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

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 (207) hide show
  1. package/actions/navigation-action.d.ts +1 -0
  2. package/actions/navigation-action.js +34 -9
  3. package/components/advanced/carousel/index.d.ts +2 -0
  4. package/components/advanced/carousel/template.d.ts +2 -0
  5. package/components/advanced/login/index.d.ts +2 -0
  6. package/components/advanced/marquee/index.d.ts +2 -0
  7. package/components/auth/RoleAuthGuard.d.ts +6 -0
  8. package/components/auth/RoleAuthGuard.js +66 -0
  9. package/components/basic/anchor/index.d.ts +2 -0
  10. package/components/basic/anchor/index.js +1 -1
  11. package/components/basic/audio/index.d.ts +2 -0
  12. package/components/basic/html/index.d.ts +2 -0
  13. package/components/basic/icon/index.d.ts +2 -0
  14. package/components/basic/iframe/index.d.ts +2 -0
  15. package/components/basic/label/index.d.ts +2 -0
  16. package/components/basic/label/index.js +17 -3
  17. package/components/basic/picture/index.d.ts +2 -0
  18. package/components/basic/picture/index.js +20 -1
  19. package/components/basic/progress-bar/index.d.ts +2 -0
  20. package/components/basic/progress-circle/index.d.ts +2 -0
  21. package/components/basic/progress-circle/index.js +2 -1
  22. package/components/basic/richtexteditor/index.d.ts +4 -0
  23. package/components/basic/richtexteditor/index.js +16 -15
  24. package/components/basic/search/index.d.ts +4 -0
  25. package/components/basic/search/index.js +2 -1
  26. package/components/basic/search/providers.js +2 -2
  27. package/components/basic/spinner/index.d.ts +2 -0
  28. package/components/basic/tile/index.d.ts +2 -0
  29. package/components/basic/tree/Components/TreeNodeComponent.d.ts +1 -1
  30. package/components/basic/tree/Components/TreeNodeComponent.js +14 -8
  31. package/components/basic/tree/hooks/useTreePersistedState.d.ts +3 -0
  32. package/components/basic/tree/hooks/useTreePersistedState.js +38 -0
  33. package/components/basic/tree/index.d.ts +3 -0
  34. package/components/basic/tree/index.js +105 -30
  35. package/components/basic/tree/props.d.ts +18 -1
  36. package/components/basic/tree/utils.d.ts +16 -1
  37. package/components/basic/tree/utils.js +111 -0
  38. package/components/basic/video/index.d.ts +2 -0
  39. package/components/chart/index.d.ts +2 -0
  40. package/components/chart/src/dataUtils.js +1 -1
  41. package/components/common/customTemplate/useCustomTemplate.js +1 -1
  42. package/components/common/index.d.ts +2 -0
  43. package/components/common/index.js +5 -1
  44. package/components/common/wm-skeleton.d.ts +95 -0
  45. package/components/common/wm-skeleton.js +346 -0
  46. package/components/container/accordion/accordion-pane/index.d.ts +2 -0
  47. package/components/container/accordion/index.d.ts +4 -0
  48. package/components/container/accordion/index.js +23 -1
  49. package/components/container/accordion/props.d.ts +10 -0
  50. package/components/container/index.d.ts +2 -0
  51. package/components/container/index.js +2 -4
  52. package/components/container/layout-grid/grid-column/index.d.ts +2 -0
  53. package/components/container/layout-grid/grid-column/index.js +2 -1
  54. package/components/container/layout-grid/grid-row/index.d.ts +2 -0
  55. package/components/container/layout-grid/index.d.ts +2 -0
  56. package/components/container/linear-layout/index.d.ts +2 -0
  57. package/components/container/linear-layout/linear-layout-item/index.d.ts +2 -0
  58. package/components/container/panel/index.d.ts +2 -0
  59. package/components/container/repeat-template/index.d.ts +2 -0
  60. package/components/container/tabs/index.d.ts +4 -0
  61. package/components/container/tabs/index.js +23 -1
  62. package/components/container/tabs/props.d.ts +10 -0
  63. package/components/container/tabs/tab-pane/index.d.ts +2 -0
  64. package/components/container/wizard/index.d.ts +8 -0
  65. package/components/container/wizard/index.js +27 -3
  66. package/components/container/wizard/props.d.ts +10 -0
  67. package/components/container/wizard/wizard-step/index.d.ts +2 -0
  68. package/components/data/card/card-actions/index.d.ts +2 -0
  69. package/components/data/card/card-content/index.d.ts +2 -0
  70. package/components/data/card/card-footer/index.d.ts +2 -0
  71. package/components/data/card/index.d.ts +2 -0
  72. package/components/data/card/index.js +12 -6
  73. package/components/data/form/base-form/hooks/useFormOperations.d.ts +1 -1
  74. package/components/data/form/base-form/hooks/useFormOperations.js +3 -3
  75. package/components/data/form/base-form/index.js +33 -26
  76. package/components/data/form/base-form/props.d.ts +1 -1
  77. package/components/data/form/dynamic-fields/index.js +3 -0
  78. package/components/data/form/form-action/index.d.ts +4 -0
  79. package/components/data/form/form-controller/hooks/index.js +2 -1
  80. package/components/data/form/form-controller/withFormController.js +14 -23
  81. package/components/data/form/form-field/base-field.js +0 -5
  82. package/components/data/form/form-field/index.js +99 -13
  83. package/components/data/form/form-field/props.d.ts +8 -0
  84. package/components/data/form/index.js +13 -0
  85. package/components/data/list/index.d.ts +7 -0
  86. package/components/data/list/index.js +18 -0
  87. package/components/data/list/props.d.ts +7 -0
  88. package/components/data/pagination/hooks/usePagination.js +0 -1
  89. package/components/data/table/components/RowCells.js +4 -1
  90. package/components/data/table/hooks/useDynamicColumns.js +3 -1
  91. package/components/data/table/hooks/useResponsiveColumns.d.ts +2 -0
  92. package/components/data/table/index.d.ts +8 -0
  93. package/components/data/table/index.js +20 -2
  94. package/components/data/table/live-table/index.d.ts +2 -0
  95. package/components/data/table/props.d.ts +10 -0
  96. package/components/data/table/table-action/index.d.ts +2 -0
  97. package/components/data/table/table-column/index.d.ts +2 -0
  98. package/components/data/table/table-row/index.d.ts +2 -0
  99. package/components/data/table/table-row-action/index.d.ts +2 -0
  100. package/components/data/table/utils/columnBuilder.d.ts +1 -1
  101. package/components/data/table/utils/columnBuilder.js +7 -4
  102. package/components/data/table/utils/crud-handlers.js +10 -10
  103. package/components/data/table/utils/index.d.ts +11 -8
  104. package/components/data/table/utils/index.js +90 -12
  105. package/components/dialogs/alert-dialog/index.d.ts +4 -0
  106. package/components/dialogs/confirm-dialog/index.d.ts +4 -0
  107. package/components/dialogs/dialog/index.d.ts +4 -0
  108. package/components/dialogs/dialog-actions/index.d.ts +2 -0
  109. package/components/dialogs/dialog-body/index.d.ts +2 -0
  110. package/components/dialogs/dialog-content/index.d.ts +2 -0
  111. package/components/dialogs/dialog-header/index.d.ts +2 -0
  112. package/components/dialogs/iframe-dialog/index.d.ts +4 -0
  113. package/components/dialogs/login-dialog/index.d.ts +4 -0
  114. package/components/dialogs/page-dialog/index.d.ts +4 -0
  115. package/components/form/button/index.d.ts +2 -0
  116. package/components/form/button/index.js +10 -1
  117. package/components/form/button-group/index.d.ts +2 -0
  118. package/components/input/calendar/index.d.ts +4 -0
  119. package/components/input/calendar/index.js +2 -1
  120. package/components/input/chips/index.d.ts +4 -0
  121. package/components/input/color-picker/index.d.ts +4 -0
  122. package/components/input/color-picker/index.js +18 -7
  123. package/components/input/composite/index.d.ts +2 -0
  124. package/components/input/currency/index.d.ts +4 -0
  125. package/components/input/default/checkbox/index.d.ts +4 -0
  126. package/components/input/default/checkboxset/index.d.ts +4 -0
  127. package/components/input/default/checkboxset/index.js +7 -5
  128. package/components/input/default/radioset/index.d.ts +4 -0
  129. package/components/input/default/radioset/index.js +2 -1
  130. package/components/input/default/switch/index.d.ts +4 -0
  131. package/components/input/default/switch/index.js +17 -13
  132. package/components/input/epoch/date/index.d.ts +2 -0
  133. package/components/input/epoch/date/index.js +30 -14
  134. package/components/input/epoch/datetime/index.d.ts +2 -0
  135. package/components/input/epoch/datetime/index.js +12 -8
  136. package/components/input/epoch/time/index.d.ts +2 -0
  137. package/components/input/epoch/time/index.js +21 -15
  138. package/components/input/fileupload/index.d.ts +2 -0
  139. package/components/input/number/index.d.ts +4 -0
  140. package/components/input/number/index.js +4 -3
  141. package/components/input/rating/index.d.ts +4 -0
  142. package/components/input/select/index.d.ts +4 -0
  143. package/components/input/slider/index.d.ts +4 -0
  144. package/components/input/slider/index.js +4 -2
  145. package/components/input/text/index.d.ts +4 -0
  146. package/components/input/text/index.js +16 -8
  147. package/components/input/textarea/index.d.ts +4 -0
  148. package/components/input/upload/index.d.ts +4 -0
  149. package/components/input/upload/index.js +6 -4
  150. package/components/layout/leftnav/index.js +21 -2
  151. package/components/layout/leftnav/props.d.ts +9 -0
  152. package/components/layout/leftnav/utils/page-class-util.d.ts +9 -0
  153. package/components/layout/leftnav/utils/page-class-util.js +28 -0
  154. package/components/navbar/index.d.ts +2 -0
  155. package/components/navbar/nav/index.d.ts +2 -0
  156. package/components/navbar/nav-item/index.d.ts +2 -0
  157. package/components/navigation/breadcrumb/index.d.ts +2 -0
  158. package/components/navigation/menu/index.d.ts +2 -0
  159. package/components/navigation/menu/index.js +2 -2
  160. package/components/navigation/popover/index.d.ts +2 -0
  161. package/components/navigation/popover/index.js +1 -0
  162. package/components/page/index.js +22 -6
  163. package/components/page/page-context.d.ts +4 -0
  164. package/components/page/page-context.js +5 -0
  165. package/components/page/partial/index.d.ts +2 -0
  166. package/components/page/partial-container/index.js +1 -4
  167. package/context/AppContext.d.ts +2 -0
  168. package/context/AppContext.js +20 -1
  169. package/context/WidgetProvider.js +0 -3
  170. package/core/proxy-service.d.ts +2 -0
  171. package/core/proxy-service.js +25 -0
  172. package/higherOrder/BaseApp.js +5 -6
  173. package/higherOrder/BaseAppProps.d.ts +1 -0
  174. package/higherOrder/BasePage.js +4 -12
  175. package/higherOrder/props.d.ts +10 -0
  176. package/higherOrder/withBaseWrapper.js +3 -0
  177. package/hooks/useAuth.js +3 -0
  178. package/hooks/useDataSourceSubscription.js +1 -1
  179. package/hooks/useHttp.js +0 -4
  180. package/hooks/useLayoutSize.d.ts +6 -0
  181. package/hooks/useLayoutSize.js +12 -0
  182. package/package-lock.json +229 -203
  183. package/package.json +3 -3
  184. package/runtime-dynamic/app-initializer.js +1 -1
  185. package/runtime-dynamic/components/use-dynamic-component.js +12 -31
  186. package/runtime-dynamic/factories/build-base-page-like-component.d.ts +1 -1
  187. package/runtime-dynamic/factories/dynamic-component.js +9 -1
  188. package/runtime-dynamic/factories/prefab-factory.d.ts +1 -1
  189. package/runtime-dynamic/factories/utils.d.ts +1 -1
  190. package/runtime-dynamic/main.js +1 -3
  191. package/runtime-dynamic/services/component-ref-provider.d.ts +19 -4
  192. package/runtime-dynamic/services/component-ref-provider.js +18 -38
  193. package/runtime-dynamic/services/index.d.ts +2 -3
  194. package/runtime-dynamic/services/index.js +1 -18
  195. package/runtime-dynamic/services/resource-manager.d.ts +2 -3
  196. package/runtime-dynamic/services/resource-manager.js +13 -17
  197. package/runtime-dynamic/services/script-executor.js +5 -8
  198. package/runtime-dynamic/services/variable-registry.js +3 -4
  199. package/utils/attr.js +1 -9
  200. package/utils/custom-expression/index.js +4 -1
  201. package/utils/custom-expression/parser.js +4 -2
  202. package/utils/format-util.js +2 -3
  203. package/utils/state-persistance.d.ts +1 -1
  204. package/runtime-dynamic/services/cache.d.ts +0 -29
  205. package/runtime-dynamic/services/cache.js +0 -51
  206. package/utils/form-state.util.d.ts +0 -62
  207. package/utils/form-state.util.js +0 -109
