@wavemaker-ai/react-runtime 1.0.0-rc.324 → 1.0.0-rc.328
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/basic/anchor/index.js +3 -0
- package/components/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/search/index.d.ts +72 -3
- package/components/basic/search/index.js +75 -21
- package/components/basic/search/props.d.ts +4 -0
- 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 +18 -5
- package/components/container/layout-grid/grid-row/index.js +1 -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/useFormSubmission.d.ts +1 -1
- package/components/data/form/base-form/hooks/useFormSubmission.js +3 -1
- package/components/data/form/base-form/index.js +11 -14
- package/components/data/form/base-form/props.d.ts +3 -0
- package/components/data/form/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-controller/withFormController.js +19 -16
- package/components/data/form/form-field/base-field.js +8 -5
- package/components/data/form/form-field/index.js +15 -8
- package/components/data/form/form-field/props.d.ts +1 -0
- package/components/data/list/components/ListItemWithTemplate.js +5 -2
- package/components/data/list/hooks/useListEffects.js +1 -1
- package/components/data/list/index.js +14 -5
- package/components/data/list/utils/constants.d.ts +0 -1
- package/components/data/list/utils/constants.js +0 -2
- package/components/data/table/components/RowCells.js +20 -4
- package/components/data/table/components/TableBody.js +5 -3
- package/components/data/table/components/TableHeader.js +14 -8
- package/components/data/table/components/TablePanelHeading.js +1 -1
- package/components/data/table/hooks/useDynamicColumns.js +1 -1
- package/components/data/table/hooks/useRowExpansion.js +41 -31
- package/components/data/table/hooks/useRowHandlers.d.ts +4 -2
- package/components/data/table/hooks/useRowHandlers.js +23 -12
- package/components/data/table/hooks/useRowSelection.d.ts +1 -1
- package/components/data/table/hooks/useRowSelection.js +80 -66
- package/components/data/table/hooks/useServerSideSorting.js +0 -1
- package/components/data/table/hooks/useTableColumns.js +16 -8
- package/components/data/table/hooks/useTableData.js +0 -1
- package/components/data/table/hooks/useTableEdit.js +0 -1
- package/components/data/table/hooks/useTableState.js +14 -2
- package/components/data/table/index.js +94 -61
- package/components/data/table/live-table/index.js +0 -1
- package/components/data/table/props.d.ts +8 -0
- package/components/data/table/utils/buildSelectionColumns.js +2 -4
- package/components/data/table/utils/columnBuilder.d.ts +16 -2
- package/components/data/table/utils/columnBuilder.js +14 -9
- package/components/data/table/utils/columnWidthDistribution.js +10 -0
- package/components/data/table/utils/constants.d.ts +0 -4
- package/components/data/table/utils/constants.js +0 -7
- package/components/data/table/utils/dynamic-columns.d.ts +1 -1
- package/components/data/table/utils/dynamic-columns.js +3 -8
- package/components/data/table/utils/expansionColumn.d.ts +23 -0
- package/components/data/table/utils/expansionColumn.js +56 -0
- package/components/data/table/utils/index.d.ts +23 -3
- package/components/data/table/utils/index.js +60 -20
- package/components/data/table/utils/selectionUtils.d.ts +5 -0
- package/components/data/table/utils/selectionUtils.js +5 -0
- package/components/dialogs/dialog/index.js +3 -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/default/radioset/index.js +2 -1
- package/components/input/epoch/date/index.js +1 -1
- package/components/input/select/index.js +3 -5
- package/components/input/text/index.js +2 -2
- package/components/input/textarea/index.js +42 -17
- package/components/navbar/nav/index.js +10 -5
- package/components/navigation/breadcrumb/index.js +2 -1
- package/components/navigation/popover/index.js +24 -8
- package/components/page/index.js +1 -1
- package/components/page/page-content/index.js +30 -6
- package/components/page/page-content/props.d.ts +1 -0
- package/components/page/partial-container/index.js +2 -1
- package/components/prefab/index.js +3 -2
- package/components/prefab/props.d.ts +1 -0
- package/components/wmx/WmxRenderer.d.ts +8 -0
- package/components/wmx/WmxRenderer.js +57 -0
- package/context/WidgetProvider.js +2 -1
- package/core/appstore.js +1 -1
- package/core/proxy-service.d.ts +1 -0
- package/core/proxy-service.js +53 -2
- package/core/util/index.d.ts +0 -2
- package/core/util/index.js +3 -30
- package/higherOrder/BasePage.js +36 -54
- package/higherOrder/DataNav.js +4 -1
- package/higherOrder/withBaseWrapper.js +9 -7
- package/hooks/useHttp.js +4 -2
- package/hooks/useLayoutSize.js +1 -1
- package/package-lock.json +240 -607
- package/package.json +3 -3
- package/runtime-dynamic/app-initializer.js +2 -1
- package/runtime-dynamic/components/partial-content.js +4 -1
- package/runtime-dynamic/components/wmx-placeholder.d.ts +18 -0
- package/runtime-dynamic/components/wmx-placeholder.js +48 -0
- package/runtime-dynamic/factories/dynamic-component.js +26 -3
- package/runtime-dynamic/main.js +6 -0
- package/runtime-dynamic/services/compile-render.js +75 -12
- package/runtime-dynamic/services/css-scoping.d.ts +2 -0
- package/runtime-dynamic/services/css-scoping.js +39 -20
- package/store/slices/i18nSlice.d.ts +0 -1
- package/store/slices/i18nSlice.js +0 -2
- package/utils/custom-expression/parser.js +11 -8
- package/utils/layoutsize-util.js +12 -7
- package/utils/style-utils.d.ts +6 -0
- package/utils/style-utils.js +10 -0
- package/utils/transformedDataset-utils.d.ts +3 -3
- package/utils/transformedDataset-utils.js +1 -2
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { type CSSProperties } from "react";
|
|
2
2
|
import { WmTableColumnProps, WmTableRowActionProps, WmTableRowProps, WmTableActionProps, ValidationResult } from "../props";
|
|
3
3
|
declare const formWidgets: readonly ["WmText", "WmTextarea", "WmCheckbox", "WmSlider", "WmCurrency", "WmSwitch", "WmSelect", "WmCheckboxSet", "WmRadioSet", "WmDate", "WmTime", "WmTimestamp", "WmRating", "WmDatetime", "WmSearch", "WmChips", "WmColorPicker"];
|
|
4
4
|
type FormWidgetType = (typeof formWidgets)[number];
|
|
@@ -7,7 +7,8 @@ export type EditWidgetType = FormWidgetType;
|
|
|
7
7
|
* Angular behavior: when a dataset is a non-array object (e.g. a REST API response
|
|
8
8
|
* like { users: [...], total: 100 }), return the first array-valued property as the
|
|
9
9
|
* actual row data. If the value is already an array it is returned as-is; if no
|
|
10
|
-
* array property is found (e.g. a
|
|
10
|
+
* array property is found, the object itself is a single record (e.g. a get-by-id
|
|
11
|
+
* service response) and is wrapped as a one-row array.
|
|
11
12
|
*/
|
|
12
13
|
export declare const extractDataArray: (dataset: any) => any[];
|
|
13
14
|
/**
|
|
@@ -46,6 +47,15 @@ export declare const parseTableStructureWithGroups: (children: React.ReactNode)
|
|
|
46
47
|
export declare const flattenTableStructure: (structure: TableStructureItem[]) => WmTableColumnProps[];
|
|
47
48
|
export declare const parseTableRowActions: (children: React.ReactNode) => WmTableRowActionProps[];
|
|
48
49
|
export declare const parseTableActions: (children: React.ReactNode) => WmTableActionProps[];
|
|
50
|
+
/** Resolve row-bound expansion props. Uses precomputed map first, then tableRowProps(rowData) fallback. */
|
|
51
|
+
export declare const getRowExpansionConfig: (config: WmTableRowProps | null, rowId: string, rowData?: any) => WmTableRowProps | null;
|
|
52
|
+
/**
|
|
53
|
+
* Whether the expansion column should be reserved in the table layout.
|
|
54
|
+
* When tableRowProps gates show per row (e.g. hierarchy children.length), hide the
|
|
55
|
+
* column entirely if no current row would show an expand control — avoids empty
|
|
56
|
+
* row-expansion-cell spacers for leaf-only datasets.
|
|
57
|
+
*/
|
|
58
|
+
export declare const isRowExpansionVisible: (config: WmTableRowProps | null | undefined, dataset: any[] | undefined) => boolean;
|
|
49
59
|
export declare const parseTableRowExpansion: (children: React.ReactNode) => WmTableRowProps | null;
|
|
50
60
|
export declare const isEditAction: (actionKey: string) => boolean;
|
|
51
61
|
export declare const isDeleteAction: (actionKey: string) => boolean;
|
|
@@ -95,8 +105,18 @@ export declare const INTERNAL_PROPERTIES: string[];
|
|
|
95
105
|
*/
|
|
96
106
|
export declare const cleanRowData: (data: any) => any;
|
|
97
107
|
export declare const parseWidth: (width: string | number, fallbackSize?: number) => number;
|
|
108
|
+
/**
|
|
109
|
+
* Angular datatable.js hides show:false columns via jQuery `.hide()` / `.show()`
|
|
110
|
+
* (sets element.style.display = "none"), not by removing th/td from the DOM.
|
|
111
|
+
* setColGroupWidths also hides the matching `<col>` ($headerCol.hide()).
|
|
112
|
+
*/
|
|
113
|
+
export declare function isColumnDomHidden(meta?: Record<string, unknown>): boolean;
|
|
114
|
+
/** Angular setColGroupWidths: jQuery `.hide()` plus width 0 on col for table-layout:fixed. */
|
|
115
|
+
export declare function getDomHiddenColStyle(meta?: Record<string, unknown>): CSSProperties | undefined;
|
|
116
|
+
/** Inline style for hidden th/td — display:none and zero box so flex sizing cannot leak width. */
|
|
117
|
+
export declare function getDomHiddenCellStyle(meta?: Record<string, unknown>): CSSProperties | undefined;
|
|
98
118
|
export declare const getColClass: (colClass: string, rowData: any, columnName: string) => string;
|
|
99
|
-
export { TABLE_CSS_CLASSES, TABLE_DATA_STATES, TABLE_MESSAGES, INTERACTIVE_CLASSES, INTERACTIVE_ROLES, INTERACTIVE_DATA_ROLES, INTERACTIVE_TAG_NAMES,
|
|
119
|
+
export { TABLE_CSS_CLASSES, TABLE_DATA_STATES, TABLE_MESSAGES, INTERACTIVE_CLASSES, INTERACTIVE_ROLES, INTERACTIVE_DATA_ROLES, INTERACTIVE_TAG_NAMES, UNSUPPORTED_STATE_PERSISTENCE_TYPES, } from "./constants";
|
|
100
120
|
export { renderDisplayCell } from "./renderDisplayCell";
|
|
101
121
|
export { buildSelectionColumns } from "./buildSelectionColumns";
|
|
102
122
|
export { validateField, resetValidationState, updateValidationErrors } from "./validation";
|
|
@@ -86,7 +86,7 @@ const extractDataArray = (dataset) => {
|
|
|
86
86
|
if (isArray(dataset)) return dataset;
|
|
87
87
|
if (dataset !== null && dataset !== void 0 && typeof dataset === "object") {
|
|
88
88
|
const firstArray = Object.values(dataset).find((v) => isArray(v));
|
|
89
|
-
return firstArray != null ? firstArray : [];
|
|
89
|
+
return firstArray != null ? firstArray : [dataset];
|
|
90
90
|
}
|
|
91
91
|
return [];
|
|
92
92
|
};
|
|
@@ -311,26 +311,17 @@ const flattenTableStructure = (structure) => {
|
|
|
311
311
|
});
|
|
312
312
|
return columns;
|
|
313
313
|
};
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
const actionProps = assign({}, props);
|
|
321
|
-
if (child.key) {
|
|
322
|
-
actionProps.key = child.key;
|
|
323
|
-
}
|
|
324
|
-
actions.push(actionProps);
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
return actions;
|
|
314
|
+
const isTableChildOfType = (child, namePattern, componentToken) => {
|
|
315
|
+
var _a;
|
|
316
|
+
if (!((_a = child == null ? void 0 : child.props) == null ? void 0 : _a.name)) return false;
|
|
317
|
+
const propName = child.props.name;
|
|
318
|
+
const displayName = getChildComponentDisplayName(child);
|
|
319
|
+
return propName.includes(namePattern) || displayName.includes(componentToken);
|
|
328
320
|
};
|
|
329
|
-
const
|
|
321
|
+
const parseTableChildActions = (children, namePattern, componentToken) => {
|
|
330
322
|
const actions = [];
|
|
331
323
|
React.Children.forEach(children, (child) => {
|
|
332
|
-
|
|
333
|
-
if (child && child.props && child.props.name && (child.props.name.includes("wm_table_action") || ((_a = child.type) == null ? void 0 : _a.displayName) === "WmTableAction")) {
|
|
324
|
+
if (isTableChildOfType(child, namePattern, componentToken)) {
|
|
334
325
|
const props = get(child, "props", {});
|
|
335
326
|
const actionProps = assign({}, props);
|
|
336
327
|
if (child.key) {
|
|
@@ -341,6 +332,8 @@ const parseTableActions = (children) => {
|
|
|
341
332
|
});
|
|
342
333
|
return actions;
|
|
343
334
|
};
|
|
335
|
+
const parseTableRowActions = (children) => parseTableChildActions(children, "wm_table_row_action", "WmTableRowAction");
|
|
336
|
+
const parseTableActions = (children) => parseTableChildActions(children, "wm_table_action", "WmTableAction");
|
|
344
337
|
function isTableRowComponent(child) {
|
|
345
338
|
if (!(child == null ? void 0 : child.type)) return false;
|
|
346
339
|
const name = child.type.displayName || child.type.name || "";
|
|
@@ -353,6 +346,24 @@ function isTableRowComponent(child) {
|
|
|
353
346
|
}
|
|
354
347
|
return false;
|
|
355
348
|
}
|
|
349
|
+
const getRowExpansionConfig = (config, rowId, rowData) => {
|
|
350
|
+
if (!config) return null;
|
|
351
|
+
const overrides = typeof config.tableRowProps === "function" && rowData !== void 0 ? config.tableRowProps(rowData) : {};
|
|
352
|
+
return __spreadValues(__spreadValues({}, config), overrides);
|
|
353
|
+
};
|
|
354
|
+
const isRowExpansionVisible = (config, dataset) => {
|
|
355
|
+
if (!config) return false;
|
|
356
|
+
if (typeof config.tableRowProps === "function") {
|
|
357
|
+
if (!Array.isArray(dataset) || dataset.length === 0) return false;
|
|
358
|
+
return dataset.some((row) => {
|
|
359
|
+
var _a;
|
|
360
|
+
const overrides = ((_a = config.tableRowProps) == null ? void 0 : _a.call(config, row)) || {};
|
|
361
|
+
const show = overrides.show !== void 0 ? overrides.show : config.show;
|
|
362
|
+
return show !== false;
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
return config.show !== false;
|
|
366
|
+
};
|
|
356
367
|
const parseTableRowExpansion = (children) => {
|
|
357
368
|
let rowExpansionConfig = null;
|
|
358
369
|
React.Children.forEach(children, (child) => {
|
|
@@ -570,6 +581,32 @@ const parseWidth = (width, fallbackSize = 150) => {
|
|
|
570
581
|
}
|
|
571
582
|
return columnSize;
|
|
572
583
|
};
|
|
584
|
+
function isColumnDomHidden(meta) {
|
|
585
|
+
return !!(meta == null ? void 0 : meta.domHidden);
|
|
586
|
+
}
|
|
587
|
+
function getDomHiddenColStyle(meta) {
|
|
588
|
+
if (!isColumnDomHidden(meta)) {
|
|
589
|
+
return void 0;
|
|
590
|
+
}
|
|
591
|
+
return {
|
|
592
|
+
display: "none",
|
|
593
|
+
width: 0,
|
|
594
|
+
minWidth: 0,
|
|
595
|
+
maxWidth: 0
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
function getDomHiddenCellStyle(meta) {
|
|
599
|
+
if (!isColumnDomHidden(meta)) {
|
|
600
|
+
return void 0;
|
|
601
|
+
}
|
|
602
|
+
return {
|
|
603
|
+
display: "none",
|
|
604
|
+
width: 0,
|
|
605
|
+
minWidth: 0,
|
|
606
|
+
maxWidth: 0,
|
|
607
|
+
padding: 0
|
|
608
|
+
};
|
|
609
|
+
}
|
|
573
610
|
const getColClass = (colClass, rowData, columnName) => {
|
|
574
611
|
if (!colClass || typeof colClass !== "string") {
|
|
575
612
|
return "";
|
|
@@ -611,7 +648,6 @@ import {
|
|
|
611
648
|
INTERACTIVE_ROLES,
|
|
612
649
|
INTERACTIVE_DATA_ROLES,
|
|
613
650
|
INTERACTIVE_TAG_NAMES,
|
|
614
|
-
DYNAMIC_COLUMNS_CONFIG,
|
|
615
651
|
UNSUPPORTED_STATE_PERSISTENCE_TYPES
|
|
616
652
|
} from "./constants";
|
|
617
653
|
import { renderDisplayCell } from "./renderDisplayCell";
|
|
@@ -642,7 +678,6 @@ import {
|
|
|
642
678
|
convertFilterObjectToArray
|
|
643
679
|
} from "./table-helpers";
|
|
644
680
|
export {
|
|
645
|
-
DYNAMIC_COLUMNS_CONFIG,
|
|
646
681
|
INTERACTIVE_CLASSES,
|
|
647
682
|
INTERACTIVE_DATA_ROLES,
|
|
648
683
|
INTERACTIVE_ROLES,
|
|
@@ -673,6 +708,9 @@ export {
|
|
|
673
708
|
getButtonClasses,
|
|
674
709
|
getChildComponentDisplayName,
|
|
675
710
|
getColClass,
|
|
711
|
+
getDomHiddenCellStyle,
|
|
712
|
+
getDomHiddenColStyle,
|
|
713
|
+
getRowExpansionConfig,
|
|
676
714
|
getRowIdsFromDataset,
|
|
677
715
|
getSpacingClasses,
|
|
678
716
|
getTableActionButtonClass,
|
|
@@ -683,11 +721,13 @@ export {
|
|
|
683
721
|
hasInteractiveAttributes,
|
|
684
722
|
hasInteractiveClass,
|
|
685
723
|
isAddNewAction,
|
|
724
|
+
isColumnDomHidden,
|
|
686
725
|
isColumnVisibleForViewport,
|
|
687
726
|
isDataColumn,
|
|
688
727
|
isDeleteAction,
|
|
689
728
|
isEditAction,
|
|
690
729
|
isInteractiveElement,
|
|
730
|
+
isRowExpansionVisible,
|
|
691
731
|
parseTableActions,
|
|
692
732
|
parseTableColumns,
|
|
693
733
|
parseTableRowActions,
|
|
@@ -11,6 +11,11 @@ export declare const hasInteractiveAttributes: (element: HTMLElement) => boolean
|
|
|
11
11
|
* Check if element or its ancestors are interactive
|
|
12
12
|
*/
|
|
13
13
|
export declare const isInteractiveElement: (event: React.MouseEvent) => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Widget passed to user callbacks must come from the page proxy (viewParent), which
|
|
16
|
+
* listener.onChange updates synchronously. listener.Widgets lags one React commit behind.
|
|
17
|
+
*/
|
|
18
|
+
export declare const getWidgetForCallback: (listener: any | undefined, viewParent: any | undefined, widgetKey: string) => any;
|
|
14
19
|
/**
|
|
15
20
|
* Get row IDs from dataset
|
|
16
21
|
*/
|
|
@@ -47,6 +47,10 @@ const isInteractiveElement = (event) => {
|
|
|
47
47
|
}
|
|
48
48
|
return false;
|
|
49
49
|
};
|
|
50
|
+
const getWidgetForCallback = (listener, viewParent, widgetKey) => {
|
|
51
|
+
var _a, _b, _c;
|
|
52
|
+
return (_c = (_a = viewParent == null ? void 0 : viewParent.Widgets) == null ? void 0 : _a[widgetKey]) != null ? _c : (_b = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _b[widgetKey];
|
|
53
|
+
};
|
|
50
54
|
const getRowIdsFromDataset = (dataset) => {
|
|
51
55
|
return dataset.map((row) => row._wmTableRowId || String(row.id));
|
|
52
56
|
};
|
|
@@ -103,6 +107,7 @@ const selectionStateHelpers = {
|
|
|
103
107
|
};
|
|
104
108
|
export {
|
|
105
109
|
getRowIdsFromDataset,
|
|
110
|
+
getWidgetForCallback,
|
|
106
111
|
hasInteractiveAttributes,
|
|
107
112
|
hasInteractiveClass,
|
|
108
113
|
isInteractiveElement,
|
|
@@ -18,13 +18,14 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
-
import { memo } from "react";
|
|
21
|
+
import { memo, Suspense } from "react";
|
|
22
22
|
import clsx from "clsx";
|
|
23
23
|
import withBaseWrapper from "../../../higherOrder/withBaseWrapper";
|
|
24
24
|
import Dialog from "..";
|
|
25
25
|
import BaseDialog from "../withDialogWrapper";
|
|
26
26
|
import { WmDialogHeader } from "../dialog-header";
|
|
27
27
|
import { WmDialogContent } from "../dialog-content";
|
|
28
|
+
import { WmSpinner } from "../../basic/spinner";
|
|
28
29
|
const WmDialog = memo(
|
|
29
30
|
(props) => {
|
|
30
31
|
var _a;
|
|
@@ -65,7 +66,7 @@ const WmDialog = memo(
|
|
|
65
66
|
closable: props.closable
|
|
66
67
|
}
|
|
67
68
|
),
|
|
68
|
-
props.children
|
|
69
|
+
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(WmSpinner, { show: true, name: "dialog" }), children: props.children })
|
|
69
70
|
] }))
|
|
70
71
|
})
|
|
71
72
|
);
|
|
@@ -38,7 +38,7 @@ const WmDialogHeader = (props) => {
|
|
|
38
38
|
variant,
|
|
39
39
|
id: titleid,
|
|
40
40
|
component: variant,
|
|
41
|
-
sx: { display: "flex", alignItems: "center" },
|
|
41
|
+
sx: { display: "flex", alignItems: "center", fontWeight: "bold" },
|
|
42
42
|
className: "app-dialog-title modal-title",
|
|
43
43
|
children: [
|
|
44
44
|
isDialog ? iconclass && iconclass.trim() !== "" || iconurl && iconurl !== "" ? /* @__PURE__ */ jsx(
|
|
@@ -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
|
{
|
|
@@ -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,10 +334,9 @@ 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, className), children: /* @__PURE__ */ jsxs(
|
|
337
|
+
return /* @__PURE__ */ jsx("div", { className: clsx(DEFAULT_CLASS, className), hidden: props.hidden, style: styles, children: /* @__PURE__ */ jsxs(
|
|
338
338
|
NativeSelect,
|
|
339
339
|
__spreadProps(__spreadValues({
|
|
340
|
-
hidden: props.hidden,
|
|
341
340
|
name,
|
|
342
341
|
IconComponent: () => null,
|
|
343
342
|
className: clsx(
|
|
@@ -368,8 +367,7 @@ const WmSelect = React.memo(
|
|
|
368
367
|
"aria-readonly": readonly,
|
|
369
368
|
className: `app-select ${className} ${DEFAULT_CLASS} form-control ng-valid ng-touched ng-dirty wm-app `,
|
|
370
369
|
accessKey: shortcutkey,
|
|
371
|
-
title: hint
|
|
372
|
-
style: styles
|
|
370
|
+
title: hint
|
|
373
371
|
},
|
|
374
372
|
readOnly: readonly,
|
|
375
373
|
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,11 +322,11 @@ 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
|
},
|
|
306
|
-
slots: __spreadValues({}, maxchars ? { formHelperText: TextareaCount } : {})
|
|
329
|
+
slots: __spreadValues({}, maxchars && limitdisplaytext ? { formHelperText: TextareaCount } : {})
|
|
307
330
|
}, events)
|
|
308
331
|
) });
|
|
309
332
|
},
|
|
@@ -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;
|