@wavemaker-ai/react-runtime 1.0.0-rc.314 → 1.0.0-rc.317

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.
Files changed (63) hide show
  1. package/actions/navigation-action.d.ts +1 -0
  2. package/actions/navigation-action.js +34 -9
  3. package/components/auth/RoleAuthGuard.d.ts +6 -0
  4. package/components/auth/RoleAuthGuard.js +65 -0
  5. package/components/basic/search/index.js +2 -1
  6. package/components/basic/search/providers.js +2 -2
  7. package/components/basic/tree/Components/TreeNodeComponent.d.ts +1 -1
  8. package/components/basic/tree/Components/TreeNodeComponent.js +14 -8
  9. package/components/basic/tree/hooks/useTreePersistedState.d.ts +3 -0
  10. package/components/basic/tree/hooks/useTreePersistedState.js +38 -0
  11. package/components/basic/tree/index.d.ts +1 -0
  12. package/components/basic/tree/index.js +105 -30
  13. package/components/basic/tree/props.d.ts +18 -1
  14. package/components/basic/tree/utils.d.ts +16 -1
  15. package/components/basic/tree/utils.js +111 -0
  16. package/components/chart/src/dataUtils.js +1 -1
  17. package/components/common/customTemplate/useCustomTemplate.js +1 -1
  18. package/components/container/layout-grid/grid-column/index.js +2 -1
  19. package/components/data/form/base-form/index.js +3 -1
  20. package/components/data/form/form-controller/withFormController.js +3 -7
  21. package/components/data/pagination/hooks/usePagination.js +0 -1
  22. package/components/data/table/index.js +5 -2
  23. package/components/data/table/utils/columnBuilder.d.ts +1 -1
  24. package/components/data/table/utils/columnBuilder.js +7 -4
  25. package/components/data/table/utils/crud-handlers.js +10 -10
  26. package/components/data/table/utils/index.d.ts +9 -8
  27. package/components/data/table/utils/index.js +73 -9
  28. package/components/layout/leftnav/index.js +21 -2
  29. package/components/layout/leftnav/props.d.ts +9 -0
  30. package/components/layout/leftnav/utils/page-class-util.d.ts +9 -0
  31. package/components/layout/leftnav/utils/page-class-util.js +28 -0
  32. package/components/navigation/popover/index.js +1 -0
  33. package/components/page/index.js +22 -6
  34. package/components/page/page-context.d.ts +4 -0
  35. package/components/page/page-context.js +5 -0
  36. package/components/page/partial-container/index.js +1 -4
  37. package/higherOrder/BaseApp.js +4 -3
  38. package/higherOrder/BaseAppProps.d.ts +1 -0
  39. package/higherOrder/BasePage.js +0 -10
  40. package/hooks/useDataSourceSubscription.js +1 -1
  41. package/hooks/useHttp.js +0 -4
  42. package/package-lock.json +103 -103
  43. package/package.json +3 -3
  44. package/runtime-dynamic/app-initializer.js +1 -1
  45. package/runtime-dynamic/components/use-dynamic-component.js +17 -31
  46. package/runtime-dynamic/factories/build-base-page-like-component.d.ts +1 -1
  47. package/runtime-dynamic/factories/dynamic-component.js +9 -1
  48. package/runtime-dynamic/factories/prefab-factory.d.ts +1 -1
  49. package/runtime-dynamic/factories/utils.d.ts +1 -1
  50. package/runtime-dynamic/services/component-ref-provider.d.ts +18 -3
  51. package/runtime-dynamic/services/component-ref-provider.js +15 -38
  52. package/runtime-dynamic/services/index.d.ts +2 -3
  53. package/runtime-dynamic/services/index.js +1 -18
  54. package/runtime-dynamic/services/resource-manager.d.ts +2 -3
  55. package/runtime-dynamic/services/resource-manager.js +5 -15
  56. package/runtime-dynamic/services/script-executor.js +1 -7
  57. package/runtime-dynamic/services/variable-registry.js +0 -4
  58. package/utils/attr.js +2 -9
  59. package/utils/custom-expression/index.js +4 -1
  60. package/utils/custom-expression/parser.js +4 -2
  61. package/utils/state-persistance.d.ts +1 -1
  62. package/runtime-dynamic/services/cache.d.ts +0 -29
  63. package/runtime-dynamic/services/cache.js +0 -51
@@ -1,4 +1,5 @@
1
- import { TreeNodeData, TreeItem, TreePartialNodeApi } from "./props";
1
+ import { type StorageType } from "@wavemaker-ai/react-runtime/utils/state-persistance";
2
+ import { TreeNodeData, TreeItem, TreePartialNodeApi, TreeUrlState } from "./props";
2
3
  /** Whether the dataset row (`node.data`) is disabled via its `disabled` property. */
