@wavemaker-ai/react-runtime 1.0.0-rc.324 → 1.0.0-rc.326
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/basic/anchor/index.js +3 -0
- package/components/container/index.js +6 -1
- package/components/container/layout-grid/grid-row/index.js +1 -1
- package/components/data/form/base-form/hooks/useFormSubmission.d.ts +1 -1
- package/components/data/form/base-form/hooks/useFormSubmission.js +3 -1
- package/components/data/form/base-form/index.js +11 -14
- package/components/data/form/base-form/props.d.ts +3 -0
- package/components/data/form/form-controller/withFormController.js +19 -2
- package/components/data/form/form-field/base-field.js +8 -5
- package/components/data/form/form-field/index.js +11 -7
- package/components/data/form/form-field/props.d.ts +1 -0
- package/components/data/list/components/ListItemWithTemplate.js +5 -2
- package/components/data/list/hooks/useListEffects.js +1 -1
- package/components/data/list/index.js +11 -3
- package/components/data/list/utils/constants.d.ts +0 -1
- package/components/data/list/utils/constants.js +0 -2
- package/components/data/table/components/RowCells.js +18 -4
- package/components/data/table/components/TableBody.js +5 -3
- package/components/data/table/components/TableHeader.js +9 -7
- package/components/data/table/components/TablePanelHeading.js +1 -1
- package/components/data/table/hooks/useDynamicColumns.js +1 -1
- package/components/data/table/hooks/useRowExpansion.js +41 -31
- package/components/data/table/hooks/useRowHandlers.js +0 -1
- package/components/data/table/hooks/useServerSideSorting.js +0 -1
- package/components/data/table/hooks/useTableColumns.js +16 -8
- package/components/data/table/hooks/useTableData.js +0 -1
- package/components/data/table/hooks/useTableEdit.js +0 -1
- package/components/data/table/index.js +47 -18
- package/components/data/table/live-table/index.js +0 -1
- package/components/data/table/props.d.ts +4 -0
- package/components/data/table/utils/buildSelectionColumns.js +0 -2
- package/components/data/table/utils/columnBuilder.d.ts +16 -2
- package/components/data/table/utils/columnBuilder.js +13 -8
- package/components/data/table/utils/columnWidthDistribution.js +10 -0
- package/components/data/table/utils/constants.d.ts +0 -4
- package/components/data/table/utils/constants.js +0 -7
- package/components/data/table/utils/dynamic-columns.d.ts +1 -1
- package/components/data/table/utils/dynamic-columns.js +3 -8
- package/components/data/table/utils/expansionColumn.d.ts +23 -0
- package/components/data/table/utils/expansionColumn.js +56 -0
- package/components/data/table/utils/index.d.ts +14 -2
- package/components/data/table/utils/index.js +45 -19
- package/components/dialogs/dialog/index.js +3 -2
- package/components/input/default/radioset/index.js +2 -1
- package/components/input/select/index.js +1 -2
- package/components/input/textarea/index.js +1 -1
- package/components/navigation/popover/index.js +15 -7
- package/components/page/index.js +1 -1
- package/components/page/page-content/index.js +6 -2
- package/components/page/partial-container/index.js +2 -1
- package/components/prefab/index.js +3 -2
- package/components/prefab/props.d.ts +1 -0
- package/context/WidgetProvider.js +2 -1
- package/core/proxy-service.d.ts +1 -0
- package/core/proxy-service.js +53 -2
- package/core/util/index.js +3 -1
- package/higherOrder/BasePage.js +25 -4
- package/higherOrder/withBaseWrapper.js +9 -7
- package/package-lock.json +127 -138
- package/package.json +3 -3
- package/runtime-dynamic/components/partial-content.js +3 -1
- package/runtime-dynamic/factories/dynamic-component.js +26 -3
- package/runtime-dynamic/services/css-scoping.d.ts +2 -0
- package/runtime-dynamic/services/css-scoping.js +39 -20
- package/utils/custom-expression/parser.js +11 -8
- package/utils/transformedDataset-utils.d.ts +3 -3
- package/utils/transformedDataset-utils.js +1 -2
|
@@ -48,6 +48,7 @@ const getCurrentPageName = (pathname) => {
|
|
|
48
48
|
const WmAnchor = (props) => {
|
|
49
49
|
var _b;
|
|
50
50
|
const _a = props, {
|
|
51
|
+
ref,
|
|
51
52
|
caption = "Link",
|
|
52
53
|
iconclass,
|
|
53
54
|
styles,
|
|
@@ -68,6 +69,7 @@ const WmAnchor = (props) => {
|
|
|
68
69
|
itemLink,
|
|
69
70
|
href: _ignoredHref
|
|
70
71
|
} = _a, restProps = __objRest(_a, [
|
|
72
|
+
"ref",
|
|
71
73
|
"caption",
|
|
72
74
|
"iconclass",
|
|
73
75
|
"styles",
|
|
@@ -211,6 +213,7 @@ const WmAnchor = (props) => {
|
|
|
211
213
|
"data-identifier": "anchor"
|
|
212
214
|
}), removeInvalidAttributes(restProps)), {
|
|
213
215
|
name: props.name,
|
|
216
|
+
ref,
|
|
214
217
|
children: [
|
|
215
218
|
/* @__PURE__ */ jsx(
|
|
216
219
|
WmAppIcon,
|
|
@@ -30,7 +30,12 @@ var __objRest = (source, exclude) => {
|
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
32
|
import { jsx } from "react/jsx-runtime";
|
|
33
|
-
import {
|
|
33
|
+
import {
|
|
34
|
+
useEffect,
|
|
35
|
+
useRef,
|
|
36
|
+
useMemo,
|
|
37
|
+
useCallback
|
|
38
|
+
} from "react";
|
|
34
39
|
import { clsx } from "clsx";
|
|
35
40
|
import { withBaseWrapper } from "../../higherOrder/withBaseWrapper";
|
|
36
41
|
import { useLayoutSize } from "../../hooks/useLayoutSize";
|
|
@@ -4,7 +4,7 @@ import { Container } from "@mui/material";
|
|
|
4
4
|
import { withBaseWrapper } from "../../../../higherOrder/withBaseWrapper";
|
|
5
5
|
const DEFAULT_CLASS = "app-grid-row clearfix";
|
|
6
6
|
const WmGridrow = (props) => {
|
|
7
|
-
return /* @__PURE__ */ jsx(Container, { style: props.styles, className: clsx(DEFAULT_CLASS, props.className), children: props.children });
|
|
7
|
+
return /* @__PURE__ */ jsx(Container, { style: props.styles, className: clsx(DEFAULT_CLASS, props.className), hidden: props.hidden, children: props.children });
|
|
8
8
|
};
|
|
9
9
|
WmGridrow.displayName = "WmGridrow";
|
|
10
10
|
var grid_row_default = withBaseWrapper(WmGridrow);
|
|
@@ -8,4 +8,4 @@ import { UseFormSubmissionOptions, UseFormSubmissionReturn } from "../props";
|
|
|
8
8
|
* - Success/error callbacks
|
|
9
9
|
* - Data output notification
|
|
10
10
|
*/
|
|
11
|
-
export declare function useFormSubmission({ formName, formfields, formDataref: externalFormDataref, getValues, formType, validateFieldsOnSubmit, resetFormData, toggleMessage, setShowViewMode, listener, datasource, formSubmit, widgettype, onBeforeSubmit, onSubmit, onResult, onSuccess, onError, insertmessage, updatemessage, deletemessage, postmessage, errormessage, messagelayout, standalone, }: UseFormSubmissionOptions): UseFormSubmissionReturn;
|
|
11
|
+
export declare function useFormSubmission({ formName, formfields, formDataref: externalFormDataref, getValues, formType, validateFieldsOnSubmit, resetFormData, toggleMessage, setShowViewMode, listener, datasource, formSubmit, widgettype, onBeforeSubmit, onSubmit, onResult, onSuccess, formSuccess, onError, insertmessage, updatemessage, deletemessage, postmessage, errormessage, messagelayout, standalone, }: UseFormSubmissionOptions): UseFormSubmissionReturn;
|
|
@@ -43,6 +43,7 @@ function useFormSubmission({
|
|
|
43
43
|
onSubmit,
|
|
44
44
|
onResult,
|
|
45
45
|
onSuccess,
|
|
46
|
+
formSuccess,
|
|
46
47
|
onError,
|
|
47
48
|
insertmessage,
|
|
48
49
|
updatemessage,
|
|
@@ -102,6 +103,7 @@ function useFormSubmission({
|
|
|
102
103
|
}
|
|
103
104
|
if (status) {
|
|
104
105
|
onSuccess == null ? void 0 : onSuccess(event, {}, data);
|
|
106
|
+
formSuccess == null ? void 0 : formSuccess(event, {}, data);
|
|
105
107
|
if (messagelayout === "Inline") {
|
|
106
108
|
toggleMessage(true, "Data saved successfully", "success");
|
|
107
109
|
}
|
|
@@ -113,7 +115,7 @@ function useFormSubmission({
|
|
|
113
115
|
}
|
|
114
116
|
}
|
|
115
117
|
},
|
|
116
|
-
[onResult, onSuccess, onError, messagelayout, errormessage, toggleMessage]
|
|
118
|
+
[onResult, onSuccess, formSuccess, onError, messagelayout, errormessage, toggleMessage]
|
|
117
119
|
);
|
|
118
120
|
const handleSubmitSuccess = useCallback(
|
|
119
121
|
(data, resolve) => {
|
|
@@ -159,17 +159,7 @@ const BaseForm = (WrappedComponent) => {
|
|
|
159
159
|
const formClassName = useMemo(() => {
|
|
160
160
|
return isInsideWizard ? clsx(className) : clsx(DEFAULT_CLASS, className);
|
|
161
161
|
}, [isInsideWizard, className]);
|
|
162
|
-
const
|
|
163
|
-
const newFields = [];
|
|
164
|
-
if (!formName) return newFields;
|
|
165
|
-
const Widgets = (formProxy == null ? void 0 : formProxy.formfields) || {};
|
|
166
|
-
Object.keys(Widgets).forEach((key) => {
|
|
167
|
-
if (!key.includes("formWidget") && Widgets[key]) {
|
|
168
|
-
newFields.push(Widgets[key]);
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
return newFields;
|
|
172
|
-
}, [formName]);
|
|
162
|
+
const onDataSourceChangeFiredRef = useRef(false);
|
|
173
163
|
const registerHeaderAction = useCallback((actionName, action) => {
|
|
174
164
|
if (!action || !actionName) return;
|
|
175
165
|
setHeaderActions((prev) => {
|
|
@@ -317,6 +307,7 @@ const BaseForm = (WrappedComponent) => {
|
|
|
317
307
|
onSubmit: props.onSubmit,
|
|
318
308
|
onResult: props.onResult,
|
|
319
309
|
onSuccess: props.onSuccess,
|
|
310
|
+
formSuccess: props.formSuccess,
|
|
320
311
|
onError: props.onError,
|
|
321
312
|
insertmessage: props.insertmessage,
|
|
322
313
|
updatemessage: props.updatemessage,
|
|
@@ -539,10 +530,15 @@ const BaseForm = (WrappedComponent) => {
|
|
|
539
530
|
debouncedFilter
|
|
540
531
|
]);
|
|
541
532
|
useEffect(() => {
|
|
542
|
-
if (props.onDataSourceChange
|
|
543
|
-
|
|
533
|
+
if (!props.onDataSourceChange || !formName) return;
|
|
534
|
+
if (onDataSourceChangeFiredRef.current) return;
|
|
535
|
+
const Widgets = (formProxy == null ? void 0 : formProxy.formfields) || {};
|
|
536
|
+
const currentFields = Object.keys(Widgets).filter((key) => !key.includes("formWidget") && Widgets[key]).map((key) => Widgets[key]);
|
|
537
|
+
if (currentFields.length > 0) {
|
|
538
|
+
onDataSourceChangeFiredRef.current = true;
|
|
539
|
+
props.onDataSourceChange(currentFields);
|
|
544
540
|
}
|
|
545
|
-
}, [
|
|
541
|
+
}, [props.onDataSourceChange, formName]);
|
|
546
542
|
useEffect(() => {
|
|
547
543
|
if (formRef.current) {
|
|
548
544
|
const formEl = formRef.current;
|
|
@@ -661,6 +657,7 @@ const BaseForm = (WrappedComponent) => {
|
|
|
661
657
|
return {
|
|
662
658
|
formdata: (_a2 = currentFormData != null ? currentFormData : widgetFormData) != null ? _a2 : formdata,
|
|
663
659
|
formName: formName || "",
|
|
660
|
+
isValid,
|
|
664
661
|
rootParentForm: isChildForm ? rootParentForm || "" : formName || "",
|
|
665
662
|
parentDataPath: isChildForm ? fullDataPath : void 0,
|
|
666
663
|
lastUpdateOrigin: isChildForm ? parentFormDataContext == null ? void 0 : parentFormDataContext.lastUpdateOrigin : lastUpdateOriginRef.current,
|
|
@@ -97,6 +97,8 @@ interface BaseFormProps extends BaseProps {
|
|
|
97
97
|
onSubmit: (event: React.FormEvent<HTMLFormElement>, widget: any, data: any) => void;
|
|
98
98
|
onError: (event: React.FormEvent<HTMLFormElement>, widget: any, error: any) => void;
|
|
99
99
|
onSuccess: (event: React.FormEvent<HTMLFormElement>, widget?: any, data?: any) => void;
|
|
100
|
+
/** @deprecated Use onSuccess instead. Fired with the same args as onSuccess for backward compatibility. */
|
|
101
|
+
formSuccess?: (event: React.FormEvent<HTMLFormElement>, widget?: any, data?: any) => void;
|
|
100
102
|
formSubmit: (event: React.FormEvent<HTMLFormElement>, widget: any, data: any, operation?: any) => void;
|
|
101
103
|
onChange: (event: React.FormEvent<HTMLFormElement>, widget: any, data: any) => void;
|
|
102
104
|
onBeforeSubmit: (event: React.FormEvent<HTMLFormElement>, widget: any, data: any) => boolean | string | object | Promise<boolean | string | object>;
|
|
@@ -280,6 +282,7 @@ export interface UseFormSubmissionOptions {
|
|
|
280
282
|
onSubmit?: Function;
|
|
281
283
|
onResult?: Function;
|
|
282
284
|
onSuccess?: Function;
|
|
285
|
+
formSuccess?: Function;
|
|
283
286
|
onError?: Function;
|
|
284
287
|
insertmessage?: string;
|
|
285
288
|
updatemessage?: string;
|
|
@@ -73,6 +73,7 @@ const withFormController = (WrappedComponent) => {
|
|
|
73
73
|
observe,
|
|
74
74
|
onBlur,
|
|
75
75
|
fieldName,
|
|
76
|
+
updateon,
|
|
76
77
|
standalone = false
|
|
77
78
|
} = _a, wrappedComponentProps = __objRest(_a, [
|
|
78
79
|
"formRef",
|
|
@@ -97,6 +98,7 @@ const withFormController = (WrappedComponent) => {
|
|
|
97
98
|
"observe",
|
|
98
99
|
"onBlur",
|
|
99
100
|
"fieldName",
|
|
101
|
+
"updateon",
|
|
100
102
|
"standalone"
|
|
101
103
|
]);
|
|
102
104
|
const [touched, setTouched] = useState(false);
|
|
@@ -193,10 +195,14 @@ const withFormController = (WrappedComponent) => {
|
|
|
193
195
|
if (isValid === false) {
|
|
194
196
|
return;
|
|
195
197
|
}
|
|
198
|
+
if (updateon === "keypress" && effectiveFormKey) {
|
|
199
|
+
setTouched(true);
|
|
200
|
+
trigger(effectiveFormKey);
|
|
201
|
+
}
|
|
196
202
|
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, e, componentProps, newValue, oldValue);
|
|
197
203
|
};
|
|
198
204
|
},
|
|
199
|
-
[type, props.datafield]
|
|
205
|
+
[type, props.datafield, updateon, effectiveFormKey]
|
|
200
206
|
);
|
|
201
207
|
const createOnBlurHandler = useCallback(
|
|
202
208
|
(field, fieldState) => {
|
|
@@ -275,7 +281,18 @@ const withFormController = (WrappedComponent) => {
|
|
|
275
281
|
})
|
|
276
282
|
}), {
|
|
277
283
|
listener: {
|
|
278
|
-
onChange: props.onChangeHandler,
|
|
284
|
+
onChange: isMaxWidget && props.onChangeHandler ? (name2, data) => {
|
|
285
|
+
const remapped = __spreadValues({}, data);
|
|
286
|
+
if ("datavalue" in remapped) {
|
|
287
|
+
remapped.maxDataValue = remapped.datavalue;
|
|
288
|
+
delete remapped.datavalue;
|
|
289
|
+
}
|
|
290
|
+
if ("displayValue" in remapped) {
|
|
291
|
+
remapped.maxDisplayValue = remapped.displayValue;
|
|
292
|
+
delete remapped.displayValue;
|
|
293
|
+
}
|
|
294
|
+
props.onChangeHandler(name2, remapped);
|
|
295
|
+
} : props.onChangeHandler,
|
|
279
296
|
Widgets: ((_a2 = props.listener) == null ? void 0 : _a2.Widgets) || {}
|
|
280
297
|
}
|
|
281
298
|
});
|
|
@@ -57,13 +57,15 @@ const BaseField = (WrappedComponent) => {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
function setFieldDataSet(dataset, options) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
const aliasDisplayField = options.aliasColumn || LIVE_CONSTANTS.LABEL_VALUE;
|
|
61
|
+
const newRelatedData = {
|
|
62
|
+
displaylabel: aliasDisplayField,
|
|
63
|
+
displayfield: aliasDisplayField,
|
|
63
64
|
datafield: options.aliasColumn || LIVE_CONSTANTS.LABEL_KEY,
|
|
64
65
|
searchkey: options.distinctField || LIVE_CONSTANTS.LABEL_KEY,
|
|
65
66
|
dataset
|
|
66
|
-
}
|
|
67
|
+
};
|
|
68
|
+
setRelatedData(newRelatedData);
|
|
67
69
|
}
|
|
68
70
|
const hasRequiredValidator = () => {
|
|
69
71
|
const checkRequiredValidator = (validator) => {
|
|
@@ -134,7 +136,8 @@ const BaseField = (WrappedComponent) => {
|
|
|
134
136
|
relatedData,
|
|
135
137
|
isRequired,
|
|
136
138
|
transformedFormKey,
|
|
137
|
-
customValidationMsg
|
|
139
|
+
customValidationMsg,
|
|
140
|
+
formContext
|
|
138
141
|
]);
|
|
139
142
|
return /* @__PURE__ */ createElement(
|
|
140
143
|
WrappedComponent,
|
|
@@ -37,7 +37,7 @@ const DATASET_SYNC_KEYS = [
|
|
|
37
37
|
];
|
|
38
38
|
const WmFormField = memo(
|
|
39
39
|
(props) => {
|
|
40
|
-
var _a, _b;
|
|
40
|
+
var _a, _b, _c, _d;
|
|
41
41
|
const { show = true, deferload } = props;
|
|
42
42
|
const [proxyProps, setProxyProps] = useState(__spreadProps(__spreadValues({}, props), {
|
|
43
43
|
show: show == null ? void 0 : show.toString(),
|
|
@@ -49,6 +49,7 @@ const WmFormField = memo(
|
|
|
49
49
|
const overriddenItemsRef = useRef({});
|
|
50
50
|
const fieldKey = props.formKey || props.name;
|
|
51
51
|
const defaultValueRegisteredRef = useRef(false);
|
|
52
|
+
const showfield = (_b = (_a = overriddenItemsRef == null ? void 0 : overriddenItemsRef.current) == null ? void 0 : _a.show) != null ? _b : show;
|
|
52
53
|
const formReady = (formProxy == null ? void 0 : formProxy.listener) !== void 0;
|
|
53
54
|
const reset = useCallback(
|
|
54
55
|
(value) => {
|
|
@@ -69,7 +70,7 @@ const WmFormField = memo(
|
|
|
69
70
|
fieldProxyRef.current[key] = key === "datavalue" && isNumber && !Array.isArray(data[key]) ? Number(data[key]) : data[key];
|
|
70
71
|
});
|
|
71
72
|
setProxyProps((prev) => {
|
|
72
|
-
return __spreadValues(__spreadValues({}, prev), isNumber && !Array.isArray(data.datavalue) ? __spreadProps(__spreadValues({}, data), { datavalue: Number(data.datavalue) }) : data);
|
|
73
|
+
return __spreadValues(__spreadValues({}, prev), isNumber && data.datavalue !== void 0 && !Array.isArray(data.datavalue) ? __spreadProps(__spreadValues({}, data), { datavalue: Number(data.datavalue) }) : data);
|
|
73
74
|
});
|
|
74
75
|
},
|
|
75
76
|
[isNumber]
|
|
@@ -109,14 +110,17 @@ const WmFormField = memo(
|
|
|
109
110
|
});
|
|
110
111
|
}, [props.dataset, props.datafield, props.displayfield, props.displaylabel, props.searchkey]);
|
|
111
112
|
function renderFormFields() {
|
|
112
|
-
var _a2, _b2,
|
|
113
|
+
var _a2, _b2, _c2, _d2, _e, _f, _g;
|
|
113
114
|
if (props.formRef) {
|
|
114
115
|
const errors = (_a2 = props.formRef) == null ? void 0 : _a2.errors;
|
|
115
116
|
const formKey = (_b2 = props.formKey) != null ? _b2 : props.name;
|
|
116
117
|
const fieldError = formKey && errors ? get(errors, formKey) : void 0;
|
|
117
118
|
const invalid = Boolean(fieldError);
|
|
118
119
|
const invalidCls = invalid ? " text-danger " : "";
|
|
119
|
-
return /* @__PURE__ */ jsx(Fragment, { children: (
|
|
120
|
+
return /* @__PURE__ */ jsx(Fragment, { children: (_g = props == null ? void 0 : props.renderFormFields) == null ? void 0 : _g.call(props, __spreadProps(__spreadValues(__spreadValues({}, proxyProps), overriddenItemsRef.current), {
|
|
121
|
+
show: showfield,
|
|
122
|
+
disabled: (_d2 = (_c2 = overriddenItemsRef == null ? void 0 : overriddenItemsRef.current) == null ? void 0 : _c2.disabled) != null ? _d2 : props == null ? void 0 : props.disabled,
|
|
123
|
+
readonly: (_f = (_e = overriddenItemsRef == null ? void 0 : overriddenItemsRef.current) == null ? void 0 : _e.readonly) != null ? _f : props == null ? void 0 : props.readonly,
|
|
120
124
|
fieldError,
|
|
121
125
|
validators: props.validators,
|
|
122
126
|
asyncValidators: props.asyncValidators,
|
|
@@ -131,13 +135,13 @@ const WmFormField = memo(
|
|
|
131
135
|
}
|
|
132
136
|
}
|
|
133
137
|
const isDynamicFormField = typeof props.className === "string" && props.className.includes("app-dynamic-form-field");
|
|
134
|
-
const itemsPerRowClass = !isDynamicFormField && ((
|
|
138
|
+
const itemsPerRowClass = !isDynamicFormField && ((_c = props.formRef) == null ? void 0 : _c.itemsPerRow) || "";
|
|
135
139
|
if (!fieldProxyRef.current) {
|
|
136
140
|
return null;
|
|
137
141
|
}
|
|
138
142
|
const isDeferLoad = deferload === true;
|
|
139
|
-
const showValue = ((
|
|
140
|
-
if (!showValue && isDeferLoad) {
|
|
143
|
+
const showValue = ((_d = proxyProps == null ? void 0 : proxyProps.show) == null ? void 0 : _d.toString()) !== "false";
|
|
144
|
+
if ((!showValue || showfield) && isDeferLoad) {
|
|
141
145
|
return null;
|
|
142
146
|
}
|
|
143
147
|
const shouldHide = !showValue && !isDeferLoad;
|
|
@@ -205,6 +205,7 @@ export interface FormFieldProps {
|
|
|
205
205
|
observeOn?: any[];
|
|
206
206
|
reset?: () => void;
|
|
207
207
|
setValidationMessage?: (message: string) => void;
|
|
208
|
+
disabled?: boolean;
|
|
208
209
|
}
|
|
209
210
|
/**
|
|
210
211
|
* Combined props for the WmFormField component, including base WaveMaker props.
|
|
@@ -6,6 +6,7 @@ import { MediaWmListtemplate } from "../templates/media-template";
|
|
|
6
6
|
import { resolveDisableItem } from "../utils/list-helpers";
|
|
7
7
|
import { useWidgetProxy } from "../../../../context/WidgetProvider";
|
|
8
8
|
import isPlainObject from "lodash-es/isPlainObject";
|
|
9
|
+
import isEmpty from "lodash-es/isEmpty";
|
|
9
10
|
const ListItemWithTemplate = ({
|
|
10
11
|
item,
|
|
11
12
|
index,
|
|
@@ -38,7 +39,7 @@ const ListItemWithTemplate = ({
|
|
|
38
39
|
const getCurrentItemWidgets = useCallback(
|
|
39
40
|
($index) => {
|
|
40
41
|
const cached = widgetCacheRef.current.get($index);
|
|
41
|
-
if (cached) {
|
|
42
|
+
if (cached && !isEmpty(cached)) {
|
|
42
43
|
return cached;
|
|
43
44
|
}
|
|
44
45
|
const items = {};
|
|
@@ -52,7 +53,9 @@ const ListItemWithTemplate = ({
|
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
|
-
|
|
56
|
+
if (!isEmpty(items)) {
|
|
57
|
+
widgetCacheRef.current.set($index, items);
|
|
58
|
+
}
|
|
56
59
|
return items;
|
|
57
60
|
},
|
|
58
61
|
[WidgetProxy, name]
|
|
@@ -112,7 +112,7 @@ const useListEffects = (props) => {
|
|
|
112
112
|
selectPageSize: (size) => widgetMethodsRef.current.selectPageSize(size)
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
|
-
}, [name, showNavigation, items]);
|
|
115
|
+
}, [name, showNavigation, items == null ? void 0 : items.length]);
|
|
116
116
|
useEffect(() => {
|
|
117
117
|
if ((listener == null ? void 0 : listener.onChange) && props.navigation !== LIST_NAVIGATION_TYPES.NONE) {
|
|
118
118
|
listener.onChange(name, {
|
|
@@ -56,8 +56,7 @@ import {
|
|
|
56
56
|
LIST_DEFAULTS,
|
|
57
57
|
LIST_MESSAGES,
|
|
58
58
|
LIST_ALIGN,
|
|
59
|
-
LIST_DIRECTION
|
|
60
|
-
INSETION_POSITION
|
|
59
|
+
LIST_DIRECTION
|
|
61
60
|
} from "./utils/constants";
|
|
62
61
|
import {
|
|
63
62
|
getItemsPerRowClass,
|
|
@@ -469,7 +468,16 @@ const WmList = (props) => {
|
|
|
469
468
|
}, [datasource]);
|
|
470
469
|
useLayoutSize(ListWrapperRef, props.layoutWidth, props.layoutHeight);
|
|
471
470
|
const showHorizontalScrollSentinel = showNavigation && navigation === LIST_NAVIGATION_TYPES.SCROLL && (direction === LIST_DIRECTION.HORIZONTAL || direction === "row");
|
|
472
|
-
const hostAutoLayoutPrefixes = [
|
|
471
|
+
const hostAutoLayoutPrefixes = [
|
|
472
|
+
"wm-pos-",
|
|
473
|
+
"wm-top",
|
|
474
|
+
"wm-bottom",
|
|
475
|
+
"wm-left",
|
|
476
|
+
"wm-right",
|
|
477
|
+
"wm-zi-",
|
|
478
|
+
"wm-w-",
|
|
479
|
+
"wm-h-"
|
|
480
|
+
];
|
|
473
481
|
const wrapper_autoLayout_Classes = useMemo(
|
|
474
482
|
() => filterAutoLayoutClasses(layoutClassName, hostAutoLayoutPrefixes),
|
|
475
483
|
[layoutClassName]
|
|
@@ -56,12 +56,10 @@ const DEFAULT_PAGINATION_META = {
|
|
|
56
56
|
number: 0,
|
|
57
57
|
empty: true
|
|
58
58
|
};
|
|
59
|
-
const INSETION_POSITION = ["top", "bottom", "left", "right"];
|
|
60
59
|
export {
|
|
61
60
|
APP_LOCALE,
|
|
62
61
|
DEFAULT_CLS,
|
|
63
62
|
DEFAULT_PAGINATION_META,
|
|
64
|
-
INSETION_POSITION,
|
|
65
63
|
LIST_ALIGN,
|
|
66
64
|
LIST_DEFAULTS,
|
|
67
65
|
LIST_DIRECTION,
|
|
@@ -33,7 +33,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
33
33
|
import { memo, Fragment as Fragment2 } from "react";
|
|
34
34
|
import { TableCell } from "@mui/material";
|
|
35
35
|
import { flexRender } from "@tanstack/react-table";
|
|
36
|
-
import { getColClass, TABLE_CSS_CLASSES } from "../utils";
|
|
36
|
+
import { getColClass, TABLE_CSS_CLASSES, getDomHiddenCellStyle } from "../utils";
|
|
37
37
|
const CustomExpressionRenderBody = memo(
|
|
38
38
|
function CustomExpressionRenderBody2({ rowData, render }) {
|
|
39
39
|
return /* @__PURE__ */ jsx(Fragment, { children: render(rowData) });
|
|
@@ -71,14 +71,28 @@ const RowCells = memo(
|
|
|
71
71
|
tabIndex: 0,
|
|
72
72
|
"data-col-id": cellIndex,
|
|
73
73
|
className: `${TABLE_CSS_CLASSES.tableCell} ${colClass || ""} ${((_e = cell.column.columnDef.meta) == null ? void 0 : _e.className) || ""}`.trim(),
|
|
74
|
-
style: __spreadProps(__spreadValues({
|
|
74
|
+
style: __spreadProps(__spreadValues(__spreadValues({
|
|
75
75
|
width: cell.column.getSize(),
|
|
76
76
|
textAlign: (_f = cell.column.columnDef.meta) == null ? void 0 : _f.textAlign,
|
|
77
77
|
backgroundColor: (_g = cell.column.columnDef.meta) == null ? void 0 : _g.backgroundColor
|
|
78
78
|
}, (() => {
|
|
79
|
-
const _a2 = cell.column.columnDef.meta || {}, {
|
|
79
|
+
const _a2 = cell.column.columnDef.meta || {}, {
|
|
80
|
+
className,
|
|
81
|
+
textAlign,
|
|
82
|
+
backgroundColor,
|
|
83
|
+
_cell,
|
|
84
|
+
_actions,
|
|
85
|
+
domHidden
|
|
86
|
+
} = _a2, otherMeta = __objRest(_a2, [
|
|
87
|
+
"className",
|
|
88
|
+
"textAlign",
|
|
89
|
+
"backgroundColor",
|
|
90
|
+
"_cell",
|
|
91
|
+
"_actions",
|
|
92
|
+
"domHidden"
|
|
93
|
+
]);
|
|
80
94
|
return otherMeta;
|
|
81
|
-
})()), {
|
|
95
|
+
})()), getDomHiddenCellStyle(cell.column.columnDef.meta)), {
|
|
82
96
|
fontSize: "inherit",
|
|
83
97
|
color: "inherit"
|
|
84
98
|
}),
|
|
@@ -29,7 +29,7 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
30
30
|
import { memo, useMemo, useCallback } from "react";
|
|
31
31
|
import { TableBody, TableRow, TableCell, Box } from "@mui/material";
|
|
32
|
-
import { TABLE_CSS_CLASSES, TABLE_MESSAGES } from "../utils";
|
|
32
|
+
import { TABLE_CSS_CLASSES, TABLE_MESSAGES, getRowExpansionConfig } from "../utils";
|
|
33
33
|
import { RowExpansionButton } from "./RowExpansionButton";
|
|
34
34
|
import isEqual from "lodash-es/isEqual";
|
|
35
35
|
import { TableDataRow } from "./TableDataRow";
|
|
@@ -180,7 +180,7 @@ const TableBodyComponentBase = ({
|
|
|
180
180
|
customColumnsRevision = 0,
|
|
181
181
|
columnsVersion = 0
|
|
182
182
|
}) => {
|
|
183
|
-
const hasExpansion =
|
|
183
|
+
const hasExpansion = rowExpansionConfig ? true : false;
|
|
184
184
|
const expansionInsertIndex = useExpansionPosition(
|
|
185
185
|
hasExpansion,
|
|
186
186
|
rowExpansionConfig || null,
|
|
@@ -190,6 +190,8 @@ const TableBodyComponentBase = ({
|
|
|
190
190
|
const renderExpansionCell = useCallback(
|
|
191
191
|
(rowId, rowData) => {
|
|
192
192
|
if (!hasExpansion || !rowExpansionConfig) return null;
|
|
193
|
+
const rowConfig = getRowExpansionConfig(rowExpansionConfig, rowId, rowData);
|
|
194
|
+
if (!rowConfig) return null;
|
|
193
195
|
return /* @__PURE__ */ jsx(
|
|
194
196
|
ExpansionCell,
|
|
195
197
|
{
|
|
@@ -197,7 +199,7 @@ const TableBodyComponentBase = ({
|
|
|
197
199
|
rowData,
|
|
198
200
|
isExpanded: isRowExpanded(rowId),
|
|
199
201
|
onToggle: toggleRowExpansion,
|
|
200
|
-
config:
|
|
202
|
+
config: rowConfig
|
|
201
203
|
},
|
|
202
204
|
`expansion-${rowId}`
|
|
203
205
|
);
|
|
@@ -33,7 +33,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
33
33
|
import React, { memo, useMemo } from "react";
|
|
34
34
|
import { TableHead, TableRow, TableCell, Box } from "@mui/material";
|
|
35
35
|
import { flexRender } from "@tanstack/react-table";
|
|
36
|
-
import { TABLE_CSS_CLASSES } from "../utils";
|
|
36
|
+
import { TABLE_CSS_CLASSES, getDomHiddenCellStyle } from "../utils";
|
|
37
37
|
import { TableFilterRow } from "./TableFilters";
|
|
38
38
|
import { calculateMaxDepth, generateHeaderRows, hasTableGroups } from "../utils/groupHeaderUtils";
|
|
39
39
|
const StandardHeaderCell = memo(
|
|
@@ -57,18 +57,19 @@ const StandardHeaderCell = memo(
|
|
|
57
57
|
"title",
|
|
58
58
|
"onClick"
|
|
59
59
|
]);
|
|
60
|
-
var _a2, _b2;
|
|
60
|
+
var _a2, _b2, _c;
|
|
61
61
|
const canSort = enablesort && header.column.getCanSort();
|
|
62
62
|
const isSorted = header.column.getIsSorted();
|
|
63
63
|
const metaClassName = ((_b2 = (_a2 = header.column.columnDef) == null ? void 0 : _a2.meta) == null ? void 0 : _b2.className) || "";
|
|
64
64
|
const resizableClass = header.column.getCanResize() ? " ui-resizable" : "";
|
|
65
65
|
const mergedClassName = `${TABLE_CSS_CLASSES.headerCell} ${metaClassName} ${className || ""} ${resizableClass}`.trim();
|
|
66
|
-
const
|
|
66
|
+
const headerMeta = (_c = header.column.columnDef) == null ? void 0 : _c.meta;
|
|
67
|
+
const mergedStyle = __spreadValues(__spreadValues({
|
|
67
68
|
cursor: canSort ? "pointer" : "default",
|
|
68
69
|
userSelect: "none",
|
|
69
70
|
width: header.getSize(),
|
|
70
71
|
position: "relative"
|
|
71
|
-
}, style);
|
|
72
|
+
}, getDomHiddenCellStyle(headerMeta)), style);
|
|
72
73
|
const headerTitle = header.column.columnDef.header && typeof header.column.columnDef.header !== "function" ? header.column.columnDef.header.toString() : "";
|
|
73
74
|
return /* @__PURE__ */ jsx(
|
|
74
75
|
TableCell,
|
|
@@ -172,7 +173,7 @@ const TableHeaderComponent = memo(
|
|
|
172
173
|
onHeaderclick,
|
|
173
174
|
tableName
|
|
174
175
|
}) => {
|
|
175
|
-
const hasExpansion = rowExpansionConfig
|
|
176
|
+
const hasExpansion = rowExpansionConfig ? true : false;
|
|
176
177
|
const hasGroups = useMemo(() => {
|
|
177
178
|
return tableStructure && hasTableGroups(tableStructure);
|
|
178
179
|
}, [tableStructure]);
|
|
@@ -378,12 +379,13 @@ const TableHeaderComponent = memo(
|
|
|
378
379
|
};
|
|
379
380
|
const isClickable = enablecolumnselection && !isSystemColumn || enablesort && header.column.getCanSort();
|
|
380
381
|
const headerCellResizableClass = header.column.getCanResize() ? " ui-resizable" : "";
|
|
382
|
+
const headerMeta = header.column.columnDef.meta;
|
|
381
383
|
cells.push(
|
|
382
384
|
/* @__PURE__ */ jsxs(
|
|
383
385
|
TableCell,
|
|
384
386
|
{
|
|
385
387
|
className: `${TABLE_CSS_CLASSES.headerCell} ${((_b = (_a = header.column.columnDef) == null ? void 0 : _a.meta) == null ? void 0 : _b.className) || ""} ${headerCellResizableClass}`.trim(),
|
|
386
|
-
style: {
|
|
388
|
+
style: __spreadValues({
|
|
387
389
|
cursor: isClickable ? "pointer" : "default",
|
|
388
390
|
userSelect: "none",
|
|
389
391
|
width: header.getSize(),
|
|
@@ -392,7 +394,7 @@ const TableHeaderComponent = memo(
|
|
|
392
394
|
color: "inherit",
|
|
393
395
|
fontWeight: "bold",
|
|
394
396
|
lineHeight: "inherit"
|
|
395
|
-
},
|
|
397
|
+
}, getDomHiddenCellStyle(headerMeta)),
|
|
396
398
|
title: header.column.columnDef.header && typeof header.column.columnDef.header !== "function" ? header.column.columnDef.header.toString() : "",
|
|
397
399
|
onClick: handleHeaderClick,
|
|
398
400
|
role: "columnheader",
|
|
@@ -121,7 +121,7 @@ const TablePanelHeadingComponent = ({
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
},
|
|
124
|
-
[datasource, columns, sortInfo, filterInfo, exportdatasize, onBeforeExport
|
|
124
|
+
[datasource, columns, sortInfo, filterInfo, exportdatasize, onBeforeExport]
|
|
125
125
|
);
|
|
126
126
|
return /* @__PURE__ */ jsx(Box, { className: "panel-heading", children: /* @__PURE__ */ jsxs(Box, { component: "h3", className: "panel-title", children: [
|
|
127
127
|
/* @__PURE__ */ jsx(Box, { className: "pull-left", children: /* @__PURE__ */ jsx(
|
|
@@ -64,7 +64,7 @@ const useDynamicColumns = ({
|
|
|
64
64
|
dynamicColumns: columnsWithListener,
|
|
65
65
|
isDynamicTable: true
|
|
66
66
|
};
|
|
67
|
-
}, [dataset, children
|
|
67
|
+
}, [dataset, children]);
|
|
68
68
|
return { dynamicColumns, isDynamicTable };
|
|
69
69
|
};
|
|
70
70
|
var useDynamicColumns_default = useDynamicColumns;
|