@@ -18,42 +18,129 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  import { Fragment, jsx } from "react/jsx-runtime";
21
- import { memo, useEffect } from "react";
21
+ import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
22
22
  import clsx from "clsx";
23
23
  import isEqual from "lodash-es/isEqual";
24
24
  import get from "lodash-es/get";
25
- import withBaseWrapper from "../../../../higherOrder/withBaseWrapper";
26
25
  import BaseField from "./base-field";
27
26
  import { WmComposite } from "../../../input/composite";
27
+ import { useWidgetProxy } from "../../../../context/WidgetProvider";
28
+ import { createFormFieldProxy } from "../../../../core/proxy-service";
28
29
  const DEFAULT_CLASS = "ng-pristine ng-invalid ng-touched";
29
30
  const DEFAULT_COMPOSITE_CLASS = "app-composite-widget caption-left clearfix form-group live-field";
31
+ const DATASET_SYNC_KEYS = [
32
+ "dataset",
33
+ "datafield",
34
+ "displayfield",
35
+ "displaylabel",
36
+ "searchkey"
37
+ ];
30
38
  const WmFormField = memo(
31
39
  (props) => {
32
- var _a;
40
+ var _a, _b;
41
+ const { show = true, deferload } = props;
42
+ const [proxyProps, setProxyProps] = useState(__spreadProps(__spreadValues({}, props), {
43
+ show: show == null ? void 0 : show.toString(),
44
+ deferload: deferload == null ? void 0 : deferload.toString(),
45
+ datavalue: props.defaultvalue
46
+ }));
47
+ const fieldProxyRef = useRef(null);
48
+ const formProxy = useWidgetProxy(`${props.formName}`);
49
+ const overriddenItemsRef = useRef({});
50
+ const fieldKey = props.formKey || props.name;
51
+ const defaultValueRegisteredRef = useRef(false);
52
+ const formReady = (formProxy == null ? void 0 : formProxy.listener) !== void 0;
53
+ const reset = useCallback(
54
+ (value) => {
55
+ const field = fieldProxyRef.current;
56
+ if (field.readonly || field.disabled) return;
57
+ fieldProxyRef.current.datavalue = value != null ? value : "";
58
+ fieldProxyRef.current.value = value != null ? value : "";
59
+ },
60
+ [fieldKey]
61
+ );
62
+ const isNumber = useMemo(
63
+ () => props.type === "integer" || props.type === "number",
64
+ [props.type]
65
+ );
66
+ const onChangeHandler = useCallback(
67
+ (name, data) => {
68
+ Object.keys(data).forEach((key) => {
69
+ fieldProxyRef.current[key] = key === "datavalue" && isNumber ? Number(data[key]) : data[key];
70
+ });
71
+ setProxyProps((prev) => {
72
+ return __spreadValues(__spreadValues({}, prev), isNumber ? __spreadProps(__spreadValues({}, data), { datavalue: Number(data.datavalue) }) : data);
73
+ });
74
+ },
75
+ [isNumber]
76
+ );
33
77
  useEffect(() => {
34
- if (props.name && props.destroy) {
35
- props.destroy([props.name]);
78
+ if (!fieldKey || !formReady) return;
79
+ if (!formProxy.formWidgets) {
80
+ formProxy.formWidgets = {};
81
+ formProxy.formfields = {};
36
82
  }
37
- }, []);
83
+ const mutableTarget = __spreadProps(__spreadValues({}, props), { reset, show, deferload });
84
+ const fieldProxy = createFormFieldProxy(
85
+ mutableTarget,
86
+ setProxyProps,
87
+ overriddenItemsRef,
88
+ formProxy
89
+ );
90
+ fieldProxyRef.current = fieldProxy;
91
+ }, [formReady]);
92
+ useEffect(() => {
93
+ if (!formReady || !fieldProxyRef.current) return;
94
+ if (defaultValueRegisteredRef.current) return;
95
+ defaultValueRegisteredRef.current = true;
96
+ fieldProxyRef.current.datavalue = props.defaultvalue;
97
+ fieldProxyRef.current.value = props.defaultvalue;
98
+ fieldProxyRef.current.defaultvalue = props.defaultvalue;
99
+ }, [props.defaultvalue]);
100
+ useEffect(() => {
101
+ var _a2;
102
+ const fieldProxy = fieldProxyRef.current;
103
+ if (!fieldProxy || !((_a2 = props.dataset) == null ? void 0 : _a2.length)) return;
104
+ DATASET_SYNC_KEYS.forEach((key) => {
105
+ const value = props[key];
106
+ if (value != null && fieldProxy[key] !== value) {
107
+ fieldProxy[key] = value;
108
+ }
109
+ });
110
+ }, [props.dataset, props.datafield, props.displayfield, props.displaylabel, props.searchkey]);
38
111
  function renderFormFields() {
39
- var _a2, _b, _c;
112
+ var _a2, _b2, _c;
40
113
  if (props.formRef) {
41
114
  const errors = (_a2 = props.formRef) == null ? void 0 : _a2.errors;
42
- const formKey = (_b = props.formKey) != null ? _b : props.name;
115
+ const formKey = (_b2 = props.formKey) != null ? _b2 : props.name;
43
116
  const fieldError = formKey && errors ? get(errors, formKey) : void 0;
44
117
  const invalid = Boolean(fieldError);
45
118
  const invalidCls = invalid ? " text-danger " : "";
46
- return /* @__PURE__ */ jsx(Fragment, { children: (_c = props == null ? void 0 : props.renderFormFields) == null ? void 0 : _c.call(props, __spreadProps(__spreadValues({}, props), {
119
+ return /* @__PURE__ */ jsx(Fragment, { children: (_c = props == null ? void 0 : props.renderFormFields) == null ? void 0 : _c.call(props, __spreadProps(__spreadValues(__spreadValues({}, proxyProps), overriddenItemsRef.current), {
47
120
  fieldError,
121
+ validators: props.validators,
122
+ asyncValidators: props.asyncValidators,
123
+ observe: props.observe,
48
124
  invalid,
49
- invalidCls
125
+ invalidCls,
126
+ iswidget: "false",
127
+ onChangeHandler
50
128
  })) });
51
129
  } else {
52
130
  return null;
53
131
  }
54
132
  }
55
133
  const itemsPerRow = ((_a = props == null ? void 0 : props.formRef) == null ? void 0 : _a.itemsPerRow) || "";
56
- if (props.hidden) {
134
+ if (!fieldProxyRef.current) {
135
+ return null;
136
+ }
137
+ const isDeferLoad = deferload === true;
138
+ const showValue = ((_b = proxyProps == null ? void 0 : proxyProps.show) == null ? void 0 : _b.toString()) !== "false";
139
+ if (!showValue && isDeferLoad) {
140
+ return null;
141
+ }
142
+ const shouldHide = !showValue && !isDeferLoad;
143
+ if (shouldHide) {
57
144
  return null;
58
145
  }
59
146
  return /* @__PURE__ */ jsx(
@@ -68,7 +155,6 @@ const WmFormField = memo(
68
155
  name: props.name,
69
156
  displayname: props.displayname,
70
157
  placeholder: props.placeholder,
71
- hidden: props.hidden,
72
158
  "data-role": props.role || "form-field",
73
159
  children: /* @__PURE__ */ jsx(
74
160
  WmComposite,
@@ -89,7 +175,7 @@ const WmFormField = memo(
89
175
  );
90
176
  WmFormField.displayName = "WmFormField";
91
177
  const WmFormFieldStandalone = BaseField(WmFormField);
92
- var form_field_default = BaseField(withBaseWrapper(WmFormField));
178
+ var form_field_default = BaseField(WmFormField);
93
179
  export {
94
180
  WmFormFieldStandalone as WmFormField,
95
181
  form_field_default as default
@@ -1,5 +1,6 @@
1
1
  import { BaseProps, Prettify } from "@wavemaker-ai/react-runtime/higherOrder/props";
2
2
  export interface FormFieldProps {
3
+ name: string;
3
4
  /**
4
5
  * Whether the field is read-only.
5
6
  */
@@ -197,6 +198,13 @@ export interface FormFieldProps {
197
198
  formName: string;
198
199
  parentForm?: string;
199
200
  destroy?: (names: string[]) => void;
201
+ asyncValidators?: any[];
202
+ setValidators?: (validators: any[]) => void;
203
+ setAsyncValidators?: (asyncValidators: any[]) => void;
204
+ observe?: any[];
205
+ observeOn?: any[];
206
+ reset?: () => void;
207
+ setValidationMessage?: (message: string) => void;
200
208
  }
201
209
  /**
202
210
  * Combined props for the WmFormField component, including base WaveMaker props.
@@ -25,8 +25,21 @@ import WmFormHeader from "./form-header";
25
25
  import FormDynamicFieldsSection from "./form-dynamic-section";
26
26
  import { removeInvalidAttributes } from "../../../utils/attr";
27
27
  import withStandalone from "../../../higherOrder/withStandalone";
28
+ import {
29
+ WmSkeleton,
30
+ SKELETON_REGISTRY,
31
+ shouldShowSkeleton
32
+ } from "../../common/wm-skeleton";
28
33
  const WmForm = (props) => {
29
34
  var _a, _b, _c, _d;
35
+ if (shouldShowSkeleton(props.loading, props.showSkeleton))
36
+ return /* @__PURE__ */ jsx(
37
+ WmSkeleton,
38
+ __spreadProps(__spreadValues({}, SKELETON_REGISTRY["WmForm"]), {
39
+ className: props.className,
40
+ styles: props.styles
41
+ })
42
+ );
30
43
  const shouldHideHeader = props.isLayoutDialog || props.isInsideWizard;
31
44
  const shouldInjectDynamicFields = Array.isArray(props.metadata) && props.metadata.length > 0;
32
45
  return /* @__PURE__ */ jsxs(
@@ -19,6 +19,7 @@ declare const WmListStandalone: React.ComponentType<{
19
19
  columnalign?: import("./props").IColumnAlignment;
20
20
  multiselect?: boolean;
21
21
  loadingdatamsg?: string;
22
+ skeletonRows?: number;
22
23
  loadingicon?: string;
23
24
  maxsize?: number;
24
25
  statehandler?: StorageType;
@@ -67,9 +68,12 @@ declare const WmListStandalone: React.ComponentType<{
67
68
  gap?: string;
68
69
  columngap?: string;
69
70
  standalone?: boolean;
71
+ layoutWidth?: string;
72
+ layoutHeight?: string;
70
73
  hidden?: boolean;
71
74
  prefabName?: string;
72
75
  key?: string;
76
+ loading?: boolean;
73
77
  name?: string;
74
78
  id?: string;
75
79
  children?: React.ReactNode;
@@ -110,6 +114,7 @@ declare const WmListStandalone: React.ComponentType<{
110
114
  outbound?: Record<string, any>;
111
115
  formfield?: boolean;
112
116
  updateon?: string;
117
+ showSkeleton?: boolean;
113
118
  } & import("@wavemaker-ai/react-runtime/higherOrder/withStandalone").WithStandaloneProps>;
114
119
  export { WmListStandalone as WmList };
115
120
  /**
@@ -171,5 +176,7 @@ declare const _default: React.ComponentType<{
171
176
  updateon?: string;
172
177
  dataset?: any;
173
178
  prefabName?: string;
179
+ loading?: boolean;
180
+ showSkeleton?: boolean;
174
181
  }>;
175
182
  export default _default;
@@ -34,6 +34,11 @@ import { useWidgetProxy } from "../../../context/WidgetProvider";
34
34
  import { InlineNavigation } from "../pagination/components";
35
35
  import { NoDataMessage, useDragAndDrop } from "./components";
36
36
  import { AppSpinner } from "../../common";
37
+ import {
38
+ WmSkeleton,
39
+ SKELETON_REGISTRY,
40
+ shouldShowSkeleton
41
+ } from "../../common/wm-skeleton";
37
42
  import {
38
43
  useListData,
39
44
  useListState,
@@ -68,6 +73,7 @@ import { DataSource } from "../types";
68
73
  import isEqual from "lodash-es/isEqual";
69
74
  import { filterAutoLayoutClasses } from "../../../utils/style-utils";
70
75
  import withStandalone from "../../../higherOrder/withStandalone";
76
+ import { useLayoutSize } from "../../../hooks/useLayoutSize";
71
77
  const WmList = (props) => {
72
78
  var _a, _b, _c, _d, _e;
73
79
  const {
@@ -155,6 +161,7 @@ const WmList = (props) => {
155
161
  } = props;
156
162
  const datasetHashRef = useRef([]);
157
163
  const [currentDataset, setCurrentDataset] = useState(null);
164
+ const ListWrapperRef = useRef(null);
158
165
  const Widgets = useWidgetProxy(void 0, standalone);
159
166
  const widgetInstance = Widgets[name];
160
167
  const effectiveStateHandlerForSubscription = navigation === LIST_NAVIGATION_TYPES.ON_DEMAND || navigation === LIST_NAVIGATION_TYPES.SCROLL ? "none" : statehandler;
@@ -458,6 +465,7 @@ const WmList = (props) => {
458
465
  }
459
466
  })();
460
467
  }, [datasource]);
468
+ useLayoutSize(ListWrapperRef, props.layoutWidth, props.layoutHeight);
461
469
  const showHorizontalScrollSentinel = showNavigation && navigation === LIST_NAVIGATION_TYPES.SCROLL && (direction === LIST_DIRECTION.HORIZONTAL || direction === "row");
462
470
  const hostAutoLayoutPrefixes = ["pos-", ...INSETION_POSITION, "zi-", "w-", "h-"];
463
471
  const wrapper_autoLayout_Classes = useMemo(
@@ -482,6 +490,15 @@ const WmList = (props) => {
482
490
  }),
483
491
  [direction, wrap, alignment, gap, columngap]
484
492
  );
493
+ if (shouldShowSkeleton(props.loading, props.showSkeleton))
494
+ return /* @__PURE__ */ jsx(
495
+ WmSkeleton,
496
+ __spreadProps(__spreadValues({}, SKELETON_REGISTRY["WmList"]), {
497
+ rows: props.skeletonRows,
498
+ className,
499
+ styles
500
+ })
501
+ );
485
502
  return /* @__PURE__ */ jsxs(
486
503
  Box,
487
504
  __spreadProps(__spreadValues({
@@ -496,6 +513,7 @@ const WmList = (props) => {
496
513
  "data-name": name
497
514
  }, { name }), {
498
515
  "data-navigation": navigation,
516
+ ref: ListWrapperRef,
499
517
  children: [
500
518
  /* @__PURE__ */ jsx(ListHeader, { title, subheading, iconclass }),
501
519
  /* @__PURE__ */ jsx(AppSpinner, { show: (_e = datasource == null ? void 0 : datasource.loading) != null ? _e : false, spinnermessages: [loadingdatamsg] }),
@@ -107,6 +107,11 @@ export interface ListProps<T = ListItemData> {
107
107
  * Message to display while loading data.
108
108
  */
109
109
  loadingdatamsg?: string;
110
+ /**
111
+ * Number of skeleton list items shown while loading.
112
+ * @default 5
113
+ */
114
+ skeletonRows?: number;
110
115
  /**
111
116
  * CSS class for the loading icon.
112
117
  */
@@ -285,6 +290,8 @@ export interface ListProps<T = ListItemData> {
285
290
  * Whether this is a standalone list.
286
291
  */
287
292
  standalone?: boolean;
293
+ layoutWidth?: string;
294
+ layoutHeight?: string;
288
295
  }
289
296
  /**
290
297
  * Props specific to the WmListItem component.
@@ -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
  }));
@@ -58,12 +58,15 @@ const RowCells = memo(
58
58
  const columnId = ((_b = cell == null ? void 0 : cell.column) == null ? void 0 : _b.id) || ((_c = cell == null ? void 0 : cell.column.columnDef) == null ? void 0 : _c.accessorKey) || "";
59
59
  const colClass = getColClass(colClassExpression, rowData, columnId);
60
60
  const customRender = customExpressionColumns == null ? void 0 : customExpressionColumns[columnId];
61
+ const hasCustomCellContent = !!customRender;
62
+ const cellValue = cell.getValue();
63
+ const cellTitle = hasCustomCellContent ? void 0 : cellValue != null && cellValue !== "" ? String(cellValue) : "";
61
64
  return /* @__PURE__ */ jsxs(Fragment2, { children: [
62
65
  hasExpansion && cellIndex === expansionInsertIndex && renderExpansionCell(rowId, rowData),
63
66
  /* @__PURE__ */ jsx(
64
67
  TableCell,
65
68
  {
66
- title: cell.getValue() ? String(cell.getValue()) : "",
69
+ title: cellTitle,
67
70
  role: "cell",
68
71
  tabIndex: 0,
69
72
  "data-col-id": cellIndex,
@@ -19,12 +19,14 @@ var __spreadValues = (a, b) => {
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  import React, { useMemo } from "react";
21
21
  import { generateColumnsFromData, isValidDataForColumns } from "../utils/dynamic-columns";
22
+ import { getChildComponentDisplayName } from "../utils";
22
23
  const hasTableColumnsInChildren = (children) => {
23
24
  let found = false;
24
25
  React.Children.forEach(children, (child) => {
25
26
  if (!(child == null ? void 0 : child.props)) return;
26
27
  const name = child.props.name || "";
27
- if (name.includes("wm_table_column") || name.includes("col_")) {
28
+ const displayName = getChildComponentDisplayName(child);
29
+ if (name.includes("wm_table_column") || name.includes("col_") || displayName.includes("WmTableColumn")) {
28
30
  found = true;
29
31
  } else if (name.includes("group")) {
30
32
  if (hasTableColumnsInChildren(child.props.children)) {
@@ -81,4 +81,6 @@ export declare const useResponsiveColumns: (columns: WmTableColumnProps[]) => {
81
81
  updateon?: string;
82
82
  dataset?: any;
83
83
  prefabName?: string;
84
+ loading?: boolean;
85
+ showSkeleton?: boolean;
84
86
  }[];
@@ -53,6 +53,8 @@ declare const WmTableStandalone: React.ComponentType<{
53
53
  errormessage?: string;
54
54
  nodatamessage?: string;
55
55
  loadingdatamsg?: string;
56
+ skeletonRows?: number;
57
+ skeletonColumns?: number;
56
58
  insertmessage?: string;
57
59
  updatemessage?: string;
58
60
  deletemessage?: string;
@@ -137,6 +139,8 @@ declare const WmTableStandalone: React.ComponentType<{
137
139
  formfield?: boolean;
138
140
  updateon?: string;
139
141
  prefabName?: string;
142
+ loading?: boolean;
143
+ showSkeleton?: boolean;
140
144
  } & import("@wavemaker-ai/react-runtime/higherOrder/withStandalone").WithStandaloneProps>;
141
145
  export { WmTableStandalone as WmTable };
142
146
  declare const WmTable: React.ComponentType<{
@@ -190,6 +194,8 @@ declare const WmTable: React.ComponentType<{
190
194
  errormessage?: string;
191
195
  nodatamessage?: string;
192
196
  loadingdatamsg?: string;
197
+ skeletonRows?: number;
198
+ skeletonColumns?: number;
193
199
  insertmessage?: string;
194
200
  updatemessage?: string;
195
201
  deletemessage?: string;
@@ -274,6 +280,8 @@ declare const WmTable: React.ComponentType<{
274
280
  formfield?: boolean;
275
281
  updateon?: string;
276
282
  prefabName?: string;
283
+ loading?: boolean;
284
+ showSkeleton?: boolean;
277
285
  }>;
278
286
  /**
279
287
  * The WmTable component is used to display data in a tabular format.
@@ -39,6 +39,11 @@ import React, {
39
39
  useState,
40
40
  useRef
41
41
  } from "react";
42
+ import {
43
+ WmSkeleton,
44
+ SKELETON_REGISTRY,
45
+ shouldShowSkeleton
46
+ } from "../../common/wm-skeleton";
42
47
  import {
43
48
  useReactTable,
44
49
  getCoreRowModel,
@@ -396,7 +401,7 @@ const WmTableComponent = memo(
396
401
  initialSortState: persisted.sort || void 0
397
402
  };
398
403
  }
399
- const initialPageSize2 = defaultPageSizeFromOptions !== void 0 ? defaultPageSizeFromOptions : actualPageSize || pagesize;
404
+ const initialPageSize2 = allowpagesizechange ? defaultPageSizeFromOptions != null ? defaultPageSizeFromOptions : actualPageSize : pagesize;
400
405
  return {
401
406
  initialPage: 1,
402
407
  initialPageSize: initialPageSize2,
@@ -1392,6 +1397,9 @@ const WmTableComponent = memo(
1392
1397
  useEffect(() => {
1393
1398
  updateSelectedItem();
1394
1399
  }, [activeRowIds, selectedRowIds, useRadioSelect, useMultiSelect, internalDataset, name]);
1400
+ const isTableLoading = useMemo(() => {
1401
+ return loading && navigation !== "On-Demand" && internalDataset.length === 0;
1402
+ }, [loading, navigation, internalDataset.length]);
1395
1403
  const colGroupSpec = useMemo(() => {
1396
1404
  const headerGroups = table.getHeaderGroups();
1397
1405
  const leafHeaderGroup = headerGroups.length ? headerGroups[headerGroups.length - 1] : void 0;
@@ -1454,7 +1462,7 @@ const WmTableComponent = memo(
1454
1462
  className: "app-grid-header-inner",
1455
1463
  style: __spreadValues({ height: "100%", overflow: "auto", position: "relative" }, styles),
1456
1464
  children: [
1457
- loading && navigation !== "On-Demand" && /* @__PURE__ */ jsx(LoadingComponent, { message: loadingdatamsg }),
1465
+ isTableLoading && /* @__PURE__ */ jsx(LoadingComponent, { message: loadingdatamsg }),
1458
1466
  /* @__PURE__ */ jsxs(
1459
1467
  Table,
1460
1468
  __spreadProps(__spreadValues({
@@ -1656,6 +1664,16 @@ const WmTableComponent = memo(
1656
1664
  );
1657
1665
  WmTableComponent.displayName = "WmTableComponent";
1658
1666
  const WmTableWithProvider = (props) => {
1667
+ if (shouldShowSkeleton(props.loading, props.showSkeleton))
1668
+ return /* @__PURE__ */ jsx(
1669
+ WmSkeleton,
1670
+ __spreadProps(__spreadValues({}, SKELETON_REGISTRY["WmTable"]), {
1671
+ rows: props.skeletonRows,
1672
+ columns: props.skeletonColumns,
1673
+ className: props.className,
1674
+ styles: props.styles
1675
+ })
1676
+ );
1659
1677
  return /* @__PURE__ */ jsx(EditedRowsProvider, { children: /* @__PURE__ */ jsx(WmTableComponent, __spreadValues({}, props)) });
1660
1678
  };
1661
1679
  WmTableWithProvider.displayName = "WmTable";
@@ -71,5 +71,7 @@ declare const _default: React.ComponentType<{
71
71
  updateon?: string;
72
72
  dataset?: any;
73
73
  prefabName?: string;
74
+ loading?: boolean;
75
+ showSkeleton?: boolean;
74
76
  }>;
75
77
  export default _default;
@@ -230,6 +230,16 @@ export interface TableProps {
230
230
  * Message to display while loading data.
231
231
  */
232
232
  loadingdatamsg?: string;
233
+ /**
234
+ * Number of skeleton body rows shown while loading.
235
+ * @default 5
236
+ */
237
+ skeletonRows?: number;
238
+ /**
239
+ * Number of skeleton columns shown while loading.
240
+ * @default 4
241
+ */
242
+ skeletonColumns?: number;
233
243
  /**
234
244
  * Message to display after successful record insertion.
235
245
  */
@@ -61,5 +61,7 @@ declare const _default: React.ComponentType<{
61
61
  updateon?: string;
62
62
  dataset?: any;
63
63
  prefabName?: string;
64
+ loading?: boolean;
65
+ showSkeleton?: boolean;
64
66
  }>;
65
67
  export default _default;
@@ -61,5 +61,7 @@ declare const _default: React.ComponentType<{
61
61
  updateon?: string;
62
62
  dataset?: any;
63
63
  prefabName?: string;
64
+ loading?: boolean;
65
+ showSkeleton?: boolean;
64
66
  }>;
65
67
  export default _default;
@@ -61,5 +61,7 @@ declare const _default: React.ComponentType<{
61
61
  updateon?: string;
62
62
  dataset?: any;
63
63
  prefabName?: string;
64
+ loading?: boolean;
65
+ showSkeleton?: boolean;
64
66
  }>;
65
67
  export default _default;
@@ -65,5 +65,7 @@ export declare const WmTableRowAction: React.FC<{
65
65
  updateon?: string;
66
66
  dataset?: any;
67
67
  prefabName?: string;
68
+ loading?: boolean;
69
+ showSkeleton?: boolean;
68
70
  }>;
69
71
  export default WmTableRowAction;
@@ -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, {