@sankhyalabs/sankhyablocks 8.16.0-dev.110 → 8.16.0-dev.111
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/{SnkMessageBuilder-aecd7c18.js → SnkMessageBuilder-9deeae08.js} +4 -3
- package/dist/cjs/index-f9e81701.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/{snk-actions-button_7.cjs.entry.js → snk-actions-button_8.cjs.entry.js} +61 -0
- package/dist/cjs/snk-application.cjs.entry.js +1 -1
- package/dist/cjs/snk-attach.cjs.entry.js +1 -1
- package/dist/cjs/snk-crud.cjs.entry.js +2 -26
- package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
- package/dist/cjs/{snk-data-unit-ebfdb9ba.js → snk-data-unit-57916de4.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +57 -5
- package/dist/cjs/snk-form-view.cjs.entry.js +19 -7
- package/dist/cjs/snk-grid.cjs.entry.js +22 -23
- package/dist/cjs/{snk-guides-viewer-fd39f437.js → snk-guides-viewer-d33379cd.js} +36 -24
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +4 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +73 -85
- package/dist/cjs/snk-taskbar.cjs.entry.js +7 -3
- package/dist/cjs/{taskbar-elements-02379452.js → taskbar-elements-6f4e06af.js} +8 -0
- package/dist/cjs/{field-search-68e34bf4.js → taskbar-processor-2fba34a8.js} +0 -35
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/snk-crud/snk-crud.js +2 -26
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +58 -4
- package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +54 -7
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +36 -40
- package/dist/collection/components/snk-grid/snk-grid.js +36 -36
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +75 -85
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +8 -0
- package/dist/collection/components/snk-taskbar/elements/taskbar-split-button/taskbar-split-button.css +0 -0
- package/dist/collection/components/snk-taskbar/elements/taskbar-split-button/taskbar-split-button.js +220 -0
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +28 -2
- package/dist/collection/lib/message/resources/snk-crud.msg.js +1 -1
- package/dist/collection/lib/message/resources/snk-grid.msg.js +1 -1
- package/dist/collection/lib/message/resources/snk-simple-crud.msg.js +2 -1
- package/dist/components/ContinuousInsertUtils.js +2 -33
- package/dist/components/SnkMessageBuilder.js +4 -3
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/snk-attach2.js +34 -28
- package/dist/components/snk-crud.js +75 -93
- package/dist/components/snk-detail-view2.js +193 -117
- package/dist/components/snk-form-view2.js +22 -8
- package/dist/components/snk-grid2.js +62 -57
- package/dist/components/snk-simple-crud2.js +104 -109
- package/dist/components/snk-taskbar2.js +29 -10
- package/dist/components/taskbar-split-button.d.ts +11 -0
- package/dist/components/taskbar-split-button.js +6 -0
- package/dist/components/taskbar-split-button2.js +87 -0
- package/dist/esm/{SnkMessageBuilder-12f5fe1a.js → SnkMessageBuilder-2dbd8fa2.js} +4 -3
- package/dist/esm/index-a7d3d3f1.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/{snk-actions-button_7.entry.js → snk-actions-button_8.entry.js} +61 -1
- package/dist/esm/snk-application.entry.js +1 -1
- package/dist/esm/snk-attach.entry.js +1 -1
- package/dist/esm/snk-crud.entry.js +3 -27
- package/dist/esm/snk-data-exporter.entry.js +2 -2
- package/dist/esm/{snk-data-unit-03654813.js → snk-data-unit-65c9dd1a.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +59 -7
- package/dist/esm/snk-form-view.entry.js +19 -7
- package/dist/esm/snk-grid.entry.js +20 -21
- package/dist/esm/{snk-guides-viewer-75e06feb.js → snk-guides-viewer-72953334.js} +37 -25
- package/dist/esm/snk-guides-viewer.entry.js +4 -3
- package/dist/esm/snk-simple-crud.entry.js +74 -86
- package/dist/esm/snk-taskbar.entry.js +7 -3
- package/dist/esm/{taskbar-elements-c62b6c66.js → taskbar-elements-f2cb4922.js} +8 -0
- package/dist/esm/{field-search-f8b1d91e.js → taskbar-processor-3436124c.js} +1 -34
- package/dist/sankhyablocks/p-0fadb620.js +1 -0
- package/dist/sankhyablocks/p-1a0caadb.js +1 -0
- package/dist/sankhyablocks/{p-2c08fa3e.entry.js → p-1bdffb17.entry.js} +1 -1
- package/dist/sankhyablocks/p-1f80174b.entry.js +1 -0
- package/dist/sankhyablocks/p-24a0dbd2.entry.js +1 -0
- package/dist/sankhyablocks/p-2f7e2251.entry.js +1 -0
- package/dist/sankhyablocks/p-3372178e.entry.js +1 -0
- package/dist/sankhyablocks/p-4689c2e6.js +1 -0
- package/dist/sankhyablocks/{p-271c86d3.entry.js → p-52d10014.entry.js} +1 -1
- package/dist/sankhyablocks/p-6a03b190.entry.js +1 -0
- package/dist/sankhyablocks/{p-ad07f0c5.entry.js → p-7beeabc1.entry.js} +1 -1
- package/dist/sankhyablocks/{p-4a93daef.entry.js → p-a4ebeec4.entry.js} +1 -1
- package/dist/sankhyablocks/p-bc101064.entry.js +1 -0
- package/dist/sankhyablocks/{p-f4d5bb7f.js → p-c9675d64.js} +1 -1
- package/dist/sankhyablocks/{p-4e861843.entry.js → p-ce94e6c4.entry.js} +1 -1
- package/dist/sankhyablocks/p-d07b18a4.js +1 -0
- package/dist/sankhyablocks/{p-6a0c8ce0.entry.js → p-ddf93f36.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-crud/snk-crud.d.ts +0 -3
- package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +12 -0
- package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +11 -1
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +6 -6
- package/dist/types/components/snk-grid/snk-grid.d.ts +7 -5
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +10 -10
- package/dist/types/components/snk-taskbar/elements/taskbar-split-button/taskbar-split-button.d.ts +44 -0
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +5 -0
- package/dist/types/components.d.ts +107 -8
- package/package.json +1 -1
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -0
- package/react/components.js.map +1 -1
- package/dist/collection/components/snk-taskbar/subcomponents/field-search.js +0 -31
- package/dist/sankhyablocks/p-1a51dfde.entry.js +0 -1
- package/dist/sankhyablocks/p-1db45d26.entry.js +0 -1
- package/dist/sankhyablocks/p-23736d75.js +0 -1
- package/dist/sankhyablocks/p-2d6df7e7.entry.js +0 -1
- package/dist/sankhyablocks/p-41da5310.js +0 -1
- package/dist/sankhyablocks/p-65be98c5.entry.js +0 -1
- package/dist/sankhyablocks/p-80f8c22c.js +0 -1
- package/dist/sankhyablocks/p-cc8c3bca.entry.js +0 -1
- package/dist/sankhyablocks/p-cf1f25ed.entry.js +0 -1
- package/dist/sankhyablocks/p-fb0f0087.js +0 -1
- package/dist/types/components/snk-taskbar/subcomponents/field-search.d.ts +0 -4
@@ -6,7 +6,7 @@ const index = require('./index-f9e81701.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
7
7
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
8
8
|
const constants = require('./constants-77c1b8bd.js');
|
9
|
-
const taskbarElements = require('./taskbar-elements-
|
9
|
+
const taskbarElements = require('./taskbar-elements-6f4e06af.js');
|
10
10
|
require('./DataFetcher-1afdb18e.js');
|
11
11
|
require('./ISave-c76e2c51.js');
|
12
12
|
const ClientSideExporterProvider = require('./ClientSideExporterProvider-a2753c93.js');
|
@@ -16,7 +16,7 @@ require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
16
16
|
const dataunitFetcher = require('./dataunit-fetcher-a723f0dc.js');
|
17
17
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
18
18
|
const formConfigFetcher = require('./form-config-fetcher-40d3f752.js');
|
19
|
-
const
|
19
|
+
const taskbarProcessor = require('./taskbar-processor-2fba34a8.js');
|
20
20
|
const ConfigStorage = require('./ConfigStorage-df09fb78.js');
|
21
21
|
const SnkFormConfigManager = require('./SnkFormConfigManager-45a8d7b7.js');
|
22
22
|
const index$2 = require('./index-102ba62d.js');
|
@@ -43,10 +43,10 @@ const SnkSimpleCrud = class {
|
|
43
43
|
this.configuratorSave = index.createEvent(this, "configuratorSave", 7);
|
44
44
|
this.configuratorCancel = index.createEvent(this, "configuratorCancel", 7);
|
45
45
|
this._multiSelectionListDataSource = new ClientSideExporterProvider.SnkMultiSelectionListDataSource();
|
46
|
-
this._keyDownHandler = (event) => this.keyDownListener(event);
|
47
46
|
this._formConfigFetcher = new formConfigFetcher.FormConfigFetcher();
|
48
47
|
this._customEditors = new Map();
|
49
48
|
this._customRenders = new Map();
|
49
|
+
this._container = undefined;
|
50
50
|
this._showPopUpGridConfig = false;
|
51
51
|
this._currentViewMode = constants.VIEW_MODE.GRID;
|
52
52
|
this._config = undefined;
|
@@ -73,7 +73,7 @@ const SnkSimpleCrud = class {
|
|
73
73
|
this.useEnterLikeTab = false;
|
74
74
|
this.actionsList = undefined;
|
75
75
|
this.configName = undefined;
|
76
|
-
this.showConfiguratorButtons =
|
76
|
+
this.showConfiguratorButtons = false;
|
77
77
|
this.gridLegacyConfigName = undefined;
|
78
78
|
this.formLegacyConfigName = undefined;
|
79
79
|
this.ignoreReadOnlyFormFields = false;
|
@@ -148,7 +148,7 @@ const SnkSimpleCrud = class {
|
|
148
148
|
taskbarIDs[TASKBAR_ID.GRID_SELECTED] = this.getGridSelectedButtonsCallBack.bind(this);
|
149
149
|
taskbarIDs[TASKBAR_ID.FINISH_EDITION] = this.getFinishEditionButtonsCallback.bind(this);
|
150
150
|
taskbarIDs[TASKBAR_ID.MULTIPLE_EDITION] = [taskbarElements.TaskbarElement.CANCEL];
|
151
|
-
this._taskbarProcessor = new
|
151
|
+
this._taskbarProcessor = new taskbarProcessor.TaskbarProcessor(taskbarIDs);
|
152
152
|
}
|
153
153
|
getGridSelectedButtonsCallBack() {
|
154
154
|
var _a, _b, _c;
|
@@ -198,6 +198,12 @@ const SnkSimpleCrud = class {
|
|
198
198
|
this.dataUnit.isMultipleEdition = false;
|
199
199
|
this._viewStack.show(view);
|
200
200
|
}
|
201
|
+
if (view === constants.VIEW_MODE.GRID) {
|
202
|
+
requestAnimationFrame(() => this.focusToGrid());
|
203
|
+
}
|
204
|
+
if (view === constants.VIEW_MODE.FORM) {
|
205
|
+
requestAnimationFrame(() => this.focusToForm());
|
206
|
+
}
|
201
207
|
}
|
202
208
|
actionClickListener(evt) {
|
203
209
|
this.handleTaskbarAction(evt.detail);
|
@@ -395,6 +401,10 @@ const SnkSimpleCrud = class {
|
|
395
401
|
}
|
396
402
|
}
|
397
403
|
}
|
404
|
+
disconnectedCallback() {
|
405
|
+
var _a;
|
406
|
+
(_a = this._keyboardManager) === null || _a === void 0 ? void 0 : _a.unbindAllShortcutKeys();
|
407
|
+
}
|
398
408
|
setCustomRenders() {
|
399
409
|
if (!this._grid) {
|
400
410
|
return;
|
@@ -572,40 +582,18 @@ const SnkSimpleCrud = class {
|
|
572
582
|
}
|
573
583
|
this.configuratorCancel.emit();
|
574
584
|
}
|
575
|
-
|
576
|
-
if (this._columnSearch != undefined) {
|
577
|
-
return this._columnSearch;
|
578
|
-
}
|
579
|
-
this._moreOptions = actionButton;
|
580
|
-
this._columnSearch = fieldSearch.buildFieldSearch(item, ({ argument }) => new Promise(accept => {
|
581
|
-
this._grid.filterColumns(argument).then((columns) => {
|
582
|
-
accept(columns
|
583
|
-
.filter(column => !column.hidden)
|
584
|
-
.map(column => ({ label: column.label, value: column.name })));
|
585
|
-
});
|
586
|
-
}), (option) => {
|
587
|
-
var _a;
|
588
|
-
if (option != undefined) {
|
589
|
-
this._grid.locateColumn(option.value);
|
590
|
-
(_a = actionButton["hideActions"]) === null || _a === void 0 ? void 0 : _a.call(actionButton);
|
591
|
-
}
|
592
|
-
});
|
593
|
-
return this._columnSearch;
|
594
|
-
}
|
595
|
-
onSelectField(option, actionButton) {
|
585
|
+
onSelectField(option) {
|
596
586
|
if (option == undefined) {
|
597
587
|
return;
|
598
588
|
}
|
599
589
|
this._fieldToGetFocus = option.value;
|
600
|
-
actionButton.hideActions();
|
601
590
|
}
|
602
|
-
getFieldSearch(
|
591
|
+
getFieldSearch(splitButton, item) {
|
603
592
|
if (this._fieldSearch != undefined) {
|
604
593
|
return this._fieldSearch;
|
605
594
|
}
|
606
|
-
this.
|
607
|
-
|
608
|
-
this._fieldSearch = fieldSearch.buildFieldSearch(item, ({ argument }) => this.fieldsOptionLoader(argument), (option) => this.onSelectField(option, actionButton));
|
595
|
+
this._splitButtonForm = splitButton;
|
596
|
+
this._fieldSearch = utils.buildFieldSearch(item, ({ argument }) => this.fieldsOptionLoader(argument), (option) => this.onSelectField(option));
|
609
597
|
return this._fieldSearch;
|
610
598
|
}
|
611
599
|
getFormFields() {
|
@@ -631,17 +619,26 @@ const SnkSimpleCrud = class {
|
|
631
619
|
isGridInsertActive() {
|
632
620
|
return this.enableGridInsert && this.dataUnit.hasNewRecord();
|
633
621
|
}
|
622
|
+
getColumnSearch(splitButton, item) {
|
623
|
+
if (this._columnSearch != undefined) {
|
624
|
+
return this._columnSearch;
|
625
|
+
}
|
626
|
+
this._splitButton = splitButton;
|
627
|
+
this._columnSearch = utils.buildFieldSearch(item, ({ argument }) => new Promise(accept => {
|
628
|
+
this._grid.filterColumns(argument).then((columns) => {
|
629
|
+
accept(columns
|
630
|
+
.filter(column => !column.hidden)
|
631
|
+
.map(column => ({ label: column.label, value: column.name })));
|
632
|
+
});
|
633
|
+
}), (option) => {
|
634
|
+
if (option != undefined) {
|
635
|
+
this._grid.locateColumn(option.value);
|
636
|
+
}
|
637
|
+
});
|
638
|
+
return this._columnSearch;
|
639
|
+
}
|
634
640
|
getActionsList() {
|
635
|
-
|
636
|
-
const hardList = [{
|
637
|
-
value: core.StringUtils.generateUUID(),
|
638
|
-
label: (_b = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.findColumn", undefined)) !== null && _b !== void 0 ? _b : "Buscar",
|
639
|
-
disableCloseOnSelect: true,
|
640
|
-
eagerInitialize: true,
|
641
|
-
itemBuilder: (actionButton, item) => (this._currentViewMode === constants.VIEW_MODE.GRID)
|
642
|
-
? this.getColumnSearch(actionButton, item)
|
643
|
-
: this.getFieldSearch(actionButton, item)
|
644
|
-
}];
|
641
|
+
const hardList = [];
|
645
642
|
if (this.enableGridInsert) {
|
646
643
|
hardList.push(this._continuousInsertUtils.actionContinuousInsert(this.enableContinuousInsert, () => {
|
647
644
|
this.enableContinuousInsert = !this.enableContinuousInsert;
|
@@ -654,8 +651,28 @@ const SnkSimpleCrud = class {
|
|
654
651
|
const taskbarID = this.getTopTaskBarId();
|
655
652
|
return hardList.concat(this.taskbarManager.getMoreOptions(taskbarID, this.configName, this.dataState, this.actionsList));
|
656
653
|
}
|
657
|
-
|
658
|
-
|
654
|
+
return hardList.concat(this.actionsList);
|
655
|
+
}
|
656
|
+
getSettingsListGrid() {
|
657
|
+
var _a, _b;
|
658
|
+
const hardList = [{
|
659
|
+
value: core.StringUtils.generateUUID(),
|
660
|
+
label: (_b = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.findColumn", {})) !== null && _b !== void 0 ? _b : utils.LABEL_SEARCH_COLUMN,
|
661
|
+
disableCloseOnSelect: true,
|
662
|
+
eagerInitialize: true,
|
663
|
+
itemBuilder: (splitButton, item) => this.getColumnSearch(splitButton, item)
|
664
|
+
}];
|
665
|
+
return hardList;
|
666
|
+
}
|
667
|
+
getSettingsListForm() {
|
668
|
+
var _a, _b;
|
669
|
+
const hardList = [{
|
670
|
+
value: core.StringUtils.generateUUID(),
|
671
|
+
label: (_b = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.findFields", {})) !== null && _b !== void 0 ? _b : utils.LABEL_SEARCH_FIELD,
|
672
|
+
disableCloseOnSelect: true,
|
673
|
+
eagerInitialize: true,
|
674
|
+
itemBuilder: (splitButton, item) => this.getFieldSearch(splitButton, item)
|
675
|
+
}];
|
659
676
|
return hardList;
|
660
677
|
}
|
661
678
|
getTopTaskBarId() {
|
@@ -663,45 +680,9 @@ const SnkSimpleCrud = class {
|
|
663
680
|
return ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? `snkGridTopTaskbar.finish_edition${index$1.PresentationMode.PRIMARY}` :
|
664
681
|
`snkGridTopTaskbar.regular${index$1.PresentationMode.PRIMARY}`;
|
665
682
|
}
|
666
|
-
async keyDownListener(event) {
|
667
|
-
if (!event.ctrlKey || event.key == undefined || event.key.toUpperCase() !== "F") {
|
668
|
-
return;
|
669
|
-
}
|
670
|
-
if (this._element == undefined) {
|
671
|
-
return;
|
672
|
-
}
|
673
|
-
if (core.JSUtils.isHiddenElement(this._element)) {
|
674
|
-
return;
|
675
|
-
}
|
676
|
-
core.FloatingManager.closeAll();
|
677
|
-
if (this._currentViewMode === constants.VIEW_MODE.GRID) {
|
678
|
-
await this.findColumn();
|
679
|
-
}
|
680
|
-
else {
|
681
|
-
await this.findField();
|
682
|
-
}
|
683
|
-
event.preventDefault();
|
684
|
-
}
|
685
|
-
async findField() {
|
686
|
-
await this.openSeach(this._fieldSearch);
|
687
|
-
}
|
688
|
-
async findColumn() {
|
689
|
-
await this.openSeach(this._columnSearch);
|
690
|
-
}
|
691
|
-
async openSeach(fieldSearch$1) {
|
692
|
-
await fieldSearch.openFieldSearch(this._moreOptions, fieldSearch$1);
|
693
|
-
}
|
694
683
|
clearFieldToFocusHandler() {
|
695
684
|
this._fieldToGetFocus = undefined;
|
696
685
|
}
|
697
|
-
connectedCallback() {
|
698
|
-
window.addEventListener("keydown", this._keyDownHandler, { capture: true });
|
699
|
-
}
|
700
|
-
disconnectedCallback() {
|
701
|
-
var _a;
|
702
|
-
window.removeEventListener("keydown", this._keyDownHandler);
|
703
|
-
(_a = this._keyboardManager) === null || _a === void 0 ? void 0 : _a.unbindAllShortcutKeys();
|
704
|
-
}
|
705
686
|
gridConfigChangeHandler(evt) {
|
706
687
|
evt.stopPropagation();
|
707
688
|
if (!this.configName)
|
@@ -797,16 +778,23 @@ const SnkSimpleCrud = class {
|
|
797
778
|
}
|
798
779
|
}, {
|
799
780
|
debounceTime: 1000,
|
800
|
-
description: "Cancela uma ação.",
|
801
|
-
element: this._element
|
781
|
+
description: "Cancela uma ação.", element: this._element
|
802
782
|
});
|
803
783
|
}
|
804
784
|
async handleFormConfigSaved() {
|
805
785
|
await this.loadFormConfig(true, true);
|
806
786
|
}
|
807
|
-
|
787
|
+
focusToGrid() {
|
788
|
+
const gridElement = this._grid;
|
789
|
+
gridElement.focus();
|
790
|
+
}
|
791
|
+
focusToForm() {
|
792
|
+
const formElement = this._form;
|
793
|
+
formElement.focus();
|
794
|
+
}
|
795
|
+
renderTaskbarContent(layout) {
|
808
796
|
var _a;
|
809
|
-
return (index.h("snk-taskbar", { class: this._currentViewMode === constants.VIEW_MODE.FORM
|
797
|
+
return (index.h("snk-taskbar", { class: `ez-box--no-outline ez-box ${this._currentViewMode === constants.VIEW_MODE.FORM ? (this.outlineMode ? 'ez-box--outline' : 'ez-box--shadow-xsmall') + ' ez-padding--small' : ''}`, dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), actionsSettingsList: layout === constants.VIEW_MODE.GRID ? this.getSettingsListGrid() : this.getSettingsListForm(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: index$1.PresentationMode.SECONDARY, tabindex: "0" }, index.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })));
|
810
798
|
}
|
811
799
|
/* istanbul ignore next */
|
812
800
|
render() {
|
@@ -814,9 +802,9 @@ const SnkSimpleCrud = class {
|
|
814
802
|
if (this.dataUnit == undefined) {
|
815
803
|
return;
|
816
804
|
}
|
817
|
-
return (index.h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: this.handleDataUnitOnInsertionMode.bind(this), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, index.h("header", null, index.h("slot", { name: "snkSimpleCrudHeader" })), index.h("section", { class: `ez-box ${this.outlineMode ? 'ez-box--outline' : 'ez-box--shadow'} simple-crud__container-section
|
805
|
+
return (index.h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: this.handleDataUnitOnInsertionMode.bind(this), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, index.h("header", null, index.h("slot", { name: "snkSimpleCrudHeader" })), index.h("section", { class: `ez-box ez-box--no-outline ${this.outlineMode ? 'ez-box--outline' : 'ez-box--shadow'} simple-crud__container-section`, ref: (ref) => this._container = ref, tabindex: "0" }, index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index.h("stack-item", null, index.h("ez-grid", { class: "ez-margin-bottom--large ez-box--no-outline", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(constants.VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(dataunitFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
818
806
|
? undefined
|
819
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this.enableContinuousInsert, enableLockManagerTaskbarClick: this.enableLockManagerTaskbarClick, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, outlineMode: this.outlineMode }, this.renderTaskbarContent(), index.h("div", { slot: "footer" }, index.h("slot", { name: "snkSimpleCrudFooter" })))), index.h("stack-item", null, this.renderTaskbarContent(), index.h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), index.h("snk-simple-form-config", { ref: (ref) => this._snkSimpleFormConfig = ref, dataUnit: this.dataUnit, onSnkConfigSaved: this.handleFormConfigSaved.bind(this), configName: (_a = this.formLegacyConfigName) !== null && _a !== void 0 ? _a : this.configName })), this.messagesBuilder && index.h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId, layoutFormConfig: this.layoutFormConfig })), index.h("div", { id: `${this._customContainerId}` }, index.h("slot", { name: "SnkConfigContainerSlot" }))), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
807
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this.enableContinuousInsert, enableLockManagerTaskbarClick: this.enableLockManagerTaskbarClick, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, outlineMode: this.outlineMode, tabindex: "0" }, this.renderTaskbarContent(constants.VIEW_MODE.GRID), index.h("div", { slot: "footer" }, index.h("slot", { name: "snkSimpleCrudFooter" })))), index.h("stack-item", null, this.renderTaskbarContent(constants.VIEW_MODE.FORM), index.h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ez-box--no-outline`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), elementFocusSearchField: this._container, tabindex: "0" }), index.h("snk-simple-form-config", { ref: (ref) => this._snkSimpleFormConfig = ref, dataUnit: this.dataUnit, onSnkConfigSaved: this.handleFormConfigSaved.bind(this), configName: (_a = this.formLegacyConfigName) !== null && _a !== void 0 ? _a : this.configName })), this.messagesBuilder && index.h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId, layoutFormConfig: this.layoutFormConfig })), index.h("div", { id: `${this._customContainerId}` }, index.h("slot", { name: "SnkConfigContainerSlot" }))), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
820
808
|
}
|
821
809
|
get _element() { return index.getElement(this); }
|
822
810
|
static get watchers() { return {
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
const index = require('./index-f9e81701.js');
|
6
6
|
const core = require('@sankhyalabs/core');
|
7
7
|
const AuthorizationConfig = require('./AuthorizationConfig-79ffae4b.js');
|
8
|
-
const taskbarElements = require('./taskbar-elements-
|
8
|
+
const taskbarElements = require('./taskbar-elements-6f4e06af.js');
|
9
9
|
const index$1 = require('./index-e3e39724.js');
|
10
10
|
require('./index-102ba62d.js');
|
11
11
|
|
@@ -70,6 +70,7 @@ const SnkTaskbar = class {
|
|
70
70
|
this.buttons = undefined;
|
71
71
|
this.customButtons = undefined;
|
72
72
|
this.actionsList = undefined;
|
73
|
+
this.actionsSettingsList = undefined;
|
73
74
|
this.primaryButton = undefined;
|
74
75
|
this.disabledButtons = undefined;
|
75
76
|
this.dataUnit = undefined;
|
@@ -226,7 +227,7 @@ const SnkTaskbar = class {
|
|
226
227
|
const taskbarElement = taskbarElements.TaskbarElement[def.toString()];
|
227
228
|
const dataExporterStoreKey = this._element.dataset.exporterStoreKey || this.configName;
|
228
229
|
if (taskbarElement) {
|
229
|
-
return taskbarElements.buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.buildDynamicActionsList(), dataExporterStoreKey, this.presentationMode);
|
230
|
+
return taskbarElements.buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), def !== taskbarElements.TaskbarElement.CONFIGURATOR ? this.buildDynamicActionsList() : this.buildActionsSettingsList(), dataExporterStoreKey, this.presentationMode);
|
230
231
|
}
|
231
232
|
else {
|
232
233
|
return taskbarElements.buildCustomButton(def, className, this.getIdElemBtnCustom(def), elem => this.elementClick(elem), elem => this.isEnabled(elem));
|
@@ -235,10 +236,13 @@ const SnkTaskbar = class {
|
|
235
236
|
buildDynamicActionsList() {
|
236
237
|
var _a;
|
237
238
|
if (this._hiddenActionsList.length) {
|
238
|
-
return [...((_a = this.actionsList) !== null && _a !== void 0 ? _a : []),
|
239
|
+
return [...((_a = this.actionsList) !== null && _a !== void 0 ? _a : []), ...this._hiddenActionsList];
|
239
240
|
}
|
240
241
|
return this.actionsList;
|
241
242
|
}
|
243
|
+
buildActionsSettingsList() {
|
244
|
+
return this.actionsSettingsList;
|
245
|
+
}
|
242
246
|
getIdElemBtnNative(taskbarElem) {
|
243
247
|
return core.StringUtils.toCamelCase(taskbarElem);
|
244
248
|
}
|
@@ -90,6 +90,9 @@ const buildElem = (element, className, dataElementId, getTitle, action, isEnable
|
|
90
90
|
case exports.TaskbarElement.FORM_MODE:
|
91
91
|
return iconButton("list", element, className, dataElementId, title, action, isEnabled);
|
92
92
|
case exports.TaskbarElement.CONFIGURATOR:
|
93
|
+
if ((actions === null || actions === void 0 ? void 0 : actions.length) > 0) {
|
94
|
+
return splitButton("settings-inverted", element, className, title, dataElementId, isEnabled, actions, action);
|
95
|
+
}
|
93
96
|
return iconButton("settings-inverted", element, className, dataElementId, title, action, isEnabled);
|
94
97
|
case exports.TaskbarElement.MORE_OPTIONS:
|
95
98
|
return actionButton(element, className, dataElementId, title, isEnabled, actions, action);
|
@@ -114,6 +117,11 @@ function iconTextButton(iconName, name, className, dataElementId, text, title, a
|
|
114
117
|
return index.h("ez-button", { key: dataElementId, title: title, label: text, size: "small", class: className, "data-taskbar-label": text, "data-taskbar-icon": iconName, "data-taskbar-element": name, "data-element-id": dataElementId, enabled: isEnabled(name), onClick: () => action(name) },
|
115
118
|
index.h("ez-icon", { class: "ez-padding-right--small", slot: "leftIcon", iconName: iconName }));
|
116
119
|
}
|
120
|
+
function splitButton(iconName, element, className, title, dataElementId, isEnabled, actions, action) {
|
121
|
+
return actions && actions.length > 0
|
122
|
+
? index.h("taskbar-split-button", { iconName: iconName, class: className, key: dataElementId, "data-taskbar-icon": iconName, "data-taskbar-label": title, "data-taskbar-element": element, "data-element-id": dataElementId, enabled: isEnabled(element), actions: actions, title: title, action: () => action(element) })
|
123
|
+
: undefined;
|
124
|
+
}
|
117
125
|
function actionButton(element, className, dataElementId, title, isEnabled, actions, action) {
|
118
126
|
return actions && actions.length > 0
|
119
127
|
? index.h("taskbar-actions-button", { class: className, key: dataElementId, title: title, "data-taskbar-element": element, "data-element-id": dataElementId, enabled: isEnabled(element), actions: actions, onTaskbarActionSelected: (evt) => action(evt.detail.value) })
|
@@ -1,7 +1,5 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
const index = require('./index-f9e81701.js');
|
4
|
-
|
5
3
|
class TaskbarProcessor {
|
6
4
|
constructor(defaultButtons) {
|
7
5
|
this._defaultButtons = defaultButtons;
|
@@ -52,37 +50,4 @@ class TaskbarProcessor {
|
|
52
50
|
}
|
53
51
|
}
|
54
52
|
|
55
|
-
const EVENT_NAME = 'taskbarActionsOpened';
|
56
|
-
const buildFieldSearch = (action, optionLoader, onSelectField) => {
|
57
|
-
return index.h("ez-search", { class: 'ez-actions-button--bottom-padding', canShowError: 'false', showSelectedValue: 'false', showOptionValue: 'false', suppressEmptyOption: 'true', label: action.label, value: '', optionLoader: optionLoader, onEzChange: (evt) => onSelectField(evt.detail), ignoreLimitCharsToSearch: true });
|
58
|
-
};
|
59
|
-
async function focusOnFieldSerch(field) {
|
60
|
-
requestAnimationFrame(async () => {
|
61
|
-
if (field) {
|
62
|
-
const realElement = field['$elm$'];
|
63
|
-
if (!realElement)
|
64
|
-
return;
|
65
|
-
realElement.value = null;
|
66
|
-
await realElement.setFocus();
|
67
|
-
}
|
68
|
-
});
|
69
|
-
}
|
70
|
-
const openFieldSearch = async (moreOptions, field) => {
|
71
|
-
if (!moreOptions) {
|
72
|
-
return;
|
73
|
-
}
|
74
|
-
if ((await moreOptions.isOpened())) {
|
75
|
-
await focusOnFieldSerch(field);
|
76
|
-
return;
|
77
|
-
}
|
78
|
-
const eventHandler = () => {
|
79
|
-
focusOnFieldSerch(field);
|
80
|
-
moreOptions.removeEventListener(EVENT_NAME, eventHandler);
|
81
|
-
};
|
82
|
-
moreOptions.addEventListener(EVENT_NAME, eventHandler);
|
83
|
-
await moreOptions.showActions();
|
84
|
-
};
|
85
|
-
|
86
53
|
exports.TaskbarProcessor = TaskbarProcessor;
|
87
|
-
exports.buildFieldSearch = buildFieldSearch;
|
88
|
-
exports.openFieldSearch = openFieldSearch;
|
@@ -56,6 +56,7 @@
|
|
56
56
|
"./components/snk-simple-crud/snk-simple-crud.js",
|
57
57
|
"./components/snk-simple-form-config/snk-simple-form-config.js",
|
58
58
|
"./components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.js",
|
59
|
+
"./components/snk-taskbar/elements/taskbar-split-button/taskbar-split-button.js",
|
59
60
|
"./components/teste-pesquisa/teste-pesquisa.js"
|
60
61
|
],
|
61
62
|
"compiler": {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { h, Host } from '@stencil/core';
|
2
|
-
import { ApplicationContext, ElementIDUtils,
|
2
|
+
import { ApplicationContext, ElementIDUtils, StringUtils, KeyboardManager } from '@sankhyalabs/core';
|
3
3
|
import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
|
4
4
|
import { PresentationMode } from '../../lib';
|
5
5
|
import { VIEW_MODE } from '../../lib/utils/constants';
|
@@ -12,7 +12,6 @@ import { ExporterStrategy } from '../../lib/@types';
|
|
12
12
|
*/
|
13
13
|
export class SnkCrud {
|
14
14
|
constructor() {
|
15
|
-
this._keyDownHandler = async (event) => this.keyDownListener(event);
|
16
15
|
this._viewHistory = [];
|
17
16
|
this._customEditors = new Map();
|
18
17
|
this._customRenders = new Map();
|
@@ -256,7 +255,6 @@ export class SnkCrud {
|
|
256
255
|
}
|
257
256
|
disconnectedCallback() {
|
258
257
|
this.removeShortcuts();
|
259
|
-
window.removeEventListener("keydown", this._keyDownHandler);
|
260
258
|
}
|
261
259
|
async handleDataStateChange(evt) {
|
262
260
|
var _a;
|
@@ -352,34 +350,12 @@ export class SnkCrud {
|
|
352
350
|
}
|
353
351
|
this.configuratorCancel.emit();
|
354
352
|
}
|
355
|
-
async keyDownListener(event) {
|
356
|
-
if (!event.ctrlKey || event.key == undefined || event.key.toUpperCase() !== "F") {
|
357
|
-
return;
|
358
|
-
}
|
359
|
-
if (this._element == undefined) {
|
360
|
-
return;
|
361
|
-
}
|
362
|
-
if (JSUtils.isHiddenElement(this._element)) {
|
363
|
-
return;
|
364
|
-
}
|
365
|
-
FloatingManager.closeAll();
|
366
|
-
if (this._currentViewMode === VIEW_MODE.GRID) {
|
367
|
-
await this._snkGrid.findColumn();
|
368
|
-
}
|
369
|
-
else {
|
370
|
-
await this._guidesViewer.findField();
|
371
|
-
}
|
372
|
-
event.preventDefault();
|
373
|
-
}
|
374
|
-
connectedCallback() {
|
375
|
-
window.addEventListener("keydown", this._keyDownHandler, { capture: true });
|
376
|
-
}
|
377
353
|
render() {
|
378
354
|
if (this._resourceID == undefined) {
|
379
355
|
return;
|
380
356
|
}
|
381
357
|
this._snkDataUnit.ignoreSaveMessage = (this._currentViewMode === VIEW_MODE.GRID && !this.enableGridInsert);
|
382
|
-
return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", { class: 'ez-flex ez-flex--column ez-size-height--full ez-size-width--full ez-padding--medium' }, h("snk-grid", { ref: (ref) => this._snkGrid = ref, class: 'ez-flex ez-flex--column ez-size-height--full ez-size-width--full', filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableLockManagerTaskbarClick: this.enableLockManagerTaskbarClick, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, strategyExporter: this.strategyExporter, multipleEditionEnabled: this.multipleEditionEnabled }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName, enableGridInsert: this.enableGridInsert, getCustomTitle: this.setCustomFormTitle, ignoreReadOnlyFormFields: this.ignoreReadOnlyFormFields }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item",
|
358
|
+
return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", { class: 'ez-flex ez-flex--column ez-size-height--full ez-size-width--full ez-padding--medium' }, h("snk-grid", { ref: (ref) => this._snkGrid = ref, class: 'ez-flex ez-flex--column ez-size-height--full ez-size-width--full', filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableLockManagerTaskbarClick: this.enableLockManagerTaskbarClick, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, strategyExporter: this.strategyExporter, multipleEditionEnabled: this.multipleEditionEnabled }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName, enableGridInsert: this.enableGridInsert, getCustomTitle: this.setCustomFormTitle, ignoreReadOnlyFormFields: this.ignoreReadOnlyFormFields }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", { tabIndex: "0" }, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId, layoutFormConfig: this.layoutFormConfig })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
|
383
359
|
}
|
384
360
|
static get is() { return "snk-crud"; }
|
385
361
|
static get encapsulation() { return "scoped"; }
|
package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Action } from '@sankhyalabs/core';
|
1
|
+
import { Action as DUAction, KeyboardManager, StringUtils } from '@sankhyalabs/core';
|
2
2
|
import { Host, forceUpdate, h } from '@stencil/core';
|
3
3
|
import { SnkFormConfigManager } from '../../../snk-form-config/SnkFormConfigManager';
|
4
4
|
import { buildFormMetadata } from "@sankhyalabs/ezui/dist/collection/utils/form";
|
@@ -8,11 +8,14 @@ import { VIEW_MODE } from '../../../../lib/utils/constants';
|
|
8
8
|
import { SnkGuidesViewer } from '../snk-guides-viewer';
|
9
9
|
import { SnkMessageBuilder } from '../../../../lib/message/SnkMessageBuilder';
|
10
10
|
import { GuideBuilder } from '../GuideBuilder';
|
11
|
+
import { buildFieldSearch, LABEL_SEARCH_FIELD, SHORTCUT_SEARCH_FIELD } from '@sankhyalabs/ezui/dist/collection/utils';
|
11
12
|
export class SnkDetailView {
|
12
13
|
constructor() {
|
13
14
|
this._disabledButtons = undefined;
|
14
15
|
this._currentView = undefined;
|
15
16
|
this.attachmentRegisterKey = undefined;
|
17
|
+
this._fieldToGetFocus = undefined;
|
18
|
+
this._hasToCreateFieldSearch = true;
|
16
19
|
this.formConfigManager = undefined;
|
17
20
|
this.dataUnitName = undefined;
|
18
21
|
this.resourceID = undefined;
|
@@ -232,9 +235,14 @@ export class SnkDetailView {
|
|
232
235
|
async componentDidLoad() {
|
233
236
|
await this.observerPropsCustomEditor(this.customEditors);
|
234
237
|
await this.observeCustomRenders(this.customRenders);
|
238
|
+
this.initKeyboardManager();
|
239
|
+
}
|
240
|
+
disconnectedCallback() {
|
241
|
+
var _a;
|
242
|
+
(_a = this._keyboardManager) === null || _a === void 0 ? void 0 : _a.unbindAllShortcutKeys();
|
235
243
|
}
|
236
244
|
async dataUnitActionHandler(action) {
|
237
|
-
if (action.type ===
|
245
|
+
if (action.type === DUAction.FIELD_INVALIDATED) {
|
238
246
|
this.addErrorBadgeToBranchGuide();
|
239
247
|
}
|
240
248
|
}
|
@@ -245,10 +253,53 @@ export class SnkDetailView {
|
|
245
253
|
normalizeBranchGuideId(id) {
|
246
254
|
return id === null || id === void 0 ? void 0 : id.replace(/child\[(.*?)\]/g, '$1').replace(/::/g, '>');
|
247
255
|
}
|
256
|
+
getSettingsListForm() {
|
257
|
+
const hardList = [{
|
258
|
+
value: StringUtils.generateUUID(),
|
259
|
+
label: this.messagesBuilder.getMessage("snkCrud.findColumn", undefined),
|
260
|
+
disableCloseOnSelect: true,
|
261
|
+
eagerInitialize: true,
|
262
|
+
itemBuilder: (_, item) => this.getFieldsSearch(item)
|
263
|
+
}];
|
264
|
+
return hardList;
|
265
|
+
}
|
266
|
+
getFieldsSearch(item) {
|
267
|
+
if (this._fieldSearch == undefined || this._hasToCreateFieldSearch) {
|
268
|
+
this._hasToCreateFieldSearch = false;
|
269
|
+
this._fieldSearch = buildFieldSearch(item, ({ argument }) => this.fieldsOptionLoader(argument), (option) => this.onSelectField(option));
|
270
|
+
}
|
271
|
+
return this._fieldSearch;
|
272
|
+
}
|
273
|
+
fieldsOptionLoader(argument) {
|
274
|
+
const searchTerm = argument === null || argument === void 0 ? void 0 : argument.toLowerCase();
|
275
|
+
const allFields = this.getFormFields().map(field => { var _a; return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(field.name); });
|
276
|
+
const filteredFields = allFields.filter(field => {
|
277
|
+
var _a, _b;
|
278
|
+
return ((_a = field.name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTerm)) ||
|
279
|
+
((_b = field.label) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchTerm));
|
280
|
+
});
|
281
|
+
const options = filteredFields.map(field => ({ value: field.name, label: field.label }));
|
282
|
+
return Promise.resolve(options);
|
283
|
+
}
|
284
|
+
onSelectField(option) {
|
285
|
+
if (option == undefined) {
|
286
|
+
return;
|
287
|
+
}
|
288
|
+
this._fieldToGetFocus = option.value;
|
289
|
+
}
|
290
|
+
clearFieldToFocusHandler() {
|
291
|
+
this._fieldToGetFocus = undefined;
|
292
|
+
}
|
293
|
+
async initKeyboardManager() {
|
294
|
+
this._keyboardManager = new KeyboardManager({ propagate: false, element: this._element });
|
295
|
+
this._keyboardManager.bind(SHORTCUT_SEARCH_FIELD, async () => {
|
296
|
+
await this._snkFormView.showSearchField();
|
297
|
+
}, { description: LABEL_SEARCH_FIELD, element: this._element });
|
298
|
+
}
|
248
299
|
render() {
|
249
300
|
this.updateLabel();
|
250
301
|
//const cardConfig: IFormCardConfig = this._cardsState?.get(this.selectedForm);
|
251
|
-
return (h(Host, null, h("snk-data-unit", { ref: (el) => this._snkDataUnit = el, dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: this.handleDataStateChange.bind(this), ignoreSaveMessage: this._currentView === VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, h("ez-view-stack", { ref: (ref) => this.updateViewStack(ref) }, h("stack-item", null, h("div", { class: "ez-box ez-box--shadow grid-container" }, h("div", { class: "ez-title--primary ez-size-width--full ez-padding--large detail-header" }, h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), h("snk-grid", { class: "ez-size-width--full", ref: (ref) => this._snkGrid = ref, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.emitSwitchEvent(VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: this.presentationMode, canEdit: this.canEdit, isDetail: true, taskbarCustomContainerId: this.taskbarCustomContainerId, gridHeaderCustomSlotId: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS", topTaskbarCustomSlotId: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS", outlineMode: false }))), h("stack-item", null, h("snk-form-view", { ref: (ref) => this._snkFormView = ref, canExpand: false, canFix: false, name: this.selectedForm, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), label: this.label, levelPath: this._levelPath, onFormItemsReady: ({ detail: formItems }) => this.formItemsReady.emit(formItems) }, h("snk-taskbar", { key: "guideViewerTaskbar", class: "form-taskbar", "data-element-id": "guideViewer", configName: this._configName, messagesBuilder: this.messagesBuilder, disabledButtons: this._disabledButtons, buttons: "INSERT,PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,GRID_MODE,CONFIGURATOR", primaryButton: "INSERT", presentationMode: this.presentationMode, onActionClick: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }, h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" })))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this.entityName, onBack: this.handleAttachBack.bind(this) }))))));
|
302
|
+
return (h(Host, null, h("snk-data-unit", { ref: (el) => this._snkDataUnit = el, dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: this.handleDataStateChange.bind(this), ignoreSaveMessage: this._currentView === VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, h("ez-view-stack", { ref: (ref) => this.updateViewStack(ref) }, h("stack-item", null, h("div", { class: "ez-box ez-box--shadow grid-container" }, h("div", { class: "ez-title--primary ez-size-width--full ez-padding--large detail-header" }, h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), h("snk-grid", { class: "ez-size-width--full", ref: (ref) => this._snkGrid = ref, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.emitSwitchEvent(VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: this.presentationMode, canEdit: this.canEdit, isDetail: true, taskbarCustomContainerId: this.taskbarCustomContainerId, gridHeaderCustomSlotId: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS", topTaskbarCustomSlotId: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS", outlineMode: false }))), h("stack-item", null, h("snk-form-view", { ref: (ref) => this._snkFormView = ref, canExpand: false, canFix: false, name: this.selectedForm, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), fieldToFocus: this._fieldToGetFocus, label: this.label, levelPath: this._levelPath, onFormItemsReady: ({ detail: formItems }) => this.formItemsReady.emit(formItems), onSnkRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), fieldSearch: this._fieldSearch }, h("snk-taskbar", { key: "guideViewerTaskbar", class: "form-taskbar", "data-element-id": "guideViewer", configName: this._configName, messagesBuilder: this.messagesBuilder, disabledButtons: this._disabledButtons, buttons: "INSERT,PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,GRID_MODE,CONFIGURATOR", primaryButton: "INSERT", presentationMode: this.presentationMode, onActionClick: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: "DETAIL_TASKBAR_CUSTOM_ELEMENTS", actionsSettingsList: this.getSettingsListForm() }, h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" })))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this.entityName, onBack: this.handleAttachBack.bind(this) }))))));
|
252
303
|
}
|
253
304
|
static get is() { return "snk-detail-view"; }
|
254
305
|
static get encapsulation() { return "scoped"; }
|
@@ -576,7 +627,9 @@ export class SnkDetailView {
|
|
576
627
|
return {
|
577
628
|
"_disabledButtons": {},
|
578
629
|
"_currentView": {},
|
579
|
-
"attachmentRegisterKey": {}
|
630
|
+
"attachmentRegisterKey": {},
|
631
|
+
"_fieldToGetFocus": {},
|
632
|
+
"_hasToCreateFieldSearch": {}
|
580
633
|
};
|
581
634
|
}
|
582
635
|
static get events() {
|
@@ -756,6 +809,7 @@ export class SnkDetailView {
|
|
756
809
|
}
|
757
810
|
};
|
758
811
|
}
|
812
|
+
static get elementRef() { return "_element"; }
|
759
813
|
static get watchers() {
|
760
814
|
return [{
|
761
815
|
"propName": "dataUnit",
|