Skip to content

Feature - Data Loading Indicators #1434

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

Merged
merged 4 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
added showDataLoadingIndicator property view in comps
  • Loading branch information
raheeliftikhar5 committed Jan 9, 2025
commit 07538e27b3e4ea8b56a5ca6b0be2e42959b1279f
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { defaultData } from "./jsonConstants";
import styled from "styled-components";
import { jsonValueExposingStateControl } from "comps/controls/codeStateControl";
import { ChangeEventHandlerControl } from "comps/controls/eventHandlerControl";
import { hiddenPropertyView } from "comps/utils/propertyUtils";
import { hiddenPropertyView, showDataLoadingIndicatorsPropertyView } from "comps/utils/propertyUtils";
import { trans } from "i18n";
import { LabelControl } from "comps/controls/labelControl";
import { formDataChildren, FormDataPropertyView } from "../formComp/formDataConstants";
Expand Down Expand Up @@ -155,15 +155,15 @@ let JsonEditorTmpComp = (function () {
<Section name={sectionNames.interaction}>
{children.onEvent.getPropertyView()}
{hiddenPropertyView(children)}
{showDataLoadingIndicatorsPropertyView(children)}
</Section>
)}
<Section name={trans('prop.height')}>
{children.autoHeight.propertyView({ label: trans('prop.height') })}
</Section>
{!children.autoHeight.getView()&&<Section name={sectionNames.layout}>
{children.showVerticalScrollbar.propertyView({label: trans('prop.showVerticalScrollbar')})}

</Section>}
{!children.autoHeight.getView()&&<Section name={sectionNames.layout}>
{children.showVerticalScrollbar.propertyView({label: trans('prop.showVerticalScrollbar')})}
</Section>}
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && ( children.label.getPropertyView() )}
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import styled from "styled-components";
import { BoolControl } from "comps/controls/boolControl";
import { dropdownControl } from "comps/controls/dropdownControl";
import { ArrayOrJSONObjectControl, NumberControl } from "comps/controls/codeControl";
import { hiddenPropertyView } from "comps/utils/propertyUtils";
import { hiddenPropertyView, showDataLoadingIndicatorsPropertyView } from "comps/utils/propertyUtils";
import { trans } from "i18n";
import { EditorContext } from "comps/editorState";
import { useContext, useEffect } from "react";
Expand Down Expand Up @@ -90,6 +90,7 @@ let JsonExplorerTmpComp = (function () {
<Section name={sectionNames.interaction}>
{hiddenPropertyView(children)}
{children.expandToggle.propertyView({ label: trans("jsonExplorer.expandToggle") })}
{showDataLoadingIndicatorsPropertyView(children)}
</Section>
)}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { hiddenPropertyView } from "comps/utils/propertyUtils";
import { hiddenPropertyView, showDataLoadingIndicatorsPropertyView } from "comps/utils/propertyUtils";
import {
ArrayOrJSONObjectControl,
NumberControl,
Expand Down Expand Up @@ -157,6 +157,7 @@ let JsonLottieTmpComp = (function () {
{children.animationStart.propertyView({ label: trans("jsonLottie.animationStart")})}
{children.keepLastFrame.propertyView({ label: trans("jsonLottie.keepLastFrame")})}
{hiddenPropertyView(children)}
{showDataLoadingIndicatorsPropertyView(children)}
</Section>
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { UICompBuilder, withDefault } from "../../generators";
import DateWidget from "./dateWidget";
import ErrorBoundary from "./errorBoundary";
import { Theme } from "@rjsf/antd";
import { hiddenPropertyView } from "comps/utils/propertyUtils";
import { hiddenPropertyView, showDataLoadingIndicatorsPropertyView } from "comps/utils/propertyUtils";
import { AutoHeightControl } from "../../controls/autoHeightControl";
import { useContext, useEffect, useRef, useState, createContext } from "react";
import { EditorContext } from "comps/editorState";
Expand Down Expand Up @@ -418,6 +418,7 @@ let FormBasicComp = (function () {
{children.resetAfterSubmit.propertyView({
label: trans("jsonSchemaForm.resetAfterSubmit"),
})}
{showDataLoadingIndicatorsPropertyView(children)}
</Section>
)}
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { default as Skeleton } from "antd/es/skeleton";
import { simpleMultiComp } from "comps/generators";
import { simpleMultiComp, withIsLoading } from "comps/generators";
import { withExposingConfigs } from "comps/generators/withExposing";
import { GreyTextColor } from "constants/style";
import log from "loglevel";
Expand Down Expand Up @@ -92,7 +92,8 @@ export function lazyLoadComp(
compName?: string,
compPath?: string,
loader?: LazyloadCompLoader,
loadingElement?: () => React.ReactNode
loadingElement?: () => React.ReactNode,
withoutLoading?: boolean,
) {
class LazyLoadComp extends simpleMultiComp({}) {
compValue: any;
Expand All @@ -119,6 +120,8 @@ export function lazyLoadComp(
return;
}

LazyExportedComp = withoutLoading ? LazyExportedComp : withIsLoading(LazyExportedComp);

const params: CompParams<any> = {
dispatch: this.dispatch,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ListViewImplComp } from "./listViewComp";
import { ListCompType } from "./listViewUtils";
import { useContext } from "react";
import { EditorContext } from "comps/editorState";
import { disabledPropertyView, hiddenPropertyView } from "comps/utils/propertyUtils";
import { disabledPropertyView, hiddenPropertyView, showDataLoadingIndicatorsPropertyView } from "comps/utils/propertyUtils";

type Props = {
comp: InstanceType<typeof ListViewImplComp>;
Expand Down Expand Up @@ -56,6 +56,7 @@ export function listPropertyView(compType: ListCompType) {
{(useContext(EditorContext).editorModeStatus === "logic" || useContext(EditorContext).editorModeStatus === "both") && (
<Section name={sectionNames.interaction}>
{hiddenPropertyView(children)}
{showDataLoadingIndicatorsPropertyView(children)}
</Section>
)}

Expand Down
Loading