3
4
  export declare const isTreeNodeDisabled: (data: TreeNodeData | undefined | null) => boolean;
4
5
  export declare const getNestedPropertyLocal: (obj: any, path: string) => any;
@@ -17,6 +18,20 @@ export declare const findNodeById: (nodes: TreeItem[], id: string) => TreeItem |
17
18
  * Used so partial templates can expand/collapse by id even when the passed-in `TreeItem`
18
19
  */
19
20
  export declare const toggleExpansionInTree: (nodes: TreeItem[], nodeId: string) => TreeItem[];
21
+ /** Migrate legacy `{ id, open, parentNode }` URL payloads to an `expanded` id list. */
22
+ export declare const migrateLegacyTreeUrlState: (raw: TreeUrlState | null | undefined) => string[];
23
+ /**
24
+ * Ensures all ancestors of every expanded id are included so nested paths reopen after refresh.
25
+ */
26
+ export declare const normalizeExpandedIds: (tree: TreeItem[], expandedIds: Iterable<string>) => Set<string>;
27
+ /**
28
+ * Node ids that are expanded **in the visible tree** (parent chain must be open / pre-open).
29
+ * Descendants of a collapsed branch are omitted even if `open` flags were left true internally.
30
+ */
31
+ export declare const collectExpandedNodeIdsForUrl: (nodes: TreeItem[]) => string[];
32
+ export declare const saveTreeState: (name: string, storage: StorageType, stateToSave: Partial<TreeUrlState> | null) => void;
33
+ export declare const getTreeState: (name: string, storage: StorageType) => TreeUrlState | null;
34
+ export declare const clearTreeState: (name: string, storage: StorageType) => void;
20
35
  /**
21
36
  * Dataset row fields for `pageParams.item` (no methods — those are merged in the hook as {@link TreePartialNodeApi}).
22
37
  */
@@ -20,6 +20,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  import isArray from "lodash-es/isArray";
21
21
  import cloneDeep from "lodash-es/cloneDeep";
22
22
  import get from "lodash-es/get";
23
+ import {
24
+ clearWidgetState,
25
+ getWidgetState,
26
+ setWidgetState
27
+ } from "../../../utils/state-persistance";
23
28
  const isTreeNodeDisabled = (data) => {
24
29
  if (!data) return false;
25
30
  const disabled_node = data.disabled;
@@ -144,6 +149,106 @@ const toggleExpansionInTree = (nodes, nodeId) => {
144
149
  return n;
145
150
  });
146
151
  };
