@wavemaker-ai/react-runtime 1.0.0-rc.647684 → 12.0.0-rc.335

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 (215) hide show
  1. package/components/advanced/carousel/index.d.ts +1 -0
  2. package/components/advanced/carousel/template.d.ts +1 -0
  3. package/components/advanced/login/index.d.ts +1 -0
  4. package/components/advanced/marquee/index.d.ts +1 -0
  5. package/components/basic/anchor/index.d.ts +1 -0
  6. package/components/basic/anchor/index.js +3 -5
  7. package/components/basic/audio/index.d.ts +1 -0
  8. package/components/basic/html/index.d.ts +1 -0
  9. package/components/basic/icon/index.d.ts +1 -0
  10. package/components/basic/iframe/index.d.ts +1 -0
  11. package/components/basic/label/index.d.ts +1 -0
  12. package/components/basic/picture/index.d.ts +1 -0
  13. package/components/basic/progress-bar/index.d.ts +1 -0
  14. package/components/basic/progress-circle/index.d.ts +1 -0
  15. package/components/basic/richtexteditor/index.d.ts +3 -0
  16. package/components/basic/search/index.js +5 -4
  17. package/components/basic/search/utils.d.ts +1 -0
  18. package/components/basic/search/utils.js +9 -0
  19. package/components/basic/spinner/index.d.ts +1 -0
  20. package/components/basic/tile/index.d.ts +1 -0
  21. package/components/basic/tree/index.d.ts +1 -0
  22. package/components/basic/video/index.d.ts +1 -0
  23. package/components/chart/index.d.ts +1 -0
  24. package/components/common/index.d.ts +2 -0
  25. package/components/common/index.js +2 -0
  26. package/components/common/partial-content-wrapper.d.ts +15 -0
  27. package/components/common/partial-content-wrapper.js +11 -0
  28. package/components/container/accordion/accordion-pane/index.d.ts +1 -0
  29. package/components/container/accordion/index.d.ts +1 -0
  30. package/components/container/index.d.ts +4 -0
  31. package/components/container/index.js +38 -11
  32. package/components/container/layout-grid/grid-column/index.d.ts +1 -0
  33. package/components/container/layout-grid/grid-row/index.d.ts +1 -0
  34. package/components/container/layout-grid/index.d.ts +1 -0
  35. package/components/container/layout-grid/index.js +1 -1
  36. package/components/container/linear-layout/index.d.ts +1 -0
  37. package/components/container/linear-layout/linear-layout-item/index.d.ts +1 -0
  38. package/components/container/panel/index.d.ts +1 -0
  39. package/components/container/props.d.ts +1 -0
  40. package/components/container/repeat-template/index.d.ts +1 -0
  41. package/components/container/repeat-template/index.js +1 -1
  42. package/components/container/tabs/index.d.ts +1 -0
  43. package/components/container/tabs/index.js +12 -8
  44. package/components/container/tabs/tab-pane/index.d.ts +1 -0
  45. package/components/container/tabs/tab-pane/index.js +2 -2
  46. package/components/container/wizard/index.d.ts +2 -0
  47. package/components/container/wizard/index.js +92 -43
  48. package/components/container/wizard/props.d.ts +2 -2
  49. package/components/container/wizard/wizard-step/index.d.ts +1 -0
  50. package/components/data/card/card-actions/index.d.ts +1 -0
  51. package/components/data/card/card-content/index.d.ts +1 -0
  52. package/components/data/card/card-footer/index.d.ts +1 -0
  53. package/components/data/card/index.d.ts +1 -0
  54. package/components/data/form/base-form/hooks/useFormOperations.d.ts +1 -1
  55. package/components/data/form/base-form/hooks/useFormOperations.js +5 -2
  56. package/components/data/form/base-form/index.js +10 -14
  57. package/components/data/form/base-form/props.d.ts +1 -0
  58. package/components/data/form/dynamic-fields/WmxDynamicFormField.js +9 -23
  59. package/components/data/form/form-action/index.d.ts +2 -0
  60. package/components/data/form/form-controller/props.d.ts +2 -0
  61. package/components/data/form/form-controller/utils.js +3 -2
  62. package/components/data/form/form-controller/validation-contrustor.js +112 -1
  63. package/components/data/form/form-controller/withFormController.js +16 -3
  64. package/components/data/form/form-field/index.js +38 -11
  65. package/components/data/form/form-field/props.d.ts +8 -2
  66. package/components/data/list/components/ListItemWithTemplate.js +1 -1
  67. package/components/data/list/index.d.ts +2 -0
  68. package/components/data/list/index.js +5 -10
  69. package/components/data/pagination/hooks/usePagination.js +6 -6
  70. package/components/data/table/components/EditableCell.js +47 -24
  71. package/components/data/table/components/FieldValidationError.js +1 -1
  72. package/components/data/table/components/RowExpansionButton.js +5 -1
  73. package/components/data/table/components/TableBody.js +2 -0
  74. package/components/data/table/components/TableHeader.js +12 -4
  75. package/components/data/table/hooks/useFormWidget.js +13 -2
  76. package/components/data/table/hooks/usePanelStructure.js +6 -1
  77. package/components/data/table/hooks/useResponsiveColumns.d.ts +1 -0
  78. package/components/data/table/hooks/useRowHandlers.js +1 -1
  79. package/components/data/table/hooks/useRowSelection.js +65 -4
  80. package/components/data/table/hooks/useTableData.js +10 -2
  81. package/components/data/table/hooks/useTableEdit.d.ts +1 -1
  82. package/components/data/table/hooks/useTableEdit.js +115 -75
  83. package/components/data/table/hooks/useTableEditForms.d.ts +25 -0
  84. package/components/data/table/hooks/useTableEditForms.js +30 -0
  85. package/components/data/table/index.d.ts +2 -0
  86. package/components/data/table/index.js +82 -45
  87. package/components/data/table/live-table/index.d.ts +1 -0
  88. package/components/data/table/props.d.ts +43 -23
  89. package/components/data/table/table-action/index.d.ts +1 -0
  90. package/components/data/table/table-column/index.d.ts +1 -0
  91. package/components/data/table/table-row/index.d.ts +1 -0
  92. package/components/data/table/table-row-action/index.d.ts +1 -0
  93. package/components/data/table/utils/buildSelectionColumns.js +19 -24
  94. package/components/data/table/utils/columnProxy.d.ts +7 -1
  95. package/components/data/table/utils/columnProxy.js +21 -1
  96. package/components/data/table/utils/columnValidation.d.ts +19 -0
  97. package/components/data/table/utils/columnValidation.js +76 -0
  98. package/components/data/table/utils/constants.d.ts +2 -0
  99. package/components/data/table/utils/constants.js +2 -0
  100. package/components/data/table/utils/crud-handlers.js +3 -1
  101. package/components/data/table/utils/expansionColumn.js +1 -1
  102. package/components/data/table/utils/index.d.ts +14 -15
  103. package/components/data/table/utils/index.js +18 -85
  104. package/components/data/table/utils/selectionUtils.d.ts +12 -0
  105. package/components/data/table/utils/selectionUtils.js +23 -5
  106. package/components/dialogs/alert-dialog/index.d.ts +2 -0
  107. package/components/dialogs/confirm-dialog/index.d.ts +2 -0
  108. package/components/dialogs/dialog/index.d.ts +2 -0
  109. package/components/dialogs/dialog-actions/index.d.ts +1 -0
  110. package/components/dialogs/dialog-body/index.d.ts +1 -0
  111. package/components/dialogs/dialog-content/index.d.ts +1 -0
  112. package/components/dialogs/dialog-header/index.d.ts +1 -0
  113. package/components/dialogs/iframe-dialog/index.d.ts +2 -0
  114. package/components/dialogs/login-dialog/index.d.ts +2 -0
  115. package/components/dialogs/page-dialog/index.d.ts +2 -0
  116. package/components/dialogs/withDialogWrapper.js +12 -2
  117. package/components/form/button/index.d.ts +1 -0
  118. package/components/form/button-group/index.d.ts +1 -0
  119. package/components/input/calendar/index.d.ts +2 -0
  120. package/components/input/chips/index.d.ts +3 -0
  121. package/components/input/color-picker/index.d.ts +3 -0
  122. package/components/input/composite/index.d.ts +1 -0
  123. package/components/input/composite/index.js +32 -6
  124. package/components/input/currency/index.d.ts +1 -0
  125. package/components/input/default/checkbox/index.d.ts +3 -0
  126. package/components/input/default/checkboxset/index.d.ts +3 -0
  127. package/components/input/default/radioset/index.d.ts +3 -0
  128. package/components/input/default/switch/index.d.ts +3 -0
  129. package/components/input/epoch/date/index.d.ts +1 -0
  130. package/components/input/epoch/datetime/index.d.ts +1 -0
  131. package/components/input/epoch/datetime/index.js +13 -3
  132. package/components/input/epoch/time/index.d.ts +1 -0
  133. package/components/input/fileupload/index.d.ts +1 -0
  134. package/components/input/fileupload/index.js +2 -1
  135. package/components/input/number/index.d.ts +3 -0
  136. package/components/input/rating/index.d.ts +3 -0
  137. package/components/input/select/index.d.ts +1 -0
  138. package/components/input/slider/index.d.ts +3 -0
  139. package/components/input/text/index.d.ts +3 -0
  140. package/components/input/text/index.js +9 -2
  141. package/components/input/textarea/index.d.ts +3 -0
  142. package/components/input/upload/index.d.ts +3 -0
  143. package/components/layout/footer/index.js +4 -2
  144. package/components/layout/footer/props.d.ts +1 -0
  145. package/components/layout/header/index.js +29 -3
  146. package/components/layout/header/props.d.ts +1 -0
  147. package/components/layout/leftnav/index.js +22 -6
  148. package/components/layout/leftnav/props.d.ts +1 -0
  149. package/components/layout/leftnav/utils/page-class-util.d.ts +1 -0
  150. package/components/layout/leftnav/utils/page-class-util.js +4 -3
  151. package/components/layout/rightnav/index.js +4 -2
  152. package/components/layout/rightnav/props.d.ts +1 -0
  153. package/components/layout/topnav/index.js +4 -2
  154. package/components/layout/topnav/props.d.ts +1 -0
  155. package/components/navbar/index.d.ts +1 -0
  156. package/components/navbar/index.js +32 -7
  157. package/components/navbar/nav-item/index.d.ts +1 -0
  158. package/components/navigation/breadcrumb/index.d.ts +1 -0
  159. package/components/navigation/menu/index.d.ts +1 -0
  160. package/components/navigation/menu/index.js +19 -11
  161. package/components/navigation/menu/props.d.ts +1 -0
  162. package/components/navigation/popover/index.d.ts +1 -0
  163. package/components/navigation/popover/index.js +15 -3
  164. package/components/page/index.js +60 -19
  165. package/components/page/page-context.d.ts +4 -0
  166. package/components/page/partial/index.d.ts +1 -0
  167. package/context/PopoverContext.d.ts +5 -0
  168. package/context/PopoverContext.js +5 -0
  169. package/context/WidgetProvider.js +9 -2
  170. package/core/proxy-service.d.ts +2 -0
  171. package/core/proxy-service.js +132 -22
  172. package/higherOrder/BaseApp.js +3 -2
  173. package/higherOrder/BasePage.js +4 -10
  174. package/higherOrder/props.d.ts +1 -0
  175. package/higherOrder/useActivePageReactivity.js +1 -4
  176. package/higherOrder/withBaseWrapper.js +12 -3
  177. package/hooks/useHttp.d.ts +14 -4
  178. package/hooks/useHttp.js +47 -9
  179. package/package-lock.json +332 -325
  180. package/package.json +3 -3
  181. package/runtime-dynamic/App.js +21 -2
  182. package/runtime-dynamic/app-initializer.js +8 -1
  183. package/runtime-dynamic/components/PageWrapper.js +1 -1
  184. package/runtime-dynamic/components/PrefabPreview.js +1 -1
  185. package/runtime-dynamic/components/partial-content.js +17 -1
  186. package/runtime-dynamic/factories/build-base-page-like-component.js +11 -7
  187. package/runtime-dynamic/factories/dynamic-component.js +5 -10
  188. package/runtime-dynamic/main.d.ts +1 -0
  189. package/runtime-dynamic/main.js +9 -1
  190. package/runtime-dynamic/routes.js +17 -8
  191. package/runtime-dynamic/services/compile-render.js +7 -0
  192. package/runtime-dynamic/services/css-scoping.d.ts +1 -1
  193. package/runtime-dynamic/services/css-scoping.js +2 -2
  194. package/runtime-dynamic/services/variable-factory.js +2 -1
  195. package/runtime-dynamic/services/variable-transpiler.js +4 -1
  196. package/runtime-dynamic/wmx-shared.d.ts +40 -0
  197. package/runtime-dynamic/wmx-shared.js +33 -0
  198. package/utils/page-params-util.js +22 -1
  199. package/utils/partial-host-util.d.ts +40 -0
  200. package/utils/partial-host-util.js +41 -0
  201. package/utils/style-utils.js +1 -1
  202. package/utils/wmx.utils.d.ts +0 -1
  203. package/utils/wmx.utils.js +0 -25
  204. package/variables/crud-variable.d.ts +10 -0
  205. package/variables/crud-variable.js +53 -2
  206. package/variables/live-variable.d.ts +1 -0
  207. package/variables/live-variable.js +2 -1
  208. package/variables/model-variable.d.ts +2 -0
  209. package/variables/model-variable.js +14 -0
  210. package/variables/operation-params.d.ts +29 -0
  211. package/variables/operation-params.js +69 -0
  212. package/variables/service-variable.d.ts +9 -0
  213. package/variables/service-variable.js +21 -2
  214. package/components/data/table/utils/validation.d.ts +0 -13
  215. package/components/data/table/utils/validation.js +0 -82
