@wavemaker-ai/react-runtime 1.0.0-rc.647469 → 1.0.0-rc.647502
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.d.ts +7 -0
- package/actions/login-action.d.ts +11 -0
- package/actions/logout-action.d.ts +10 -0
- package/actions/navigation-action.d.ts +35 -0
- package/actions/navigation-action.js +23 -5
- package/actions/notification-action.d.ts +20 -0
- package/actions/timer-action.d.ts +27 -0
- package/components/advanced/carousel/index.d.ts +1 -0
- package/components/advanced/carousel/index.js +2 -1
- package/components/advanced/carousel/template.d.ts +1 -0
- package/components/advanced/carousel/template.js +2 -1
- package/components/advanced/login/index.d.ts +1 -0
- package/components/advanced/marquee/index.d.ts +1 -0
- package/components/advanced/marquee/index.js +2 -1
- package/components/basic/anchor/index.d.ts +1 -0
- package/components/basic/anchor/index.js +4 -3
- package/components/basic/audio/index.d.ts +1 -0
- package/components/basic/audio/index.js +3 -2
- package/components/basic/html/index.d.ts +1 -0
- package/components/basic/icon/index.d.ts +1 -0
- package/components/basic/icon/index.js +4 -7
- package/components/basic/iframe/iframe.utils.d.ts +1 -1
- package/components/basic/iframe/iframe.utils.js +8 -4
- package/components/basic/iframe/index.d.ts +1 -0
- package/components/basic/label/index.d.ts +1 -0
- package/components/basic/label/index.js +3 -2
- package/components/basic/message/index.js +1 -1
- package/components/basic/picture/index.d.ts +1 -0
- package/components/basic/picture/index.js +3 -4
- package/components/basic/progress-bar/index.d.ts +1 -0
- package/components/basic/progress-bar/index.js +2 -1
- 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 +3 -0
- package/components/basic/search/index.js +7 -4
- package/components/basic/search/props.d.ts +2 -0
- package/components/basic/spinner/index.d.ts +1 -0
- package/components/basic/tile/index.d.ts +1 -0
- package/components/basic/tile/index.js +2 -1
- package/components/basic/tree/Components/TreeNodeComponent.js +9 -5
- package/components/basic/tree/index.d.ts +1 -0
- package/components/basic/tree/index.js +14 -3
- package/components/basic/tree/utils.d.ts +2 -0
- package/components/basic/tree/utils.js +11 -1
- package/components/basic/video/index.d.ts +1 -0
- package/components/basic/video/index.js +40 -23
- package/components/chart/index.d.ts +1 -0
- package/components/common/AppSpinner.js +2 -5
- package/components/container/accordion/accordion-pane/index.d.ts +1 -0
- package/components/container/accordion/accordion-pane/index.js +1 -4
- package/components/container/accordion/index.d.ts +1 -0
- package/components/container/index.d.ts +3 -0
- package/components/container/index.js +6 -1
- 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/layout-grid/index.js +4 -8
- 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 +11 -6
- package/components/container/panel/components/panel-header/props.d.ts +5 -0
- package/components/container/panel/index.d.ts +1 -0
- package/components/container/panel/index.js +2 -1
- package/components/container/props.d.ts +2 -0
- package/components/container/repeat-template/index.d.ts +22 -1
- package/components/container/repeat-template/index.js +2 -1
- package/components/container/tabs/index.d.ts +3 -1
- package/components/container/tabs/index.js +102 -51
- package/components/container/tabs/props.d.ts +12 -0
- package/components/container/tabs/tab-pane/index.d.ts +1 -0
- package/components/container/tabs/tab-pane/index.js +28 -11
- package/components/container/wizard/index.d.ts +2 -0
- package/components/container/wizard/wizard-step/index.d.ts +1 -0
- package/components/container/wizard/wizard-step/index.js +2 -2
- package/components/data/card/card-actions/index.d.ts +1 -0
- package/components/data/card/card-actions/index.js +3 -5
- package/components/data/card/card-content/index.d.ts +1 -0
- package/components/data/card/card-content/index.js +3 -13
- package/components/data/card/card-footer/index.d.ts +1 -0
- package/components/data/card/card-footer/index.js +3 -5
- package/components/data/card/index.d.ts +1 -0
- package/components/data/card/index.js +3 -14
- package/components/data/form/dynamic-fields/index.js +7 -1
- package/components/data/form/dynamic-fields/props.d.ts +1 -0
- package/components/data/form/form-action/index.d.ts +2 -0
- package/components/data/form/form-body/index.js +2 -1
- package/components/data/form/form-field/base-field.js +4 -3
- package/components/data/form/form-footer/index.js +2 -1
- package/components/data/list/components/ListItemWithTemplate.js +4 -2
- package/components/data/list/hooks/props.d.ts +2 -2
- package/components/data/list/hooks/useListEventHandlers.js +6 -6
- package/components/data/list/index.d.ts +2 -0
- package/components/data/list/index.js +3 -4
- package/components/data/list/props.d.ts +2 -1
- package/components/data/list/utils/list-widget-methods.d.ts +2 -1
- package/components/data/table/components/RowCells.d.ts +16 -2
- package/components/data/table/components/RowCells.js +38 -24
- package/components/data/table/components/TableBody.js +11 -3
- package/components/data/table/components/TableDataRow.d.ts +3 -0
- package/components/data/table/components/TableDataRow.js +11 -3
- package/components/data/table/components/TableHeader.js +1 -4
- package/components/data/table/hooks/index.d.ts +1 -0
- package/components/data/table/hooks/index.js +12 -0
- package/components/data/table/hooks/useCustomExpressionColumns.d.ts +16 -0
- package/components/data/table/hooks/useCustomExpressionColumns.js +88 -0
- package/components/data/table/hooks/useDynamicColumns.js +1 -1
- package/components/data/table/hooks/useResponsiveColumns.d.ts +1 -0
- package/components/data/table/hooks/useRowSelection.d.ts +1 -1
- package/components/data/table/hooks/useRowSelection.js +26 -5
- package/components/data/table/hooks/useTableInitialization.js +2 -1
- package/components/data/table/index.d.ts +4 -0
- package/components/data/table/index.js +77 -12
- package/components/data/table/live-table/index.d.ts +1 -0
- package/components/data/table/props.d.ts +7 -0
- 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.js +7 -1
- package/components/data/table/utils/columnBuilder.js +1 -1
- package/components/data/table/utils/index.js +2 -2
- package/components/data/table/utils/renderDisplayCell.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/index.js +2 -4
- 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/iframe-dialog/index.d.ts +2 -0
- package/components/dialogs/login-dialog/index.d.ts +2 -0
- package/components/dialogs/page-dialog/index.d.ts +2 -0
- package/components/form/button/index.d.ts +1 -0
- package/components/form/button/index.js +4 -3
- package/components/form/button-group/index.d.ts +1 -0
- package/components/form/button-group/index.js +2 -1
- package/components/input/calendar/index.d.ts +2 -0
- package/components/input/chips/index.d.ts +2 -0
- package/components/input/color-picker/index.d.ts +2 -0
- package/components/input/composite/index.d.ts +1 -0
- package/components/input/currency/index.d.ts +2 -0
- package/components/input/default/checkbox/index.d.ts +2 -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 +2 -0
- package/components/input/epoch/date/components/DatePickerPopover.js +11 -29
- package/components/input/epoch/date/index.d.ts +1 -0
- package/components/input/epoch/datetime/index.d.ts +1 -0
- package/components/input/epoch/datetime/index.js +10 -25
- package/components/input/epoch/time/index.d.ts +1 -0
- package/components/input/epoch/time/index.js +1 -1
- package/components/input/epoch/time/utils.d.ts +0 -17
- package/components/input/epoch/time/utils.js +1 -18
- package/components/input/fileupload/index.d.ts +1 -0
- package/components/input/number/index.d.ts +2 -0
- package/components/input/rating/index.d.ts +2 -0
- package/components/input/rating/index.js +14 -17
- package/components/input/select/index.d.ts +2 -0
- package/components/input/select/index.js +1 -4
- package/components/input/slider/index.d.ts +2 -0
- package/components/input/slider/index.js +13 -12
- package/components/input/text/index.d.ts +2 -0
- package/components/input/text/index.js +3 -14
- package/components/input/textarea/index.d.ts +2 -0
- package/components/input/textarea/index.js +7 -10
- package/components/input/upload/index.d.ts +2 -0
- package/components/input/upload/index.js +3 -5
- package/components/layout/footer/index.js +2 -1
- package/components/layout/footer/props.d.ts +1 -0
- package/components/layout/header/index.js +2 -1
- package/components/layout/header/props.d.ts +1 -0
- package/components/layout/leftnav/index.js +2 -1
- package/components/layout/leftnav/props.d.ts +1 -0
- package/components/layout/rightnav/index.js +2 -1
- package/components/layout/rightnav/props.d.ts +1 -0
- package/components/layout/topnav/index.js +2 -1
- package/components/layout/topnav/props.d.ts +1 -0
- package/components/navbar/index.d.ts +1 -0
- package/components/navbar/index.js +2 -1
- package/components/navbar/nav/index.d.ts +1 -0
- package/components/navbar/nav-item/index.d.ts +1 -0
- package/components/navbar/nav-item/index.js +2 -1
- package/components/navigation/breadcrumb/index.d.ts +1 -0
- package/components/navigation/menu/index.d.ts +1 -0
- package/components/navigation/menu/index.js +5 -4
- package/components/navigation/popover/index.d.ts +2 -1
- package/components/navigation/popover/index.js +1 -1
- package/components/page/error-boundary/index.js +5 -5
- package/components/page/index.js +13 -9
- package/components/page/partial/index.d.ts +1 -0
- package/components/prefab/container/index.js +2 -1
- package/context/WidgetProvider.js +2 -2
- package/core/app.service.js +40 -35
- package/core/constants/events.js +6 -0
- package/core/constants/index.d.ts +9 -1
- package/core/constants/index.js +32 -5
- package/core/formatter/date-formatters.d.ts +1 -1
- package/core/formatter/date-formatters.js +38 -13
- package/core/formatter/types.d.ts +1 -1
- package/core/proxy-service.js +15 -5
- package/core/security.service.d.ts +12 -0
- package/core/util/index.js +3 -2
- package/higherOrder/BaseApp.js +2 -2
- package/higherOrder/BasePage.d.ts +0 -17
- package/higherOrder/BasePage.js +53 -104
- package/higherOrder/BasePrefab.js +69 -59
- package/higherOrder/props.d.ts +1 -0
- package/higherOrder/withBaseWrapper.js +3 -4
- package/hooks/useAccess.js +13 -0
- package/mui-config/theme-provider.d.ts +3 -0
- package/mui-config/theme.d.ts +2 -0
- package/mui-config/theme.js +1 -4
- package/package-lock.json +2640 -615
- package/package.json +23 -4
- package/runtime-dynamic/App.d.ts +7 -0
- package/runtime-dynamic/App.js +144 -0
- package/runtime-dynamic/app-initializer.d.ts +15 -0
- package/runtime-dynamic/app-initializer.js +447 -0
- package/runtime-dynamic/components/ErrorBoundary.d.ts +18 -0
- package/runtime-dynamic/components/ErrorBoundary.js +93 -0
- package/runtime-dynamic/components/PageWrapper.d.ts +1 -0
- package/runtime-dynamic/components/PageWrapper.js +43 -0
- package/runtime-dynamic/components/PrefabPreview.d.ts +1 -0
- package/runtime-dynamic/components/PrefabPreview.js +84 -0
- package/runtime-dynamic/components/partial-content.d.ts +15 -0
- package/runtime-dynamic/components/partial-content.js +50 -0
- package/runtime-dynamic/components/prefab-content.d.ts +10 -0
- package/runtime-dynamic/components/prefab-content.js +31 -0
- package/runtime-dynamic/components/use-dynamic-component.d.ts +10 -0
- package/runtime-dynamic/components/use-dynamic-component.js +165 -0
- package/runtime-dynamic/factories/build-base-page-like-component.d.ts +8 -0
- package/runtime-dynamic/factories/build-base-page-like-component.js +59 -0
- package/runtime-dynamic/factories/prefab-factory.d.ts +3 -0
- package/runtime-dynamic/factories/prefab-factory.js +82 -0
- package/runtime-dynamic/factories/startup-info.d.ts +6 -0
- package/runtime-dynamic/factories/startup-info.js +28 -0
- package/runtime-dynamic/factories/utils.d.ts +23 -0
- package/runtime-dynamic/factories/utils.js +131 -0
- package/runtime-dynamic/index.d.ts +14 -0
- package/runtime-dynamic/index.js +191 -0
- package/runtime-dynamic/main.d.ts +2 -0
- package/runtime-dynamic/main.js +84 -0
- package/runtime-dynamic/preview-mode.d.ts +15 -0
- package/runtime-dynamic/preview-mode.js +31 -0
- package/runtime-dynamic/preview-navigation.d.ts +6 -0
- package/runtime-dynamic/preview-navigation.js +38 -0
- package/runtime-dynamic/preview-resource-base.d.ts +12 -0
- package/runtime-dynamic/preview-resource-base.js +65 -0
- package/runtime-dynamic/registry/component-registry.d.ts +3 -0
- package/runtime-dynamic/registry/component-registry.js +353 -0
- package/runtime-dynamic/registry/custom-widget-registry.d.ts +7 -0
- package/runtime-dynamic/registry/custom-widget-registry.js +18 -0
- package/runtime-dynamic/registry/index.d.ts +2 -0
- package/runtime-dynamic/registry/index.js +63 -0
- package/runtime-dynamic/registry/store.d.ts +9 -0
- package/runtime-dynamic/registry/store.js +26 -0
- package/runtime-dynamic/routes.d.ts +2 -0
- package/runtime-dynamic/routes.js +107 -0
- package/runtime-dynamic/services/app-extension-provider.d.ts +1 -0
- package/runtime-dynamic/services/app-extension-provider.js +45 -0
- package/runtime-dynamic/services/cache.d.ts +29 -0
- package/runtime-dynamic/services/cache.js +57 -0
- package/runtime-dynamic/services/component-ref-provider.d.ts +12 -0
- package/runtime-dynamic/services/component-ref-provider.js +149 -0
- package/runtime-dynamic/services/css-scoping.d.ts +2 -0
- package/runtime-dynamic/services/css-scoping.js +53 -0
- package/runtime-dynamic/services/fragment-url.d.ts +16 -0
- package/runtime-dynamic/services/fragment-url.js +74 -0
- package/runtime-dynamic/services/index.d.ts +10 -0
- package/runtime-dynamic/services/index.js +152 -0
- package/runtime-dynamic/services/markup-transpiler.d.ts +12 -0
- package/runtime-dynamic/services/markup-transpiler.js +250 -0
- package/runtime-dynamic/services/prefab-resources.d.ts +18 -0
- package/runtime-dynamic/services/prefab-resources.js +159 -0
- package/runtime-dynamic/services/resource-manager.d.ts +2 -0
- package/runtime-dynamic/services/resource-manager.js +66 -0
- package/runtime-dynamic/services/script-executor.d.ts +8 -0
- package/runtime-dynamic/services/script-executor.js +90 -0
- package/runtime-dynamic/services/variable-factory.d.ts +2 -0
- package/runtime-dynamic/services/variable-factory.js +260 -0
- package/runtime-dynamic/services/variable-registry.d.ts +12 -0
- package/runtime-dynamic/services/variable-registry.js +118 -0
- package/runtime-dynamic/services/variable-transpiler.d.ts +5 -0
- package/runtime-dynamic/services/variable-transpiler.js +159 -0
- package/runtime-dynamic/shims/next-image.d.ts +35 -0
- package/runtime-dynamic/shims/next-image.js +60 -0
- package/runtime-dynamic/shims/next-link.d.ts +25 -0
- package/runtime-dynamic/shims/next-link.js +33 -0
- package/runtime-dynamic/shims/next-navigation.d.ts +16 -0
- package/runtime-dynamic/shims/next-navigation.js +52 -0
- package/runtime-dynamic/utils/index.d.ts +9 -0
- package/runtime-dynamic/utils/index.js +40 -0
- package/store/middleware/navigationMiddleware.js +1 -1
- package/store/slices/appConfigSlice.js +10 -8
- package/store/slices/authSlice.js +46 -32
- package/tsconfig.declaration.tsbuildinfo +1 -1
- package/types/index.d.ts +1 -0
- package/utils/attr.js +71 -14
- package/utils/custom-expression/index.d.ts +43 -0
- package/utils/custom-expression/index.js +161 -0
- package/utils/custom-expression/parser.d.ts +15 -0
- package/utils/custom-expression/parser.js +208 -0
- package/utils/layoutsize-util.d.ts +1 -0
- package/utils/layoutsize-util.js +57 -0
- package/utils/lib-error-skipper.d.ts +4 -26
- package/utils/lib-error-skipper.js +41 -165
- package/utils/style-utils.d.ts +6 -0
- package/utils/style-utils.js +10 -1
- package/variables/metadata.service.js +2 -3
- package/variables/model-variable.js +10 -7
- package/variables/service-variable.d.ts +1 -0
- package/variables/service-variable.js +26 -6
- package/components/input/epoch/datetime/styled.d.ts +0 -78
- package/components/input/epoch/datetime/styled.js +0 -90
|
@@ -216,4 +216,16 @@ Object.keys(_useDynamicColumns).forEach(function (key) {
|
|
|
216
216
|
return _useDynamicColumns[key];
|
|
217
217
|
}
|
|
218
218
|
});
|
|
219
|
+
});
|
|
220
|
+
var _useCustomExpressionColumns = require("./useCustomExpressionColumns");
|
|
221
|
+
Object.keys(_useCustomExpressionColumns).forEach(function (key) {
|
|
222
|
+
if (key === "default" || key === "__esModule") return;
|
|
223
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
224
|
+
if (key in exports && exports[key] === _useCustomExpressionColumns[key]) return;
|
|
225
|
+
Object.defineProperty(exports, key, {
|
|
226
|
+
enumerable: true,
|
|
227
|
+
get: function get() {
|
|
228
|
+
return _useCustomExpressionColumns[key];
|
|
229
|
+
}
|
|
230
|
+
});
|
|
219
231
|
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type MutableRefObject } from "react";
|
|
2
|
+
import { type CustomExpressionColumnSource, type CustomExpressionComponent } from "@/utils/custom-expression";
|
|
3
|
+
export type UseCustomExpressionColumnsArgs = {
|
|
4
|
+
columnSource: CustomExpressionColumnSource;
|
|
5
|
+
listenerRef: MutableRefObject<unknown>;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Syncs parsed `customExpression` column renderers with the table column proxy:
|
|
9
|
+
* signature dedupe, stale async-merge guard, revision bumps for memoized cells.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useCustomExpressionColumns({ columnSource, listenerRef, }: UseCustomExpressionColumnsArgs): {
|
|
12
|
+
customColumns: Record<string, CustomExpressionComponent>;
|
|
13
|
+
customColumnsRevision: number;
|
|
14
|
+
customExpressionSignature: string;
|
|
15
|
+
mergeParsedCustomColumns: () => Promise<void>;
|
|
16
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useCustomExpressionColumns = useCustomExpressionColumns;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
+
var _react = require("react");
|
|
12
|
+
var _customExpression = require("../../../../utils/custom-expression");
|
|
13
|
+
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
|
+
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
|
+
* Syncs parsed `customExpression` column renderers with the table column proxy:
|
|
17
|
+
* signature dedupe, stale async-merge guard, revision bumps for memoized cells.
|
|
18
|
+
*/
|
|
19
|
+
function useCustomExpressionColumns(_ref) {
|
|
20
|
+
var columnSource = _ref.columnSource,
|
|
21
|
+
listenerRef = _ref.listenerRef;
|
|
22
|
+
var mergeGenerationRef = (0, _react.useRef)(0);
|
|
23
|
+
var lastMergedSignatureRef = (0, _react.useRef)(null);
|
|
24
|
+
var _useState = (0, _react.useState)({}),
|
|
25
|
+
customColumns = _useState[0],
|
|
26
|
+
setCustomColumns = _useState[1];
|
|
27
|
+
var _useState2 = (0, _react.useState)(0),
|
|
28
|
+
customColumnsRevision = _useState2[0],
|
|
29
|
+
setCustomColumnsRevision = _useState2[1];
|
|
30
|
+
var customExpressionSignature = (0, _react.useMemo)(function () {
|
|
31
|
+
return (0, _customExpression.buildCustomExpressionSignature)(columnSource);
|
|
32
|
+
}, [columnSource]);
|
|
33
|
+
var mergeParsedCustomColumns = (0, _react.useCallback)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
34
|
+
var customExprKeys, sig, mergeGen, newColumns;
|
|
35
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
36
|
+
while (1) switch (_context.prev = _context.next) {
|
|
37
|
+
case 0:
|
|
38
|
+
customExprKeys = Object.keys(columnSource).filter(function (key) {
|
|
39
|
+
return columnSource[key].customExpression;
|
|
40
|
+
});
|
|
41
|
+
if (!(customExprKeys.length === 0)) {
|
|
42
|
+
_context.next = 4;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
lastMergedSignatureRef.current = null;
|
|
46
|
+
return _context.abrupt("return");
|
|
47
|
+
case 4:
|
|
48
|
+
sig = customExpressionSignature;
|
|
49
|
+
if (!(lastMergedSignatureRef.current === sig)) {
|
|
50
|
+
_context.next = 7;
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
return _context.abrupt("return");
|
|
54
|
+
case 7:
|
|
55
|
+
mergeGen = ++mergeGenerationRef.current;
|
|
56
|
+
_context.next = 10;
|
|
57
|
+
return (0, _customExpression.buildCustomExpressionComponentsMap)({
|
|
58
|
+
columnSource: columnSource,
|
|
59
|
+
listener: listenerRef.current
|
|
60
|
+
});
|
|
61
|
+
case 10:
|
|
62
|
+
newColumns = _context.sent;
|
|
63
|
+
if (!(mergeGen !== mergeGenerationRef.current)) {
|
|
64
|
+
_context.next = 13;
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
return _context.abrupt("return");
|
|
68
|
+
case 13:
|
|
69
|
+
lastMergedSignatureRef.current = sig;
|
|
70
|
+
setCustomColumns(function (prev) {
|
|
71
|
+
return _objectSpread(_objectSpread({}, prev), newColumns);
|
|
72
|
+
});
|
|
73
|
+
setCustomColumnsRevision(function (r) {
|
|
74
|
+
return r + 1;
|
|
75
|
+
});
|
|
76
|
+
case 16:
|
|
77
|
+
case "end":
|
|
78
|
+
return _context.stop();
|
|
79
|
+
}
|
|
80
|
+
}, _callee);
|
|
81
|
+
})), [columnSource, customExpressionSignature, listenerRef]);
|
|
82
|
+
return {
|
|
83
|
+
customColumns: customColumns,
|
|
84
|
+
customColumnsRevision: customColumnsRevision,
|
|
85
|
+
customExpressionSignature: customExpressionSignature,
|
|
86
|
+
mergeParsedCustomColumns: mergeParsedCustomColumns
|
|
87
|
+
};
|
|
88
|
+
}
|
|
@@ -29,7 +29,7 @@ var _hasTableColumnsInChildren = function hasTableColumnsInChildren(children) {
|
|
|
29
29
|
_react["default"].Children.forEach(children, function (child) {
|
|
30
30
|
if (!(child !== null && child !== void 0 && child.props)) return;
|
|
31
31
|
var name = child.props.name || "";
|
|
32
|
-
if (name.includes("wm_table_column")) {
|
|
32
|
+
if (name.includes("wm_table_column") || name.includes("col_")) {
|
|
33
33
|
found = true;
|
|
34
34
|
} else if (name.includes("group")) {
|
|
35
35
|
if (_hasTableColumnsInChildren(child.props.children)) {
|
|
@@ -61,6 +61,7 @@ export declare const useResponsiveColumns: (columns: WmTableColumnProps[]) => {
|
|
|
61
61
|
eventCallback?: (eventName: string, data: any) => void;
|
|
62
62
|
forwardedRef?: React.ForwardedRef<any>;
|
|
63
63
|
viewParent?: any;
|
|
64
|
+
destroy?: ((names: string[]) => void) | ((formName?: string) => void);
|
|
64
65
|
hint?: string;
|
|
65
66
|
arialabel?: string;
|
|
66
67
|
tabindex?: number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { UseRowSelectionProps, UseRowSelectionReturn } from "../props";
|
|
2
|
-
export declare const useRowSelection: ({ radioselect, multiselect, gridfirstrowselect, internalDataset, cellState, name, statehandler, initialActualPageSize, getTableState: getTableCurrentState, onRowselect, onRowdeselect, listener, navigation, }: UseRowSelectionProps) => UseRowSelectionReturn;
|
|
2
|
+
export declare const useRowSelection: ({ radioselect, multiselect, gridfirstrowselect, internalDataset, cellState, name, statehandler, initialActualPageSize, getTableState: getTableCurrentState, onRowselect, onRowdeselect, listener, navigation, onSyncSelectedItems, }: UseRowSelectionProps) => UseRowSelectionReturn;
|
|
@@ -27,7 +27,8 @@ var useRowSelection = exports.useRowSelection = function useRowSelection(_ref) {
|
|
|
27
27
|
onRowdeselect = _ref.onRowdeselect,
|
|
28
28
|
listener = _ref.listener,
|
|
29
29
|
_ref$navigation = _ref.navigation,
|
|
30
|
-
navigation = _ref$navigation === void 0 ? "Basic" : _ref$navigation
|
|
30
|
+
navigation = _ref$navigation === void 0 ? "Basic" : _ref$navigation,
|
|
31
|
+
onSyncSelectedItems = _ref.onSyncSelectedItems;
|
|
31
32
|
// Keep a ref to always have the latest dataset
|
|
32
33
|
var datasetRef = (0, _react.useRef)(internalDataset);
|
|
33
34
|
(0, _react.useEffect)(function () {
|
|
@@ -133,10 +134,13 @@ var useRowSelection = exports.useRowSelection = function useRowSelection(_ref) {
|
|
|
133
134
|
// Helper to trigger selection callbacks
|
|
134
135
|
var triggerSelectionCallback = (0, _react.useCallback)(function (event, rowData, callback) {
|
|
135
136
|
if (callback && rowData) {
|
|
137
|
+
// Sync selectedItems into the widget proxy BEFORE firing the user callback so
|
|
138
|
+
// that Page.Widgets.<table>.selectedItems is up-to-date when the handler runs.
|
|
139
|
+
onSyncSelectedItems === null || onSyncSelectedItems === void 0 || onSyncSelectedItems(_selectionUtils.selectionStateHelpers.getSelection(cellState));
|
|
136
140
|
var cleanedRow = (0, _utils.cleanRowData)([rowData])[0];
|
|
137
141
|
callback(event, getWidgetRef(), cleanedRow);
|
|
138
142
|
}
|
|
139
|
-
}, [getWidgetRef]);
|
|
143
|
+
}, [getWidgetRef, onSyncSelectedItems, cellState]);
|
|
140
144
|
|
|
141
145
|
// Handle selection for radio mode (replaces previous selection)
|
|
142
146
|
var handleRadioSelection = (0, _react.useCallback)(function (rowId, rowData) {
|
|
@@ -180,16 +184,33 @@ var useRowSelection = exports.useRowSelection = function useRowSelection(_ref) {
|
|
|
180
184
|
|
|
181
185
|
// Toggle all rows selection for multiselect
|
|
182
186
|
var handleSelectAll = (0, _react.useCallback)(function (isSelected) {
|
|
187
|
+
var newIds = [];
|
|
183
188
|
if (isSelected) {
|
|
184
189
|
// Use ref to ensure we always have the latest dataset
|
|
185
|
-
|
|
186
|
-
_selectionUtils.selectionStateHelpers.setAllSelection(cellState,
|
|
190
|
+
newIds = (0, _selectionUtils.getRowIdsFromDataset)(datasetRef.current);
|
|
191
|
+
_selectionUtils.selectionStateHelpers.setAllSelection(cellState, newIds);
|
|
187
192
|
} else {
|
|
188
193
|
_selectionUtils.selectionStateHelpers.clearSelection(cellState);
|
|
189
194
|
}
|
|
190
195
|
forceUpdate({});
|
|
191
196
|
saveStateImmediate();
|
|
192
|
-
|
|
197
|
+
|
|
198
|
+
// Sync selectedItems to proxy once (so Page.Widgets.<table>.selectedItems is up-to-date
|
|
199
|
+
// for any onRowselect/onRowdeselect callbacks that fire below).
|
|
200
|
+
onSyncSelectedItems === null || onSyncSelectedItems === void 0 || onSyncSelectedItems(newIds);
|
|
201
|
+
|
|
202
|
+
// Fire per-row callbacks so user scripts (e.g. onRowselect updating a label) are triggered.
|
|
203
|
+
// onSyncSelectedItems is intentionally NOT called inside each iteration — we already synced
|
|
204
|
+
// the full selection above, avoiding O(N) redundant proxy writes.
|
|
205
|
+
var rows = datasetRef.current;
|
|
206
|
+
var callback = isSelected ? onRowselect : onRowdeselect;
|
|
207
|
+
if (callback && rows.length > 0) {
|
|
208
|
+
rows.forEach(function (row) {
|
|
209
|
+
var cleanedRow = (0, _utils.cleanRowData)([row])[0];
|
|
210
|
+
callback(null, getWidgetRef(), cleanedRow);
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
}, [cellState, saveStateImmediate, onSyncSelectedItems, onRowselect, onRowdeselect, getWidgetRef]);
|
|
193
214
|
|
|
194
215
|
// Handle row selection on click - unified handler
|
|
195
216
|
var handleRowSelectionClick = (0, _react.useCallback)(function (event, rowId, rowData) {
|
|
@@ -95,7 +95,8 @@ var useTableInitialization = exports.useTableInitialization = function useTableI
|
|
|
95
95
|
// Only update form data, preserve current view/edit mode
|
|
96
96
|
formWidget === null || formWidget === void 0 || (_formWidget$setFormDa2 = formWidget.setFormData) === null || _formWidget$setFormDa2 === void 0 || _formWidget$setFormDa2.call(formWidget, getRow);
|
|
97
97
|
} else {
|
|
98
|
-
|
|
98
|
+
var _formWidget$edit;
|
|
99
|
+
formWidget === null || formWidget === void 0 || (_formWidget$edit = formWidget.edit) === null || _formWidget$edit === void 0 || _formWidget$edit.call(formWidget, getRow);
|
|
99
100
|
}
|
|
100
101
|
}, 10);
|
|
101
102
|
}
|
|
@@ -89,6 +89,7 @@ declare const WmTableStandalone: React.ComponentType<{
|
|
|
89
89
|
binddataset?: string;
|
|
90
90
|
onSuccess?: (operation: string, data: any) => void;
|
|
91
91
|
onError?: (event: any, widget: any, data: any, operation: string) => void;
|
|
92
|
+
customExpressionColumns?: Record<string, (rowData: any) => React.ReactNode>;
|
|
92
93
|
standalone?: boolean;
|
|
93
94
|
ref?: React.RefObject<HTMLElement> | React.RefObject<null>;
|
|
94
95
|
animation?: string;
|
|
@@ -115,6 +116,7 @@ declare const WmTableStandalone: React.ComponentType<{
|
|
|
115
116
|
eventCallback?: (eventName: string, data: any) => void;
|
|
116
117
|
forwardedRef?: React.ForwardedRef<any>;
|
|
117
118
|
viewParent?: any;
|
|
119
|
+
destroy?: ((names: string[]) => void) | ((formName?: string) => void);
|
|
118
120
|
hint?: string;
|
|
119
121
|
arialabel?: string;
|
|
120
122
|
tabindex?: number;
|
|
@@ -224,6 +226,7 @@ declare const WmTable: React.ComponentType<{
|
|
|
224
226
|
binddataset?: string;
|
|
225
227
|
onSuccess?: (operation: string, data: any) => void;
|
|
226
228
|
onError?: (event: any, widget: any, data: any, operation: string) => void;
|
|
229
|
+
customExpressionColumns?: Record<string, (rowData: any) => React.ReactNode>;
|
|
227
230
|
standalone?: boolean;
|
|
228
231
|
ref?: React.RefObject<HTMLElement> | React.RefObject<null>;
|
|
229
232
|
animation?: string;
|
|
@@ -250,6 +253,7 @@ declare const WmTable: React.ComponentType<{
|
|
|
250
253
|
eventCallback?: (eventName: string, data: any) => void;
|
|
251
254
|
forwardedRef?: React.ForwardedRef<any>;
|
|
252
255
|
viewParent?: any;
|
|
256
|
+
destroy?: ((names: string[]) => void) | ((formName?: string) => void);
|
|
253
257
|
hint?: string;
|
|
254
258
|
arialabel?: string;
|
|
255
259
|
tabindex?: number;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
"use client";
|
|
2
3
|
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
5
|
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
@@ -32,7 +33,7 @@ var _types = require("@wavemaker-ai/react-runtime/components/data/types");
|
|
|
32
33
|
var _useEditedRows = require("./hooks/use-edited-rows");
|
|
33
34
|
var _scriptPageSizeBroadcast = require("./utils/script-page-size-broadcast");
|
|
34
35
|
var _withStandalone = _interopRequireDefault(require("@wavemaker-ai/react-runtime/higherOrder/withStandalone"));
|
|
35
|
-
var _excluded = ["name", "dataset", "navigation", "children", "listener", "pagesize", "navigationalign", "showrecordcount", "maxsize", "boundarylinks", "allowpagesizechange", "pagesizeoptions", "formposition", "editmode", "spacing", "title", "subheading", "iconclass", "exportOptions", "shownavigation", "onDemandLoad", "showrowindex", "showheader", "enablesort", "enablecolumnselection", "onColumnselect", "onColumndeselect", "radioselect", "radioselecttitle", "radioselectarialabel", "multiselect", "multiselecttitle", "multiselectarialabel", "gridfirstrowselect", "isrowselectable", "rowClass", "deleteoktext", "deletecanceltext", "confirmdelete", "errormessage", "nodatamessage", "loadingdatamsg", "insertmessage", "updatemessage", "deletemessage", "ondemandmessage", "viewlessmessage", "showviewlessbutton", "onRowDelete", "onRowUpdate", "datasource", "binddataset", "onSuccess", "onError", "onRowinsert", "onRowupdate", "onRowdelete", "onRowclick", "onSort", "onBeforerowdelete", "onBeforefilter", "onHeaderclick", "onRowselect", "onRowdeselect", "onSetrecord", "statehandler", "formName", "parentForm", "filtermode", "filteronkeypress", "searchlabel", "onBeforedatarender", "onDatarender", "className", "exportformat", "exportdatasize", "onBeforeexport", "onAfterexport"];
|
|
36
|
+
var _excluded = ["name", "dataset", "navigation", "children", "listener", "pagesize", "navigationalign", "showrecordcount", "maxsize", "boundarylinks", "allowpagesizechange", "pagesizeoptions", "formposition", "editmode", "spacing", "title", "subheading", "iconclass", "exportOptions", "shownavigation", "onDemandLoad", "showrowindex", "showheader", "enablesort", "enablecolumnselection", "onColumnselect", "onColumndeselect", "radioselect", "radioselecttitle", "radioselectarialabel", "multiselect", "multiselecttitle", "multiselectarialabel", "gridfirstrowselect", "isrowselectable", "rowClass", "deleteoktext", "deletecanceltext", "confirmdelete", "errormessage", "nodatamessage", "loadingdatamsg", "insertmessage", "updatemessage", "deletemessage", "ondemandmessage", "viewlessmessage", "showviewlessbutton", "onRowDelete", "onRowUpdate", "datasource", "binddataset", "onSuccess", "onError", "onRowinsert", "onRowupdate", "onRowdelete", "onRowclick", "onSort", "onBeforerowdelete", "onBeforefilter", "onHeaderclick", "onRowselect", "onRowdeselect", "onSetrecord", "statehandler", "formName", "parentForm", "filtermode", "filteronkeypress", "searchlabel", "onBeforedatarender", "onDatarender", "className", "exportformat", "exportdatasize", "onBeforeexport", "onAfterexport", "styles"];
|
|
36
37
|
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" != _typeof3(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); }
|
|
37
38
|
var __jsx = _react["default"].createElement;
|
|
38
39
|
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; }
|
|
@@ -159,12 +160,15 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
159
160
|
exportdatasize = props.exportdatasize,
|
|
160
161
|
onBeforeexport = props.onBeforeexport,
|
|
161
162
|
onAfterexport = props.onAfterexport,
|
|
163
|
+
styles = props.styles,
|
|
162
164
|
rest = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
163
165
|
// When same partial is used multiple times (e.g. in tabs), use unique storage key to prevent state collision
|
|
164
166
|
var effectiveStorageKey = (0, _react.useMemo)(function () {
|
|
165
167
|
return name + (listener !== null && listener !== void 0 && listener.partialName ? "__".concat(listener === null || listener === void 0 ? void 0 : listener.partialName) : "");
|
|
166
168
|
}, [name, listener === null || listener === void 0 ? void 0 : listener.partialName]);
|
|
167
169
|
var widgetRegistrationKey = props["item-id"] || name;
|
|
170
|
+
var listenerRef = (0, _react.useRef)(listener);
|
|
171
|
+
listenerRef.current = listener;
|
|
168
172
|
var loading = (datasource === null || datasource === void 0 ? void 0 : datasource.loading) || false;
|
|
169
173
|
var prevDatasetRef = (0, _react.useRef)(dataset);
|
|
170
174
|
var prevSelectedRow = (0, _react.useRef)(null);
|
|
@@ -260,6 +264,15 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
260
264
|
// Use the table name as unique ID to prevent collisions between multiple tables
|
|
261
265
|
var cellState = (0, _hooks.useCellState)(name);
|
|
262
266
|
|
|
267
|
+
// Ref holding the "sync selectedItems" implementation, assigned each render after
|
|
268
|
+
// tableApis is defined. A stable wrapper is passed to useRowSelection so it can
|
|
269
|
+
// call the latest version without being in its dependency array.
|
|
270
|
+
var syncSelectedItemsImplRef = (0, _react.useRef)(null);
|
|
271
|
+
var onSyncSelectedItems = (0, _react.useCallback)(function (ids) {
|
|
272
|
+
var _syncSelectedItemsImp;
|
|
273
|
+
return (_syncSelectedItemsImp = syncSelectedItemsImplRef.current) === null || _syncSelectedItemsImp === void 0 ? void 0 : _syncSelectedItemsImp.call(syncSelectedItemsImplRef, ids);
|
|
274
|
+
}, []);
|
|
275
|
+
|
|
263
276
|
// ==================== STATE PERSISTENCE ====================
|
|
264
277
|
// Restore persisted state before initializing table
|
|
265
278
|
var _useMemo = (0, _react.useMemo)(function () {
|
|
@@ -384,7 +397,8 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
384
397
|
onRowselect: onRowselect,
|
|
385
398
|
onRowdeselect: onRowdeselect,
|
|
386
399
|
listener: listener,
|
|
387
|
-
navigation: navigation
|
|
400
|
+
navigation: navigation,
|
|
401
|
+
onSyncSelectedItems: onSyncSelectedItems
|
|
388
402
|
}),
|
|
389
403
|
selectedRowIds = _useRowSelection.selectedRowIds,
|
|
390
404
|
useMultiSelect = _useRowSelection.useMultiSelect,
|
|
@@ -752,6 +766,14 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
752
766
|
var columnsProxy = (0, _react.useMemo)(function () {
|
|
753
767
|
return (0, _columnProxy.createColumnsProxy)(wmTableColumns, applyOverride, setColumnsVersion, setSummaryRowDef);
|
|
754
768
|
}, [wmTableColumns, applyOverride, setColumnsVersion, setSummaryRowDef]);
|
|
769
|
+
var _useCustomExpressionC = (0, _hooks.useCustomExpressionColumns)({
|
|
770
|
+
columnSource: columnsProxy,
|
|
771
|
+
listenerRef: listenerRef
|
|
772
|
+
}),
|
|
773
|
+
customColumns = _useCustomExpressionC.customColumns,
|
|
774
|
+
customColumnsRevision = _useCustomExpressionC.customColumnsRevision,
|
|
775
|
+
customExpressionSignature = _useCustomExpressionC.customExpressionSignature,
|
|
776
|
+
mergeParsedCustomColumns = _useCustomExpressionC.mergeParsedCustomColumns;
|
|
755
777
|
columnsStateRef.current = columns;
|
|
756
778
|
var columnsForTable = (0, _react.useMemo)(function () {
|
|
757
779
|
var base = columnsStateRef.current || [];
|
|
@@ -1155,6 +1177,12 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
1155
1177
|
// data
|
|
1156
1178
|
columnsProxy // columns (including dynamic ones)
|
|
1157
1179
|
);
|
|
1180
|
+
var customExprKeys = Object.keys(columnsProxy).filter(function (key) {
|
|
1181
|
+
return columnsProxy[key].customExpression;
|
|
1182
|
+
});
|
|
1183
|
+
if (customExprKeys.length > 0) {
|
|
1184
|
+
void mergeParsedCustomColumns()["finally"](function () {});
|
|
1185
|
+
}
|
|
1158
1186
|
var nextRows = internalDataset.map(function (r) {
|
|
1159
1187
|
return (0, _typeof2["default"])(r) === "object" && r !== null ? _objectSpread({}, r) : r;
|
|
1160
1188
|
});
|
|
@@ -1180,7 +1208,14 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
1180
1208
|
});
|
|
1181
1209
|
}
|
|
1182
1210
|
}
|
|
1183
|
-
}, [internalDataset, wmTableColumns, onBeforedatarender, onDatarender, name, isDynamicTable, table.getState().pagination.pageIndex, setInternalDataset]);
|
|
1211
|
+
}, [internalDataset, wmTableColumns, onBeforedatarender, onDatarender, name, isDynamicTable, table.getState().pagination.pageIndex, setInternalDataset, columnsProxy, mergeParsedCustomColumns]);
|
|
1212
|
+
|
|
1213
|
+
// Re-parse when custom-expression markup signature changes, or when rows appear after empty dataset.
|
|
1214
|
+
(0, _react.useEffect)(function () {
|
|
1215
|
+
if (!onBeforedatarender) return;
|
|
1216
|
+
if (internalDataset.length === 0) return;
|
|
1217
|
+
void mergeParsedCustomColumns();
|
|
1218
|
+
}, [customExpressionSignature, mergeParsedCustomColumns, onBeforedatarender, internalDataset.length]);
|
|
1184
1219
|
// Use table initialization hook
|
|
1185
1220
|
(0, _hooks.useTableInitialization)({
|
|
1186
1221
|
internalDataset: internalDataset,
|
|
@@ -1456,6 +1491,33 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
1456
1491
|
rowDefInstances: rowDefInstances
|
|
1457
1492
|
};
|
|
1458
1493
|
|
|
1494
|
+
// Keep the sync-selected-items implementation up-to-date every render so that
|
|
1495
|
+
// the stable onSyncSelectedItems callback (passed to useRowSelection) always has
|
|
1496
|
+
// access to the latest tableApis / internalDataset / listener values.
|
|
1497
|
+
syncSelectedItemsImplRef.current = function (newSelectedIds) {
|
|
1498
|
+
if (!(listener !== null && listener !== void 0 && listener.onChange)) return;
|
|
1499
|
+
var getRowId = function getRowId(row) {
|
|
1500
|
+
return row._wmTableRowId || String(row.id);
|
|
1501
|
+
};
|
|
1502
|
+
var selectedRows = internalDataset.filter(function (row) {
|
|
1503
|
+
return newSelectedIds.includes(getRowId(row));
|
|
1504
|
+
});
|
|
1505
|
+
var selectedItems = (0, _utils.cleanRowData)(selectedRows);
|
|
1506
|
+
if (!(0, _lodashEs.isEqual)(prevSelectedRow.current, selectedItems)) {
|
|
1507
|
+
prevSelectedRow.current = selectedItems;
|
|
1508
|
+
if (tableApisRegistered.current) {
|
|
1509
|
+
listener.onChange(widgetRegistrationKey, {
|
|
1510
|
+
selectedItems: selectedItems
|
|
1511
|
+
});
|
|
1512
|
+
} else {
|
|
1513
|
+
tableApisRegistered.current = true;
|
|
1514
|
+
listener.onChange(widgetRegistrationKey, _objectSpread(_objectSpread({}, tableApis), {}, {
|
|
1515
|
+
selectedItems: selectedItems
|
|
1516
|
+
}));
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
};
|
|
1520
|
+
|
|
1459
1521
|
// Register table with parent form's formWidgets when parentForm is present
|
|
1460
1522
|
(0, _react.useEffect)(function () {
|
|
1461
1523
|
var _listener$Widgets8;
|
|
@@ -1504,21 +1566,21 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
1504
1566
|
// Clean and format selecteditem - always return as array
|
|
1505
1567
|
var cleanedRows = (0, _utils.cleanRowData)(selectedRows);
|
|
1506
1568
|
|
|
1507
|
-
// Always return
|
|
1508
|
-
var
|
|
1569
|
+
// Always return selectedItems as an array (empty array if nothing selected)
|
|
1570
|
+
var selectedItems = cleanedRows.length > 0 ? cleanedRows : [];
|
|
1509
1571
|
|
|
1510
1572
|
// Update only if changed
|
|
1511
|
-
if (!(0, _lodashEs.isEqual)(prevSelectedRow.current,
|
|
1512
|
-
prevSelectedRow.current =
|
|
1573
|
+
if (!(0, _lodashEs.isEqual)(prevSelectedRow.current, selectedItems)) {
|
|
1574
|
+
prevSelectedRow.current = selectedItems;
|
|
1513
1575
|
if (tableApisRegistered.current) {
|
|
1514
1576
|
listener.onChange(widgetRegistrationKey, {
|
|
1515
|
-
|
|
1577
|
+
selectedItems: selectedItems
|
|
1516
1578
|
});
|
|
1517
1579
|
return;
|
|
1518
1580
|
}
|
|
1519
1581
|
tableApisRegistered.current = true;
|
|
1520
1582
|
listener.onChange(widgetRegistrationKey, _objectSpread(_objectSpread({}, tableApis), {}, {
|
|
1521
|
-
|
|
1583
|
+
selectedItems: selectedItems
|
|
1522
1584
|
}));
|
|
1523
1585
|
}
|
|
1524
1586
|
};
|
|
@@ -1593,11 +1655,11 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
1593
1655
|
className: "app-grid-header"
|
|
1594
1656
|
}, __jsx(_material.Box, {
|
|
1595
1657
|
className: "app-grid-header-inner",
|
|
1596
|
-
style: {
|
|
1658
|
+
style: _objectSpread({
|
|
1597
1659
|
height: "100%",
|
|
1598
1660
|
overflow: "auto",
|
|
1599
1661
|
position: "relative"
|
|
1600
|
-
}
|
|
1662
|
+
}, styles)
|
|
1601
1663
|
}, loading && navigation !== "On-Demand" && __jsx(_LoadingComponent["default"], {
|
|
1602
1664
|
message: loadingdatamsg
|
|
1603
1665
|
}), __jsx(_material.Table, {
|
|
@@ -1662,7 +1724,10 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
1662
1724
|
editingRowId: editingRowId,
|
|
1663
1725
|
activeRowIds: activeRowIds,
|
|
1664
1726
|
selectedRowIds: selectedRowIds,
|
|
1665
|
-
isAddingNewRow: isAddingNewRow
|
|
1727
|
+
isAddingNewRow: isAddingNewRow,
|
|
1728
|
+
customExpressionColumns: customColumns,
|
|
1729
|
+
customColumnsRevision: customColumnsRevision,
|
|
1730
|
+
columnsVersion: columnsVersion
|
|
1666
1731
|
}), summaryRowEnabled && summaryRowDefs.length > 0 && __jsx(_components.SummaryRowFooter, {
|
|
1667
1732
|
summaryRowDefs: summaryRowDefs,
|
|
1668
1733
|
summaryRowDefObjects: summaryRowDefObjects,
|
|
@@ -52,6 +52,7 @@ declare const _default: React.ComponentType<{
|
|
|
52
52
|
eventCallback?: (eventName: string, data: any) => void;
|
|
53
53
|
forwardedRef?: React.ForwardedRef<any>;
|
|
54
54
|
viewParent?: any;
|
|
55
|
+
destroy?: ((names: string[]) => void) | ((formName?: string) => void);
|
|
55
56
|
hint?: string;
|
|
56
57
|
arialabel?: string;
|
|
57
58
|
tabindex?: number;
|
|
@@ -350,6 +350,7 @@ export interface TableProps {
|
|
|
350
350
|
* Callback fired on operation error.
|
|
351
351
|
*/
|
|
352
352
|
onError?: (event: any, widget: any, data: any, operation: string) => void;
|
|
353
|
+
customExpressionColumns?: Record<string, (rowData: any) => ReactNode>;
|
|
353
354
|
}
|
|
354
355
|
/**
|
|
355
356
|
* Combined props for the WmTable component, including base WaveMaker props.
|
|
@@ -786,6 +787,11 @@ export interface TableBodyProps {
|
|
|
786
787
|
selectedRowIds?: string[];
|
|
787
788
|
isAddingNewRow?: boolean;
|
|
788
789
|
registerRowDefInstance?: (rowId: string, instance: any, rowData?: any) => void;
|
|
790
|
+
customExpressionColumns?: Record<string, (rowData: any) => ReactNode>;
|
|
791
|
+
/** Bumps when custom-expression components are re-parsed (forces body cells to refresh). */
|
|
792
|
+
customColumnsRevision?: number;
|
|
793
|
+
/** Column proxy / table column definition generation counter. */
|
|
794
|
+
columnsVersion?: number;
|
|
789
795
|
}
|
|
790
796
|
export interface TableHeaderProps {
|
|
791
797
|
table: Table<any>;
|
|
@@ -1084,6 +1090,7 @@ export interface UseRowSelectionProps {
|
|
|
1084
1090
|
onRowdeselect?: (event: any, widget: any, row: any) => void;
|
|
1085
1091
|
listener?: any;
|
|
1086
1092
|
navigation?: string;
|
|
1093
|
+
onSyncSelectedItems?: (selectedIds: string[]) => void;
|
|
1087
1094
|
}
|
|
1088
1095
|
export interface UseRowSelectionReturn {
|
|
1089
1096
|
selectedRowIds: string[];
|
|
@@ -38,6 +38,7 @@ declare const _default: React.ComponentType<{
|
|
|
38
38
|
eventCallback?: (eventName: string, data: any) => void;
|
|
39
39
|
forwardedRef?: React.ForwardedRef<any>;
|
|
40
40
|
viewParent?: any;
|
|
41
|
+
destroy?: ((names: string[]) => void) | ((formName?: string) => void);
|
|
41
42
|
hint?: string;
|
|
42
43
|
arialabel?: string;
|
|
43
44
|
tabindex?: number;
|
|
@@ -38,6 +38,7 @@ declare const _default: React.ComponentType<{
|
|
|
38
38
|
eventCallback?: (eventName: string, data: any) => void;
|
|
39
39
|
forwardedRef?: React.ForwardedRef<any>;
|
|
40
40
|
viewParent?: any;
|
|
41
|
+
destroy?: ((names: string[]) => void) | ((formName?: string) => void);
|
|
41
42
|
hint?: string;
|
|
42
43
|
arialabel?: string;
|
|
43
44
|
tabindex?: number;
|
|
@@ -38,6 +38,7 @@ declare const _default: React.ComponentType<{
|
|
|
38
38
|
eventCallback?: (eventName: string, data: any) => void;
|
|
39
39
|
forwardedRef?: React.ForwardedRef<any>;
|
|
40
40
|
viewParent?: any;
|
|
41
|
+
destroy?: ((names: string[]) => void) | ((formName?: string) => void);
|
|
41
42
|
hint?: string;
|
|
42
43
|
arialabel?: string;
|
|
43
44
|
tabindex?: number;
|
|
@@ -46,6 +46,7 @@ export declare const WmTableRowAction: React.FC<{
|
|
|
46
46
|
eventCallback?: (eventName: string, data: any) => void;
|
|
47
47
|
forwardedRef?: React.ForwardedRef<any>;
|
|
48
48
|
viewParent?: any;
|
|
49
|
+
destroy?: ((names: string[]) => void) | ((formName?: string) => void);
|
|
49
50
|
hint?: string;
|
|
50
51
|
arialabel?: string;
|
|
51
52
|
tabindex?: number;
|
|
@@ -106,6 +106,9 @@ var buildSelectionColumns = exports.buildSelectionColumns = function buildSelect
|
|
|
106
106
|
size: "small",
|
|
107
107
|
inputProps: {
|
|
108
108
|
"aria-label": "Select all rows"
|
|
109
|
+
},
|
|
110
|
+
sx: {
|
|
111
|
+
padding: 0
|
|
109
112
|
}
|
|
110
113
|
})));
|
|
111
114
|
},
|
|
@@ -136,7 +139,10 @@ var buildSelectionColumns = exports.buildSelectionColumns = function buildSelect
|
|
|
136
139
|
role: "checkbox",
|
|
137
140
|
"aria-live": "assertive"
|
|
138
141
|
},
|
|
139
|
-
size: "small"
|
|
142
|
+
size: "small",
|
|
143
|
+
sx: {
|
|
144
|
+
padding: 0
|
|
145
|
+
}
|
|
140
146
|
}))), isSelected ? __jsx("span", {
|
|
141
147
|
className: "sr-only",
|
|
142
148
|
"aria-live": "assertive"
|
|
@@ -70,7 +70,7 @@ var createDataColumn = exports.createDataColumn = function createDataColumn(wmCo
|
|
|
70
70
|
columnSize = (0, _.parseWidth)(wmColumn.styles.width);
|
|
71
71
|
}
|
|
72
72
|
return _objectSpread(_objectSpread({
|
|
73
|
-
accessorKey: wmColumn.field,
|
|
73
|
+
accessorKey: wmColumn.field || wmColumn.name,
|
|
74
74
|
// Use sortby field for sorting if provided, otherwise use the display field
|
|
75
75
|
// Supports nested properties like "department.store.employee"
|
|
76
76
|
accessorFn: wmColumn.sortby ? function (row) {
|
|
@@ -319,7 +319,7 @@ function transformExpression(exp) {
|
|
|
319
319
|
var parseTableColumns = exports.parseTableColumns = function parseTableColumns(children, dataset) {
|
|
320
320
|
var columns = [];
|
|
321
321
|
_react["default"].Children.forEach(children, function (child) {
|
|
322
|
-
if (child && child.props && child.props.name && child.props.name.includes("wm_table_column")) {
|
|
322
|
+
if (child && child.props && child.props.name && (child.props.name.includes("wm_table_column") || child.props.name.includes("col_"))) {
|
|
323
323
|
var props = (0, _lodashEs.get)(child, "props", {});
|
|
324
324
|
var binding = (0, _lodashEs.get)(props, "binding");
|
|
325
325
|
var aggregate = getAggregateFunctions(dataset, binding);
|
|
@@ -400,7 +400,7 @@ var _parseTableStructureWithGroups = exports.parseTableStructureWithGroups = fun
|
|
|
400
400
|
structure.push(group);
|
|
401
401
|
}
|
|
402
402
|
// Handle WmTableColumn
|
|
403
|
-
else if (childName.includes("wm_table_column")) {
|
|
403
|
+
else if (childName.includes("wm_table_column") || childName.includes("col_")) {
|
|
404
404
|
var _props = (0, _lodashEs.get)(child, "props", {});
|
|
405
405
|
var column = _objectSpread({
|
|
406
406
|
field: (0, _lodashEs.get)(_props, "binding"),
|
|
@@ -170,7 +170,7 @@ var widgetRenderers = {
|
|
|
170
170
|
*/
|
|
171
171
|
var renderDisplayCell = exports.renderDisplayCell = function renderDisplayCell(column, rowData, listener, cellState) {
|
|
172
172
|
var widgetType = (0, _lodashEs.get)(column, "widgetType", "label");
|
|
173
|
-
var mappedWidgetType = (0, _index2.getWidgetMappingForType)(widgetType);
|
|
173
|
+
var mappedWidgetType = column.field ? (0, _index2.getWidgetMappingForType)(widgetType) : "dynamic-text";
|
|
174
174
|
|
|
175
175
|
// Get the appropriate renderer, defaulting to WmLabel
|
|
176
176
|
var renderer = (0, _lodashEs.get)(widgetRenderers, mappedWidgetType) || widgetRenderers.WmLabel;
|
|
@@ -46,6 +46,7 @@ declare const WmAlertDialogStandalone: {
|
|
|
46
46
|
eventCallback?: (eventName: string, data: any) => void;
|
|
47
47
|
forwardedRef?: React.ForwardedRef<any>;
|
|
48
48
|
viewParent?: any;
|
|
49
|
+
destroy?: ((names: string[]) => void) | ((formName?: string) => void);
|
|
49
50
|
hint?: string;
|
|
50
51
|
arialabel?: string;
|
|
51
52
|
tabindex?: number;
|
|
@@ -128,6 +129,7 @@ declare const _default: {
|
|
|
128
129
|
eventCallback?: (eventName: string, data: any) => void;
|
|
129
130
|
forwardedRef?: React.ForwardedRef<any>;
|
|
130
131
|
viewParent?: any;
|
|
132
|
+
destroy?: ((names: string[]) => void) | ((formName?: string) => void);
|
|
131
133
|
hint?: string;
|
|
132
134
|
arialabel?: string;
|
|
133
135
|
tabindex?: number;
|
|
@@ -47,6 +47,7 @@ declare const WmConfirmDialogStandalone: {
|
|
|
47
47
|
eventCallback?: (eventName: string, data: any) => void;
|
|
48
48
|
forwardedRef?: React.ForwardedRef<any>;
|
|
49
49
|
viewParent?: any;
|
|
50
|
+
destroy?: ((names: string[]) => void) | ((formName?: string) => void);
|
|
50
51
|
hint?: string;
|
|
51
52
|
arialabel?: string;
|
|
52
53
|
tabindex?: number;
|
|
@@ -130,6 +131,7 @@ declare const _default: {
|
|
|
130
131
|
eventCallback?: (eventName: string, data: any) => void;
|
|
131
132
|
forwardedRef?: React.ForwardedRef<any>;
|
|
132
133
|
viewParent?: any;
|
|
134
|
+
destroy?: ((names: string[]) => void) | ((formName?: string) => void);
|
|
133
135
|
hint?: string;
|
|
134
136
|
arialabel?: string;
|
|
135
137
|
tabindex?: number;
|
|
@@ -51,6 +51,7 @@ declare const WmDialogStandalone: {
|
|
|
51
51
|
eventCallback?: (eventName: string, data: any) => void;
|
|
52
52
|
forwardedRef?: React.ForwardedRef<any>;
|
|
53
53
|
viewParent?: any;
|
|
54
|
+
destroy?: ((names: string[]) => void) | ((formName?: string) => void);
|
|
54
55
|
hint?: string;
|
|
55
56
|
arialabel?: string;
|
|
56
57
|
tabindex?: number;
|
|
@@ -140,6 +141,7 @@ declare const _default: {
|
|
|
140
141
|
eventCallback?: (eventName: string, data: any) => void;
|
|
141
142
|
forwardedRef?: React.ForwardedRef<any>;
|
|
142
143
|
viewParent?: any;
|
|
144
|
+
destroy?: ((names: string[]) => void) | ((formName?: string) => void);
|
|
143
145
|
hint?: string;
|
|
144
146
|
arialabel?: string;
|
|
145
147
|
tabindex?: number;
|