152
+ const migrateLegacyTreeUrlState = (raw) => {
153
+ if (!raw || typeof raw !== "object") return [];
154
+ if (Array.isArray(raw.expanded) && raw.expanded.length) {
155
+ return raw.expanded.map((id) => String(id));
156
+ }
157
+ const ids = /* @__PURE__ */ new Set();
158
+ if (Array.isArray(raw.parentNode)) {
159
+ for (const x of raw.parentNode) {
160
+ if (x != null && x !== "") ids.add(String(x));
161
+ }
162
+ }
163
+ if (raw.open && raw.id != null && raw.id !== "") {
164
+ ids.add(String(raw.id));
165
+ }
166
+ return [...ids];
167
+ };
168
+ const normalizeExpandedIds = (tree, expandedIds) => {
169
+ const set = /* @__PURE__ */ new Set();
170
+ for (const id of expandedIds) {
171
+ if (id == null || id === "") continue;
172
+ const node = findNodeById(tree, String(id));
173
+ if (!node) continue;
174
+ let current = node;
175
+ while (current) {
176
+ set.add(String(current.nodeId));
177
+ current = current.parent;
178
+ }
179
+ }
180
+ return set;
181
+ };
182
+ const collectExpandedNodeIdsForUrl = (nodes) => {
183
+ const out = [];
184
+ const walk = (list, branchOpen) => {
185
+ var _a;
186
+ for (const n of list) {
187
+ if (!branchOpen) continue;
188
+ if (n.open) {
189
+ out.push(n.nodeId);
190
+ if ((_a = n.children) == null ? void 0 : _a.length) {
191
+ walk(n.children, true);
192
+ }
193
+ }
194
+ }
195
+ };
196
+ walk(nodes, true);
197
+ return out;
198
+ };
199
+ const encodeNodeIdForUrl = (id) => {
200
+ try {
201
+ return btoa(unescape(encodeURIComponent(id))).replace(/=+$/, "");
202
+ } catch (e) {
203
+ return id;
204
+ }
205
+ };
206
+ const decodeNodeIdFromUrl = (token) => {
207
+ try {
208
+ return decodeURIComponent(escape(atob(token)));
209
+ } catch (e) {
210
+ return token;
211
+ }
212
+ };
213
+ const toTreeStatePayload = (storage, state) => {
214
+ var _a;
215
+ if (storage !== "URL") return state;
216
+ const out = {};
217
+ if ((_a = state.expanded) == null ? void 0 : _a.length) {
218
+ out.expanded = [...new Set(state.expanded.map(String))].map(encodeNodeIdForUrl);
219
+ }
220
+ if (state.selected) out.selected = encodeNodeIdForUrl(String(state.selected));
221
+ return out;
222
+ };
223
+ const fromTreeStatePayload = (storage, raw) => {
224
+ var _a, _b;
225
+ if (raw == null || typeof raw !== "object" || Array.isArray(raw)) return null;
226
+ const state = raw;
227
+ if (storage !== "URL") return state;
228
+ const out = {};
229
+ if ((_a = state.expanded) == null ? void 0 : _a.length) {
230
+ out.expanded = [...new Set(state.expanded.map((id) => decodeNodeIdFromUrl(String(id))))];
231
+ }
232
+ if (state.selected) out.selected = decodeNodeIdFromUrl(String(state.selected));
233
+ return ((_b = out.expanded) == null ? void 0 : _b.length) || out.selected ? out : null;
234
+ };
235
+ const saveTreeState = (name, storage, stateToSave) => {
236
+ const config = { name, type: "tree", storage };
237
+ if (stateToSave == null) {
238
+ clearWidgetState(config);
239
+ return;
240
+ }
241
+ if (storage === "URL") {
242
+ clearWidgetState(config);
243
+ }
244
+ setWidgetState(config, toTreeStatePayload(storage, stateToSave));
245
+ };
246
+ const getTreeState = (name, storage) => {
247
+ return fromTreeStatePayload(storage, getWidgetState({ name, type: "tree", storage }));
248
+ };
249
+ const clearTreeState = (name, storage) => {
250
+ clearWidgetState({ name, type: "tree", storage });
251
+ };
147
252
  const getTreePartialRowPayload = (node) => {
148
253
  var _a;
149
254
  const raw = node.data;
@@ -205,12 +310,18 @@ export {
205
310
  assembleTreePartialItem,
206
311
  buildTreePartialSnapshot,
207
312
  buildTreePathFromRoot,
313
+ clearTreeState,
314
+ collectExpandedNodeIdsForUrl,
208
315
  computeTreeNodeDepthFromRoot,
209
316
  findNodeById,
210
317
  generateUniqueNodeId,
211
318
  getNestedPropertyLocal,
212
319
  getTreePartialRowPayload,
320
+ getTreeState,
213
321
  isTreeNodeDisabled,
322
+ migrateLegacyTreeUrlState,
323
+ normalizeExpandedIds,
214
324
  processNode,
325
+ saveTreeState,
215
326
  toggleExpansionInTree
216
327
  };
@@ -428,7 +428,7 @@ const getAggregatedData = (datasource, groupby, aggregation, aggregationcolumn,
428
428
  }
429
429
  ];
430
430
  }
431
- datasource.execute("getAggregatedData", {
431
+ datasource == null ? void 0 : datasource.execute("getAggregatedData", {
432
432
  aggregations: data,
433
433
  sort: sortExpr
434
434
  }).then(
@@ -6,7 +6,7 @@ function useCustomTemplate({ content, name, listener }) {
6
6
  if ((listener == null ? void 0 : listener.onChange) && typeof listener.onChange === "function") {
7
7
  listener.onChange(name, { setTemplate });
8
8
  }
9
- }, [name, listener == null ? void 0 : listener.onChange]);
9
+ }, [name]);
10
10
  useEffect(() => {
11
11
  stableOnChange();
12
12
  }, [stableOnChange]);
@@ -33,6 +33,7 @@ import { jsx } from "react/jsx-runtime";
33
33
  import clsx from "clsx";
34
34
  import { Container } from "@mui/material";
35
35
  import { withBaseWrapper } from "../../../../higherOrder/withBaseWrapper";
36
+ import { removeInvalidAttributes } from "../../../../utils/attr";
36
37
  const DEFAULT_CLASS = "app-grid-column";
37
38
  const WmGridcolumn = (props) => {
38
39
  const _a = props, {
@@ -57,7 +58,7 @@ const WmGridcolumn = (props) => {
57
58
  maxWidth: false,
58
59
  style: styles,
59
60
  className: clsx(DEFAULT_CLASS, className, columnwidth && `col-sm-${columnwidth}`)
60
- }, otherProps), {
61
+ }, removeInvalidAttributes(otherProps)), {
61
62
  children
62
63
  })
63
64
  );
