@wavemaker/react-runtime 11.14.2-rc.6311 → 12.0.0-next.28533
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/base-action.js +5 -7
- package/actions/login-action.js +7 -8
- package/actions/logout-action.js +5 -7
- package/actions/navigation-action.js +32 -10
- package/actions/notification-action.js +22 -8
- package/actions/timer-action.js +13 -15
- package/actions/toast.js +4 -2
- package/actions/toast.service.js +1 -2
- package/components/advanced/carousel/index.js +1 -1
- package/components/advanced/carousel/template.js +1 -1
- package/components/basic/anchor/index.js +26 -9
- package/components/basic/html/index.js +115 -24
- package/components/basic/icon/index.js +2 -1
- package/components/basic/iframe/index.js +2 -1
- package/components/basic/label/index.js +12 -9
- package/components/basic/message/index.js +12 -3
- package/components/basic/picture/index.js +11 -4
- package/components/basic/progress-bar/index.js +1 -1
- package/components/basic/progress-circle/index.js +34 -28
- package/components/basic/progress-circle/props.js +10 -2
- package/components/basic/richtexteditor/index.js +95 -94
- package/components/basic/search/index.js +401 -156
- package/components/basic/search/providers.js +126 -61
- package/components/basic/spinner/index.js +2 -1
- package/components/basic/tree/index.js +34 -34
- package/components/basic/tree/utils.js +10 -4
- package/components/chart/components/barColumnChart/index.js +36 -33
- package/components/chart/components/bubbleChart/index.js +35 -25
- package/components/chart/components/chartLegend/utils.js +2 -1
- package/components/chart/components/cumulativeLineChart/index.js +30 -26
- package/components/chart/components/lineAreaChart/index.js +50 -32
- package/components/chart/components/pieDonutChart/index.js +13 -4
- package/components/chart/hooks/useXAxisConfig.js +15 -8
- package/components/chart/index.js +223 -53
- package/components/chart/utils.js +12 -1
- package/components/constants.js +5 -2
- package/components/container/accordion/accordion-pane/index.js +17 -12
- package/components/container/accordion/index.js +9 -4
- package/components/container/alignment-utils.js +56 -1
- package/components/container/index.js +49 -20
- package/components/container/panel/components/panel-header/index.js +3 -4
- package/components/container/panel/index.js +15 -10
- package/components/container/tabs/index.js +92 -14
- package/components/container/tabs/tab-pane/index.js +15 -8
- package/components/container/tabs/utils.js +51 -0
- package/components/container/wizard/components/StepComponents.js +2 -1
- package/components/container/wizard/components/WizardStep.js +2 -1
- package/components/container/wizard/index.js +64 -35
- package/components/container/wizard/utils.js +46 -1
- package/components/container/wizard/wizard-step/index.js +11 -1
- package/components/data/card/card-content/index.js +1 -1
- package/components/data/form/base-form/index.js +991 -180
- package/components/data/form/base-form/props.js +3 -1
- package/components/data/form/base-form/utils.js +159 -1
- package/components/data/form/dynamic-fields/constant.js +53 -0
- package/components/data/form/dynamic-fields/index.js +10 -45
- package/components/data/form/dynamic-fields/utils.js +37 -2
- package/components/data/form/form-action/index.js +5 -4
- package/components/data/form/form-context.js +5 -1
- package/components/data/form/form-controller/utils.js +84 -0
- package/components/data/form/form-controller/validation-contrustor.js +402 -189
- package/components/data/form/form-controller/withFormController.js +191 -52
- package/components/data/form/form-field/base-field.js +54 -33
- package/components/data/form/form-field/index.js +28 -5
- package/components/data/form/form-header/index.js +3 -4
- package/components/data/form/index.js +20 -1
- package/components/data/list/components/ListDND.js +2 -1
- package/components/data/list/components/ListItem.js +6 -2
- package/components/data/list/components/ListItemWithTemplate.js +46 -2
- package/components/data/list/components/ListItems.js +17 -26
- package/components/data/list/components/ListPagination.js +3 -3
- package/components/data/list/components/StandardListItems.js +3 -4
- package/components/data/list/hooks/useListEffects.js +55 -14
- package/components/data/list/hooks/useListEventHandlers.js +3 -1
- package/components/data/list/hooks/useListState.js +3 -1
- package/components/data/list/hooks/usePaginatedGroupedData.js +18 -5
- package/components/data/list/index.js +74 -55
- package/components/data/list/utils/list-helpers.js +73 -35
- package/components/data/list/utils/list-widget-methods.js +138 -95
- package/components/data/live-filter/index.js +26 -15
- package/components/data/live-form/index.js +23 -7
- package/components/data/live-form/props.js +1 -1
- package/components/data/pagination/components/BasicPagination.js +71 -16
- package/components/data/pagination/components/PageSizeSelector.js +8 -3
- package/components/data/pagination/components/TotalRecords.js +1 -5
- package/components/data/pagination/hooks/usePagination.js +349 -66
- package/components/data/pagination/index.js +137 -19
- package/components/data/table/components/AddNewRow.js +5 -1
- package/components/data/table/components/EditableCell.js +2 -2
- package/components/data/table/components/RowCells.js +64 -0
- package/components/data/table/components/RowExpansionButton.js +2 -2
- package/components/data/table/components/SummaryCell.js +111 -0
- package/components/data/table/components/SummaryRow.js +54 -0
- package/components/data/table/components/SummaryRowFooter.js +46 -0
- package/components/data/table/components/TableBody.js +61 -59
- package/components/data/table/components/TableDataRow.js +109 -0
- package/components/data/table/components/TableFilters.js +225 -121
- package/components/data/table/components/TableHeader.js +291 -23
- package/components/data/table/components/TablePanelHeading.js +139 -8
- package/components/data/table/components/index.js +22 -1
- package/components/data/table/hooks/use-edited-rows.js +141 -0
- package/components/data/table/hooks/useCellState.js +5 -12
- package/components/data/table/hooks/useFormWidget.js +58 -51
- package/components/data/table/hooks/usePaginationState.js +45 -24
- package/components/data/table/hooks/usePanelStructure.js +4 -4
- package/components/data/table/hooks/useRowHandlers.js +39 -5
- package/components/data/table/hooks/useRowSelection.js +244 -50
- package/components/data/table/hooks/useServerSideSorting.js +81 -37
- package/components/data/table/hooks/useTableColumns.js +211 -118
- package/components/data/table/hooks/useTableData.js +54 -9
- package/components/data/table/hooks/useTableEdit.js +272 -97
- package/components/data/table/hooks/useTableEffects.js +31 -13
- package/components/data/table/hooks/useTableFilter.js +1 -1
- package/components/data/table/hooks/useTableInitialization.js +23 -22
- package/components/data/table/hooks/useTableState.js +11 -5
- package/components/data/table/hooks/useTableStateManager.js +140 -65
- package/components/data/table/index.js +637 -274
- package/components/data/table/live-table/index.js +54 -22
- package/components/data/table/table-action/index.js +1 -1
- package/components/data/table/table-group/index.js +26 -0
- package/components/data/table/table-row-action/index.js +32 -18
- package/components/data/table/utils/buildSelectionColumns.js +12 -21
- package/components/data/table/utils/columnBuilder.js +29 -14
- package/components/data/table/utils/columnProxy.js +68 -1
- package/components/data/table/utils/constants.js +6 -2
- package/components/data/table/utils/crud-handlers.js +68 -63
- package/components/data/table/utils/groupHeaderUtils.js +102 -0
- package/components/data/table/utils/index.js +210 -21
- package/components/data/table/utils/renderDisplayCell.js +6 -6
- package/components/data/table/utils/selectionUtils.js +25 -26
- package/components/data/table/utils/validation.js +1 -0
- package/components/data/utils/filter-field-util.js +3 -3
- package/components/dialogs/alert-dialog/index.js +1 -1
- package/components/dialogs/confirm-dialog/index.js +1 -1
- package/components/dialogs/dialog/index.js +4 -1
- package/components/dialogs/dialog-content/index.js +3 -1
- package/components/dialogs/dialog-header/index.js +2 -2
- package/components/dialogs/iframe-dialog/index.js +11 -5
- package/components/dialogs/index.js +1 -1
- package/components/dialogs/login-dialog/index.js +1 -1
- package/components/dialogs/page-dialog/index.js +1 -1
- package/components/form/button/index.js +33 -7
- package/components/input/calendar/index.js +18 -6
- package/components/input/chips/index.js +99 -28
- package/components/input/chips/utils.js +34 -4
- package/components/input/color-picker/index.js +74 -25
- package/components/input/composite/index.js +3 -3
- package/components/input/currency/index.js +35 -49
- package/components/input/default/checkbox/index.js +23 -28
- package/components/input/default/checkboxset/index.js +38 -18
- package/components/input/default/checkboxset/utils.js +30 -0
- package/components/input/default/radioset/index.js +36 -39
- package/components/input/default/switch/index.js +30 -13
- package/components/input/epoch/date/index.js +130 -69
- package/components/input/epoch/date/utils.js +94 -1
- package/components/input/epoch/datetime/index.js +72 -22
- package/components/input/epoch/datetime/utils.js +49 -10
- package/components/input/epoch/time/index.js +68 -19
- package/components/input/epoch/time/utils.js +62 -14
- package/components/input/fileupload/Utils.js +12 -7
- package/components/input/fileupload/components/MultiUpload.js +2 -6
- package/components/input/fileupload/components/SingleUpload.js +3 -7
- package/components/input/fileupload/index.js +6 -10
- package/components/input/fileupload/useFileUpload.js +16 -5
- package/components/input/number/index.js +158 -43
- package/components/input/rating/index.js +90 -7
- package/components/input/select/index.js +147 -70
- package/components/input/slider/index.js +84 -26
- package/components/input/text/index.js +38 -18
- package/components/input/text/util.js +283 -130
- package/components/input/textarea/index.js +13 -10
- package/components/input/upload/index.js +124 -0
- package/components/input/upload/props.js +5 -0
- package/components/input/util/index.js +11 -0
- package/components/navbar/index.js +51 -3
- package/components/navbar/nav/index.js +46 -16
- package/components/navbar/nav-item/index.js +11 -5
- package/components/navigation/menu/components/ListItems.js +3 -0
- package/components/navigation/menu/constants.js +2 -1
- package/components/navigation/menu/hooks/useHoverState.hook.js +48 -0
- package/components/navigation/menu/hooks/useKeyboardMovements.hook.js +37 -0
- package/components/navigation/menu/hooks/useTransformedDataset.hook.js +15 -0
- package/components/navigation/menu/index.js +326 -188
- package/components/navigation/menu/utils/action-task.js +14 -0
- package/components/navigation/menu/utils/role-filter.js +76 -0
- package/components/navigation/popover/index.js +99 -26
- package/components/page/partial-container/index.js +34 -5
- package/components/prefab/index.js +2 -4
- package/context/PrefabContext.js +10 -6
- package/context/WidgetProvider.js +30 -31
- package/core/app.service.js +1 -1
- package/core/constants/events.js +57 -1
- package/core/dialog.service.js +1 -2
- package/core/event-notifier.js +1 -2
- package/core/formatter/array-formatters.js +33 -0
- package/core/formatter/date-formatters.js +2 -4
- package/core/formatter/index.js +2 -1
- package/core/formatter/number-formatters.js +5 -10
- package/core/formatter/security-formatters.js +2 -4
- package/core/formatter/string-formatters.js +3 -6
- package/core/proxy-service.js +84 -13
- package/core/script-registry.js +108 -48
- package/core/util/common.js +4 -4
- package/core/util/compare.js +30 -0
- package/core/util/dom.js +8 -8
- package/core/util/index.js +16 -6
- package/core/util/safe-is-equal.js +156 -0
- package/core/util/security.js +1 -2
- package/core/util/utils.js +16 -7
- package/higherOrder/BaseApp.js +108 -65
- package/higherOrder/BaseDateTime.js +31 -13
- package/higherOrder/BasePage.js +268 -144
- package/higherOrder/BasePartial.js +1 -1
- package/higherOrder/BasePrefab.js +33 -15
- package/higherOrder/DataNav.js +99 -16
- package/higherOrder/helper.js +5 -0
- package/higherOrder/withBaseWrapper.js +41 -28
- package/hooks/useAuth.js +11 -5
- package/hooks/useHttp.js +280 -94
- package/mui-config/theme-provider.js +1 -1
- package/mui-config/theme.js +1 -1
- package/package-lock.json +824 -724
- package/package.json +8 -8
- package/store/bindActions/i18nActions.js +18 -0
- package/store/index.js +3 -1
- package/store/slices/appConfigSlice.js +2 -2
- package/store/slices/authSlice.js +31 -28
- package/store/slices/i18nSlice.js +2 -2
- package/store/slices/navigationSlice.js +35 -0
- package/store/viewport.service.js +255 -0
- package/utils/attr.js +35 -0
- package/utils/dataset-util.js +1 -2
- package/utils/form-state.util.js +43 -12
- package/utils/form-utils.js +47 -2
- package/utils/format-util.js +28 -13
- package/utils/page-params-util.js +33 -1
- package/utils/state-persistance.js +72 -13
- package/utils/transformedDataset-utils.js +35 -24
- package/variables/base-variable.js +12 -14
- package/variables/crud-variable.js +225 -0
- package/variables/live-variable.js +56 -20
- package/variables/metadata.service.js +123 -0
- package/variables/model-variable.js +21 -15
- package/variables/service-variable.js +88 -83
|
@@ -8,9 +8,78 @@ exports.TableFilterRow = exports.GlobalSearchFilter = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _material = require("@mui/material");
|
|
10
10
|
var _lodashEs = require("lodash-es");
|
|
11
|
-
var _utils = require("
|
|
11
|
+
var _utils = require("@wavemaker/react-runtime/components/data/utils");
|
|
12
12
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
13
13
|
var __jsx = _react["default"].createElement;
|
|
14
|
+
// Constants
|
|
15
|
+
var ACTION_COLUMN_IDS = ["actions", "row-operations", "multiSelect", "radioSelect", "row-index"];
|
|
16
|
+
var DEFAULT_MATCH_MODE = "anywhereignorecase";
|
|
17
|
+
var DATA_TYPES = {
|
|
18
|
+
NUMBER: "number",
|
|
19
|
+
DATE: "date",
|
|
20
|
+
STRING: "string"
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// Menu popup styles for Bootstrap dropdown compatibility
|
|
24
|
+
var MENU_POPUP_STYLES = {
|
|
25
|
+
paper: {
|
|
26
|
+
style: {
|
|
27
|
+
zIndex: 1040,
|
|
28
|
+
background: "transparent",
|
|
29
|
+
boxShadow: "none",
|
|
30
|
+
overflow: "visible"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var MENU_LIST_STYLES = {
|
|
35
|
+
style: {
|
|
36
|
+
padding: 0
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Utility: Get data type from widget configuration
|
|
41
|
+
var getDataType = function getDataType(widgetType, editInputType) {
|
|
42
|
+
// Check edit input type first
|
|
43
|
+
if (editInputType === DATA_TYPES.NUMBER) return DATA_TYPES.NUMBER;
|
|
44
|
+
if ((0, _lodashEs.includes)(["date", "datetime-local", "time"], editInputType)) {
|
|
45
|
+
return DATA_TYPES.DATE;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Check widget type
|
|
49
|
+
if ((0, _lodashEs.includes)(["number", "currency", "integer"], widgetType)) {
|
|
50
|
+
return DATA_TYPES.NUMBER;
|
|
51
|
+
}
|
|
52
|
+
if ((0, _lodashEs.includes)(["date", "datetime", "time", "timestamp"], widgetType)) {
|
|
53
|
+
return DATA_TYPES.DATE;
|
|
54
|
+
}
|
|
55
|
+
return DATA_TYPES.STRING;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Utility: Get input group CSS class based on data type
|
|
59
|
+
var getInputGroupClass = function getInputGroupClass(dataType) {
|
|
60
|
+
switch (dataType) {
|
|
61
|
+
case DATA_TYPES.NUMBER:
|
|
62
|
+
return "input-group number input-group-sm";
|
|
63
|
+
case DATA_TYPES.DATE:
|
|
64
|
+
return "input-group date input-group-sm";
|
|
65
|
+
default:
|
|
66
|
+
return "input-group text input-group-sm";
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// Utility: Check if column should be filtered
|
|
71
|
+
var isFilterableColumn = function isFilterableColumn(column) {
|
|
72
|
+
var columnId = (0, _lodashEs.defaultTo)(column.id, column.accessorKey);
|
|
73
|
+
var isActionColumn = (0, _lodashEs.includes)(ACTION_COLUMN_IDS, columnId) || column.isRowIndex;
|
|
74
|
+
return !isActionColumn && column.enableColumnFilter !== false && !(0, _lodashEs.isEmpty)(column.accessorKey);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// Utility: Shallow comparison helper for memo
|
|
78
|
+
var shallowEqual = function shallowEqual(prev, next, keys) {
|
|
79
|
+
return keys.every(function (key) {
|
|
80
|
+
return prev[key] === next[key];
|
|
81
|
+
});
|
|
82
|
+
};
|
|
14
83
|
var GlobalSearchFilter = exports.GlobalSearchFilter = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
15
84
|
var value = _ref.value,
|
|
16
85
|
onChange = _ref.onChange,
|
|
@@ -18,7 +87,11 @@ var GlobalSearchFilter = exports.GlobalSearchFilter = /*#__PURE__*/(0, _react.me
|
|
|
18
87
|
onColumnChange = _ref.onColumnChange,
|
|
19
88
|
columns = _ref.columns,
|
|
20
89
|
_ref$searchLabel = _ref.searchLabel,
|
|
21
|
-
searchLabel = _ref$searchLabel === void 0 ? "Search" : _ref$searchLabel
|
|
90
|
+
searchLabel = _ref$searchLabel === void 0 ? "Search" : _ref$searchLabel,
|
|
91
|
+
name = _ref.name,
|
|
92
|
+
_ref$filteronkeypress = _ref.filteronkeypress,
|
|
93
|
+
filteronkeypress = _ref$filteronkeypress === void 0 ? false : _ref$filteronkeypress,
|
|
94
|
+
listener = _ref.listener;
|
|
22
95
|
// Local state for input value
|
|
23
96
|
var _useState = (0, _react.useState)(value),
|
|
24
97
|
inputValue = _useState[0],
|
|
@@ -37,27 +110,63 @@ var GlobalSearchFilter = exports.GlobalSearchFilter = /*#__PURE__*/(0, _react.me
|
|
|
37
110
|
(0, _react.useEffect)(function () {
|
|
38
111
|
setLocalSelectedColumn(selectedColumn);
|
|
39
112
|
}, [selectedColumn]);
|
|
113
|
+
var clearLocalSearchControls = (0, _react.useCallback)(function () {
|
|
114
|
+
setInputValue("");
|
|
115
|
+
setLocalSelectedColumn("");
|
|
116
|
+
}, []);
|
|
117
|
+
(0, _react.useEffect)(function () {
|
|
118
|
+
if (listener !== null && listener !== void 0 && listener.onChange && name) {
|
|
119
|
+
listener.onChange(name, {
|
|
120
|
+
clearFilter: clearLocalSearchControls
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}, [clearLocalSearchControls, name]);
|
|
40
124
|
|
|
41
|
-
// Filter
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
// Always update the value when search is triggered
|
|
48
|
-
onChange(inputValue);
|
|
125
|
+
// Filter searchable columns - memoize to prevent recalculation
|
|
126
|
+
var searchableColumns = (0, _react.useMemo)(function () {
|
|
127
|
+
return (0, _lodashEs.filter)((0, _lodashEs.defaultTo)(columns, []), function (col) {
|
|
128
|
+
return !(0, _lodashEs.isEmpty)(col === null || col === void 0 ? void 0 : col.accessorKey) && !(0, _lodashEs.includes)(ACTION_COLUMN_IDS, col === null || col === void 0 ? void 0 : col.id);
|
|
129
|
+
});
|
|
130
|
+
}, [columns]);
|
|
49
131
|
|
|
50
|
-
|
|
132
|
+
// Apply filter with current column selection
|
|
133
|
+
var applyFilter = (0, _react.useCallback)(function (value) {
|
|
134
|
+
onChange(value);
|
|
51
135
|
if (localSelectedColumn !== selectedColumn) {
|
|
52
136
|
onColumnChange(localSelectedColumn);
|
|
53
137
|
}
|
|
54
|
-
};
|
|
55
|
-
var
|
|
138
|
+
}, [onChange, onColumnChange, localSelectedColumn, selectedColumn]);
|
|
139
|
+
var handleColumnChange = (0, _react.useCallback)(function (e) {
|
|
140
|
+
var newColumn = e.target.value;
|
|
141
|
+
setLocalSelectedColumn(newColumn);
|
|
142
|
+
|
|
143
|
+
// If filteronkeypress is true, apply filter immediately when column changes
|
|
144
|
+
if (filteronkeypress && inputValue) {
|
|
145
|
+
onColumnChange(newColumn);
|
|
146
|
+
onChange(inputValue);
|
|
147
|
+
}
|
|
148
|
+
}, [filteronkeypress, inputValue, onColumnChange, onChange]);
|
|
149
|
+
var handleSearch = (0, _react.useCallback)(function () {
|
|
150
|
+
applyFilter(inputValue);
|
|
151
|
+
}, [applyFilter, inputValue]);
|
|
152
|
+
var handleInputChange = (0, _react.useCallback)(function (e) {
|
|
153
|
+
var newValue = e.target.value;
|
|
154
|
+
setInputValue(newValue);
|
|
155
|
+
|
|
156
|
+
// If filteronkeypress is true, apply filter on every keystroke
|
|
157
|
+
if (filteronkeypress) {
|
|
158
|
+
applyFilter(newValue);
|
|
159
|
+
}
|
|
160
|
+
}, [filteronkeypress, applyFilter]);
|
|
161
|
+
var handleKeyDown = (0, _react.useCallback)(function (e) {
|
|
56
162
|
if (e.key === "Enter") {
|
|
57
163
|
e.preventDefault();
|
|
58
|
-
|
|
164
|
+
// Only trigger search manually if filteronkeypress is false
|
|
165
|
+
if (!filteronkeypress) {
|
|
166
|
+
handleSearch();
|
|
167
|
+
}
|
|
59
168
|
}
|
|
60
|
-
};
|
|
169
|
+
}, [filteronkeypress, handleSearch]);
|
|
61
170
|
return __jsx(_material.Box, {
|
|
62
171
|
component: "form",
|
|
63
172
|
className: "form-search form-inline",
|
|
@@ -71,11 +180,16 @@ var GlobalSearchFilter = exports.GlobalSearchFilter = /*#__PURE__*/(0, _react.me
|
|
|
71
180
|
className: "form-control app-textbox",
|
|
72
181
|
placeholder: searchLabel,
|
|
73
182
|
value: inputValue,
|
|
74
|
-
onChange:
|
|
75
|
-
return setInputValue(e.target.value);
|
|
76
|
-
},
|
|
183
|
+
onChange: handleInputChange,
|
|
77
184
|
onKeyDown: handleKeyDown,
|
|
78
|
-
size: "small"
|
|
185
|
+
size: "small",
|
|
186
|
+
sx: {
|
|
187
|
+
"& input::placeholder": {
|
|
188
|
+
color: "text.secondary",
|
|
189
|
+
opacity: 0.7,
|
|
190
|
+
fontWeight: "normal"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
79
193
|
})), __jsx(_material.Box, {
|
|
80
194
|
className: "input-append input-group input-group-sm",
|
|
81
195
|
component: "div"
|
|
@@ -85,15 +199,13 @@ var GlobalSearchFilter = exports.GlobalSearchFilter = /*#__PURE__*/(0, _react.me
|
|
|
85
199
|
"data-element": "dgFilterValue",
|
|
86
200
|
className: "form-control app-select input-sm",
|
|
87
201
|
value: localSelectedColumn,
|
|
88
|
-
onChange:
|
|
89
|
-
return setLocalSelectedColumn(e.target.value);
|
|
90
|
-
}
|
|
202
|
+
onChange: handleColumnChange
|
|
91
203
|
}, __jsx("option", {
|
|
92
204
|
value: "",
|
|
93
205
|
className: "placeholder"
|
|
94
206
|
}, "Select Field"), (0, _lodashEs.map)(searchableColumns, function (column, index) {
|
|
95
207
|
return __jsx("option", {
|
|
96
|
-
key: column.id
|
|
208
|
+
key: (0, _lodashEs.defaultTo)(column.id, column.accessorKey),
|
|
97
209
|
value: column.accessorKey,
|
|
98
210
|
"data-coldef-index": index
|
|
99
211
|
}, column.header);
|
|
@@ -111,6 +223,8 @@ var GlobalSearchFilter = exports.GlobalSearchFilter = /*#__PURE__*/(0, _react.me
|
|
|
111
223
|
component: "i",
|
|
112
224
|
className: "wi wi-search"
|
|
113
225
|
})))));
|
|
226
|
+
}, function (prevProps, nextProps) {
|
|
227
|
+
return shallowEqual(prevProps, nextProps, ["value", "selectedColumn", "columns", "searchLabel", "name", "filteronkeypress", "onChange", "onColumnChange"]);
|
|
114
228
|
});
|
|
115
229
|
GlobalSearchFilter.displayName = "GlobalSearchFilter";
|
|
116
230
|
// Component to handle individual column filter with local state
|
|
@@ -130,110 +244,95 @@ var ColumnFilterCell = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
|
|
|
130
244
|
var _useState4 = (0, _react.useState)(null),
|
|
131
245
|
anchorEl = _useState4[0],
|
|
132
246
|
setAnchorEl = _useState4[1];
|
|
133
|
-
var _useState5 = (0, _react.useState)(
|
|
247
|
+
var _useState5 = (0, _react.useState)(DEFAULT_MATCH_MODE),
|
|
134
248
|
selectedMatchMode = _useState5[0],
|
|
135
249
|
setSelectedMatchMode = _useState5[1];
|
|
136
250
|
var filterButtonRef = (0, _react.useRef)(null);
|
|
251
|
+
|
|
252
|
+
// Sync local value with prop changes
|
|
137
253
|
(0, _react.useEffect)(function () {
|
|
138
254
|
setLocalValue(value);
|
|
139
255
|
}, [value]);
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
256
|
+
|
|
257
|
+
// Memoize data type, match modes, and CSS classes
|
|
258
|
+
var dataType = (0, _react.useMemo)(function () {
|
|
259
|
+
return getDataType(widgetType, columnMeta.editinputtype);
|
|
260
|
+
}, [widgetType, columnMeta.editinputtype]);
|
|
261
|
+
var matchModes = (0, _react.useMemo)(function () {
|
|
262
|
+
var matchModeMap = (0, _utils.getMatchModeTypesMap)();
|
|
263
|
+
return (0, _lodashEs.get)(matchModeMap, dataType, (0, _lodashEs.get)(matchModeMap, "default", []));
|
|
264
|
+
}, [dataType]);
|
|
265
|
+
var matchModeMessages = (0, _react.useMemo)(function () {
|
|
266
|
+
return (0, _utils.getMatchModeMsgs)(listener === null || listener === void 0 ? void 0 : listener.appLocale);
|
|
267
|
+
}, [listener === null || listener === void 0 ? void 0 : listener.appLocale]);
|
|
268
|
+
var inputGroupClass = (0, _react.useMemo)(function () {
|
|
269
|
+
return getInputGroupClass(dataType);
|
|
270
|
+
}, [dataType]);
|
|
271
|
+
|
|
272
|
+
// Event handlers
|
|
273
|
+
var handleApplyFilter = (0, _react.useCallback)(function (e) {
|
|
274
|
+
var inputValue = (0, _lodashEs.defaultTo)(e.target.value, localValue);
|
|
275
|
+
if (inputValue !== value) {
|
|
276
|
+
onChange(columnId, inputValue, selectedMatchMode);
|
|
144
277
|
}
|
|
145
|
-
};
|
|
146
|
-
var handleKeyDown = function
|
|
278
|
+
}, [localValue, value, columnId, selectedMatchMode, onChange]);
|
|
279
|
+
var handleKeyDown = (0, _react.useCallback)(function (e) {
|
|
147
280
|
if (e.key === "Enter") {
|
|
148
281
|
e.preventDefault();
|
|
149
|
-
handleApplyFilter();
|
|
282
|
+
handleApplyFilter(e);
|
|
150
283
|
}
|
|
151
|
-
e.stopPropagation();
|
|
152
|
-
};
|
|
153
|
-
var handleFilterIconClick = function
|
|
284
|
+
e.stopPropagation();
|
|
285
|
+
}, [handleApplyFilter]);
|
|
286
|
+
var handleFilterIconClick = (0, _react.useCallback)(function (e) {
|
|
154
287
|
e.stopPropagation();
|
|
155
288
|
setAnchorEl(filterButtonRef.current);
|
|
156
|
-
};
|
|
157
|
-
var handleClosePopover = function
|
|
289
|
+
}, []);
|
|
290
|
+
var handleClosePopover = (0, _react.useCallback)(function () {
|
|
158
291
|
setAnchorEl(null);
|
|
159
|
-
};
|
|
160
|
-
var handleMatchModeSelect = function
|
|
292
|
+
}, []);
|
|
293
|
+
var handleMatchModeSelect = (0, _react.useCallback)(function (matchMode) {
|
|
161
294
|
setSelectedMatchMode(matchMode);
|
|
162
|
-
|
|
163
|
-
onMatchModeChange(columnId, matchMode);
|
|
164
|
-
}
|
|
165
|
-
// Apply the filter with new match mode if there's a value
|
|
295
|
+
onMatchModeChange === null || onMatchModeChange === void 0 || onMatchModeChange(columnId, matchMode);
|
|
166
296
|
if (localValue) {
|
|
167
297
|
onChange(columnId, localValue, matchMode);
|
|
168
298
|
}
|
|
169
299
|
handleClosePopover();
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
// Check widget type
|
|
181
|
-
switch (widget) {
|
|
182
|
-
case "number":
|
|
183
|
-
case "currency":
|
|
184
|
-
case "integer":
|
|
185
|
-
return "number";
|
|
186
|
-
case "date":
|
|
187
|
-
case "datetime":
|
|
188
|
-
case "time":
|
|
189
|
-
case "timestamp":
|
|
190
|
-
return "date";
|
|
191
|
-
case "text":
|
|
192
|
-
case "textarea":
|
|
193
|
-
case "string":
|
|
194
|
-
default:
|
|
195
|
-
return "string";
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
// Get available match modes for the column type
|
|
200
|
-
var getMatchModes = function getMatchModes() {
|
|
201
|
-
var dataType = getDataTypeFromWidget(widgetType);
|
|
202
|
-
var matchModeMap = (0, _utils.getMatchModeTypesMap)();
|
|
203
|
-
return matchModeMap[dataType] || matchModeMap["default"] || [];
|
|
204
|
-
};
|
|
205
|
-
var matchModes = getMatchModes();
|
|
206
|
-
var matchModeMessages = (0, _utils.getMatchModeMsgs)(listener === null || listener === void 0 ? void 0 : listener.appLocale);
|
|
207
|
-
|
|
208
|
-
// Get CSS class based on widget type
|
|
209
|
-
var getInputGroupClass = function getInputGroupClass() {
|
|
210
|
-
var dataType = getDataTypeFromWidget(widgetType);
|
|
211
|
-
switch (dataType) {
|
|
212
|
-
case "number":
|
|
213
|
-
return "input-group number input-group-sm";
|
|
214
|
-
case "date":
|
|
215
|
-
return "input-group date input-group-sm";
|
|
216
|
-
default:
|
|
217
|
-
return "input-group text input-group-sm";
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
return __jsx(_material.Box, {
|
|
221
|
-
component: "div",
|
|
300
|
+
}, [columnId, localValue, onChange, onMatchModeChange, handleClosePopover]);
|
|
301
|
+
var handleClearFilterIconClick = (0, _react.useCallback)(function () {
|
|
302
|
+
onChange(columnId, "", selectedMatchMode);
|
|
303
|
+
setLocalValue("");
|
|
304
|
+
}, [columnId, selectedMatchMode, onChange]);
|
|
305
|
+
var handleLocalValueChange = (0, _react.useCallback)(function (value) {
|
|
306
|
+
setLocalValue(value);
|
|
307
|
+
}, []);
|
|
308
|
+
return __jsx("div", {
|
|
222
309
|
"data-col-identifier": columnAccessorKey,
|
|
223
|
-
className:
|
|
310
|
+
className: inputGroupClass
|
|
224
311
|
}, __jsx(_material.Box, {
|
|
312
|
+
component: "div",
|
|
313
|
+
tabIndex: 0,
|
|
225
314
|
onBlur: handleApplyFilter,
|
|
226
315
|
onKeyDown: handleKeyDown,
|
|
227
316
|
onClick: function onClick(e) {
|
|
228
317
|
return e.stopPropagation();
|
|
229
318
|
}
|
|
230
|
-
}, renderFormWidget(columnId, widgetType, localValue,
|
|
231
|
-
return setLocalValue(value);
|
|
232
|
-
}, {
|
|
319
|
+
}, renderFormWidget(columnId, widgetType, localValue, handleLocalValueChange, {
|
|
233
320
|
placeholder: "",
|
|
234
321
|
sessionKey: "filter_".concat(columnId),
|
|
235
322
|
column: columnMeta
|
|
236
|
-
})), __jsx(
|
|
323
|
+
})), __jsx("span", {
|
|
324
|
+
className: "input-group-addon filter-clear-icon"
|
|
325
|
+
}, __jsx(_material.Box, {
|
|
326
|
+
hidden: (0, _lodashEs.isEmpty)(localValue),
|
|
327
|
+
component: "button",
|
|
328
|
+
type: "button",
|
|
329
|
+
className: "btn-transparent btn app-button",
|
|
330
|
+
"aria-haspopup": "true",
|
|
331
|
+
"aria-expanded": Boolean(anchorEl),
|
|
332
|
+
onClick: handleClearFilterIconClick
|
|
333
|
+
}, __jsx("i", {
|
|
334
|
+
className: "app-icon wi wi-clear"
|
|
335
|
+
}))), __jsx(_material.Box, {
|
|
237
336
|
component: "span",
|
|
238
337
|
className: "input-group-addon"
|
|
239
338
|
}, __jsx(_material.Box, {
|
|
@@ -247,16 +346,22 @@ var ColumnFilterCell = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
|
|
|
247
346
|
}, __jsx(_material.Box, {
|
|
248
347
|
component: "i",
|
|
249
348
|
className: "app-icon wi wi-filter-list"
|
|
250
|
-
})),
|
|
251
|
-
|
|
349
|
+
})), __jsx(_material.Menu, {
|
|
350
|
+
anchorEl: anchorEl,
|
|
351
|
+
open: Boolean(anchorEl),
|
|
352
|
+
onClose: handleClosePopover,
|
|
353
|
+
anchorOrigin: {
|
|
354
|
+
vertical: "bottom",
|
|
355
|
+
horizontal: "right"
|
|
356
|
+
},
|
|
357
|
+
transformOrigin: {
|
|
358
|
+
vertical: "top",
|
|
359
|
+
horizontal: "right"
|
|
360
|
+
},
|
|
361
|
+
slotProps: MENU_POPUP_STYLES,
|
|
362
|
+
MenuListProps: MENU_LIST_STYLES
|
|
252
363
|
}, __jsx(_material.Box, {
|
|
253
|
-
className: "dropdown open show"
|
|
254
|
-
style: {
|
|
255
|
-
position: "absolute",
|
|
256
|
-
top: "100%",
|
|
257
|
-
right: 0,
|
|
258
|
-
zIndex: 1000
|
|
259
|
-
}
|
|
364
|
+
className: "dropdown open show"
|
|
260
365
|
}, __jsx(_material.Box, {
|
|
261
366
|
component: "ul",
|
|
262
367
|
className: "matchmode-dropdown dropdown-menu"
|
|
@@ -267,6 +372,7 @@ var ColumnFilterCell = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
|
|
|
267
372
|
className: selectedMatchMode === mode ? "active" : ""
|
|
268
373
|
}, __jsx(_material.Box, {
|
|
269
374
|
component: "a",
|
|
375
|
+
href: "javascript:void(0);",
|
|
270
376
|
onClick: function onClick() {
|
|
271
377
|
return handleMatchModeSelect(mode);
|
|
272
378
|
},
|
|
@@ -274,8 +380,10 @@ var ColumnFilterCell = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
|
|
|
274
380
|
cursor: "pointer",
|
|
275
381
|
textDecoration: "none"
|
|
276
382
|
}
|
|
277
|
-
}, matchModeMessages
|
|
383
|
+
}, (0, _lodashEs.get)(matchModeMessages, mode, mode)));
|
|
278
384
|
}))))));
|
|
385
|
+
}, function (prevProps, nextProps) {
|
|
386
|
+
return shallowEqual(prevProps, nextProps, ["columnId", "value", "widgetType", "columnMeta", "columnAccessorKey", "onChange", "renderFormWidget", "onMatchModeChange"]);
|
|
279
387
|
});
|
|
280
388
|
ColumnFilterCell.displayName = "ColumnFilterCell";
|
|
281
389
|
var TableFilterRow = exports.TableFilterRow = /*#__PURE__*/(0, _react.memo)(function (_ref3) {
|
|
@@ -291,28 +399,22 @@ var TableFilterRow = exports.TableFilterRow = /*#__PURE__*/(0, _react.memo)(func
|
|
|
291
399
|
return __jsx("tr", {
|
|
292
400
|
className: "table-filter-row"
|
|
293
401
|
}, (0, _lodashEs.map)(columns, function (column, index) {
|
|
294
|
-
var
|
|
295
|
-
// Use accessorKey as the column ID if id is not present
|
|
296
|
-
var columnId = column.id || column.accessorKey;
|
|
402
|
+
var columnId = (0, _lodashEs.defaultTo)(column.id, column.accessorKey);
|
|
297
403
|
|
|
298
|
-
// Skip
|
|
299
|
-
|
|
300
|
-
var isActionColumn = (0, _lodashEs.includes)(actionColumnIds, columnId) || column.isRowIndex;
|
|
301
|
-
if (isActionColumn || column.enableColumnFilter === false || !column.accessorKey) {
|
|
404
|
+
// Skip non-filterable columns
|
|
405
|
+
if (!isFilterableColumn(column)) {
|
|
302
406
|
return __jsx("th", {
|
|
303
407
|
key: columnId
|
|
304
408
|
});
|
|
305
409
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
var columnMeta = column.meta || {};
|
|
309
|
-
var widgetType = columnMeta.editWidgetType || columnMeta.widgetType || "text";
|
|
410
|
+
var columnMeta = (0, _lodashEs.defaultTo)(column.meta, {});
|
|
411
|
+
var widgetType = (0, _lodashEs.defaultTo)(columnMeta.editWidgetType, (0, _lodashEs.defaultTo)(columnMeta.widgetType, "text"));
|
|
310
412
|
return __jsx("th", {
|
|
311
413
|
key: columnId,
|
|
312
414
|
"data-col-id": index + 1
|
|
313
415
|
}, __jsx(ColumnFilterCell, {
|
|
314
416
|
columnId: columnId,
|
|
315
|
-
value: ((
|
|
417
|
+
value: (0, _lodashEs.get)(columnFilters, [columnId, "value"], ""),
|
|
316
418
|
onChange: onColumnFilterChange,
|
|
317
419
|
widgetType: widgetType,
|
|
318
420
|
columnMeta: columnMeta,
|
|
@@ -321,5 +423,7 @@ var TableFilterRow = exports.TableFilterRow = /*#__PURE__*/(0, _react.memo)(func
|
|
|
321
423
|
listener: listener
|
|
322
424
|
}));
|
|
323
425
|
}));
|
|
426
|
+
}, function (prevProps, nextProps) {
|
|
427
|
+
return shallowEqual(prevProps, nextProps, ["columns", "columnFilters", "filterMode", "onColumnFilterChange", "renderFormWidget"]);
|
|
324
428
|
});
|
|
325
429
|
TableFilterRow.displayName = "TableFilterRow";
|