@sankhyalabs/sankhyablocks 0.0.0-feat-dev-KB-66041.0 → 0.0.0-feat-dev-KB-66041.1
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/dist/cjs/snk-crud.cjs.entry.js +13 -13
- package/dist/cjs/snk-data-exporter.cjs.entry.js +1 -1
- package/dist/cjs/{snk-data-unit-6d05bccc.js → snk-data-unit-5dab454d.js} +15 -12
- package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
- package/dist/cjs/snk-detail-view.cjs.entry.js +1 -1
- package/dist/cjs/{snk-guides-viewer-f7e792de.js → snk-guides-viewer-63b66ca9.js} +42 -36
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +25 -12
- package/dist/collection/components/snk-crud/snk-crud.js +13 -13
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +42 -36
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +15 -12
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +25 -12
- package/dist/components/snk-crud.js +13 -13
- package/dist/components/snk-data-unit2.js +15 -12
- package/dist/components/snk-detail-view2.js +42 -36
- package/dist/components/snk-simple-crud2.js +25 -12
- package/dist/esm/snk-crud.entry.js +13 -13
- package/dist/esm/snk-data-exporter.entry.js +1 -1
- package/dist/esm/{snk-data-unit-e54e7e4d.js → snk-data-unit-a0c95e1a.js} +15 -12
- package/dist/esm/snk-data-unit.entry.js +1 -1
- package/dist/esm/snk-detail-view.entry.js +1 -1
- package/dist/esm/{snk-guides-viewer-e06c45fa.js → snk-guides-viewer-d8b31204.js} +42 -36
- package/dist/esm/snk-guides-viewer.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +25 -12
- package/dist/sankhyablocks/p-342d0405.entry.js +1 -0
- package/dist/sankhyablocks/{p-e8f138b3.entry.js → p-3f866fc5.entry.js} +1 -1
- package/dist/sankhyablocks/{p-2c01d147.entry.js → p-8adb1e06.entry.js} +1 -1
- package/dist/sankhyablocks/p-a519568d.js +1 -0
- package/dist/sankhyablocks/p-a52d6be6.entry.js +1 -0
- package/dist/sankhyablocks/{p-e7f7d2aa.entry.js → p-c5062d5a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-c7a971ab.entry.js → p-c6220097.entry.js} +1 -1
- package/dist/sankhyablocks/p-edbb3358.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +1 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +2 -2
- package/package.json +1 -1
- package/dist/sankhyablocks/p-0c511783.js +0 -1
- package/dist/sankhyablocks/p-31bce3b4.entry.js +0 -1
- package/dist/sankhyablocks/p-87c8a024.entry.js +0 -1
- package/dist/sankhyablocks/p-f13f32c8.js +0 -1
|
@@ -154,20 +154,20 @@ const SnkCrud = class {
|
|
|
154
154
|
this.setViewMode(constants.VIEW_MODE.FORM);
|
|
155
155
|
}
|
|
156
156
|
async executeAction(act) {
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
switch (act) {
|
|
158
|
+
case taskbarElements.TaskbarElement.GRID_MODE:
|
|
159
|
+
return this.setViewMode(constants.VIEW_MODE.GRID);
|
|
160
|
+
case taskbarElements.TaskbarElement.FORM_MODE:
|
|
161
|
+
case taskbarElements.TaskbarElement.UPDATE:
|
|
162
|
+
return this.gridToForm(act !== taskbarElements.TaskbarElement.UPDATE);
|
|
163
|
+
case taskbarElements.TaskbarElement.UPDATE_MULTIPLE:
|
|
164
|
+
this._dataUnit.isMultipleEdition = true;
|
|
165
|
+
return this.setViewMode(constants.VIEW_MODE.FORM);
|
|
166
|
+
case taskbarElements.TaskbarElement.CONFIGURATOR:
|
|
167
|
+
return this._snkConfigurator.open();
|
|
168
|
+
case taskbarElements.TaskbarElement.ATTACH:
|
|
169
|
+
return this.setViewMode(constants.VIEW_MODE.ATTACHMENT);
|
|
159
170
|
}
|
|
160
|
-
if (act === taskbarElements.TaskbarElement.FORM_MODE || act === taskbarElements.TaskbarElement.UPDATE) {
|
|
161
|
-
return this.gridToForm(act !== taskbarElements.TaskbarElement.UPDATE);
|
|
162
|
-
}
|
|
163
|
-
if (act === taskbarElements.TaskbarElement.UPDATE_MULTIPLE) {
|
|
164
|
-
this._dataUnit.isMultipleEdition = true;
|
|
165
|
-
return this.setViewMode(constants.VIEW_MODE.FORM);
|
|
166
|
-
}
|
|
167
|
-
if (act === taskbarElements.TaskbarElement.CONFIGURATOR)
|
|
168
|
-
return this._snkConfigurator.open();
|
|
169
|
-
if (act === taskbarElements.TaskbarElement.ATTACH)
|
|
170
|
-
return this.setViewMode(constants.VIEW_MODE.ATTACHMENT);
|
|
171
171
|
}
|
|
172
172
|
backView() {
|
|
173
173
|
const lastView = this._viewHistory.at(-2) || constants.VIEW_MODE.GRID;
|
|
@@ -9,7 +9,7 @@ const IFetchDataExporterParams = require('./IFetchDataExporterParams-e78ec415.js
|
|
|
9
9
|
const index = require('./index-e3e39724.js');
|
|
10
10
|
const constants = require('./constants-241934b3.js');
|
|
11
11
|
const DataFetcher = require('./DataFetcher-875371e9.js');
|
|
12
|
-
const snkDataUnit = require('./snk-data-unit-
|
|
12
|
+
const snkDataUnit = require('./snk-data-unit-5dab454d.js');
|
|
13
13
|
require('./ISave-62fbb1dd.js');
|
|
14
14
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
15
15
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
@@ -397,18 +397,7 @@ const SnkDataUnit = class {
|
|
|
397
397
|
}
|
|
398
398
|
async interceptSavingData(action) {
|
|
399
399
|
if (this.dataUnit.isMultipleEdition) {
|
|
400
|
-
const
|
|
401
|
-
const title = this.getMessage("snkDataUnit.multipleUpdateConfirmationTitle");
|
|
402
|
-
const message = this.getMessage("snkDataUnit.multipleUpdateConfirmationMessage", { size: selectedRecords.length });
|
|
403
|
-
const labelBtnCancel = this.getMessage("snkDataUnit.confirm.cancel");
|
|
404
|
-
const labelBtnConfirm = this.getMessage("snkDataUnit.confirm.updateMultipleConfirm");
|
|
405
|
-
const confirm = await showConfirmMultipleUpdatePopup({
|
|
406
|
-
title,
|
|
407
|
-
message,
|
|
408
|
-
labelBtnConfirm,
|
|
409
|
-
labelBtnCancel,
|
|
410
|
-
changingFields: this.getChangingFields()
|
|
411
|
-
});
|
|
400
|
+
const confirm = await this.confirmMultipleSavingData();
|
|
412
401
|
if (!confirm)
|
|
413
402
|
return undefined;
|
|
414
403
|
}
|
|
@@ -421,6 +410,20 @@ const SnkDataUnit = class {
|
|
|
421
410
|
}
|
|
422
411
|
return continueAction ? action : undefined;
|
|
423
412
|
}
|
|
413
|
+
async confirmMultipleSavingData() {
|
|
414
|
+
const selectedRecords = this.dataUnit.getSelectionInfo().records;
|
|
415
|
+
const title = this.getMessage('snkDataUnit.multipleUpdateConfirmationTitle');
|
|
416
|
+
const message = this.getMessage('snkDataUnit.multipleUpdateConfirmationMessage', { size: selectedRecords.length });
|
|
417
|
+
const labelBtnCancel = this.getMessage('snkDataUnit.confirm.cancel');
|
|
418
|
+
const labelBtnConfirm = this.getMessage('snkDataUnit.confirm.updateMultipleConfirm');
|
|
419
|
+
return await showConfirmMultipleUpdatePopup({
|
|
420
|
+
title,
|
|
421
|
+
message,
|
|
422
|
+
labelBtnConfirm,
|
|
423
|
+
labelBtnCancel,
|
|
424
|
+
changingFields: this.getChangingFields(),
|
|
425
|
+
});
|
|
426
|
+
}
|
|
424
427
|
getChangingFields() {
|
|
425
428
|
const changes = this.dataUnit.buildChangesToSave();
|
|
426
429
|
if (!(changes === null || changes === void 0 ? void 0 : changes.length))
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const snkDataUnit = require('./snk-data-unit-
|
|
5
|
+
const snkDataUnit = require('./snk-data-unit-5dab454d.js');
|
|
6
6
|
require('./index-f9e81701.js');
|
|
7
7
|
require('@sankhyalabs/core');
|
|
8
8
|
require('@sankhyalabs/ezui/dist/collection/utils');
|
|
@@ -16,7 +16,7 @@ require('./filter-item-type.enum-a7ffdaa6.js');
|
|
|
16
16
|
require('./form-config-fetcher-db332748.js');
|
|
17
17
|
const constants = require('./constants-241934b3.js');
|
|
18
18
|
const taskbarElements = require('./taskbar-elements-02379452.js');
|
|
19
|
-
const snkGuidesViewer = require('./snk-guides-viewer-
|
|
19
|
+
const snkGuidesViewer = require('./snk-guides-viewer-63b66ca9.js');
|
|
20
20
|
const SnkMessageBuilder = require('./SnkMessageBuilder-aecd7c18.js');
|
|
21
21
|
require('./ConfigStorage-2235f35e.js');
|
|
22
22
|
require('./PrintUtils-bcaeb82f.js');
|
|
@@ -205,18 +205,20 @@ const SnkGuidesViewer = class {
|
|
|
205
205
|
}
|
|
206
206
|
getTaskBarId() {
|
|
207
207
|
var _a;
|
|
208
|
-
if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty)
|
|
209
|
-
return
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
208
|
+
if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
|
|
209
|
+
return TASKBAR_ID.FINISH_EDITION;
|
|
210
|
+
}
|
|
211
|
+
if (this.dataUnit.isMultipleEdition) {
|
|
212
|
+
return TASKBAR_ID.MUTIPLE_EDITION;
|
|
213
|
+
}
|
|
214
|
+
return TASKBAR_ID.REGULAR;
|
|
213
215
|
}
|
|
214
216
|
loadTaskbarProcessor() {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
217
|
+
const taskbarIDs = {};
|
|
218
|
+
taskbarIDs[TASKBAR_ID.REGULAR] = this.buildBtnsRegularMode();
|
|
219
|
+
taskbarIDs[TASKBAR_ID.FINISH_EDITION] = [taskbarElements.TaskbarElement.CANCEL, taskbarElements.TaskbarElement.SAVE, this.handleAddGridMode()];
|
|
220
|
+
taskbarIDs[TASKBAR_ID.MUTIPLE_EDITION] = [taskbarElements.TaskbarElement.CANCEL];
|
|
221
|
+
this._taskbarProcessor = new fieldSearch.TaskbarProcessor(taskbarIDs);
|
|
220
222
|
this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, this.buildDisabledButtons(), this.buildInvisibleButtons());
|
|
221
223
|
}
|
|
222
224
|
buildBtnsRegularMode() {
|
|
@@ -472,22 +474,23 @@ const SnkGuidesViewer = class {
|
|
|
472
474
|
}
|
|
473
475
|
async dataUnitActionHandler(action) {
|
|
474
476
|
var _a;
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
this.dataUnit.isMultipleEdition
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
477
|
+
switch (action.type) {
|
|
478
|
+
case core.Action.EDITION_CANCELED:
|
|
479
|
+
case core.Action.DATA_SAVED:
|
|
480
|
+
if (this.dataUnit.isMultipleEdition) {
|
|
481
|
+
this.exitViewer();
|
|
482
|
+
this.dataUnit.isMultipleEdition = false;
|
|
483
|
+
}
|
|
484
|
+
break;
|
|
485
|
+
case core.Action.FIELD_INVALIDATED:
|
|
486
|
+
const guideName = this.getGuideName((_a = action.payload) === null || _a === void 0 ? void 0 : _a.fieldName);
|
|
487
|
+
await this.addErrorBadgeToGuide(guideName);
|
|
488
|
+
await this.openGuideNavigator(guideName);
|
|
489
|
+
break;
|
|
490
|
+
case core.Action.METADATA_LOADED:
|
|
491
|
+
case core.Action.MULTIPLE_EDITION_CHANGED:
|
|
492
|
+
this.loadGuides(this.noGuideSelected());
|
|
493
|
+
break;
|
|
491
494
|
}
|
|
492
495
|
}
|
|
493
496
|
async addErrorBadgeToGuide(guideName) {
|
|
@@ -533,16 +536,13 @@ const SnkGuidesViewer = class {
|
|
|
533
536
|
return this.buildRecordIdsArray();
|
|
534
537
|
}
|
|
535
538
|
buildRecordIdsArray() {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
selectedRecords.
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
});
|
|
544
|
-
label = label + "]";
|
|
545
|
-
return label;
|
|
539
|
+
var _a, _b;
|
|
540
|
+
const selectedRecords = (_b = (_a = this.dataUnit.getSelectionInfo()) === null || _a === void 0 ? void 0 : _a.records) !== null && _b !== void 0 ? _b : [];
|
|
541
|
+
if (selectedRecords.length === 0) {
|
|
542
|
+
return "[]";
|
|
543
|
+
}
|
|
544
|
+
const labels = selectedRecords.map(record => this.messagesBuilder.getMessage("snkCrud.title", record));
|
|
545
|
+
return `[${labels.join(", ")}]`;
|
|
546
546
|
}
|
|
547
547
|
componentDidLoad() {
|
|
548
548
|
this.dataUnit.subscribe(this.dataUnitActionHandler.bind(this));
|
|
@@ -579,6 +579,12 @@ const SnkGuidesViewer = class {
|
|
|
579
579
|
"masterFormConfig": ["observeMasterFormConfig"]
|
|
580
580
|
}; }
|
|
581
581
|
};
|
|
582
|
+
var TASKBAR_ID;
|
|
583
|
+
(function (TASKBAR_ID) {
|
|
584
|
+
TASKBAR_ID["FINISH_EDITION"] = "snkGuideViewer.finish_edition";
|
|
585
|
+
TASKBAR_ID["MUTIPLE_EDITION"] = "snkGuideViewer.multiple_edition";
|
|
586
|
+
TASKBAR_ID["REGULAR"] = "snkGuideViewer.regular";
|
|
587
|
+
})(TASKBAR_ID || (TASKBAR_ID = {}));
|
|
582
588
|
SnkGuidesViewer.style = snkGuidesViewerCss;
|
|
583
589
|
|
|
584
590
|
exports.SnkGuidesViewer = SnkGuidesViewer;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const snkGuidesViewer = require('./snk-guides-viewer-
|
|
5
|
+
const snkGuidesViewer = require('./snk-guides-viewer-63b66ca9.js');
|
|
6
6
|
require('./index-f9e81701.js');
|
|
7
7
|
require('@sankhyalabs/core');
|
|
8
8
|
require('./SnkFormConfigManager-6637cd6b.js');
|
|
@@ -47,14 +47,6 @@ const SnkSimpleCrud = class {
|
|
|
47
47
|
this._formConfigFetcher = new formConfigFetcher.FormConfigFetcher();
|
|
48
48
|
this._customEditors = new Map();
|
|
49
49
|
this._customRenders = new Map();
|
|
50
|
-
this._taskbarProcessor = new fieldSearch.TaskbarProcessor({
|
|
51
|
-
"snkSimpleCrudTaskbar.form_regular": this.getButtons(false, [taskbarElements.TaskbarElement.GRID_MODE], true),
|
|
52
|
-
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, [taskbarElements.TaskbarElement.DATA_EXPORTER, taskbarElements.TaskbarElement.FORM_MODE]),
|
|
53
|
-
"snkSimpleCrudTaskbar.form_selected": this.getButtons(true, [taskbarElements.TaskbarElement.GRID_MODE], true),
|
|
54
|
-
"snkSimpleCrudTaskbar.grid_selected": this.getGridSelectedButtonsCallBack.bind(this),
|
|
55
|
-
"snkSimpleCrudTaskbar.finish_edition": this.getFinishEditionButtonsCallback.bind(this),
|
|
56
|
-
"snkSimpleCrudTaskbar.multiple_edition": [taskbarElements.TaskbarElement.CANCEL]
|
|
57
|
-
});
|
|
58
50
|
this._showPopUpGridConfig = false;
|
|
59
51
|
this._currentViewMode = constants.VIEW_MODE.GRID;
|
|
60
52
|
this._config = undefined;
|
|
@@ -148,6 +140,16 @@ const SnkSimpleCrud = class {
|
|
|
148
140
|
newCustomFieldProps.set(fieldName, Object.assign(Object.assign({}, currentProps), { [propName]: value }));
|
|
149
141
|
this._fieldsProps = newCustomFieldProps;
|
|
150
142
|
}
|
|
143
|
+
loadTaskbarProcessor() {
|
|
144
|
+
const taskbarIDs = {};
|
|
145
|
+
taskbarIDs[TASKBAR_ID.FORM_REGULAR] = this.getButtons(false, [taskbarElements.TaskbarElement.GRID_MODE], true);
|
|
146
|
+
taskbarIDs[TASKBAR_ID.GRID_REGULAR] = this.getButtons(false, [taskbarElements.TaskbarElement.DATA_EXPORTER, taskbarElements.TaskbarElement.FORM_MODE]);
|
|
147
|
+
taskbarIDs[TASKBAR_ID.FORM_SELECTED] = this.getButtons(true, [taskbarElements.TaskbarElement.GRID_MODE], true);
|
|
148
|
+
taskbarIDs[TASKBAR_ID.GRID_SELECTED] = this.getGridSelectedButtonsCallBack.bind(this);
|
|
149
|
+
taskbarIDs[TASKBAR_ID.FINISH_EDITION] = this.getFinishEditionButtonsCallback.bind(this);
|
|
150
|
+
taskbarIDs[TASKBAR_ID.MULTIPLE_EDITION] = [taskbarElements.TaskbarElement.CANCEL];
|
|
151
|
+
this._taskbarProcessor = new fieldSearch.TaskbarProcessor(taskbarIDs);
|
|
152
|
+
}
|
|
151
153
|
getGridSelectedButtonsCallBack() {
|
|
152
154
|
var _a, _b, _c;
|
|
153
155
|
if (!this.multipleEditionEnabled || ((_c = (_b = (_a = this.dataState) === null || _a === void 0 ? void 0 : _a.selectionInfo) === null || _b === void 0 ? void 0 : _b.records) === null || _c === void 0 ? void 0 : _c.length) === 1) {
|
|
@@ -349,8 +351,10 @@ const SnkSimpleCrud = class {
|
|
|
349
351
|
this.setFormConfig(await this._formConfigManager.loadConfig());
|
|
350
352
|
}
|
|
351
353
|
async componentWillRender() {
|
|
354
|
+
this.loadTaskbarProcessor();
|
|
352
355
|
this._resourceID = await this.application.getResourceID();
|
|
353
356
|
this.dataExporterProviderStore();
|
|
357
|
+
this.dataExporterProviderStore();
|
|
354
358
|
this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, this.getTaskBarDisabledButtons());
|
|
355
359
|
if (this.configName === undefined) {
|
|
356
360
|
return;
|
|
@@ -428,17 +432,17 @@ const SnkSimpleCrud = class {
|
|
|
428
432
|
getTaskBarId() {
|
|
429
433
|
var _a, _b;
|
|
430
434
|
if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
|
|
431
|
-
return
|
|
435
|
+
return TASKBAR_ID.FINISH_EDITION;
|
|
432
436
|
}
|
|
433
437
|
if (this.dataUnit.isMultipleEdition) {
|
|
434
|
-
return
|
|
438
|
+
return TASKBAR_ID.MULTIPLE_EDITION;
|
|
435
439
|
}
|
|
436
440
|
if (((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.selectionInfo) &&
|
|
437
441
|
!this.dataState.selectionInfo.isAllRecords() &&
|
|
438
442
|
this.dataState.selectionInfo.length > 0) {
|
|
439
|
-
return this._currentViewMode === constants.VIEW_MODE.GRID ?
|
|
443
|
+
return this._currentViewMode === constants.VIEW_MODE.GRID ? TASKBAR_ID.GRID_SELECTED : TASKBAR_ID.FORM_SELECTED;
|
|
440
444
|
}
|
|
441
|
-
return this._currentViewMode === constants.VIEW_MODE.GRID ?
|
|
445
|
+
return this._currentViewMode === constants.VIEW_MODE.GRID ? TASKBAR_ID.GRID_REGULAR : TASKBAR_ID.FORM_REGULAR;
|
|
442
446
|
}
|
|
443
447
|
initInMemoryDataUnit() {
|
|
444
448
|
this._inMemoryLoader = new dataunitFetcher.InMemoryLoader(this._metadata, undefined, { autoLoad: this.autoLoad });
|
|
@@ -821,6 +825,15 @@ const SnkSimpleCrud = class {
|
|
|
821
825
|
"gridLegacyConfigName": ["observeGridLegacy"]
|
|
822
826
|
}; }
|
|
823
827
|
};
|
|
828
|
+
var TASKBAR_ID;
|
|
829
|
+
(function (TASKBAR_ID) {
|
|
830
|
+
TASKBAR_ID["FORM_REGULAR"] = "snkSimpleCrudTaskbar.form_regular";
|
|
831
|
+
TASKBAR_ID["GRID_REGULAR"] = "snkSimpleCrudTaskbar.grid_regular";
|
|
832
|
+
TASKBAR_ID["FORM_SELECTED"] = "snkSimpleCrudTaskbar.form_selected";
|
|
833
|
+
TASKBAR_ID["GRID_SELECTED"] = "snkSimpleCrudTaskbar.grid_selected";
|
|
834
|
+
TASKBAR_ID["FINISH_EDITION"] = "snkSimpleCrudTaskbar.finish_edition";
|
|
835
|
+
TASKBAR_ID["MULTIPLE_EDITION"] = "snkSimpleCrudTaskbar.multiple_edition";
|
|
836
|
+
})(TASKBAR_ID || (TASKBAR_ID = {}));
|
|
824
837
|
SnkSimpleCrud.style = snkSimpleCrudCss;
|
|
825
838
|
|
|
826
839
|
exports.snk_simple_crud = SnkSimpleCrud;
|
|
@@ -135,20 +135,20 @@ export class SnkCrud {
|
|
|
135
135
|
this.setViewMode(VIEW_MODE.FORM);
|
|
136
136
|
}
|
|
137
137
|
async executeAction(act) {
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
switch (act) {
|
|
139
|
+
case TaskbarElement.GRID_MODE:
|
|
140
|
+
return this.setViewMode(VIEW_MODE.GRID);
|
|
141
|
+
case TaskbarElement.FORM_MODE:
|
|
142
|
+
case TaskbarElement.UPDATE:
|
|
143
|
+
return this.gridToForm(act !== TaskbarElement.UPDATE);
|
|
144
|
+
case TaskbarElement.UPDATE_MULTIPLE:
|
|
145
|
+
this._dataUnit.isMultipleEdition = true;
|
|
146
|
+
return this.setViewMode(VIEW_MODE.FORM);
|
|
147
|
+
case TaskbarElement.CONFIGURATOR:
|
|
148
|
+
return this._snkConfigurator.open();
|
|
149
|
+
case TaskbarElement.ATTACH:
|
|
150
|
+
return this.setViewMode(VIEW_MODE.ATTACHMENT);
|
|
140
151
|
}
|
|
141
|
-
if (act === TaskbarElement.FORM_MODE || act === TaskbarElement.UPDATE) {
|
|
142
|
-
return this.gridToForm(act !== TaskbarElement.UPDATE);
|
|
143
|
-
}
|
|
144
|
-
if (act === TaskbarElement.UPDATE_MULTIPLE) {
|
|
145
|
-
this._dataUnit.isMultipleEdition = true;
|
|
146
|
-
return this.setViewMode(VIEW_MODE.FORM);
|
|
147
|
-
}
|
|
148
|
-
if (act === TaskbarElement.CONFIGURATOR)
|
|
149
|
-
return this._snkConfigurator.open();
|
|
150
|
-
if (act === TaskbarElement.ATTACH)
|
|
151
|
-
return this.setViewMode(VIEW_MODE.ATTACHMENT);
|
|
152
152
|
}
|
|
153
153
|
backView() {
|
|
154
154
|
const lastView = this._viewHistory.at(-2) || VIEW_MODE.GRID;
|
|
@@ -189,18 +189,20 @@ export class SnkGuidesViewer {
|
|
|
189
189
|
}
|
|
190
190
|
getTaskBarId() {
|
|
191
191
|
var _a;
|
|
192
|
-
if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty)
|
|
193
|
-
return
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
192
|
+
if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
|
|
193
|
+
return TASKBAR_ID.FINISH_EDITION;
|
|
194
|
+
}
|
|
195
|
+
if (this.dataUnit.isMultipleEdition) {
|
|
196
|
+
return TASKBAR_ID.MUTIPLE_EDITION;
|
|
197
|
+
}
|
|
198
|
+
return TASKBAR_ID.REGULAR;
|
|
197
199
|
}
|
|
198
200
|
loadTaskbarProcessor() {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
201
|
+
const taskbarIDs = {};
|
|
202
|
+
taskbarIDs[TASKBAR_ID.REGULAR] = this.buildBtnsRegularMode();
|
|
203
|
+
taskbarIDs[TASKBAR_ID.FINISH_EDITION] = [TaskbarElement.CANCEL, TaskbarElement.SAVE, this.handleAddGridMode()];
|
|
204
|
+
taskbarIDs[TASKBAR_ID.MUTIPLE_EDITION] = [TaskbarElement.CANCEL];
|
|
205
|
+
this._taskbarProcessor = new TaskbarProcessor(taskbarIDs);
|
|
204
206
|
this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, this.buildDisabledButtons(), this.buildInvisibleButtons());
|
|
205
207
|
}
|
|
206
208
|
buildBtnsRegularMode() {
|
|
@@ -456,22 +458,23 @@ export class SnkGuidesViewer {
|
|
|
456
458
|
}
|
|
457
459
|
async dataUnitActionHandler(action) {
|
|
458
460
|
var _a;
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
this.dataUnit.isMultipleEdition
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
461
|
+
switch (action.type) {
|
|
462
|
+
case DUAction.EDITION_CANCELED:
|
|
463
|
+
case DUAction.DATA_SAVED:
|
|
464
|
+
if (this.dataUnit.isMultipleEdition) {
|
|
465
|
+
this.exitViewer();
|
|
466
|
+
this.dataUnit.isMultipleEdition = false;
|
|
467
|
+
}
|
|
468
|
+
break;
|
|
469
|
+
case DUAction.FIELD_INVALIDATED:
|
|
470
|
+
const guideName = this.getGuideName((_a = action.payload) === null || _a === void 0 ? void 0 : _a.fieldName);
|
|
471
|
+
await this.addErrorBadgeToGuide(guideName);
|
|
472
|
+
await this.openGuideNavigator(guideName);
|
|
473
|
+
break;
|
|
474
|
+
case DUAction.METADATA_LOADED:
|
|
475
|
+
case DUAction.MULTIPLE_EDITION_CHANGED:
|
|
476
|
+
this.loadGuides(this.noGuideSelected());
|
|
477
|
+
break;
|
|
475
478
|
}
|
|
476
479
|
}
|
|
477
480
|
async addErrorBadgeToGuide(guideName) {
|
|
@@ -517,16 +520,13 @@ export class SnkGuidesViewer {
|
|
|
517
520
|
return this.buildRecordIdsArray();
|
|
518
521
|
}
|
|
519
522
|
buildRecordIdsArray() {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
selectedRecords.
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
});
|
|
528
|
-
label = label + "]";
|
|
529
|
-
return label;
|
|
523
|
+
var _a, _b;
|
|
524
|
+
const selectedRecords = (_b = (_a = this.dataUnit.getSelectionInfo()) === null || _a === void 0 ? void 0 : _a.records) !== null && _b !== void 0 ? _b : [];
|
|
525
|
+
if (selectedRecords.length === 0) {
|
|
526
|
+
return "[]";
|
|
527
|
+
}
|
|
528
|
+
const labels = selectedRecords.map(record => this.messagesBuilder.getMessage("snkCrud.title", record));
|
|
529
|
+
return `[${labels.join(", ")}]`;
|
|
530
530
|
}
|
|
531
531
|
componentDidLoad() {
|
|
532
532
|
this.dataUnit.subscribe(this.dataUnitActionHandler.bind(this));
|
|
@@ -1165,3 +1165,9 @@ export class SnkGuidesViewer {
|
|
|
1165
1165
|
}];
|
|
1166
1166
|
}
|
|
1167
1167
|
}
|
|
1168
|
+
var TASKBAR_ID;
|
|
1169
|
+
(function (TASKBAR_ID) {
|
|
1170
|
+
TASKBAR_ID["FINISH_EDITION"] = "snkGuideViewer.finish_edition";
|
|
1171
|
+
TASKBAR_ID["MUTIPLE_EDITION"] = "snkGuideViewer.multiple_edition";
|
|
1172
|
+
TASKBAR_ID["REGULAR"] = "snkGuideViewer.regular";
|
|
1173
|
+
})(TASKBAR_ID || (TASKBAR_ID = {}));
|
|
@@ -273,18 +273,7 @@ export class SnkDataUnit {
|
|
|
273
273
|
}
|
|
274
274
|
async interceptSavingData(action) {
|
|
275
275
|
if (this.dataUnit.isMultipleEdition) {
|
|
276
|
-
const
|
|
277
|
-
const title = this.getMessage("snkDataUnit.multipleUpdateConfirmationTitle");
|
|
278
|
-
const message = this.getMessage("snkDataUnit.multipleUpdateConfirmationMessage", { size: selectedRecords.length });
|
|
279
|
-
const labelBtnCancel = this.getMessage("snkDataUnit.confirm.cancel");
|
|
280
|
-
const labelBtnConfirm = this.getMessage("snkDataUnit.confirm.updateMultipleConfirm");
|
|
281
|
-
const confirm = await showConfirmMultipleUpdatePopup({
|
|
282
|
-
title,
|
|
283
|
-
message,
|
|
284
|
-
labelBtnConfirm,
|
|
285
|
-
labelBtnCancel,
|
|
286
|
-
changingFields: this.getChangingFields()
|
|
287
|
-
});
|
|
276
|
+
const confirm = await this.confirmMultipleSavingData();
|
|
288
277
|
if (!confirm)
|
|
289
278
|
return undefined;
|
|
290
279
|
}
|
|
@@ -297,6 +286,20 @@ export class SnkDataUnit {
|
|
|
297
286
|
}
|
|
298
287
|
return continueAction ? action : undefined;
|
|
299
288
|
}
|
|
289
|
+
async confirmMultipleSavingData() {
|
|
290
|
+
const selectedRecords = this.dataUnit.getSelectionInfo().records;
|
|
291
|
+
const title = this.getMessage('snkDataUnit.multipleUpdateConfirmationTitle');
|
|
292
|
+
const message = this.getMessage('snkDataUnit.multipleUpdateConfirmationMessage', { size: selectedRecords.length });
|
|
293
|
+
const labelBtnCancel = this.getMessage('snkDataUnit.confirm.cancel');
|
|
294
|
+
const labelBtnConfirm = this.getMessage('snkDataUnit.confirm.updateMultipleConfirm');
|
|
295
|
+
return await showConfirmMultipleUpdatePopup({
|
|
296
|
+
title,
|
|
297
|
+
message,
|
|
298
|
+
labelBtnConfirm,
|
|
299
|
+
labelBtnCancel,
|
|
300
|
+
changingFields: this.getChangingFields(),
|
|
301
|
+
});
|
|
302
|
+
}
|
|
300
303
|
getChangingFields() {
|
|
301
304
|
const changes = this.dataUnit.buildChangesToSave();
|
|
302
305
|
if (!(changes === null || changes === void 0 ? void 0 : changes.length))
|
|
@@ -22,14 +22,6 @@ export class SnkSimpleCrud {
|
|
|
22
22
|
this._formConfigFetcher = new FormConfigFetcher();
|
|
23
23
|
this._customEditors = new Map();
|
|
24
24
|
this._customRenders = new Map();
|
|
25
|
-
this._taskbarProcessor = new TaskbarProcessor({
|
|
26
|
-
"snkSimpleCrudTaskbar.form_regular": this.getButtons(false, [TaskbarElement.GRID_MODE], true),
|
|
27
|
-
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]),
|
|
28
|
-
"snkSimpleCrudTaskbar.form_selected": this.getButtons(true, [TaskbarElement.GRID_MODE], true),
|
|
29
|
-
"snkSimpleCrudTaskbar.grid_selected": this.getGridSelectedButtonsCallBack.bind(this),
|
|
30
|
-
"snkSimpleCrudTaskbar.finish_edition": this.getFinishEditionButtonsCallback.bind(this),
|
|
31
|
-
"snkSimpleCrudTaskbar.multiple_edition": [TaskbarElement.CANCEL]
|
|
32
|
-
});
|
|
33
25
|
this._showPopUpGridConfig = false;
|
|
34
26
|
this._currentViewMode = VIEW_MODE.GRID;
|
|
35
27
|
this._config = undefined;
|
|
@@ -123,6 +115,16 @@ export class SnkSimpleCrud {
|
|
|
123
115
|
newCustomFieldProps.set(fieldName, Object.assign(Object.assign({}, currentProps), { [propName]: value }));
|
|
124
116
|
this._fieldsProps = newCustomFieldProps;
|
|
125
117
|
}
|
|
118
|
+
loadTaskbarProcessor() {
|
|
119
|
+
const taskbarIDs = {};
|
|
120
|
+
taskbarIDs[TASKBAR_ID.FORM_REGULAR] = this.getButtons(false, [TaskbarElement.GRID_MODE], true);
|
|
121
|
+
taskbarIDs[TASKBAR_ID.GRID_REGULAR] = this.getButtons(false, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]);
|
|
122
|
+
taskbarIDs[TASKBAR_ID.FORM_SELECTED] = this.getButtons(true, [TaskbarElement.GRID_MODE], true);
|
|
123
|
+
taskbarIDs[TASKBAR_ID.GRID_SELECTED] = this.getGridSelectedButtonsCallBack.bind(this);
|
|
124
|
+
taskbarIDs[TASKBAR_ID.FINISH_EDITION] = this.getFinishEditionButtonsCallback.bind(this);
|
|
125
|
+
taskbarIDs[TASKBAR_ID.MULTIPLE_EDITION] = [TaskbarElement.CANCEL];
|
|
126
|
+
this._taskbarProcessor = new TaskbarProcessor(taskbarIDs);
|
|
127
|
+
}
|
|
126
128
|
getGridSelectedButtonsCallBack() {
|
|
127
129
|
var _a, _b, _c;
|
|
128
130
|
if (!this.multipleEditionEnabled || ((_c = (_b = (_a = this.dataState) === null || _a === void 0 ? void 0 : _a.selectionInfo) === null || _b === void 0 ? void 0 : _b.records) === null || _c === void 0 ? void 0 : _c.length) === 1) {
|
|
@@ -324,8 +326,10 @@ export class SnkSimpleCrud {
|
|
|
324
326
|
this.setFormConfig(await this._formConfigManager.loadConfig());
|
|
325
327
|
}
|
|
326
328
|
async componentWillRender() {
|
|
329
|
+
this.loadTaskbarProcessor();
|
|
327
330
|
this._resourceID = await this.application.getResourceID();
|
|
328
331
|
this.dataExporterProviderStore();
|
|
332
|
+
this.dataExporterProviderStore();
|
|
329
333
|
this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, this.getTaskBarDisabledButtons());
|
|
330
334
|
if (this.configName === undefined) {
|
|
331
335
|
return;
|
|
@@ -403,17 +407,17 @@ export class SnkSimpleCrud {
|
|
|
403
407
|
getTaskBarId() {
|
|
404
408
|
var _a, _b;
|
|
405
409
|
if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
|
|
406
|
-
return
|
|
410
|
+
return TASKBAR_ID.FINISH_EDITION;
|
|
407
411
|
}
|
|
408
412
|
if (this.dataUnit.isMultipleEdition) {
|
|
409
|
-
return
|
|
413
|
+
return TASKBAR_ID.MULTIPLE_EDITION;
|
|
410
414
|
}
|
|
411
415
|
if (((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.selectionInfo) &&
|
|
412
416
|
!this.dataState.selectionInfo.isAllRecords() &&
|
|
413
417
|
this.dataState.selectionInfo.length > 0) {
|
|
414
|
-
return this._currentViewMode === VIEW_MODE.GRID ?
|
|
418
|
+
return this._currentViewMode === VIEW_MODE.GRID ? TASKBAR_ID.GRID_SELECTED : TASKBAR_ID.FORM_SELECTED;
|
|
415
419
|
}
|
|
416
|
-
return this._currentViewMode === VIEW_MODE.GRID ?
|
|
420
|
+
return this._currentViewMode === VIEW_MODE.GRID ? TASKBAR_ID.GRID_REGULAR : TASKBAR_ID.FORM_REGULAR;
|
|
417
421
|
}
|
|
418
422
|
initInMemoryDataUnit() {
|
|
419
423
|
this._inMemoryLoader = new InMemoryLoader(this._metadata, undefined, { autoLoad: this.autoLoad });
|
|
@@ -1759,3 +1763,12 @@ export class SnkSimpleCrud {
|
|
|
1759
1763
|
}];
|
|
1760
1764
|
}
|
|
1761
1765
|
}
|
|
1766
|
+
var TASKBAR_ID;
|
|
1767
|
+
(function (TASKBAR_ID) {
|
|
1768
|
+
TASKBAR_ID["FORM_REGULAR"] = "snkSimpleCrudTaskbar.form_regular";
|
|
1769
|
+
TASKBAR_ID["GRID_REGULAR"] = "snkSimpleCrudTaskbar.grid_regular";
|
|
1770
|
+
TASKBAR_ID["FORM_SELECTED"] = "snkSimpleCrudTaskbar.form_selected";
|
|
1771
|
+
TASKBAR_ID["GRID_SELECTED"] = "snkSimpleCrudTaskbar.grid_selected";
|
|
1772
|
+
TASKBAR_ID["FINISH_EDITION"] = "snkSimpleCrudTaskbar.finish_edition";
|
|
1773
|
+
TASKBAR_ID["MULTIPLE_EDITION"] = "snkSimpleCrudTaskbar.multiple_edition";
|
|
1774
|
+
})(TASKBAR_ID || (TASKBAR_ID = {}));
|
|
@@ -177,20 +177,20 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
177
177
|
this.setViewMode(VIEW_MODE.FORM);
|
|
178
178
|
}
|
|
179
179
|
async executeAction(act) {
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
switch (act) {
|
|
181
|
+
case TaskbarElement.GRID_MODE:
|
|
182
|
+
return this.setViewMode(VIEW_MODE.GRID);
|
|
183
|
+
case TaskbarElement.FORM_MODE:
|
|
184
|
+
case TaskbarElement.UPDATE:
|
|
185
|
+
return this.gridToForm(act !== TaskbarElement.UPDATE);
|
|
186
|
+
case TaskbarElement.UPDATE_MULTIPLE:
|
|
187
|
+
this._dataUnit.isMultipleEdition = true;
|
|
188
|
+
return this.setViewMode(VIEW_MODE.FORM);
|
|
189
|
+
case TaskbarElement.CONFIGURATOR:
|
|
190
|
+
return this._snkConfigurator.open();
|
|
191
|
+
case TaskbarElement.ATTACH:
|
|
192
|
+
return this.setViewMode(VIEW_MODE.ATTACHMENT);
|
|
182
193
|
}
|
|
183
|
-
if (act === TaskbarElement.FORM_MODE || act === TaskbarElement.UPDATE) {
|
|
184
|
-
return this.gridToForm(act !== TaskbarElement.UPDATE);
|
|
185
|
-
}
|
|
186
|
-
if (act === TaskbarElement.UPDATE_MULTIPLE) {
|
|
187
|
-
this._dataUnit.isMultipleEdition = true;
|
|
188
|
-
return this.setViewMode(VIEW_MODE.FORM);
|
|
189
|
-
}
|
|
190
|
-
if (act === TaskbarElement.CONFIGURATOR)
|
|
191
|
-
return this._snkConfigurator.open();
|
|
192
|
-
if (act === TaskbarElement.ATTACH)
|
|
193
|
-
return this.setViewMode(VIEW_MODE.ATTACHMENT);
|
|
194
194
|
}
|
|
195
195
|
backView() {
|
|
196
196
|
const lastView = this._viewHistory.at(-2) || VIEW_MODE.GRID;
|
|
@@ -396,18 +396,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
396
396
|
}
|
|
397
397
|
async interceptSavingData(action) {
|
|
398
398
|
if (this.dataUnit.isMultipleEdition) {
|
|
399
|
-
const
|
|
400
|
-
const title = this.getMessage("snkDataUnit.multipleUpdateConfirmationTitle");
|
|
401
|
-
const message = this.getMessage("snkDataUnit.multipleUpdateConfirmationMessage", { size: selectedRecords.length });
|
|
402
|
-
const labelBtnCancel = this.getMessage("snkDataUnit.confirm.cancel");
|
|
403
|
-
const labelBtnConfirm = this.getMessage("snkDataUnit.confirm.updateMultipleConfirm");
|
|
404
|
-
const confirm = await showConfirmMultipleUpdatePopup({
|
|
405
|
-
title,
|
|
406
|
-
message,
|
|
407
|
-
labelBtnConfirm,
|
|
408
|
-
labelBtnCancel,
|
|
409
|
-
changingFields: this.getChangingFields()
|
|
410
|
-
});
|
|
399
|
+
const confirm = await this.confirmMultipleSavingData();
|
|
411
400
|
if (!confirm)
|
|
412
401
|
return undefined;
|
|
413
402
|
}
|
|
@@ -420,6 +409,20 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
420
409
|
}
|
|
421
410
|
return continueAction ? action : undefined;
|
|
422
411
|
}
|
|
412
|
+
async confirmMultipleSavingData() {
|
|
413
|
+
const selectedRecords = this.dataUnit.getSelectionInfo().records;
|
|
414
|
+
const title = this.getMessage('snkDataUnit.multipleUpdateConfirmationTitle');
|
|
415
|
+
const message = this.getMessage('snkDataUnit.multipleUpdateConfirmationMessage', { size: selectedRecords.length });
|
|
416
|
+
const labelBtnCancel = this.getMessage('snkDataUnit.confirm.cancel');
|
|
417
|
+
const labelBtnConfirm = this.getMessage('snkDataUnit.confirm.updateMultipleConfirm');
|
|
418
|
+
return await showConfirmMultipleUpdatePopup({
|
|
419
|
+
title,
|
|
420
|
+
message,
|
|
421
|
+
labelBtnConfirm,
|
|
422
|
+
labelBtnCancel,
|
|
423
|
+
changingFields: this.getChangingFields(),
|
|
424
|
+
});
|
|
425
|
+
}
|
|
423
426
|
getChangingFields() {
|
|
424
427
|
const changes = this.dataUnit.buildChangesToSave();
|
|
425
428
|
if (!(changes === null || changes === void 0 ? void 0 : changes.length))
|