@wavemaker/react-runtime 11.14.3-rc.6401 → 11.15.0-1.246
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 +73 -18
- 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 +31 -11
- 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 +4 -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/repeat-template/index.js +33 -0
- package/components/container/tabs/index.js +83 -14
- package/components/container/tabs/tab-pane/index.js +33 -10
- 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 +985 -183
- 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 +67 -45
- 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 +51 -18
- 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 -52
- 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 +209 -72
- 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 +105 -32
- 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 +85 -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 +41 -3
- 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 +307 -266
- 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
|
@@ -10,17 +10,17 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _material = require("@mui/material");
|
|
13
|
-
var _reactTable = require("@tanstack/react-table");
|
|
14
13
|
var _utils = require("../utils");
|
|
15
14
|
var _RowExpansionButton = require("./RowExpansionButton");
|
|
16
|
-
var
|
|
17
|
-
|
|
15
|
+
var _isEqual = _interopRequireDefault(require("lodash-es/isEqual"));
|
|
16
|
+
var _TableDataRow = require("./TableDataRow");
|
|
17
|
+
var _excluded = ["name", "content"];
|
|
18
18
|
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); }
|
|
19
19
|
var __jsx = _react["default"].createElement;
|
|
20
20
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
21
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
22
22
|
// Constants
|
|
23
|
-
var SYSTEM_COLUMN_IDS = ["multiSelect", "radioSelect", "row-index", "actions"];
|
|
23
|
+
var SYSTEM_COLUMN_IDS = ["multiSelect", "radioSelect", "row-index", "rowIndex", "actions"];
|
|
24
24
|
var DEFAULT_EXPANSION_WIDTH = "50px";
|
|
25
25
|
var EXPANDED_ROW_BG_COLOR = "#f5f5f5";
|
|
26
26
|
var DEFAULT_CELL_PADDING = "2rem";
|
|
@@ -40,10 +40,16 @@ var EmptyRow = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
40
40
|
_ref$rowClass = _ref.rowClass,
|
|
41
41
|
rowClass = _ref$rowClass === void 0 ? "" : _ref$rowClass;
|
|
42
42
|
return __jsx(_material.TableRow, {
|
|
43
|
-
className: rowClass
|
|
43
|
+
className: rowClass,
|
|
44
|
+
role: "row",
|
|
45
|
+
tabIndex: 0,
|
|
46
|
+
"data-row-id": "empty"
|
|
44
47
|
}, __jsx(_material.TableCell, {
|
|
45
48
|
colSpan: colSpan,
|
|
46
49
|
className: "".concat(_utils.TABLE_CSS_CLASSES.tableCell, " text-center"),
|
|
50
|
+
role: "cell",
|
|
51
|
+
"data-col-id": "empty-cell",
|
|
52
|
+
tabIndex: 0,
|
|
47
53
|
style: {
|
|
48
54
|
padding: DEFAULT_CELL_PADDING
|
|
49
55
|
}
|
|
@@ -58,6 +64,9 @@ var ExpansionCell = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
|
|
|
58
64
|
config = _ref2.config;
|
|
59
65
|
return __jsx(_material.TableCell, {
|
|
60
66
|
className: "app-datagrid-cell row-expansion-cell",
|
|
67
|
+
role: "cell",
|
|
68
|
+
"data-col-id": "row-expansion",
|
|
69
|
+
tabIndex: 0,
|
|
61
70
|
style: {
|
|
62
71
|
textAlign: "center",
|
|
63
72
|
position: "relative",
|
|
@@ -96,7 +105,7 @@ var ExpandedContent = /*#__PURE__*/(0, _react.memo)(function (_ref3) {
|
|
|
96
105
|
var onLoad = function onLoad() {
|
|
97
106
|
console.log("Partial content loaded for row:", rowId);
|
|
98
107
|
};
|
|
99
|
-
return config.renderPartial(partialProps, onLoad);
|
|
108
|
+
return config.renderPartial(partialProps, onLoad, rowData);
|
|
100
109
|
}
|
|
101
110
|
if (config.children) {
|
|
102
111
|
return config.children;
|
|
@@ -106,11 +115,16 @@ var ExpandedContent = /*#__PURE__*/(0, _react.memo)(function (_ref3) {
|
|
|
106
115
|
return __jsx(_material.TableRow, {
|
|
107
116
|
className: "expanded-row-content",
|
|
108
117
|
"data-row-id": rowId,
|
|
118
|
+
role: "row",
|
|
119
|
+
tabIndex: 0,
|
|
109
120
|
style: {
|
|
110
121
|
backgroundColor: EXPANDED_ROW_BG_COLOR
|
|
111
122
|
}
|
|
112
123
|
}, __jsx(_material.TableCell, {
|
|
113
124
|
colSpan: colSpan,
|
|
125
|
+
role: "cell",
|
|
126
|
+
"data-col-id": "expanded-content",
|
|
127
|
+
tabIndex: 0,
|
|
114
128
|
style: {
|
|
115
129
|
padding: "16px",
|
|
116
130
|
borderBottom: "1px solid #e0e0e0"
|
|
@@ -171,15 +185,16 @@ var TableBodyComponentBase = function TableBodyComponentBase(_ref4) {
|
|
|
171
185
|
isRowSelected = _ref4.isRowSelected,
|
|
172
186
|
_ref4$nodatamessage = _ref4.nodatamessage,
|
|
173
187
|
nodatamessage = _ref4$nodatamessage === void 0 ? _utils.TABLE_MESSAGES.noDataMessage : _ref4$nodatamessage,
|
|
174
|
-
_ref4$loadingdatamsg = _ref4.loadingdatamsg,
|
|
175
|
-
loadingdatamsg = _ref4$loadingdatamsg === void 0 ? _utils.TABLE_MESSAGES.loadingMessage : _ref4$loadingdatamsg,
|
|
176
|
-
_ref4$isLoading = _ref4.isLoading,
|
|
177
|
-
isLoading = _ref4$isLoading === void 0 ? false : _ref4$isLoading,
|
|
178
188
|
rowExpansionConfig = _ref4.rowExpansionConfig,
|
|
179
|
-
_ref4$expandedRows = _ref4.expandedRows,
|
|
180
|
-
expandedRows = _ref4$expandedRows === void 0 ? new Set() : _ref4$expandedRows,
|
|
181
189
|
toggleRowExpansion = _ref4.toggleRowExpansion,
|
|
182
|
-
isRowExpanded = _ref4.isRowExpanded
|
|
190
|
+
isRowExpanded = _ref4.isRowExpanded,
|
|
191
|
+
ColClassSignature = _ref4.ColClassSignature,
|
|
192
|
+
rowsVersion = _ref4.rowsVersion,
|
|
193
|
+
tableData = _ref4.tableData,
|
|
194
|
+
_ref4$editingRowId = _ref4.editingRowId,
|
|
195
|
+
editingRowId = _ref4$editingRowId === void 0 ? null : _ref4$editingRowId,
|
|
196
|
+
_ref4$isAddingNewRow = _ref4.isAddingNewRow,
|
|
197
|
+
isAddingNewRow = _ref4$isAddingNewRow === void 0 ? false : _ref4$isAddingNewRow;
|
|
183
198
|
var hasExpansion = !!(rowExpansionConfig !== null && rowExpansionConfig !== void 0 && rowExpansionConfig.show && toggleRowExpansion && isRowExpanded);
|
|
184
199
|
var expansionInsertIndex = useExpansionPosition(hasExpansion, rowExpansionConfig || null, columns);
|
|
185
200
|
var totalColumns = columns.length + (hasExpansion ? 1 : 0);
|
|
@@ -194,69 +209,56 @@ var TableBodyComponentBase = function TableBodyComponentBase(_ref4) {
|
|
|
194
209
|
config: rowExpansionConfig
|
|
195
210
|
});
|
|
196
211
|
}, [hasExpansion, rowExpansionConfig, isRowExpanded, toggleRowExpansion]);
|
|
197
|
-
var renderDataRow = (0, _react.useCallback)(function (row) {
|
|
198
|
-
var rowId = row.id;
|
|
199
|
-
var isSelected = isRowSelected(rowId);
|
|
200
|
-
var isActive = isRowActive(rowId, isSelected);
|
|
201
|
-
var rowIsExpanded = (isRowExpanded === null || isRowExpanded === void 0 ? void 0 : isRowExpanded(rowId)) || false;
|
|
202
|
-
return __jsx(_react.Fragment, {
|
|
203
|
-
key: rowId
|
|
204
|
-
}, __jsx(_material.TableRow, {
|
|
205
|
-
className: "".concat(_utils.TABLE_CSS_CLASSES.tableRow, " ").concat(isActive ? "active" : "", " ").concat(rowClass),
|
|
206
|
-
onClick: function onClick(event) {
|
|
207
|
-
return onRowClick(event, row.original, rowId);
|
|
208
|
-
},
|
|
209
|
-
style: {
|
|
210
|
-
cursor: "pointer"
|
|
211
|
-
}
|
|
212
|
-
}, row.getVisibleCells().map(function (cell, cellIndex) {
|
|
213
|
-
var _cell$column$columnDe, _cell$column$columnDe2, _cell$column$columnDe3;
|
|
214
|
-
return __jsx(_react.Fragment, {
|
|
215
|
-
key: "cell-".concat(cellIndex)
|
|
216
|
-
}, hasExpansion && cellIndex === expansionInsertIndex && renderExpansionCell(rowId, row.original), __jsx(_material.TableCell, {
|
|
217
|
-
key: cell.id,
|
|
218
|
-
title: row.getValue(cell.column.id) ? String(row.getValue(cell.column.id)) : "",
|
|
219
|
-
className: "".concat(_utils.TABLE_CSS_CLASSES.tableCell, " ").concat(((_cell$column$columnDe = cell.column.columnDef.meta) === null || _cell$column$columnDe === void 0 ? void 0 : _cell$column$columnDe.className) || "").trim(),
|
|
220
|
-
style: _objectSpread({
|
|
221
|
-
width: cell.column.getSize(),
|
|
222
|
-
textAlign: (_cell$column$columnDe2 = cell.column.columnDef.meta) === null || _cell$column$columnDe2 === void 0 ? void 0 : _cell$column$columnDe2.textAlign,
|
|
223
|
-
backgroundColor: (_cell$column$columnDe3 = cell.column.columnDef.meta) === null || _cell$column$columnDe3 === void 0 ? void 0 : _cell$column$columnDe3.backgroundColor
|
|
224
|
-
}, function () {
|
|
225
|
-
var _ref5 = cell.column.columnDef.meta || {},
|
|
226
|
-
className = _ref5.className,
|
|
227
|
-
textAlign = _ref5.textAlign,
|
|
228
|
-
backgroundColor = _ref5.backgroundColor,
|
|
229
|
-
otherMeta = (0, _objectWithoutProperties2["default"])(_ref5, _excluded2);
|
|
230
|
-
return otherMeta;
|
|
231
|
-
}())
|
|
232
|
-
}, (0, _reactTable.flexRender)(cell.column.columnDef.cell, cell.getContext())));
|
|
233
|
-
})), hasExpansion && rowIsExpanded && rowExpansionConfig && __jsx(ExpandedContent, {
|
|
234
|
-
rowId: rowId,
|
|
235
|
-
rowData: row.original,
|
|
236
|
-
config: rowExpansionConfig,
|
|
237
|
-
colSpan: totalColumns
|
|
238
|
-
}));
|
|
239
|
-
}, [isRowSelected, isRowActive, rowClass, onRowClick, hasExpansion, expansionInsertIndex, renderExpansionCell, isRowExpanded, rowExpansionConfig, totalColumns]);
|
|
240
212
|
|
|
241
213
|
// Render logic
|
|
242
214
|
var renderTableContent = function renderTableContent() {
|
|
243
215
|
var rows = table.getRowModel().rows;
|
|
244
|
-
if (rows.length === 0) {
|
|
216
|
+
if (rows.length === 0 && !isAddingNewRow) {
|
|
245
217
|
return __jsx(EmptyRow, {
|
|
246
218
|
colSpan: totalColumns,
|
|
247
219
|
message: nodatamessage,
|
|
248
220
|
rowClass: rowClass
|
|
249
221
|
});
|
|
250
222
|
}
|
|
251
|
-
return rows.map(
|
|
223
|
+
return rows.map(function (row) {
|
|
224
|
+
var rowId = row.id;
|
|
225
|
+
var isSelected = isRowSelected(rowId);
|
|
226
|
+
var isActive = isRowActive(rowId, isSelected);
|
|
227
|
+
var rowIsExpanded = (isRowExpanded === null || isRowExpanded === void 0 ? void 0 : isRowExpanded(rowId)) || false;
|
|
228
|
+
var isEditingRow = editingRowId === rowId;
|
|
229
|
+
return __jsx(_TableDataRow.TableDataRow, {
|
|
230
|
+
key: rowId,
|
|
231
|
+
row: row,
|
|
232
|
+
rowId: rowId,
|
|
233
|
+
index: row.index,
|
|
234
|
+
isSelected: isSelected,
|
|
235
|
+
isActive: isActive,
|
|
236
|
+
rowIsExpanded: rowIsExpanded,
|
|
237
|
+
isEditingRow: isEditingRow,
|
|
238
|
+
hasExpansion: hasExpansion,
|
|
239
|
+
expansionInsertIndex: expansionInsertIndex,
|
|
240
|
+
renderExpansionCell: renderExpansionCell,
|
|
241
|
+
rowClass: rowClass,
|
|
242
|
+
onRowClick: onRowClick,
|
|
243
|
+
ColClassSignature: ColClassSignature || "",
|
|
244
|
+
rowsVersion: rowsVersion || 0,
|
|
245
|
+
tableData: tableData || [],
|
|
246
|
+
ExpandedContent: ExpandedContent,
|
|
247
|
+
rowExpansionConfig: rowExpansionConfig,
|
|
248
|
+
totalColumns: totalColumns
|
|
249
|
+
});
|
|
250
|
+
});
|
|
252
251
|
};
|
|
253
252
|
return __jsx(_material.TableBody, {
|
|
254
253
|
className: "app-grid-content ".concat(_utils.TABLE_CSS_CLASSES.gridBody)
|
|
255
254
|
}, formposition === "top" && renderAddNewRow(), renderTableContent(), formposition === "bottom" && renderAddNewRow());
|
|
256
255
|
};
|
|
257
256
|
var TableBodyComponent = exports.TableBodyComponent = /*#__PURE__*/(0, _react.memo)(TableBodyComponentBase, function (prev, current) {
|
|
258
|
-
var keys = ["
|
|
257
|
+
var keys = ["rowClass", "formposition", "nodatamessage", "rowsVersion", "tableData", "ColClassSignature", "activeRowIds", "selectedRowIds", "editingRowId", "table", "renderAddNewRow", "isAddingNewRow"];
|
|
259
258
|
return keys.every(function (key) {
|
|
259
|
+
if (key === "activeRowIds" || key === "selectedRowIds") {
|
|
260
|
+
return (0, _isEqual["default"])(prev[key], current[key]);
|
|
261
|
+
}
|
|
260
262
|
return prev[key] === current[key];
|
|
261
263
|
});
|
|
262
264
|
});
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.TableDataRow = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _material = require("@mui/material");
|
|
12
|
+
var _RowCells = require("./RowCells");
|
|
13
|
+
var _useEditedRows = require("../hooks/use-edited-rows");
|
|
14
|
+
var _utils = require("../utils");
|
|
15
|
+
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); }
|
|
16
|
+
var __jsx = _react["default"].createElement;
|
|
17
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
|
+
var TableDataRowComponent = function TableDataRowComponent(_ref) {
|
|
20
|
+
var row = _ref.row,
|
|
21
|
+
rowId = _ref.rowId,
|
|
22
|
+
isSelected = _ref.isSelected,
|
|
23
|
+
isActive = _ref.isActive,
|
|
24
|
+
rowIsExpanded = _ref.rowIsExpanded,
|
|
25
|
+
isEditingRow = _ref.isEditingRow,
|
|
26
|
+
hasExpansion = _ref.hasExpansion,
|
|
27
|
+
expansionInsertIndex = _ref.expansionInsertIndex,
|
|
28
|
+
renderExpansionCell = _ref.renderExpansionCell,
|
|
29
|
+
rowClass = _ref.rowClass,
|
|
30
|
+
onRowClick = _ref.onRowClick,
|
|
31
|
+
ColClassSignature = _ref.ColClassSignature,
|
|
32
|
+
rowsVersion = _ref.rowsVersion,
|
|
33
|
+
tableData = _ref.tableData,
|
|
34
|
+
ExpandedContent = _ref.ExpandedContent,
|
|
35
|
+
rowExpansionConfig = _ref.rowExpansionConfig,
|
|
36
|
+
totalColumns = _ref.totalColumns,
|
|
37
|
+
index = _ref.index;
|
|
38
|
+
// Subscribe to edits for this specific row.
|
|
39
|
+
// This hook will only trigger a re-render for THIS component if the data for this row changes.
|
|
40
|
+
var editedTableData = (0, _useEditedRows.useEditedRow)(rowId);
|
|
41
|
+
|
|
42
|
+
// Create a merged data object that proxies `getProperty` to return edited values
|
|
43
|
+
var mergedRowData = (0, _react.useMemo)(function () {
|
|
44
|
+
// If no edits, return original (ensure referential stability if possible, though row.original might change)
|
|
45
|
+
if (!editedTableData) {
|
|
46
|
+
return row.original;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Create a shallow copy first
|
|
50
|
+
// we use a safe approach: spread original, then spread edits
|
|
51
|
+
var merged = _objectSpread(_objectSpread({}, row.original), editedTableData);
|
|
52
|
+
|
|
53
|
+
// Now strict overrides for getProperty
|
|
54
|
+
// If the original data has a getProperty method (WaveMaker specific), we need to wrap it.
|
|
55
|
+
if (typeof row.original.getProperty === "function") {
|
|
56
|
+
// Define getProperty on the merged object
|
|
57
|
+
// We use Object.defineProperty to make it non-enumerable if strictness is needed, but simple assignment is usually fine.
|
|
58
|
+
merged.getProperty = function (key) {
|
|
59
|
+
// 1. Check if we have an edited value for this key
|
|
60
|
+
if (editedTableData && Object.prototype.hasOwnProperty.call(editedTableData, key)) {
|
|
61
|
+
return editedTableData[key];
|
|
62
|
+
}
|
|
63
|
+
// 2. Fallback to original getProperty
|
|
64
|
+
return row.original.getProperty(key);
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
return merged;
|
|
68
|
+
}, [row.original, editedTableData]);
|
|
69
|
+
return __jsx(_react.Fragment, {
|
|
70
|
+
key: rowId
|
|
71
|
+
}, __jsx(_material.TableRow, {
|
|
72
|
+
className: "".concat(_utils.TABLE_CSS_CLASSES.tableRow, " ").concat(isActive ? "active" : "", " ").concat(rowClass),
|
|
73
|
+
onClick: function onClick(event) {
|
|
74
|
+
return onRowClick(event, row.original, rowId);
|
|
75
|
+
},
|
|
76
|
+
"data-row-id": row.index,
|
|
77
|
+
role: "row",
|
|
78
|
+
tabIndex: 0,
|
|
79
|
+
style: {
|
|
80
|
+
cursor: "pointer"
|
|
81
|
+
},
|
|
82
|
+
"data-editing": isEditingRow
|
|
83
|
+
}, __jsx(_RowCells.RowCells, {
|
|
84
|
+
cells: row.getVisibleCells(),
|
|
85
|
+
hasExpansion: hasExpansion,
|
|
86
|
+
expansionInsertIndex: expansionInsertIndex,
|
|
87
|
+
renderExpansionCell: renderExpansionCell,
|
|
88
|
+
rowId: rowId
|
|
89
|
+
// Pass the merged data which includes the "live" edited values and the smart getProperty
|
|
90
|
+
,
|
|
91
|
+
rowData: mergedRowData,
|
|
92
|
+
ColClassSignature: ColClassSignature,
|
|
93
|
+
rowsVersion: rowsVersion,
|
|
94
|
+
tableData: tableData,
|
|
95
|
+
isEditingRow: isEditingRow,
|
|
96
|
+
isSelected: isSelected
|
|
97
|
+
})), hasExpansion && rowIsExpanded && rowExpansionConfig && __jsx(ExpandedContent, {
|
|
98
|
+
rowId: rowId,
|
|
99
|
+
rowData: row.original,
|
|
100
|
+
config: rowExpansionConfig,
|
|
101
|
+
colSpan: totalColumns
|
|
102
|
+
}));
|
|
103
|
+
};
|
|
104
|
+
var TableDataRow = exports.TableDataRow = /*#__PURE__*/(0, _react.memo)(TableDataRowComponent, function (prev, next) {
|
|
105
|
+
var keys = ["isSelected", "isActive", "rowIsExpanded", "isEditingRow", "rowClass", "ColClassSignature", "rowsVersion", "row", "index"];
|
|
106
|
+
return keys.every(function (key) {
|
|
107
|
+
return prev[key] === next[key];
|
|
108
|
+
});
|
|
109
|
+
});
|