@wavemaker-ai/react-runtime 1.0.0-rc.322 → 1.0.0-rc.324
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions/login-action.js +1 -1
- package/components/advanced/carousel/index.d.ts +1 -0
- package/components/advanced/carousel/template.d.ts +1 -0
- package/components/advanced/login/index.d.ts +1 -0
- package/components/advanced/marquee/index.d.ts +1 -0
- package/components/basic/anchor/index.d.ts +1 -0
- package/components/basic/anchor/index.js +16 -14
- package/components/basic/audio/index.d.ts +1 -0
- package/components/basic/html/index.d.ts +1 -0
- package/components/basic/icon/index.d.ts +1 -0
- package/components/basic/icon/index.js +13 -16
- package/components/basic/iframe/index.d.ts +1 -0
- package/components/basic/label/index.d.ts +1 -0
- package/components/basic/label/index.js +5 -3
- package/components/basic/label/props.d.ts +1 -1
- package/components/basic/picture/index.d.ts +1 -0
- package/components/basic/picture/index.js +3 -2
- package/components/basic/progress-bar/index.d.ts +1 -0
- package/components/basic/progress-circle/index.d.ts +1 -0
- package/components/basic/richtexteditor/index.d.ts +2 -0
- package/components/basic/search/index.d.ts +6 -0
- package/components/basic/search/index.js +69 -9
- package/components/basic/search/props.d.ts +4 -0
- package/components/basic/spinner/index.d.ts +2 -0
- package/components/basic/spinner/index.js +11 -9
- package/components/basic/spinner/props.d.ts +5 -0
- package/components/basic/tile/index.d.ts +1 -0
- package/components/basic/tree/index.d.ts +1 -0
- package/components/basic/video/index.d.ts +1 -0
- package/components/chart/index.d.ts +2 -0
- package/components/chart/props.d.ts +1 -0
- package/components/chart/src/chart.js +12 -1
- package/components/chart/src/types.d.ts +2 -0
- package/components/common/WmAppIcon/index.d.ts +15 -0
- package/components/common/WmAppIcon/index.js +130 -0
- package/components/common/WmAppIcon/props.d.ts +17 -0
- package/components/common/WmAppIcon/props.js +0 -0
- package/components/common/index.d.ts +3 -1
- package/components/common/index.js +10 -2
- package/components/common/wm-skeleton.d.ts +7 -0
- package/components/common/wm-skeleton.js +11 -1
- package/components/container/accordion/accordion-pane/index.d.ts +2 -0
- package/components/container/accordion/accordion-pane/index.js +10 -1
- package/components/container/accordion/accordion-pane/props.d.ts +1 -0
- package/components/container/accordion/index.d.ts +1 -0
- package/components/container/accordion/index.js +2 -2
- package/components/container/index.d.ts +1 -0
- package/components/container/layout-grid/grid-column/index.d.ts +1 -0
- package/components/container/layout-grid/grid-row/index.d.ts +1 -0
- package/components/container/layout-grid/index.d.ts +1 -0
- package/components/container/linear-layout/index.d.ts +1 -0
- package/components/container/linear-layout/linear-layout-item/index.d.ts +1 -0
- package/components/container/panel/components/panel-header/index.js +16 -16
- package/components/container/panel/index.d.ts +1 -0
- package/components/container/repeat-template/index.d.ts +1 -0
- package/components/container/tabs/index.d.ts +1 -0
- package/components/container/tabs/index.js +18 -18
- package/components/container/tabs/props.d.ts +1 -0
- package/components/container/tabs/tab-pane/index.d.ts +2 -0
- package/components/container/tabs/tab-pane/index.js +2 -0
- package/components/container/tabs/tab-pane/props.d.ts +1 -0
- package/components/container/wizard/components/StepComponents.js +14 -6
- package/components/container/wizard/index.d.ts +2 -0
- package/components/container/wizard/index.js +2 -2
- package/components/container/wizard/props.d.ts +4 -0
- package/components/container/wizard/wizard-step/index.d.ts +1 -0
- package/components/container/wizard/wizard-step/index.js +6 -0
- package/components/data/card/card-actions/index.d.ts +1 -0
- package/components/data/card/card-content/index.d.ts +1 -0
- package/components/data/card/card-footer/index.d.ts +1 -0
- package/components/data/card/index.d.ts +1 -0
- package/components/data/card/index.js +13 -6
- package/components/data/form/dynamic-fields/index.js +1 -0
- package/components/data/form/form-action/index.d.ts +2 -0
- package/components/data/form/form-action/index.js +6 -4
- package/components/data/form/form-field/index.js +5 -4
- package/components/data/form/form-header/index.d.ts +1 -1
- package/components/data/form/form-header/index.js +10 -1
- package/components/data/form/index.js +5 -3
- package/components/data/form/props.d.ts +1 -0
- package/components/data/list/components/ListHeader.js +19 -3
- package/components/data/list/components/ListItemWithTemplate.js +5 -1
- package/components/data/list/components/ListItems.d.ts +1 -1
- package/components/data/list/components/ListItems.js +5 -1
- package/components/data/list/components/LoadMoreButton.js +14 -2
- package/components/data/list/components/StandardListItems.js +1 -1
- package/components/data/list/components/props.d.ts +11 -5
- package/components/data/list/hooks/props.d.ts +2 -2
- package/components/data/list/hooks/useListEventHandlers.js +3 -2
- package/components/data/list/index.d.ts +5 -1
- package/components/data/list/index.js +17 -4
- package/components/data/list/props.d.ts +14 -2
- package/components/data/list/utils/list-helpers.d.ts +5 -1
- package/components/data/list/utils/list-helpers.js +10 -0
- package/components/data/pagination/components/PageSizeSelector.js +49 -155
- package/components/data/pagination/hooks/usePagination.js +24 -1
- package/components/data/table/components/RowCells.js +1 -1
- package/components/data/table/components/TableDataRow.js +16 -3
- package/components/data/table/components/TableHeader.js +1 -1
- package/components/data/table/components/TablePanelHeading.js +14 -2
- package/components/data/table/hooks/useResponsiveColumns.d.ts +1 -0
- package/components/data/table/hooks/useTableColumns.js +2 -2
- package/components/data/table/hooks/useTableData.js +30 -1
- package/components/data/table/index.d.ts +4 -0
- package/components/data/table/index.js +47 -30
- package/components/data/table/live-table/index.d.ts +1 -0
- package/components/data/table/props.d.ts +11 -2
- package/components/data/table/table-action/index.d.ts +1 -0
- package/components/data/table/table-column/index.d.ts +1 -0
- package/components/data/table/table-row/index.d.ts +1 -0
- package/components/data/table/table-row-action/index.d.ts +1 -0
- package/components/data/table/utils/buildSelectionColumns.d.ts +1 -1
- package/components/data/table/utils/buildSelectionColumns.js +97 -71
- package/components/data/table/utils/columnBuilder.d.ts +13 -0
- package/components/data/table/utils/columnBuilder.js +27 -18
- package/components/data/table/utils/columnWidthDistribution.d.ts +1 -1
- package/components/data/table/utils/columnWidthDistribution.js +4 -1
- package/components/data/table/utils/constants.d.ts +1 -1
- package/components/data/table/utils/constants.js +1 -1
- package/components/dialogs/alert-dialog/index.d.ts +2 -0
- package/components/dialogs/confirm-dialog/index.d.ts +2 -0
- package/components/dialogs/dialog/index.d.ts +2 -0
- package/components/dialogs/dialog-actions/index.d.ts +1 -0
- package/components/dialogs/dialog-body/index.d.ts +1 -0
- package/components/dialogs/dialog-content/index.d.ts +1 -0
- package/components/dialogs/dialog-header/index.d.ts +1 -0
- package/components/dialogs/dialog-header/index.js +11 -12
- package/components/dialogs/iframe-dialog/index.d.ts +2 -0
- package/components/dialogs/login-dialog/index.d.ts +4 -0
- package/components/dialogs/login-dialog/index.js +2 -1
- package/components/dialogs/login-dialog/props.d.ts +1 -0
- package/components/dialogs/page-dialog/index.d.ts +4 -0
- package/components/dialogs/page-dialog/index.js +2 -1
- package/components/dialogs/page-dialog/props.d.ts +1 -0
- package/components/form/button/index.d.ts +1 -0
- package/components/form/button/index.js +29 -33
- package/components/form/button-group/index.d.ts +1 -0
- package/components/input/calendar/index.d.ts +2 -0
- package/components/input/chips/index.d.ts +2 -0
- package/components/input/chips/index.js +9 -3
- package/components/input/chips/utils.d.ts +5 -0
- package/components/input/chips/utils.js +29 -0
- package/components/input/color-picker/index.d.ts +2 -0
- package/components/input/composite/index.d.ts +1 -0
- package/components/input/composite/index.js +1 -0
- package/components/input/currency/index.d.ts +2 -0
- package/components/input/default/checkbox/index.d.ts +6 -0
- package/components/input/default/checkbox/index.js +48 -18
- package/components/input/default/checkbox/props.d.ts +8 -0
- package/components/input/default/checkboxset/index.d.ts +2 -0
- package/components/input/default/radioset/index.d.ts +2 -0
- package/components/input/default/switch/index.d.ts +6 -0
- package/components/input/default/switch/index.js +36 -9
- package/components/input/default/switch/prop.d.ts +2 -0
- package/components/input/epoch/date/index.d.ts +1 -0
- package/components/input/epoch/datetime/index.d.ts +1 -0
- package/components/input/epoch/time/index.d.ts +1 -0
- package/components/input/fileupload/components/ListItems.d.ts +5 -1
- package/components/input/fileupload/components/ListItems.js +27 -5
- package/components/input/fileupload/components/MultiUpload.js +12 -1
- package/components/input/fileupload/components/SingleUpload.js +12 -1
- package/components/input/fileupload/index.d.ts +3 -0
- package/components/input/fileupload/index.js +11 -0
- package/components/input/fileupload/props.d.ts +10 -0
- package/components/input/number/index.d.ts +2 -0
- package/components/input/rating/index.d.ts +6 -0
- package/components/input/rating/index.js +10 -5
- package/components/input/rating/props.d.ts +8 -0
- package/components/input/select/index.d.ts +2 -0
- package/components/input/slider/index.d.ts +6 -0
- package/components/input/slider/index.js +19 -2
- package/components/input/slider/props.d.ts +2 -0
- package/components/input/text/index.d.ts +7 -1
- package/components/input/text/index.js +25 -6
- package/components/input/text/props.d.ts +8 -0
- package/components/input/textarea/index.d.ts +2 -0
- package/components/input/textarea/index.js +9 -4
- package/components/input/textarea/util.d.ts +1 -0
- package/components/input/textarea/util.js +17 -0
- package/components/input/upload/index.d.ts +2 -0
- package/components/navbar/index.d.ts +7 -0
- package/components/navbar/index.js +21 -7
- package/components/navbar/nav/index.d.ts +1 -0
- package/components/navbar/nav-item/index.d.ts +1 -0
- package/components/navigation/breadcrumb/index.d.ts +1 -0
- package/components/navigation/menu/index.d.ts +3 -1
- package/components/navigation/menu/index.js +22 -4
- package/components/navigation/menu/props.d.ts +1 -0
- package/components/navigation/popover/index.d.ts +1 -0
- package/components/navigation/popover/index.js +8 -2
- package/components/page/partial/index.d.ts +1 -0
- package/core/appstore.d.ts +10 -0
- package/core/appstore.js +9 -1
- package/core/constants/events.d.ts +3 -0
- package/core/constants/events.js +13 -1
- package/core/proxy-service.js +1 -1
- package/core/util/index.d.ts +2 -0
- package/core/util/index.js +29 -0
- package/higherOrder/BasePage.js +81 -26
- package/higherOrder/props.d.ts +1 -0
- package/higherOrder/useActivePageReactivity.d.ts +21 -0
- package/higherOrder/useActivePageReactivity.js +57 -0
- package/higherOrder/withBaseWrapper.js +2 -0
- package/higherOrder/withRenderLogger.d.ts +15 -0
- package/higherOrder/withRenderLogger.js +53 -0
- package/hooks/useAuth.js +7 -1
- package/package-lock.json +219 -198
- package/package.json +4 -3
- package/runtime-dynamic/factories/dynamic-component.js +18 -5
- package/runtime-dynamic/factories/utils.js +7 -1
- package/runtime-dynamic/services/compile-render.js +2 -1
- package/store/slices/i18nSlice.d.ts +2 -0
- package/store/slices/i18nSlice.js +3 -1
- package/types/index.d.ts +6 -0
- package/utils/attr.js +4 -1
- package/utils/svg-icon.d.ts +27 -0
- package/utils/svg-icon.js +75 -0
|
@@ -35,7 +35,7 @@ const StandardListItems = ({
|
|
|
35
35
|
const itemId = getItemId(item, globalIndex);
|
|
36
36
|
const isFirst = index === 0;
|
|
37
37
|
const isLast = index === currentItems.length - 1;
|
|
38
|
-
const isActive = (Array.isArray(activeItems) || activeItems instanceof Set) && some(Array.from(activeItems), (active) => active._wmListItemId === item._wmListItemId);
|
|
38
|
+
const isActive = (Array.isArray(activeItems) || activeItems instanceof Set) && some(Array.from(activeItems), (active) => active._wmListItemId && item._wmListItemId && active._wmListItemId === item._wmListItemId);
|
|
39
39
|
return /* @__PURE__ */ jsx(
|
|
40
40
|
ListItemWithTemplate,
|
|
41
41
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { GroupedDataItem } from "../hooks";
|
|
3
|
-
import { INavigation, IDirection, IAlignment, ListItemData, ListPaginationChangeHandler, ListSetRecordHandler, ListBeforeDataRenderHandler } from "../props";
|
|
3
|
+
import { INavigation, IDirection, IAlignment, DisableItemProp, ListItemData, ListPaginationChangeHandler, ListSetRecordHandler, ListBeforeDataRenderHandler } from "../props";
|
|
4
4
|
import { DragEndEvent } from "@dnd-kit/core";
|
|
5
5
|
export type DefaultEventHandler<T = ListItemData> = (event: React.MouseEvent, item: T) => void;
|
|
6
6
|
export interface ListPaginationProps {
|
|
@@ -58,7 +58,7 @@ export interface ListItemsProps<T = ListItemData> {
|
|
|
58
58
|
orderby?: string;
|
|
59
59
|
startIndex?: number;
|
|
60
60
|
endIndex?: number;
|
|
61
|
-
disableitem:
|
|
61
|
+
disableitem: DisableItemProp<T>;
|
|
62
62
|
itemclass: string | ((item: T) => string | null | undefined);
|
|
63
63
|
itemsPerRowClass: string;
|
|
64
64
|
direction: IDirection;
|
|
@@ -71,9 +71,11 @@ export interface ListItemsProps<T = ListItemData> {
|
|
|
71
71
|
nodatamessage: string;
|
|
72
72
|
ondemandmessage: string;
|
|
73
73
|
loadingicon: string;
|
|
74
|
+
loadingiconurl?: string;
|
|
74
75
|
loadingdatamsg: string;
|
|
75
76
|
paginationclass: string;
|
|
76
77
|
isLoadingMore: boolean;
|
|
78
|
+
prefabName?: string;
|
|
77
79
|
collapsible: boolean;
|
|
78
80
|
showcount: boolean;
|
|
79
81
|
groupCollapsed: Record<string, boolean>;
|
|
@@ -102,6 +104,8 @@ export interface ListHeaderProps {
|
|
|
102
104
|
title?: string;
|
|
103
105
|
subheading?: string;
|
|
104
106
|
iconclass?: string;
|
|
107
|
+
iconurl?: string;
|
|
108
|
+
prefabName?: string;
|
|
105
109
|
}
|
|
106
110
|
export interface ListTemplateProps {
|
|
107
111
|
children: React.ReactNode;
|
|
@@ -128,9 +132,11 @@ export interface LoadMoreButtonProps {
|
|
|
128
132
|
paginationclass: string;
|
|
129
133
|
isLoadingMore: boolean;
|
|
130
134
|
loadingicon: string;
|
|
135
|
+
loadingiconurl?: string;
|
|
131
136
|
loadingdatamsg: string;
|
|
132
137
|
ondemandmessage: string;
|
|
133
138
|
onLoadMore: () => void;
|
|
139
|
+
prefabName?: string;
|
|
134
140
|
}
|
|
135
141
|
export interface GroupHeaderProps {
|
|
136
142
|
groupKey: string;
|
|
@@ -155,7 +161,7 @@ export interface ListItemWithTemplateProps<T extends ListItemData = ListItemData
|
|
|
155
161
|
itemId: string;
|
|
156
162
|
isFirst: boolean;
|
|
157
163
|
isLast: boolean;
|
|
158
|
-
disableitem:
|
|
164
|
+
disableitem: DisableItemProp<T>;
|
|
159
165
|
itemclass: string | ((item: T, index?: number) => string | null | undefined);
|
|
160
166
|
itemsPerRowClass: string;
|
|
161
167
|
name: string;
|
|
@@ -177,7 +183,7 @@ export interface StandardListItemsProps<T extends ListItemData = ListItemData> {
|
|
|
177
183
|
currentPageItems: CurrentPageItemsResult<T>;
|
|
178
184
|
direction: string;
|
|
179
185
|
enablereorder: boolean;
|
|
180
|
-
disableitem:
|
|
186
|
+
disableitem: DisableItemProp<T>;
|
|
181
187
|
itemclass: string | ((item: T, index?: number) => string | null | undefined);
|
|
182
188
|
itemsPerRowClass: string;
|
|
183
189
|
name: string;
|
|
@@ -198,7 +204,7 @@ export interface GroupedListItemsProps<T extends ListItemData = ListItemData> {
|
|
|
198
204
|
groupedData: GroupedDataItem<T>[];
|
|
199
205
|
paginatedGroupedData: PaginatedGroupedDataItem<T>[];
|
|
200
206
|
direction: string;
|
|
201
|
-
disableitem:
|
|
207
|
+
disableitem: DisableItemProp<T>;
|
|
202
208
|
itemclass: string | ((item: T, index?: number) => string | null | undefined);
|
|
203
209
|
itemsPerRowClass: string;
|
|
204
210
|
name: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { DefaultEventHandler, IPaginationMeta } from "../components/props";
|
|
3
|
-
import { WmListProps, ListItemData, ListPaginationChangeHandler, ListSetRecordHandler, ListItemEventHandler, ListSelectHandler } from "../props";
|
|
3
|
+
import { WmListProps, DisableItemProp, ListItemData, ListPaginationChangeHandler, ListSetRecordHandler, ListItemEventHandler, ListSelectHandler } from "../props";
|
|
4
4
|
export interface GroupedDataItem<T = ListItemData> {
|
|
5
5
|
key: string;
|
|
6
6
|
data: T[];
|
|
@@ -11,7 +11,7 @@ export type UseListDataProps<T = ListItemData> = Pick<WmListProps<T>, "datafield
|
|
|
11
11
|
export interface UseListEventHandlersProps<T extends ListItemData = ListItemData> {
|
|
12
12
|
items: T[];
|
|
13
13
|
multiselect: boolean;
|
|
14
|
-
disableitem:
|
|
14
|
+
disableitem: DisableItemProp<T>;
|
|
15
15
|
selectionlimit: number;
|
|
16
16
|
collapsible: boolean;
|
|
17
17
|
selectedItems: T[];
|
|
@@ -19,7 +19,7 @@ var __spreadValues = (a, b) => {
|
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
import { useCallback, useRef, useEffect } from "react";
|
|
21
21
|
import { findIndex, includes, filter, slice, min, max } from "lodash-es";
|
|
22
|
-
import { getSelectedItemWidgets } from "../utils/list-helpers";
|
|
22
|
+
import { getSelectedItemWidgets, resolveDisableItem } from "../utils/list-helpers";
|
|
23
23
|
import { useWidgetProxy } from "../../../../context/WidgetProvider";
|
|
24
24
|
import { setWidgetIndex, setWidgetPageIndex, setWidgetItem } from "../utils/widget-instance-utils";
|
|
25
25
|
const useListEventHandlers = (props) => {
|
|
@@ -82,7 +82,8 @@ const useListEventHandlers = (props) => {
|
|
|
82
82
|
);
|
|
83
83
|
const handleListItemClick = useCallback(
|
|
84
84
|
(event, item) => {
|
|
85
|
-
|
|
85
|
+
const itemIndex = findIndex(items, (i) => i === item);
|
|
86
|
+
if (resolveDisableItem(disableitem, item, itemIndex)) return;
|
|
86
87
|
const selectCount = selectedItems.length;
|
|
87
88
|
const isItemSelected = includes(selectedItems, item);
|
|
88
89
|
const isItemActive = activeItems.has(item);
|
|
@@ -8,10 +8,11 @@ declare const WmListStandalone: React.ComponentType<{
|
|
|
8
8
|
dataset?: any;
|
|
9
9
|
datasource?: import("../../../variables/live-variable").LiveVariableConfig;
|
|
10
10
|
direction?: import("./props").IDirection;
|
|
11
|
-
disableitem?:
|
|
11
|
+
disableitem?: import("./props").DisableItemProp<ListItemData>;
|
|
12
12
|
enablereorder?: boolean;
|
|
13
13
|
groupby?: string;
|
|
14
14
|
iconclass?: string;
|
|
15
|
+
iconurl?: string;
|
|
15
16
|
itemclass?: string | ((item: ListItemData) => string | null | undefined);
|
|
16
17
|
itemsperrow?: string;
|
|
17
18
|
listclass?: string;
|
|
@@ -21,6 +22,7 @@ declare const WmListStandalone: React.ComponentType<{
|
|
|
21
22
|
loadingdatamsg?: string;
|
|
22
23
|
skeletonRows?: number;
|
|
23
24
|
loadingicon?: string;
|
|
25
|
+
loadingiconurl?: string;
|
|
24
26
|
maxsize?: number;
|
|
25
27
|
statehandler?: StorageType;
|
|
26
28
|
navigation?: import("./props").INavigation;
|
|
@@ -115,6 +117,7 @@ declare const WmListStandalone: React.ComponentType<{
|
|
|
115
117
|
formfield?: boolean;
|
|
116
118
|
updateon?: string;
|
|
117
119
|
showSkeleton?: boolean;
|
|
120
|
+
widget?: string;
|
|
118
121
|
} & import("@wavemaker-ai/react-runtime/higherOrder/withStandalone").WithStandaloneProps>;
|
|
119
122
|
export { WmListStandalone as WmList };
|
|
120
123
|
/**
|
|
@@ -178,5 +181,6 @@ declare const _default: React.ComponentType<{
|
|
|
178
181
|
prefabName?: string;
|
|
179
182
|
loading?: boolean;
|
|
180
183
|
showSkeleton?: boolean;
|
|
184
|
+
widget?: string;
|
|
181
185
|
}>;
|
|
182
186
|
export default _default;
|
|
@@ -37,7 +37,7 @@ import { AppSpinner } from "../../common";
|
|
|
37
37
|
import {
|
|
38
38
|
WmSkeleton,
|
|
39
39
|
SKELETON_REGISTRY,
|
|
40
|
-
|
|
40
|
+
useShouldShowSkeleton
|
|
41
41
|
} from "../../common/wm-skeleton";
|
|
42
42
|
import {
|
|
43
43
|
useListData,
|
|
@@ -122,9 +122,11 @@ const WmList = (props) => {
|
|
|
122
122
|
title = "",
|
|
123
123
|
subheading = "",
|
|
124
124
|
iconclass = "",
|
|
125
|
+
iconurl,
|
|
125
126
|
nodatamessage = LIST_MESSAGES.NO_DATA,
|
|
126
127
|
loadingdatamsg = LIST_MESSAGES.LOADING,
|
|
127
|
-
loadingicon = "fa-
|
|
128
|
+
loadingicon = "fa fa-circle-o-notch",
|
|
129
|
+
loadingiconurl,
|
|
128
130
|
ondemandmessage = LIST_MESSAGES.LOAD_MORE,
|
|
129
131
|
// Styling Classes
|
|
130
132
|
listclass = "list-group media-list",
|
|
@@ -490,7 +492,7 @@ const WmList = (props) => {
|
|
|
490
492
|
}),
|
|
491
493
|
[direction, wrap, alignment, gap, columngap]
|
|
492
494
|
);
|
|
493
|
-
if (
|
|
495
|
+
if (useShouldShowSkeleton(props.loading, props.showSkeleton))
|
|
494
496
|
return /* @__PURE__ */ jsx(
|
|
495
497
|
WmSkeleton,
|
|
496
498
|
__spreadProps(__spreadValues({}, SKELETON_REGISTRY["WmList"]), {
|
|
@@ -515,7 +517,16 @@ const WmList = (props) => {
|
|
|
515
517
|
"data-navigation": navigation,
|
|
516
518
|
ref: ListWrapperRef,
|
|
517
519
|
children: [
|
|
518
|
-
/* @__PURE__ */ jsx(
|
|
520
|
+
/* @__PURE__ */ jsx(
|
|
521
|
+
ListHeader,
|
|
522
|
+
{
|
|
523
|
+
title,
|
|
524
|
+
subheading,
|
|
525
|
+
iconclass,
|
|
526
|
+
iconurl,
|
|
527
|
+
prefabName: props.prefabName
|
|
528
|
+
}
|
|
529
|
+
),
|
|
519
530
|
/* @__PURE__ */ jsx(AppSpinner, { show: (_e = datasource == null ? void 0 : datasource.loading) != null ? _e : false, spinnermessages: [loadingdatamsg] }),
|
|
520
531
|
/* @__PURE__ */ jsxs(
|
|
521
532
|
InlineNavigation,
|
|
@@ -570,9 +581,11 @@ const WmList = (props) => {
|
|
|
570
581
|
nodatamessage,
|
|
571
582
|
ondemandmessage,
|
|
572
583
|
loadingicon,
|
|
584
|
+
loadingiconurl,
|
|
573
585
|
loadingdatamsg,
|
|
574
586
|
paginationclass,
|
|
575
587
|
isLoadingMore: listState.isLoadingMore,
|
|
588
|
+
prefabName: props.prefabName,
|
|
576
589
|
collapsible,
|
|
577
590
|
showcount,
|
|
578
591
|
groupCollapsed: listState.groupCollapsed,
|
|
@@ -25,6 +25,10 @@ export type IColumnAlignment = "start" | "center" | "end";
|
|
|
25
25
|
export type ListItemData = Record<string, unknown> & {
|
|
26
26
|
_wmListItemId?: string;
|
|
27
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* Per-item disable flag: static boolean or callback evaluated per list row.
|
|
30
|
+
*/
|
|
31
|
+
export type DisableItemProp<T = ListItemData> = boolean | ((item: T, index: number) => boolean);
|
|
28
32
|
export type ListItemEventHandler = (event: React.MouseEvent, widget: unknown) => void;
|
|
29
33
|
export type ListPageEventHandler = (event: React.MouseEvent | null, page: number) => void;
|
|
30
34
|
export type ListReorderEventHandler<T = ListItemData> = (event: React.MouseEvent | null, data: T[], changedItem: T) => void;
|
|
@@ -64,9 +68,9 @@ export interface ListProps<T = ListItemData> {
|
|
|
64
68
|
*/
|
|
65
69
|
direction?: IDirection;
|
|
66
70
|
/**
|
|
67
|
-
* Whether to disable list items.
|
|
71
|
+
* Whether to disable list items (boolean or per-item callback).
|
|
68
72
|
*/
|
|
69
|
-
disableitem?:
|
|
73
|
+
disableitem?: DisableItemProp<T>;
|
|
70
74
|
/**
|
|
71
75
|
* Whether to enable reordering of list items.
|
|
72
76
|
*/
|
|
@@ -79,6 +83,10 @@ export interface ListProps<T = ListItemData> {
|
|
|
79
83
|
* CSS class for the list icon.
|
|
80
84
|
*/
|
|
81
85
|
iconclass?: string;
|
|
86
|
+
/**
|
|
87
|
+
* URL for the list icon (.svg renders inline, other URLs as image).
|
|
88
|
+
*/
|
|
89
|
+
iconurl?: string;
|
|
82
90
|
/**
|
|
83
91
|
* CSS class or function returning a class for each list item.
|
|
84
92
|
*/
|
|
@@ -116,6 +124,10 @@ export interface ListProps<T = ListItemData> {
|
|
|
116
124
|
* CSS class for the loading icon.
|
|
117
125
|
*/
|
|
118
126
|
loadingicon?: string;
|
|
127
|
+
/**
|
|
128
|
+
* URL for the loading icon (.svg renders inline, other URLs as image).
|
|
129
|
+
*/
|
|
130
|
+
loadingiconurl?: string;
|
|
119
131
|
/**
|
|
120
132
|
* Maximum size of the collection.
|
|
121
133
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IAlignment, IDirection, ListItemData } from "../props";
|
|
1
|
+
import { DisableItemProp, IAlignment, IDirection, ListItemData } from "../props";
|
|
2
2
|
import { StorageType } from "@wavemaker-ai/react-runtime/utils/state-persistance";
|
|
3
3
|
/**
|
|
4
4
|
* Get items per row CSS classes based on configuration
|
|
@@ -20,6 +20,10 @@ export declare function hasListGroupAutoLayoutClass(layoutProps: {
|
|
|
20
20
|
gap?: unknown;
|
|
21
21
|
columngap?: unknown;
|
|
22
22
|
}): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Resolves disableitem prop to a boolean for a single list row.
|
|
25
|
+
*/
|
|
26
|
+
export declare const resolveDisableItem: <T extends ListItemData>(disableitem: DisableItemProp<T> | undefined, item: T, index: number) => boolean;
|
|
23
27
|
/**
|
|
24
28
|
* Get safe dataset ensuring it's always an array
|
|
25
29
|
* @param dataset - Input dataset of any type
|
|
@@ -42,6 +42,15 @@ function hasListGroupAutoLayoutClass(layoutProps) {
|
|
|
42
42
|
const extra_LayoutAttrs = [wrap, alignment, gap, columngap];
|
|
43
43
|
return extra_LayoutAttrs.some((v) => v !== void 0 && v !== null);
|
|
44
44
|
}
|
|
45
|
+
const resolveDisableItem = (disableitem, item, index) => {
|
|
46
|
+
if (!disableitem) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
if (typeof disableitem === "function") {
|
|
50
|
+
return !!disableitem(item, index);
|
|
51
|
+
}
|
|
52
|
+
return disableitem;
|
|
53
|
+
};
|
|
45
54
|
const flattenIfArrayOfArrays = (arr) => {
|
|
46
55
|
if (arr.length === 0) return arr;
|
|
47
56
|
const first = arr[0];
|
|
@@ -139,5 +148,6 @@ export {
|
|
|
139
148
|
getSelectedItemWidgets,
|
|
140
149
|
getTextAlignClass,
|
|
141
150
|
hasListGroupAutoLayoutClass,
|
|
151
|
+
resolveDisableItem,
|
|
142
152
|
saveListState
|
|
143
153
|
};
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, memo } from "react";
|
|
3
|
-
import
|
|
4
|
-
import Typography from "@mui/material/Typography";
|
|
5
|
-
import Select from "@mui/material/Select";
|
|
6
|
-
import MenuItem from "@mui/material/MenuItem";
|
|
7
|
-
import FormControl from "@mui/material/FormControl";
|
|
3
|
+
import TablePagination from "@mui/material/TablePagination";
|
|
8
4
|
import { APP_LOCALE } from "../../list/utils/constants";
|
|
9
5
|
import { useAppSelector } from "../../../../store";
|
|
6
|
+
const EmptyPaginationActions = () => null;
|
|
7
|
+
EmptyPaginationActions.displayName = "EmptyPaginationActions";
|
|
10
8
|
const PageSizeSelectorComponent = ({
|
|
11
9
|
pagesizeoptions = "5,10,20,50,100",
|
|
12
10
|
maxResults = 10,
|
|
@@ -25,164 +23,60 @@ const PageSizeSelectorComponent = ({
|
|
|
25
23
|
}
|
|
26
24
|
return parsedOptions;
|
|
27
25
|
}, [pagesizeoptions, paginationMeta == null ? void 0 : paginationMeta.size]);
|
|
28
|
-
const effectiveMaxResults =
|
|
29
|
-
|
|
30
|
-
}, [paginationMeta == null ? void 0 : paginationMeta.size, maxResults]);
|
|
31
|
-
const rowSummary = useMemo(() => {
|
|
32
|
-
if (!dataSize) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
const startIndex = Math.min((currentPage - 1) * effectiveMaxResults + 1, dataSize);
|
|
36
|
-
const endIndex = Math.min(currentPage * effectiveMaxResults, dataSize);
|
|
37
|
-
return {
|
|
38
|
-
startIndex,
|
|
39
|
-
endIndex,
|
|
40
|
-
totalRecords: dataSize
|
|
41
|
-
};
|
|
42
|
-
}, [currentPage, effectiveMaxResults, dataSize]);
|
|
43
|
-
const handleChange = (event) => {
|
|
26
|
+
const effectiveMaxResults = (paginationMeta == null ? void 0 : paginationMeta.size) || maxResults;
|
|
27
|
+
const handleRowsPerPageChange = (event) => {
|
|
44
28
|
const newValue = Number(event.target.value);
|
|
45
29
|
if (onPageSizeChange) {
|
|
46
30
|
onPageSizeChange(event, newValue);
|
|
47
31
|
}
|
|
48
32
|
};
|
|
49
|
-
return /* @__PURE__ */
|
|
50
|
-
|
|
33
|
+
return /* @__PURE__ */ jsx(
|
|
34
|
+
TablePagination,
|
|
51
35
|
{
|
|
52
|
-
|
|
53
|
-
display: "flex",
|
|
54
|
-
flexWrap: "wrap",
|
|
55
|
-
alignItems: "center",
|
|
56
|
-
gap: 2
|
|
57
|
-
},
|
|
36
|
+
component: "div",
|
|
58
37
|
className: "pagination page-size-selector",
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
size: "small",
|
|
89
|
-
sx: {
|
|
90
|
-
minWidth: 70,
|
|
91
|
-
"& .MuiInputBase-root": {
|
|
92
|
-
height: "auto"
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
children: /* @__PURE__ */ jsx(
|
|
96
|
-
Select,
|
|
97
|
-
{
|
|
98
|
-
id: "page-size-select",
|
|
99
|
-
value: effectiveMaxResults,
|
|
100
|
-
onChange: handleChange,
|
|
101
|
-
sx: {
|
|
102
|
-
fontSize: "14px",
|
|
103
|
-
minHeight: "auto",
|
|
104
|
-
"& .MuiSelect-select": {
|
|
105
|
-
paddingTop: "6px",
|
|
106
|
-
paddingBottom: "6px",
|
|
107
|
-
paddingLeft: "10px",
|
|
108
|
-
paddingRight: "32px",
|
|
109
|
-
// Space for dropdown arrow
|
|
110
|
-
minHeight: "auto"
|
|
111
|
-
},
|
|
112
|
-
"& .MuiOutlinedInput-notchedOutline": {
|
|
113
|
-
borderColor: "rgba(0, 0, 0, 0.23)"
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
MenuProps: {
|
|
117
|
-
PaperProps: {
|
|
118
|
-
sx: {
|
|
119
|
-
maxHeight: 300,
|
|
120
|
-
"& .MuiMenuItem-root": {
|
|
121
|
-
fontSize: "14px",
|
|
122
|
-
padding: "6px 16px",
|
|
123
|
-
// Override any global padding
|
|
124
|
-
margin: 0
|
|
125
|
-
// Override any global margin
|
|
126
|
-
},
|
|
127
|
-
"& .MuiList-root": {
|
|
128
|
-
padding: "8px 0"
|
|
129
|
-
// Ensure proper list padding
|
|
130
|
-
},
|
|
131
|
-
"& li": {
|
|
132
|
-
padding: 0,
|
|
133
|
-
// Override global li padding
|
|
134
|
-
margin: 0
|
|
135
|
-
// Override global li margin
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
anchorOrigin: {
|
|
140
|
-
vertical: "bottom",
|
|
141
|
-
horizontal: "center"
|
|
142
|
-
},
|
|
143
|
-
transformOrigin: {
|
|
144
|
-
vertical: "top",
|
|
145
|
-
horizontal: "center"
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
children: options.map((option) => /* @__PURE__ */ jsx(MenuItem, { value: option, children: option }, option))
|
|
149
|
-
}
|
|
150
|
-
)
|
|
151
|
-
}
|
|
152
|
-
)
|
|
153
|
-
]
|
|
154
|
-
}
|
|
155
|
-
),
|
|
156
|
-
rowSummary && /* @__PURE__ */ jsx(
|
|
157
|
-
Box,
|
|
158
|
-
{
|
|
159
|
-
sx: {
|
|
160
|
-
display: "flex",
|
|
161
|
-
alignItems: "center",
|
|
162
|
-
gap: 0.5
|
|
163
|
-
},
|
|
164
|
-
className: "item-range",
|
|
165
|
-
children: /* @__PURE__ */ jsxs(
|
|
166
|
-
Typography,
|
|
167
|
-
{
|
|
168
|
-
sx: {
|
|
169
|
-
fontSize: "14px",
|
|
170
|
-
color: "text.primary"
|
|
171
|
-
},
|
|
172
|
-
children: [
|
|
173
|
-
/* @__PURE__ */ jsxs(Box, { component: "span", children: [
|
|
174
|
-
rowSummary.startIndex,
|
|
175
|
-
" - ",
|
|
176
|
-
rowSummary.endIndex
|
|
177
|
-
] }),
|
|
178
|
-
/* @__PURE__ */ jsx(Box, { component: "span", sx: { mx: 0.5 }, children: "\xA0\xA0of\xA0\xA0" }),
|
|
179
|
-
/* @__PURE__ */ jsx(Box, { component: "span", children: rowSummary.totalRecords })
|
|
180
|
-
]
|
|
38
|
+
count: dataSize,
|
|
39
|
+
page: Math.max(0, currentPage - 1),
|
|
40
|
+
onPageChange: () => {
|
|
41
|
+
},
|
|
42
|
+
rowsPerPage: effectiveMaxResults,
|
|
43
|
+
onRowsPerPageChange: handleRowsPerPageChange,
|
|
44
|
+
rowsPerPageOptions: options,
|
|
45
|
+
labelRowsPerPage: `${itemsPerPageLabel} :`,
|
|
46
|
+
ActionsComponent: EmptyPaginationActions,
|
|
47
|
+
slotProps: {
|
|
48
|
+
toolbar: {
|
|
49
|
+
className: "items-per-page"
|
|
50
|
+
},
|
|
51
|
+
selectLabel: {
|
|
52
|
+
className: "app-label",
|
|
53
|
+
title: itemsPerPageLabel
|
|
54
|
+
},
|
|
55
|
+
select: {
|
|
56
|
+
id: "page-size-select",
|
|
57
|
+
size: "small",
|
|
58
|
+
className: "btn app-button dropdown-toggle page-size-select",
|
|
59
|
+
MenuProps: {
|
|
60
|
+
disableScrollLock: true,
|
|
61
|
+
anchorOrigin: { vertical: "top", horizontal: "left" },
|
|
62
|
+
transformOrigin: { vertical: "bottom", horizontal: "left" },
|
|
63
|
+
slotProps: {
|
|
64
|
+
paper: {
|
|
65
|
+
elevation: 0,
|
|
66
|
+
className: "dropdown-menu pagesize-options"
|
|
181
67
|
}
|
|
182
|
-
|
|
68
|
+
}
|
|
183
69
|
}
|
|
184
|
-
|
|
185
|
-
|
|
70
|
+
},
|
|
71
|
+
menuItem: {
|
|
72
|
+
className: "dropdown-item"
|
|
73
|
+
},
|
|
74
|
+
displayedRows: dataSize ? {
|
|
75
|
+
className: "item-range"
|
|
76
|
+
} : {
|
|
77
|
+
className: "page-size-no-range"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
186
80
|
}
|
|
187
81
|
);
|
|
188
82
|
};
|
|
@@ -821,12 +821,35 @@ const usePagination = ({
|
|
|
821
821
|
}
|
|
822
822
|
}
|
|
823
823
|
}, [isServerSidePagination, totalItems, paginationMeta]);
|
|
824
|
+
const hasServerReportedPage = isServerSidePagination && (paginationMeta == null ? void 0 : paginationMeta.number) !== void 0 && (paginationMeta == null ? void 0 : paginationMeta.number) !== null;
|
|
824
825
|
useEffect(() => {
|
|
826
|
+
if (hasServerReportedPage) {
|
|
827
|
+
return;
|
|
828
|
+
}
|
|
825
829
|
if (initialPage !== void 0 && initialPage !== paginationState.currentPage) {
|
|
826
830
|
setPaginationState((prev) => __spreadProps(__spreadValues({}, prev), { currentPage: initialPage }));
|
|
827
831
|
disableNavigation();
|
|
828
832
|
}
|
|
829
|
-
}, [initialPage, paginationState.currentPage, disableNavigation]);
|
|
833
|
+
}, [initialPage, paginationState.currentPage, disableNavigation, hasServerReportedPage]);
|
|
834
|
+
useEffect(() => {
|
|
835
|
+
if (!isServerSidePagination) {
|
|
836
|
+
return;
|
|
837
|
+
}
|
|
838
|
+
const metaPageNumber = paginationMeta == null ? void 0 : paginationMeta.number;
|
|
839
|
+
if (metaPageNumber === void 0 || metaPageNumber === null) {
|
|
840
|
+
return;
|
|
841
|
+
}
|
|
842
|
+
const serverCurrentPage = metaPageNumber + 1;
|
|
843
|
+
if (serverCurrentPage > 0 && serverCurrentPage !== paginationState.currentPage) {
|
|
844
|
+
setPaginationState((prev) => __spreadProps(__spreadValues({}, prev), { currentPage: serverCurrentPage }));
|
|
845
|
+
disableNavigation();
|
|
846
|
+
}
|
|
847
|
+
}, [
|
|
848
|
+
isServerSidePagination,
|
|
849
|
+
paginationMeta == null ? void 0 : paginationMeta.number,
|
|
850
|
+
paginationState.currentPage,
|
|
851
|
+
disableNavigation
|
|
852
|
+
]);
|
|
830
853
|
useEffect(() => {
|
|
831
854
|
if (maxResults !== paginationState.currentMaxResults) {
|
|
832
855
|
setPaginationState((prev) => __spreadProps(__spreadValues({}, prev), { currentMaxResults: maxResults }));
|
|
@@ -76,7 +76,7 @@ const RowCells = memo(
|
|
|
76
76
|
textAlign: (_f = cell.column.columnDef.meta) == null ? void 0 : _f.textAlign,
|
|
77
77
|
backgroundColor: (_g = cell.column.columnDef.meta) == null ? void 0 : _g.backgroundColor
|
|
78
78
|
}, (() => {
|
|
79
|
-
const _a2 = cell.column.columnDef.meta || {}, { className, textAlign, backgroundColor } = _a2, otherMeta = __objRest(_a2, ["className", "textAlign", "backgroundColor"]);
|
|
79
|
+
const _a2 = cell.column.columnDef.meta || {}, { className, textAlign, backgroundColor, _cell } = _a2, otherMeta = __objRest(_a2, ["className", "textAlign", "backgroundColor", "_cell"]);
|
|
80
80
|
return otherMeta;
|
|
81
81
|
})()), {
|
|
82
82
|
fontSize: "inherit",
|
|
@@ -15,7 +15,7 @@ var __spreadValues = (a, b) => {
|
|
|
15
15
|
return a;
|
|
16
16
|
};
|
|
17
17
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
-
import { memo, Fragment, useMemo } from "react";
|
|
18
|
+
import { memo, Fragment, useMemo, useCallback } from "react";
|
|
19
19
|
import { TableRow } from "@mui/material";
|
|
20
20
|
import { RowCells } from "./RowCells";
|
|
21
21
|
import { useEditedRow } from "../hooks/use-edited-rows";
|
|
@@ -44,6 +44,10 @@ const TableDataRowComponent = ({
|
|
|
44
44
|
customColumnsRevision = 0,
|
|
45
45
|
columnsVersion = 0
|
|
46
46
|
}) => {
|
|
47
|
+
const handleClick = useCallback(
|
|
48
|
+
(event) => onRowClick(event, row.original, rowId),
|
|
49
|
+
[onRowClick, row.original, rowId]
|
|
50
|
+
);
|
|
47
51
|
const editedTableData = useEditedRow(rowId);
|
|
48
52
|
const mergedRowData = useMemo(() => {
|
|
49
53
|
if (!editedTableData) {
|
|
@@ -65,7 +69,7 @@ const TableDataRowComponent = ({
|
|
|
65
69
|
TableRow,
|
|
66
70
|
{
|
|
67
71
|
className: `${TABLE_CSS_CLASSES.tableRow} ${isActive ? "active" : ""} ${rowClass}`,
|
|
68
|
-
onClick:
|
|
72
|
+
onClick: handleClick,
|
|
69
73
|
"data-row-id": row.index,
|
|
70
74
|
role: "row",
|
|
71
75
|
tabIndex: 0,
|
|
@@ -117,7 +121,16 @@ const TableDataRow = memo(TableDataRowComponent, (prev, next) => {
|
|
|
117
121
|
"index",
|
|
118
122
|
"customExpressionColumns",
|
|
119
123
|
"customColumnsRevision",
|
|
120
|
-
"columnsVersion"
|
|
124
|
+
"columnsVersion",
|
|
125
|
+
// closure-captured props — stale closure if memo skips when these change
|
|
126
|
+
"onRowClick",
|
|
127
|
+
"renderExpansionCell",
|
|
128
|
+
"hasExpansion",
|
|
129
|
+
"expansionInsertIndex",
|
|
130
|
+
"ExpandedContent",
|
|
131
|
+
"onInstanceLoad",
|
|
132
|
+
"rowExpansionConfig",
|
|
133
|
+
"totalColumns"
|
|
121
134
|
];
|
|
122
135
|
return keys.every((key) => prev[key] === next[key]);
|
|
123
136
|
});
|
|
@@ -400,7 +400,7 @@ const TableHeaderComponent = memo(
|
|
|
400
400
|
tabIndex: 0,
|
|
401
401
|
"data-col-field": header.column.id,
|
|
402
402
|
children: [
|
|
403
|
-
header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()),
|
|
403
|
+
/* @__PURE__ */ jsx("span", { className: "header-data", children: header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()) }),
|
|
404
404
|
enablesort && !enablecolumnselection && header.column.getCanSort() && /* @__PURE__ */ jsx(
|
|
405
405
|
Box,
|
|
406
406
|
{
|