@wavemaker-ai/react-runtime 1.0.0-rc.330 → 1.0.0-rc.332
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions/notification-action.js +3 -3
- package/actions/toast.js +2 -1
- package/components/basic/message/index.js +1 -0
- package/components/basic/search/index.js +9 -11
- package/components/basic/search/providers.d.ts +1 -1
- package/components/basic/search/providers.js +6 -3
- package/components/container/layout-grid/index.js +1 -0
- package/components/container/linear-layout/index.js +0 -1
- package/components/data/form/base-form/hooks/useFormOperations.js +9 -15
- package/components/data/form/base-form/index.js +17 -14
- package/components/data/form/base-form/utils.js +5 -4
- package/components/data/form/form-action/index.d.ts +2 -2
- package/components/data/form/form-action/index.js +2 -2
- package/components/data/form/form-context.d.ts +12 -13
- package/components/data/form/form-context.js +4 -6
- package/components/data/form/form-controller/withFormController.js +4 -4
- package/components/data/form/form-field/index.js +6 -5
- package/components/data/list/components/ListItems.js +1 -3
- package/components/data/list/index.js +2 -2
- package/components/data/pagination/hooks/usePagination.js +2 -2
- package/components/data/table/components/TableBody.js +2 -1
- package/components/data/table/components/TableDataRow.js +1 -1
- package/components/data/table/hooks/useRowHandlers.js +2 -2
- package/components/data/table/hooks/useRowSelection.js +15 -10
- package/components/data/table/hooks/useTableColumns.js +5 -5
- package/components/data/table/index.js +2 -2
- package/components/data/table/props.d.ts +8 -8
- package/components/data/table/utils/buildSelectionColumns.js +30 -30
- package/components/data/table/utils/index.js +15 -1
- package/components/data/table/utils/selectionUtils.d.ts +2 -0
- package/components/data/table/utils/selectionUtils.js +23 -1
- package/components/dialogs/dialog-actions/index.js +11 -2
- package/components/input/epoch/date/index.js +2 -1
- package/components/input/epoch/date/utils.js +4 -2
- package/components/input/epoch/datetime/index.js +2 -2
- package/components/input/epoch/datetime/props.d.ts +2 -2
- package/components/input/epoch/time/utils.d.ts +1 -1
- package/components/input/epoch/time/utils.js +2 -2
- package/components/input/fileupload/useFileUpload.js +19 -24
- package/components/input/select/index.js +6 -3
- package/components/navigation/popover/index.d.ts +1 -1
- package/components/navigation/popover/index.js +1 -1
- package/components/navigation/popover/props.d.ts +1 -1
- package/core/proxy-service.d.ts +16 -1
- package/core/proxy-service.js +39 -12
- package/higherOrder/BaseDateTime.js +8 -1
- package/higherOrder/BasePage.js +7 -2
- package/higherOrder/withBaseWrapper.js +3 -4
- package/package-lock.json +176 -159
- package/package.json +3 -3
|
@@ -44,12 +44,12 @@ class NotificationAction extends BaseAction {
|
|
|
44
44
|
return this.invoke(arg1, arg2, arg3);
|
|
45
45
|
}
|
|
46
46
|
prepareToastOptions(params = {}) {
|
|
47
|
-
var _a, _b, _c, _d;
|
|
47
|
+
var _a, _b, _c, _d, _e;
|
|
48
48
|
const configParams = this.config.paramProvider();
|
|
49
49
|
const mergedParams = __spreadValues(__spreadValues({}, configParams), params);
|
|
50
50
|
const alertClass = (_b = (_a = String(mergedParams.class)) == null ? void 0 : _a.toLowerCase()) != null ? _b : "info";
|
|
51
51
|
const type = NOTIFICATION_TYPE[alertClass] || "info";
|
|
52
|
-
const position = (_c = mergedParams.
|
|
52
|
+
const position = (_d = (_c = mergedParams.position) != null ? _c : mergedParams.toasterPosition) != null ? _d : "bottom right";
|
|
53
53
|
let duration = parseInt(String(mergedParams.duration));
|
|
54
54
|
if (isNaN(duration)) {
|
|
55
55
|
duration = type === "success" ? DEFAULT_DURATION : null;
|
|
@@ -63,7 +63,7 @@ class NotificationAction extends BaseAction {
|
|
|
63
63
|
name: this.name,
|
|
64
64
|
styles: mergedParams.styles || {},
|
|
65
65
|
hideOnClick: mergedParams.hideOnClick !== false,
|
|
66
|
-
showTypeLabel: (
|
|
66
|
+
showTypeLabel: (_e = mergedParams.showTypeLabel) != null ? _e : false,
|
|
67
67
|
onClose: () => {
|
|
68
68
|
if (this.config.onClose) {
|
|
69
69
|
this.config.onClose(this, null);
|
package/actions/toast.js
CHANGED
|
@@ -90,7 +90,8 @@ const CustomToast = ({ toast, onClose }) => {
|
|
|
90
90
|
onClick: handleClick,
|
|
91
91
|
sx: {
|
|
92
92
|
"& .MuiSnackbarContent-root": {
|
|
93
|
-
alignItems: "unset !important"
|
|
93
|
+
alignItems: "unset !important",
|
|
94
|
+
minWidth: "unset"
|
|
94
95
|
},
|
|
95
96
|
"& .MuiSnackbar-root": {
|
|
96
97
|
all: "unset !important"
|
|
@@ -729,18 +729,16 @@ const Search = React.forwardRef((props, ref) => {
|
|
|
729
729
|
}
|
|
730
730
|
};
|
|
731
731
|
const handleFocus = (event) => {
|
|
732
|
-
if (
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
setGroupedData(getGroupedData(normalizedData));
|
|
740
|
-
}
|
|
741
|
-
setIsOpen(true);
|
|
742
|
-
setMenuOpen(true);
|
|
732
|
+
if (formattedDataset.length > 0 && !selectedItem) {
|
|
733
|
+
setIsOpen(true);
|
|
734
|
+
setMenuOpen(true);
|
|
735
|
+
} else if (type === "autocomplete" && normalizedData && normalizedData.length > 0) {
|
|
736
|
+
setFormattedDataset(normalizedData);
|
|
737
|
+
if (props == null ? void 0 : props.groupby) {
|
|
738
|
+
setGroupedData(getGroupedData(normalizedData));
|
|
743
739
|
}
|
|
740
|
+
setIsOpen(true);
|
|
741
|
+
setMenuOpen(true);
|
|
744
742
|
}
|
|
745
743
|
if (onFocus && (standalone || (listener == null ? void 0 : listener.Widgets) && name && name in listener.Widgets)) {
|
|
746
744
|
onFocus(
|
|
@@ -43,7 +43,7 @@ export declare class LocalDataProvider implements IDataProvider {
|
|
|
43
43
|
}
|
|
44
44
|
export declare class DataProvider {
|
|
45
45
|
private localDataProvider;
|
|
46
|
-
init(component: any):
|
|
46
|
+
init(component: any): boolean;
|
|
47
47
|
invokeVariable(component: any, query: string): Promise<any>;
|
|
48
48
|
filter(config: DataProviderConfig): Promise<{
|
|
49
49
|
data: any[];
|
|
@@ -194,10 +194,13 @@ class DataProvider {
|
|
|
194
194
|
}
|
|
195
195
|
// Check if the variable is of type service variable and whether update is required
|
|
196
196
|
init(component) {
|
|
197
|
-
|
|
198
|
-
let datasource = component == null ? void 0 : component.datasource;
|
|
197
|
+
const datasource = component == null ? void 0 : component.datasource;
|
|
199
198
|
if (datasource && datasource.execute) {
|
|
200
|
-
|
|
199
|
+
if (!datasource.execute(DataSource.Operation.IS_API_AWARE)) {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
const hasData = !!((component == null ? void 0 : component.dataset) && component.dataset.length);
|
|
203
|
+
return !!datasource.execute(DataSource.Operation.IS_UPDATE_REQUIRED, hasData);
|
|
201
204
|
}
|
|
202
205
|
return false;
|
|
203
206
|
}
|
|
@@ -46,7 +46,6 @@ function WmLinearLayout(props) {
|
|
|
46
46
|
} = props;
|
|
47
47
|
const computedStyles = useMemo(() => {
|
|
48
48
|
const flexStyles = __spreadProps(__spreadValues({}, styles), {
|
|
49
|
-
display: "flex",
|
|
50
49
|
flexDirection: direction
|
|
51
50
|
});
|
|
52
51
|
if (direction === "row" || direction === "row-reverse") {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useState, useCallback } from "react";
|
|
2
|
+
import { getFormFieldEntries } from "../../../../../core/proxy-service";
|
|
2
3
|
import { cleanNullValues } from "../utils";
|
|
3
4
|
import { usesPrefixedFields } from "../props";
|
|
4
5
|
function useFormOperations({
|
|
@@ -22,25 +23,18 @@ function useFormOperations({
|
|
|
22
23
|
const formreset = useCallback(async () => {
|
|
23
24
|
const cleanedData = {};
|
|
24
25
|
const formNamePrefix = `${formName}.`;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (formfields[key].formName !== formName) return;
|
|
26
|
+
getFormFieldEntries(formfields).forEach(({ key, field }) => {
|
|
27
|
+
if (field.formName !== formName) return;
|
|
28
28
|
if (key.endsWith("_formWidget")) return;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
} else {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
if (formfields[key].readonly || formfields[key].readOnly || formfields[key].disabled) {
|
|
38
|
-
cleanedData[fieldKey] = formfields[key].defaultvalue || formfields[key].value;
|
|
29
|
+
if (hasPrefixedFields && !key.startsWith(formNamePrefix)) return;
|
|
30
|
+
const fieldKey = hasPrefixedFields ? key.slice(formNamePrefix.length) : key;
|
|
31
|
+
if (field.readonly || field.readOnly || field.disabled) {
|
|
32
|
+
cleanedData[fieldKey] = field.defaultvalue || field.value;
|
|
39
33
|
} else {
|
|
40
34
|
cleanedData[fieldKey] = "";
|
|
35
|
+
field.datavalue = "";
|
|
41
36
|
}
|
|
42
|
-
|
|
43
|
-
if (widgetFormType === "live-filter" && isRange) {
|
|
37
|
+
if (widgetFormType === "live-filter" && (field.isRange === true || field.isRange === "true")) {
|
|
44
38
|
cleanedData[`${fieldKey}_maxWidget`] = "";
|
|
45
39
|
}
|
|
46
40
|
});
|
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
usesPrefixedFields
|
|
51
51
|
} from "./hooks";
|
|
52
52
|
import { useWidgetProxy } from "../../../../context/WidgetProvider";
|
|
53
|
+
import { getFormFieldList } from "../../../../core/proxy-service";
|
|
53
54
|
import {
|
|
54
55
|
useAppNotificationAction,
|
|
55
56
|
useNotifyApp
|
|
@@ -357,6 +358,11 @@ const BaseForm = (WrappedComponent) => {
|
|
|
357
358
|
widgetFormType: props["form-type"],
|
|
358
359
|
debouncedFilter
|
|
359
360
|
});
|
|
361
|
+
const formreset = useCallback(async () => {
|
|
362
|
+
var _a2;
|
|
363
|
+
await formresetFn();
|
|
364
|
+
(_a2 = props.onReset) == null ? void 0 : _a2.call(props);
|
|
365
|
+
}, [formresetFn, props.onReset]);
|
|
360
366
|
const clearFilter = useMemo(
|
|
361
367
|
() => handleSubmit((data, e) => {
|
|
362
368
|
e == null ? void 0 : e.preventDefault();
|
|
@@ -380,7 +386,6 @@ const BaseForm = (WrappedComponent) => {
|
|
|
380
386
|
setShowViewMode(true);
|
|
381
387
|
formresetFn();
|
|
382
388
|
}, [setShowViewMode, props.cancel, formresetFn]);
|
|
383
|
-
const getFieldValue = useCallback((fieldName) => watch(fieldName), [watch]);
|
|
384
389
|
const highlightInvalidFields = useCallback(async () => {
|
|
385
390
|
await validateFieldsOnSubmit();
|
|
386
391
|
}, [validateFieldsOnSubmit]);
|
|
@@ -454,16 +459,13 @@ const BaseForm = (WrappedComponent) => {
|
|
|
454
459
|
const registerFn = parentFormDataContext == null ? void 0 : parentFormDataContext.registerChildField;
|
|
455
460
|
if (!registerFn || !formName) return;
|
|
456
461
|
const widgetFormFields = getWidgetFormFields(listener, formName);
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
if (
|
|
460
|
-
const typedWidget = widget;
|
|
461
|
-
const formKey = (typedWidget == null ? void 0 : typedWidget.formKey) || (typedWidget == null ? void 0 : typedWidget.fieldName) || key;
|
|
462
|
-
const fieldName = (typedWidget == null ? void 0 : typedWidget.fieldName) || key;
|
|
462
|
+
getFormFieldList(widgetFormFields || formfields).forEach((field) => {
|
|
463
|
+
const fieldName = (field == null ? void 0 : field.fieldName) || (field == null ? void 0 : field.name);
|
|
464
|
+
if (!fieldName) return;
|
|
463
465
|
registerFn({
|
|
464
466
|
childFormName: formName,
|
|
465
|
-
widget,
|
|
466
|
-
formKey,
|
|
467
|
+
widget: field,
|
|
468
|
+
formKey: (field == null ? void 0 : field.formKey) || fieldName,
|
|
467
469
|
fieldName
|
|
468
470
|
});
|
|
469
471
|
});
|
|
@@ -532,8 +534,7 @@ const BaseForm = (WrappedComponent) => {
|
|
|
532
534
|
useEffect(() => {
|
|
533
535
|
if (!props.onDataSourceChange || !formName) return;
|
|
534
536
|
if (onDataSourceChangeFiredRef.current) return;
|
|
535
|
-
const
|
|
536
|
-
const currentFields = Object.keys(Widgets).filter((key) => !key.includes("formWidget") && Widgets[key]).map((key) => Widgets[key]);
|
|
537
|
+
const currentFields = getFormFieldList(formProxy == null ? void 0 : formProxy.formfields);
|
|
537
538
|
if (currentFields.length > 0) {
|
|
538
539
|
onDataSourceChangeFiredRef.current = true;
|
|
539
540
|
props.onDataSourceChange(currentFields);
|
|
@@ -588,7 +589,8 @@ const BaseForm = (WrappedComponent) => {
|
|
|
588
589
|
showViewMode,
|
|
589
590
|
formdata: computedFormdata,
|
|
590
591
|
submit,
|
|
591
|
-
formreset
|
|
592
|
+
formreset,
|
|
593
|
+
setValue
|
|
592
594
|
}),
|
|
593
595
|
[
|
|
594
596
|
updateFormData,
|
|
@@ -608,13 +610,14 @@ const BaseForm = (WrappedComponent) => {
|
|
|
608
610
|
showViewMode,
|
|
609
611
|
computedFormdata,
|
|
610
612
|
submit,
|
|
611
|
-
|
|
613
|
+
formreset,
|
|
614
|
+
setValue
|
|
612
615
|
]
|
|
613
616
|
);
|
|
614
617
|
const conditionalProps = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, props.target && { target: props.target }), props.method && { method: props.method }), props.encType && { encType: props.encType }), props.action && { action: props.action });
|
|
615
618
|
const formProps = __spreadProps(__spreadValues(__spreadValues({}, props), conditionalProps), {
|
|
616
619
|
submit,
|
|
617
|
-
formreset
|
|
620
|
+
formreset,
|
|
618
621
|
formfields,
|
|
619
622
|
formWidgets: formfields,
|
|
620
623
|
headerActions,
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
some
|
|
30
30
|
} from "lodash-es";
|
|
31
31
|
import { REGEX } from "./constant";
|
|
32
|
+
import { defineFieldAlias } from "../../../../core/proxy-service";
|
|
32
33
|
let userAgent = "";
|
|
33
34
|
if (typeof window !== "undefined") {
|
|
34
35
|
userAgent = window.navigator.userAgent;
|
|
@@ -272,10 +273,10 @@ const registerChildFieldInWidget = (listener, formName, data) => {
|
|
|
272
273
|
const parentFormContext = listener.Widgets[formName];
|
|
273
274
|
parentFormContext.formfields = parentFormContext.formfields || {};
|
|
274
275
|
parentFormContext.formWidgets = parentFormContext.formWidgets || {};
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
276
|
+
const { formfields, formWidgets } = parentFormContext;
|
|
277
|
+
formfields[formKey] = widget;
|
|
278
|
+
formWidgets[fieldName] = widget;
|
|
279
|
+
defineFieldAlias(`${fieldName}_formWidget`, widget, formfields, formWidgets);
|
|
279
280
|
};
|
|
280
281
|
export {
|
|
281
282
|
cleanNullValues,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const WmFormActionsStandalone: import("react").ComponentType<{
|
|
2
|
-
onClick: ((event: any) => void) & ((event?: React.MouseEvent<HTMLElement>, widget?: Record<string, any>, newVal?: string | number | null, oldVal?: string | number | null) => void);
|
|
2
|
+
onClick: ((event: any, widget?: any) => void) & ((event?: React.MouseEvent<HTMLElement>, widget?: Record<string, any>, newVal?: string | number | null, oldVal?: string | number | null) => void);
|
|
3
3
|
formKey: string;
|
|
4
4
|
name: string;
|
|
5
5
|
displayName: string;
|
|
@@ -75,7 +75,7 @@ export { WmFormActionsStandalone as WmFormAction };
|
|
|
75
75
|
* @param props - {@link WmFormActionsProps}
|
|
76
76
|
*/
|
|
77
77
|
declare const _default: import("react").ComponentType<{
|
|
78
|
-
onClick: ((event: any) => void) & ((event?: React.MouseEvent<HTMLElement>, widget?: Record<string, any>, newVal?: string | number | null, oldVal?: string | number | null) => void);
|
|
78
|
+
onClick: ((event: any, widget?: any) => void) & ((event?: React.MouseEvent<HTMLElement>, widget?: Record<string, any>, newVal?: string | number | null, oldVal?: string | number | null) => void);
|
|
79
79
|
formKey: string;
|
|
80
80
|
name: string;
|
|
81
81
|
displayName: string;
|
|
@@ -59,7 +59,7 @@ const WmFormActions = memo((props) => {
|
|
|
59
59
|
const isheaderaction = position === "header" && !headeraction;
|
|
60
60
|
const formRef = useFormContext();
|
|
61
61
|
const handleClick = useCallback(
|
|
62
|
-
(event) => {
|
|
62
|
+
(event, widget) => {
|
|
63
63
|
var _a2, _b2, _c;
|
|
64
64
|
if (props.standalone) {
|
|
65
65
|
if (type === "submit") {
|
|
@@ -68,7 +68,7 @@ const WmFormActions = memo((props) => {
|
|
|
68
68
|
(_b2 = formRef == null ? void 0 : formRef.formreset) == null ? void 0 : _b2.call(formRef);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
(_c = props.onClick) == null ? void 0 : _c.call(props, event);
|
|
71
|
+
(_c = props.onClick) == null ? void 0 : _c.call(props, event, widget);
|
|
72
72
|
},
|
|
73
73
|
[formRef, props.onClick, type]
|
|
74
74
|
);
|
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import type { UseFormSetValue } from "react-hook-form";
|
|
2
3
|
export interface FormContextValue {
|
|
3
|
-
updateFormData?: (data: any) => void;
|
|
4
4
|
control?: any;
|
|
5
5
|
watch?: any;
|
|
6
|
-
registerFormField?: (formKey: string, fieldName: string, fieldInstance: any) => void;
|
|
7
|
-
registerFormWidget?: (widgetName: string, widgetInstance: any) => void;
|
|
8
|
-
registerHeaderAction?: (actionName: string, action: any) => void;
|
|
9
|
-
onChangeHandler?: (fieldName: string, value: any) => void;
|
|
10
|
-
getFieldValue?: (fieldName: string) => any;
|
|
11
6
|
trigger?: any;
|
|
12
7
|
errors?: any;
|
|
13
|
-
|
|
8
|
+
setValue?: UseFormSetValue<any>;
|
|
9
|
+
submitCount?: number;
|
|
10
|
+
submit?: (e?: any) => Promise<boolean | undefined>;
|
|
11
|
+
formreset?: () => Promise<void>;
|
|
12
|
+
updateFormData?: (data: any) => void;
|
|
13
|
+
onChangeHandler?: (fieldName: string, value: any) => void;
|
|
14
|
+
registerFormWidget?: (widgetName: string, widgetInstance: any) => void;
|
|
15
|
+
registerHeaderAction?: (actionName: string, action: any) => void;
|
|
14
16
|
captionposition?: string;
|
|
15
17
|
captionCls?: string;
|
|
16
18
|
widgetCls?: string;
|
|
17
|
-
|
|
19
|
+
itemsPerRow?: string;
|
|
18
20
|
isViewMode?: boolean;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
name?: string;
|
|
22
|
+
validationtype?: string;
|
|
21
23
|
ref?: any;
|
|
22
|
-
itemsPerRow?: string;
|
|
23
|
-
submit?: (e?: any) => Promise<boolean | undefined>;
|
|
24
|
-
formreset?: () => Promise<void>;
|
|
25
24
|
}
|
|
26
25
|
declare const FormContext: React.Context<FormContextValue>;
|
|
27
26
|
/**
|
|
@@ -18,17 +18,15 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
import { jsx } from "react/jsx-runtime";
|
|
21
|
-
import { createContext, useContext } from "react";
|
|
21
|
+
import { createContext, useContext, useMemo } from "react";
|
|
22
22
|
const FormContext = createContext(null);
|
|
23
23
|
const ParentFormDataContext = createContext(null);
|
|
24
24
|
const useParentFormData = () => useContext(ParentFormDataContext);
|
|
25
25
|
const FormProvider = ({ value, isViewMode, children }) => {
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
-
const useFormContext = () => {
|
|
29
|
-
const context = useContext(FormContext);
|
|
30
|
-
return context;
|
|
26
|
+
const contextValue = useMemo(() => __spreadProps(__spreadValues({}, value), { isViewMode }), [value, isViewMode]);
|
|
27
|
+
return /* @__PURE__ */ jsx(FormContext.Provider, { value: contextValue, children });
|
|
31
28
|
};
|
|
29
|
+
const useFormContext = () => useContext(FormContext);
|
|
32
30
|
const useIsViewMode = () => {
|
|
33
31
|
const context = useFormContext();
|
|
34
32
|
return context == null ? void 0 : context.isViewMode;
|
|
@@ -233,7 +233,7 @@ const withFormController = (WrappedComponent) => {
|
|
|
233
233
|
rules: validationRules,
|
|
234
234
|
defaultValue: effectiveDataValue !== void 0 ? effectiveDataValue : defaultvalue,
|
|
235
235
|
render: ({ field, fieldState }) => {
|
|
236
|
-
var _a2, _b;
|
|
236
|
+
var _a2, _b, _c;
|
|
237
237
|
fieldRef.current = field;
|
|
238
238
|
const processedValue = processFieldValue(field.value, type, props.datafield);
|
|
239
239
|
const errorState = getErrorState(fieldState, validationType, touched);
|
|
@@ -292,8 +292,8 @@ const withFormController = (WrappedComponent) => {
|
|
|
292
292
|
delete remapped.displayValue;
|
|
293
293
|
}
|
|
294
294
|
props.onChangeHandler(name2, remapped);
|
|
295
|
-
} : props.onChangeHandler,
|
|
296
|
-
Widgets: ((
|
|
295
|
+
} : props.onChangeHandler || ((_a2 = props.listener) == null ? void 0 : _a2.onChange),
|
|
296
|
+
Widgets: ((_b = props.listener) == null ? void 0 : _b.Widgets) || {}
|
|
297
297
|
}
|
|
298
298
|
});
|
|
299
299
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -336,7 +336,7 @@ const withFormController = (WrappedComponent) => {
|
|
|
336
336
|
textAlign: "start",
|
|
337
337
|
width: "100%"
|
|
338
338
|
},
|
|
339
|
-
children: (
|
|
339
|
+
children: (_c = fieldState.error) == null ? void 0 : _c.message
|
|
340
340
|
}
|
|
341
341
|
)
|
|
342
342
|
] });
|
|
@@ -37,7 +37,7 @@ const DATASET_SYNC_KEYS = [
|
|
|
37
37
|
];
|
|
38
38
|
const WmFormField = memo(
|
|
39
39
|
(props) => {
|
|
40
|
-
var _a, _b, _c, _d
|
|
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(),
|
|
@@ -86,7 +86,8 @@ const WmFormField = memo(
|
|
|
86
86
|
mutableTarget,
|
|
87
87
|
setProxyProps,
|
|
88
88
|
overriddenItemsRef,
|
|
89
|
-
formProxy
|
|
89
|
+
formProxy,
|
|
90
|
+
props.formRef
|
|
90
91
|
);
|
|
91
92
|
fieldProxyRef.current = fieldProxy;
|
|
92
93
|
}, [formReady]);
|
|
@@ -110,7 +111,7 @@ const WmFormField = memo(
|
|
|
110
111
|
});
|
|
111
112
|
}, [props.dataset, props.datafield, props.displayfield, props.displaylabel, props.searchkey]);
|
|
112
113
|
function renderFormFields() {
|
|
113
|
-
var _a2, _b2, _c2, _d2,
|
|
114
|
+
var _a2, _b2, _c2, _d2, _e, _f, _g, _h;
|
|
114
115
|
if (props.formRef) {
|
|
115
116
|
const errors = (_a2 = props.formRef) == null ? void 0 : _a2.errors;
|
|
116
117
|
const formKey = (_b2 = props.formKey) != null ? _b2 : props.name;
|
|
@@ -120,7 +121,7 @@ const WmFormField = memo(
|
|
|
120
121
|
return /* @__PURE__ */ jsx(Fragment, { children: (_h = props == null ? void 0 : props.renderFormFields) == null ? void 0 : _h.call(props, __spreadProps(__spreadValues(__spreadValues({}, proxyProps), overriddenItemsRef.current), {
|
|
121
122
|
show: showfield,
|
|
122
123
|
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 = (
|
|
124
|
+
readonly: (_f = (_e = overriddenItemsRef == null ? void 0 : overriddenItemsRef.current) == null ? void 0 : _e.readonly) != null ? _f : props == null ? void 0 : props.readonly,
|
|
124
125
|
// BaseField derives this from live validators. A direct field-proxy write wins,
|
|
125
126
|
// but never fall back to the initial proxyProps.required snapshot.
|
|
126
127
|
required: (_g = overriddenItemsRef.current.required) != null ? _g : props.required,
|
|
@@ -143,7 +144,7 @@ const WmFormField = memo(
|
|
|
143
144
|
return null;
|
|
144
145
|
}
|
|
145
146
|
const isDeferLoad = deferload === true;
|
|
146
|
-
const showValue = (
|
|
147
|
+
const showValue = (showfield == null ? void 0 : showfield.toString()) !== "false";
|
|
147
148
|
if ((!showValue || showfield) && isDeferLoad) {
|
|
148
149
|
return null;
|
|
149
150
|
}
|
|
@@ -98,8 +98,6 @@ const ListItems = ({
|
|
|
98
98
|
if (onBeforedatarender && widgetInstance) {
|
|
99
99
|
onBeforedatarender(widgetInstance, rawCurrentPageItems.currentItems);
|
|
100
100
|
}
|
|
101
|
-
}, [rawCurrentItemsKey, groupby]);
|
|
102
|
-
useEffect(() => {
|
|
103
101
|
if (onRender) {
|
|
104
102
|
if (groupby) {
|
|
105
103
|
const currentPageGroupedItems = paginatedGroupedData.reduce((acc, group) => {
|
|
@@ -110,7 +108,7 @@ const ListItems = ({
|
|
|
110
108
|
onRender(widgetInstance, currentPageItems.currentItems);
|
|
111
109
|
}
|
|
112
110
|
}
|
|
113
|
-
}, []);
|
|
111
|
+
}, [rawCurrentItemsKey, groupby, currentPage]);
|
|
114
112
|
const totalGroupedItems = useMemo(() => {
|
|
115
113
|
if (!groupedData || !Array.isArray(groupedData)) return 0;
|
|
116
114
|
return groupedData.reduce((total, group) => {
|
|
@@ -393,7 +393,7 @@ const WmList = (props) => {
|
|
|
393
393
|
} else {
|
|
394
394
|
widgetMethods.selectItem(selecteditem);
|
|
395
395
|
}
|
|
396
|
-
}, [selecteditem
|
|
396
|
+
}, [selecteditem]);
|
|
397
397
|
useListEffects({
|
|
398
398
|
name,
|
|
399
399
|
navigation,
|
|
@@ -649,7 +649,7 @@ const WmList = (props) => {
|
|
|
649
649
|
listDirection: direction,
|
|
650
650
|
scrollContainerRef: listScrollContainerRef,
|
|
651
651
|
sentinelRef: scrollSentinelRef,
|
|
652
|
-
orderedDataset: groupby ? Array(paginationState.totalItems).fill(null) : items,
|
|
652
|
+
orderedDataset: groupby && navigation !== LIST_NAVIGATION_TYPES.SCROLL ? Array(paginationState.totalItems).fill(null) : items,
|
|
653
653
|
pagesize: paginationState.currentPageSize,
|
|
654
654
|
navigationalign,
|
|
655
655
|
showrecordcount,
|
|
@@ -530,7 +530,7 @@ const usePagination = ({
|
|
|
530
530
|
}
|
|
531
531
|
setPaginationState((prev) => __spreadProps(__spreadValues({}, prev), { currentPage: newPage }));
|
|
532
532
|
if (isServerSidePagination) {
|
|
533
|
-
datasourceInvoke(newPage).then(() => {
|
|
533
|
+
datasourceInvoke(newPage).then((response) => {
|
|
534
534
|
if (onPaginationChange) {
|
|
535
535
|
onPaginationChange(
|
|
536
536
|
event || createDummyEvent("paginationchange"),
|
|
@@ -541,7 +541,7 @@ const usePagination = ({
|
|
|
541
541
|
if (onSetRecord) {
|
|
542
542
|
const firstRow = (newPage - 1) * paginationState.currentMaxResults;
|
|
543
543
|
const startIndex = firstRow;
|
|
544
|
-
const data = isArray(dataState.fullData) ? dataState.fullData.slice(
|
|
544
|
+
const data = response && isArray(response.data) ? addUniqueRowIds(response.data) : isArray(dataState.fullData) ? dataState.fullData.slice(
|
|
545
545
|
startIndex,
|
|
546
546
|
startIndex + paginationState.currentMaxResults
|
|
547
547
|
) : dataState.fullData;
|
|
@@ -109,7 +109,7 @@ const ExpandedContent = memo(({ rowId, rowData, config, colSpan, onInstanceLoad
|
|
|
109
109
|
return /* @__PURE__ */ jsx(
|
|
110
110
|
TableRow,
|
|
111
111
|
{
|
|
112
|
-
className: "expanded-row-content",
|
|
112
|
+
className: "expanded-row-content app-datagrid-detail-row",
|
|
113
113
|
"data-row-id": rowId,
|
|
114
114
|
role: "row",
|
|
115
115
|
tabIndex: 0,
|
|
@@ -121,6 +121,7 @@ const ExpandedContent = memo(({ rowId, rowData, config, colSpan, onInstanceLoad
|
|
|
121
121
|
role: "cell",
|
|
122
122
|
"data-col-id": "expanded-content",
|
|
123
123
|
tabIndex: 0,
|
|
124
|
+
className: "app-datagrid-row-details-cell",
|
|
124
125
|
style: {
|
|
125
126
|
padding: "16px",
|
|
126
127
|
borderBottom: "1px solid #e0e0e0"
|
|
@@ -68,7 +68,7 @@ const TableDataRowComponent = ({
|
|
|
68
68
|
/* @__PURE__ */ jsx(
|
|
69
69
|
TableRow,
|
|
70
70
|
{
|
|
71
|
-
className: `${TABLE_CSS_CLASSES.tableRow} ${isActive ? "active" : ""} ${rowClass}`,
|
|
71
|
+
className: `${TABLE_CSS_CLASSES.tableRow} ${isActive ? "active" : ""} ${hasExpansion && rowIsExpanded ? "expanded" : ""} ${rowClass}`,
|
|
72
72
|
onClick: handleClick,
|
|
73
73
|
"data-row-id": row.index,
|
|
74
74
|
role: "row",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback } from "react";
|
|
2
2
|
import { cleanRowData } from "../utils";
|
|
3
|
-
import { getWidgetForCallback } from "../utils/selectionUtils";
|
|
3
|
+
import { getWidgetForCallback, toNativeEvent } from "../utils/selectionUtils";
|
|
4
4
|
const useRowHandlers = ({
|
|
5
5
|
editingRowId,
|
|
6
6
|
isAddingNewRow,
|
|
@@ -28,7 +28,7 @@ const useRowHandlers = ({
|
|
|
28
28
|
if (widget) {
|
|
29
29
|
widget.nativeElement = event.target;
|
|
30
30
|
}
|
|
31
|
-
onRowclick(event, widget, cleanRowData(rowData));
|
|
31
|
+
onRowclick(toNativeEvent(event), widget, cleanRowData(rowData));
|
|
32
32
|
},
|
|
33
33
|
[onRowclick, getWidgetRef]
|
|
34
34
|
);
|
|
@@ -4,7 +4,9 @@ import {
|
|
|
4
4
|
getRowIdsFromDataset,
|
|
5
5
|
rowExistsInDataset,
|
|
6
6
|
selectionStateHelpers,
|
|
7
|
-
getWidgetForCallback
|
|
7
|
+
getWidgetForCallback,
|
|
8
|
+
toNativeEvent,
|
|
9
|
+
createSelectionEventStub
|
|
8
10
|
} from "../utils/selectionUtils";
|
|
9
11
|
import { saveTableState, getTableState } from "../utils/table-helpers";
|
|
10
12
|
import { cleanRowData, UNSUPPORTED_STATE_PERSISTENCE_TYPES } from "../utils";
|
|
@@ -138,16 +140,17 @@ const useRowSelection = ({
|
|
|
138
140
|
);
|
|
139
141
|
const triggerSelectionCallback = useCallback(
|
|
140
142
|
(event, rowData, callback) => {
|
|
143
|
+
var _a;
|
|
141
144
|
if (callback && rowData) {
|
|
142
145
|
const widget = getWidgetRef();
|
|
143
146
|
const cleanedRow = cleanRowData([rowData])[0];
|
|
144
|
-
callback(event, widget, cleanedRow);
|
|
147
|
+
callback((_a = toNativeEvent(event)) != null ? _a : createSelectionEventStub(), widget, cleanedRow);
|
|
145
148
|
}
|
|
146
149
|
},
|
|
147
150
|
[getWidgetRef]
|
|
148
151
|
);
|
|
149
152
|
const handleRadioSelection = useCallback(
|
|
150
|
-
(rowId, rowData) => {
|
|
153
|
+
(rowId, rowData, event) => {
|
|
151
154
|
const previousSelection = selectionStateHelpers.getSelection(cellState);
|
|
152
155
|
const previousRowId = previousSelection.length > 0 ? previousSelection[0] : null;
|
|
153
156
|
let previousRowData = null;
|
|
@@ -159,9 +162,9 @@ const useRowSelection = ({
|
|
|
159
162
|
selectionStateHelpers.setSelection(cellState, rowId);
|
|
160
163
|
commitSelectionChange();
|
|
161
164
|
if (previousRowData) {
|
|
162
|
-
triggerSelectionCallback(
|
|
165
|
+
triggerSelectionCallback(event, previousRowData, onRowdeselect);
|
|
163
166
|
}
|
|
164
|
-
triggerSelectionCallback(
|
|
167
|
+
triggerSelectionCallback(event, rowData, onRowselect);
|
|
165
168
|
},
|
|
166
169
|
[
|
|
167
170
|
cellState,
|
|
@@ -173,19 +176,20 @@ const useRowSelection = ({
|
|
|
173
176
|
]
|
|
174
177
|
);
|
|
175
178
|
const handleMultiSelection = useCallback(
|
|
176
|
-
(rowId, rowData, isSelected) => {
|
|
179
|
+
(rowId, rowData, isSelected, event) => {
|
|
177
180
|
if (isSelected) {
|
|
178
181
|
selectionStateHelpers.addToSelection(cellState, rowId);
|
|
179
182
|
} else {
|
|
180
183
|
selectionStateHelpers.removeFromSelection(cellState, rowId);
|
|
181
184
|
}
|
|
182
185
|
commitSelectionChange();
|
|
183
|
-
triggerSelectionCallback(
|
|
186
|
+
triggerSelectionCallback(event, rowData, isSelected ? onRowselect : onRowdeselect);
|
|
184
187
|
},
|
|
185
188
|
[cellState, commitSelectionChange, onRowselect, onRowdeselect, triggerSelectionCallback]
|
|
186
189
|
);
|
|
187
190
|
const handleSelectAll = useCallback(
|
|
188
|
-
(isSelected) => {
|
|
191
|
+
(isSelected, event) => {
|
|
192
|
+
var _a;
|
|
189
193
|
let newIds = [];
|
|
190
194
|
if (isSelected) {
|
|
191
195
|
newIds = getRowIdsFromDataset(datasetRef.current);
|
|
@@ -197,9 +201,10 @@ const useRowSelection = ({
|
|
|
197
201
|
const rows = datasetRef.current;
|
|
198
202
|
const callback = isSelected ? onRowselect : onRowdeselect;
|
|
199
203
|
if (callback && rows.length > 0) {
|
|
204
|
+
const sharedEvent = (_a = toNativeEvent(event)) != null ? _a : createSelectionEventStub();
|
|
200
205
|
rows.forEach((row) => {
|
|
201
206
|
const cleanedRow = cleanRowData([row])[0];
|
|
202
|
-
callback(
|
|
207
|
+
callback(sharedEvent, getWidgetRef(), cleanedRow);
|
|
203
208
|
});
|
|
204
209
|
}
|
|
205
210
|
},
|
|
@@ -274,7 +279,7 @@ const useRowSelection = ({
|
|
|
274
279
|
applySelectionForMode([firstRowId]);
|
|
275
280
|
forceUpdate({});
|
|
276
281
|
if (onRowselect) {
|
|
277
|
-
triggerSelectionCallback(
|
|
282
|
+
triggerSelectionCallback(void 0, firstRowData, onRowselect);
|
|
278
283
|
}
|
|
279
284
|
}
|
|
280
285
|
}, [
|