@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
@@ -6,17 +6,17 @@ const index = require('./index-f9e81701.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
7
7
|
const constants = require('./constants-35ddd366.js');
|
8
8
|
const taskbarElements = require('./taskbar-elements-39949c7a.js');
|
9
|
-
require('./DataFetcher-
|
10
|
-
require('./pesquisa-fetcher-
|
9
|
+
require('./DataFetcher-ba94ed5b.js');
|
10
|
+
require('./pesquisa-fetcher-ef050a47.js');
|
11
11
|
const index$1 = require('./index-0e663819.js');
|
12
12
|
require('./ISave-d68ce3cd.js');
|
13
13
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
14
14
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
15
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
15
|
+
const dataunitFetcher = require('./dataunit-fetcher-529a3866.js');
|
16
16
|
require('./PreloadManager-84466da6.js');
|
17
17
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
18
|
-
require('./form-config-fetcher-
|
19
|
-
const
|
18
|
+
require('./form-config-fetcher-df043d3d.js');
|
19
|
+
const fieldSearch = require('./field-search-ca27041a.js');
|
20
20
|
const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-ba5838c2.js');
|
21
21
|
require('./index-102ba62d.js');
|
22
22
|
require('./PrintUtils-bcaeb82f.js');
|
@@ -33,10 +33,11 @@ const SnkSimpleCrud = class {
|
|
33
33
|
this.dataUnitReady = index.createEvent(this, "dataUnitReady", 3);
|
34
34
|
this.actionClick = index.createEvent(this, "actionClick", 7);
|
35
35
|
this.formItemsReady = index.createEvent(this, "formItemsReady", 7);
|
36
|
-
this.REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER"];
|
37
|
-
this.REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER"];
|
36
|
+
this.REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
|
37
|
+
this.REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER", "MORE_OPTIONS"];
|
38
38
|
this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource.SnkMultiSelectionListDataSource();
|
39
|
-
this.
|
39
|
+
this._keyDownHandler = (event) => this.keyDownListener(event);
|
40
|
+
this._taskbarProcessor = new fieldSearch.TaskbarProcessor({
|
40
41
|
"snkSimpleCrudTaskbar.form_regular": this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(taskbarElements.TaskbarElement.GRID_MODE),
|
41
42
|
"snkSimpleCrudTaskbar.grid_regular": this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(taskbarElements.TaskbarElement.FORM_MODE),
|
42
43
|
"snkSimpleCrudTaskbar.form_selected": this.resolveInMemoryBtns(this.REGULAR_SELECTED_BTNS).concat(taskbarElements.TaskbarElement.GRID_MODE),
|
@@ -45,11 +46,13 @@ const SnkSimpleCrud = class {
|
|
45
46
|
});
|
46
47
|
this._currentViewMode = constants.VIEW_MODE.GRID;
|
47
48
|
this._config = undefined;
|
49
|
+
this._fieldToGetFocus = undefined;
|
48
50
|
this.dataState = undefined;
|
49
51
|
this.dataUnit = undefined;
|
50
52
|
this.mode = constants.SIMPLE_CRUD_MODE.SERVER;
|
51
53
|
this.gridConfig = undefined;
|
52
54
|
this.formConfig = undefined;
|
55
|
+
this._formFields = [];
|
53
56
|
this.multipleSelection = undefined;
|
54
57
|
this.useCancelConfirm = true;
|
55
58
|
this.taskbarManager = undefined;
|
@@ -197,11 +200,135 @@ const SnkSimpleCrud = class {
|
|
197
200
|
this.dataUnit.clearSelection();
|
198
201
|
}
|
199
202
|
}
|
203
|
+
getColumnSearch(actionButton, item) {
|
204
|
+
if (this._columnSearch != undefined) {
|
205
|
+
return this._columnSearch;
|
206
|
+
}
|
207
|
+
actionButton.addEventListener("ezPopoverOpen", () => {
|
208
|
+
if (this._columnSearch) {
|
209
|
+
const realElement = this._columnSearch["$elm$"];
|
210
|
+
realElement.value = null;
|
211
|
+
}
|
212
|
+
});
|
213
|
+
this._moreOptions = actionButton;
|
214
|
+
this._columnSearch = fieldSearch.buildFieldSearch(item, ({ argument }) => new Promise(accept => {
|
215
|
+
this._grid.filterColumns(argument).then((columns) => {
|
216
|
+
accept(columns
|
217
|
+
.filter(column => !column.hidden)
|
218
|
+
.map(column => ({ label: column.label, value: column.name })));
|
219
|
+
});
|
220
|
+
}), (option) => {
|
221
|
+
if (option != undefined) {
|
222
|
+
this._grid.locateColumn(option.value);
|
223
|
+
actionButton.hideActions();
|
224
|
+
}
|
225
|
+
});
|
226
|
+
return this._columnSearch;
|
227
|
+
}
|
228
|
+
onSelectField(option, actionButton) {
|
229
|
+
if (option == undefined) {
|
230
|
+
return;
|
231
|
+
}
|
232
|
+
this._fieldToGetFocus = option.value;
|
233
|
+
actionButton.hideActions();
|
234
|
+
}
|
235
|
+
getFieldSearch(actionButton, item) {
|
236
|
+
if (this._fieldSearch != undefined) {
|
237
|
+
return this._fieldSearch;
|
238
|
+
}
|
239
|
+
this._moreOptions = actionButton;
|
240
|
+
actionButton.addEventListener("ezPopoverOpen", () => this.findField());
|
241
|
+
this._fieldSearch = fieldSearch.buildFieldSearch(item, ({ argument }) => this.fieldsOptionLoader(argument), (option) => this.onSelectField(option, actionButton));
|
242
|
+
return this._fieldSearch;
|
243
|
+
}
|
244
|
+
getFormFields() {
|
245
|
+
var _a, _b;
|
246
|
+
return (_b = (_a = this.formConfig) === null || _a === void 0 ? void 0 : _a.fields) !== null && _b !== void 0 ? _b : this._formFields;
|
247
|
+
}
|
248
|
+
handleFormSetFields(fields) {
|
249
|
+
this._formFields = fields !== null && fields !== void 0 ? fields : [];
|
250
|
+
}
|
251
|
+
fieldsOptionLoader(argument) {
|
252
|
+
const searchTerm = argument === null || argument === void 0 ? void 0 : argument.toLowerCase();
|
253
|
+
const allFields = this.getFormFields().map(field => { var _a; return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(field.name); });
|
254
|
+
const filteredFields = allFields.filter(field => {
|
255
|
+
var _a, _b;
|
256
|
+
return ((_a = field.name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTerm)) ||
|
257
|
+
((_b = field.label) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchTerm));
|
258
|
+
});
|
259
|
+
const options = filteredFields.map(field => ({ value: field.name, label: field.label }));
|
260
|
+
return Promise.resolve(options);
|
261
|
+
}
|
262
|
+
getActionsList() {
|
263
|
+
var _a, _b;
|
264
|
+
return [{
|
265
|
+
value: "",
|
266
|
+
label: (_b = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.findColumn", undefined)) !== null && _b !== void 0 ? _b : "Buscar",
|
267
|
+
itemBuilder: (actionButton, item) => (this._currentViewMode === constants.VIEW_MODE.GRID)
|
268
|
+
? this.getColumnSearch(actionButton, item)
|
269
|
+
: this.getFieldSearch(actionButton, item)
|
270
|
+
}];
|
271
|
+
}
|
272
|
+
keyDownListener(event) {
|
273
|
+
if (!event.ctrlKey || event.key == undefined || event.key.toUpperCase() !== "F") {
|
274
|
+
return;
|
275
|
+
}
|
276
|
+
if (this._element == undefined) {
|
277
|
+
return;
|
278
|
+
}
|
279
|
+
if (core.JSUtils.isHiddenElement(this._element)) {
|
280
|
+
return;
|
281
|
+
}
|
282
|
+
core.FloatingManager.closeAll();
|
283
|
+
if (this._currentViewMode === constants.VIEW_MODE.GRID) {
|
284
|
+
this.findColumn();
|
285
|
+
}
|
286
|
+
else {
|
287
|
+
this.findField();
|
288
|
+
}
|
289
|
+
event.preventDefault();
|
290
|
+
}
|
291
|
+
async findField() {
|
292
|
+
if (!this._moreOptions) {
|
293
|
+
return;
|
294
|
+
}
|
295
|
+
if (!(await this._moreOptions.isOpened())) {
|
296
|
+
this._moreOptions.showActions();
|
297
|
+
return;
|
298
|
+
}
|
299
|
+
if (this._fieldSearch) {
|
300
|
+
const realElement = this._fieldSearch["$elm$"];
|
301
|
+
realElement.value = null;
|
302
|
+
requestAnimationFrame(() => realElement.setFocus());
|
303
|
+
}
|
304
|
+
}
|
305
|
+
async findColumn() {
|
306
|
+
if (!this._moreOptions) {
|
307
|
+
return;
|
308
|
+
}
|
309
|
+
if (!(await this._moreOptions.isOpened())) {
|
310
|
+
this._moreOptions.showActions();
|
311
|
+
}
|
312
|
+
if (this._columnSearch) {
|
313
|
+
const realElement = this._columnSearch["$elm$"];
|
314
|
+
realElement.value = null;
|
315
|
+
requestAnimationFrame(() => realElement.setFocus());
|
316
|
+
}
|
317
|
+
}
|
318
|
+
clearFieldToFocusHandler() {
|
319
|
+
this._fieldToGetFocus = undefined;
|
320
|
+
}
|
321
|
+
connectedCallback() {
|
322
|
+
window.addEventListener("keydown", this._keyDownHandler, { capture: true });
|
323
|
+
}
|
324
|
+
disconnectedCallback() {
|
325
|
+
window.removeEventListener("keydown", this._keyDownHandler);
|
326
|
+
}
|
200
327
|
render() {
|
201
328
|
var _a;
|
202
|
-
return (index.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(constants.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, index.h("header", null, index.h("slot", { name: "snkSimpleCrudHeader" })), index.h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, index.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: index$1.PresentationMode.SECONDARY }, index.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index.h("stack-item", null, index.h("ez-grid", { dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(constants.VIEW_MODE.FORM), columnfilterDataSource: this.dataUnit.name.includes(dataunitFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
329
|
+
return (index.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(constants.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, index.h("header", null, index.h("slot", { name: "snkSimpleCrudHeader" })), index.h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, index.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: index$1.PresentationMode.SECONDARY }, index.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index.h("stack-item", null, index.h("ez-grid", { ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(constants.VIEW_MODE.FORM), columnfilterDataSource: this.dataUnit.name.includes(dataunitFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
203
330
|
? undefined
|
204
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, index.h("div", { slot: "footer" }, index.h("slot", { name: "snkSimpleCrudFooter" })))), index.h("stack-item", null, index.h("ez-form", { dataUnit: this.dataUnit, config: this.formConfig }))))));
|
331
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, index.h("div", { slot: "footer" }, index.h("slot", { name: "snkSimpleCrudFooter" })))), index.h("stack-item", null, index.h("ez-form", { dataUnit: this.dataUnit, config: this.formConfig, fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }))))));
|
205
332
|
}
|
206
333
|
get _element() { return index.getElement(this); }
|
207
334
|
static get watchers() { return {
|
@@ -110,7 +110,7 @@ export class SnkAttach {
|
|
110
110
|
var _a, _b;
|
111
111
|
if (!this.dataUnit)
|
112
112
|
return null;
|
113
|
-
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")))))))));
|
113
|
+
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")))))))));
|
114
114
|
}
|
115
115
|
static get is() { return "snk-attach"; }
|
116
116
|
static get encapsulation() { return "scoped"; }
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { h, Host } from '@stencil/core';
|
2
|
-
import { ApplicationContext, ElementIDUtils, StringUtils } from '@sankhyalabs/core';
|
2
|
+
import { ApplicationContext, ElementIDUtils, FloatingManager, StringUtils, JSUtils } 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';
|
@@ -11,6 +11,7 @@ import { AutorizationType } from '../../lib/http/data-fetcher/fetchers/auth-fetc
|
|
11
11
|
*/
|
12
12
|
export class SnkCrud {
|
13
13
|
constructor() {
|
14
|
+
this._keyDownHandler = (event) => this.keyDownListener(event);
|
14
15
|
this._viewHistory = [];
|
15
16
|
this._dataUnit = undefined;
|
16
17
|
this._dataState = undefined;
|
@@ -158,6 +159,7 @@ export class SnkCrud {
|
|
158
159
|
}
|
159
160
|
disconnectedCallback() {
|
160
161
|
this.removeShortcuts();
|
162
|
+
window.removeEventListener("keydown", this._keyDownHandler);
|
161
163
|
}
|
162
164
|
async initKeyboardManager() {
|
163
165
|
const keyboardManager = await this._application.getKeyboardManager();
|
@@ -236,6 +238,28 @@ export class SnkCrud {
|
|
236
238
|
}
|
237
239
|
this.configuratorCancel.emit();
|
238
240
|
}
|
241
|
+
keyDownListener(event) {
|
242
|
+
if (!event.ctrlKey || event.key == undefined || event.key.toUpperCase() !== "F") {
|
243
|
+
return;
|
244
|
+
}
|
245
|
+
if (this._element == undefined) {
|
246
|
+
return;
|
247
|
+
}
|
248
|
+
if (JSUtils.isHiddenElement(this._element)) {
|
249
|
+
return;
|
250
|
+
}
|
251
|
+
FloatingManager.closeAll();
|
252
|
+
if (this._currentViewMode === VIEW_MODE.GRID) {
|
253
|
+
this._snkGrid.findColumn();
|
254
|
+
}
|
255
|
+
else {
|
256
|
+
this._guidesViewer.findField();
|
257
|
+
}
|
258
|
+
event.preventDefault();
|
259
|
+
}
|
260
|
+
connectedCallback() {
|
261
|
+
window.addEventListener("keydown", this._keyDownHandler, { capture: true });
|
262
|
+
}
|
239
263
|
render() {
|
240
264
|
if (this._resourceID == undefined) {
|
241
265
|
return;
|
@@ -15,6 +15,7 @@ export class SnkFormView {
|
|
15
15
|
this.canExpand = true;
|
16
16
|
this.canFix = true;
|
17
17
|
this.recordsValidator = undefined;
|
18
|
+
this.fieldToFocus = undefined;
|
18
19
|
}
|
19
20
|
async showUp() {
|
20
21
|
if (this._formView) {
|
@@ -79,6 +80,18 @@ export class SnkFormView {
|
|
79
80
|
this._dataBinder.onDisconnectedCallback();
|
80
81
|
}
|
81
82
|
}
|
83
|
+
componentDidRender() {
|
84
|
+
if (this.fieldToFocus == undefined) {
|
85
|
+
return;
|
86
|
+
}
|
87
|
+
if (!this.fields.some(item => item.name === this.fieldToFocus)) {
|
88
|
+
return;
|
89
|
+
}
|
90
|
+
requestAnimationFrame(() => {
|
91
|
+
this._dataBinder.setFocus(this.fieldToFocus);
|
92
|
+
this.snkRequestClearFieldToFocus.emit();
|
93
|
+
});
|
94
|
+
}
|
82
95
|
render() {
|
83
96
|
return (h(Host, { class: "ez-box__container" }, h("div", { class: "summary-header ez-flex ez-size-width--full" }, h("div", { class: "ez-flex ez-text ez-title--primary ez-text--bold ez-flex--justify-start ez-flex--align-items-center ez-col--sd-9" }, this.levelPath ? h("span", { class: "level-path" }, this.levelPath + " /") : undefined, this.label), h("div", { class: "ez-flex ez-flex--justify-end ez-col--sd-3" }, this.canFix &&
|
84
97
|
h("ez-button", { class: "ez-padding-left--medium", mode: "icon", size: "small", iconName: this.fixed ? "un-pin" : "push-pin", "data-element-id": ElementIDUtils.getInternalIDInfo("toggleFixed_ezFormCard"), onClick: () => this.changeFix(), title: this.fixed ? "Desafixar" : "Fixar" }), this.canExpand &&
|
@@ -331,6 +344,23 @@ export class SnkFormView {
|
|
331
344
|
"tags": [],
|
332
345
|
"text": "Validador respons\u00E1vel por checar a integridade das informa\u00E7\u00F5es do registro."
|
333
346
|
}
|
347
|
+
},
|
348
|
+
"fieldToFocus": {
|
349
|
+
"type": "string",
|
350
|
+
"mutable": false,
|
351
|
+
"complexType": {
|
352
|
+
"original": "string",
|
353
|
+
"resolved": "string",
|
354
|
+
"references": {}
|
355
|
+
},
|
356
|
+
"required": false,
|
357
|
+
"optional": false,
|
358
|
+
"docs": {
|
359
|
+
"tags": [],
|
360
|
+
"text": "Determina o campo que deve ficar em evid\u00EAncia."
|
361
|
+
},
|
362
|
+
"attribute": "field-to-focus",
|
363
|
+
"reflect": false
|
334
364
|
}
|
335
365
|
};
|
336
366
|
}
|
@@ -355,6 +385,21 @@ export class SnkFormView {
|
|
355
385
|
}
|
356
386
|
}
|
357
387
|
}
|
388
|
+
}, {
|
389
|
+
"method": "snkRequestClearFieldToFocus",
|
390
|
+
"name": "snkRequestClearFieldToFocus",
|
391
|
+
"bubbles": true,
|
392
|
+
"cancelable": true,
|
393
|
+
"composed": true,
|
394
|
+
"docs": {
|
395
|
+
"tags": [],
|
396
|
+
"text": "Emitido quando o campo recebe foco"
|
397
|
+
},
|
398
|
+
"complexType": {
|
399
|
+
"original": "void",
|
400
|
+
"resolved": "void",
|
401
|
+
"references": {}
|
402
|
+
}
|
358
403
|
}, {
|
359
404
|
"method": "formItemsReady",
|
360
405
|
"name": "formItemsReady",
|
@@ -7,6 +7,7 @@ import { TaskbarElement } from '../../snk-taskbar/elements/taskbar-elements';
|
|
7
7
|
import { VIEW_MODE } from '../../../lib/utils/constants';
|
8
8
|
import { PresentationMode } from '../../../lib';
|
9
9
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
10
|
+
import { buildFieldSearch } from '../../snk-taskbar/subcomponents/field-search';
|
10
11
|
const FORM_NAME_PREFIX = "__FORM:";
|
11
12
|
export class SnkGuidesViewer {
|
12
13
|
constructor() {
|
@@ -25,10 +26,12 @@ export class SnkGuidesViewer {
|
|
25
26
|
this.presentationMode = undefined;
|
26
27
|
this.resourceID = undefined;
|
27
28
|
this.detailTaskbarCustomContainerId = undefined;
|
29
|
+
this._hasToCreateFieldSearch = true;
|
28
30
|
this._breadcrumbItems = [];
|
29
31
|
this._guides = undefined;
|
30
32
|
this._formEditorConfigManager = undefined;
|
31
33
|
this._formEditorDataUnit = undefined;
|
34
|
+
this._fieldToGetFocus = undefined;
|
32
35
|
}
|
33
36
|
observeDataUnit() {
|
34
37
|
this.loadGuides(true);
|
@@ -53,6 +56,23 @@ export class SnkGuidesViewer {
|
|
53
56
|
this._formEditorConfigManager = masterConfig ? this._configManager : this._currentDetail.formConfigManager;
|
54
57
|
this._formEditorDataUnit = masterConfig ? this.dataUnit : this._currentDetail.dataUnit;
|
55
58
|
}
|
59
|
+
/**
|
60
|
+
* Abre o localizador de campos
|
61
|
+
*/
|
62
|
+
async findField() {
|
63
|
+
if (!this._moreOptions) {
|
64
|
+
return;
|
65
|
+
}
|
66
|
+
if (!(await this._moreOptions.isOpened())) {
|
67
|
+
this._moreOptions.showActions();
|
68
|
+
return;
|
69
|
+
}
|
70
|
+
if (this._fieldSearch) {
|
71
|
+
const realElement = this._fieldSearch["$elm$"];
|
72
|
+
realElement.value = null;
|
73
|
+
requestAnimationFrame(() => realElement.setFocus());
|
74
|
+
}
|
75
|
+
}
|
56
76
|
exitViewer() {
|
57
77
|
if (this.dataUnit.isDirty()) {
|
58
78
|
this.dataUnit.cancelEdition({ after: () => this.exit.emit() });
|
@@ -176,25 +196,26 @@ export class SnkGuidesViewer {
|
|
176
196
|
static updateContentCard(formName, cardConfig, propertyChanged, configManager) {
|
177
197
|
return configManager.saveCardState(formName, cardConfig, propertyChanged);
|
178
198
|
}
|
179
|
-
static buildFixedForms(
|
180
|
-
|
199
|
+
static buildFixedForms(params) {
|
200
|
+
var _a;
|
201
|
+
const cardsState = (_a = params.formConfig) === null || _a === void 0 ? void 0 : _a.cardsState;
|
181
202
|
if (cardsState == undefined) {
|
182
203
|
return;
|
183
204
|
}
|
184
205
|
return (h(Fragment, null, Array.from(cardsState.entries())
|
185
|
-
.filter(([formName, cardConfig]) => (cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed) && formName != selectedForm)
|
206
|
+
.filter(([formName, cardConfig]) => (cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed) && formName != params.selectedForm)
|
186
207
|
.sort(([, cardConfigA], [, cardConfigB]) => {
|
187
208
|
const indexA = (cardConfigA === null || cardConfigA === void 0 ? void 0 : cardConfigA.fixSequence) || 0;
|
188
209
|
const indexB = (cardConfigB === null || cardConfigB === void 0 ? void 0 : cardConfigB.fixSequence) || 0;
|
189
210
|
return indexA - indexB;
|
190
211
|
})
|
191
212
|
.map(([formName, cardConfig]) => {
|
192
|
-
var _a;
|
193
|
-
const sheet = formMetadata.getSheet(formName);
|
213
|
+
var _a, _b;
|
214
|
+
const sheet = params.formMetadata.getSheet(formName);
|
194
215
|
if (sheet == undefined) {
|
195
216
|
return;
|
196
217
|
}
|
197
|
-
return h("snk-form-view", { levelPath: levelPath, label: sheet.label, name: formName, fields: sheet.fields, formMetadata: formMetadata, dataUnit: dataUnit, recordsValidator: recordsValidator, contracted: (cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.presentation) === "CONTRACTED", fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_a = formConfig === null ||
|
218
|
+
return h("snk-form-view", { levelPath: params.levelPath, label: sheet.label, name: formName, fields: sheet.fields, formMetadata: params.formMetadata, dataUnit: params.dataUnit, recordsValidator: params.recordsValidator, contracted: (cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.presentation) === "CONTRACTED", fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_b = (_a = params.formConfig) === null || _a === void 0 ? void 0 : _a.summary) === null || _b === void 0 ? void 0 : _b.get(formName), fieldToFocus: params.fieldToFocus, key: formName, onSnkRequestClearFieldToFocus: _ => { var _a; return (_a = params.onRequestClearFieldToFocus) === null || _a === void 0 ? void 0 : _a.call(params); } });
|
198
219
|
})));
|
199
220
|
}
|
200
221
|
wrapDetail(levels, content) {
|
@@ -243,7 +264,7 @@ export class SnkGuidesViewer {
|
|
243
264
|
const sheet = this._masterFormMetadata.getSheet(cardId);
|
244
265
|
if (sheet) {
|
245
266
|
const cardConfig = (_c = (_b = this.masterFormConfig) === null || _b === void 0 ? void 0 : _b.cardsState) === null || _c === void 0 ? void 0 : _c.get(cardId);
|
246
|
-
content = h("snk-form-view", { ref: ref => this._mainForm = ref, fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_e = (_d = this.masterFormConfig) === null || _d === void 0 ? void 0 : _d.summary) === null || _e === void 0 ? void 0 : _e.get(cardId), name: cardId, label: sheet.label, fields: sheet.fields, dataUnit: this.dataUnit, formMetadata: this._masterFormMetadata, recordsValidator: this.recordsValidator, key: guideId }, this.presentationMode == PresentationMode.SECONDARY && this.buildTaskBar());
|
267
|
+
content = h("snk-form-view", { ref: ref => this._mainForm = ref, fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_e = (_d = this.masterFormConfig) === null || _d === void 0 ? void 0 : _d.summary) === null || _e === void 0 ? void 0 : _e.get(cardId), name: cardId, label: sheet.label, fields: sheet.fields, dataUnit: this.dataUnit, formMetadata: this._masterFormMetadata, recordsValidator: this.recordsValidator, fieldToFocus: this._fieldToGetFocus, key: guideId, onSnkRequestClearFieldToFocus: _ => this.clearFieldToFocusHandler() }, this.presentationMode == PresentationMode.SECONDARY && this.buildTaskBar());
|
247
268
|
}
|
248
269
|
}
|
249
270
|
return content;
|
@@ -262,6 +283,13 @@ export class SnkGuidesViewer {
|
|
262
283
|
});
|
263
284
|
this.resetGuideBadge(currentItem);
|
264
285
|
}
|
286
|
+
changeGuideHandler(guideName) {
|
287
|
+
var _a;
|
288
|
+
(_a = this._guideNavigator) === null || _a === void 0 ? void 0 : _a.selectGuide(guideName);
|
289
|
+
}
|
290
|
+
clearFieldToFocusHandler() {
|
291
|
+
this._fieldToGetFocus = undefined;
|
292
|
+
}
|
265
293
|
resetGuideBadge(selectedGuide) {
|
266
294
|
var _a;
|
267
295
|
this._guides = [...(_a = this._guides) === null || _a === void 0 ? void 0 : _a.map(guide => {
|
@@ -327,11 +355,41 @@ export class SnkGuidesViewer {
|
|
327
355
|
}
|
328
356
|
this._guideHasChanged = false;
|
329
357
|
}
|
358
|
+
getFieldsSearch(actionButton, item) {
|
359
|
+
if (this._fieldSearch == undefined || this._hasToCreateFieldSearch) {
|
360
|
+
this._hasToCreateFieldSearch = false;
|
361
|
+
this._moreOptions = actionButton;
|
362
|
+
actionButton.addEventListener("ezPopoverOpen", () => this.findField());
|
363
|
+
actionButton.addEventListener("ezDisconnectedActionButtons", () => this._hasToCreateFieldSearch = true);
|
364
|
+
this._fieldSearch = buildFieldSearch(item, ({ argument }) => this.fieldsOptionLoader(argument), (option) => this.onSelectField(option, actionButton));
|
365
|
+
}
|
366
|
+
return this._fieldSearch;
|
367
|
+
}
|
368
|
+
fieldsOptionLoader(argument) {
|
369
|
+
return Promise.resolve(this._configManager.getFieldsList(this.dataUnit, argument)
|
370
|
+
.map(field => ({ value: field.name, label: field.label })));
|
371
|
+
}
|
372
|
+
onSelectField(option, actionButton) {
|
373
|
+
if (option == undefined) {
|
374
|
+
return;
|
375
|
+
}
|
376
|
+
this._fieldToGetFocus = option.value;
|
377
|
+
const fieldGuideName = this.getGuideName(option.value);
|
378
|
+
if (fieldGuideName !== this.selectedGuide.id) {
|
379
|
+
this.changeGuideHandler(fieldGuideName);
|
380
|
+
}
|
381
|
+
actionButton.hideActions();
|
382
|
+
}
|
330
383
|
getActionsList() {
|
384
|
+
const hardList = [{
|
385
|
+
value: "",
|
386
|
+
label: this.getMessage("snkCrud.findColumn"),
|
387
|
+
itemBuilder: (actionButton, item) => this.getFieldsSearch(actionButton, item)
|
388
|
+
}];
|
331
389
|
if (this.taskbarManager != undefined && this.taskbarManager.getMoreOptions != undefined) {
|
332
|
-
return this.taskbarManager.getMoreOptions(this.getTaskBarId(), this.configName, this.dataState, this.actionsList);
|
390
|
+
return hardList.concat(this.taskbarManager.getMoreOptions(this.getTaskBarId(), this.configName, this.dataState, this.actionsList));
|
333
391
|
}
|
334
|
-
return this.actionsList;
|
392
|
+
return hardList.concat(this.actionsList);
|
335
393
|
}
|
336
394
|
buildTaskBar() {
|
337
395
|
var _a;
|
@@ -398,7 +456,15 @@ export class SnkGuidesViewer {
|
|
398
456
|
h("div", { class: "ez-margin-top--extra-small" }, h("ez-breadcrumb", Object.assign({ items: this._breadcrumbItems, onSelectedItem: (evt) => this.onBreadcrumbClickHandler(evt === null || evt === void 0 ? void 0 : evt.detail) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("breadcrumb")}` }))))), this.presentationMode != PresentationMode.SECONDARY && this.buildTaskBar()), h("div", { class: "snk-guides-viewer__container" }, showGuides ?
|
399
457
|
h("ez-guide-navigator", { ref: (ref) => this._guideNavigator = ref, class: "snk-guides-viewer__guide-navigator", items: this._guides, selectedId: this.selectedGuide ? this.selectedGuide.id : undefined, onEzSelectionChange: evt => this.updateSelectedGuideHandler(evt.detail) })
|
400
458
|
:
|
401
|
-
h("div", null), h("div", { class: "snk-guides-viewer__detail-container" }, SnkGuidesViewer.buildFixedForms(
|
459
|
+
h("div", null), h("div", { class: "snk-guides-viewer__detail-container" }, SnkGuidesViewer.buildFixedForms({
|
460
|
+
formConfig: this.masterFormConfig,
|
461
|
+
formMetadata: this._masterFormMetadata,
|
462
|
+
selectedForm: (_b = this.selectedGuide) === null || _b === void 0 ? void 0 : _b.id,
|
463
|
+
dataUnit: this.dataUnit,
|
464
|
+
recordsValidator: this.recordsValidator,
|
465
|
+
fieldToFocus: this._fieldToGetFocus,
|
466
|
+
onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this)
|
467
|
+
}), this.getContent())), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this.getConfigViewMode(), onConfigSelected: (evt) => this.changeConfigViewMode(evt.detail), messagesBuilder: this.messagesBuilder, onOpenConfig: (evt) => this.openConfig(evt.detail), resourceID: this.resourceID })));
|
402
468
|
}
|
403
469
|
static get is() { return "snk-guides-viewer"; }
|
404
470
|
static get encapsulation() { return "scoped"; }
|
@@ -689,10 +755,12 @@ export class SnkGuidesViewer {
|
|
689
755
|
}
|
690
756
|
static get states() {
|
691
757
|
return {
|
758
|
+
"_hasToCreateFieldSearch": {},
|
692
759
|
"_breadcrumbItems": {},
|
693
760
|
"_guides": {},
|
694
761
|
"_formEditorConfigManager": {},
|
695
|
-
"_formEditorDataUnit": {}
|
762
|
+
"_formEditorDataUnit": {},
|
763
|
+
"_fieldToGetFocus": {}
|
696
764
|
};
|
697
765
|
}
|
698
766
|
static get events() {
|
@@ -776,6 +844,25 @@ export class SnkGuidesViewer {
|
|
776
844
|
"text": "detail - Define se a configura\u00E7\u00E3o que est\u00E1 sendo carregada \u00E9\nreferente a um form detail."
|
777
845
|
}]
|
778
846
|
}
|
847
|
+
},
|
848
|
+
"findField": {
|
849
|
+
"complexType": {
|
850
|
+
"signature": "() => Promise<void>",
|
851
|
+
"parameters": [],
|
852
|
+
"references": {
|
853
|
+
"Promise": {
|
854
|
+
"location": "global"
|
855
|
+
},
|
856
|
+
"HTMLEzSearchElement": {
|
857
|
+
"location": "global"
|
858
|
+
}
|
859
|
+
},
|
860
|
+
"return": "Promise<void>"
|
861
|
+
},
|
862
|
+
"docs": {
|
863
|
+
"text": "Abre o localizador de campos",
|
864
|
+
"tags": []
|
865
|
+
}
|
779
866
|
}
|
780
867
|
};
|
781
868
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ConfigStorage } from "../../lib/configs/ConfigStorage";
|
2
|
-
import { ObjectUtils } from "@sankhyalabs/core";
|
2
|
+
import { ObjectUtils, StringUtils } from "@sankhyalabs/core";
|
3
3
|
import { FormConfigFetcher } from "../../lib/http/data-fetcher/fetchers/form-config-fetcher";
|
4
4
|
export class SnkFormConfigManager {
|
5
5
|
constructor(configName, resourceID, onConfigChange) {
|
@@ -62,19 +62,36 @@ export class SnkFormConfigManager {
|
|
62
62
|
}
|
63
63
|
return updatingCardConfig;
|
64
64
|
}
|
65
|
-
getFieldsList(dataUnit) {
|
65
|
+
getFieldsList(dataUnit, descriptionFilter) {
|
66
66
|
var _a;
|
67
67
|
const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
|
68
68
|
if (fields != undefined && fields.length > 0) {
|
69
|
-
return
|
69
|
+
return fields.map(({ label, name, readOnly }) => {
|
70
|
+
if (label == undefined) {
|
71
|
+
return dataUnit.getField(name);
|
72
|
+
}
|
73
|
+
return { name, label, readOnly };
|
74
|
+
})
|
75
|
+
.filter(field => this.isFieldVisible(field, descriptionFilter));
|
70
76
|
}
|
71
77
|
if (dataUnit != undefined) {
|
72
78
|
return dataUnit.metadata.fields
|
73
|
-
.filter(field => field
|
74
|
-
.map(({ name }) => { return { name }; });
|
79
|
+
.filter(field => this.isFieldVisible(field, descriptionFilter))
|
80
|
+
.map(({ label, name, readOnly }) => { return { label, name, readOnly }; });
|
75
81
|
}
|
76
82
|
return [];
|
77
83
|
}
|
84
|
+
isFieldVisible(field, descriptionFilter) {
|
85
|
+
if (field.visible === false) {
|
86
|
+
return false;
|
87
|
+
}
|
88
|
+
if (descriptionFilter == undefined) {
|
89
|
+
return true;
|
90
|
+
}
|
91
|
+
const normalizedText = StringUtils.replaceAccentuatedCharsLower((field.label || field.name).toLocaleLowerCase());
|
92
|
+
const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
|
93
|
+
return normalizedText.includes(normalizedFilter);
|
94
|
+
}
|
78
95
|
getInsertionConfig(dataUnit) {
|
79
96
|
const fields = this.getFieldsList(dataUnit).filter(field => {
|
80
97
|
if (dataUnit) {
|