Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature - Data Loading Indicators #1434

Merged
merged 4 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/packages/lowcoder/src/api/commonSettingApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export interface ThemeDetail {
components?: Record<string, JSONObject>;
showComponentLoadingIndicators?: boolean;
showDataLoadingIndicators?: boolean;
dataLoadingIndicator?: string;
}

export function getThemeDetailName(key: keyof ThemeDetail) {
Expand Down
3 changes: 2 additions & 1 deletion client/packages/lowcoder/src/components/ModuleLoading.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import LoadingOutlined from "@ant-design/icons/LoadingOutlined";
import { default as Spin } from "antd/es/spin";
import { GreyTextColor } from "constants/style";
import styled from "styled-components";
Expand All @@ -14,7 +15,7 @@ export const LoadingPlaceholder = styled.div`
export function ModuleLoading() {
return (
<LoadingPlaceholder>
<Spin />
<Spin indicator={<LoadingOutlined style={{ fontSize: 15 }} spin />} />
</LoadingPlaceholder>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ConfigItem, Radius, Margin, Padding, GridColumns, BorderWidth, BorderSt
import { isValidColor, isValidGradient, toHex } from "components/colorSelect/colorUtils";
import { ColorSelect } from "components/colorSelect";
import { TacoInput } from "components/tacoInput";
import { Slider, Switch } from "antd";
import { Segmented, Slider, Switch } from "antd";
import {
ExpandIcon,
CompressIcon,
Expand All @@ -28,6 +28,7 @@ export type configChangeParams = {
components?: Record<string, object>,
showComponentLoadingIndicators?: boolean;
showDataLoadingIndicators?: boolean;
dataLoadingIndicator?: string;
gridColumns?: string;
gridRowHeight?: string;
gridRowCount?: number;
Expand Down Expand Up @@ -58,6 +59,7 @@ type ColorConfigProps = {
padding?: string;
showComponentLoadingIndicators?: boolean;
showDataLoadingIndicators?: boolean;
dataLoadingIndicator?: string;
gridColumns?: string;
gridRowHeight?: string;
gridRowCount?: number;
Expand Down Expand Up @@ -87,6 +89,7 @@ export default function ThemeSettingsSelector(props: ColorConfigProps) {
fontFamily: defaultFontFamily,
showComponentLoadingIndicators: defaultShowComponentLoaders,
showDataLoadingIndicators: defaultShowDataLoaders,
dataLoadingIndicator: defaultDataLoadingIndicator,
gridColumns: defaultGridColumns,
gridRowHeight: defaultGridRowHeight,
gridRowCount: defaultGridRowCount,
Expand All @@ -110,6 +113,7 @@ export default function ThemeSettingsSelector(props: ColorConfigProps) {
const [fontFamily, setFontFamily] = useState(defaultFontFamily);
const [showComponentLoaders, setComponentLoaders] = useState(defaultShowComponentLoaders);
const [showDataLoaders, setDataLoaders] = useState(defaultShowDataLoaders);
const [dataLoadingIndicator, setDataLoadingIndicator] = useState(defaultDataLoadingIndicator);
const [gridColumns, setGridColumns] = useState(defaultGridColumns);
const [gridRowHeight, setGridRowHeight] = useState(defaultGridRowHeight);
const [gridRowCount, setGridRowCount] = useState(defaultGridRowCount);
Expand Down Expand Up @@ -346,6 +350,10 @@ export default function ThemeSettingsSelector(props: ColorConfigProps) {
setDataLoaders(defaultShowDataLoaders);
}, [defaultShowDataLoaders]);

useEffect(() => {
setDataLoadingIndicator(defaultDataLoadingIndicator);
}, [defaultDataLoadingIndicator]);

useEffect(() => {
setGridPaddingX(defaultGridPaddingX);
}, [defaultGridPaddingX]);
Expand Down Expand Up @@ -375,6 +383,7 @@ export default function ThemeSettingsSelector(props: ColorConfigProps) {
themeSettingKey !== "fontFamily" &&
themeSettingKey !== "showComponentLoadingIndicators" &&
themeSettingKey !== "showDataLoadingIndicators" &&
themeSettingKey !== "dataLoadingIndicator" &&
themeSettingKey !== "gridColumns" &&
themeSettingKey !== "gridRowHeight" &&
themeSettingKey !== "gridRowCount" &&
Expand Down Expand Up @@ -551,6 +560,25 @@ export default function ThemeSettingsSelector(props: ColorConfigProps) {
</div>
)}

{themeSettingKey === "dataLoadingIndicator" && (
<div style={{
marginTop: '6px',
}}>
<Segmented
block
value={dataLoadingIndicator}
options={[
{ value: 'spinner', label: 'Spinner' },
{ value: 'skeleton', label: 'Skeleton' },
]}
onChange={(value) => {
setDataLoadingIndicator(value)
configChange({ themeSettingKey, dataLoadingIndicator: value});
}}
/>
</div>
)}

{themeSettingKey === "gridColumns" && (
<div className="config-input">
<GridColumns $gridColumns={defaultGridColumns || "24"}>
Expand Down
3 changes: 2 additions & 1 deletion client/packages/lowcoder/src/comps/comps/avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
withExposingConfigs,
} from "comps/generators/withExposing";
import { Section, sectionNames } from "lowcoder-design";
import { hiddenPropertyView } from "comps/utils/propertyUtils";
import { hiddenPropertyView, showDataLoadingIndicatorsPropertyView } from "comps/utils/propertyUtils";
import { trans } from "i18n";
import { NumberControl } from "comps/controls/codeControl";
import { IconControl } from "comps/controls/iconControl";
Expand Down Expand Up @@ -253,6 +253,7 @@ let AvatarBasicComp = (function () {
{<BadgeBasicSection {...children} />}
<Section name={sectionNames.interaction}>
{children.onEvent.getPropertyView()}
{showDataLoadingIndicatorsPropertyView(children)}
</Section>
<Section name={sectionNames.layout}>
{hiddenPropertyView(children)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
hiddenPropertyView,
disabledPropertyView,
loadingPropertyView,
showDataLoadingIndicatorsPropertyView,
} from "comps/utils/propertyUtils";
import { trans } from "i18n";
import { IconControl } from "comps/controls/iconControl";
Expand Down Expand Up @@ -129,6 +130,7 @@ const LinkTmpComp = (function () {
{disabledPropertyView(children)}
{hiddenPropertyView(children)}
{loadingPropertyView(children)}
{showDataLoadingIndicatorsPropertyView(children)}
</Section>
<Section name={sectionNames.advanced}>
{children.prefixIcon.propertyView({ label: trans("button.prefixIcon") })}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { UICompBuilder } from "comps/generators/uiCompBuilder";
import { CustomModal, Section, sectionNames } from "lowcoder-design";
import styled from "styled-components";
import { CommonNameConfig, NameConfig, withExposingConfigs } from "../../generators/withExposing";
import { hiddenPropertyView, disabledPropertyView } from "comps/utils/propertyUtils";
import { hiddenPropertyView, disabledPropertyView, showDataLoadingIndicatorsPropertyView } from "comps/utils/propertyUtils";
import { trans } from "i18n";
import React, { Suspense, useEffect, useRef, useState, useContext } from "react";
import { arrayStringExposingStateControl } from "comps/controls/codeStateControl";
Expand Down Expand Up @@ -223,6 +223,7 @@ const ScannerTmpComp = (function () {
{children.onEvent.getPropertyView()}
{disabledPropertyView(children)}
{hiddenPropertyView(children)}
{showDataLoadingIndicatorsPropertyView(children)}
</Section>
<Section name={sectionNames.advanced}>
{children.continuous.propertyView({ label: trans("scanner.continuous") })}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
disabledPropertyView,
hiddenPropertyView,
loadingPropertyView,
showDataLoadingIndicatorsPropertyView,
} from "comps/utils/propertyUtils";
import { Section, sectionNames } from "lowcoder-design";
import { trans } from "i18n";
Expand Down Expand Up @@ -109,6 +110,7 @@ const ToggleTmpComp = (function () {
{disabledPropertyView(children)}
{hiddenPropertyView(children)}
{loadingPropertyView(children)}
{showDataLoadingIndicatorsPropertyView(children)}
</Section>
<Section name={sectionNames.advanced}>
{children.showText.propertyView({ label: trans("toggleButton.showText") })}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { UICompBuilder, withDefault } from "../../generators";
// Right-side attribute subframe
import { Section, sectionNames } from "lowcoder-design";
// Switch indicating whether the component is hidden or not
import { hiddenPropertyView } from "comps/utils/propertyUtils";
import { hiddenPropertyView, showDataLoadingIndicatorsPropertyView } from "comps/utils/propertyUtils";
// Right property switch
import { BoolControl } from "comps/controls/boolControl";
import { styleControl } from "comps/controls/styleControl"; //样式输入框
Expand Down Expand Up @@ -406,6 +406,7 @@ let CommentBasicComp = (function () {
{children.deleteAble.propertyView({
label: trans("comment.deleteAble"),
})}
{showDataLoadingIndicatorsPropertyView(children)}
</Section>
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { TriContainer } from "../triContainerComp/triContainer";
import {
ContainerCompBuilder,
} from "../triContainerComp/triContainerCompBuilder";
import { disabledPropertyView, hiddenPropertyView } from "comps/utils/propertyUtils";
import { disabledPropertyView, hiddenPropertyView, showDataLoadingIndicatorsPropertyView } from "comps/utils/propertyUtils";
import { trans } from "i18n";
import { BoolCodeControl, StringControl } from "comps/controls/codeControl";
import { BoolControl } from "comps/controls/boolControl";
Expand Down Expand Up @@ -318,8 +318,9 @@ export const ContainerBaseComp = (function () {

</Section>
<Section name={sectionNames.interaction}>
{hiddenPropertyView(children)}
{children.onEvent.getPropertyView()}
{hiddenPropertyView(children)}
{showDataLoadingIndicatorsPropertyView(children)}
</Section>
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useEffect, useRef, useContext } from "react";
import styled from "styled-components";
import { getPromiseAfterDispatch } from "util/promiseUtils";
import { EventData, EventTypeEnum } from "./types";
import { hiddenPropertyView } from "comps/utils/propertyUtils";
import { hiddenPropertyView, showDataLoadingIndicatorsPropertyView } from "comps/utils/propertyUtils";
import { trans } from "i18n";
import { EditorContext } from "comps/editorState";
import { AnimationStyle, AnimationStyleType, CustomStyle, CustomStyleType } from "@lowcoder-ee/comps/controls/styleControlConstants";
Expand Down Expand Up @@ -244,6 +244,7 @@ const CustomCompBase = new UICompBuilder(childrenMap, (props, dispatch) => {
{children.model.propertyView({ label: trans("customComp.data") })}
{children.code.propertyView({ label: trans("customComp.code"), language: "html" })}
{hiddenPropertyView(children)}
{showDataLoadingIndicatorsPropertyView(children)}
</Section>
<Section name={sectionNames.style}>
{children.style.getPropertyView()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
minuteStepPropertyView,
requiredPropertyView,
SecondStepPropertyView,
showDataLoadingIndicatorsPropertyView,
} from "comps/utils/propertyUtils";
import { trans } from "i18n";
import { DATE_FORMAT, DATE_TIME_FORMAT, DateParser, PickerMode } from "util/dateTimeUtils";
Expand Down Expand Up @@ -272,6 +273,7 @@ const DatePickerTmpCmp = new UICompBuilder(childrenMap, (props) => {
{children.onEvent.getPropertyView()}
{disabledPropertyView(children)}
{hiddenPropertyView(children)}
{showDataLoadingIndicatorsPropertyView(children)}
</Section>
</>
)}
Expand Down Expand Up @@ -480,6 +482,7 @@ let DateRangeTmpCmp = (function () {
{children.onEvent.getPropertyView()}
{disabledPropertyView(children)}
{hiddenPropertyView(children)}
{showDataLoadingIndicatorsPropertyView(children)}
</Section>
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {
minuteStepPropertyView,
requiredPropertyView,
SecondStepPropertyView,
showDataLoadingIndicatorsPropertyView,
} from "comps/utils/propertyUtils";
import { trans } from "i18n";
import { TIME_FORMAT, TimeParser } from "util/dateTimeUtils";
Expand Down Expand Up @@ -240,6 +241,7 @@ const TimePickerTmpCmp = new UICompBuilder(childrenMap, (props) => {
{children.onEvent.getPropertyView()}
{disabledPropertyView(children)}
{hiddenPropertyView(children)}
{showDataLoadingIndicatorsPropertyView(children)}
</Section></>
)}

Expand Down Expand Up @@ -411,6 +413,7 @@ const TimeRangeTmpCmp = (function () {
{children.onEvent.getPropertyView()}
{disabledPropertyView(children)}
{hiddenPropertyView(children)}
{showDataLoadingIndicatorsPropertyView(children)}
</Section></>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { AnimationStyle, AnimationStyleType, FileStyle, FileStyleType, heightCal
import { withMethodExposing } from "comps/generators/withMethodExposing";
import { hasIcon } from "comps/utils";
import { getComponentDocUrl } from "comps/utils/compDocUtil";
import { disabledPropertyView, hiddenPropertyView } from "comps/utils/propertyUtils";
import { disabledPropertyView, hiddenPropertyView, showDataLoadingIndicatorsPropertyView } from "comps/utils/propertyUtils";
import { trans } from "i18n";
import _ from "lodash";
import mime from "mime";
Expand Down Expand Up @@ -644,6 +644,7 @@ let FileTmpComp = new UICompBuilder(childrenMap, (props, dispatch) => {
{children.onEvent.getPropertyView()}
{disabledPropertyView(children)}
{hiddenPropertyView(children)}
{showDataLoadingIndicatorsPropertyView(children)}
</Section>
<Section name={sectionNames.advanced}>
{children.fileType.propertyView({
Expand Down
3 changes: 2 additions & 1 deletion client/packages/lowcoder/src/comps/comps/fileViewerComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Section, sectionNames } from "lowcoder-design";
import { StringControl } from "../controls/codeControl";
import { UICompBuilder, withDefault } from "../generators";
import { NameConfig, NameConfigHidden, withExposingConfigs } from "../generators/withExposing";
import { hiddenPropertyView } from "comps/utils/propertyUtils";
import { hiddenPropertyView, showDataLoadingIndicatorsPropertyView } from "comps/utils/propertyUtils";
import { trans } from "i18n";
import { useContext } from "react";
import { EditorContext } from "comps/editorState";
Expand Down Expand Up @@ -112,6 +112,7 @@ let FileViewerBasicComp = (function () {
{["logic", "both"].includes(useContext(EditorContext).editorModeStatus) && (
<Section name={sectionNames.interaction}>
{hiddenPropertyView(children)}
{showDataLoadingIndicatorsPropertyView(children)}
</Section>
)}
<Section name={sectionNames.layout}>
Expand Down
5 changes: 4 additions & 1 deletion client/packages/lowcoder/src/comps/comps/gridItemComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ const TmpComp = withTypeAndChildren<
return lazyLoadComp(
manifest.compName,
manifest.compPath,
);
undefined,
undefined,
manifest.withoutLoading,
)
}
const comp = manifest.withoutLoading ? manifest.comp : withIsLoading(manifest.comp!);
return withErrorBoundary(comp!) as ExposingMultiCompConstructor;
Expand Down
3 changes: 2 additions & 1 deletion client/packages/lowcoder/src/comps/comps/iconComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
withExposingConfigs,
} from "comps/generators/withExposing";
import { Section, sectionNames } from "lowcoder-design";
import { hiddenPropertyView } from "comps/utils/propertyUtils";
import { hiddenPropertyView, showDataLoadingIndicatorsPropertyView } from "comps/utils/propertyUtils";
import { trans } from "i18n";
import { NumberControl } from "comps/controls/codeControl";
import { IconControl } from "comps/controls/iconControl";
Expand Down Expand Up @@ -128,6 +128,7 @@ let IconBasicComp = (function () {
<Section name={sectionNames.interaction}>
{children.onEvent.getPropertyView()}
{hiddenPropertyView(children)}
{showDataLoadingIndicatorsPropertyView(children)}
</Section>
)}

Expand Down
3 changes: 2 additions & 1 deletion client/packages/lowcoder/src/comps/comps/iframeComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import styled from "styled-components";
import { NameConfig, NameConfigHidden, withExposingConfigs } from "../generators/withExposing";
import { styleControl } from "comps/controls/styleControl";
import { AnimationStyle, AnimationStyleType, IframeStyle, IframeStyleType } from "comps/controls/styleControlConstants";
import { hiddenPropertyView } from "comps/utils/propertyUtils";
import { hiddenPropertyView, showDataLoadingIndicatorsPropertyView } from "comps/utils/propertyUtils";
import { trans } from "i18n";
import log from "loglevel";

Expand Down Expand Up @@ -81,6 +81,7 @@ let IFrameCompBase = new UICompBuilder(
{children.allowMicrophone.propertyView({ label: trans("iframe.allowMicrophone") })}
{children.allowCamera.propertyView({ label: trans("iframe.allowCamera") })}
{children.allowPopup.propertyView({ label: trans("iframe.allowPopup") })}
{showDataLoadingIndicatorsPropertyView(children)}
</Section>
)}

Expand Down
3 changes: 2 additions & 1 deletion client/packages/lowcoder/src/comps/comps/imageComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
heightCalculator,
widthCalculator,
} from "comps/controls/styleControlConstants";
import { hiddenPropertyView } from "comps/utils/propertyUtils";
import { hiddenPropertyView, showDataLoadingIndicatorsPropertyView } from "comps/utils/propertyUtils";
import { trans } from "i18n";
import { AutoHeightControl } from "comps/controls/autoHeightControl";
import { BoolControl } from "comps/controls/boolControl";
Expand Down Expand Up @@ -190,6 +190,7 @@ let ImageBasicComp = new UICompBuilder(childrenMap, (props) => {
<Section name={sectionNames.interaction}>
{children.onEvent.getPropertyView()}
{hiddenPropertyView(children)}
{showDataLoadingIndicatorsPropertyView(children)}
{children.supportPreview.propertyView({
label: trans("image.supportPreview"),
tooltip: trans("image.supportPreviewTip"),
Expand Down
Loading
Loading