@wavemaker/react-runtime 11.14.3-rc.6401 → 11.15.0-2.247
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 +423 -331
- 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
|
@@ -16,7 +16,7 @@ var _findIndex = _interopRequireDefault(require("lodash-es/findIndex"));
|
|
|
16
16
|
var _slice = _interopRequireDefault(require("lodash-es/slice"));
|
|
17
17
|
var _forEach = _interopRequireDefault(require("lodash-es/forEach"));
|
|
18
18
|
var _some = _interopRequireDefault(require("lodash-es/some"));
|
|
19
|
-
var _types = require("
|
|
19
|
+
var _types = require("@wavemaker/react-runtime/components/data/types");
|
|
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
|
// ==================== DATASOURCE UTILITIES ====================
|
|
@@ -62,17 +62,18 @@ var handleOperationResult = function handleOperationResult(operation, response,
|
|
|
62
62
|
onRowCallback = options.onRowCallback,
|
|
63
63
|
message = options.message,
|
|
64
64
|
onError = options.onError,
|
|
65
|
-
errormessage = options.errormessage
|
|
65
|
+
errormessage = options.errormessage,
|
|
66
|
+
widget = options.widget;
|
|
66
67
|
if (error) {
|
|
67
68
|
showToast === null || showToast === void 0 || showToast(error || errormessage, "Error");
|
|
68
|
-
onError === null || onError === void 0 || onError(
|
|
69
|
+
onError === null || onError === void 0 || onError(null, widget, error, operation);
|
|
69
70
|
return false;
|
|
70
71
|
}
|
|
71
72
|
if (!onRowCallback && showToast && message) {
|
|
72
73
|
showToast(message, "Success");
|
|
73
74
|
}
|
|
74
75
|
onSuccess === null || onSuccess === void 0 || onSuccess(operation, response);
|
|
75
|
-
onRowCallback === null || onRowCallback === void 0 || onRowCallback(null, response);
|
|
76
|
+
onRowCallback === null || onRowCallback === void 0 || onRowCallback(null, widget, response);
|
|
76
77
|
return true;
|
|
77
78
|
};
|
|
78
79
|
|
|
@@ -293,21 +294,23 @@ var refreshDataSource = exports.refreshDataSource = /*#__PURE__*/function () {
|
|
|
293
294
|
}();
|
|
294
295
|
var handleServerOperation = exports.handleServerOperation = /*#__PURE__*/function () {
|
|
295
296
|
var _ref6 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(options) {
|
|
296
|
-
var
|
|
297
|
+
var _listener$Widgets;
|
|
298
|
+
var datasource, binddataset, isNewRow, rowId, currentEditingData, wmTableColumns, setInternalDataset, onNewRowAdded, onRowUpdate, showToast, insertmessage, updatemessage, onRowinsert, onRowupdate, onSuccess, onError, errormessage, tableInstance, isServerSidePagination, listener, widgetName, widget, formData, response, _yield$getDatasourceI, isApiAware, currentPageNum, shouldUseServer, _datasource$paginatio4, totalElements, _datasource$paginatio5, size, lastPage, _datasource$paginatio6;
|
|
297
299
|
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
298
300
|
while (1) switch (_context5.prev = _context5.next) {
|
|
299
301
|
case 0:
|
|
300
|
-
datasource = options.datasource, binddataset = options.binddataset, isNewRow = options.isNewRow, rowId = options.rowId, currentEditingData = options.currentEditingData, wmTableColumns = options.wmTableColumns, setInternalDataset = options.setInternalDataset, onNewRowAdded = options.onNewRowAdded, onRowUpdate = options.onRowUpdate, showToast = options.showToast, insertmessage = options.insertmessage, updatemessage = options.updatemessage, onRowinsert = options.onRowinsert, onRowupdate = options.onRowupdate, onSuccess = options.onSuccess, onError = options.onError, errormessage = options.errormessage, tableInstance = options.tableInstance, isServerSidePagination = options.isServerSidePagination;
|
|
301
|
-
|
|
302
|
+
datasource = options.datasource, binddataset = options.binddataset, isNewRow = options.isNewRow, rowId = options.rowId, currentEditingData = options.currentEditingData, wmTableColumns = options.wmTableColumns, setInternalDataset = options.setInternalDataset, onNewRowAdded = options.onNewRowAdded, onRowUpdate = options.onRowUpdate, showToast = options.showToast, insertmessage = options.insertmessage, updatemessage = options.updatemessage, onRowinsert = options.onRowinsert, onRowupdate = options.onRowupdate, onSuccess = options.onSuccess, onError = options.onError, errormessage = options.errormessage, tableInstance = options.tableInstance, isServerSidePagination = options.isServerSidePagination, listener = options.listener, widgetName = options.widgetName; // Get widget reference for callbacks
|
|
303
|
+
widget = widgetName ? listener === null || listener === void 0 || (_listener$Widgets = listener.Widgets) === null || _listener$Widgets === void 0 ? void 0 : _listener$Widgets[widgetName] : undefined;
|
|
304
|
+
_context5.prev = 2;
|
|
302
305
|
formData = collectFormData(currentEditingData, wmTableColumns, isNewRow);
|
|
303
306
|
response = currentEditingData;
|
|
304
307
|
if (!datasource) {
|
|
305
308
|
_context5.next = 37;
|
|
306
309
|
break;
|
|
307
310
|
}
|
|
308
|
-
_context5.next =
|
|
311
|
+
_context5.next = 8;
|
|
309
312
|
return getDatasourceInfo(datasource);
|
|
310
|
-
case
|
|
313
|
+
case 8:
|
|
311
314
|
_yield$getDatasourceI = _context5.sent;
|
|
312
315
|
isApiAware = _yield$getDatasourceI.isApiAware;
|
|
313
316
|
currentPageNum = _yield$getDatasourceI.currentPageNum;
|
|
@@ -317,59 +320,55 @@ var handleServerOperation = exports.handleServerOperation = /*#__PURE__*/functio
|
|
|
317
320
|
break;
|
|
318
321
|
}
|
|
319
322
|
if (!(!isApiAware && binddataset)) {
|
|
320
|
-
_context5.next =
|
|
323
|
+
_context5.next = 18;
|
|
321
324
|
break;
|
|
322
325
|
}
|
|
323
|
-
_context5.next =
|
|
326
|
+
_context5.next = 16;
|
|
324
327
|
return handleNonApiAwareOperation(datasource, binddataset, formData, isNewRow ? "ADD_ITEM" : "SET_ITEM");
|
|
325
|
-
case
|
|
328
|
+
case 16:
|
|
326
329
|
_context5.next = 37;
|
|
327
330
|
break;
|
|
328
|
-
case
|
|
329
|
-
_context5.next =
|
|
331
|
+
case 18:
|
|
332
|
+
_context5.next = 20;
|
|
330
333
|
return datasource.execute(isNewRow ? _types.DataSource.Operation.INSERT_RECORD : _types.DataSource.Operation.UPDATE_RECORD, {
|
|
331
334
|
row: formData,
|
|
332
335
|
skipNotification: true
|
|
333
336
|
});
|
|
334
|
-
case
|
|
337
|
+
case 20:
|
|
335
338
|
response = _context5.sent;
|
|
336
339
|
if (!response.error) {
|
|
337
|
-
_context5.next =
|
|
340
|
+
_context5.next = 23;
|
|
338
341
|
break;
|
|
339
342
|
}
|
|
340
343
|
throw response.error;
|
|
341
|
-
case
|
|
344
|
+
case 23:
|
|
342
345
|
if (!(isNewRow && isServerSidePagination && datasource.pagination)) {
|
|
343
|
-
_context5.next =
|
|
346
|
+
_context5.next = 35;
|
|
344
347
|
break;
|
|
345
348
|
}
|
|
346
349
|
_datasource$paginatio4 = datasource.pagination, totalElements = _datasource$paginatio4.totalElements, _datasource$paginatio5 = _datasource$paginatio4.size, size = _datasource$paginatio5 === void 0 ? 10 : _datasource$paginatio5;
|
|
347
350
|
if (!(totalElements !== undefined && size > 0)) {
|
|
348
|
-
_context5.next =
|
|
351
|
+
_context5.next = 33;
|
|
349
352
|
break;
|
|
350
353
|
}
|
|
351
354
|
lastPage = Math.ceil((totalElements + 1) / size);
|
|
352
355
|
if (!(tableInstance && lastPage > currentPageNum)) {
|
|
353
|
-
_context5.next =
|
|
356
|
+
_context5.next = 31;
|
|
354
357
|
break;
|
|
355
358
|
}
|
|
356
359
|
tableInstance.setPageIndex(lastPage - 1);
|
|
357
|
-
_context5.next =
|
|
360
|
+
_context5.next = 33;
|
|
358
361
|
break;
|
|
359
|
-
case
|
|
360
|
-
_context5.next =
|
|
362
|
+
case 31:
|
|
363
|
+
_context5.next = 33;
|
|
361
364
|
return refreshDataSource(datasource, {
|
|
362
365
|
page: currentPageNum,
|
|
363
366
|
pagesize: size
|
|
364
367
|
});
|
|
365
|
-
case
|
|
368
|
+
case 33:
|
|
366
369
|
_context5.next = 37;
|
|
367
370
|
break;
|
|
368
|
-
case
|
|
369
|
-
if (!isServerSidePagination) {
|
|
370
|
-
_context5.next = 37;
|
|
371
|
-
break;
|
|
372
|
-
}
|
|
371
|
+
case 35:
|
|
373
372
|
_context5.next = 37;
|
|
374
373
|
return refreshDataSource(datasource, {
|
|
375
374
|
page: currentPageNum,
|
|
@@ -389,21 +388,23 @@ var handleServerOperation = exports.handleServerOperation = /*#__PURE__*/functio
|
|
|
389
388
|
onSuccess: onSuccess,
|
|
390
389
|
onRowCallback: isNewRow ? onRowinsert : onRowupdate,
|
|
391
390
|
message: isNewRow ? insertmessage : updatemessage,
|
|
392
|
-
onError: onError
|
|
391
|
+
onError: onError,
|
|
392
|
+
widget: widget
|
|
393
393
|
}));
|
|
394
394
|
case 41:
|
|
395
395
|
_context5.prev = 41;
|
|
396
|
-
_context5.t0 = _context5["catch"](
|
|
396
|
+
_context5.t0 = _context5["catch"](2);
|
|
397
397
|
return _context5.abrupt("return", handleOperationResult(isNewRow ? "insert" : "update", null, _context5.t0, {
|
|
398
398
|
showToast: showToast,
|
|
399
399
|
onError: onError,
|
|
400
|
-
errormessage: errormessage
|
|
400
|
+
errormessage: errormessage,
|
|
401
|
+
widget: widget
|
|
401
402
|
}));
|
|
402
403
|
case 44:
|
|
403
404
|
case "end":
|
|
404
405
|
return _context5.stop();
|
|
405
406
|
}
|
|
406
|
-
}, _callee5, null, [[
|
|
407
|
+
}, _callee5, null, [[2, 41]]);
|
|
407
408
|
}));
|
|
408
409
|
return function handleServerOperation(_x10) {
|
|
409
410
|
return _ref6.apply(this, arguments);
|
|
@@ -411,62 +412,64 @@ var handleServerOperation = exports.handleServerOperation = /*#__PURE__*/functio
|
|
|
411
412
|
}();
|
|
412
413
|
var handleDeleteOperation = exports.handleDeleteOperation = /*#__PURE__*/function () {
|
|
413
414
|
var _ref7 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee6(options) {
|
|
414
|
-
var
|
|
415
|
+
var _listener$Widgets2;
|
|
416
|
+
var rowData, tableInstance, internalDataset, setInternalDataset, datasource, binddataset, onRowDelete, showToast, deletemessage, onSuccess, onRowdelete, onError, errormessage, isServerSidePagination, listener, widgetName, widget, rowIndex, response, _yield$getDatasourceI2, isApiAware, currentPageNum, shouldUseServer, newDataset, paginationResult, _datasource$paginatio7;
|
|
415
417
|
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
416
418
|
while (1) switch (_context6.prev = _context6.next) {
|
|
417
419
|
case 0:
|
|
418
|
-
rowData = options.rowData, tableInstance = options.tableInstance, internalDataset = options.internalDataset, setInternalDataset = options.setInternalDataset, datasource = options.datasource, binddataset = options.binddataset, onRowDelete = options.onRowDelete, showToast = options.showToast, deletemessage = options.deletemessage, onSuccess = options.onSuccess, onRowdelete = options.onRowdelete, onError = options.onError, errormessage = options.errormessage, isServerSidePagination = options.isServerSidePagination;
|
|
419
|
-
|
|
420
|
+
rowData = options.rowData, tableInstance = options.tableInstance, internalDataset = options.internalDataset, setInternalDataset = options.setInternalDataset, datasource = options.datasource, binddataset = options.binddataset, onRowDelete = options.onRowDelete, showToast = options.showToast, deletemessage = options.deletemessage, onSuccess = options.onSuccess, onRowdelete = options.onRowdelete, onError = options.onError, errormessage = options.errormessage, isServerSidePagination = options.isServerSidePagination, listener = options.listener, widgetName = options.widgetName; // Get widget reference for callbacks
|
|
421
|
+
widget = widgetName ? listener === null || listener === void 0 || (_listener$Widgets2 = listener.Widgets) === null || _listener$Widgets2 === void 0 ? void 0 : _listener$Widgets2[widgetName] : undefined;
|
|
422
|
+
_context6.prev = 2;
|
|
420
423
|
// Find row first
|
|
421
424
|
rowIndex = (0, _findIndex["default"])(internalDataset, function (row) {
|
|
422
425
|
return row._wmTableRowId === rowData._wmTableRowId || row.id !== undefined && row.id === rowData.id;
|
|
423
426
|
});
|
|
424
427
|
if (!(rowIndex === -1)) {
|
|
425
|
-
_context6.next =
|
|
428
|
+
_context6.next = 7;
|
|
426
429
|
break;
|
|
427
430
|
}
|
|
428
431
|
console.warn("Row not found for deletion");
|
|
429
432
|
return _context6.abrupt("return", false);
|
|
430
|
-
case
|
|
433
|
+
case 7:
|
|
431
434
|
response = rowData; // Handle server operations first, before updating local dataset
|
|
432
435
|
if (!datasource) {
|
|
433
|
-
_context6.next =
|
|
436
|
+
_context6.next = 26;
|
|
434
437
|
break;
|
|
435
438
|
}
|
|
436
|
-
_context6.next =
|
|
439
|
+
_context6.next = 11;
|
|
437
440
|
return getDatasourceInfo(datasource);
|
|
438
|
-
case
|
|
441
|
+
case 11:
|
|
439
442
|
_yield$getDatasourceI2 = _context6.sent;
|
|
440
443
|
isApiAware = _yield$getDatasourceI2.isApiAware;
|
|
441
444
|
currentPageNum = _yield$getDatasourceI2.currentPageNum;
|
|
442
445
|
shouldUseServer = _yield$getDatasourceI2.shouldUseServer;
|
|
443
446
|
if (!shouldUseServer) {
|
|
444
|
-
_context6.next =
|
|
447
|
+
_context6.next = 26;
|
|
445
448
|
break;
|
|
446
449
|
}
|
|
447
450
|
if (!(!isApiAware && binddataset)) {
|
|
448
|
-
_context6.next =
|
|
451
|
+
_context6.next = 21;
|
|
449
452
|
break;
|
|
450
453
|
}
|
|
451
|
-
_context6.next =
|
|
454
|
+
_context6.next = 19;
|
|
452
455
|
return handleNonApiAwareOperation(datasource, binddataset, rowData, "REMOVE_ITEM");
|
|
453
|
-
case
|
|
454
|
-
_context6.next =
|
|
456
|
+
case 19:
|
|
457
|
+
_context6.next = 26;
|
|
455
458
|
break;
|
|
456
|
-
case
|
|
457
|
-
_context6.next =
|
|
459
|
+
case 21:
|
|
460
|
+
_context6.next = 23;
|
|
458
461
|
return datasource.execute(_types.DataSource.Operation.DELETE_RECORD, {
|
|
459
462
|
row: rowData,
|
|
460
463
|
skipNotification: true
|
|
461
464
|
});
|
|
462
|
-
case
|
|
465
|
+
case 23:
|
|
463
466
|
response = _context6.sent;
|
|
464
467
|
if (!response.error) {
|
|
465
|
-
_context6.next =
|
|
468
|
+
_context6.next = 26;
|
|
466
469
|
break;
|
|
467
470
|
}
|
|
468
471
|
throw response.error;
|
|
469
|
-
case
|
|
472
|
+
case 26:
|
|
470
473
|
// Only update dataset after successful server operation
|
|
471
474
|
newDataset = (0, _filter["default"])(internalDataset, function (row) {
|
|
472
475
|
return row._wmTableRowId !== rowData._wmTableRowId && (row.id === undefined || row.id !== rowData.id);
|
|
@@ -476,41 +479,43 @@ var handleDeleteOperation = exports.handleDeleteOperation = /*#__PURE__*/functio
|
|
|
476
479
|
});
|
|
477
480
|
|
|
478
481
|
// Handle pagination
|
|
479
|
-
_context6.next =
|
|
482
|
+
_context6.next = 30;
|
|
480
483
|
return adjustPaginationAfterDelete(tableInstance, internalDataset, datasource, isServerSidePagination || false);
|
|
481
|
-
case
|
|
484
|
+
case 30:
|
|
482
485
|
paginationResult = _context6.sent;
|
|
483
486
|
if (!(isServerSidePagination && paginationResult.shouldRefresh && datasource)) {
|
|
484
|
-
_context6.next =
|
|
487
|
+
_context6.next = 34;
|
|
485
488
|
break;
|
|
486
489
|
}
|
|
487
|
-
_context6.next =
|
|
490
|
+
_context6.next = 34;
|
|
488
491
|
return datasource.invoke({
|
|
489
492
|
page: paginationResult.targetPage,
|
|
490
493
|
pagesize: ((_datasource$paginatio7 = datasource.pagination) === null || _datasource$paginatio7 === void 0 ? void 0 : _datasource$paginatio7.size) || 10
|
|
491
494
|
});
|
|
492
|
-
case
|
|
495
|
+
case 34:
|
|
493
496
|
onRowDelete === null || onRowDelete === void 0 || onRowDelete(rowData, rowIndex, newDataset);
|
|
494
497
|
return _context6.abrupt("return", handleOperationResult("delete", response, null, {
|
|
495
498
|
showToast: showToast,
|
|
496
499
|
onSuccess: onSuccess,
|
|
497
500
|
onRowCallback: onRowdelete,
|
|
498
501
|
message: deletemessage,
|
|
499
|
-
onError: onError
|
|
502
|
+
onError: onError,
|
|
503
|
+
widget: widget
|
|
500
504
|
}));
|
|
501
|
-
case
|
|
502
|
-
_context6.prev =
|
|
503
|
-
_context6.t0 = _context6["catch"](
|
|
505
|
+
case 38:
|
|
506
|
+
_context6.prev = 38;
|
|
507
|
+
_context6.t0 = _context6["catch"](2);
|
|
504
508
|
return _context6.abrupt("return", handleOperationResult("delete", null, _context6.t0, {
|
|
505
509
|
showToast: showToast,
|
|
506
510
|
onError: onError,
|
|
507
|
-
errormessage: errormessage
|
|
511
|
+
errormessage: errormessage,
|
|
512
|
+
widget: widget
|
|
508
513
|
}));
|
|
509
|
-
case
|
|
514
|
+
case 41:
|
|
510
515
|
case "end":
|
|
511
516
|
return _context6.stop();
|
|
512
517
|
}
|
|
513
|
-
}, _callee6, null, [[
|
|
518
|
+
}, _callee6, null, [[2, 38]]);
|
|
514
519
|
}));
|
|
515
520
|
return function handleDeleteOperation(_x11) {
|
|
516
521
|
return _ref7.apply(this, arguments);
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.hasTableGroups = exports.generateHeaderRows = exports.calculateMaxDepth = exports.calculateColspan = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Calculate the colspan for a group based on visible child columns
|
|
9
|
+
*/
|
|
10
|
+
var calculateColspan = exports.calculateColspan = function calculateColspan(group) {
|
|
11
|
+
var _countVisibleColumns = function countVisibleColumns(items) {
|
|
12
|
+
var count = 0;
|
|
13
|
+
items.forEach(function (item) {
|
|
14
|
+
if ("isGroup" in item && item.isGroup) {
|
|
15
|
+
// Recursively count columns in nested groups
|
|
16
|
+
count += _countVisibleColumns(item.columns);
|
|
17
|
+
} else {
|
|
18
|
+
// It's a column - check if it's visible
|
|
19
|
+
var column = item;
|
|
20
|
+
if (column.show !== false) {
|
|
21
|
+
count++;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return count;
|
|
26
|
+
};
|
|
27
|
+
var colspan = _countVisibleColumns(group.columns);
|
|
28
|
+
return colspan || 1; // Return at least 1 to avoid invalid colspan
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Calculate the maximum depth of the hierarchical structure
|
|
33
|
+
*/
|
|
34
|
+
var _calculateMaxDepth = exports.calculateMaxDepth = function calculateMaxDepth(structure) {
|
|
35
|
+
var maxDepth = 1;
|
|
36
|
+
structure.forEach(function (item) {
|
|
37
|
+
if ("isGroup" in item && item.isGroup) {
|
|
38
|
+
var groupDepth = 1 + _calculateMaxDepth(item.columns);
|
|
39
|
+
maxDepth = Math.max(maxDepth, groupDepth);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return maxDepth;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Generate header rows with proper colspan and rowspan values
|
|
47
|
+
*/
|
|
48
|
+
var generateHeaderRows = exports.generateHeaderRows = function generateHeaderRows(structure, maxDepth) {
|
|
49
|
+
var headerRows = [];
|
|
50
|
+
|
|
51
|
+
// Initialize empty rows
|
|
52
|
+
for (var i = 0; i < maxDepth; i++) {
|
|
53
|
+
headerRows.push([]);
|
|
54
|
+
}
|
|
55
|
+
var _processStructure = function processStructure(items) {
|
|
56
|
+
var currentLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
57
|
+
items.forEach(function (item) {
|
|
58
|
+
if ("isGroup" in item && item.isGroup) {
|
|
59
|
+
// It's a group - add to current level with colspan
|
|
60
|
+
var groupItem = item;
|
|
61
|
+
var colspan = calculateColspan(groupItem);
|
|
62
|
+
headerRows[currentLevel].push({
|
|
63
|
+
isGroup: true,
|
|
64
|
+
field: groupItem.field,
|
|
65
|
+
displayName: groupItem.displayName || "",
|
|
66
|
+
colspan: colspan,
|
|
67
|
+
textAlignment: groupItem.textAlignment,
|
|
68
|
+
backgroundColor: groupItem.backgroundColor,
|
|
69
|
+
"class": groupItem["class"],
|
|
70
|
+
colClass: groupItem.colClass,
|
|
71
|
+
styles: groupItem.styles
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// Process children at next level
|
|
75
|
+
_processStructure(groupItem.columns, currentLevel + 1);
|
|
76
|
+
} else {
|
|
77
|
+
// It's a column - add with rowspan to reach bottom
|
|
78
|
+
var column = item;
|
|
79
|
+
if (column.show !== false) {
|
|
80
|
+
var rowspan = maxDepth - currentLevel;
|
|
81
|
+
headerRows[currentLevel].push({
|
|
82
|
+
isGroup: false,
|
|
83
|
+
field: column.field || column.binding || "",
|
|
84
|
+
displayName: column.caption || column.displayName || "",
|
|
85
|
+
rowspan: rowspan,
|
|
86
|
+
column: column
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
_processStructure(structure);
|
|
93
|
+
return headerRows;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Check if the table has any groups
|
|
97
|
+
*/
|
|
98
|
+
var hasTableGroups = exports.hasTableGroups = function hasTableGroups(structure) {
|
|
99
|
+
return structure.some(function (item) {
|
|
100
|
+
return "isGroup" in item && item.isGroup;
|
|
101
|
+
});
|
|
102
|
+
};
|