@@ -0,0 +1,76 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import { cloneDeep } from "lodash-es";
21
+ const isColumnValidatable = (column) => {
22
+ if (!column || !column.field) return false;
23
+ if (column.readonly) return false;
24
+ if (column.show === false) return false;
25
+ return true;
26
+ };
27
+ const cloneValidators = (validators) => Array.isArray(validators) ? cloneDeep(validators) : [];
28
+ const storeColumnValidators = (registry, field, kind, validators) => {
29
+ const current = registry[field] || { validators: [], asyncValidators: [] };
30
+ registry[field] = __spreadProps(__spreadValues({}, current), { [kind]: cloneValidators(validators) });
31
+ };
32
+ const NATIVE_VALIDITY_FLAGS = [
33
+ "badInput",
34
+ "typeMismatch",
35
+ "stepMismatch",
36
+ "rangeOverflow",
37
+ "rangeUnderflow",
38
+ "tooLong",
39
+ "tooShort"
40
+ ];
41
+ const hasNativeError = (input) => !input.validity.valid && NATIVE_VALIDITY_FLAGS.some((flag) => input.validity[flag]);
42
+ const collectNativeValidityErrors = (cellElements, rowId) => {
43
+ const errors = [];
44
+ const prefix = `${rowId}_`;
45
+ for (const [fieldKey, element] of Object.entries(cellElements)) {
46
+ if (!element || !fieldKey.startsWith(prefix)) continue;
47
+ const fieldName = element.getAttribute("data-field-name") || fieldKey.slice(prefix.length);
48
+ const inputs = Array.from(element.querySelectorAll("input, select, textarea"));
49
+ const invalid = inputs.find(
50
+ (input) => !input.disabled && !("readOnly" in input && input.readOnly) && hasNativeError(input)
51
+ );
52
+ if (invalid) {
53
+ errors.push({ fieldName, message: invalid.validationMessage || "Value is not valid" });
54
+ }
55
+ }
56
+ return errors;
57
+ };
58
+ const focusFirstInvalidCell = (cellElements, rowId, invalidFieldNames) => {
59
+ var _a;
60
+ for (const fieldName of invalidFieldNames) {
61
+ const target = (_a = cellElements[`${rowId}_${fieldName}`]) == null ? void 0 : _a.querySelector(
62
+ "[focus-target], input, textarea, select"
63
+ );
64
+ if (target) {
65
+ target.focus();
66
+ return;
67
+ }
68
+ }
69
+ };
70
+ export {
71
+ cloneValidators,
72
+ collectNativeValidityErrors,
73
+ focusFirstInvalidCell,
74
+ isColumnValidatable,
75
+ storeColumnValidators
76
+ };
@@ -44,5 +44,7 @@ export declare const TABLE_MESSAGES: {
44
44
  export declare const INTERACTIVE_CLASSES: readonly ["MuiInputBase", "MuiSelect", "MuiButton", "MuiCheckbox", "MuiRadio", "MuiSlider", "MuiSwitch", "MuiTextField", "MuiAutocomplete", "MuiChip", "MuiRating", "MuiToggleButton", "MuiPickersDay", "MuiDatePicker", "MuiTimePicker", "MuiDateTimePicker", "MuiCalendarPicker", "MuiClockPicker", "MuiColorPicker", "MuiFormControl", "MuiFormGroup", "MuiFormControlLabel", "app-text", "app-textarea", "app-checkbox", "app-slider", "app-currency", "app-switch", "app-select", "app-checkboxset", "app-radioset", "app-date", "app-time", "app-timestamp", "app-rating", "app-datetime", "app-search", "app-chips", "app-colorpicker", "app-calendar", "app-editor"];
45
45
  export declare const INTERACTIVE_ROLES: readonly ["button", "textbox", "combobox", "listbox"];
46
46
  export declare const INTERACTIVE_DATA_ROLES: readonly ["input", "select", "date", "time", "color", "editor", "checkbox", "radio", "slider", "chips", "rating"];
47
+ /** data-role values on the table selection column. Clicks here must not count as interactive widgets. */
48
+ export declare const SELECTION_COLUMN_DATA_ROLES: readonly ["select-all", "select-row"];
47
49
  export declare const INTERACTIVE_TAG_NAMES: readonly ["INPUT", "BUTTON", "SELECT", "TEXTAREA", "A", "LABEL"];
48
50
  export declare const UNSUPPORTED_STATE_PERSISTENCE_TYPES: readonly string[];
@@ -104,6 +104,7 @@ const INTERACTIVE_DATA_ROLES = [
104
104
  "chips",
105
105
  "rating"
106
106
  ];
107
+ const SELECTION_COLUMN_DATA_ROLES = ["select-all", "select-row"];
107
108
  const INTERACTIVE_TAG_NAMES = [
108
109
  "INPUT",
109
110
  "BUTTON",
@@ -122,6 +123,7 @@ export {
122
123
  INTERACTIVE_DATA_ROLES,
123
124
  INTERACTIVE_ROLES,
124
125
  INTERACTIVE_TAG_NAMES,
126
+ SELECTION_COLUMN_DATA_ROLES,
125
127
  TABLE_CSS_CLASSES,
126
128
  TABLE_DATA_STATES,
127
129
  TABLE_MESSAGES,
@@ -23,6 +23,7 @@ import findIndex from "lodash-es/findIndex";
23
23
  import slice from "lodash-es/slice";
24
24
  import forEach from "lodash-es/forEach";
25
25
  import some from "lodash-es/some";
26
+ import { addUniqueRowIds } from "./index";
26
27
  import { DataSource } from "../../types";
27
28
  const getDatasourceInfo = async (datasource) => {
28
29
  var _a, _b;
@@ -56,7 +57,8 @@ const createCompleteRecord = (editingData, wmTableColumns, serverResponse) => {
56
57
  completeRecord[column.field] = (_b = (_a = editingData[column.field]) != null ? _a : column.defaultvalue) != null ? _b : "";
57
58
  }
58
59
  });
59
- return __spreadProps(__spreadValues(__spreadValues({}, completeRecord), serverResponse), { _wmTableRowId: uniqueId("new_row_") });
60
+ const record = __spreadProps(__spreadValues(__spreadValues({}, completeRecord), serverResponse), { _wmTableRowId: uniqueId("new_row_") });
61
+ return addUniqueRowIds([record])[0];
60
62
  };
61
63
  const hasValidData = (record) => some(record, (value) => value !== void 0 && value !== null && value !== "");
62
64
  const updateDataset = (isNewRow, rowId, editingData, wmTableColumns, serverResponse, options) => {
@@ -47,7 +47,7 @@ function buildExpansionColSpec(columnwidth) {
47
47
  return {
48
48
  key: "row-expansion",
49
49
  width: w,
50
- style: { width: w }
50
+ style: { width: w, minWidth: w, maxWidth: w }
51
51
  };
52
52
  }
53
53
  export {
@@ -1,5 +1,5 @@
1
1
  import React, { type CSSProperties } from "react";
2
- import { WmTableColumnProps, WmTableRowActionProps, WmTableRowProps, WmTableActionProps, ValidationResult } from "../props";
2
+ import { WmTableColumnProps, WmTableRowActionProps, WmTableRowProps, WmTableActionProps } from "../props";
3
3
  declare const formWidgets: readonly ["WmText", "WmTextarea", "WmCheckbox", "WmSlider", "WmCurrency", "WmSwitch", "WmSelect", "WmCheckboxSet", "WmRadioSet", "WmDate", "WmTime", "WmTimestamp", "WmRating", "WmDatetime", "WmSearch", "WmChips", "WmColorPicker"];
4
4
  type FormWidgetType = (typeof formWidgets)[number];
5
5
  export type EditWidgetType = FormWidgetType;
@@ -51,9 +51,16 @@ export declare const parseTableActions: (children: React.ReactNode) => WmTableAc
51
51
  export declare const getRowExpansionConfig: (config: WmTableRowProps | null, rowId: string, rowData?: any) => WmTableRowProps | null;
52
52
  /**
53
53
  * Whether the expansion column should be reserved in the table layout.
54
- * When tableRowProps gates show per row (e.g. hierarchy children.length), hide the
55
- * column entirely if no current row would show an expand control — avoids empty
56
- * row-expansion-cell spacers for leaf-only datasets.
54
+ *
55
+ * This is a STRUCTURAL check, matching Angular's datatable: the row-expansion
56
+ * column is part of the table layout whenever a row-expansion config exists and
57
+ * is not statically disabled. Per-row `show` (e.g. a hierarchy `children.length`
58
+ * gate via `tableRowProps`) only controls whether the toggle *button* renders
59
+ * inside the cell — see RowExpansionButton — never whether the column exists.
60
+ *
61
+ * Collapsing the column when no current row happens to be expandable would
62
+ * desynchronise header/body/colgroup cell counts and shift every data column by
63
+ * one for leaf-only datasets (e.g. nested child tables in a hierarchy).
57
64
  */
58
65
  export declare const isRowExpansionVisible: (config: WmTableRowProps | null | undefined, dataset: any[] | undefined) => boolean;
59
66
  export declare const parseTableRowExpansion: (children: React.ReactNode) => WmTableRowProps | null;
@@ -62,15 +69,6 @@ export declare const isDeleteAction: (actionKey: string) => boolean;
62
69
  export declare const isAddNewAction: (actionKey: string) => boolean;
63
70
  export declare const getActionButtonClass: (action: WmTableRowActionProps) => string;
64
71
  export declare const getTableActionButtonClass: (action: WmTableActionProps) => string;
65
- /**
66
- * Validates editing fields and focuses first invalid field if validation fails
67
- * Can be used across different edit modes (inline, dialog, quick edit)
68
- *
69
- * @param fieldRefs - Record of field references from editing form
70
- * @param editingRowId - Optional ID for logging/debugging purposes
71
- * @returns ValidationResult object with validation status and invalid elements
72
- */
73
- export declare const validateEditingFields: (fieldRefs: Record<string, HTMLElement | null>, editingRowId?: string) => ValidationResult;
74
72
  export declare const getButtonClasses: (action: any, spacing?: string, isGridEditMode?: boolean, isLoading?: boolean) => string;
75
73
  export declare const getSpacingClasses: (spacing?: string) => string;
76
74
  export declare const shouldShowPagination: ({ shownavigation, onDemandLoad, internalDataset, pagesize, allowpagesizechange, datasource, showrecordcount, }: {
@@ -116,10 +114,11 @@ export declare function getDomHiddenColStyle(meta?: Record<string, unknown>): CS
116
114
  /** Inline style for hidden th/td — display:none and zero box so flex sizing cannot leak width. */
117
115
  export declare function getDomHiddenCellStyle(meta?: Record<string, unknown>): CSSProperties | undefined;
118
116
  export declare const getColClass: (colClass: string, rowData: any, columnName: string) => string;
119
- export { TABLE_CSS_CLASSES, TABLE_DATA_STATES, TABLE_MESSAGES, INTERACTIVE_CLASSES, INTERACTIVE_ROLES, INTERACTIVE_DATA_ROLES, INTERACTIVE_TAG_NAMES, UNSUPPORTED_STATE_PERSISTENCE_TYPES, } from "./constants";
117
+ export { TABLE_CSS_CLASSES, TABLE_DATA_STATES, TABLE_MESSAGES, INTERACTIVE_CLASSES, INTERACTIVE_ROLES, INTERACTIVE_DATA_ROLES, INTERACTIVE_TAG_NAMES, SELECTION_COLUMN_DATA_ROLES, UNSUPPORTED_STATE_PERSISTENCE_TYPES, } from "./constants";
120
118
  export { renderDisplayCell } from "./renderDisplayCell";
121
119
  export { buildSelectionColumns } from "./buildSelectionColumns";
122
- export { validateField, resetValidationState, updateValidationErrors } from "./validation";
120
+ export { cloneValidators, collectNativeValidityErrors, focusFirstInvalidCell, isColumnValidatable, } from "./columnValidation";
121
+ export type { ColumnValidatorRegistry, NativeValidityError } from "./columnValidation";
123
122
  export { hasInteractiveClass, hasInteractiveAttributes, isInteractiveElement, getRowIdsFromDataset, rowExistsInDataset, selectionStateHelpers, } from "./selectionUtils";
124
123
  export { createRowIndexColumn, createDataColumn, createDataColumns, createEditingActionButtons, createDefaultColumnProps, getActionColumnSize, } from "./columnBuilder";
125
124
  export { isDataColumn, hasExplicitWidth, distributeColumnWidths } from "./columnWidthDistribution";
@@ -18,15 +18,12 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  import {
21
- forEach,
22
- entries,
23
21
  size,
24
22
  isEmpty,
25
23
  isArray,
26
24
  map,
27
25
  get,
28
26
  trim,
29
- startsWith,
30
27
  findIndex,
31
28
  assign,
32
29
  floor,
@@ -369,12 +366,7 @@ const isRowExpansionVisible = (config, dataset) => {
369
366
  if (!config) return false;
370
367
  if (typeof config.tableRowProps === "function") {
371
368
  if (!Array.isArray(dataset) || dataset.length === 0) return false;
372
- return dataset.some((row) => {
373
- var _a;
374
- const overrides = ((_a = config.tableRowProps) == null ? void 0 : _a.call(config, row)) || {};
375
- const show = overrides.show !== void 0 ? overrides.show : config.show;
376
- return show !== false;
377
- });
369
+ return true;
378
370
  }
379
371
  return config.show !== false;
380
372
  };
@@ -414,74 +406,6 @@ const getActionButtonClass = (action) => {
414
406
  const getTableActionButtonClass = (action) => {
415
407
  return `btn ${get(action, "className", "btn-primary")} ${isAddNewAction(get(action, "key")) ? "add-action" : ""}`;
416
408
  };
417
- const validateEditingFields = (fieldRefs, editingRowId) => {
418
- const invalidElements = [];
419
- const invalidFieldKeys = [];
420
- const shouldValidateField = (fieldKey) => {
421
- if (!editingRowId) return true;
422
- return startsWith(fieldKey, `${editingRowId}_`);
423
- };
424
- forEach(entries(fieldRefs), ([fieldKey, fieldElement]) => {
425
- if (!shouldValidateField(fieldKey) || !fieldElement) {
426
- return;
427
- }
428
- let isInvalid = false;
429
- const inputs = fieldElement.querySelectorAll("input, select, textarea");
430
- forEach(inputs, (input) => {
431
- if (input && !input.validity.valid && input.hasAttribute("required")) {
432
- invalidElements.push(input);
433
- isInvalid = true;
434
- }
435
- if (input && input.classList.contains("ng-invalid")) {
436
- invalidElements.push(input);
437
- isInvalid = true;
438
- }
439
- if (input && input.hasAttribute("required") && !trim(input.value)) {
440
- invalidElements.push(input);
441
- isInvalid = true;
442
- }
443
- });
444
- if (fieldElement.hasAttribute("required")) {
445
- const inputEl = fieldElement.querySelector("input, textarea, select");
446
- if (inputEl && !trim(inputEl.value)) {
447
- invalidElements.push(inputEl);
448
- isInvalid = true;
449
- }
450
- }
451
- if (isInvalid) {
452
- invalidFieldKeys.push(fieldKey);
453
- }
454
- });
455
- if (size(invalidElements) > 0) {
456
- const logPrefix = editingRowId ? `[${editingRowId}]` : "[Validation]";
457
- console.log(`${logPrefix} Validation failed: Found ${size(invalidElements)} invalid elements`);
458
- const firstInvalidElement = get(invalidElements, "[0]");
459
- if (firstInvalidElement) {
460
- const cell = firstInvalidElement.closest("td, .app-datagrid-cell, .form-field");
461
- if (cell) {
462
- const focusTarget = cell.querySelector(
463
- "[focus-target], input, textarea, select"
464
- );
465
- if (focusTarget) {
466
- setTimeout(() => {
467
- focusTarget.focus();
468
- console.log(`${logPrefix} Focused first invalid field:`, focusTarget);
469
- }, 0);
470
- }
471
- } else {
472
- setTimeout(() => {
473
- firstInvalidElement.focus();
474
- }, 0);
475
- }
476
- }
477
- }
478
- return {
479
- isValid: isEmpty(invalidElements),
480
- invalidElements,
481
- invalidFieldKeys,
482
- firstInvalidElement: size(invalidElements) > 0 ? get(invalidElements, "[0]") : void 0
483
- };
484
- };
485
409
  const getButtonClasses = (action, spacing = "normal", isGridEditMode = false, isLoading = false) => {
486
410
  const baseClass = `btn ${get(action, "className", "btn-primary")} ${isAddNewAction(get(action, "key")) ? "add-action" : ""}`;
487
411
  const spacingClass = spacing === "condensed" ? "btn-sm" : "";
@@ -504,9 +428,11 @@ const shouldShowPagination = ({
504
428
  datasource,
505
429
  showrecordcount = false
506
430
  }) => {
507
- var _a;
431
+ var _a, _b, _c;
508
432
  if (!shownavigation) return false;
509
- if (((_a = datasource == null ? void 0 : datasource.pagination) == null ? void 0 : _a.totalElements) > 0) return true;
433
+ const hasRecords = size(internalDataset) > 0 || ((_a = datasource == null ? void 0 : datasource.pagination) == null ? void 0 : _a.totalElements) > 0 || Boolean((_b = datasource == null ? void 0 : datasource.pagination) == null ? void 0 : _b.next);
434
+ if (!hasRecords) return false;
435
+ if (((_c = datasource == null ? void 0 : datasource.pagination) == null ? void 0 : _c.totalElements) > pagesize) return true;
510
436
  if (allowpagesizechange) return true;
511
437
  if (showrecordcount) return true;
512
438
  return onDemandLoad || size(internalDataset) > pagesize;
@@ -662,11 +588,17 @@ import {
662
588
  INTERACTIVE_ROLES,
663
589
  INTERACTIVE_DATA_ROLES,
664
590
  INTERACTIVE_TAG_NAMES,
591
+ SELECTION_COLUMN_DATA_ROLES,
665
592
  UNSUPPORTED_STATE_PERSISTENCE_TYPES
666
593
  } from "./constants";
667
594
  import { renderDisplayCell } from "./renderDisplayCell";
668
595
  import { buildSelectionColumns } from "./buildSelectionColumns";
669
- import { validateField, resetValidationState, updateValidationErrors } from "./validation";
596
+ import {
597
+ cloneValidators,
598
+ collectNativeValidityErrors,
599
+ focusFirstInvalidCell,
600
+ isColumnValidatable
601
+ } from "./columnValidation";
670
602
  import {
671
603
  hasInteractiveClass,
672
604
  hasInteractiveAttributes,
@@ -697,6 +629,7 @@ export {
697
629
  INTERACTIVE_ROLES,
698
630
  INTERACTIVE_TAG_NAMES,
699
631
  INTERNAL_PROPERTIES,
632
+ SELECTION_COLUMN_DATA_ROLES,
700
633
  TABLE_CSS_CLASSES2 as TABLE_CSS_CLASSES,
701
634
  TABLE_DATA_STATES,
702
635
  TABLE_MESSAGES,
@@ -705,6 +638,8 @@ export {
705
638
  buildSelectionColumns,
706
639
  cleanRowData,
707
640
  clearTableState,
641
+ cloneValidators,
642
+ collectNativeValidityErrors,
708
643
  convertFilterArrayToObject,
709
644
  convertFilterObjectToArray,
710
645
  createDataColumn,
@@ -715,6 +650,7 @@ export {
715
650
  distributeColumnWidths,
716
651
  extractDataArray,
717
652
  flattenTableStructure,
653
+ focusFirstInvalidCell,
718
654
  getActionButtonClass,
719
655
  getActionColumnSize,
720
656
  getAggregateFunctions,
@@ -736,6 +672,7 @@ export {
736
672
  hasInteractiveClass,
737
673
  isAddNewAction,
738
674
  isColumnDomHidden,
675
+ isColumnValidatable,
739
676
  isColumnVisibleForViewport,
740
677
  isDataColumn,
741
678
  isDeleteAction,
@@ -749,13 +686,9 @@ export {
749
686
  parseTableStructureWithGroups,
750
687
  parseWidth,
751
688
  renderDisplayCell,
752
- resetValidationState,
753
689
  rowExistsInDataset,
754
690
  saveTableState,
755
691
  selectionStateHelpers,
756
692
  shouldShowPagination,
757
- shouldShowPanelHeading,
758
- updateValidationErrors,
759
- validateEditingFields,
760
- validateField
693
+ shouldShowPanelHeading
761
694
  };
@@ -7,6 +7,18 @@ export declare const hasInteractiveClass: (element: HTMLElement) => boolean;
7
7
  * Check if an element has interactive attributes
8
8
  */
9
9
  export declare const hasInteractiveAttributes: (element: HTMLElement) => boolean;
10
+ /** The name datatable.js and the React table use for a row's multiselect checkbox. */
11
+ export declare const MULTI_SELECT_INPUT_NAME = "gridMultiSelect";
12
+ /**
13
+ * True when the clicked row's selection checkbox has been renamed away from
14
+ * `gridMultiSelect`.
15
+ *
16
+ * Mirrors the Angular datatable, whose toggleRowSelection only ever acts on
17
+ * `input[name="gridMultiSelect"]`, so application code that renames the input
18
+ * (e.g. to "gridMultiSelectDisable") opts that row out of click selection.
19
+ * Rows without a selection checkbox are never treated as renamed.
20
+ */
21
+ export declare const isSelectionCheckboxRenamed: (event: React.MouseEvent) => boolean;
10
22
  /**
11
23
  * Check if element or its ancestors are interactive
12
24
  */
@@ -3,7 +3,8 @@ import {
3
3
  INTERACTIVE_CLASSES,
4
4
  INTERACTIVE_ROLES,
5
5
  INTERACTIVE_DATA_ROLES,
6
- INTERACTIVE_TAG_NAMES
6
+ INTERACTIVE_TAG_NAMES,
7
+ SELECTION_COLUMN_DATA_ROLES
7
8
  } from "./constants";
8
9
  const hasInteractiveClass = (element) => {
9
10
  if (!element.className || typeof element.className !== "string") return false;
@@ -24,23 +25,38 @@ const hasInteractiveAttributes = (element) => {
24
25
  return true;
25
26
  }
26
27
  const dataRole = element.getAttribute("data-role");
28
+ if (dataRole && SELECTION_COLUMN_DATA_ROLES.includes(dataRole)) {
29
+ return false;
30
+ }
27
31
  if (dataRole) {
28
32
  for (const interactiveRole of INTERACTIVE_DATA_ROLES) {
29
- if (dataRole.includes(interactiveRole)) {
33
+ if (dataRole === interactiveRole) {
30
34
  return true;
31
35
  }
32
36
  }
33
37
  }
34
38
  return false;
35
39
  };
40
+ const MULTI_SELECT_INPUT_NAME = "gridMultiSelect";
41
+ const isSelectionCheckboxRenamed = (event) => {
42
+ var _a, _b;
43
+ const target = event == null ? void 0 : event.target;
44
+ const row = (_a = target == null ? void 0 : target.closest) == null ? void 0 : _a.call(target, "tr");
45
+ const checkbox = (_b = row == null ? void 0 : row.querySelector) == null ? void 0 : _b.call(row, 'input[type="checkbox"]');
46
+ return !!checkbox && checkbox.getAttribute("name") !== MULTI_SELECT_INPUT_NAME;
47
+ };
48
+ const isSelectionColumnTarget = (target) => {
49
+ if (!(target == null ? void 0 : target.closest)) return false;
50
+ return SELECTION_COLUMN_DATA_ROLES.some((role) => target.closest(`[data-role="${role}"]`));
51
+ };
36
52
  const isInteractiveElement = (event) => {
37
53
  const target = event.target;
38
- if (INTERACTIVE_TAG_NAMES.includes(target.tagName)) {
39
- return true;
54
+ if (isSelectionColumnTarget(target)) {
55
+ return false;
40
56
  }
41
57
  let element = target;
42
58
  while (element) {
43
- if (hasInteractiveClass(element) || hasInteractiveAttributes(element)) {
59
+ if (INTERACTIVE_TAG_NAMES.includes(element.tagName) || hasInteractiveClass(element) || hasInteractiveAttributes(element)) {
44
60
  return true;
45
61
  }
46
62
  element = element.parentElement;
@@ -126,12 +142,14 @@ const selectionStateHelpers = {
126
142
  }
127
143
  };
128
144
  export {
145
+ MULTI_SELECT_INPUT_NAME,
129
146
  createSelectionEventStub,
130
147
  getRowIdsFromDataset,
131
148
  getWidgetForCallback,
132
149
  hasInteractiveAttributes,
133
150
  hasInteractiveClass,
134
151
  isInteractiveElement,
152
+ isSelectionCheckboxRenamed,
135
153
  rowExistsInDataset,
136
154
  selectionStateHelpers,
137
155
  toNativeEvent
@@ -29,6 +29,7 @@ declare const WmAlertDialogStandalone: {
29
29
  width?: number | string;
30
30
  height?: number | string;
31
31
  className?: string;
32
+ class?: string;
32
33
  conditionalstyle?: React.CSSProperties;
33
34
  conditionalclass?: string;
34
35
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -115,6 +116,7 @@ declare const _default: {
115
116
  width?: number | string;
116
117
  height?: number | string;
117
118
  className?: string;
119
+ class?: string;
118
120
  conditionalstyle?: React.CSSProperties;
119
121
  conditionalclass?: string;
120
122
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -30,6 +30,7 @@ declare const WmConfirmDialogStandalone: {
30
30
  width?: number | string;
31
31
  height?: number | string;
32
32
  className?: string;
33
+ class?: string;
33
34
  conditionalstyle?: React.CSSProperties;
34
35
  conditionalclass?: string;
35
36
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -117,6 +118,7 @@ declare const _default: {
117
118
  width?: number | string;
118
119
  height?: number | string;
119
120
  className?: string;
121
+ class?: string;
120
122
  conditionalstyle?: React.CSSProperties;
121
123
  conditionalclass?: string;
122
124
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -34,6 +34,7 @@ declare const WmDialogStandalone: {
34
34
  width?: number | string;
35
35
  height?: number | string;
36
36
  className?: string;
37
+ class?: string;
37
38
  conditionalstyle?: import("react").CSSProperties;
38
39
  conditionalclass?: string;
39
40
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -127,6 +128,7 @@ declare const _default: {
127
128
  width?: number | string;
128
129
  height?: number | string;
129
130
  className?: string;
131
+ class?: string;
130
132
  conditionalstyle?: import("react").CSSProperties;
131
133
  conditionalclass?: string;
132
134
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -24,6 +24,7 @@ declare const _default: import("react").ComponentType<{
24
24
  width?: number | string;
25
25
  height?: number | string;
26
26
  className?: string;
27
+ class?: string;
27
28
  conditionalstyle?: import("react").CSSProperties;
28
29
  conditionalclass?: string;
29
30
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -23,6 +23,7 @@ declare const _default: import("react").ComponentType<{
23
23
  width?: number | string;
24
24
  height?: number | string;
25
25
  className?: string;
26
+ class?: string;
26
27
  conditionalstyle?: import("react").CSSProperties;
27
28
  conditionalclass?: string;
28
29
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -26,6 +26,7 @@ declare const _default: import("react").ComponentType<{
26
26
  width?: number | string;
27
27
  height?: number | string;
28
28
  className?: string;
29
+ class?: string;
29
30
  conditionalstyle?: import("react").CSSProperties;
30
31
  conditionalclass?: string;
31
32
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -40,6 +40,7 @@ declare const _default: React.ComponentType<{
40
40
  width?: number | string;
41
41
  height?: number | string;
42
42
  className?: string;
43
+ class?: string;
43
44
  conditionalstyle?: React.CSSProperties;
44
45
  conditionalclass?: string;
45
46
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -39,6 +39,7 @@ declare const WmIframeDialogStandalone: {
39
39
  width?: number | string;
40
40
  height?: number | string;
41
41
  className?: string;
42
+ class?: string;
42
43
  conditionalstyle?: React.CSSProperties;
43
44
  conditionalclass?: string;
44
45
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -135,6 +136,7 @@ declare const _default: {
135
136
  width?: number | string;
136
137
  height?: number | string;
137
138
  className?: string;
139
+ class?: string;
138
140
  conditionalstyle?: React.CSSProperties;
139
141
  conditionalclass?: string;
140
142
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -38,6 +38,7 @@ declare const WmLoginDialogStandalone: {
38
38
  width?: number | string;
39
39
  height?: number | string;
40
40
  className?: string;
41
+ class?: string;
41
42
  conditionalstyle?: React.CSSProperties;
42
43
  conditionalclass?: string;
43
44
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -123,6 +124,7 @@ declare const _default: {
123
124
  width?: number | string;
124
125
  height?: number | string;
125
126
  className?: string;
127
+ class?: string;
126
128
  conditionalstyle?: React.CSSProperties;
127
129
  conditionalclass?: string;
128
130
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -33,6 +33,7 @@ declare const WmPageDialogStandalone: {
33
33
  width?: number | string;
34
34
  height?: number | string;
35
35
  className?: string;
36
+ class?: string;
36
37
  conditionalstyle?: React.CSSProperties;
37
38
  conditionalclass?: string;
38
39
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -122,6 +123,7 @@ declare const _default: {
122
123
  width?: number | string;
123
124
  height?: number | string;
124
125
  className?: string;
126
+ class?: string;
125
127
  conditionalstyle?: React.CSSProperties;
126
128
  conditionalclass?: string;
127
129
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -30,8 +30,9 @@ var __objRest = (source, exclude) => {
30
30
  return target;
31
31
  };
32
32
  import { jsx } from "react/jsx-runtime";
33
- import { useCallback, useState, useEffect, useMemo, useRef } from "react";
33
+ import { useCallback, useState, useEffect, useMemo, useRef, useContext } from "react";
34
34
  import DialogService from "../../core/dialog.service";
35
+ import { PopoverContext } from "../../context/PopoverContext";
35
36
  const BaseDialog = (Component) => {
36
37
  const WrappedComponent = (props) => {
37
38
  const _a = props, {
@@ -52,6 +53,8 @@ const BaseDialog = (Component) => {
52
53
  "appLocale"
53
54
  ]);
54
55
  const [dialogOpen, setDialogOpen] = useState(!!isopen);
56
+ const popoverContext = useContext(PopoverContext);
57
+ const wasDialogOpenRef = useRef(!!isopen);
55
58
  const appLocaleMessages = useMemo(
56
59
  () => {
57
60
  var _a2;
@@ -65,15 +68,22 @@ const BaseDialog = (Component) => {
65
68
  setDialogOpen(!!isopen);
66
69
  isDialogOpenRef.current = !!isopen;
67
70
  }, [isopen]);
71
+ useEffect(() => {
72
+ if (wasDialogOpenRef.current && !dialogOpen) {
73
+ popoverContext == null ? void 0 : popoverContext.onDialogClose();
74
+ }
75
+ wasDialogOpenRef.current = dialogOpen;
76
+ }, [dialogOpen, popoverContext]);
68
77
  const handleTransitionEntered = useCallback(() => {
69
78
  if (onOpened) {
70
79
  onOpened();
71
80
  }
72
81
  }, [onOpened]);
73
82
  const handleOpen = useCallback(() => {
83
+ popoverContext == null ? void 0 : popoverContext.closeForDialog();
74
84
  setDialogOpen(true);
75
85
  isDialogOpenRef.current = true;
76
- }, []);
86
+ }, [popoverContext]);
77
87
  const handleClose = useCallback(
78
88
  (event) => {
79
89
  if (isDialogOpenRef.current) {
@@ -34,6 +34,7 @@ declare const _default: import("react").ComponentType<{
34
34
  width?: number | string;
35
35
  height?: number | string;
36
36
  className?: string;
37
+ class?: string;
37
38
  conditionalstyle?: import("react").CSSProperties;
38
39
  conditionalclass?: string;
39
40
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -26,6 +26,7 @@ declare const _default: React.ComponentType<{
26
26
  width?: number | string;
27
27
  height?: number | string;
28
28
  className?: string;
29
+ class?: string;
29
30
  conditionalstyle?: React.CSSProperties;
30
31
  conditionalclass?: string;
31
32
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];