@@ -449,7 +449,7 @@ const BaseForm = (WrappedComponent) => {
449
449
  useEffect(() => {
450
450
  return () => {
451
451
  var _a2;
452
- if (!formName) return;
452
+ if (!formName || !formRef.current) return;
453
453
  (_a2 = props == null ? void 0 : props.destroy) == null ? void 0 : _a2.call(props, formName);
454
454
  formresetFn();
455
455
  };
@@ -583,6 +583,7 @@ const BaseForm = (WrappedComponent) => {
583
583
  widgetCls,
584
584
  itemsPerRow,
585
585
  validationtype: props.validationtype,
586
+ submitCount,
586
587
  showViewMode,
587
588
  formdata: computedFormdata,
588
589
  submit,
@@ -602,6 +603,7 @@ const BaseForm = (WrappedComponent) => {
602
603
  widgetCls,
603
604
  itemsPerRow,
604
605
  props.validationtype,
606
+ submitCount,
605
607
  showViewMode,
606
608
  computedFormdata,
607
609
  submit,
@@ -160,17 +160,12 @@ const withFormController = (WrappedComponent) => {
160
160
  }
161
161
  };
162
162
  }, [effectiveFormKey]);
163
- useEffect(() => {
164
- if (touched && !hasEverBeenTouchedRef.current) {
165
- hasEverBeenTouchedRef.current = true;
166
- }
167
- }, [touched]);
168
163
  useEffect(() => {
169
164
  if (isInitialMountRef.current) {
170
165
  isInitialMountRef.current = false;
171
166
  return;
172
167
  }
173
- const hasBeenTouchedOrSubmitted = hasEverBeenTouchedRef.current || (formRef == null ? void 0 : formRef.submitCount) && formRef.submitCount > 0;
168
+ const hasBeenTouchedOrSubmitted = hasEverBeenTouchedRef.current || (formRef == null ? void 0 : formRef.submitCount) && formRef.submitCount > 0 || false;
174
169
  if (trigger && effectiveFormKey && hasBeenTouchedOrSubmitted) {
175
170
  trigger(effectiveFormKey);
176
171
  }
@@ -181,7 +176,7 @@ const withFormController = (WrappedComponent) => {
181
176
  customMsgInitialRef.current = false;
182
177
  return;
183
178
  }
184
- if (trigger && effectiveFormKey) {
179
+ if (trigger && effectiveFormKey && hasEverBeenTouchedRef.current) {
185
180
  trigger(effectiveFormKey);
186
181
  }
187
182
  }, [customValidationMsg]);
@@ -218,6 +213,7 @@ const withFormController = (WrappedComponent) => {
218
213
  return (e) => {
219
214
  var _a2;
220
215
  setTouched(true);
216
+ hasEverBeenTouchedRef.current = true;
221
217
  field.onBlur();
222
218
  const shouldTriggerValidation = validationType === "html" && trigger && !!fieldState.error || validationType !== "none" && ((_a2 = observeRef.current) == null ? void 0 : _a2.length) && trigger;
223
219
  if (shouldTriggerValidation) {
@@ -165,7 +165,6 @@ const usePagination = ({
165
165
  return response;
166
166
  }).catch((error) => {
167
167
  isFetchingRef.current = false;
168
- console.error("Error fetching page data:", error);
169
168
  setPaginationState((prev) => __spreadProps(__spreadValues({}, prev), {
170
169
  error: error.message || "Failed to fetch page data"
171
170
  }));
@@ -396,7 +396,7 @@ const WmTableComponent = memo(
396
396
  initialSortState: persisted.sort || void 0
397
397
  };
398
398
  }
399
- const initialPageSize2 = defaultPageSizeFromOptions !== void 0 ? defaultPageSizeFromOptions : actualPageSize || pagesize;
399
+ const initialPageSize2 = allowpagesizechange ? defaultPageSizeFromOptions != null ? defaultPageSizeFromOptions : actualPageSize : pagesize;
400
400
  return {
401
401
  initialPage: 1,
402
402
  initialPageSize: initialPageSize2,
@@ -1392,6 +1392,9 @@ const WmTableComponent = memo(
1392
1392
  useEffect(() => {
1393
1393
  updateSelectedItem();
1394
1394
  }, [activeRowIds, selectedRowIds, useRadioSelect, useMultiSelect, internalDataset, name]);
1395
+ const isTableLoading = useMemo(() => {
1396
+ return loading && navigation !== "On-Demand" && internalDataset.length === 0;
1397
+ }, [loading, navigation, internalDataset.length]);
1395
1398
  const colGroupSpec = useMemo(() => {
1396
1399
  const headerGroups = table.getHeaderGroups();
1397
1400
  const leafHeaderGroup = headerGroups.length ? headerGroups[headerGroups.length - 1] : void 0;
@@ -1454,7 +1457,7 @@ const WmTableComponent = memo(
1454
1457
  className: "app-grid-header-inner",
1455
1458
  style: __spreadValues({ height: "100%", overflow: "auto", position: "relative" }, styles),
1456
1459
  children: [
1457
- loading && navigation !== "On-Demand" && /* @__PURE__ */ jsx(LoadingComponent, { message: loadingdatamsg }),
1460
+ isTableLoading && /* @__PURE__ */ jsx(LoadingComponent, { message: loadingdatamsg }),
1458
1461
  /* @__PURE__ */ jsxs(
1459
1462
  Table,
1460
1463
  __spreadProps(__spreadValues({
@@ -8,7 +8,7 @@ export declare const createRowIndexColumn: () => ColumnDef<any>;
8
8
  /**
9
9
  * Creates data column definition from WmTableColumnProps
10
10
  */
11
- export declare const createDataColumn: (wmColumn: WmTableColumnProps, renderCell: (wmColumn: WmTableColumnProps, row: any) => React.ReactNode) => ColumnDef<any>;
11
+ export declare const createDataColumn: (wmColumn: WmTableColumnProps, renderCell: (wmColumn: WmTableColumnProps, row: any) => React.ReactNode, index?: number) => ColumnDef<any>;
12
12
  /**
13
13
  * Creates column definitions from table columns
14
14
  */
@@ -45,7 +45,7 @@ const createRowIndexColumn = () => ({
45
45
  },
46
46
  enableSorting: false
47
47
  });
48
- const createDataColumn = (wmColumn, renderCell) => {
48
+ const createDataColumn = (wmColumn, renderCell, index = 0) => {
49
49
  var _a, _b;
50
50
  const colClassProp = (_a = wmColumn.colClass) != null ? _a : wmColumn["col-class"];
51
51
  let columnSize;
@@ -54,8 +54,11 @@ const createDataColumn = (wmColumn, renderCell) => {
54
54
  } else if ((_b = wmColumn.styles) == null ? void 0 : _b.width) {
55
55
  columnSize = parseWidth(wmColumn.styles.width);
56
56
  }
57
+ const accessorKey = wmColumn.field || wmColumn.name;
58
+ const columnId = (accessorKey == null ? void 0 : accessorKey.replace(/\./g, "_")) || (typeof wmColumn.caption === "string" && wmColumn.caption ? wmColumn.caption : void 0) || `column_${index}`;
57
59
  return __spreadProps(__spreadValues({
58
- accessorKey: wmColumn.field || wmColumn.name,
60
+ id: columnId,
61
+ accessorKey,
59
62
  // Use sortby field for sorting if provided, otherwise use the display field
60
63
  // Supports nested properties like "department.store.employee"
61
64
  accessorFn: wmColumn.sortby ? (row) => get(row, wmColumn.sortby || "") : void 0,
@@ -89,9 +92,9 @@ const createDataColumn = (wmColumn, renderCell) => {
89
92
  };
90
93
  const createDataColumns = (wmTableColumns, renderCell) => {
91
94
  const columns = [];
92
- wmTableColumns.forEach((wmColumn) => {
95
+ wmTableColumns.forEach((wmColumn, index) => {
93
96
  if (wmColumn.show) {
94
- columns.push(createDataColumn(wmColumn, renderCell));
97
+ columns.push(createDataColumn(wmColumn, renderCell, index));
95
98
  }
96
99
  });
97
100
  return columns;
@@ -27,8 +27,8 @@ import { DataSource } from "../../types";
27
27
  const getDatasourceInfo = async (datasource) => {
28
28
  var _a, _b;
29
29
  const [supportsCrud, isApiAware] = await Promise.all([
30
- datasource.execute(DataSource.Operation.SUPPORTS_CRUD),
31
- datasource.execute(DataSource.Operation.IS_API_AWARE)
30
+ datasource == null ? void 0 : datasource.execute(DataSource.Operation.SUPPORTS_CRUD),
31
+ datasource == null ? void 0 : datasource.execute(DataSource.Operation.IS_API_AWARE)
32
32
  ]);
33
33
  const currentPageNum = ((_b = (_a = datasource.pagination) == null ? void 0 : _a.number) != null ? _b : 0) + 1;
34
34
  const shouldUseServer = supportsCrud || !isApiAware || datasource.category === "wm.CrudVariable";
@@ -151,7 +151,7 @@ const handleNonApiAwareOperation = async (datasource, binddataset, formData, ope
151
151
  const path = binddataset.split(".");
152
152
  const parentIndex = parseInt(path[path.length - 1]);
153
153
  const parentPath = path.slice(0, -1).join(".");
154
- return datasource.execute(DataSource.Operation[operation], {
154
+ return datasource == null ? void 0 : datasource.execute(DataSource.Operation[operation], {
155
155
  item: formData,
156
156
  path: parentPath,
157
157
  parentIndex
@@ -159,7 +159,7 @@ const handleNonApiAwareOperation = async (datasource, binddataset, formData, ope
159
159
  };
160
160
  const refreshDataSource = async (datasource, options) => {
161
161
  if (!datasource) throw new Error("Datasource is required");
162
- return datasource.execute(DataSource.Operation.LIST_RECORDS, {
162
+ return datasource == null ? void 0 : datasource.execute(DataSource.Operation.LIST_RECORDS, {
163
163
  filterFields: options.filterFields || {},
164
164
  orderBy: options.orderBy,
165
165
  page: options.page || 1,
@@ -206,10 +206,10 @@ const handleServerOperation = async (options) => {
206
206
  isNewRow ? "ADD_ITEM" : "SET_ITEM"
207
207
  );
208
208
  } else {
209
- response = await datasource.execute(
209
+ response = await (datasource == null ? void 0 : datasource.execute(
210
210
  isNewRow ? DataSource.Operation.INSERT_RECORD : DataSource.Operation.UPDATE_RECORD,
211
211
  { row: formData, skipNotification: true }
212
- );
212
+ ));
213
213
  if (response.error) throw response.error;
214
214
  if (isNewRow && isServerSidePagination && datasource.pagination) {
215
215
  const { totalElements, size = 10 } = datasource.pagination;
@@ -292,10 +292,10 @@ const handleDeleteOperation = async (options) => {
292
292
  if (!isApiAware && binddataset) {
293
293
  await handleNonApiAwareOperation(datasource, binddataset, rowData, "REMOVE_ITEM");
294
294
  } else {
295
- response = await datasource.execute(DataSource.Operation.DELETE_RECORD, {
295
+ response = await (datasource == null ? void 0 : datasource.execute(DataSource.Operation.DELETE_RECORD, {
296
296
  row: rowData,
297
297
  skipNotification: true
298
- });
298
+ }));
299
299
  if (response.error) throw response.error;
300
300
  }
301
301
  }
@@ -312,10 +312,10 @@ const handleDeleteOperation = async (options) => {
312
312
  isServerSidePagination || false
313
313
  );
314
314
  if (isServerSidePagination && paginationResult.shouldRefresh && datasource) {
315
- await datasource.invoke({
315
+ await (datasource == null ? void 0 : datasource.invoke({
316
316
  page: paginationResult.targetPage,
317
317
  pagesize: ((_b = datasource.pagination) == null ? void 0 : _b.size) || 10
318
- });
318
+ }));
319
319
  }
320
320
  onRowDelete == null ? void 0 : onRowDelete(rowData, rowIndex, newDataset);
321
321
  return handleOperationResult("delete", response, null, {
@@ -94,11 +94,12 @@ export declare const INTERNAL_PROPERTIES: string[];
94
94
  export declare const cleanRowData: (data: any) => any;
95
95
  export declare const parseWidth: (width: string | number, fallbackSize?: number) => number;
96
96
  export declare const getColClass: (colClass: string, rowData: any, columnName: string) => string;
97
- export * from "./constants";
98
- export * from "./renderDisplayCell";
99
- export * from "./buildSelectionColumns";
100
- export * from "./validation";
101
- export * from "./selectionUtils";
102
- export * from "./columnBuilder";
103
- export * from "./columnWidthDistribution";
104
- export * from "./table-helpers";
97
+ export { TABLE_CSS_CLASSES, TABLE_DATA_STATES, TABLE_MESSAGES, INTERACTIVE_CLASSES, INTERACTIVE_ROLES, INTERACTIVE_DATA_ROLES, INTERACTIVE_TAG_NAMES, DYNAMIC_COLUMNS_CONFIG, UNSUPPORTED_STATE_PERSISTENCE_TYPES, } from "./constants";
98
+ export { renderDisplayCell } from "./renderDisplayCell";
99
+ export { buildSelectionColumns } from "./buildSelectionColumns";
100
+ export { validateField, resetValidationState, updateValidationErrors } from "./validation";
101
+ export { hasInteractiveClass, hasInteractiveAttributes, isInteractiveElement, getRowIdsFromDataset, rowExistsInDataset, selectionStateHelpers, } from "./selectionUtils";
102
+ export { createRowIndexColumn, createDataColumn, createDataColumns, createEditingActionButtons, createDefaultColumnProps, getActionColumnSize, } from "./columnBuilder";
103
+ export { isDataColumn, hasExplicitWidth, distributeColumnWidths } from "./columnWidthDistribution";
104
+ export type { TableSearchFilter, FilterFieldObject, FilterFieldsObject, TableSortState, TableStateData, } from "./table-helpers";
105
+ export { saveTableState, getTableState, clearTableState, convertFilterArrayToObject, convertFilterObjectToArray, } from "./table-helpers";
@@ -590,40 +590,104 @@ const getColClass = (colClass, rowData, columnName) => {
590
590
  return "";
591
591
  }
592
592
  };
593
- export * from "./constants";
594
- export * from "./renderDisplayCell";
595
- export * from "./buildSelectionColumns";
596
- export * from "./validation";
597
- export * from "./selectionUtils";
598
- export * from "./columnBuilder";
599
- export * from "./columnWidthDistribution";
600
- export * from "./table-helpers";
593
+ import {
594
+ TABLE_CSS_CLASSES as TABLE_CSS_CLASSES2,
595
+ TABLE_DATA_STATES,
596
+ TABLE_MESSAGES,
597
+ INTERACTIVE_CLASSES,
598
+ INTERACTIVE_ROLES,
599
+ INTERACTIVE_DATA_ROLES,
600
+ INTERACTIVE_TAG_NAMES,
601
+ DYNAMIC_COLUMNS_CONFIG,
602
+ UNSUPPORTED_STATE_PERSISTENCE_TYPES
603
+ } from "./constants";
604
+ import { renderDisplayCell } from "./renderDisplayCell";
605
+ import { buildSelectionColumns } from "./buildSelectionColumns";
606
+ import { validateField, resetValidationState, updateValidationErrors } from "./validation";
607
+ import {
608
+ hasInteractiveClass,
609
+ hasInteractiveAttributes,
610
+ isInteractiveElement,
611
+ getRowIdsFromDataset,
612
+ rowExistsInDataset,
613
+ selectionStateHelpers
614
+ } from "./selectionUtils";
615
+ import {
616
+ createRowIndexColumn,
617
+ createDataColumn,
618
+ createDataColumns,
619
+ createEditingActionButtons,
620
+ createDefaultColumnProps,
621
+ getActionColumnSize
622
+ } from "./columnBuilder";
623
+ import { isDataColumn, hasExplicitWidth, distributeColumnWidths } from "./columnWidthDistribution";
624
+ import {
625
+ saveTableState,
626
+ getTableState,
627
+ clearTableState,
628
+ convertFilterArrayToObject,
629
+ convertFilterObjectToArray
630
+ } from "./table-helpers";
601
631
  export {
632
+ DYNAMIC_COLUMNS_CONFIG,
633
+ INTERACTIVE_CLASSES,
634
+ INTERACTIVE_DATA_ROLES,
635
+ INTERACTIVE_ROLES,
636
+ INTERACTIVE_TAG_NAMES,
602
637
  INTERNAL_PROPERTIES,
638
+ TABLE_CSS_CLASSES2 as TABLE_CSS_CLASSES,
639
+ TABLE_DATA_STATES,
640
+ TABLE_MESSAGES,
641
+ UNSUPPORTED_STATE_PERSISTENCE_TYPES,
603
642
  addUniqueRowIds,
643
+ buildSelectionColumns,
604
644
  cleanRowData,
645
+ clearTableState,
646
+ convertFilterArrayToObject,
647
+ convertFilterObjectToArray,
648
+ createDataColumn,
649
+ createDataColumns,
650
+ createDefaultColumnProps,
651
+ createEditingActionButtons,
652
+ createRowIndexColumn,
653
+ distributeColumnWidths,
605
654
  extractDataArray,
606
655
  flattenTableStructure,
607
656
  getActionButtonClass,
657
+ getActionColumnSize,
608
658
  getAggregateFunctions,
609
659
  getBooleanDataset,
610
660
  getButtonClasses,
611
661
  getColClass,
662
+ getRowIdsFromDataset,
612
663
  getSpacingClasses,
613
664
  getTableActionButtonClass,
665
+ getTableState,
614
666
  getWidgetMappingForType,
615
667
  handleNewRowNavigation,
668
+ hasExplicitWidth,
669
+ hasInteractiveAttributes,
670
+ hasInteractiveClass,
616
671
  isAddNewAction,
617
672
  isColumnVisibleForViewport,
673
+ isDataColumn,
618
674
  isDeleteAction,
619
675
  isEditAction,
676
+ isInteractiveElement,
620
677
  parseTableActions,
621
678
  parseTableColumns,
622
679
  parseTableRowActions,
623
680
  parseTableRowExpansion,
624
681
  parseTableStructureWithGroups,
625
682
  parseWidth,
683
+ renderDisplayCell,
684
+ resetValidationState,
685
+ rowExistsInDataset,
686
+ saveTableState,
687
+ selectionStateHelpers,
626
688
  shouldShowPagination,
627
689
  shouldShowPanelHeading,
628
- validateEditingFields
690
+ updateValidationErrors,
691
+ validateEditingFields,
692
+ validateField
629
693
  };
@@ -1,18 +1,24 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { useEffect } from "react";
2
+ import { useContext, useEffect } from "react";
3
3
  import clsx from "clsx";
4
4
  import Box from "@mui/material/Box";
5
+ import { PageLayoutContext } from "../../page/page-context";
6
+ import { getLeftPanelPageClasses } from "./utils/page-class-util";
5
7
  const DEFAULT_CLASS = "app-nav-drawer app-left-panel left-panel-collapsed ";
8
+ const SLIDE_IN = "slide-in";
6
9
  const WmLeftPanel = (props) => {
10
+ const { onLeftPanelPageClassesChange } = useContext(PageLayoutContext);
7
11
  const {
8
12
  styles,
9
13
  children,
10
14
  render,
11
15
  className,
12
16
  columnwidth = 2,
17
+ xscolumnwidth = 10,
13
18
  id,
14
19
  navtype,
15
20
  navheight,
21
+ animation = SLIDE_IN,
16
22
  onNavHeightChange
17
23
  } = props;
18
24
  useEffect(() => {
@@ -25,6 +31,18 @@ const WmLeftPanel = (props) => {
25
31
  }
26
32
  };
27
33
  }, [navheight, onNavHeightChange]);
34
+ useEffect(() => {
35
+ onLeftPanelPageClassesChange == null ? void 0 : onLeftPanelPageClassesChange(
36
+ getLeftPanelPageClasses({
37
+ animation,
38
+ columnwidth,
39
+ xscolumnwidth
40
+ })
41
+ );
42
+ return () => {
43
+ onLeftPanelPageClassesChange == null ? void 0 : onLeftPanelPageClassesChange(void 0);
44
+ };
45
+ }, [animation, columnwidth, xscolumnwidth]);
28
46
  return /* @__PURE__ */ jsx(
29
47
  Box,
30
48
  {
@@ -34,7 +52,8 @@ const WmLeftPanel = (props) => {
34
52
  className: clsx(
35
53
  DEFAULT_CLASS,
36
54
  className,
37
- `col-sm-${columnwidth} ${navtype ? `app-nav-${navtype}` : ""} ${navheight ? `app-nav-${navheight}` : ""}`
55
+ animation,
56
+ `col-md-${columnwidth} col-sm-${columnwidth} col-xs-${xscolumnwidth} ${navtype ? `app-nav-${navtype}` : ""} ${navheight ? `app-nav-${navheight}` : ""}`
38
57
  ),
39
58
  children: render ? render(props) : children
40
59
  }
@@ -1,9 +1,18 @@
1
1
  export interface LeftNavProps {
2
+ /**
3
+ * The animation mode used by the left panel.
4
+ */
5
+ animation?: string;
2
6
  /**
3
7
  * The number of columns the left panel should span.
4
8
  * @default 2
5
9
  */
6
10
  columnwidth?: number | string;
11
+ /**
12
+ * The number of columns the left panel should span on extra-small screens.
13
+ * @default 10
14
+ */
15
+ xscolumnwidth?: number | string;
7
16
  /**
8
17
  * The height of the navigation panel.
9
18
  */
@@ -0,0 +1,9 @@
1
+ export type LeftPanelPageLayout = {
2
+ animation?: string;
3
+ columnwidth?: number | string;
4
+ xscolumnwidth?: number | string;
5
+ };
6
+ /**
7
+ * (slide-in-left-panel-container, left-panel-container-*-*, etc.).
8
+ */
9
+ export declare const getLeftPanelPageClasses: (layout: LeftPanelPageLayout) => string;
@@ -0,0 +1,28 @@
1
+ import clsx from "clsx";
2
+ const SLIDE_IN = "slide-in";
3
+ const SLIDE_OVER = "slide-over";
4
+ const getPageWidthClass = (device, panelWidth) => {
5
+ const width = Number(panelWidth);
6
+ if (!Number.isFinite(width)) {
7
+ return "";
8
+ }
9
+ return `left-panel-container-${device}-${12 - width}`;
10
+ };
11
+ const getLeftPanelPageClasses = (layout) => {
12
+ if (layout.animation === SLIDE_IN) {
13
+ return clsx(
14
+ "left-panel-collapsed-container",
15
+ "slide-in-left-panel-container",
16
+ getPageWidthClass("md", layout.columnwidth),
17
+ getPageWidthClass("sm", layout.columnwidth),
18
+ getPageWidthClass("xs", layout.xscolumnwidth)
19
+ );
20
+ }
21
+ if (layout.animation === SLIDE_OVER) {
22
+ return clsx("left-panel-collapsed-container", "slide-over-left-panel-container");
23
+ }
24
+ return "left-panel-collapsed-container";
25
+ };
26
+ export {
27
+ getLeftPanelPageClasses
28
+ };