@wavemaker-ai/react-runtime 1.0.0-rc.330 → 1.0.0-rc.334
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/advanced/carousel/index.d.ts +1 -0
- package/components/advanced/carousel/template.d.ts +1 -0
- package/components/advanced/login/index.d.ts +1 -0
- package/components/advanced/marquee/index.d.ts +1 -0
- package/components/basic/anchor/index.d.ts +1 -0
- package/components/basic/anchor/index.js +3 -5
- package/components/basic/audio/index.d.ts +1 -0
- package/components/basic/html/index.d.ts +1 -0
- package/components/basic/icon/index.d.ts +1 -0
- package/components/basic/iframe/index.d.ts +1 -0
- package/components/basic/label/index.d.ts +1 -0
- package/components/basic/message/index.js +1 -0
- package/components/basic/picture/index.d.ts +1 -0
- package/components/basic/progress-bar/index.d.ts +1 -0
- package/components/basic/progress-circle/index.d.ts +1 -0
- package/components/basic/richtexteditor/index.d.ts +2 -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/basic/spinner/index.d.ts +1 -0
- package/components/basic/tile/index.d.ts +1 -0
- package/components/basic/tree/index.d.ts +1 -0
- package/components/basic/video/index.d.ts +1 -0
- package/components/chart/index.d.ts +1 -0
- package/components/container/accordion/accordion-pane/index.d.ts +1 -0
- package/components/container/accordion/index.d.ts +1 -0
- package/components/container/index.d.ts +4 -0
- package/components/container/index.js +33 -9
- package/components/container/layout-grid/grid-column/index.d.ts +1 -0
- package/components/container/layout-grid/grid-row/index.d.ts +1 -0
- package/components/container/layout-grid/index.d.ts +1 -0
- package/components/container/layout-grid/index.js +2 -1
- package/components/container/linear-layout/index.d.ts +1 -0
- package/components/container/linear-layout/index.js +0 -1
- package/components/container/linear-layout/linear-layout-item/index.d.ts +1 -0
- package/components/container/panel/index.d.ts +1 -0
- package/components/container/props.d.ts +1 -0
- package/components/container/repeat-template/index.d.ts +1 -0
- package/components/container/repeat-template/index.js +1 -1
- package/components/container/tabs/index.d.ts +1 -0
- package/components/container/tabs/index.js +8 -6
- package/components/container/tabs/tab-pane/index.d.ts +1 -0
- package/components/container/tabs/tab-pane/index.js +2 -2
- package/components/container/wizard/index.d.ts +2 -0
- package/components/container/wizard/index.js +56 -40
- package/components/container/wizard/wizard-step/index.d.ts +1 -0
- package/components/data/card/card-actions/index.d.ts +1 -0
- package/components/data/card/card-content/index.d.ts +1 -0
- package/components/data/card/card-footer/index.d.ts +1 -0
- package/components/data/card/index.d.ts +1 -0
- package/components/data/form/base-form/hooks/useFormOperations.d.ts +1 -1
- package/components/data/form/base-form/hooks/useFormOperations.js +14 -17
- package/components/data/form/base-form/index.js +22 -23
- package/components/data/form/base-form/props.d.ts +1 -0
- package/components/data/form/base-form/utils.js +5 -4
- package/components/data/form/form-action/index.d.ts +4 -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 +20 -7
- package/components/data/form/form-field/index.js +40 -15
- package/components/data/form/form-field/props.d.ts +7 -2
- package/components/data/list/components/ListItems.js +1 -3
- package/components/data/list/index.d.ts +2 -0
- package/components/data/list/index.js +6 -11
- package/components/data/pagination/hooks/usePagination.js +8 -8
- package/components/data/table/components/RowExpansionButton.js +5 -1
- package/components/data/table/components/TableBody.js +4 -1
- package/components/data/table/components/TableDataRow.js +1 -1
- package/components/data/table/components/TableHeader.js +3 -1
- package/components/data/table/hooks/useFormWidget.js +2 -2
- package/components/data/table/hooks/usePanelStructure.js +6 -1
- package/components/data/table/hooks/useResponsiveColumns.d.ts +1 -0
- package/components/data/table/hooks/useRowHandlers.js +3 -3
- package/components/data/table/hooks/useRowSelection.js +22 -13
- package/components/data/table/hooks/useTableColumns.js +5 -5
- package/components/data/table/hooks/useTableData.js +10 -2
- package/components/data/table/index.d.ts +2 -0
- package/components/data/table/index.js +15 -14
- package/components/data/table/live-table/index.d.ts +1 -0
- package/components/data/table/props.d.ts +9 -8
- package/components/data/table/table-action/index.d.ts +1 -0
- package/components/data/table/table-column/index.d.ts +1 -0
- package/components/data/table/table-row/index.d.ts +1 -0
- package/components/data/table/table-row-action/index.d.ts +1 -0
- package/components/data/table/utils/buildSelectionColumns.js +45 -50
- package/components/data/table/utils/crud-handlers.js +3 -1
- package/components/data/table/utils/expansionColumn.js +1 -1
- package/components/data/table/utils/index.d.ts +10 -3
- package/components/data/table/utils/index.js +20 -9
- package/components/data/table/utils/selectionUtils.d.ts +14 -0
- package/components/data/table/utils/selectionUtils.js +33 -1
- package/components/dialogs/alert-dialog/index.d.ts +2 -0
- package/components/dialogs/confirm-dialog/index.d.ts +2 -0
- package/components/dialogs/dialog/index.d.ts +2 -0
- package/components/dialogs/dialog-actions/index.d.ts +1 -0
- package/components/dialogs/dialog-actions/index.js +11 -2
- package/components/dialogs/dialog-body/index.d.ts +1 -0
- package/components/dialogs/dialog-content/index.d.ts +1 -0
- package/components/dialogs/dialog-header/index.d.ts +1 -0
- package/components/dialogs/iframe-dialog/index.d.ts +2 -0
- package/components/dialogs/login-dialog/index.d.ts +2 -0
- package/components/dialogs/page-dialog/index.d.ts +2 -0
- package/components/dialogs/withDialogWrapper.js +12 -2
- package/components/form/button/index.d.ts +1 -0
- package/components/form/button-group/index.d.ts +1 -0
- package/components/input/calendar/index.d.ts +2 -0
- package/components/input/chips/index.d.ts +2 -0
- package/components/input/color-picker/index.d.ts +2 -0
- package/components/input/composite/index.d.ts +1 -0
- package/components/input/composite/index.js +32 -6
- package/components/input/default/checkbox/index.d.ts +2 -0
- package/components/input/default/checkboxset/index.d.ts +2 -0
- package/components/input/default/radioset/index.d.ts +2 -0
- package/components/input/default/switch/index.d.ts +2 -0
- package/components/input/epoch/date/index.d.ts +1 -0
- package/components/input/epoch/date/index.js +2 -1
- package/components/input/epoch/date/utils.js +4 -2
- package/components/input/epoch/datetime/index.d.ts +1 -0
- package/components/input/epoch/datetime/index.js +5 -3
- package/components/input/epoch/datetime/props.d.ts +2 -2
- package/components/input/epoch/time/index.d.ts +1 -0
- package/components/input/epoch/time/utils.d.ts +1 -1
- package/components/input/epoch/time/utils.js +2 -2
- package/components/input/fileupload/index.d.ts +1 -0
- package/components/input/fileupload/index.js +2 -1
- package/components/input/fileupload/useFileUpload.js +19 -24
- package/components/input/number/index.d.ts +2 -0
- package/components/input/rating/index.d.ts +2 -0
- package/components/input/select/index.js +6 -3
- package/components/input/slider/index.d.ts +2 -0
- package/components/input/text/index.d.ts +2 -0
- package/components/input/text/index.js +9 -2
- package/components/input/textarea/index.d.ts +2 -0
- package/components/input/upload/index.d.ts +2 -0
- package/components/navbar/index.d.ts +1 -0
- package/components/navbar/nav-item/index.d.ts +1 -0
- package/components/navigation/breadcrumb/index.d.ts +1 -0
- package/components/navigation/menu/index.d.ts +1 -0
- package/components/navigation/menu/index.js +13 -9
- package/components/navigation/menu/props.d.ts +1 -0
- package/components/navigation/popover/index.d.ts +2 -1
- package/components/navigation/popover/index.js +16 -4
- package/components/navigation/popover/props.d.ts +1 -1
- package/components/page/partial/index.d.ts +1 -0
- package/context/PopoverContext.d.ts +5 -0
- package/context/PopoverContext.js +5 -0
- package/context/WidgetProvider.js +9 -2
- package/core/proxy-service.d.ts +18 -1
- package/core/proxy-service.js +84 -14
- package/higherOrder/BaseApp.js +2 -1
- package/higherOrder/BaseDateTime.js +8 -1
- package/higherOrder/BasePage.js +9 -11
- package/higherOrder/props.d.ts +1 -0
- package/higherOrder/useActivePageReactivity.js +1 -4
- package/higherOrder/withBaseWrapper.js +6 -6
- package/package-lock.json +203 -185
- package/package.json +3 -3
- package/runtime-dynamic/components/PageWrapper.js +1 -1
- package/runtime-dynamic/components/PrefabPreview.js +1 -1
- package/runtime-dynamic/components/partial-content.js +17 -1
- package/runtime-dynamic/factories/build-base-page-like-component.js +11 -7
- package/runtime-dynamic/factories/dynamic-component.js +1 -7
- package/runtime-dynamic/routes.js +17 -8
- package/utils/page-params-util.js +22 -1
- package/utils/partial-host-util.d.ts +40 -0
- package/utils/partial-host-util.js +41 -0
- package/variables/model-variable.d.ts +2 -0
- package/variables/model-variable.js +14 -0
|
@@ -48,6 +48,8 @@ import {
|
|
|
48
48
|
useHTMLValidationProps,
|
|
49
49
|
useExternalDataSync
|
|
50
50
|
} from "./hooks";
|
|
51
|
+
const ALWAYS_MULTI_VALUE_WIDGETS = ["WmChips", "WmCheckboxset"];
|
|
52
|
+
const MULTI_SELECT_WIDGET = "WmSelect";
|
|
51
53
|
const withFormController = (WrappedComponent) => {
|
|
52
54
|
const WithFormControllerComponent = memo((props) => {
|
|
53
55
|
const _a = props, {
|
|
@@ -121,6 +123,9 @@ const withFormController = (WrappedComponent) => {
|
|
|
121
123
|
useDefaultValueSync(defaultvalue, datavalue, fieldRef);
|
|
122
124
|
const widget = WrappedComponent == null ? void 0 : WrappedComponent.displayName;
|
|
123
125
|
const ignoreRange = ["WmRadioset", "WmCheckboxset"].includes(widget != null ? widget : "");
|
|
126
|
+
const isMultipleSelect = widget === MULTI_SELECT_WIDGET && props.multiple == true;
|
|
127
|
+
const isMultiValueWidget = ALWAYS_MULTI_VALUE_WIDGETS.includes(widget != null ? widget : "") || isMultipleSelect;
|
|
128
|
+
const fallbackDefaultValue = isMultiValueWidget && defaultvalue === void 0 ? [] : defaultvalue;
|
|
124
129
|
const validationRules = useValidationRules(
|
|
125
130
|
validationType,
|
|
126
131
|
validators,
|
|
@@ -172,6 +177,10 @@ const withFormController = (WrappedComponent) => {
|
|
|
172
177
|
trigger(effectiveFormKey);
|
|
173
178
|
}
|
|
174
179
|
}, [customValidationMsg]);
|
|
180
|
+
const onChangeRef = useRef(props.onChange);
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
onChangeRef.current = props.onChange;
|
|
183
|
+
}, [props.onChange]);
|
|
175
184
|
const createOnChangeHandler = useCallback(
|
|
176
185
|
(field) => {
|
|
177
186
|
return (e, componentProps, newValue, oldValue, isValid) => {
|
|
@@ -199,7 +208,7 @@ const withFormController = (WrappedComponent) => {
|
|
|
199
208
|
setTouched(true);
|
|
200
209
|
trigger(effectiveFormKey);
|
|
201
210
|
}
|
|
202
|
-
(_a2 =
|
|
211
|
+
(_a2 = onChangeRef.current) == null ? void 0 : _a2.call(onChangeRef, e, componentProps, newValue, oldValue);
|
|
203
212
|
};
|
|
204
213
|
},
|
|
205
214
|
[type, props.datafield, updateon, effectiveFormKey]
|
|
@@ -231,12 +240,13 @@ const withFormController = (WrappedComponent) => {
|
|
|
231
240
|
control: formRef.control,
|
|
232
241
|
name: effectiveFormKey,
|
|
233
242
|
rules: validationRules,
|
|
234
|
-
defaultValue: effectiveDataValue !== void 0 ? effectiveDataValue :
|
|
243
|
+
defaultValue: effectiveDataValue !== void 0 ? effectiveDataValue : fallbackDefaultValue,
|
|
235
244
|
render: ({ field, fieldState }) => {
|
|
236
|
-
var _a2, _b;
|
|
245
|
+
var _a2, _b, _c;
|
|
237
246
|
fieldRef.current = field;
|
|
238
247
|
const processedValue = processFieldValue(field.value, type, props.datafield);
|
|
239
248
|
const errorState = getErrorState(fieldState, validationType, touched);
|
|
249
|
+
const isExplicitFormField = props.formfield === true || props.formfield === "true";
|
|
240
250
|
let valueToUse;
|
|
241
251
|
if (processedValue !== void 0) {
|
|
242
252
|
valueToUse = processedValue;
|
|
@@ -292,8 +302,8 @@ const withFormController = (WrappedComponent) => {
|
|
|
292
302
|
delete remapped.displayValue;
|
|
293
303
|
}
|
|
294
304
|
props.onChangeHandler(name2, remapped);
|
|
295
|
-
} : props.onChangeHandler,
|
|
296
|
-
Widgets: ((
|
|
305
|
+
} : props.onChangeHandler || ((_a2 = props.listener) == null ? void 0 : _a2.onChange),
|
|
306
|
+
Widgets: ((_b = props.listener) == null ? void 0 : _b.Widgets) || {}
|
|
297
307
|
}
|
|
298
308
|
});
|
|
299
309
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -321,11 +331,14 @@ const withFormController = (WrappedComponent) => {
|
|
|
321
331
|
value = JSON.stringify(value);
|
|
322
332
|
}
|
|
323
333
|
}
|
|
334
|
+
if (value && typeof value === "object") {
|
|
335
|
+
value = JSON.stringify(value);
|
|
336
|
+
}
|
|
324
337
|
return value;
|
|
325
338
|
})()
|
|
326
339
|
}
|
|
327
340
|
),
|
|
328
|
-
shouldShowErrorMessage(validationType, fieldState, touched) && /* @__PURE__ */ jsx(
|
|
341
|
+
isExplicitFormField && shouldShowErrorMessage(validationType, fieldState, touched) && /* @__PURE__ */ jsx(
|
|
329
342
|
"p",
|
|
330
343
|
{
|
|
331
344
|
className: "help-block text-danger",
|
|
@@ -336,7 +349,7 @@ const withFormController = (WrappedComponent) => {
|
|
|
336
349
|
textAlign: "start",
|
|
337
350
|
width: "100%"
|
|
338
351
|
},
|
|
339
|
-
children: (
|
|
352
|
+
children: (_c = fieldState.error) == null ? void 0 : _c.message
|
|
340
353
|
}
|
|
341
354
|
)
|
|
342
355
|
] });
|
|
@@ -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(),
|
|
@@ -48,7 +48,7 @@ const WmFormField = memo(
|
|
|
48
48
|
const formProxy = useWidgetProxy(`${props.formName}`);
|
|
49
49
|
const overriddenItemsRef = useRef({});
|
|
50
50
|
const fieldKey = props.formKey || props.name;
|
|
51
|
-
const
|
|
51
|
+
const prevDefaultValueRef = useRef(props.defaultvalue);
|
|
52
52
|
const showfield = (_b = (_a = overriddenItemsRef == null ? void 0 : overriddenItemsRef.current) == null ? void 0 : _a.show) != null ? _b : show;
|
|
53
53
|
const formReady = (formProxy == null ? void 0 : formProxy.listener) !== void 0 || ((_c = props.formRef) == null ? void 0 : _c.name) === props.formName;
|
|
54
54
|
const reset = useCallback(
|
|
@@ -81,27 +81,43 @@ const WmFormField = memo(
|
|
|
81
81
|
formProxy.formWidgets = {};
|
|
82
82
|
formProxy.formfields = {};
|
|
83
83
|
}
|
|
84
|
-
const mutableTarget = __spreadProps(__spreadValues({}, props), {
|
|
84
|
+
const mutableTarget = __spreadProps(__spreadValues({}, props), {
|
|
85
|
+
reset,
|
|
86
|
+
show,
|
|
87
|
+
deferload,
|
|
88
|
+
fieldValidations: {
|
|
89
|
+
validate: () => {
|
|
90
|
+
var _a2;
|
|
91
|
+
if (fieldKey && typeof ((_a2 = props.formRef) == null ? void 0 : _a2.trigger) === "function") {
|
|
92
|
+
props.formRef.trigger(fieldKey);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
85
97
|
const fieldProxy = createFormFieldProxy(
|
|
86
98
|
mutableTarget,
|
|
87
99
|
setProxyProps,
|
|
88
100
|
overriddenItemsRef,
|
|
89
|
-
formProxy
|
|
101
|
+
formProxy,
|
|
102
|
+
props.formRef
|
|
90
103
|
);
|
|
91
104
|
fieldProxyRef.current = fieldProxy;
|
|
92
105
|
}, [formReady]);
|
|
93
106
|
useEffect(() => {
|
|
94
107
|
if (!formReady || !fieldProxyRef.current) return;
|
|
95
|
-
if (
|
|
96
|
-
|
|
108
|
+
if (prevDefaultValueRef.current === props.defaultvalue) return;
|
|
109
|
+
const valueUnset = fieldProxyRef.current.datavalue === void 0 || fieldProxyRef.current.datavalue === prevDefaultValueRef.current;
|
|
110
|
+
prevDefaultValueRef.current = props.defaultvalue;
|
|
111
|
+
if (!valueUnset) return;
|
|
97
112
|
fieldProxyRef.current.datavalue = props.defaultvalue;
|
|
98
113
|
fieldProxyRef.current.value = props.defaultvalue;
|
|
99
114
|
fieldProxyRef.current.defaultvalue = props.defaultvalue;
|
|
100
|
-
}, [props.defaultvalue]);
|
|
115
|
+
}, [props.defaultvalue, formReady]);
|
|
101
116
|
useEffect(() => {
|
|
102
|
-
var _a2;
|
|
103
117
|
const fieldProxy = fieldProxyRef.current;
|
|
104
|
-
if (!fieldProxy
|
|
118
|
+
if (!fieldProxy) return;
|
|
119
|
+
const hasDataset = typeof props.dataset === "function" || props.dataset && props.dataset.length > 0;
|
|
120
|
+
if (!hasDataset) return;
|
|
105
121
|
DATASET_SYNC_KEYS.forEach((key) => {
|
|
106
122
|
const value = props[key];
|
|
107
123
|
if (value != null && fieldProxy[key] !== value) {
|
|
@@ -110,20 +126,25 @@ const WmFormField = memo(
|
|
|
110
126
|
});
|
|
111
127
|
}, [props.dataset, props.datafield, props.displayfield, props.displaylabel, props.searchkey]);
|
|
112
128
|
function renderFormFields() {
|
|
113
|
-
var _a2, _b2, _c2, _d2,
|
|
129
|
+
var _a2, _b2, _c2, _d2, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
114
130
|
if (props.formRef) {
|
|
115
131
|
const errors = (_a2 = props.formRef) == null ? void 0 : _a2.errors;
|
|
116
132
|
const formKey = (_b2 = props.formKey) != null ? _b2 : props.name;
|
|
117
133
|
const fieldError = formKey && errors ? get(errors, formKey) : void 0;
|
|
118
134
|
const invalid = Boolean(fieldError);
|
|
119
135
|
const invalidCls = invalid ? " text-danger " : "";
|
|
120
|
-
return /* @__PURE__ */ jsx(Fragment, { children: (
|
|
136
|
+
return /* @__PURE__ */ jsx(Fragment, { children: (_m = props == null ? void 0 : props.renderFormFields) == null ? void 0 : _m.call(props, __spreadProps(__spreadValues(__spreadValues({}, proxyProps), overriddenItemsRef.current), {
|
|
137
|
+
// proxyProps snapshots onChange once at mount; nothing resyncs it, so a
|
|
138
|
+
// handler assigned after mount (e.g. from a page's onReady) is never seen
|
|
139
|
+
// unless we read the live prop here, same as onTrailingiconclick below.
|
|
140
|
+
onChange: props.onChange,
|
|
121
141
|
show: showfield,
|
|
122
142
|
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 = (
|
|
143
|
+
readonly: (_f = (_e = overriddenItemsRef == null ? void 0 : overriddenItemsRef.current) == null ? void 0 : _e.readonly) != null ? _f : props == null ? void 0 : props.readonly,
|
|
124
144
|
// BaseField derives this from live validators. A direct field-proxy write wins,
|
|
125
145
|
// but never fall back to the initial proxyProps.required snapshot.
|
|
126
146
|
required: (_g = overriddenItemsRef.current.required) != null ? _g : props.required,
|
|
147
|
+
displayname: (_h = overriddenItemsRef.current.displayname) != null ? _h : props.displayname,
|
|
127
148
|
fieldError,
|
|
128
149
|
validators: props.validators,
|
|
129
150
|
asyncValidators: props.asyncValidators,
|
|
@@ -131,7 +152,11 @@ const WmFormField = memo(
|
|
|
131
152
|
invalid,
|
|
132
153
|
invalidCls,
|
|
133
154
|
iswidget: "false",
|
|
134
|
-
onChangeHandler
|
|
155
|
+
onChangeHandler,
|
|
156
|
+
onTrailingiconclick: (_i = overriddenItemsRef.current.onTrailingiconclick) != null ? _i : props.onTrailingiconclick,
|
|
157
|
+
trailingiconurl: (_j = overriddenItemsRef.current.trailingiconurl) != null ? _j : props.trailingiconurl,
|
|
158
|
+
onLeadingiconclick: (_k = overriddenItemsRef.current.onLeadingiconclick) != null ? _k : props.onLeadingiconclick,
|
|
159
|
+
leadingiconurl: (_l = overriddenItemsRef.current.leadingiconurl) != null ? _l : props.leadingiconurl
|
|
135
160
|
})) });
|
|
136
161
|
} else {
|
|
137
162
|
return null;
|
|
@@ -143,8 +168,8 @@ const WmFormField = memo(
|
|
|
143
168
|
return null;
|
|
144
169
|
}
|
|
145
170
|
const isDeferLoad = deferload === true;
|
|
146
|
-
const showValue = (
|
|
147
|
-
if (
|
|
171
|
+
const showValue = (showfield == null ? void 0 : showfield.toString()) !== "false";
|
|
172
|
+
if (!showValue && isDeferLoad) {
|
|
148
173
|
return null;
|
|
149
174
|
}
|
|
150
175
|
const shouldHide = !showValue && !isDeferLoad;
|
|
@@ -146,9 +146,9 @@ export interface FormFieldProps {
|
|
|
146
146
|
*/
|
|
147
147
|
displaylabel?: string;
|
|
148
148
|
/**
|
|
149
|
-
* The collection of data items for the field.
|
|
149
|
+
* The collection of data items for the field, or a thunk returning them.
|
|
150
150
|
*/
|
|
151
|
-
dataset?: any[];
|
|
151
|
+
dataset?: any[] | (() => any[]);
|
|
152
152
|
/**
|
|
153
153
|
* Key to use for searching.
|
|
154
154
|
*/
|
|
@@ -206,6 +206,11 @@ export interface FormFieldProps {
|
|
|
206
206
|
reset?: () => void;
|
|
207
207
|
setValidationMessage?: (message: string) => void;
|
|
208
208
|
disabled?: boolean;
|
|
209
|
+
trailingiconurl?: string;
|
|
210
|
+
onTrailingiconclick?: (...args: any[]) => void;
|
|
211
|
+
leadingiconurl?: string;
|
|
212
|
+
onLeadingiconclick?: (...args: any[]) => void;
|
|
213
|
+
onChange?: (...args: any[]) => void;
|
|
209
214
|
}
|
|
210
215
|
/**
|
|
211
216
|
* Combined props for the WmFormField component, including base WaveMaker props.
|
|
@@ -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) => {
|
|
@@ -84,6 +84,7 @@ declare const WmListStandalone: React.ComponentType<{
|
|
|
84
84
|
datavalue?: any;
|
|
85
85
|
width?: number | string;
|
|
86
86
|
height?: number | string;
|
|
87
|
+
class?: string;
|
|
87
88
|
animation?: string;
|
|
88
89
|
show?: boolean | string;
|
|
89
90
|
padding?: string;
|
|
@@ -139,6 +140,7 @@ declare const _default: React.ComponentType<{
|
|
|
139
140
|
width?: number | string;
|
|
140
141
|
height?: number | string;
|
|
141
142
|
className?: string;
|
|
143
|
+
class?: string;
|
|
142
144
|
conditionalstyle?: React.CSSProperties;
|
|
143
145
|
conditionalclass?: string;
|
|
144
146
|
showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
|
|
@@ -182,7 +182,7 @@ const WmList = (props) => {
|
|
|
182
182
|
}
|
|
183
183
|
const safeDataset = useMemo(() => {
|
|
184
184
|
return addUniqueRowIds(resolvedDataset, { type: "list" });
|
|
185
|
-
}, [currentDataset]);
|
|
185
|
+
}, [currentDataset, dataset]);
|
|
186
186
|
const [initialRender, setinitialRender] = useState(true);
|
|
187
187
|
const userInitiatedSelectionRef = React.useRef(false);
|
|
188
188
|
const listScrollContainerRef = useRef(null);
|
|
@@ -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,
|
|
@@ -512,18 +512,13 @@ const WmList = (props) => {
|
|
|
512
512
|
return /* @__PURE__ */ jsxs(
|
|
513
513
|
Box,
|
|
514
514
|
__spreadProps(__spreadValues(__spreadProps(__spreadValues({
|
|
515
|
-
className: clsx(
|
|
516
|
-
DEFAULT_CLS,
|
|
517
|
-
"wm-position-relative",
|
|
518
|
-
className,
|
|
519
|
-
hidden && "wm-hidden",
|
|
520
|
-
wrapper_autoLayout_Classes
|
|
521
|
-
),
|
|
515
|
+
className: clsx(DEFAULT_CLS, "wm-position-relative", className, wrapper_autoLayout_Classes),
|
|
522
516
|
component: "div",
|
|
523
517
|
"data-name": name
|
|
524
518
|
}, { name }), {
|
|
525
519
|
"data-navigation": navigation,
|
|
526
|
-
ref: ListWrapperRef
|
|
520
|
+
ref: ListWrapperRef,
|
|
521
|
+
hidden
|
|
527
522
|
}), direction ? { direction } : {}), {
|
|
528
523
|
children: [
|
|
529
524
|
/* @__PURE__ */ jsx(
|
|
@@ -649,7 +644,7 @@ const WmList = (props) => {
|
|
|
649
644
|
listDirection: direction,
|
|
650
645
|
scrollContainerRef: listScrollContainerRef,
|
|
651
646
|
sentinelRef: scrollSentinelRef,
|
|
652
|
-
orderedDataset: groupby ? Array(paginationState.totalItems).fill(null) : items,
|
|
647
|
+
orderedDataset: groupby && navigation !== LIST_NAVIGATION_TYPES.SCROLL ? Array(paginationState.totalItems).fill(null) : items,
|
|
653
648
|
pagesize: paginationState.currentPageSize,
|
|
654
649
|
navigationalign,
|
|
655
650
|
showrecordcount,
|
|
@@ -381,7 +381,7 @@ const usePagination = ({
|
|
|
381
381
|
const updatedMaxResults = newMaxResults || prev.currentMaxResults;
|
|
382
382
|
const updatedDataSize = newDataSize !== void 0 ? newDataSize : prev.dataSize;
|
|
383
383
|
const updatedCurrentPage = currentPage !== void 0 ? currentPage : prev.currentPage;
|
|
384
|
-
const newPageCount = (paginationMeta == null ? void 0 : paginationMeta.totalPages) !== void 0 && (
|
|
384
|
+
const newPageCount = (paginationMeta == null ? void 0 : paginationMeta.totalPages) !== void 0 && (isServerSidePagination || paginationMeta.totalPages > 1) ? paginationMeta.totalPages : updatedDataSize > updatedMaxResults ? Math.ceil(updatedDataSize / updatedMaxResults) : updatedDataSize < 0 ? 0 : 1;
|
|
385
385
|
return __spreadProps(__spreadValues({}, prev), {
|
|
386
386
|
currentPage: updatedCurrentPage,
|
|
387
387
|
dataSize: updatedDataSize,
|
|
@@ -390,7 +390,7 @@ const usePagination = ({
|
|
|
390
390
|
}
|
|
391
391
|
});
|
|
392
392
|
},
|
|
393
|
-
[paginationMeta]
|
|
393
|
+
[isServerSidePagination, paginationMeta]
|
|
394
394
|
);
|
|
395
395
|
const disableNavigation = useCallback(() => {
|
|
396
396
|
setDisableStates({
|
|
@@ -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;
|
|
@@ -551,7 +551,7 @@ const usePagination = ({
|
|
|
551
551
|
totalElements: (paginationMeta == null ? void 0 : paginationMeta.totalElements) || dataState.fullData.length,
|
|
552
552
|
totalPages: paginationState.pageCount
|
|
553
553
|
};
|
|
554
|
-
onSetRecord(
|
|
554
|
+
onSetRecord(createDummyEvent("setrecord"), widgetInstance, data, pageInfo);
|
|
555
555
|
}
|
|
556
556
|
if (setIsLoadingMore) {
|
|
557
557
|
setIsLoadingMore(false);
|
|
@@ -582,7 +582,7 @@ const usePagination = ({
|
|
|
582
582
|
totalElements: (paginationMeta == null ? void 0 : paginationMeta.totalElements) || dataState.fullData.length,
|
|
583
583
|
totalPages: paginationState.pageCount
|
|
584
584
|
};
|
|
585
|
-
onSetRecord(
|
|
585
|
+
onSetRecord(createDummyEvent("setrecord"), widgetInstance, data, pageInfo);
|
|
586
586
|
}
|
|
587
587
|
if (setIsLoadingMore) {
|
|
588
588
|
setIsLoadingMore(false);
|
|
@@ -679,7 +679,7 @@ const usePagination = ({
|
|
|
679
679
|
totalElements: (paginationMeta == null ? void 0 : paginationMeta.totalElements) || fullData.length,
|
|
680
680
|
totalPages: pageCount
|
|
681
681
|
};
|
|
682
|
-
onSetRecord(
|
|
682
|
+
onSetRecord(createDummyEvent("setrecord"), widgetInstance, data, pageInfo);
|
|
683
683
|
}
|
|
684
684
|
goToPage();
|
|
685
685
|
},
|
|
@@ -737,7 +737,7 @@ const usePagination = ({
|
|
|
737
737
|
totalElements: (paginationMeta == null ? void 0 : paginationMeta.totalElements) || dataState.fullData.length,
|
|
738
738
|
totalPages: newPageCount
|
|
739
739
|
};
|
|
740
|
-
onSetRecord(
|
|
740
|
+
onSetRecord(createDummyEvent("setrecord"), widgetInstance, data, pageInfo);
|
|
741
741
|
}
|
|
742
742
|
if (setIsLoadingMore) {
|
|
743
743
|
setIsLoadingMore(false);
|
|
@@ -49,7 +49,11 @@ const RowExpansionButton = ({
|
|
|
49
49
|
"aria-label": ariaLabel,
|
|
50
50
|
"aria-expanded": isExpanded,
|
|
51
51
|
"aria-live": "polite",
|
|
52
|
-
tabIndex: 0
|
|
52
|
+
tabIndex: 0,
|
|
53
|
+
styles: __spreadValues({
|
|
54
|
+
minWidth: 0,
|
|
55
|
+
padding: 0
|
|
56
|
+
}, config.styles)
|
|
53
57
|
};
|
|
54
58
|
if (config.listener) {
|
|
55
59
|
commonProps.listener = config.listener;
|
|
@@ -69,6 +69,8 @@ const ExpansionCell = memo(({ rowId, rowData, isExpanded, onToggle, config }) =>
|
|
|
69
69
|
textAlign: "center",
|
|
70
70
|
position: "relative",
|
|
71
71
|
width: config.columnwidth || DEFAULT_EXPANSION_WIDTH,
|
|
72
|
+
minWidth: config.columnwidth || DEFAULT_EXPANSION_WIDTH,
|
|
73
|
+
maxWidth: config.columnwidth || DEFAULT_EXPANSION_WIDTH,
|
|
72
74
|
padding: "4px"
|
|
73
75
|
},
|
|
74
76
|
children: /* @__PURE__ */ jsx(Box, { component: "span", className: "row-expansion-column", "data-identifier": "rowExpansionButtons", children: /* @__PURE__ */ jsx(
|
|
@@ -109,7 +111,7 @@ const ExpandedContent = memo(({ rowId, rowData, config, colSpan, onInstanceLoad
|
|
|
109
111
|
return /* @__PURE__ */ jsx(
|
|
110
112
|
TableRow,
|
|
111
113
|
{
|
|
112
|
-
className: "expanded-row-content",
|
|
114
|
+
className: "expanded-row-content app-datagrid-detail-row",
|
|
113
115
|
"data-row-id": rowId,
|
|
114
116
|
role: "row",
|
|
115
117
|
tabIndex: 0,
|
|
@@ -121,6 +123,7 @@ const ExpandedContent = memo(({ rowId, rowData, config, colSpan, onInstanceLoad
|
|
|
121
123
|
role: "cell",
|
|
122
124
|
"data-col-id": "expanded-content",
|
|
123
125
|
tabIndex: 0,
|
|
126
|
+
className: "app-datagrid-row-details-cell",
|
|
124
127
|
style: {
|
|
125
128
|
padding: "16px",
|
|
126
129
|
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",
|
|
@@ -147,6 +147,8 @@ const ExpansionHeaderCell = memo(
|
|
|
147
147
|
rowSpan,
|
|
148
148
|
style: __spreadValues({
|
|
149
149
|
width: columnwidth || "50px",
|
|
150
|
+
minWidth: columnwidth || "50px",
|
|
151
|
+
maxWidth: columnwidth || "50px",
|
|
150
152
|
padding: "8px",
|
|
151
153
|
userSelect: "none"
|
|
152
154
|
}, rest.style)
|
|
@@ -330,7 +332,7 @@ const TableHeaderComponent = memo(
|
|
|
330
332
|
role: "columnheader",
|
|
331
333
|
"data-col-id": headerIndex,
|
|
332
334
|
tabIndex: 0,
|
|
333
|
-
"data-col-field":
|
|
335
|
+
"data-col-field": "row-expansion",
|
|
334
336
|
columnwidth: rowExpansionConfig == null ? void 0 : rowExpansionConfig.columnwidth
|
|
335
337
|
},
|
|
336
338
|
`expansion-header-${headerIndex}`
|
|
@@ -62,7 +62,7 @@ const useFormWidget = ({ listener }) => {
|
|
|
62
62
|
const sessionSuffix = (widgetProps == null ? void 0 : widgetProps.sessionKey) ? `_${widgetProps.sessionKey}` : "";
|
|
63
63
|
const uniqueName = `edit_${fieldName}${sessionSuffix}`;
|
|
64
64
|
const disabled = getDisabledValue(widgetProps == null ? void 0 : widgetProps.disabled, widgetProps == null ? void 0 : widgetProps.rowData);
|
|
65
|
-
const commonProps = __spreadValues({
|
|
65
|
+
const commonProps = __spreadProps(__spreadValues({}, widgetProps == null ? void 0 : widgetProps.column), {
|
|
66
66
|
key: uniqueName,
|
|
67
67
|
// Add key to force component recreation
|
|
68
68
|
name: uniqueName,
|
|
@@ -84,7 +84,7 @@ const useFormWidget = ({ listener }) => {
|
|
|
84
84
|
column: widgetProps == null ? void 0 : widgetProps.column,
|
|
85
85
|
updateon: "blur",
|
|
86
86
|
regexp: ((_a = widgetProps == null ? void 0 : widgetProps.column) == null ? void 0 : _a.regexp) || ".*"
|
|
87
|
-
}
|
|
87
|
+
});
|
|
88
88
|
const wrapEventHandler = (handler) => {
|
|
89
89
|
return (event) => {
|
|
90
90
|
handler(event, {}, widgetProps == null ? void 0 : widgetProps.rowData);
|
|
@@ -39,9 +39,14 @@ const usePanelStructure = ({
|
|
|
39
39
|
showrecordcount
|
|
40
40
|
]
|
|
41
41
|
);
|
|
42
|
+
const showFooter = useMemo(
|
|
43
|
+
() => showPagination || footerActions.length > 0,
|
|
44
|
+
[showPagination, footerActions]
|
|
45
|
+
);
|
|
42
46
|
return {
|
|
43
47
|
showPanelHeading,
|
|
44
|
-
showPagination
|
|
48
|
+
showPagination,
|
|
49
|
+
showFooter
|
|
45
50
|
};
|
|
46
51
|
};
|
|
47
52
|
export {
|
|
@@ -52,6 +52,7 @@ export declare const useResponsiveColumns: (columns: WmTableColumnProps[]) => {
|
|
|
52
52
|
padding?: string;
|
|
53
53
|
margin?: string;
|
|
54
54
|
height?: number | string;
|
|
55
|
+
class?: string;
|
|
55
56
|
conditionalstyle?: import("react").CSSProperties;
|
|
56
57
|
conditionalclass?: string;
|
|
57
58
|
showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
|
|
@@ -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,13 +28,14 @@ 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
|
);
|
|
35
35
|
const handleRowClick = useCallback(
|
|
36
36
|
(event, rowData, rowId) => {
|
|
37
37
|
const hasSelectionMode = useRadioSelect || useMultiSelect;
|
|
38
|
+
invokeRowClick(event, rowData);
|
|
38
39
|
let isSelectionHandled = false;
|
|
39
40
|
if (hasSelectionMode && isrowselectable) {
|
|
40
41
|
isSelectionHandled = handleRowSelectionClick(event, rowId, rowData);
|
|
@@ -47,7 +48,6 @@ const useRowHandlers = ({
|
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
49
50
|
handleRowActiveClick(rowId, isSelectionHandled, isEditingOrAdding);
|
|
50
|
-
invokeRowClick(event, rowData);
|
|
51
51
|
},
|
|
52
52
|
[
|
|
53
53
|
editingRowId,
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import {
|
|
3
3
|
isInteractiveElement,
|
|
4
|
+
isSelectionCheckboxRenamed,
|
|
4
5
|
getRowIdsFromDataset,
|
|
5
6
|
rowExistsInDataset,
|
|
6
7
|
selectionStateHelpers,
|
|
7
|
-
getWidgetForCallback
|
|
8
|
+
getWidgetForCallback,
|
|
9
|
+
toNativeEvent,
|
|
10
|
+
createSelectionEventStub
|
|
8
11
|
} from "../utils/selectionUtils";
|
|
9
12
|
import { saveTableState, getTableState } from "../utils/table-helpers";
|
|
10
13
|
import { cleanRowData, UNSUPPORTED_STATE_PERSISTENCE_TYPES } from "../utils";
|
|
@@ -138,16 +141,17 @@ const useRowSelection = ({
|
|
|
138
141
|
);
|
|
139
142
|
const triggerSelectionCallback = useCallback(
|
|
140
143
|
(event, rowData, callback) => {
|
|
144
|
+
var _a;
|
|
141
145
|
if (callback && rowData) {
|
|
142
146
|
const widget = getWidgetRef();
|
|
143
147
|
const cleanedRow = cleanRowData([rowData])[0];
|
|
144
|
-
callback(event, widget, cleanedRow);
|
|
148
|
+
callback((_a = toNativeEvent(event)) != null ? _a : createSelectionEventStub(), widget, cleanedRow);
|
|
145
149
|
}
|
|
146
150
|
},
|
|
147
151
|
[getWidgetRef]
|
|
148
152
|
);
|
|
149
153
|
const handleRadioSelection = useCallback(
|
|
150
|
-
(rowId, rowData) => {
|
|
154
|
+
(rowId, rowData, event) => {
|
|
151
155
|
const previousSelection = selectionStateHelpers.getSelection(cellState);
|
|
152
156
|
const previousRowId = previousSelection.length > 0 ? previousSelection[0] : null;
|
|
153
157
|
let previousRowData = null;
|
|
@@ -159,9 +163,9 @@ const useRowSelection = ({
|
|
|
159
163
|
selectionStateHelpers.setSelection(cellState, rowId);
|
|
160
164
|
commitSelectionChange();
|
|
161
165
|
if (previousRowData) {
|
|
162
|
-
triggerSelectionCallback(
|
|
166
|
+
triggerSelectionCallback(event, previousRowData, onRowdeselect);
|
|
163
167
|
}
|
|
164
|
-
triggerSelectionCallback(
|
|
168
|
+
triggerSelectionCallback(event, rowData, onRowselect);
|
|
165
169
|
},
|
|
166
170
|
[
|
|
167
171
|
cellState,
|
|
@@ -173,19 +177,20 @@ const useRowSelection = ({
|
|
|
173
177
|
]
|
|
174
178
|
);
|
|
175
179
|
const handleMultiSelection = useCallback(
|
|
176
|
-
(rowId, rowData, isSelected) => {
|
|
180
|
+
(rowId, rowData, isSelected, event) => {
|
|
177
181
|
if (isSelected) {
|
|
178
182
|
selectionStateHelpers.addToSelection(cellState, rowId);
|
|
179
183
|
} else {
|
|
180
184
|
selectionStateHelpers.removeFromSelection(cellState, rowId);
|
|
181
185
|
}
|
|
182
186
|
commitSelectionChange();
|
|
183
|
-
triggerSelectionCallback(
|
|
187
|
+
triggerSelectionCallback(event, rowData, isSelected ? onRowselect : onRowdeselect);
|
|
184
188
|
},
|
|
185
189
|
[cellState, commitSelectionChange, onRowselect, onRowdeselect, triggerSelectionCallback]
|
|
186
190
|
);
|
|
187
191
|
const handleSelectAll = useCallback(
|
|
188
|
-
(isSelected) => {
|
|
192
|
+
(isSelected, event) => {
|
|
193
|
+
var _a;
|
|
189
194
|
let newIds = [];
|
|
190
195
|
if (isSelected) {
|
|
191
196
|
newIds = getRowIdsFromDataset(datasetRef.current);
|
|
@@ -197,9 +202,10 @@ const useRowSelection = ({
|
|
|
197
202
|
const rows = datasetRef.current;
|
|
198
203
|
const callback = isSelected ? onRowselect : onRowdeselect;
|
|
199
204
|
if (callback && rows.length > 0) {
|
|
205
|
+
const sharedEvent = (_a = toNativeEvent(event)) != null ? _a : createSelectionEventStub();
|
|
200
206
|
rows.forEach((row) => {
|
|
201
207
|
const cleanedRow = cleanRowData([row])[0];
|
|
202
|
-
callback(
|
|
208
|
+
callback(sharedEvent, getWidgetRef(), cleanedRow);
|
|
203
209
|
});
|
|
204
210
|
}
|
|
205
211
|
},
|
|
@@ -212,10 +218,13 @@ const useRowSelection = ({
|
|
|
212
218
|
}
|
|
213
219
|
if (useMultiSelect) {
|
|
214
220
|
const isCurrentlySelected = selectionStateHelpers.isRowSelected(cellState, rowId);
|
|
215
|
-
const
|
|
216
|
-
|
|
221
|
+
const isToggled = !isSelectionCheckboxRenamed(event);
|
|
222
|
+
if (isToggled) {
|
|
223
|
+
selectionStateHelpers.toggleSelection(cellState, rowId);
|
|
224
|
+
}
|
|
225
|
+
const isSelected = isToggled ? !isCurrentlySelected : isCurrentlySelected;
|
|
217
226
|
commitSelectionChange();
|
|
218
|
-
triggerSelectionCallback(event, rowData,
|
|
227
|
+
triggerSelectionCallback(event, rowData, isSelected ? onRowselect : onRowdeselect);
|
|
219
228
|
return true;
|
|
220
229
|
}
|
|
221
230
|
handleRadioSelection(rowId, rowData);
|
|
@@ -274,7 +283,7 @@ const useRowSelection = ({
|
|
|
274
283
|
applySelectionForMode([firstRowId]);
|
|
275
284
|
forceUpdate({});
|
|
276
285
|
if (onRowselect) {
|
|
277
|
-
triggerSelectionCallback(
|
|
286
|
+
triggerSelectionCallback(void 0, firstRowData, onRowselect);
|
|
278
287
|
}
|
|
279
288
|
}
|
|
280
289
|
}, [
|