@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
@@ -12,7 +12,7 @@ import './filter-item-type.enum.js';
|
|
12
12
|
import './form-config-fetcher.js';
|
13
13
|
import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
|
14
14
|
import { V as VIEW_MODE } from './constants.js';
|
15
|
-
import { T as TaskbarProcessor } from './
|
15
|
+
import { T as TaskbarProcessor, b as buildFieldSearch } from './field-search.js';
|
16
16
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
17
17
|
import { d as defineCustomElement$s } from './snk-attach2.js';
|
18
18
|
import { d as defineCustomElement$r } from './snk-config-options2.js';
|
@@ -67,10 +67,12 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
67
67
|
this.presentationMode = undefined;
|
68
68
|
this.resourceID = undefined;
|
69
69
|
this.detailTaskbarCustomContainerId = undefined;
|
70
|
+
this._hasToCreateFieldSearch = true;
|
70
71
|
this._breadcrumbItems = [];
|
71
72
|
this._guides = undefined;
|
72
73
|
this._formEditorConfigManager = undefined;
|
73
74
|
this._formEditorDataUnit = undefined;
|
75
|
+
this._fieldToGetFocus = undefined;
|
74
76
|
}
|
75
77
|
observeDataUnit() {
|
76
78
|
this.loadGuides(true);
|
@@ -95,6 +97,23 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
95
97
|
this._formEditorConfigManager = masterConfig ? this._configManager : this._currentDetail.formConfigManager;
|
96
98
|
this._formEditorDataUnit = masterConfig ? this.dataUnit : this._currentDetail.dataUnit;
|
97
99
|
}
|
100
|
+
/**
|
101
|
+
* Abre o localizador de campos
|
102
|
+
*/
|
103
|
+
async findField() {
|
104
|
+
if (!this._moreOptions) {
|
105
|
+
return;
|
106
|
+
}
|
107
|
+
if (!(await this._moreOptions.isOpened())) {
|
108
|
+
this._moreOptions.showActions();
|
109
|
+
return;
|
110
|
+
}
|
111
|
+
if (this._fieldSearch) {
|
112
|
+
const realElement = this._fieldSearch["$elm$"];
|
113
|
+
realElement.value = null;
|
114
|
+
requestAnimationFrame(() => realElement.setFocus());
|
115
|
+
}
|
116
|
+
}
|
98
117
|
exitViewer() {
|
99
118
|
if (this.dataUnit.isDirty()) {
|
100
119
|
this.dataUnit.cancelEdition({ after: () => this.exit.emit() });
|
@@ -218,25 +237,26 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
218
237
|
static updateContentCard(formName, cardConfig, propertyChanged, configManager) {
|
219
238
|
return configManager.saveCardState(formName, cardConfig, propertyChanged);
|
220
239
|
}
|
221
|
-
static buildFixedForms(
|
222
|
-
|
240
|
+
static buildFixedForms(params) {
|
241
|
+
var _a;
|
242
|
+
const cardsState = (_a = params.formConfig) === null || _a === void 0 ? void 0 : _a.cardsState;
|
223
243
|
if (cardsState == undefined) {
|
224
244
|
return;
|
225
245
|
}
|
226
246
|
return (h(Fragment, null, Array.from(cardsState.entries())
|
227
|
-
.filter(([formName, cardConfig]) => (cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed) && formName != selectedForm)
|
247
|
+
.filter(([formName, cardConfig]) => (cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed) && formName != params.selectedForm)
|
228
248
|
.sort(([, cardConfigA], [, cardConfigB]) => {
|
229
249
|
const indexA = (cardConfigA === null || cardConfigA === void 0 ? void 0 : cardConfigA.fixSequence) || 0;
|
230
250
|
const indexB = (cardConfigB === null || cardConfigB === void 0 ? void 0 : cardConfigB.fixSequence) || 0;
|
231
251
|
return indexA - indexB;
|
232
252
|
})
|
233
253
|
.map(([formName, cardConfig]) => {
|
234
|
-
var _a;
|
235
|
-
const sheet = formMetadata.getSheet(formName);
|
254
|
+
var _a, _b;
|
255
|
+
const sheet = params.formMetadata.getSheet(formName);
|
236
256
|
if (sheet == undefined) {
|
237
257
|
return;
|
238
258
|
}
|
239
|
-
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 ||
|
259
|
+
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); } });
|
240
260
|
})));
|
241
261
|
}
|
242
262
|
wrapDetail(levels, content) {
|
@@ -285,7 +305,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
285
305
|
const sheet = this._masterFormMetadata.getSheet(cardId);
|
286
306
|
if (sheet) {
|
287
307
|
const cardConfig = (_c = (_b = this.masterFormConfig) === null || _b === void 0 ? void 0 : _b.cardsState) === null || _c === void 0 ? void 0 : _c.get(cardId);
|
288
|
-
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());
|
308
|
+
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());
|
289
309
|
}
|
290
310
|
}
|
291
311
|
return content;
|
@@ -304,6 +324,13 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
304
324
|
});
|
305
325
|
this.resetGuideBadge(currentItem);
|
306
326
|
}
|
327
|
+
changeGuideHandler(guideName) {
|
328
|
+
var _a;
|
329
|
+
(_a = this._guideNavigator) === null || _a === void 0 ? void 0 : _a.selectGuide(guideName);
|
330
|
+
}
|
331
|
+
clearFieldToFocusHandler() {
|
332
|
+
this._fieldToGetFocus = undefined;
|
333
|
+
}
|
307
334
|
resetGuideBadge(selectedGuide) {
|
308
335
|
var _a;
|
309
336
|
this._guides = [...(_a = this._guides) === null || _a === void 0 ? void 0 : _a.map(guide => {
|
@@ -369,11 +396,41 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
369
396
|
}
|
370
397
|
this._guideHasChanged = false;
|
371
398
|
}
|
399
|
+
getFieldsSearch(actionButton, item) {
|
400
|
+
if (this._fieldSearch == undefined || this._hasToCreateFieldSearch) {
|
401
|
+
this._hasToCreateFieldSearch = false;
|
402
|
+
this._moreOptions = actionButton;
|
403
|
+
actionButton.addEventListener("ezPopoverOpen", () => this.findField());
|
404
|
+
actionButton.addEventListener("ezDisconnectedActionButtons", () => this._hasToCreateFieldSearch = true);
|
405
|
+
this._fieldSearch = buildFieldSearch(item, ({ argument }) => this.fieldsOptionLoader(argument), (option) => this.onSelectField(option, actionButton));
|
406
|
+
}
|
407
|
+
return this._fieldSearch;
|
408
|
+
}
|
409
|
+
fieldsOptionLoader(argument) {
|
410
|
+
return Promise.resolve(this._configManager.getFieldsList(this.dataUnit, argument)
|
411
|
+
.map(field => ({ value: field.name, label: field.label })));
|
412
|
+
}
|
413
|
+
onSelectField(option, actionButton) {
|
414
|
+
if (option == undefined) {
|
415
|
+
return;
|
416
|
+
}
|
417
|
+
this._fieldToGetFocus = option.value;
|
418
|
+
const fieldGuideName = this.getGuideName(option.value);
|
419
|
+
if (fieldGuideName !== this.selectedGuide.id) {
|
420
|
+
this.changeGuideHandler(fieldGuideName);
|
421
|
+
}
|
422
|
+
actionButton.hideActions();
|
423
|
+
}
|
372
424
|
getActionsList() {
|
425
|
+
const hardList = [{
|
426
|
+
value: "",
|
427
|
+
label: this.getMessage("snkCrud.findColumn"),
|
428
|
+
itemBuilder: (actionButton, item) => this.getFieldsSearch(actionButton, item)
|
429
|
+
}];
|
373
430
|
if (this.taskbarManager != undefined && this.taskbarManager.getMoreOptions != undefined) {
|
374
|
-
return this.taskbarManager.getMoreOptions(this.getTaskBarId(), this.configName, this.dataState, this.actionsList);
|
431
|
+
return hardList.concat(this.taskbarManager.getMoreOptions(this.getTaskBarId(), this.configName, this.dataState, this.actionsList));
|
375
432
|
}
|
376
|
-
return this.actionsList;
|
433
|
+
return hardList.concat(this.actionsList);
|
377
434
|
}
|
378
435
|
buildTaskBar() {
|
379
436
|
var _a;
|
@@ -440,7 +497,15 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
440
497
|
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 ?
|
441
498
|
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) })
|
442
499
|
:
|
443
|
-
h("div", null), h("div", { class: "snk-guides-viewer__detail-container" }, SnkGuidesViewer.buildFixedForms(
|
500
|
+
h("div", null), h("div", { class: "snk-guides-viewer__detail-container" }, SnkGuidesViewer.buildFixedForms({
|
501
|
+
formConfig: this.masterFormConfig,
|
502
|
+
formMetadata: this._masterFormMetadata,
|
503
|
+
selectedForm: (_b = this.selectedGuide) === null || _b === void 0 ? void 0 : _b.id,
|
504
|
+
dataUnit: this.dataUnit,
|
505
|
+
recordsValidator: this.recordsValidator,
|
506
|
+
fieldToFocus: this._fieldToGetFocus,
|
507
|
+
onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this)
|
508
|
+
}), 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 })));
|
444
509
|
}
|
445
510
|
static get watchers() { return {
|
446
511
|
"dataUnit": ["observeDataUnit"],
|
@@ -463,11 +528,14 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
463
528
|
"presentationMode": [1, "presentation-mode"],
|
464
529
|
"resourceID": [1, "resource-i-d"],
|
465
530
|
"detailTaskbarCustomContainerId": [1, "detail-taskbar-custom-container-id"],
|
531
|
+
"_hasToCreateFieldSearch": [32],
|
466
532
|
"_breadcrumbItems": [32],
|
467
533
|
"_guides": [32],
|
468
534
|
"_formEditorConfigManager": [32],
|
469
535
|
"_formEditorDataUnit": [32],
|
470
|
-
"
|
536
|
+
"_fieldToGetFocus": [32],
|
537
|
+
"showFormConfig": [64],
|
538
|
+
"findField": [64]
|
471
539
|
}, [[2, "actionClick", "onActionClick"], [0, "snkContentCardChanged", "onContentCardChanged"]]]);
|
472
540
|
function defineCustomElement$1() {
|
473
541
|
if (typeof customElements === "undefined") {
|
@@ -10,6 +10,7 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
10
10
|
super();
|
11
11
|
this.__registerHost();
|
12
12
|
this.snkContentCardChanged = createEvent(this, "snkContentCardChanged", 7);
|
13
|
+
this.snkRequestClearFieldToFocus = createEvent(this, "snkRequestClearFieldToFocus", 7);
|
13
14
|
this.formItemsReady = createEvent(this, "formItemsReady", 7);
|
14
15
|
this.levelPath = undefined;
|
15
16
|
this.label = undefined;
|
@@ -23,6 +24,7 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
23
24
|
this.canExpand = true;
|
24
25
|
this.canFix = true;
|
25
26
|
this.recordsValidator = undefined;
|
27
|
+
this.fieldToFocus = undefined;
|
26
28
|
}
|
27
29
|
async showUp() {
|
28
30
|
if (this._formView) {
|
@@ -87,6 +89,18 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
87
89
|
this._dataBinder.onDisconnectedCallback();
|
88
90
|
}
|
89
91
|
}
|
92
|
+
componentDidRender() {
|
93
|
+
if (this.fieldToFocus == undefined) {
|
94
|
+
return;
|
95
|
+
}
|
96
|
+
if (!this.fields.some(item => item.name === this.fieldToFocus)) {
|
97
|
+
return;
|
98
|
+
}
|
99
|
+
requestAnimationFrame(() => {
|
100
|
+
this._dataBinder.setFocus(this.fieldToFocus);
|
101
|
+
this.snkRequestClearFieldToFocus.emit();
|
102
|
+
});
|
103
|
+
}
|
90
104
|
render() {
|
91
105
|
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 &&
|
92
106
|
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 &&
|
@@ -110,6 +124,7 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
110
124
|
"canExpand": [4, "can-expand"],
|
111
125
|
"canFix": [4, "can-fix"],
|
112
126
|
"recordsValidator": [16],
|
127
|
+
"fieldToFocus": [1, "field-to-focus"],
|
113
128
|
"showUp": [64]
|
114
129
|
}]);
|
115
130
|
function defineCustomElement() {
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Fragment } from '@stencil/core/internal/client';
|
2
|
-
import {
|
3
|
-
import { UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
2
|
+
import { ElementIDUtils, ApplicationContext, DataType } from '@sankhyalabs/core';
|
3
|
+
import { SortMode, UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
4
4
|
import { d as defineCustomElement$1, T as TaskbarElement } from './snk-taskbar2.js';
|
5
5
|
import { C as ConfigStorage } from './ConfigStorage.js';
|
6
6
|
import { P as PresentationMode } from './index2.js';
|
7
|
-
import { T as TaskbarProcessor, S as SnkMultiSelectionListDataSource } from './
|
7
|
+
import { T as TaskbarProcessor, S as SnkMultiSelectionListDataSource, b as buildFieldSearch } from './field-search.js';
|
8
8
|
import { s as store } from './index3.js';
|
9
9
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
10
10
|
import { d as defineCustomElement$h } from './snk-actions-button2.js';
|
@@ -98,6 +98,22 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
98
98
|
var _a;
|
99
99
|
(_a = this._snkFilterBar) === null || _a === void 0 ? void 0 : _a.reload();
|
100
100
|
}
|
101
|
+
/**
|
102
|
+
* Abre o localizador de colunas
|
103
|
+
*/
|
104
|
+
async findColumn() {
|
105
|
+
if (!this._moreOptions) {
|
106
|
+
return;
|
107
|
+
}
|
108
|
+
if (!(await this._moreOptions.isOpened())) {
|
109
|
+
this._moreOptions.showActions();
|
110
|
+
}
|
111
|
+
if (this._columnSearch) {
|
112
|
+
const realElement = this._columnSearch["$elm$"];
|
113
|
+
realElement.value = null;
|
114
|
+
requestAnimationFrame(() => realElement.setFocus());
|
115
|
+
}
|
116
|
+
}
|
101
117
|
/**
|
102
118
|
* Retorna o elemento da filter-bar da grade.
|
103
119
|
*/
|
@@ -342,12 +358,42 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
342
358
|
getPrimaryButton() {
|
343
359
|
return this.presentationMode === PresentationMode.PRIMARY ? "INSERT" : "";
|
344
360
|
}
|
361
|
+
getColumnSearch(actionButton, item) {
|
362
|
+
if (this._columnSearch != undefined) {
|
363
|
+
return this._columnSearch;
|
364
|
+
}
|
365
|
+
actionButton.addEventListener("ezPopoverOpen", () => {
|
366
|
+
if (this._columnSearch) {
|
367
|
+
const realElement = this._columnSearch["$elm$"];
|
368
|
+
realElement.value = null;
|
369
|
+
}
|
370
|
+
});
|
371
|
+
this._moreOptions = actionButton;
|
372
|
+
this._columnSearch = buildFieldSearch(item, ({ argument }) => new Promise(accept => {
|
373
|
+
this._grid.filterColumns(argument).then((columns) => {
|
374
|
+
accept(columns
|
375
|
+
.filter(column => !column.hidden)
|
376
|
+
.map(column => ({ label: column.label, value: column.name })));
|
377
|
+
});
|
378
|
+
}), (option) => {
|
379
|
+
if (option != undefined) {
|
380
|
+
this._grid.locateColumn(option.value);
|
381
|
+
actionButton.hideActions();
|
382
|
+
}
|
383
|
+
});
|
384
|
+
return this._columnSearch;
|
385
|
+
}
|
345
386
|
getActionsList() {
|
387
|
+
const hardList = [{
|
388
|
+
value: "",
|
389
|
+
label: this.messagesBuilder.getMessage("snkGrid.findColumn", {}),
|
390
|
+
itemBuilder: (actionButton, item) => this.getColumnSearch(actionButton, item)
|
391
|
+
}];
|
346
392
|
if (this.taskbarManager != undefined && this.taskbarManager.getMoreOptions != undefined) {
|
347
393
|
const taskbarID = this.getTopTaskBarId();
|
348
|
-
return this.taskbarManager.getMoreOptions(taskbarID, this.configName, this._dataState, this.actionsList);
|
394
|
+
return hardList.concat(this.taskbarManager.getMoreOptions(taskbarID, this.configName, this._dataState, this.actionsList));
|
349
395
|
}
|
350
|
-
return this.actionsList;
|
396
|
+
return hardList.concat(this.actionsList);
|
351
397
|
}
|
352
398
|
handleFilterConfigUpdated(filterConfig) {
|
353
399
|
if (!filterConfig.length) {
|
@@ -396,6 +442,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
396
442
|
"hideConfig": [64],
|
397
443
|
"setConfig": [64],
|
398
444
|
"reloadFilterBar": [64],
|
445
|
+
"findColumn": [64],
|
399
446
|
"getFilterBar": [64]
|
400
447
|
}]);
|
401
448
|
function defineCustomElement() {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
2
|
-
import { ObjectUtils, ApplicationContext, DataType, UserInterface } from '@sankhyalabs/core';
|
2
|
+
import { ObjectUtils, ApplicationContext, DataType, UserInterface, JSUtils, FloatingManager } from '@sankhyalabs/core';
|
3
3
|
import { V as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants.js';
|
4
4
|
import { T as TaskbarElement, d as defineCustomElement$1 } from './snk-taskbar2.js';
|
5
5
|
import './DataFetcher.js';
|
@@ -10,7 +10,7 @@ import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
10
10
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
11
11
|
import './filter-item-type.enum.js';
|
12
12
|
import './form-config-fetcher.js';
|
13
|
-
import { S as SnkMultiSelectionListDataSource, T as TaskbarProcessor } from './
|
13
|
+
import { S as SnkMultiSelectionListDataSource, T as TaskbarProcessor, b as buildFieldSearch } from './field-search.js';
|
14
14
|
import { d as defineCustomElement$4 } from './snk-data-exporter2.js';
|
15
15
|
import { d as defineCustomElement$3 } from './snk-data-unit2.js';
|
16
16
|
import { d as defineCustomElement$2 } from './snk-exporter-email-sender2.js';
|
@@ -25,9 +25,10 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
25
25
|
this.dataUnitReady = createEvent(this, "dataUnitReady", 3);
|
26
26
|
this.actionClick = createEvent(this, "actionClick", 7);
|
27
27
|
this.formItemsReady = createEvent(this, "formItemsReady", 7);
|
28
|
-
this.REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER"];
|
29
|
-
this.REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER"];
|
28
|
+
this.REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
|
29
|
+
this.REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER", "MORE_OPTIONS"];
|
30
30
|
this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
|
31
|
+
this._keyDownHandler = (event) => this.keyDownListener(event);
|
31
32
|
this._taskbarProcessor = new TaskbarProcessor({
|
32
33
|
"snkSimpleCrudTaskbar.form_regular": this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(TaskbarElement.GRID_MODE),
|
33
34
|
"snkSimpleCrudTaskbar.grid_regular": this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(TaskbarElement.FORM_MODE),
|
@@ -37,11 +38,13 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
37
38
|
});
|
38
39
|
this._currentViewMode = VIEW_MODE.GRID;
|
39
40
|
this._config = undefined;
|
41
|
+
this._fieldToGetFocus = undefined;
|
40
42
|
this.dataState = undefined;
|
41
43
|
this.dataUnit = undefined;
|
42
44
|
this.mode = SIMPLE_CRUD_MODE.SERVER;
|
43
45
|
this.gridConfig = undefined;
|
44
46
|
this.formConfig = undefined;
|
47
|
+
this._formFields = [];
|
45
48
|
this.multipleSelection = undefined;
|
46
49
|
this.useCancelConfirm = true;
|
47
50
|
this.taskbarManager = undefined;
|
@@ -189,11 +192,135 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
189
192
|
this.dataUnit.clearSelection();
|
190
193
|
}
|
191
194
|
}
|
195
|
+
getColumnSearch(actionButton, item) {
|
196
|
+
if (this._columnSearch != undefined) {
|
197
|
+
return this._columnSearch;
|
198
|
+
}
|
199
|
+
actionButton.addEventListener("ezPopoverOpen", () => {
|
200
|
+
if (this._columnSearch) {
|
201
|
+
const realElement = this._columnSearch["$elm$"];
|
202
|
+
realElement.value = null;
|
203
|
+
}
|
204
|
+
});
|
205
|
+
this._moreOptions = actionButton;
|
206
|
+
this._columnSearch = buildFieldSearch(item, ({ argument }) => new Promise(accept => {
|
207
|
+
this._grid.filterColumns(argument).then((columns) => {
|
208
|
+
accept(columns
|
209
|
+
.filter(column => !column.hidden)
|
210
|
+
.map(column => ({ label: column.label, value: column.name })));
|
211
|
+
});
|
212
|
+
}), (option) => {
|
213
|
+
if (option != undefined) {
|
214
|
+
this._grid.locateColumn(option.value);
|
215
|
+
actionButton.hideActions();
|
216
|
+
}
|
217
|
+
});
|
218
|
+
return this._columnSearch;
|
219
|
+
}
|
220
|
+
onSelectField(option, actionButton) {
|
221
|
+
if (option == undefined) {
|
222
|
+
return;
|
223
|
+
}
|
224
|
+
this._fieldToGetFocus = option.value;
|
225
|
+
actionButton.hideActions();
|
226
|
+
}
|
227
|
+
getFieldSearch(actionButton, item) {
|
228
|
+
if (this._fieldSearch != undefined) {
|
229
|
+
return this._fieldSearch;
|
230
|
+
}
|
231
|
+
this._moreOptions = actionButton;
|
232
|
+
actionButton.addEventListener("ezPopoverOpen", () => this.findField());
|
233
|
+
this._fieldSearch = buildFieldSearch(item, ({ argument }) => this.fieldsOptionLoader(argument), (option) => this.onSelectField(option, actionButton));
|
234
|
+
return this._fieldSearch;
|
235
|
+
}
|
236
|
+
getFormFields() {
|
237
|
+
var _a, _b;
|
238
|
+
return (_b = (_a = this.formConfig) === null || _a === void 0 ? void 0 : _a.fields) !== null && _b !== void 0 ? _b : this._formFields;
|
239
|
+
}
|
240
|
+
handleFormSetFields(fields) {
|
241
|
+
this._formFields = fields !== null && fields !== void 0 ? fields : [];
|
242
|
+
}
|
243
|
+
fieldsOptionLoader(argument) {
|
244
|
+
const searchTerm = argument === null || argument === void 0 ? void 0 : argument.toLowerCase();
|
245
|
+
const allFields = this.getFormFields().map(field => { var _a; return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(field.name); });
|
246
|
+
const filteredFields = allFields.filter(field => {
|
247
|
+
var _a, _b;
|
248
|
+
return ((_a = field.name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTerm)) ||
|
249
|
+
((_b = field.label) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchTerm));
|
250
|
+
});
|
251
|
+
const options = filteredFields.map(field => ({ value: field.name, label: field.label }));
|
252
|
+
return Promise.resolve(options);
|
253
|
+
}
|
254
|
+
getActionsList() {
|
255
|
+
var _a, _b;
|
256
|
+
return [{
|
257
|
+
value: "",
|
258
|
+
label: (_b = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.findColumn", undefined)) !== null && _b !== void 0 ? _b : "Buscar",
|
259
|
+
itemBuilder: (actionButton, item) => (this._currentViewMode === VIEW_MODE.GRID)
|
260
|
+
? this.getColumnSearch(actionButton, item)
|
261
|
+
: this.getFieldSearch(actionButton, item)
|
262
|
+
}];
|
263
|
+
}
|
264
|
+
keyDownListener(event) {
|
265
|
+
if (!event.ctrlKey || event.key == undefined || event.key.toUpperCase() !== "F") {
|
266
|
+
return;
|
267
|
+
}
|
268
|
+
if (this._element == undefined) {
|
269
|
+
return;
|
270
|
+
}
|
271
|
+
if (JSUtils.isHiddenElement(this._element)) {
|
272
|
+
return;
|
273
|
+
}
|
274
|
+
FloatingManager.closeAll();
|
275
|
+
if (this._currentViewMode === VIEW_MODE.GRID) {
|
276
|
+
this.findColumn();
|
277
|
+
}
|
278
|
+
else {
|
279
|
+
this.findField();
|
280
|
+
}
|
281
|
+
event.preventDefault();
|
282
|
+
}
|
283
|
+
async findField() {
|
284
|
+
if (!this._moreOptions) {
|
285
|
+
return;
|
286
|
+
}
|
287
|
+
if (!(await this._moreOptions.isOpened())) {
|
288
|
+
this._moreOptions.showActions();
|
289
|
+
return;
|
290
|
+
}
|
291
|
+
if (this._fieldSearch) {
|
292
|
+
const realElement = this._fieldSearch["$elm$"];
|
293
|
+
realElement.value = null;
|
294
|
+
requestAnimationFrame(() => realElement.setFocus());
|
295
|
+
}
|
296
|
+
}
|
297
|
+
async findColumn() {
|
298
|
+
if (!this._moreOptions) {
|
299
|
+
return;
|
300
|
+
}
|
301
|
+
if (!(await this._moreOptions.isOpened())) {
|
302
|
+
this._moreOptions.showActions();
|
303
|
+
}
|
304
|
+
if (this._columnSearch) {
|
305
|
+
const realElement = this._columnSearch["$elm$"];
|
306
|
+
realElement.value = null;
|
307
|
+
requestAnimationFrame(() => realElement.setFocus());
|
308
|
+
}
|
309
|
+
}
|
310
|
+
clearFieldToFocusHandler() {
|
311
|
+
this._fieldToGetFocus = undefined;
|
312
|
+
}
|
313
|
+
connectedCallback() {
|
314
|
+
window.addEventListener("keydown", this._keyDownHandler, { capture: true });
|
315
|
+
}
|
316
|
+
disconnectedCallback() {
|
317
|
+
window.removeEventListener("keydown", this._keyDownHandler);
|
318
|
+
}
|
192
319
|
render() {
|
193
320
|
var _a;
|
194
|
-
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)
|
321
|
+
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)
|
195
322
|
? undefined
|
196
|
-
: 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 }))))));
|
323
|
+
: 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) }))))));
|
197
324
|
}
|
198
325
|
get _element() { return this; }
|
199
326
|
static get watchers() { return {
|
@@ -214,6 +341,8 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
214
341
|
"useEnterLikeTab": [4, "use-enter-like-tab"],
|
215
342
|
"_currentViewMode": [32],
|
216
343
|
"_config": [32],
|
344
|
+
"_fieldToGetFocus": [32],
|
345
|
+
"_formFields": [32],
|
217
346
|
"goToView": [64],
|
218
347
|
"setMetadata": [64],
|
219
348
|
"setRecords": [64],
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { R as ResourceFetcher, F as FormConfigFetcher } from './form-config-fetcher-
|
1
|
+
import { R as ResourceFetcher, F as FormConfigFetcher } from './form-config-fetcher-36219cd3.js';
|
2
2
|
import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
|
3
3
|
import { ObjectUtils } from '@sankhyalabs/core';
|
4
|
-
import { d as dist, D as DataFetcher } from './DataFetcher-
|
4
|
+
import { d as dist, D as DataFetcher } from './DataFetcher-aa159c5a.js';
|
5
5
|
|
6
6
|
class GridConfigFetcher extends ResourceFetcher {
|
7
7
|
constructor() {
|
@@ -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-3e4ff0f5.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,6 +1,6 @@
|
|
1
|
-
import { C as ConfigStorage } from './ConfigStorage-
|
2
|
-
import { ObjectUtils } from '@sankhyalabs/core';
|
3
|
-
import { F as FormConfigFetcher } from './form-config-fetcher-
|
1
|
+
import { C as ConfigStorage } from './ConfigStorage-379a9cba.js';
|
2
|
+
import { ObjectUtils, StringUtils } from '@sankhyalabs/core';
|
3
|
+
import { F as FormConfigFetcher } from './form-config-fetcher-36219cd3.js';
|
4
4
|
|
5
5
|
class SnkFormConfigManager {
|
6
6
|
constructor(configName, resourceID, onConfigChange) {
|
@@ -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) {
|