@wavemaker-ai/react-runtime 1.0.0-rc.647655 → 1.0.0-rc.647684
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/icon/index.js +36 -5
- package/components/basic/iframe/index.js +18 -8
- package/components/basic/label/index.js +4 -3
- package/components/basic/message/index.js +1 -0
- package/components/basic/search/index.d.ts +72 -3
- package/components/basic/search/index.js +84 -32
- package/components/basic/search/props.d.ts +4 -0
- package/components/basic/search/providers.d.ts +1 -1
- package/components/basic/search/providers.js +6 -3
- package/components/common/WmAppIcon/index.js +11 -8
- package/components/common/WmAppIcon/props.d.ts +2 -0
- package/components/container/accordion/accordion-pane/index.d.ts +1 -0
- package/components/container/accordion/accordion-pane/index.js +7 -3
- package/components/container/accordion/accordion-pane/props.d.ts +1 -0
- package/components/container/index.js +13 -5
- package/components/container/layout-grid/index.js +1 -0
- package/components/container/linear-layout/index.js +0 -1
- package/components/container/panel/components/panel-header/index.js +1 -3
- package/components/container/tabs/tab-pane/index.d.ts +1 -0
- package/components/container/tabs/tab-pane/index.js +2 -2
- package/components/container/tabs/tab-pane/props.d.ts +1 -0
- package/components/container/wizard/index.js +11 -10
- package/components/container/wizard/utils.js +1 -0
- 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/dynamic-fields/WmxDynamicFormField.d.ts +11 -0
- package/components/data/form/dynamic-fields/WmxDynamicFormField.js +77 -0
- package/components/data/form/dynamic-fields/index.js +12 -1
- 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 -18
- package/components/data/form/form-field/index.js +10 -6
- package/components/data/list/components/ListItems.js +1 -3
- package/components/data/list/index.js +5 -4
- package/components/data/pagination/hooks/usePagination.js +2 -2
- package/components/data/table/components/RowCells.js +3 -1
- package/components/data/table/components/TableBody.js +2 -1
- package/components/data/table/components/TableDataRow.js +1 -1
- package/components/data/table/components/TableHeader.js +5 -1
- package/components/data/table/hooks/useRowHandlers.d.ts +4 -2
- package/components/data/table/hooks/useRowHandlers.js +23 -11
- package/components/data/table/hooks/useRowSelection.d.ts +1 -1
- package/components/data/table/hooks/useRowSelection.js +93 -74
- package/components/data/table/hooks/useTableColumns.js +5 -5
- package/components/data/table/hooks/useTableState.js +14 -2
- package/components/data/table/index.js +54 -50
- package/components/data/table/props.d.ts +12 -8
- package/components/data/table/utils/buildSelectionColumns.js +31 -31
- package/components/data/table/utils/columnBuilder.js +1 -1
- package/components/data/table/utils/index.d.ts +9 -1
- package/components/data/table/utils/index.js +30 -2
- package/components/data/table/utils/selectionUtils.d.ts +7 -0
- package/components/data/table/utils/selectionUtils.js +28 -1
- package/components/dialogs/dialog-actions/index.js +11 -2
- package/components/dialogs/dialog-header/index.js +1 -1
- package/components/dialogs/index.js +14 -2
- package/components/input/chips/index.js +29 -5
- package/components/input/color-picker/index.js +4 -6
- package/components/input/epoch/date/index.js +3 -2
- 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 +8 -6
- package/components/input/text/index.js +2 -2
- package/components/input/textarea/index.js +41 -16
- package/components/navbar/nav/index.js +10 -5
- package/components/navigation/breadcrumb/index.js +2 -1
- package/components/navigation/popover/index.d.ts +1 -1
- package/components/navigation/popover/index.js +10 -2
- package/components/navigation/popover/props.d.ts +1 -1
- package/components/page/page-content/index.js +24 -4
- package/components/page/page-content/props.d.ts +1 -0
- package/components/page/partial-container/index.js +1 -1
- package/components/wmx/WmxRenderer.d.ts +8 -0
- package/components/wmx/WmxRenderer.js +57 -0
- package/core/appstore.js +1 -1
- package/core/proxy-service.d.ts +16 -1
- package/core/proxy-service.js +39 -12
- package/core/util/index.d.ts +0 -2
- package/core/util/index.js +0 -29
- package/higherOrder/BaseDateTime.js +8 -1
- package/higherOrder/BasePage.js +31 -65
- package/higherOrder/DataNav.js +4 -1
- package/higherOrder/withBaseWrapper.js +3 -4
- package/hooks/useHttp.js +4 -2
- package/hooks/useLayoutSize.js +1 -1
- package/package-lock.json +360 -696
- package/package.json +3 -3
- package/runtime-dynamic/app-initializer.js +2 -1
- package/runtime-dynamic/components/partial-content.js +2 -1
- package/runtime-dynamic/components/wmx-placeholder.d.ts +18 -0
- package/runtime-dynamic/components/wmx-placeholder.js +48 -0
- package/runtime-dynamic/main.js +6 -0
- package/runtime-dynamic/services/compile-render.js +75 -12
- package/store/slices/i18nSlice.d.ts +0 -1
- package/store/slices/i18nSlice.js +0 -2
- package/utils/layoutsize-util.js +12 -7
- package/utils/style-utils.d.ts +6 -0
- package/utils/style-utils.js +10 -0
- package/utils/wmx.utils.d.ts +6 -0
- package/utils/wmx.utils.js +41 -0
- package/variables/crud-variable.js +1 -1
- package/variables/live-variable.js +1 -1
- package/variables/service-variable.js +6 -3
|
@@ -18,11 +18,13 @@ 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 React, { memo, useEffect } from "react";
|
|
21
|
+
import React, { memo, useEffect, useMemo } from "react";
|
|
22
22
|
import Dialog from "@mui/material/Dialog";
|
|
23
23
|
import Fade from "@mui/material/Fade";
|
|
24
24
|
import clsx from "clsx";
|
|
25
|
+
import { useAppState } from "../../context/WidgetProvider";
|
|
25
26
|
import { Box } from "@mui/material";
|
|
27
|
+
import { getFragmentCssScopeClass } from "../../utils/style-utils";
|
|
26
28
|
const DEFAULT_CLASS = "modal fade in";
|
|
27
29
|
const FadeTransition = React.forwardRef(function FadeTransition2(props, ref) {
|
|
28
30
|
return /* @__PURE__ */ jsx(
|
|
@@ -56,6 +58,16 @@ const useBodyScrollLock = (lock) => {
|
|
|
56
58
|
const WmDialog = memo((props) => {
|
|
57
59
|
const { children, className, open = false, onClose, modal = false, onTransitionEntered } = props;
|
|
58
60
|
useBodyScrollLock(open);
|
|
61
|
+
const appState = useAppState();
|
|
62
|
+
const cssScopeClass = useMemo(
|
|
63
|
+
() => getFragmentCssScopeClass({
|
|
64
|
+
componentName: appState == null ? void 0 : appState.componentName,
|
|
65
|
+
name: appState == null ? void 0 : appState.name,
|
|
66
|
+
componentType: appState == null ? void 0 : appState.componentType,
|
|
67
|
+
type: appState == null ? void 0 : appState.type
|
|
68
|
+
}),
|
|
69
|
+
[appState == null ? void 0 : appState.componentName, appState == null ? void 0 : appState.name, appState == null ? void 0 : appState.componentType, appState == null ? void 0 : appState.type]
|
|
70
|
+
);
|
|
59
71
|
const transitionType = FadeTransition;
|
|
60
72
|
const pageRef = document.getElementsByClassName("app-page")[0] || null;
|
|
61
73
|
const handleClose = (event, reason) => {
|
|
@@ -130,7 +142,7 @@ const WmDialog = memo((props) => {
|
|
|
130
142
|
width: "var(--wm-modal-full-screen-width)"
|
|
131
143
|
}, sheetPositionStyles))
|
|
132
144
|
},
|
|
133
|
-
children: /* @__PURE__ */ jsx(Box, { className: clsx(className), children })
|
|
145
|
+
children: /* @__PURE__ */ jsx("div", { className: clsx(cssScopeClass), children: /* @__PURE__ */ jsx(Box, { className: clsx(className), children }) })
|
|
134
146
|
})
|
|
135
147
|
);
|
|
136
148
|
});
|
|
@@ -100,6 +100,10 @@ const WmChips = React.memo(
|
|
|
100
100
|
const [uniqueKeyCounter, setUniqueKeyCounter] = useState(0);
|
|
101
101
|
const [isInitialized, setIsInitialized] = useState(false);
|
|
102
102
|
const backspaceArmedRef = useRef(false);
|
|
103
|
+
const chipsListRef = useRef(chipsList);
|
|
104
|
+
chipsListRef.current = chipsList;
|
|
105
|
+
const modelByValueRef = useRef(modelByValue);
|
|
106
|
+
modelByValueRef.current = modelByValue;
|
|
103
107
|
const maxSizeReached = "Max size reached";
|
|
104
108
|
const isFullWidth = inputwidth === "full";
|
|
105
109
|
const generateStableKeyCb = useCallback(
|
|
@@ -219,7 +223,20 @@ const WmChips = React.memo(
|
|
|
219
223
|
};
|
|
220
224
|
newChipsList.push(chipObj);
|
|
221
225
|
} else {
|
|
222
|
-
|
|
226
|
+
const existingChip = chipsListRef.current.find((chip) => {
|
|
227
|
+
var _a2, _b;
|
|
228
|
+
const chipModelValue = (_b = (_a2 = chip.dataObject) == null ? void 0 : _a2[datafield]) != null ? _b : chip.value;
|
|
229
|
+
return isEqual(chip.value, val) || isEqual(chipModelValue, val);
|
|
230
|
+
});
|
|
231
|
+
if (existingChip) {
|
|
232
|
+
newChipsList.push(__spreadProps(__spreadValues({}, existingChip), {
|
|
233
|
+
key: generateStableKeyCb(existingChip.value, i),
|
|
234
|
+
active: false,
|
|
235
|
+
isDuplicate: false
|
|
236
|
+
}));
|
|
237
|
+
} else {
|
|
238
|
+
searchQuery2.push(val);
|
|
239
|
+
}
|
|
223
240
|
}
|
|
224
241
|
});
|
|
225
242
|
if (searchQuery2.length && datafield !== "All Fields") {
|
|
@@ -248,16 +265,23 @@ const WmChips = React.memo(
|
|
|
248
265
|
const debouncedUpdateQueryModel = useMemo(() => {
|
|
249
266
|
return debounce(updateQueryModel, 150);
|
|
250
267
|
}, [updateQueryModel]);
|
|
268
|
+
const debouncedUpdateQueryModelRef = useRef(debouncedUpdateQueryModel);
|
|
269
|
+
useEffect(() => {
|
|
270
|
+
debouncedUpdateQueryModelRef.current = debouncedUpdateQueryModel;
|
|
271
|
+
}, [debouncedUpdateQueryModel]);
|
|
251
272
|
useEffect(() => {
|
|
252
273
|
if (isInitialized && datavalue !== void 0) {
|
|
253
|
-
|
|
274
|
+
if (isEqual(datavalue, modelByValueRef.current)) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
debouncedUpdateQueryModelRef.current(datavalue);
|
|
254
278
|
} else if (datavalue == void 0 || datavalue.length == 0) {
|
|
255
279
|
setChipsList([]);
|
|
256
280
|
setSearchQuery(void 0);
|
|
257
281
|
setModelByValue([]);
|
|
258
282
|
updateMaxSize(0);
|
|
259
283
|
}
|
|
260
|
-
}, [datavalue,
|
|
284
|
+
}, [datavalue, isInitialized]);
|
|
261
285
|
const addItem = useCallback(
|
|
262
286
|
(newItem) => {
|
|
263
287
|
performAddItem(
|
|
@@ -447,7 +471,7 @@ const WmChips = React.memo(
|
|
|
447
471
|
formEl.removeEventListener("wmformreset", handleFormReset);
|
|
448
472
|
};
|
|
449
473
|
}, []);
|
|
450
|
-
const
|
|
474
|
+
const RenderChipsList = () => {
|
|
451
475
|
const sensors = useSensors(
|
|
452
476
|
useSensor(PointerSensor, {
|
|
453
477
|
activationConstraint: { distance: 5 }
|
|
@@ -624,7 +648,7 @@ const WmChips = React.memo(
|
|
|
624
648
|
className: "wm-chips-root",
|
|
625
649
|
ref: rootRef,
|
|
626
650
|
style: __spreadValues({ width, height }, styles),
|
|
627
|
-
children:
|
|
651
|
+
children: RenderChipsList()
|
|
628
652
|
}
|
|
629
653
|
);
|
|
630
654
|
},
|
|
@@ -513,8 +513,8 @@ const WmColorPicker = memo(
|
|
|
513
513
|
window.removeEventListener("resize", updatePosition);
|
|
514
514
|
};
|
|
515
515
|
}, [isOpen, calculatePosition, setPickerPosition]);
|
|
516
|
-
|
|
517
|
-
setTimeout(() => {
|
|
516
|
+
useEffect(() => {
|
|
517
|
+
const timeoutId = setTimeout(() => {
|
|
518
518
|
var _a2;
|
|
519
519
|
const captionEl = (_a2 = containerRef.current) == null ? void 0 : _a2.closest(".app-composite-widget.caption-floating");
|
|
520
520
|
if (captionEl && !captionEl.classList.contains("float-active")) {
|
|
@@ -523,10 +523,8 @@ const WmColorPicker = memo(
|
|
|
523
523
|
setPlaceholder(placeholder);
|
|
524
524
|
}
|
|
525
525
|
}, 100);
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
checkPlaceholder();
|
|
529
|
-
}, [inputValue, isInteractingWithPicker]);
|
|
526
|
+
return () => clearTimeout(timeoutId);
|
|
527
|
+
}, [inputValue, isInteractingWithPicker, placeholder]);
|
|
530
528
|
return /* @__PURE__ */ jsxs(
|
|
531
529
|
Box,
|
|
532
530
|
{
|
|
@@ -69,7 +69,7 @@ const WmDate = forwardRef((props, ref) => {
|
|
|
69
69
|
onMouseEnter,
|
|
70
70
|
onMouseLeave,
|
|
71
71
|
onBeforeload,
|
|
72
|
-
placeholder = "Select
|
|
72
|
+
placeholder = "Select date",
|
|
73
73
|
tabindex = 0,
|
|
74
74
|
datepattern: datepatternProp,
|
|
75
75
|
outputformat = "yyyy-MM-dd",
|
|
@@ -153,7 +153,7 @@ const WmDate = forwardRef((props, ref) => {
|
|
|
153
153
|
() => {
|
|
154
154
|
var _a2;
|
|
155
155
|
return [
|
|
156
|
-
defaultDateFormat || ((_a2 = listener == null ? void 0 : listener.localeFormats) == null ? void 0 : _a2.date) || "
|
|
156
|
+
defaultDateFormat || ((_a2 = listener == null ? void 0 : listener.localeFormats) == null ? void 0 : _a2.date) || "yyyy-MM-dd",
|
|
157
157
|
selectedLocale || (listener == null ? void 0 : listener.selectedLocale) || "en"
|
|
158
158
|
];
|
|
159
159
|
},
|
|
@@ -255,6 +255,7 @@ const WmDate = forwardRef((props, ref) => {
|
|
|
255
255
|
if (!dateValue) return "";
|
|
256
256
|
try {
|
|
257
257
|
const momentDate = moment(dateValue).locale(currentLocale);
|
|
258
|
+
if (!momentDate.isValid()) return "";
|
|
258
259
|
const momentPattern = convertToMomentFormat(datepattern);
|
|
259
260
|
return momentDate.format(momentPattern);
|
|
260
261
|
} catch (e) {
|
|
@@ -57,10 +57,12 @@ const parseExcludedDates = (excludedates, getDateObj) => {
|
|
|
57
57
|
};
|
|
58
58
|
const defaultGetDateObj = (date) => {
|
|
59
59
|
if (!date) return null;
|
|
60
|
-
if (date instanceof Date) return date;
|
|
60
|
+
if (date instanceof Date) return isNaN(date.getTime()) ? null : date;
|
|
61
61
|
if (typeof date === "string") {
|
|
62
62
|
const parsedDate = moment(date).toDate();
|
|
63
|
-
|
|
63
|
+
if (!isNaN(parsedDate.getTime())) return parsedDate;
|
|
64
|
+
const fallbackDate = new Date(date);
|
|
65
|
+
return isNaN(fallbackDate.getTime()) ? null : fallbackDate;
|
|
64
66
|
}
|
|
65
67
|
return null;
|
|
66
68
|
};
|
|
@@ -96,8 +96,8 @@ const WmDateTime = memo(
|
|
|
96
96
|
const defaultDateTimeFormat = useMemo(() => {
|
|
97
97
|
const combinedFromParts = () => {
|
|
98
98
|
var _a2, _b2;
|
|
99
|
-
const datePart = defaultDateFormat || ((_a2 = listener == null ? void 0 : listener.localeFormats) == null ? void 0 : _a2.date) || "
|
|
100
|
-
const timePart = defaultTimeFormat || ((_b2 = listener == null ? void 0 : listener.localeFormats) == null ? void 0 : _b2.time) || "
|
|
99
|
+
const datePart = defaultDateFormat || ((_a2 = listener == null ? void 0 : listener.localeFormats) == null ? void 0 : _a2.date) || "yyyy-MM-dd";
|
|
100
|
+
const timePart = defaultTimeFormat || ((_b2 = listener == null ? void 0 : listener.localeFormats) == null ? void 0 : _b2.time) || "hh:mm a";
|
|
101
101
|
return `${datePart} ${timePart}`;
|
|
102
102
|
};
|
|
103
103
|
return combinedFromParts();
|
|
@@ -45,12 +45,12 @@ export interface DateTimeProps {
|
|
|
45
45
|
defaultDateTimeFormat?: string;
|
|
46
46
|
/**
|
|
47
47
|
* Default date segment for display when `datepattern` is unset and `defaultDateTimeFormat` is not set.
|
|
48
|
-
* Falls back to `listener.localeFormats.date`, then `"
|
|
48
|
+
* Falls back to `listener.localeFormats.date`, then `"yyyy-MM-dd"`.
|
|
49
49
|
*/
|
|
50
50
|
defaultDateFormat?: string;
|
|
51
51
|
/**
|
|
52
52
|
* Default time segment for display when `datepattern` is unset and `defaultDateTimeFormat` is not set.
|
|
53
|
-
* Falls back to `listener.localeFormats.time`, then `"
|
|
53
|
+
* Falls back to `listener.localeFormats.time`, then `"hh:mm a"`.
|
|
54
54
|
*/
|
|
55
55
|
defaultTimeFormat?: string;
|
|
56
56
|
/**
|
|
@@ -9,7 +9,7 @@ export declare function validateTimeRange(timeValue: Date | moment.Moment | null
|
|
|
9
9
|
export declare function validateTimeFormat(inputValue: string, pattern: string, required: boolean, validationmessage?: string): ValidationResult;
|
|
10
10
|
export declare function parseTimeObj(timeValue: string | Date | null | undefined): Date | null;
|
|
11
11
|
export declare const DEFAULT_CLASS = "input-group app-timeinput";
|
|
12
|
-
export declare const DEFAULT_TIMEPATTERN = "
|
|
12
|
+
export declare const DEFAULT_TIMEPATTERN = "hh:mm a";
|
|
13
13
|
export declare const DEFAULT_OUTPUT_FORMAT = "HH:mm:ss";
|
|
14
14
|
export declare const READONLY_STYLES: {
|
|
15
15
|
cursor: string;
|
|
@@ -76,7 +76,7 @@ function formatDisplayTimeValue(value, pattern) {
|
|
|
76
76
|
if (pattern === "timestamp") {
|
|
77
77
|
return momentObj.valueOf().toString();
|
|
78
78
|
}
|
|
79
|
-
return momentObj.isValid() ? momentObj.format(pattern) : "";
|
|
79
|
+
return momentObj.isValid() ? momentObj.format(pattern.replace(/\ba\b/g, "A")) : "";
|
|
80
80
|
} catch (error) {
|
|
81
81
|
console.warn("Error formatting display value:", error);
|
|
82
82
|
return "";
|
|
@@ -178,7 +178,7 @@ function parseTimeObj(timeValue) {
|
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
const DEFAULT_CLASS = "input-group app-timeinput";
|
|
181
|
-
const DEFAULT_TIMEPATTERN = "
|
|
181
|
+
const DEFAULT_TIMEPATTERN = "hh:mm a";
|
|
182
182
|
const DEFAULT_OUTPUT_FORMAT = "HH:mm:ss";
|
|
183
183
|
const READONLY_STYLES = {
|
|
184
184
|
cursor: "not-allowed"
|
|
@@ -30,7 +30,6 @@ const useFileUpload = (props) => {
|
|
|
30
30
|
disabled = !fileUploadConstants.DEFAULT_VALUES.ENABLED,
|
|
31
31
|
contenttype = "",
|
|
32
32
|
maxfilesize,
|
|
33
|
-
uploadpath,
|
|
34
33
|
datasource,
|
|
35
34
|
extensions,
|
|
36
35
|
filetype,
|
|
@@ -104,7 +103,7 @@ const useFileUpload = (props) => {
|
|
|
104
103
|
const eventHandler = (_b2 = (_a2 = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a2[name]) == null ? void 0 : _b2[eventName];
|
|
105
104
|
return eventHandler ? eventHandler(payload.$event, listener.Widgets[name], payload.files) || true : true;
|
|
106
105
|
},
|
|
107
|
-
[
|
|
106
|
+
[name]
|
|
108
107
|
);
|
|
109
108
|
const fileUploadProgress = (progress) => {
|
|
110
109
|
setUploadedFiles((prevFiles) => {
|
|
@@ -125,26 +124,18 @@ const useFileUpload = (props) => {
|
|
|
125
124
|
});
|
|
126
125
|
});
|
|
127
126
|
};
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
(_b2 = listener == null ? void 0 : listener.App) == null ? void 0 : _b2.notifyApp("File upload failed", "Error");
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
return () => {
|
|
142
|
-
const progressObs2 = datasource && datasource._progressObservable;
|
|
143
|
-
if (progressObs2 == null ? void 0 : progressObs2.unsubscribe) {
|
|
144
|
-
progressObs2.unsubscribe();
|
|
127
|
+
const subscribeToProgress = useCallback((progressObs) => {
|
|
128
|
+
if (!progressObs) return;
|
|
129
|
+
progressObs.subscribe((progress) => {
|
|
130
|
+
var _a2, _b2;
|
|
131
|
+
fileUploadProgress(progress);
|
|
132
|
+
if (progress.progress === 100) {
|
|
133
|
+
(_a2 = listener == null ? void 0 : listener.App) == null ? void 0 : _a2.notifyApp("File uploaded successfully", "Success");
|
|
134
|
+
} else if (progress.errMsg) {
|
|
135
|
+
(_b2 = listener == null ? void 0 : listener.App) == null ? void 0 : _b2.notifyApp("File upload failed", "Error");
|
|
145
136
|
}
|
|
146
|
-
};
|
|
147
|
-
}, [
|
|
137
|
+
});
|
|
138
|
+
}, []);
|
|
148
139
|
useEffect(() => {
|
|
149
140
|
const selected = getChooseFilter();
|
|
150
141
|
setChooseFilter(selected);
|
|
@@ -193,7 +184,7 @@ const useFileUpload = (props) => {
|
|
|
193
184
|
window.removeEventListener("focus", disableDropZone);
|
|
194
185
|
};
|
|
195
186
|
const onBeforeSelectEventCall = ($event, $files) => {
|
|
196
|
-
var _a2, _b2
|
|
187
|
+
var _a2, _b2;
|
|
197
188
|
const files = getValidFiles(
|
|
198
189
|
$files,
|
|
199
190
|
contenttype,
|
|
@@ -237,14 +228,18 @@ const useFileUpload = (props) => {
|
|
|
237
228
|
});
|
|
238
229
|
if (datasource) {
|
|
239
230
|
datasource._progressObservable = eventObserver();
|
|
231
|
+
subscribeToProgress(datasource._progressObservable);
|
|
240
232
|
datasource.dataBinding = datasource.dataBinding || {};
|
|
241
233
|
datasource.dataBinding.files = filesWithIds;
|
|
242
234
|
datasource.dataSet = filesWithIds;
|
|
243
235
|
}
|
|
244
236
|
setUploadedFiles((prev) => multiple ? [...prev, ...filesWithIds] : [...filesWithIds]);
|
|
245
237
|
listener == null ? void 0 : listener.onChange(name, { selectedFiles: filesWithIds });
|
|
246
|
-
|
|
247
|
-
|
|
238
|
+
onSelect == null ? void 0 : onSelect(
|
|
239
|
+
$event,
|
|
240
|
+
(_b2 = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _b2[name],
|
|
241
|
+
filesWithIds
|
|
242
|
+
);
|
|
248
243
|
}
|
|
249
244
|
}
|
|
250
245
|
};
|
|
@@ -47,7 +47,7 @@ const WmSelect = React.memo(
|
|
|
47
47
|
name,
|
|
48
48
|
styles,
|
|
49
49
|
orderby,
|
|
50
|
-
placeholder,
|
|
50
|
+
placeholder = "Select value",
|
|
51
51
|
readonly = false,
|
|
52
52
|
required = false,
|
|
53
53
|
shortcutkey,
|
|
@@ -334,7 +334,7 @@ const WmSelect = React.memo(
|
|
|
334
334
|
}
|
|
335
335
|
prevComputedValueRef.current = currentValue;
|
|
336
336
|
}, [computedSelectValue, multiple, listener, props.fieldName, name, localDatavalue]);
|
|
337
|
-
return /* @__PURE__ */ jsx("div", { className: clsx(DEFAULT_CLASS
|
|
337
|
+
return /* @__PURE__ */ jsx("div", { className: clsx(DEFAULT_CLASS), hidden: props.hidden, style: styles, children: /* @__PURE__ */ jsxs(
|
|
338
338
|
NativeSelect,
|
|
339
339
|
__spreadProps(__spreadValues({
|
|
340
340
|
name,
|
|
@@ -342,7 +342,6 @@ const WmSelect = React.memo(
|
|
|
342
342
|
className: clsx(
|
|
343
343
|
isTouched ? "ng-touched" : "ng-untouched",
|
|
344
344
|
isDirty ? "ng-invalid" : "ng-valid",
|
|
345
|
-
className,
|
|
346
345
|
"wm-native-select-root"
|
|
347
346
|
),
|
|
348
347
|
value: multiple ? computedSelectValue : (_b = (_a = computedSelectValue.key) != null ? _a : placeholder) != null ? _b : ""
|
|
@@ -365,10 +364,13 @@ const WmSelect = React.memo(
|
|
|
365
364
|
multiple,
|
|
366
365
|
disabled,
|
|
367
366
|
"aria-readonly": readonly,
|
|
368
|
-
className:
|
|
367
|
+
className: clsx(
|
|
368
|
+
"app-select",
|
|
369
|
+
className || "",
|
|
370
|
+
"form-control ng-valid ng-touched ng-dirty wm-app"
|
|
371
|
+
),
|
|
369
372
|
accessKey: shortcutkey,
|
|
370
|
-
title: hint
|
|
371
|
-
style: styles
|
|
373
|
+
title: hint
|
|
372
374
|
},
|
|
373
375
|
readOnly: readonly,
|
|
374
376
|
children: [
|
|
@@ -369,13 +369,14 @@ const WmText = memo(
|
|
|
369
369
|
autoFocus: autofocus,
|
|
370
370
|
disabled,
|
|
371
371
|
required,
|
|
372
|
-
placeholder: placeholder != null ? placeholder : "Enter
|
|
372
|
+
placeholder: placeholder != null ? placeholder : "Enter value",
|
|
373
373
|
value: sanitizeInputValue(displayValue),
|
|
374
374
|
type,
|
|
375
375
|
inputRef: ref,
|
|
376
376
|
error: displayError,
|
|
377
377
|
"aria-readonly": readonly,
|
|
378
378
|
helperText: supportingtext || void 0,
|
|
379
|
+
style: styles,
|
|
379
380
|
className: clsx(
|
|
380
381
|
"app-input-wrapper",
|
|
381
382
|
isTouched ? "ng-touched" : "ng-untouched",
|
|
@@ -443,7 +444,6 @@ const WmText = memo(
|
|
|
443
444
|
isTouched ? "ng-touched" : "ng-untouched",
|
|
444
445
|
displayError && "ng-invalid"
|
|
445
446
|
),
|
|
446
|
-
style: styles,
|
|
447
447
|
"aria-label": arialabel,
|
|
448
448
|
maxLength: maxchars,
|
|
449
449
|
pattern: regexp,
|
|
@@ -14,6 +14,18 @@ var __spreadValues = (a, b) => {
|
|
|
14
14
|
}
|
|
15
15
|
return a;
|
|
16
16
|
};
|
|
17
|
+
var __objRest = (source, exclude) => {
|
|
18
|
+
var target = {};
|
|
19
|
+
for (var prop in source)
|
|
20
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
21
|
+
target[prop] = source[prop];
|
|
22
|
+
if (source != null && __getOwnPropSymbols)
|
|
23
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
24
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
};
|
|
17
29
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
18
30
|
import { memo, useEffect, useRef, useState, useCallback, useMemo } from "react";
|
|
19
31
|
import clsx from "clsx";
|
|
@@ -133,13 +145,22 @@ const WmTextarea = memo(
|
|
|
133
145
|
}
|
|
134
146
|
}
|
|
135
147
|
}, [datavalue, isDirty, validateInput]);
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
var _a2, _b;
|
|
150
|
+
const shadowTextarea = (_b = (_a2 = textareaRef.current) == null ? void 0 : _a2.closest(".wm-textarea-root")) == null ? void 0 : _b.querySelector('textarea[aria-hidden="true"]');
|
|
151
|
+
if (readonly) {
|
|
152
|
+
shadowTextarea == null ? void 0 : shadowTextarea.setAttribute("readonly", "");
|
|
153
|
+
} else {
|
|
154
|
+
shadowTextarea == null ? void 0 : shadowTextarea.removeAttribute("readonly");
|
|
155
|
+
}
|
|
156
|
+
}, [readonly]);
|
|
136
157
|
useEffect(() => {
|
|
137
158
|
if (!shortcutkey) return;
|
|
138
159
|
const handleGlobalKeyDown = (e) => {
|
|
139
|
-
var
|
|
160
|
+
var _a2;
|
|
140
161
|
if (e.altKey && e.key.toLowerCase() === shortcutkey.toLowerCase()) {
|
|
141
162
|
e.preventDefault();
|
|
142
|
-
(
|
|
163
|
+
(_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
|
|
143
164
|
}
|
|
144
165
|
};
|
|
145
166
|
window.addEventListener("keydown", handleGlobalKeyDown);
|
|
@@ -154,11 +175,11 @@ const WmTextarea = memo(
|
|
|
154
175
|
[limitdisplaytext, maxchars, debouncedCharLengthUpdate]
|
|
155
176
|
);
|
|
156
177
|
const characterCountText = useMemo(
|
|
157
|
-
() => maxchars ? resolveCharacterCountText(maxchars, displayValue, limitdisplaytext) : void 0,
|
|
178
|
+
() => maxchars && limitdisplaytext ? resolveCharacterCountText(maxchars, displayValue, limitdisplaytext) : void 0,
|
|
158
179
|
[maxchars, displayValue, limitdisplaytext]
|
|
159
180
|
);
|
|
160
181
|
const handleInputChange = useCallback((event) => {
|
|
161
|
-
var
|
|
182
|
+
var _a2;
|
|
162
183
|
const newValue = event.target.value;
|
|
163
184
|
valueRef.current = newValue;
|
|
164
185
|
setDisplayValue(newValue);
|
|
@@ -168,7 +189,7 @@ const WmTextarea = memo(
|
|
|
168
189
|
debouncedUpdate(newValue);
|
|
169
190
|
}
|
|
170
191
|
if (onKeypress) {
|
|
171
|
-
onKeypress(event, (
|
|
192
|
+
onKeypress(event, (_a2 = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a2[name]);
|
|
172
193
|
}
|
|
173
194
|
setTimeout(() => {
|
|
174
195
|
isInternalUpdate.current = false;
|
|
@@ -176,7 +197,7 @@ const WmTextarea = memo(
|
|
|
176
197
|
}, []);
|
|
177
198
|
const handleBlur = useCallback(
|
|
178
199
|
(event) => {
|
|
179
|
-
var
|
|
200
|
+
var _a2;
|
|
180
201
|
if (readonly || disabled) {
|
|
181
202
|
return;
|
|
182
203
|
}
|
|
@@ -194,7 +215,7 @@ const WmTextarea = memo(
|
|
|
194
215
|
setIsDirty(false);
|
|
195
216
|
}
|
|
196
217
|
if (onBlur) {
|
|
197
|
-
onBlur(event, (
|
|
218
|
+
onBlur(event, (_a2 = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a2[name]);
|
|
198
219
|
}
|
|
199
220
|
setTimeout(() => {
|
|
200
221
|
isInternalUpdate.current = false;
|
|
@@ -204,9 +225,9 @@ const WmTextarea = memo(
|
|
|
204
225
|
);
|
|
205
226
|
const handleFocus = useCallback(
|
|
206
227
|
(event) => {
|
|
207
|
-
var
|
|
228
|
+
var _a2;
|
|
208
229
|
if (onFocus) {
|
|
209
|
-
onFocus(event, (
|
|
230
|
+
onFocus(event, (_a2 = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a2[name]);
|
|
210
231
|
}
|
|
211
232
|
},
|
|
212
233
|
[onFocus, listener, name]
|
|
@@ -219,8 +240,8 @@ const WmTextarea = memo(
|
|
|
219
240
|
}
|
|
220
241
|
if (onKeydown) {
|
|
221
242
|
delay(() => {
|
|
222
|
-
var
|
|
223
|
-
onKeydown(event, (
|
|
243
|
+
var _a2;
|
|
244
|
+
onKeydown(event, (_a2 = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a2[name]);
|
|
224
245
|
}, 0);
|
|
225
246
|
}
|
|
226
247
|
},
|
|
@@ -230,8 +251,8 @@ const WmTextarea = memo(
|
|
|
230
251
|
(event) => {
|
|
231
252
|
if (onKeyup) {
|
|
232
253
|
delay(() => {
|
|
233
|
-
var
|
|
234
|
-
onKeyup(event, (
|
|
254
|
+
var _a2;
|
|
255
|
+
onKeyup(event, (_a2 = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a2[name]);
|
|
235
256
|
}, 0);
|
|
236
257
|
}
|
|
237
258
|
},
|
|
@@ -256,6 +277,8 @@ const WmTextarea = memo(
|
|
|
256
277
|
} : {});
|
|
257
278
|
const value = sanitizeInputValue(displayValue);
|
|
258
279
|
const isEditable = !readonly && !disabled;
|
|
280
|
+
const _a = styles || {}, { height: styleHeight } = _a, rootStyles = __objRest(_a, ["height"]);
|
|
281
|
+
const textareaHeight = !styleHeight ? void 0 : typeof styleHeight === "number" ? `${styleHeight}px` : String(styleHeight);
|
|
259
282
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
260
283
|
TextField,
|
|
261
284
|
__spreadValues({
|
|
@@ -276,7 +299,7 @@ const WmTextarea = memo(
|
|
|
276
299
|
isTouched ? "ng-touched" : "ng-untouched",
|
|
277
300
|
isDirty && "ng-invalid"
|
|
278
301
|
),
|
|
279
|
-
style:
|
|
302
|
+
style: rootStyles,
|
|
280
303
|
"aria-readonly": readonly,
|
|
281
304
|
helperText: characterCountText,
|
|
282
305
|
slotProps: {
|
|
@@ -299,7 +322,7 @@ const WmTextarea = memo(
|
|
|
299
322
|
isDirty && "ng-invalid",
|
|
300
323
|
isEditable ? "wm-textarea-editable" : ""
|
|
301
324
|
),
|
|
302
|
-
style: __spreadValues({},
|
|
325
|
+
style: __spreadValues({}, textareaHeight ? { "--wm-textarea-height": textareaHeight } : {}),
|
|
303
326
|
pattern: regexp
|
|
304
327
|
}
|
|
305
328
|
},
|
|
@@ -320,7 +343,9 @@ const WmTextarea = memo(
|
|
|
320
343
|
"autofocus",
|
|
321
344
|
"arialabel",
|
|
322
345
|
"limitdisplaytext",
|
|
323
|
-
"hidden"
|
|
346
|
+
"hidden",
|
|
347
|
+
"styles",
|
|
348
|
+
"className"
|
|
324
349
|
];
|
|
325
350
|
return keys.every((key) => prev[key] === current[key]);
|
|
326
351
|
}
|
|
@@ -61,14 +61,19 @@ const WmNav = memo(
|
|
|
61
61
|
}, [dataset, orderby]);
|
|
62
62
|
const triggerActionClickForAnchor = (e, item) => {
|
|
63
63
|
e == null ? void 0 : e.preventDefault();
|
|
64
|
+
const navigate = () => {
|
|
65
|
+
triggerItemAction({
|
|
66
|
+
label: getItemLabel(item),
|
|
67
|
+
link: item[props.itemlink || "link"],
|
|
68
|
+
target: item[props.itemtarget]
|
|
69
|
+
});
|
|
70
|
+
};
|
|
64
71
|
if (props.onSelect) {
|
|
65
72
|
props.onSelect(e, props, item);
|
|
73
|
+
setTimeout(navigate, 0);
|
|
74
|
+
} else {
|
|
75
|
+
navigate();
|
|
66
76
|
}
|
|
67
|
-
triggerItemAction({
|
|
68
|
-
label: getItemLabel(item),
|
|
69
|
-
link: item[props.itemlink || "link"],
|
|
70
|
-
target: item[props.itemtarget]
|
|
71
|
-
});
|
|
72
77
|
};
|
|
73
78
|
const getItemLabel = (item) => {
|
|
74
79
|
const { itemlabel } = props;
|
|
@@ -3,6 +3,7 @@ import clsx from "clsx";
|
|
|
3
3
|
import Link from "next/link";
|
|
4
4
|
import withDatasetAwareNavigation from "../../../higherOrder/DataNav";
|
|
5
5
|
import withBaseWrapper from "../../../higherOrder/withBaseWrapper";
|
|
6
|
+
import { WmAppIcon } from "../../common/WmAppIcon";
|
|
6
7
|
const BreadCrumb = (props) => {
|
|
7
8
|
const { className, onBeforenavigate, itemtarget, navNodes = [] } = props;
|
|
8
9
|
function handleBeforeNavigate(e, node) {
|
|
@@ -11,7 +12,7 @@ const BreadCrumb = (props) => {
|
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
const renderNavItem = (node, index, isLast = false) => /* @__PURE__ */ jsx("li", { className: clsx(node.class, { active: isLast }), children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14
|
-
node.icon
|
|
15
|
+
node.icon && /* @__PURE__ */ jsx(WmAppIcon, { icon: node.icon }),
|
|
15
16
|
!isLast ? /* @__PURE__ */ jsx(
|
|
16
17
|
Link,
|
|
17
18
|
{
|
|
@@ -25,7 +25,7 @@ declare const _default: React.ComponentType<{
|
|
|
25
25
|
onLoad?: (widget: WmPopoverProps) => void | Function;
|
|
26
26
|
onShow?: (event: Event, widget: WmPopoverProps) => void;
|
|
27
27
|
onHide?: (event: Event, widget: WmPopoverProps) => void;
|
|
28
|
-
render?: (props: WmPopoverProps, onLoad: () => void) => React.ReactNode;
|
|
28
|
+
render?: (props: WmPopoverProps, onLoad: (widget?: any) => void) => React.ReactNode;
|
|
29
29
|
disabled?: boolean;
|
|
30
30
|
isOpen?: boolean;
|
|
31
31
|
caption: string;
|
|
@@ -18,7 +18,15 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
useRef,
|
|
23
|
+
useState,
|
|
24
|
+
useEffect,
|
|
25
|
+
useMemo,
|
|
26
|
+
Suspense,
|
|
27
|
+
useCallback,
|
|
28
|
+
useLayoutEffect
|
|
29
|
+
} from "react";
|
|
22
30
|
import clsx from "clsx";
|
|
23
31
|
import debounce from "lodash-es/debounce";
|
|
24
32
|
import Popover from "@mui/material/Popover";
|
|
@@ -298,7 +306,7 @@ const WmPopover = (Props) => {
|
|
|
298
306
|
}
|
|
299
307
|
),
|
|
300
308
|
props.title && /* @__PURE__ */ jsx("div", { className: "popover-title popover-header", children: props.title }),
|
|
301
|
-
/* @__PURE__ */ jsx("div", { className: "popover-content popover-body", children: props.render && props.content ? /* @__PURE__ */ jsx(Suspense, { fallback: null, children: props.render(props, () => handleLoad(
|
|
309
|
+
/* @__PURE__ */ jsx("div", { className: "popover-content popover-body", children: props.render && props.content ? /* @__PURE__ */ jsx(Suspense, { fallback: null, children: props.render(props, (widget) => handleLoad(widget)) }) : props.children })
|
|
302
310
|
]
|
|
303
311
|
}
|
|
304
312
|
)
|
|
@@ -19,7 +19,7 @@ interface PopoverProps extends WmAnchorProps {
|
|
|
19
19
|
onLoad?: (widget: WmPopoverProps) => void | Function;
|
|
20
20
|
onShow?: (event: Event, widget: WmPopoverProps) => void;
|
|
21
21
|
onHide?: (event: Event, widget: WmPopoverProps) => void;
|
|
22
|
-
render?: (props: WmPopoverProps, onLoad: () => void) => React.ReactNode;
|
|
22
|
+
render?: (props: WmPopoverProps, onLoad: (widget?: any) => void) => React.ReactNode;
|
|
23
23
|
disabled?: boolean;
|
|
24
24
|
isOpen?: boolean;
|
|
25
25
|
}
|