@sankhyalabs/sankhyablocks 8.11.0 → 8.12.0-dev.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/{ConfigStorage-49d4681c.js → ConfigStorage-0d507a8f.js} +2 -2
- package/dist/cjs/{DataFetcher-1b1e9ff0.js → DataFetcher-ba94ed5b.js} +22 -18
- package/dist/cjs/{SnkFormConfigManager-d4184bfa.js → SnkFormConfigManager-467907f6.js} +23 -6
- package/dist/cjs/{SnkMessageBuilder-fbc33123.js → SnkMessageBuilder-7293d0ad.js} +9 -1
- package/dist/cjs/{auth-fetcher-eee6ec18.js → auth-fetcher-c8467c07.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-38233d72.js → dataunit-fetcher-529a3866.js} +1 -1
- package/dist/cjs/{taskbar-processor-bce3f499.js → field-search-ca27041a.js} +7 -0
- package/dist/cjs/{form-config-fetcher-00372ac0.js → form-config-fetcher-df043d3d.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-8bc6d0a5.js → pesquisa-fetcher-ef050a47.js} +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button.cjs.entry.js +4 -4
- package/dist/cjs/snk-application.cjs.entry.js +8 -8
- package/dist/cjs/snk-attach.cjs.entry.js +4 -4
- package/dist/cjs/snk-crud.cjs.entry.js +29 -5
- package/dist/cjs/snk-data-exporter.cjs.entry.js +4 -4
- package/dist/cjs/{snk-data-unit-04d76538.js → snk-data-unit-1bc69073.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +9 -9
- package/dist/cjs/snk-filter-bar.cjs.entry.js +4 -4
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +4 -4
- package/dist/cjs/snk-form-config.cjs.entry.js +3 -3
- package/dist/cjs/snk-form-view.cjs.entry.js +14 -0
- package/dist/cjs/snk-form.cjs.entry.js +5 -5
- package/dist/cjs/snk-grid-config.cjs.entry.js +4 -4
- package/dist/cjs/snk-grid.cjs.entry.js +55 -9
- package/dist/cjs/{snk-guides-viewer-0d5aad6b.js → snk-guides-viewer-f94f2113.js} +82 -17
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +9 -9
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +4 -4
- package/dist/cjs/snk-simple-crud.cjs.entry.js +137 -10
- package/dist/collection/components/snk-attach/snk-attach.js +1 -1
- package/dist/collection/components/snk-crud/snk-crud.js +25 -1
- package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +45 -0
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +98 -11
- package/dist/collection/components/snk-form/SnkFormConfigManager.js +22 -5
- package/dist/collection/components/snk-grid/snk-grid.js +69 -4
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +136 -6
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +1 -0
- package/dist/collection/components/snk-taskbar/subcomponents/field-search.js +4 -0
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +9 -5
- package/dist/collection/lib/message/SnkMessageBuilder.js +2 -0
- package/dist/collection/lib/message/resources/snk-crud.msg.js +1 -0
- package/dist/collection/lib/message/resources/snk-grid.msg.js +3 -1
- package/dist/collection/lib/message/resources/snk-simple-crud.msg.js +4 -0
- package/dist/components/DataFetcher.js +22 -18
- package/dist/components/SnkFormConfigManager.js +22 -5
- package/dist/components/SnkMessageBuilder.js +9 -1
- package/dist/components/{SnkMultiSelectionListDataSource.js → field-search.js} +6 -1
- package/dist/components/snk-attach2.js +1 -1
- package/dist/components/snk-crud.js +25 -1
- package/dist/components/snk-detail-view2.js +80 -12
- package/dist/components/snk-form-view2.js +15 -0
- package/dist/components/snk-grid2.js +52 -5
- package/dist/components/snk-simple-crud2.js +135 -6
- package/dist/esm/{ConfigStorage-9a086412.js → ConfigStorage-379a9cba.js} +2 -2
- package/dist/esm/{DataFetcher-7814568f.js → DataFetcher-aa159c5a.js} +22 -18
- package/dist/esm/{SnkFormConfigManager-709e68a2.js → SnkFormConfigManager-587e9030.js} +24 -7
- package/dist/esm/{SnkMessageBuilder-f60c5443.js → SnkMessageBuilder-ca843d1b.js} +9 -1
- package/dist/esm/{auth-fetcher-06354710.js → auth-fetcher-c05dc474.js} +1 -1
- package/dist/esm/{dataunit-fetcher-aa70ea72.js → dataunit-fetcher-fd329839.js} +1 -1
- package/dist/esm/{taskbar-processor-94402e6e.js → field-search-c6938ee4.js} +7 -1
- package/dist/esm/{form-config-fetcher-24f43afd.js → form-config-fetcher-36219cd3.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-f7aaf727.js → pesquisa-fetcher-dd3ca0a5.js} +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button.entry.js +4 -4
- package/dist/esm/snk-application.entry.js +8 -8
- package/dist/esm/snk-attach.entry.js +4 -4
- package/dist/esm/snk-crud.entry.js +30 -6
- package/dist/esm/snk-data-exporter.entry.js +4 -4
- package/dist/esm/{snk-data-unit-ad5cf70c.js → snk-data-unit-6208ebf0.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +9 -9
- package/dist/esm/snk-filter-bar.entry.js +4 -4
- package/dist/esm/snk-filter-modal-item.entry.js +4 -4
- package/dist/esm/snk-form-config.entry.js +3 -3
- package/dist/esm/snk-form-view.entry.js +14 -0
- package/dist/esm/snk-form.entry.js +5 -5
- package/dist/esm/snk-grid-config.entry.js +4 -4
- package/dist/esm/snk-grid.entry.js +54 -8
- package/dist/esm/{snk-guides-viewer-9c50ebea.js → snk-guides-viewer-86171cf4.js} +81 -16
- package/dist/esm/snk-guides-viewer.entry.js +9 -9
- package/dist/esm/snk-personalized-filter.entry.js +4 -4
- package/dist/esm/snk-simple-crud.entry.js +137 -10
- package/dist/sankhyablocks/p-03dcc5ff.entry.js +1 -0
- package/dist/sankhyablocks/{p-e47d966c.js → p-0d7863ed.js} +1 -1
- package/dist/sankhyablocks/p-2028633c.js +1 -0
- package/dist/sankhyablocks/{p-117b0848.entry.js → p-257feef3.entry.js} +2 -2
- package/dist/sankhyablocks/{p-df841828.entry.js → p-2e963486.entry.js} +1 -1
- package/dist/sankhyablocks/{p-cd2a285d.js → p-32f0935f.js} +1 -1
- package/dist/sankhyablocks/{p-97277eae.entry.js → p-35fe6e61.entry.js} +1 -1
- package/dist/sankhyablocks/{p-ee49df44.js → p-3af0a81e.js} +1 -1
- package/dist/sankhyablocks/p-3ecd72a4.js +1 -0
- package/dist/sankhyablocks/{p-5cff2f60.js → p-4396d1a6.js} +1 -1
- package/dist/sankhyablocks/p-4775a293.entry.js +1 -0
- package/dist/sankhyablocks/{p-d05d3e37.entry.js → p-4b0ea83f.entry.js} +1 -1
- package/dist/sankhyablocks/p-50734e76.entry.js +1 -0
- package/dist/sankhyablocks/p-50e18dee.entry.js +1 -0
- package/dist/sankhyablocks/p-672380c5.js +1 -0
- package/dist/sankhyablocks/{p-57196255.entry.js → p-729f5f5b.entry.js} +1 -1
- package/dist/sankhyablocks/{p-88039a7f.js → p-9695f78b.js} +1 -1
- package/dist/sankhyablocks/{p-29ffb7d7.entry.js → p-aaa1438e.entry.js} +1 -1
- package/dist/sankhyablocks/{p-1b7105ae.entry.js → p-b542061a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-2e1a8609.entry.js → p-c259545b.entry.js} +1 -1
- package/dist/sankhyablocks/{p-a3868fbc.entry.js → p-cb7419e0.entry.js} +1 -1
- package/dist/sankhyablocks/{p-84a53f61.entry.js → p-d1677df0.entry.js} +1 -1
- package/dist/sankhyablocks/p-d2666ae0.entry.js +1 -0
- package/dist/sankhyablocks/{p-e38f28ae.js → p-d9bb09b3.js} +2 -2
- package/dist/sankhyablocks/{p-809a09ac.entry.js → p-de56f563.entry.js} +1 -1
- package/dist/sankhyablocks/{p-3f0fe056.js → p-e6380c60.js} +1 -1
- package/dist/sankhyablocks/p-f5059aa8.entry.js +1 -0
- package/dist/sankhyablocks/p-ff6064e7.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-crud/snk-crud.d.ts +3 -0
- package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +10 -1
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +25 -1
- package/dist/types/components/snk-form/SnkFormConfigManager.d.ts +6 -1
- package/dist/types/components/snk-grid/snk-grid.d.ts +7 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +23 -2
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +2 -3
- package/dist/types/components/snk-taskbar/subcomponents/field-search.d.ts +2 -0
- package/dist/types/components.d.ts +20 -0
- package/dist/types/lib/message/resources/snk-simple-crud.msg.d.ts +2 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-1626c58f.entry.js +0 -1
- package/dist/sankhyablocks/p-3fd145ac.js +0 -1
- package/dist/sankhyablocks/p-9be1dfd5.entry.js +0 -1
- package/dist/sankhyablocks/p-aa3b0d19.js +0 -1
- package/dist/sankhyablocks/p-c2beb95c.js +0 -1
- package/dist/sankhyablocks/p-c555075c.entry.js +0 -1
- package/dist/sankhyablocks/p-e1aec599.entry.js +0 -1
- package/dist/sankhyablocks/p-fab8339c.entry.js +0 -1
- package/dist/sankhyablocks/p-fad0a721.js +0 -1
- package/dist/sankhyablocks/p-ff90e0e6.entry.js +0 -1
@@ -1,6 +1,6 @@
|
|
1
1
|
import { h, Fragment } from '@stencil/core';
|
2
2
|
import { ApplicationContext, DataType, ElementIDUtils } from '@sankhyalabs/core';
|
3
|
-
import { UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
3
|
+
import { SortMode, UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
4
4
|
import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
|
5
5
|
import { ConfigStorage } from '../../lib/configs/ConfigStorage';
|
6
6
|
import { PresentationMode } from '../../lib/@types';
|
@@ -8,7 +8,7 @@ import TaskbarProcessor from '../snk-taskbar/processor/taskbar-processor';
|
|
8
8
|
import store from "../../lib/store";
|
9
9
|
import SnkMultiSelectionListDataSource from './filtercolumn/SnkMultiSelectionListDataSource';
|
10
10
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
11
|
-
import {
|
11
|
+
import { buildFieldSearch } from '../snk-taskbar/subcomponents/field-search';
|
12
12
|
export class SnkGrid {
|
13
13
|
constructor() {
|
14
14
|
this._topTaskbarProcessor = new TaskbarProcessor({
|
@@ -77,6 +77,22 @@ export class SnkGrid {
|
|
77
77
|
var _a;
|
78
78
|
(_a = this._snkFilterBar) === null || _a === void 0 ? void 0 : _a.reload();
|
79
79
|
}
|
80
|
+
/**
|
81
|
+
* Abre o localizador de colunas
|
82
|
+
*/
|
83
|
+
async findColumn() {
|
84
|
+
if (!this._moreOptions) {
|
85
|
+
return;
|
86
|
+
}
|
87
|
+
if (!(await this._moreOptions.isOpened())) {
|
88
|
+
this._moreOptions.showActions();
|
89
|
+
}
|
90
|
+
if (this._columnSearch) {
|
91
|
+
const realElement = this._columnSearch["$elm$"];
|
92
|
+
realElement.value = null;
|
93
|
+
requestAnimationFrame(() => realElement.setFocus());
|
94
|
+
}
|
95
|
+
}
|
80
96
|
/**
|
81
97
|
* Retorna o elemento da filter-bar da grade.
|
82
98
|
*/
|
@@ -321,12 +337,42 @@ export class SnkGrid {
|
|
321
337
|
getPrimaryButton() {
|
322
338
|
return this.presentationMode === PresentationMode.PRIMARY ? "INSERT" : "";
|
323
339
|
}
|
340
|
+
getColumnSearch(actionButton, item) {
|
341
|
+
if (this._columnSearch != undefined) {
|
342
|
+
return this._columnSearch;
|
343
|
+
}
|
344
|
+
actionButton.addEventListener("ezPopoverOpen", () => {
|
345
|
+
if (this._columnSearch) {
|
346
|
+
const realElement = this._columnSearch["$elm$"];
|
347
|
+
realElement.value = null;
|
348
|
+
}
|
349
|
+
});
|
350
|
+
this._moreOptions = actionButton;
|
351
|
+
this._columnSearch = buildFieldSearch(item, ({ argument }) => new Promise(accept => {
|
352
|
+
this._grid.filterColumns(argument).then((columns) => {
|
353
|
+
accept(columns
|
354
|
+
.filter(column => !column.hidden)
|
355
|
+
.map(column => ({ label: column.label, value: column.name })));
|
356
|
+
});
|
357
|
+
}), (option) => {
|
358
|
+
if (option != undefined) {
|
359
|
+
this._grid.locateColumn(option.value);
|
360
|
+
actionButton.hideActions();
|
361
|
+
}
|
362
|
+
});
|
363
|
+
return this._columnSearch;
|
364
|
+
}
|
324
365
|
getActionsList() {
|
366
|
+
const hardList = [{
|
367
|
+
value: "",
|
368
|
+
label: this.messagesBuilder.getMessage("snkGrid.findColumn", {}),
|
369
|
+
itemBuilder: (actionButton, item) => this.getColumnSearch(actionButton, item)
|
370
|
+
}];
|
325
371
|
if (this.taskbarManager != undefined && this.taskbarManager.getMoreOptions != undefined) {
|
326
372
|
const taskbarID = this.getTopTaskBarId();
|
327
|
-
return this.taskbarManager.getMoreOptions(taskbarID, this.configName, this._dataState, this.actionsList);
|
373
|
+
return hardList.concat(this.taskbarManager.getMoreOptions(taskbarID, this.configName, this._dataState, this.actionsList));
|
328
374
|
}
|
329
|
-
return this.actionsList;
|
375
|
+
return hardList.concat(this.actionsList);
|
330
376
|
}
|
331
377
|
handleFilterConfigUpdated(filterConfig) {
|
332
378
|
if (!filterConfig.length) {
|
@@ -805,6 +851,25 @@ export class SnkGrid {
|
|
805
851
|
"tags": []
|
806
852
|
}
|
807
853
|
},
|
854
|
+
"findColumn": {
|
855
|
+
"complexType": {
|
856
|
+
"signature": "() => Promise<void>",
|
857
|
+
"parameters": [],
|
858
|
+
"references": {
|
859
|
+
"Promise": {
|
860
|
+
"location": "global"
|
861
|
+
},
|
862
|
+
"HTMLEzSearchElement": {
|
863
|
+
"location": "global"
|
864
|
+
}
|
865
|
+
},
|
866
|
+
"return": "Promise<void>"
|
867
|
+
},
|
868
|
+
"docs": {
|
869
|
+
"text": "Abre o localizador de colunas",
|
870
|
+
"tags": []
|
871
|
+
}
|
872
|
+
},
|
808
873
|
"getFilterBar": {
|
809
874
|
"complexType": {
|
810
875
|
"signature": "() => Promise<HTMLSnkFilterBarElement>",
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ApplicationContext, DataType, ObjectUtils, UserInterface, } from '@sankhyalabs/core';
|
1
|
+
import { ApplicationContext, DataType, FloatingManager, ObjectUtils, UserInterface, JSUtils } from '@sankhyalabs/core';
|
2
2
|
import { h } from '@stencil/core';
|
3
3
|
import { SIMPLE_CRUD_MODE, VIEW_MODE } from '../../lib/utils/constants';
|
4
4
|
import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
|
@@ -6,11 +6,13 @@ import { PresentationMode } from '../../lib';
|
|
6
6
|
import TaskbarProcessor from '../snk-taskbar/processor/taskbar-processor';
|
7
7
|
import InMemoryLoader from '../../lib/dataUnit/InMemoryLoader';
|
8
8
|
import SnkMultiSelectionListDataSource from '../snk-grid/filtercolumn/SnkMultiSelectionListDataSource';
|
9
|
+
import { buildFieldSearch } from '../snk-taskbar/subcomponents/field-search';
|
9
10
|
export class SnkSimpleCrud {
|
10
11
|
constructor() {
|
11
|
-
this.REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER"];
|
12
|
-
this.REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER"];
|
12
|
+
this.REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
|
13
|
+
this.REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER", "MORE_OPTIONS"];
|
13
14
|
this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
|
15
|
+
this._keyDownHandler = (event) => this.keyDownListener(event);
|
14
16
|
this._taskbarProcessor = new TaskbarProcessor({
|
15
17
|
"snkSimpleCrudTaskbar.form_regular": this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(TaskbarElement.GRID_MODE),
|
16
18
|
"snkSimpleCrudTaskbar.grid_regular": this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(TaskbarElement.FORM_MODE),
|
@@ -20,11 +22,13 @@ export class SnkSimpleCrud {
|
|
20
22
|
});
|
21
23
|
this._currentViewMode = VIEW_MODE.GRID;
|
22
24
|
this._config = undefined;
|
25
|
+
this._fieldToGetFocus = undefined;
|
23
26
|
this.dataState = undefined;
|
24
27
|
this.dataUnit = undefined;
|
25
28
|
this.mode = SIMPLE_CRUD_MODE.SERVER;
|
26
29
|
this.gridConfig = undefined;
|
27
30
|
this.formConfig = undefined;
|
31
|
+
this._formFields = [];
|
28
32
|
this.multipleSelection = undefined;
|
29
33
|
this.useCancelConfirm = true;
|
30
34
|
this.taskbarManager = undefined;
|
@@ -172,11 +176,135 @@ export class SnkSimpleCrud {
|
|
172
176
|
this.dataUnit.clearSelection();
|
173
177
|
}
|
174
178
|
}
|
179
|
+
getColumnSearch(actionButton, item) {
|
180
|
+
if (this._columnSearch != undefined) {
|
181
|
+
return this._columnSearch;
|
182
|
+
}
|
183
|
+
actionButton.addEventListener("ezPopoverOpen", () => {
|
184
|
+
if (this._columnSearch) {
|
185
|
+
const realElement = this._columnSearch["$elm$"];
|
186
|
+
realElement.value = null;
|
187
|
+
}
|
188
|
+
});
|
189
|
+
this._moreOptions = actionButton;
|
190
|
+
this._columnSearch = buildFieldSearch(item, ({ argument }) => new Promise(accept => {
|
191
|
+
this._grid.filterColumns(argument).then((columns) => {
|
192
|
+
accept(columns
|
193
|
+
.filter(column => !column.hidden)
|
194
|
+
.map(column => ({ label: column.label, value: column.name })));
|
195
|
+
});
|
196
|
+
}), (option) => {
|
197
|
+
if (option != undefined) {
|
198
|
+
this._grid.locateColumn(option.value);
|
199
|
+
actionButton.hideActions();
|
200
|
+
}
|
201
|
+
});
|
202
|
+
return this._columnSearch;
|
203
|
+
}
|
204
|
+
onSelectField(option, actionButton) {
|
205
|
+
if (option == undefined) {
|
206
|
+
return;
|
207
|
+
}
|
208
|
+
this._fieldToGetFocus = option.value;
|
209
|
+
actionButton.hideActions();
|
210
|
+
}
|
211
|
+
getFieldSearch(actionButton, item) {
|
212
|
+
if (this._fieldSearch != undefined) {
|
213
|
+
return this._fieldSearch;
|
214
|
+
}
|
215
|
+
this._moreOptions = actionButton;
|
216
|
+
actionButton.addEventListener("ezPopoverOpen", () => this.findField());
|
217
|
+
this._fieldSearch = buildFieldSearch(item, ({ argument }) => this.fieldsOptionLoader(argument), (option) => this.onSelectField(option, actionButton));
|
218
|
+
return this._fieldSearch;
|
219
|
+
}
|
220
|
+
getFormFields() {
|
221
|
+
var _a, _b;
|
222
|
+
return (_b = (_a = this.formConfig) === null || _a === void 0 ? void 0 : _a.fields) !== null && _b !== void 0 ? _b : this._formFields;
|
223
|
+
}
|
224
|
+
handleFormSetFields(fields) {
|
225
|
+
this._formFields = fields !== null && fields !== void 0 ? fields : [];
|
226
|
+
}
|
227
|
+
fieldsOptionLoader(argument) {
|
228
|
+
const searchTerm = argument === null || argument === void 0 ? void 0 : argument.toLowerCase();
|
229
|
+
const allFields = this.getFormFields().map(field => { var _a; return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(field.name); });
|
230
|
+
const filteredFields = allFields.filter(field => {
|
231
|
+
var _a, _b;
|
232
|
+
return ((_a = field.name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTerm)) ||
|
233
|
+
((_b = field.label) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchTerm));
|
234
|
+
});
|
235
|
+
const options = filteredFields.map(field => ({ value: field.name, label: field.label }));
|
236
|
+
return Promise.resolve(options);
|
237
|
+
}
|
238
|
+
getActionsList() {
|
239
|
+
var _a, _b;
|
240
|
+
return [{
|
241
|
+
value: "",
|
242
|
+
label: (_b = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.findColumn", undefined)) !== null && _b !== void 0 ? _b : "Buscar",
|
243
|
+
itemBuilder: (actionButton, item) => (this._currentViewMode === VIEW_MODE.GRID)
|
244
|
+
? this.getColumnSearch(actionButton, item)
|
245
|
+
: this.getFieldSearch(actionButton, item)
|
246
|
+
}];
|
247
|
+
}
|
248
|
+
keyDownListener(event) {
|
249
|
+
if (!event.ctrlKey || event.key == undefined || event.key.toUpperCase() !== "F") {
|
250
|
+
return;
|
251
|
+
}
|
252
|
+
if (this._element == undefined) {
|
253
|
+
return;
|
254
|
+
}
|
255
|
+
if (JSUtils.isHiddenElement(this._element)) {
|
256
|
+
return;
|
257
|
+
}
|
258
|
+
FloatingManager.closeAll();
|
259
|
+
if (this._currentViewMode === VIEW_MODE.GRID) {
|
260
|
+
this.findColumn();
|
261
|
+
}
|
262
|
+
else {
|
263
|
+
this.findField();
|
264
|
+
}
|
265
|
+
event.preventDefault();
|
266
|
+
}
|
267
|
+
async findField() {
|
268
|
+
if (!this._moreOptions) {
|
269
|
+
return;
|
270
|
+
}
|
271
|
+
if (!(await this._moreOptions.isOpened())) {
|
272
|
+
this._moreOptions.showActions();
|
273
|
+
return;
|
274
|
+
}
|
275
|
+
if (this._fieldSearch) {
|
276
|
+
const realElement = this._fieldSearch["$elm$"];
|
277
|
+
realElement.value = null;
|
278
|
+
requestAnimationFrame(() => realElement.setFocus());
|
279
|
+
}
|
280
|
+
}
|
281
|
+
async findColumn() {
|
282
|
+
if (!this._moreOptions) {
|
283
|
+
return;
|
284
|
+
}
|
285
|
+
if (!(await this._moreOptions.isOpened())) {
|
286
|
+
this._moreOptions.showActions();
|
287
|
+
}
|
288
|
+
if (this._columnSearch) {
|
289
|
+
const realElement = this._columnSearch["$elm$"];
|
290
|
+
realElement.value = null;
|
291
|
+
requestAnimationFrame(() => realElement.setFocus());
|
292
|
+
}
|
293
|
+
}
|
294
|
+
clearFieldToFocusHandler() {
|
295
|
+
this._fieldToGetFocus = undefined;
|
296
|
+
}
|
297
|
+
connectedCallback() {
|
298
|
+
window.addEventListener("keydown", this._keyDownHandler, { capture: true });
|
299
|
+
}
|
300
|
+
disconnectedCallback() {
|
301
|
+
window.removeEventListener("keydown", this._keyDownHandler);
|
302
|
+
}
|
175
303
|
render() {
|
176
304
|
var _a;
|
177
|
-
return (h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium ez-margin-bottom--large", 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, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), columnfilterDataSource: this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
305
|
+
return (h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium ez-margin-bottom--large", 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(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), columnfilterDataSource: this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
178
306
|
? undefined
|
179
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { dataUnit: this.dataUnit, config: this.formConfig }))))));
|
307
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { dataUnit: this.dataUnit, config: this.formConfig, fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }))))));
|
180
308
|
}
|
181
309
|
static get is() { return "snk-simple-crud"; }
|
182
310
|
static get encapsulation() { return "scoped"; }
|
@@ -393,7 +521,9 @@ export class SnkSimpleCrud {
|
|
393
521
|
static get states() {
|
394
522
|
return {
|
395
523
|
"_currentViewMode": {},
|
396
|
-
"_config": {}
|
524
|
+
"_config": {},
|
525
|
+
"_fieldToGetFocus": {},
|
526
|
+
"_formFields": {}
|
397
527
|
};
|
398
528
|
}
|
399
529
|
static get events() {
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { h } from '@stencil/core';
|
2
|
+
export const buildFieldSearch = (action, optionLoader, onSelectField) => {
|
3
|
+
return h("ez-search", { class: "ez-actions-button--bottom-padding", canShowError: "false", showSelectedValue: "false", showOptionValue: "false", suppressEmptyOption: "true", label: action.label, value: action.value, optionLoader: optionLoader, onEzChange: (evt) => onSelectField(evt.detail), ignoreLimitCharsToSearch: true });
|
4
|
+
};
|
@@ -6,12 +6,12 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
6
6
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
7
7
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
8
8
|
};
|
9
|
-
import { ApplicationContext, ErrorException, ObjectUtils,
|
9
|
+
import { ApplicationContext, ErrorException, ObjectUtils, StringUtils, WarningException } from '@sankhyalabs/core';
|
10
10
|
import { batchRequests } from 'graphql-request';
|
11
11
|
import UrlUtils from "../../../lib/utils/urlutils";
|
12
|
-
import { ServiceBrokerRecaller } from './recaller/ServiceBrokerRecaller';
|
13
|
-
import { GraphQLRecaller } from './recaller/GraphQLRecaller';
|
14
12
|
import { PrintUtils } from '../../utils/PrintUtils';
|
13
|
+
import { GraphQLRecaller } from './recaller/GraphQLRecaller';
|
14
|
+
import { ServiceBrokerRecaller } from './recaller/ServiceBrokerRecaller';
|
15
15
|
export class DataFetcher {
|
16
16
|
constructor() {
|
17
17
|
this.ready = true;
|
@@ -361,9 +361,13 @@ export class DataFetcher {
|
|
361
361
|
const { data: dataResponse, errors: errorsResponse, extensions } = response;
|
362
362
|
//Reject promises with errors from query
|
363
363
|
errorsResponse.forEach((errorResponse) => {
|
364
|
-
Object.entries(errorResponse).forEach(([
|
364
|
+
Object.entries(errorResponse).forEach(async ([key, val]) => {
|
365
365
|
var _a;
|
366
|
-
|
366
|
+
const waitingRequest = watingRequestsById.get(val.request.variables[val.index].queryID);
|
367
|
+
const hasClientEvent = await this.proccesGraphQLClientEvents(extensions, waitingRequest.request, waitingRequest.resolve, waitingRequest.reject);
|
368
|
+
if (!hasClientEvent) {
|
369
|
+
(((_a = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new ErrorException("Falha detectada", val.message));
|
370
|
+
}
|
367
371
|
});
|
368
372
|
});
|
369
373
|
//Resolve promises with data from query
|
@@ -4,6 +4,7 @@ import snkTaskbarMessages from "./resources/snk-taskbar.msg.js";
|
|
4
4
|
import crudUtilsMessages from "./resources/crud-utils.msg.js";
|
5
5
|
import snkExporterMessages from "./resources/snk-exporter.msg.js";
|
6
6
|
import snkCrudMessages from "./resources/snk-crud.msg.js";
|
7
|
+
import snkSimpleCrudMessages from "./resources/snk-simple-crud.msg.js";
|
7
8
|
import fileViewerMessages from "./resources/file-viewer.msg.js";
|
8
9
|
import snkApplicationMessages from "./resources/snk-application.msg.js";
|
9
10
|
import { snkFormConfigMessages, snkConfigOptionsMessages, snkFieldConfigMessages, snkTabConfigMessages } from "./resources/snk-form.msg.js";
|
@@ -37,6 +38,7 @@ export class SnkMessageBuilder {
|
|
37
38
|
snkExporter: snkExporterMessages,
|
38
39
|
snkDataExporter: snkDataExporterMessages,
|
39
40
|
snkCrud: snkCrudMessages,
|
41
|
+
snkSimpleCrud: snkSimpleCrudMessages,
|
40
42
|
fileViewer: fileViewerMessages,
|
41
43
|
snkFilterParamConfig: snkFilterParamConfigMessages,
|
42
44
|
snkFilterFieldSearch: snkFilterFieldSearchMessages,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { DataType, ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils } from '@sankhyalabs/core';
|
2
|
-
import { DataUnitTransient } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
3
2
|
import { P as PrintUtils } from './PrintUtils.js';
|
3
|
+
import { DataUnitTransient } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
4
4
|
|
5
5
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
6
6
|
|
@@ -6487,21 +6487,6 @@ class UrlUtils {
|
|
6487
6487
|
}
|
6488
6488
|
}
|
6489
6489
|
|
6490
|
-
class ServiceBrokerRecaller {
|
6491
|
-
constructor(serviceName, requestBody, successCallback, errorCallback) {
|
6492
|
-
this.serviceName = serviceName;
|
6493
|
-
this.requestBody = requestBody;
|
6494
|
-
this.successCallback = successCallback;
|
6495
|
-
this.errorCallback = errorCallback;
|
6496
|
-
}
|
6497
|
-
reCall(requestBody) {
|
6498
|
-
if (requestBody) {
|
6499
|
-
this.requestBody = requestBody;
|
6500
|
-
}
|
6501
|
-
return DataFetcher.get().callServiceBroker(this.serviceName, this.requestBody).then(this.successCallback, this.errorCallback);
|
6502
|
-
}
|
6503
|
-
}
|
6504
|
-
|
6505
6490
|
class GraphQLRecaller {
|
6506
6491
|
constructor(req, resolve, reject) {
|
6507
6492
|
this.req = req;
|
@@ -6528,6 +6513,21 @@ class GraphQLRecaller {
|
|
6528
6513
|
}
|
6529
6514
|
}
|
6530
6515
|
|
6516
|
+
class ServiceBrokerRecaller {
|
6517
|
+
constructor(serviceName, requestBody, successCallback, errorCallback) {
|
6518
|
+
this.serviceName = serviceName;
|
6519
|
+
this.requestBody = requestBody;
|
6520
|
+
this.successCallback = successCallback;
|
6521
|
+
this.errorCallback = errorCallback;
|
6522
|
+
}
|
6523
|
+
reCall(requestBody) {
|
6524
|
+
if (requestBody) {
|
6525
|
+
this.requestBody = requestBody;
|
6526
|
+
}
|
6527
|
+
return DataFetcher.get().callServiceBroker(this.serviceName, this.requestBody).then(this.successCallback, this.errorCallback);
|
6528
|
+
}
|
6529
|
+
}
|
6530
|
+
|
6531
6531
|
var __asyncValues = (undefined && undefined.__asyncValues) || function (o) {
|
6532
6532
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
6533
6533
|
var m = o[Symbol.asyncIterator], i;
|
@@ -6872,9 +6872,13 @@ class DataFetcher {
|
|
6872
6872
|
const { data: dataResponse, errors: errorsResponse, extensions } = response;
|
6873
6873
|
//Reject promises with errors from query
|
6874
6874
|
errorsResponse.forEach((errorResponse) => {
|
6875
|
-
Object.entries(errorResponse).forEach(([
|
6875
|
+
Object.entries(errorResponse).forEach(async ([key, val]) => {
|
6876
6876
|
var _a;
|
6877
|
-
|
6877
|
+
const waitingRequest = watingRequestsById.get(val.request.variables[val.index].queryID);
|
6878
|
+
const hasClientEvent = await this.proccesGraphQLClientEvents(extensions, waitingRequest.request, waitingRequest.resolve, waitingRequest.reject);
|
6879
|
+
if (!hasClientEvent) {
|
6880
|
+
(((_a = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new ErrorException("Falha detectada", val.message));
|
6881
|
+
}
|
6878
6882
|
});
|
6879
6883
|
});
|
6880
6884
|
//Resolve promises with data from query
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { C as ConfigStorage } from './ConfigStorage.js';
|
2
|
-
import { ObjectUtils } from '@sankhyalabs/core';
|
2
|
+
import { ObjectUtils, StringUtils } from '@sankhyalabs/core';
|
3
3
|
import { F as FormConfigFetcher } from './form-config-fetcher.js';
|
4
4
|
|
5
5
|
class SnkFormConfigManager {
|
@@ -63,19 +63,36 @@ class SnkFormConfigManager {
|
|
63
63
|
}
|
64
64
|
return updatingCardConfig;
|
65
65
|
}
|
66
|
-
getFieldsList(dataUnit) {
|
66
|
+
getFieldsList(dataUnit, descriptionFilter) {
|
67
67
|
var _a;
|
68
68
|
const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
|
69
69
|
if (fields != undefined && fields.length > 0) {
|
70
|
-
return
|
70
|
+
return fields.map(({ label, name, readOnly }) => {
|
71
|
+
if (label == undefined) {
|
72
|
+
return dataUnit.getField(name);
|
73
|
+
}
|
74
|
+
return { name, label, readOnly };
|
75
|
+
})
|
76
|
+
.filter(field => this.isFieldVisible(field, descriptionFilter));
|
71
77
|
}
|
72
78
|
if (dataUnit != undefined) {
|
73
79
|
return dataUnit.metadata.fields
|
74
|
-
.filter(field => field
|
75
|
-
.map(({ name }) => { return { name }; });
|
80
|
+
.filter(field => this.isFieldVisible(field, descriptionFilter))
|
81
|
+
.map(({ label, name, readOnly }) => { return { label, name, readOnly }; });
|
76
82
|
}
|
77
83
|
return [];
|
78
84
|
}
|
85
|
+
isFieldVisible(field, descriptionFilter) {
|
86
|
+
if (field.visible === false) {
|
87
|
+
return false;
|
88
|
+
}
|
89
|
+
if (descriptionFilter == undefined) {
|
90
|
+
return true;
|
91
|
+
}
|
92
|
+
const normalizedText = StringUtils.replaceAccentuatedCharsLower((field.label || field.name).toLocaleLowerCase());
|
93
|
+
const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
|
94
|
+
return normalizedText.includes(normalizedFilter);
|
95
|
+
}
|
79
96
|
getInsertionConfig(dataUnit) {
|
80
97
|
const fields = this.getFieldsList(dataUnit).filter(field => {
|
81
98
|
if (dataUnit) {
|
@@ -140,9 +140,14 @@ const snkCrudMessages = {
|
|
140
140
|
update: "Alterar registro",
|
141
141
|
clean: "{{ENTITY_NAME}}"
|
142
142
|
},
|
143
|
+
findColumn: "Buscar campos",
|
143
144
|
goBackTitle: "Voltar"
|
144
145
|
};
|
145
146
|
|
147
|
+
const snkSimpleCrudMessages = {
|
148
|
+
findColumn: "Busca de colunas",
|
149
|
+
};
|
150
|
+
|
146
151
|
const fileViewerMessages = {
|
147
152
|
error: {
|
148
153
|
title: "Erro na Exportação",
|
@@ -234,7 +239,9 @@ const snkConfiguratorMessages = {
|
|
234
239
|
labelForm: "Formulário"
|
235
240
|
};
|
236
241
|
|
237
|
-
const snkGridMessages = {
|
242
|
+
const snkGridMessages = {
|
243
|
+
findColumn: "Busca de colunas"
|
244
|
+
};
|
238
245
|
const snkGridConfigMessages = {
|
239
246
|
gridConfiguration: "Configuração da Grade",
|
240
247
|
columnVisibilityOrder: "Defina visibilidade e ordem das colunas.",
|
@@ -510,6 +517,7 @@ class SnkMessageBuilder {
|
|
510
517
|
snkExporter: snkExporterMessages,
|
511
518
|
snkDataExporter: snkDataExporterMessages,
|
512
519
|
snkCrud: snkCrudMessages,
|
520
|
+
snkSimpleCrud: snkSimpleCrudMessages,
|
513
521
|
fileViewer: fileViewerMessages,
|
514
522
|
snkFilterParamConfig: snkFilterParamConfigMessages,
|
515
523
|
snkFilterFieldSearch: snkFilterFieldSearchMessages,
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { UserInterface, DateUtils } from '@sankhyalabs/core';
|
2
2
|
import InMemoryFilterColumnDataSource from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
|
3
3
|
import { a as PreloadManager } from './dataunit-fetcher.js';
|
4
|
+
import { h } from '@stencil/core/internal/client';
|
4
5
|
|
5
6
|
class TaskbarProcessor {
|
6
7
|
constructor(defaultButtons) {
|
@@ -86,4 +87,8 @@ class SnkMultiSelectionListDataSource {
|
|
86
87
|
}
|
87
88
|
}
|
88
89
|
|
89
|
-
|
90
|
+
const buildFieldSearch = (action, optionLoader, onSelectField) => {
|
91
|
+
return h("ez-search", { class: "ez-actions-button--bottom-padding", canShowError: "false", showSelectedValue: "false", showOptionValue: "false", suppressEmptyOption: "true", label: action.label, value: action.value, optionLoader: optionLoader, onEzChange: (evt) => onSelectField(evt.detail), ignoreLimitCharsToSearch: true });
|
92
|
+
};
|
93
|
+
|
94
|
+
export { SnkMultiSelectionListDataSource as S, TaskbarProcessor as T, buildFieldSearch as b };
|
@@ -446,7 +446,7 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
446
446
|
var _a, _b;
|
447
447
|
if (!this.dataUnit)
|
448
448
|
return null;
|
449
|
-
return (h("main", { class: "snk-attach__main" }, h("header", { class: "snk-attach__header" }, h("snk-simple-bar", { onExit: this.handleBack, messagesBuilder: this.messagesBuilder }, h("div", { slot: "rightSlot" }, h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })))), h("div", { class: "snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column" }, h("div", { class: "ez-box__container" }, h("snk-simple-crud", { ref: (el) => this._crudElement = el, dataUnit: this.dataUnit, taskbarManager: buildTaskBarManager(), gridConfig: (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid, formConfig: (_b = this.crudConfig) === null || _b === void 0 ? void 0 : _b.form, useCancelConfirm: false, onActionClick: this.handleTaskbarClick }, h("div", { slot: "snkSimpleCrudHeader" }, h("div", { class: "ez-flex ez-flex--column" }, h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkAttach.title")), h("span", { class: "ez-text ez-text--medium ez-text--secondary" }, this.getMessage("snkAttach.description")))))))));
|
449
|
+
return (h("main", { class: "snk-attach__main" }, h("header", { class: "snk-attach__header" }, h("snk-simple-bar", { onExit: this.handleBack, messagesBuilder: this.messagesBuilder }, h("div", { slot: "rightSlot" }, h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })))), h("div", { class: "snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column" }, h("div", { class: "ez-box__container" }, h("snk-simple-crud", { ref: (el) => this._crudElement = el, dataUnit: this.dataUnit, taskbarManager: buildTaskBarManager(), gridConfig: (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid, formConfig: (_b = this.crudConfig) === null || _b === void 0 ? void 0 : _b.form, useCancelConfirm: false, onActionClick: this.handleTaskbarClick, messagesBuilder: this.messagesBuilder }, h("div", { slot: "snkSimpleCrudHeader" }, h("div", { class: "ez-flex ez-flex--column" }, h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkAttach.title")), h("span", { class: "ez-text ez-text--medium ez-text--secondary" }, this.getMessage("snkAttach.description")))))))));
|
450
450
|
}
|
451
451
|
static get watchers() { return {
|
452
452
|
"registerKey": ["registerKeyWatcher"]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
2
|
-
import { StringUtils, ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
|
2
|
+
import { StringUtils, ElementIDUtils, ApplicationContext, JSUtils, FloatingManager } from '@sankhyalabs/core';
|
3
3
|
import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
|
4
4
|
import './DataFetcher.js';
|
5
5
|
import './dataunit-fetcher.js';
|
@@ -49,6 +49,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
49
49
|
this.configuratorSave = createEvent(this, "configuratorSave", 7);
|
50
50
|
this.configuratorCancel = createEvent(this, "configuratorCancel", 7);
|
51
51
|
this.formItemsReady = createEvent(this, "formItemsReady", 7);
|
52
|
+
this._keyDownHandler = (event) => this.keyDownListener(event);
|
52
53
|
this._viewHistory = [];
|
53
54
|
this._dataUnit = undefined;
|
54
55
|
this._dataState = undefined;
|
@@ -196,6 +197,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
196
197
|
}
|
197
198
|
disconnectedCallback() {
|
198
199
|
this.removeShortcuts();
|
200
|
+
window.removeEventListener("keydown", this._keyDownHandler);
|
199
201
|
}
|
200
202
|
async initKeyboardManager() {
|
201
203
|
const keyboardManager = await this._application.getKeyboardManager();
|
@@ -274,6 +276,28 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
274
276
|
}
|
275
277
|
this.configuratorCancel.emit();
|
276
278
|
}
|
279
|
+
keyDownListener(event) {
|
280
|
+
if (!event.ctrlKey || event.key == undefined || event.key.toUpperCase() !== "F") {
|
281
|
+
return;
|
282
|
+
}
|
283
|
+
if (this._element == undefined) {
|
284
|
+
return;
|
285
|
+
}
|
286
|
+
if (JSUtils.isHiddenElement(this._element)) {
|
287
|
+
return;
|
288
|
+
}
|
289
|
+
FloatingManager.closeAll();
|
290
|
+
if (this._currentViewMode === VIEW_MODE.GRID) {
|
291
|
+
this._snkGrid.findColumn();
|
292
|
+
}
|
293
|
+
else {
|
294
|
+
this._guidesViewer.findField();
|
295
|
+
}
|
296
|
+
event.preventDefault();
|
297
|
+
}
|
298
|
+
connectedCallback() {
|
299
|
+
window.addEventListener("keydown", this._keyDownHandler, { capture: true });
|
300
|
+
}
|
277
301
|
render() {
|
278
302
|
if (this._resourceID == undefined) {
|
279
303
|
return;
|