@wavemaker/react-runtime 11.14.3-rc.6401 → 11.15.0-2.247
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/base-action.js +5 -7
- package/actions/login-action.js +7 -8
- package/actions/logout-action.js +5 -7
- package/actions/navigation-action.js +73 -18
- package/actions/notification-action.js +22 -8
- package/actions/timer-action.js +13 -15
- package/actions/toast.js +4 -2
- package/actions/toast.service.js +1 -2
- package/components/advanced/carousel/index.js +1 -1
- package/components/advanced/carousel/template.js +1 -1
- package/components/basic/anchor/index.js +31 -11
- package/components/basic/html/index.js +115 -24
- package/components/basic/icon/index.js +2 -1
- package/components/basic/iframe/index.js +2 -1
- package/components/basic/label/index.js +12 -9
- package/components/basic/message/index.js +12 -3
- package/components/basic/picture/index.js +11 -4
- package/components/basic/progress-bar/index.js +4 -1
- package/components/basic/progress-circle/index.js +34 -28
- package/components/basic/progress-circle/props.js +10 -2
- package/components/basic/richtexteditor/index.js +95 -94
- package/components/basic/search/index.js +401 -156
- package/components/basic/search/providers.js +126 -61
- package/components/basic/spinner/index.js +2 -1
- package/components/basic/tree/index.js +34 -34
- package/components/basic/tree/utils.js +10 -4
- package/components/chart/components/barColumnChart/index.js +36 -33
- package/components/chart/components/bubbleChart/index.js +35 -25
- package/components/chart/components/chartLegend/utils.js +2 -1
- package/components/chart/components/cumulativeLineChart/index.js +30 -26
- package/components/chart/components/lineAreaChart/index.js +50 -32
- package/components/chart/components/pieDonutChart/index.js +13 -4
- package/components/chart/hooks/useXAxisConfig.js +15 -8
- package/components/chart/index.js +223 -53
- package/components/chart/utils.js +12 -1
- package/components/constants.js +5 -2
- package/components/container/accordion/accordion-pane/index.js +17 -12
- package/components/container/accordion/index.js +9 -4
- package/components/container/alignment-utils.js +56 -1
- package/components/container/index.js +49 -20
- package/components/container/panel/components/panel-header/index.js +3 -4
- package/components/container/panel/index.js +15 -10
- package/components/container/repeat-template/index.js +33 -0
- package/components/container/tabs/index.js +83 -14
- package/components/container/tabs/tab-pane/index.js +33 -10
- package/components/container/tabs/utils.js +51 -0
- package/components/container/wizard/components/StepComponents.js +2 -1
- package/components/container/wizard/components/WizardStep.js +2 -1
- package/components/container/wizard/index.js +64 -35
- package/components/container/wizard/utils.js +46 -1
- package/components/container/wizard/wizard-step/index.js +11 -1
- package/components/data/card/card-content/index.js +1 -1
- package/components/data/form/base-form/index.js +985 -183
- package/components/data/form/base-form/props.js +3 -1
- package/components/data/form/base-form/utils.js +159 -1
- package/components/data/form/dynamic-fields/constant.js +53 -0
- package/components/data/form/dynamic-fields/index.js +10 -45
- package/components/data/form/dynamic-fields/utils.js +37 -2
- package/components/data/form/form-action/index.js +5 -4
- package/components/data/form/form-context.js +5 -1
- package/components/data/form/form-controller/utils.js +84 -0
- package/components/data/form/form-controller/validation-contrustor.js +402 -189
- package/components/data/form/form-controller/withFormController.js +191 -52
- package/components/data/form/form-field/base-field.js +67 -45
- package/components/data/form/form-field/index.js +28 -5
- package/components/data/form/form-header/index.js +3 -4
- package/components/data/form/index.js +20 -1
- package/components/data/list/components/ListDND.js +2 -1
- package/components/data/list/components/ListItem.js +6 -2
- package/components/data/list/components/ListItemWithTemplate.js +46 -2
- package/components/data/list/components/ListItems.js +17 -26
- package/components/data/list/components/ListPagination.js +3 -3
- package/components/data/list/components/StandardListItems.js +3 -4
- package/components/data/list/hooks/useListEffects.js +55 -14
- package/components/data/list/hooks/useListEventHandlers.js +3 -1
- package/components/data/list/hooks/useListState.js +3 -1
- package/components/data/list/hooks/usePaginatedGroupedData.js +18 -5
- package/components/data/list/index.js +74 -55
- package/components/data/list/utils/list-helpers.js +73 -35
- package/components/data/list/utils/list-widget-methods.js +138 -95
- package/components/data/live-filter/index.js +26 -15
- package/components/data/live-form/index.js +51 -18
- package/components/data/live-form/props.js +1 -1
- package/components/data/pagination/components/BasicPagination.js +71 -16
- package/components/data/pagination/components/PageSizeSelector.js +8 -3
- package/components/data/pagination/components/TotalRecords.js +1 -5
- package/components/data/pagination/hooks/usePagination.js +349 -66
- package/components/data/pagination/index.js +137 -19
- package/components/data/table/components/AddNewRow.js +5 -1
- package/components/data/table/components/EditableCell.js +2 -2
- package/components/data/table/components/RowCells.js +64 -0
- package/components/data/table/components/RowExpansionButton.js +2 -2
- package/components/data/table/components/SummaryCell.js +111 -0
- package/components/data/table/components/SummaryRow.js +54 -0
- package/components/data/table/components/SummaryRowFooter.js +46 -0
- package/components/data/table/components/TableBody.js +61 -59
- package/components/data/table/components/TableDataRow.js +109 -0
- package/components/data/table/components/TableFilters.js +225 -121
- package/components/data/table/components/TableHeader.js +291 -23
- package/components/data/table/components/TablePanelHeading.js +139 -8
- package/components/data/table/components/index.js +22 -1
- package/components/data/table/hooks/use-edited-rows.js +141 -0
- package/components/data/table/hooks/useCellState.js +5 -12
- package/components/data/table/hooks/useFormWidget.js +58 -52
- package/components/data/table/hooks/usePaginationState.js +45 -24
- package/components/data/table/hooks/usePanelStructure.js +4 -4
- package/components/data/table/hooks/useRowHandlers.js +39 -5
- package/components/data/table/hooks/useRowSelection.js +244 -50
- package/components/data/table/hooks/useServerSideSorting.js +81 -37
- package/components/data/table/hooks/useTableColumns.js +211 -118
- package/components/data/table/hooks/useTableData.js +54 -9
- package/components/data/table/hooks/useTableEdit.js +272 -97
- package/components/data/table/hooks/useTableEffects.js +31 -13
- package/components/data/table/hooks/useTableFilter.js +1 -1
- package/components/data/table/hooks/useTableInitialization.js +23 -22
- package/components/data/table/hooks/useTableState.js +11 -5
- package/components/data/table/hooks/useTableStateManager.js +140 -65
- package/components/data/table/index.js +637 -274
- package/components/data/table/live-table/index.js +54 -22
- package/components/data/table/table-action/index.js +1 -1
- package/components/data/table/table-group/index.js +26 -0
- package/components/data/table/table-row-action/index.js +32 -18
- package/components/data/table/utils/buildSelectionColumns.js +12 -21
- package/components/data/table/utils/columnBuilder.js +29 -14
- package/components/data/table/utils/columnProxy.js +68 -1
- package/components/data/table/utils/constants.js +6 -2
- package/components/data/table/utils/crud-handlers.js +68 -63
- package/components/data/table/utils/groupHeaderUtils.js +102 -0
- package/components/data/table/utils/index.js +210 -21
- package/components/data/table/utils/renderDisplayCell.js +6 -6
- package/components/data/table/utils/selectionUtils.js +25 -26
- package/components/data/table/utils/validation.js +1 -0
- package/components/data/utils/filter-field-util.js +3 -3
- package/components/dialogs/alert-dialog/index.js +1 -1
- package/components/dialogs/confirm-dialog/index.js +1 -1
- package/components/dialogs/dialog/index.js +4 -1
- package/components/dialogs/dialog-content/index.js +3 -1
- package/components/dialogs/dialog-header/index.js +2 -2
- package/components/dialogs/iframe-dialog/index.js +11 -5
- package/components/dialogs/index.js +1 -1
- package/components/dialogs/login-dialog/index.js +1 -1
- package/components/dialogs/page-dialog/index.js +1 -1
- package/components/form/button/index.js +33 -7
- package/components/input/calendar/index.js +18 -6
- package/components/input/chips/index.js +99 -28
- package/components/input/chips/utils.js +34 -4
- package/components/input/color-picker/index.js +74 -25
- package/components/input/composite/index.js +3 -3
- package/components/input/currency/index.js +35 -49
- package/components/input/default/checkbox/index.js +23 -28
- package/components/input/default/checkboxset/index.js +38 -18
- package/components/input/default/checkboxset/utils.js +30 -0
- package/components/input/default/radioset/index.js +36 -39
- package/components/input/default/switch/index.js +30 -13
- package/components/input/epoch/date/index.js +130 -69
- package/components/input/epoch/date/utils.js +94 -1
- package/components/input/epoch/datetime/index.js +72 -22
- package/components/input/epoch/datetime/utils.js +49 -10
- package/components/input/epoch/time/index.js +68 -19
- package/components/input/epoch/time/utils.js +62 -14
- package/components/input/fileupload/Utils.js +12 -7
- package/components/input/fileupload/components/MultiUpload.js +2 -6
- package/components/input/fileupload/components/SingleUpload.js +3 -7
- package/components/input/fileupload/index.js +6 -10
- package/components/input/fileupload/useFileUpload.js +16 -5
- package/components/input/number/index.js +158 -43
- package/components/input/rating/index.js +90 -7
- package/components/input/select/index.js +209 -72
- package/components/input/slider/index.js +84 -26
- package/components/input/text/index.js +38 -18
- package/components/input/text/util.js +283 -130
- package/components/input/textarea/index.js +13 -10
- package/components/input/upload/index.js +124 -0
- package/components/input/upload/props.js +5 -0
- package/components/input/util/index.js +11 -0
- package/components/navbar/index.js +51 -3
- package/components/navbar/nav/index.js +46 -16
- package/components/navbar/nav-item/index.js +11 -5
- package/components/navigation/menu/components/ListItems.js +3 -0
- package/components/navigation/menu/constants.js +2 -1
- package/components/navigation/menu/hooks/useHoverState.hook.js +48 -0
- package/components/navigation/menu/hooks/useKeyboardMovements.hook.js +37 -0
- package/components/navigation/menu/hooks/useTransformedDataset.hook.js +15 -0
- package/components/navigation/menu/index.js +326 -188
- package/components/navigation/menu/utils/action-task.js +14 -0
- package/components/navigation/menu/utils/role-filter.js +76 -0
- package/components/navigation/popover/index.js +105 -32
- package/components/page/partial-container/index.js +34 -5
- package/components/prefab/index.js +2 -4
- package/context/PrefabContext.js +10 -6
- package/context/WidgetProvider.js +30 -31
- package/core/app.service.js +1 -1
- package/core/constants/events.js +57 -1
- package/core/dialog.service.js +1 -2
- package/core/event-notifier.js +1 -2
- package/core/formatter/array-formatters.js +33 -0
- package/core/formatter/date-formatters.js +2 -4
- package/core/formatter/index.js +2 -1
- package/core/formatter/number-formatters.js +5 -10
- package/core/formatter/security-formatters.js +2 -4
- package/core/formatter/string-formatters.js +3 -6
- package/core/proxy-service.js +85 -13
- package/core/script-registry.js +108 -48
- package/core/util/common.js +4 -4
- package/core/util/compare.js +30 -0
- package/core/util/dom.js +8 -8
- package/core/util/index.js +16 -6
- package/core/util/safe-is-equal.js +156 -0
- package/core/util/security.js +1 -2
- package/core/util/utils.js +16 -7
- package/higherOrder/BaseApp.js +108 -65
- package/higherOrder/BaseDateTime.js +31 -13
- package/higherOrder/BasePage.js +268 -144
- package/higherOrder/BasePartial.js +1 -1
- package/higherOrder/BasePrefab.js +33 -15
- package/higherOrder/DataNav.js +99 -16
- package/higherOrder/helper.js +41 -3
- package/higherOrder/withBaseWrapper.js +41 -28
- package/hooks/useAuth.js +11 -5
- package/hooks/useHttp.js +280 -94
- package/mui-config/theme-provider.js +1 -1
- package/mui-config/theme.js +1 -1
- package/package-lock.json +423 -331
- package/package.json +8 -8
- package/store/bindActions/i18nActions.js +18 -0
- package/store/index.js +3 -1
- package/store/slices/appConfigSlice.js +2 -2
- package/store/slices/authSlice.js +31 -28
- package/store/slices/i18nSlice.js +2 -2
- package/store/slices/navigationSlice.js +35 -0
- package/store/viewport.service.js +255 -0
- package/utils/attr.js +35 -0
- package/utils/dataset-util.js +1 -2
- package/utils/form-state.util.js +43 -12
- package/utils/form-utils.js +47 -2
- package/utils/format-util.js +28 -13
- package/utils/page-params-util.js +33 -1
- package/utils/state-persistance.js +72 -13
- package/utils/transformedDataset-utils.js +35 -24
- package/variables/base-variable.js +12 -14
- package/variables/crud-variable.js +225 -0
- package/variables/live-variable.js +56 -20
- package/variables/metadata.service.js +123 -0
- package/variables/model-variable.js +21 -15
- package/variables/service-variable.js +88 -83
|
@@ -106,7 +106,8 @@ var SortableItem = exports.SortableItem = function SortableItem(_ref) {
|
|
|
106
106
|
cursor: enableReorder && !disableItem ? "grab" : undefined,
|
|
107
107
|
touchAction: "none",
|
|
108
108
|
position: "relative",
|
|
109
|
-
willChange: "transform"
|
|
109
|
+
willChange: "transform",
|
|
110
|
+
width: "100%"
|
|
110
111
|
};
|
|
111
112
|
return __jsx("div", (0, _extends2["default"])({
|
|
112
113
|
ref: setNodeRef,
|
|
@@ -42,6 +42,10 @@ var buildItemClasses = function buildItemClasses(itemClass, isActive, disableIte
|
|
|
42
42
|
/**
|
|
43
43
|
* List Item Component
|
|
44
44
|
* Renders individual list items with context and drag-and-drop support
|
|
45
|
+
*
|
|
46
|
+
* Note: Widget naming (e.g., "Name_0", "Name_1") and internal widget flags
|
|
47
|
+
* are now handled at the codegen level. The renderItem function generates
|
|
48
|
+
* widgets with indexed names and data-internal-widget="true" directly.
|
|
45
49
|
*/
|
|
46
50
|
var WmListItem = exports.WmListItem = function WmListItem(_ref) {
|
|
47
51
|
var item = _ref.item,
|
|
@@ -64,7 +68,6 @@ var WmListItem = exports.WmListItem = function WmListItem(_ref) {
|
|
|
64
68
|
tabIndex = _ref.tabIndex,
|
|
65
69
|
_ref$isActive = _ref.isActive,
|
|
66
70
|
isActive = _ref$isActive === void 0 ? false : _ref$isActive,
|
|
67
|
-
name = _ref.name,
|
|
68
71
|
_ref$enableReorder = _ref.enableReorder,
|
|
69
72
|
enableReorder = _ref$enableReorder === void 0 ? false : _ref$enableReorder,
|
|
70
73
|
id = _ref.id,
|
|
@@ -125,7 +128,8 @@ var WmListItem = exports.WmListItem = function WmListItem(_ref) {
|
|
|
125
128
|
"data-item-index": index,
|
|
126
129
|
"data-item-active": isActive,
|
|
127
130
|
"aria-selected": isActive,
|
|
128
|
-
role: "option"
|
|
131
|
+
role: "option",
|
|
132
|
+
listitemindex: index
|
|
129
133
|
}, __jsx(ListItemContext.Provider, {
|
|
130
134
|
value: contextValue
|
|
131
135
|
}, children));
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.ListItemWithTemplate = void 0;
|
|
8
|
-
var
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
12
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
10
13
|
var _ListItem = require("./ListItem");
|
|
11
14
|
var _mediaTemplate = require("../templates/media-template");
|
|
15
|
+
var _WidgetProvider = require("../../../../context/WidgetProvider");
|
|
16
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
12
17
|
var __jsx = _react["default"].createElement;
|
|
18
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
20
|
/**
|
|
14
21
|
* Single list item component with template rendering
|
|
15
22
|
*/
|
|
@@ -35,7 +42,44 @@ var ListItemWithTemplate = exports.ListItemWithTemplate = function ListItemWithT
|
|
|
35
42
|
onItemDoubleClick = _ref.onItemDoubleClick,
|
|
36
43
|
onItemMouseEnter = _ref.onItemMouseEnter,
|
|
37
44
|
onItemMouseLeave = _ref.onItemMouseLeave;
|
|
38
|
-
var
|
|
45
|
+
var WidgetProxy = (0, _WidgetProvider.useWidgetProxy)();
|
|
46
|
+
var widgetCacheRef = (0, _react.useRef)(new Map());
|
|
47
|
+
|
|
48
|
+
// Clear cache when WidgetProxy or name changes
|
|
49
|
+
(0, _react.useEffect)(function () {
|
|
50
|
+
widgetCacheRef.current.clear();
|
|
51
|
+
}, [WidgetProxy, name]);
|
|
52
|
+
var getCurrentItemWidgets = (0, _react.useCallback)(function ($index) {
|
|
53
|
+
// Return cached result if available
|
|
54
|
+
var cached = widgetCacheRef.current.get($index);
|
|
55
|
+
if (cached) {
|
|
56
|
+
return cached;
|
|
57
|
+
}
|
|
58
|
+
var items = {};
|
|
59
|
+
var prefix = "".concat(name, "_").concat($index, "_");
|
|
60
|
+
|
|
61
|
+
// Use for...in for better performance than Object.keys + filter
|
|
62
|
+
for (var key in WidgetProxy) {
|
|
63
|
+
var _key$split = key.split("_"),
|
|
64
|
+
_key$split2 = (0, _slicedToArray2["default"])(_key$split, 2),
|
|
65
|
+
listName = _key$split2[0],
|
|
66
|
+
idx = _key$split2[1];
|
|
67
|
+
if (key.startsWith(prefix)) {
|
|
68
|
+
var widget = WidgetProxy[key];
|
|
69
|
+
if (parseInt(idx) === $index && listName === name) {
|
|
70
|
+
items[widget.name] = widget;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Cache the result
|
|
76
|
+
widgetCacheRef.current.set($index, items);
|
|
77
|
+
return items;
|
|
78
|
+
}, [WidgetProxy, name]);
|
|
79
|
+
var itemWithSelected = _objectSpread(_objectSpread({}, item), {}, {
|
|
80
|
+
selected: isActive
|
|
81
|
+
});
|
|
82
|
+
var templateContent = renderItem ? renderItem(itemWithSelected, globalIndex !== null && globalIndex !== void 0 ? globalIndex : index, WidgetProxy[name], getCurrentItemWidgets) : itemTemplate || __jsx(_mediaTemplate.MediaWmListtemplate, null);
|
|
39
83
|
|
|
40
84
|
// Resolve item class: support string or function callback
|
|
41
85
|
var resolvedItemClass = typeof itemclass === "function" ? itemclass(item) : itemclass;
|
|
@@ -92,7 +92,8 @@ var ListItems = exports.ListItems = function ListItems(_ref) {
|
|
|
92
92
|
navigation: navigation,
|
|
93
93
|
currentPage: currentPage,
|
|
94
94
|
pagesize: pagesize,
|
|
95
|
-
visibleItems: visibleItems
|
|
95
|
+
visibleItems: visibleItems,
|
|
96
|
+
isServerSidePagination: isServerPaginated
|
|
96
97
|
});
|
|
97
98
|
|
|
98
99
|
// Create stable identifiers for data changes
|
|
@@ -109,37 +110,27 @@ var ListItems = exports.ListItems = function ListItems(_ref) {
|
|
|
109
110
|
// Call onBeforedatarender with unsorted current page items - only when data changes
|
|
110
111
|
(0, _react.useEffect)(function () {
|
|
111
112
|
if (onBeforedatarender && widgetInstance) {
|
|
112
|
-
|
|
113
|
-
// For grouped data, we need to get unsorted items for the current page
|
|
114
|
-
// Since grouped data is already sorted, we'll use the raw dataset approach
|
|
115
|
-
onBeforedatarender(widgetInstance, rawCurrentPageItems.currentItems);
|
|
116
|
-
} else {
|
|
117
|
-
// For standard lists, use raw current page items (unsorted)
|
|
118
|
-
onBeforedatarender(widgetInstance, rawCurrentPageItems.currentItems);
|
|
119
|
-
}
|
|
113
|
+
onBeforedatarender(widgetInstance, rawCurrentPageItems.currentItems);
|
|
120
114
|
}
|
|
121
115
|
}, [rawCurrentItemsKey, groupby]);
|
|
122
116
|
|
|
123
117
|
// Call onRender with sorted current page items - only when data changes
|
|
124
118
|
(0, _react.useEffect)(function () {
|
|
125
|
-
if (onRender
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
return function () {
|
|
139
|
-
return clearTimeout(timer);
|
|
140
|
-
};
|
|
119
|
+
if (onRender) {
|
|
120
|
+
// Call onRender synchronously to ensure it fires before onSelect
|
|
121
|
+
// This maintains the correct event order: onBeforedatarender -> onRender -> onSelect
|
|
122
|
+
if (groupby) {
|
|
123
|
+
// For grouped data, flatten the current page grouped items (sorted)
|
|
124
|
+
var currentPageGroupedItems = paginatedGroupedData.reduce(function (acc, group) {
|
|
125
|
+
return acc.concat(group.data);
|
|
126
|
+
}, []);
|
|
127
|
+
onRender(widgetInstance, currentPageGroupedItems);
|
|
128
|
+
} else {
|
|
129
|
+
// For standard lists, use sorted current page items
|
|
130
|
+
onRender(widgetInstance, currentPageItems.currentItems);
|
|
131
|
+
}
|
|
141
132
|
}
|
|
142
|
-
}, [
|
|
133
|
+
}, []);
|
|
143
134
|
|
|
144
135
|
// Calculate total items for grouped data
|
|
145
136
|
var totalGroupedItems = (0, _react.useMemo)(function () {
|
|
@@ -21,6 +21,7 @@ var mapNavigationType = function mapNavigationType(navigation) {
|
|
|
21
21
|
case _constants.LIST_NAVIGATION_TYPES.BASIC:
|
|
22
22
|
case _constants.LIST_NAVIGATION_TYPES.PAGER:
|
|
23
23
|
case _constants.LIST_NAVIGATION_TYPES.CLASSIC:
|
|
24
|
+
case _constants.LIST_NAVIGATION_TYPES.SCROLL:
|
|
24
25
|
return navigation;
|
|
25
26
|
case _constants.LIST_NAVIGATION_TYPES.ADVANCED:
|
|
26
27
|
return _constants.LIST_NAVIGATION_TYPES.CLASSIC;
|
|
@@ -38,8 +39,7 @@ var mapNavigationType = function mapNavigationType(navigation) {
|
|
|
38
39
|
var shouldHidePagination = function shouldHidePagination(navigation, allowpagesizechange, datasetLength, pagesize, paginationMeta, totalItems) {
|
|
39
40
|
// Hide for certain navigation types
|
|
40
41
|
var isNone = String(navigation) === String(_constants.LIST_NAVIGATION_TYPES.NONE) || navigation === "None";
|
|
41
|
-
|
|
42
|
-
if (isNone || isOnDemand) {
|
|
42
|
+
if (isNone) {
|
|
43
43
|
return true;
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -107,7 +107,7 @@ var ListPagination = exports.ListPagination = function ListPagination(props) {
|
|
|
107
107
|
// Early return if pagination should be hidden
|
|
108
108
|
var hidePagination = (0, _react.useMemo)(function () {
|
|
109
109
|
return shouldHidePagination(navigation, allowpagesizechange, orderedDataset.length, pagesize, paginationMeta, totalItems);
|
|
110
|
-
}, [navigation, allowpagesizechange, orderedDataset.length, pagesize,
|
|
110
|
+
}, [navigation, allowpagesizechange, orderedDataset.length, pagesize, paginationMeta, props.totalItems]);
|
|
111
111
|
|
|
112
112
|
// Get the appropriate navigation type for the pagination component
|
|
113
113
|
var paginationNavigation = (0, _react.useMemo)(function () {
|
|
@@ -10,7 +10,6 @@ var _ListDND = require("./ListDND");
|
|
|
10
10
|
var _ListItemWithTemplate = require("./ListItemWithTemplate");
|
|
11
11
|
var _ListContainer = require("./ListContainer");
|
|
12
12
|
var _NoDataMessage = require("./NoDataMessage");
|
|
13
|
-
var _isEqual = _interopRequireDefault(require("lodash-es/isEqual"));
|
|
14
13
|
var _some = _interopRequireDefault(require("lodash-es/some"));
|
|
15
14
|
var __jsx = _react["default"].createElement;
|
|
16
15
|
/**
|
|
@@ -47,9 +46,9 @@ var StandardListItems = exports.StandardListItems = function StandardListItems(_
|
|
|
47
46
|
var itemId = (0, _ListDND.getItemId)(item, globalIndex);
|
|
48
47
|
var isFirst = index === 0;
|
|
49
48
|
var isLast = index === currentItems.length - 1;
|
|
50
|
-
var isActive = Array.isArray(activeItems) || activeItems instanceof Set
|
|
51
|
-
return
|
|
52
|
-
})
|
|
49
|
+
var isActive = (Array.isArray(activeItems) || activeItems instanceof Set) && (0, _some["default"])(Array.from(activeItems), function (active) {
|
|
50
|
+
return active._wmListItemId === item._wmListItemId;
|
|
51
|
+
});
|
|
53
52
|
return __jsx(_ListItemWithTemplate.ListItemWithTemplate, {
|
|
54
53
|
key: itemId,
|
|
55
54
|
item: item,
|
|
@@ -9,6 +9,7 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _constants = require("../utils/constants");
|
|
11
11
|
var _listHelpers = require("../utils/list-helpers");
|
|
12
|
+
var _WidgetProvider = require("@wavemaker/react-runtime/context/WidgetProvider");
|
|
12
13
|
var useListEffects = exports.useListEffects = function useListEffects(props) {
|
|
13
14
|
var name = props.name,
|
|
14
15
|
navigation = props.navigation,
|
|
@@ -47,13 +48,17 @@ var useListEffects = exports.useListEffects = function useListEffects(props) {
|
|
|
47
48
|
setRestoredPageNumber = props.setRestoredPageNumber,
|
|
48
49
|
showNavigation = props.showNavigation,
|
|
49
50
|
stateManager = props.stateManager;
|
|
50
|
-
|
|
51
|
+
var Widgets = (0, _WidgetProvider.useWidgetProxy)();
|
|
51
52
|
// Track page size changes
|
|
52
53
|
var _useState = (0, _react.useState)(paginationState.currentPageSize),
|
|
53
54
|
lastPageSize = _useState[0],
|
|
54
55
|
setLastPageSize = _useState[1];
|
|
55
56
|
var rafRef1 = (0, _react.useRef)(null);
|
|
56
57
|
var rafRef2 = (0, _react.useRef)(null);
|
|
58
|
+
var hasInitialWidgetUpdateRun = (0, _react.useRef)(false);
|
|
59
|
+
var widgetMethodsRef = (0, _react.useRef)(widgetMethods);
|
|
60
|
+
widgetMethodsRef.current = widgetMethods;
|
|
61
|
+
|
|
57
62
|
// Effect 1: Accumulate data for On-Demand navigation
|
|
58
63
|
(0, _react.useEffect)(function () {
|
|
59
64
|
if (navigation === _constants.LIST_NAVIGATION_TYPES.ON_DEMAND && datasource && safeDataset.length > 0) {
|
|
@@ -97,23 +102,44 @@ var useListEffects = exports.useListEffects = function useListEffects(props) {
|
|
|
97
102
|
}, [orderby]); // Reset when sorting changes
|
|
98
103
|
|
|
99
104
|
// Effect 3: Expose methods through widget instance
|
|
105
|
+
// Uses wrapper functions that delegate to ref to avoid stale closures and infinite re-renders
|
|
100
106
|
(0, _react.useEffect)(function () {
|
|
101
107
|
if (listener !== null && listener !== void 0 && listener.onChange) {
|
|
102
108
|
listener.onChange(name, {
|
|
103
|
-
selectItem:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
selectItem: function selectItem(val) {
|
|
110
|
+
return widgetMethodsRef.current.selectItem(val);
|
|
111
|
+
},
|
|
112
|
+
deselectItem: function deselectItem(val) {
|
|
113
|
+
return widgetMethodsRef.current.deselectItem(val);
|
|
114
|
+
},
|
|
115
|
+
getItem: function getItem(index) {
|
|
116
|
+
return widgetMethodsRef.current.getItem(index);
|
|
117
|
+
},
|
|
118
|
+
getIndex: function getIndex(item) {
|
|
119
|
+
return widgetMethodsRef.current.getIndex(item);
|
|
120
|
+
},
|
|
121
|
+
clear: function clear() {
|
|
122
|
+
return widgetMethodsRef.current.clear();
|
|
123
|
+
},
|
|
124
|
+
getWidgets: function getWidgets(widgetName, index) {
|
|
125
|
+
return widgetMethodsRef.current.getWidgets(widgetName, index);
|
|
126
|
+
},
|
|
127
|
+
listItems: {
|
|
128
|
+
first: items[0],
|
|
129
|
+
last: items[items.length - 1],
|
|
130
|
+
length: items.length
|
|
131
|
+
},
|
|
132
|
+
showNavigation: showNavigation,
|
|
133
|
+
selectPageSize: function selectPageSize(size) {
|
|
134
|
+
return widgetMethodsRef.current.selectPageSize(size);
|
|
135
|
+
}
|
|
110
136
|
});
|
|
111
137
|
}
|
|
112
|
-
}, []);
|
|
138
|
+
}, [name, showNavigation, items]);
|
|
113
139
|
|
|
114
140
|
// Effect 3: Expose methods through widget instance
|
|
115
141
|
(0, _react.useEffect)(function () {
|
|
116
|
-
if (listener !== null && listener !== void 0 && listener.onChange) {
|
|
142
|
+
if (listener !== null && listener !== void 0 && listener.onChange && props.navigation !== _constants.LIST_NAVIGATION_TYPES.NONE) {
|
|
117
143
|
listener.onChange(name, {
|
|
118
144
|
selecteditem: listState.selectedItems[0]
|
|
119
145
|
});
|
|
@@ -121,7 +147,7 @@ var useListEffects = exports.useListEffects = function useListEffects(props) {
|
|
|
121
147
|
}, [listState.selectedItems]);
|
|
122
148
|
|
|
123
149
|
// Effect 3b: Update selected item widgets for state restoration (not selectfirstitem)
|
|
124
|
-
|
|
150
|
+
|
|
125
151
|
(0, _react.useEffect)(function () {
|
|
126
152
|
// Only run once on initial load when there are selected items from state restoration
|
|
127
153
|
// Skip if selectfirstitem is true (handled in useListState)
|
|
@@ -136,7 +162,7 @@ var useListEffects = exports.useListEffects = function useListEffects(props) {
|
|
|
136
162
|
rafRef1.current = requestAnimationFrame(function () {
|
|
137
163
|
// getSelectedItemWidgets(null, listener, name);
|
|
138
164
|
rafRef2.current = requestAnimationFrame(function () {
|
|
139
|
-
(0, _listHelpers.getSelectedItemWidgets)(null, listener, name);
|
|
165
|
+
(0, _listHelpers.getSelectedItemWidgets)(null, listener, name, listState.selectedItems[0] || null, Widgets);
|
|
140
166
|
});
|
|
141
167
|
});
|
|
142
168
|
return function () {
|
|
@@ -150,12 +176,20 @@ var useListEffects = exports.useListEffects = function useListEffects(props) {
|
|
|
150
176
|
}, [name, listState.selectedItems.length, initialRender, selectfirstitem]);
|
|
151
177
|
|
|
152
178
|
// Effect 5: Handle selectfirstitem with onSelect
|
|
179
|
+
// Use setTimeout to ensure onSelect fires after onRender (which is called synchronously in ListItems)
|
|
153
180
|
(0, _react.useEffect)(function () {
|
|
154
181
|
if (selectfirstitem && widgetInstance && onSelect && listState.selectedItems.length > 0) {
|
|
155
182
|
// Only trigger onSelect for selectfirstitem if it's the initial selection and not user-initiated
|
|
156
183
|
if (listState.selectedItems.length === 1 && items.length > 0 && listState.selectedItems[0] === items[0]) {
|
|
157
184
|
if (!userInitiatedSelectionRef.current) {
|
|
158
|
-
onSelect
|
|
185
|
+
// Delay onSelect to ensure it fires after onRender
|
|
186
|
+
// onRender is called synchronously in the ListItems component
|
|
187
|
+
var timer = setTimeout(function () {
|
|
188
|
+
onSelect(widgetInstance, listState.selectedItems[0]);
|
|
189
|
+
}, 0);
|
|
190
|
+
return function () {
|
|
191
|
+
return clearTimeout(timer);
|
|
192
|
+
};
|
|
159
193
|
}
|
|
160
194
|
}
|
|
161
195
|
}
|
|
@@ -173,7 +207,14 @@ var useListEffects = exports.useListEffects = function useListEffects(props) {
|
|
|
173
207
|
listState.setFirstSelectedItem(firstItemInGroup);
|
|
174
208
|
// Trigger onSelect for the initial selection of first item in grouped data only if not user-initiated
|
|
175
209
|
if (onSelect && widgetInstance && !userInitiatedSelectionRef.current) {
|
|
176
|
-
|
|
210
|
+
// Delay onSelect to ensure it fires after onRender
|
|
211
|
+
// onRender is called synchronously in the ListItems component
|
|
212
|
+
var timer = setTimeout(function () {
|
|
213
|
+
onSelect(widgetInstance, firstItemInGroup);
|
|
214
|
+
}, 0);
|
|
215
|
+
return function () {
|
|
216
|
+
return clearTimeout(timer);
|
|
217
|
+
};
|
|
177
218
|
}
|
|
178
219
|
};
|
|
179
220
|
|
|
@@ -10,6 +10,7 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _lodashEs = require("lodash-es");
|
|
12
12
|
var _listHelpers = require("../utils/list-helpers");
|
|
13
|
+
var _WidgetProvider = require("@wavemaker/react-runtime/context/WidgetProvider");
|
|
13
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
15
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
16
|
/**
|
|
@@ -55,6 +56,7 @@ var useListEventHandlers = exports.useListEventHandlers = function useListEventH
|
|
|
55
56
|
listener = props.listener,
|
|
56
57
|
name = props.name;
|
|
57
58
|
var selectedItemsRef = (0, _react.useRef)(selectedItems);
|
|
59
|
+
var Widgets = (0, _WidgetProvider.useWidgetProxy)();
|
|
58
60
|
(0, _react.useEffect)(function () {
|
|
59
61
|
selectedItemsRef.current = selectedItems;
|
|
60
62
|
}, [selectedItems]);
|
|
@@ -168,7 +170,7 @@ var useListEventHandlers = exports.useListEventHandlers = function useListEventH
|
|
|
168
170
|
}
|
|
169
171
|
// If item is already selected, do nothing (don't deselect)
|
|
170
172
|
}
|
|
171
|
-
(0, _listHelpers.getSelectedItemWidgets)(event, listener, name || "");
|
|
173
|
+
(0, _listHelpers.getSelectedItemWidgets)(event, listener, name || "", item || null, Widgets);
|
|
172
174
|
if (widgetInstance) {
|
|
173
175
|
delete widgetInstance._wmListItemId;
|
|
174
176
|
widgetInstance.item = item;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useListState = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _listHelpers = require("../utils/list-helpers");
|
|
9
|
+
var _WidgetProvider = require("@wavemaker/react-runtime/context/WidgetProvider");
|
|
9
10
|
/**
|
|
10
11
|
* Custom hook for managing list state
|
|
11
12
|
* @param dataset - The dataset array
|
|
@@ -17,6 +18,7 @@ var _listHelpers = require("../utils/list-helpers");
|
|
|
17
18
|
* @returns State management object for the list
|
|
18
19
|
*/
|
|
19
20
|
var useListState = exports.useListState = function useListState(dataset, pagesize, selectfirstitem, selectionlimit, listener, name) {
|
|
21
|
+
var Widgets = (0, _WidgetProvider.useWidgetProxy)();
|
|
20
22
|
var _useState = (0, _react.useState)([]),
|
|
21
23
|
selectedItems = _useState[0],
|
|
22
24
|
setSelectedItems = _useState[1];
|
|
@@ -76,7 +78,7 @@ var useListState = exports.useListState = function useListState(dataset, pagesiz
|
|
|
76
78
|
rafRef1.current = requestAnimationFrame(function () {
|
|
77
79
|
// getSelectedItemWidgets(null, listener, name);
|
|
78
80
|
rafRef2.current = requestAnimationFrame(function () {
|
|
79
|
-
(0, _listHelpers.getSelectedItemWidgets)(null, listener, name);
|
|
81
|
+
(0, _listHelpers.getSelectedItemWidgets)(null, listener, name, firstItem || null, Widgets);
|
|
80
82
|
});
|
|
81
83
|
});
|
|
82
84
|
}
|
|
@@ -9,11 +9,11 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _lodashEs = require("lodash-es");
|
|
11
11
|
var _constants = require("../utils/constants");
|
|
12
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
12
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
15
13
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
16
14
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
15
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
17
|
/**
|
|
18
18
|
* Hook for calculating paginated grouped data based on navigation type and pagination
|
|
19
19
|
*/
|
|
@@ -22,12 +22,25 @@ var usePaginatedGroupedData = exports.usePaginatedGroupedData = function usePagi
|
|
|
22
22
|
navigation = _ref.navigation,
|
|
23
23
|
currentPage = _ref.currentPage,
|
|
24
24
|
pagesize = _ref.pagesize,
|
|
25
|
-
visibleItems = _ref.visibleItems
|
|
25
|
+
visibleItems = _ref.visibleItems,
|
|
26
|
+
isServerSidePagination = _ref.isServerSidePagination;
|
|
26
27
|
return (0, _react.useMemo)(function () {
|
|
27
28
|
if (!groupedData || !(0, _lodashEs.isArray)(groupedData) || groupedData.length === 0) {
|
|
28
29
|
return [];
|
|
29
30
|
}
|
|
30
31
|
|
|
32
|
+
// For server-side pagination, the data is already paginated by the server
|
|
33
|
+
// Just return all grouped data without additional client-side pagination
|
|
34
|
+
if (isServerSidePagination) {
|
|
35
|
+
return groupedData.map(function (group) {
|
|
36
|
+
return _objectSpread(_objectSpread({}, group), {}, {
|
|
37
|
+
data: group.data,
|
|
38
|
+
startIndexInGroup: 0,
|
|
39
|
+
originalDataLength: group.data.length
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
31
44
|
// For on-demand navigation, show all items up to visibleItems
|
|
32
45
|
if (navigation === _constants.LIST_NAVIGATION_TYPES.ON_DEMAND) {
|
|
33
46
|
var itemCount = 0;
|
|
@@ -56,7 +69,7 @@ var usePaginatedGroupedData = exports.usePaginatedGroupedData = function usePagi
|
|
|
56
69
|
return paginatedGroups;
|
|
57
70
|
}
|
|
58
71
|
|
|
59
|
-
// For regular pagination
|
|
72
|
+
// For regular client-side pagination
|
|
60
73
|
var startIndex = (currentPage - 1) * pagesize;
|
|
61
74
|
var endIndex = currentPage * pagesize;
|
|
62
75
|
|
|
@@ -117,5 +130,5 @@ var usePaginatedGroupedData = exports.usePaginatedGroupedData = function usePagi
|
|
|
117
130
|
_iterator2.f();
|
|
118
131
|
}
|
|
119
132
|
return result;
|
|
120
|
-
}, [groupedData, navigation, currentPage, pagesize, visibleItems]);
|
|
133
|
+
}, [groupedData, navigation, currentPage, pagesize, visibleItems, isServerSidePagination]);
|
|
121
134
|
};
|