@sankhyalabs/sankhyablocks 8.15.0-dev.67 → 8.15.0-dev.69
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/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-attach.cjs.entry.js +20 -18
- package/dist/cjs/snk-crud.cjs.entry.js +50 -0
- package/dist/cjs/snk-detail-view.cjs.entry.js +41 -2
- package/dist/cjs/snk-form-view.cjs.entry.js +31 -0
- package/dist/cjs/snk-form.cjs.entry.js +26 -1
- package/dist/cjs/snk-grid.cjs.entry.js +46 -0
- package/dist/cjs/{snk-guides-viewer-545dd904.js → snk-guides-viewer-66dd6949.js} +19 -3
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +49 -1
- package/dist/collection/components/snk-attach/snk-attach.js +20 -18
- package/dist/collection/components/snk-crud/interfaces/PropsCustomEditor.js +1 -0
- package/dist/collection/components/snk-crud/interfaces/PropsCustomRender.js +1 -0
- package/dist/collection/components/snk-crud/snk-crud.js +102 -0
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +135 -0
- package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +82 -0
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +73 -3
- package/dist/collection/components/snk-form/snk-form.js +52 -1
- package/dist/collection/components/snk-grid/snk-grid.js +104 -0
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +101 -1
- package/dist/components/snk-attach2.js +20 -18
- package/dist/components/snk-crud.js +52 -0
- package/dist/components/snk-detail-view2.js +68 -5
- package/dist/components/snk-form-view2.js +33 -0
- package/dist/components/snk-form.js +27 -1
- package/dist/components/snk-grid2.js +48 -0
- package/dist/components/snk-simple-crud2.js +51 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-attach.entry.js +20 -18
- package/dist/esm/snk-crud.entry.js +50 -0
- package/dist/esm/snk-detail-view.entry.js +41 -2
- package/dist/esm/snk-form-view.entry.js +31 -0
- package/dist/esm/snk-form.entry.js +26 -1
- package/dist/esm/snk-grid.entry.js +46 -0
- package/dist/esm/{snk-guides-viewer-081bcf90.js → snk-guides-viewer-11cf8dc7.js} +19 -3
- package/dist/esm/snk-guides-viewer.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +49 -1
- package/dist/sankhyablocks/p-188e1432.entry.js +1 -0
- package/dist/sankhyablocks/{p-8171e586.entry.js → p-19ba2e08.entry.js} +1 -1
- package/dist/sankhyablocks/p-1db45d26.entry.js +1 -0
- package/dist/sankhyablocks/p-2c9ea7b6.entry.js +1 -0
- package/dist/sankhyablocks/p-50e72d6c.js +1 -0
- package/dist/sankhyablocks/p-5201ab24.entry.js +1 -0
- package/dist/sankhyablocks/p-a6c4b656.entry.js +1 -0
- package/dist/sankhyablocks/p-aa9c4099.entry.js +1 -0
- package/dist/sankhyablocks/{p-af3e1265.entry.js → p-b68918fc.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-crud/interfaces/PropsCustomEditor.d.ts +4 -0
- package/dist/types/components/snk-crud/interfaces/PropsCustomRender.d.ts +4 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +14 -0
- package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +23 -0
- package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +15 -2
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +13 -0
- package/dist/types/components/snk-form/snk-form.d.ts +8 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +19 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +13 -2
- package/dist/types/components.d.ts +76 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-1122030d.js +0 -1
- package/dist/sankhyablocks/p-24880828.entry.js +0 -1
- package/dist/sankhyablocks/p-33f695d6.entry.js +0 -1
- package/dist/sankhyablocks/p-39f8ebb3.entry.js +0 -1
- package/dist/sankhyablocks/p-e4e044cf.entry.js +0 -1
- package/dist/sankhyablocks/p-ecc666ef.entry.js +0 -1
- package/dist/sankhyablocks/p-ee1d9c09.entry.js +0 -1
@@ -658,7 +658,7 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
658
658
|
this.crudConfig = undefined;
|
659
659
|
}
|
660
660
|
async initAttach() {
|
661
|
-
var _a, _b, _c, _d
|
661
|
+
var _a, _b, _c, _d;
|
662
662
|
await this.loadAttachmentDataUnit();
|
663
663
|
this.returnToGridMode();
|
664
664
|
if (this.fetcherType === "AnexoSistema") {
|
@@ -672,7 +672,8 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
672
672
|
if (hasMoreOneItem)
|
673
673
|
return;
|
674
674
|
}
|
675
|
-
|
675
|
+
await this._currentDataUnit.loadMetadata();
|
676
|
+
await this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
|
676
677
|
}
|
677
678
|
/**
|
678
679
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
@@ -711,14 +712,14 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
711
712
|
if (this._crudElement)
|
712
713
|
this._crudElement.goToView(VIEW_MODE.GRID);
|
713
714
|
}
|
714
|
-
loadAttachmentDataUnit() {
|
715
|
+
async loadAttachmentDataUnit() {
|
715
716
|
try {
|
716
717
|
switch (this.fetcherType) {
|
717
718
|
case "AnexoSistema":
|
718
|
-
this.loadAnexoSistema();
|
719
|
+
await this.loadAnexoSistema();
|
719
720
|
break;
|
720
721
|
case "Attach":
|
721
|
-
this.loadAttach();
|
722
|
+
await this.loadAttach();
|
722
723
|
break;
|
723
724
|
default:
|
724
725
|
this._currentFetcher = this.fetcher;
|
@@ -730,12 +731,13 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
730
731
|
throw new Error('There was an error while creating the data unit');
|
731
732
|
}
|
732
733
|
}
|
733
|
-
loadAnexoSistema() {
|
734
|
-
|
734
|
+
async loadAnexoSistema() {
|
735
|
+
var _a;
|
736
|
+
this._currentDataUnit = new DataUnitFetcher().getDataUnit(RESOURCE_ID, DATA_UNIT_NAME);
|
737
|
+
this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
|
735
738
|
if (!this._currentDataUnit.metadata) {
|
736
|
-
this._currentDataUnit
|
737
|
-
|
738
|
-
.then(() => this.crudConfig = Object.assign({}, anexoSistemaCrudConfig));
|
739
|
+
await this._currentDataUnit.loadMetadata();
|
740
|
+
this.crudConfig = Object.assign({}, anexoSistemaCrudConfig);
|
739
741
|
}
|
740
742
|
this.initDataUnitLoaders();
|
741
743
|
this._currentDataUnit.addFilterProvider({
|
@@ -744,10 +746,11 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
744
746
|
this._currentDataUnit.addInterceptor({
|
745
747
|
interceptAction: (action) => this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement)
|
746
748
|
});
|
747
|
-
this._currentDataUnit.loadData()
|
749
|
+
await this._currentDataUnit.loadData();
|
750
|
+
this.disableEditFieldsNotInForm();
|
748
751
|
}
|
749
|
-
loadAttach() {
|
750
|
-
|
752
|
+
async loadAttach() {
|
753
|
+
this._currentFetcher = new AttachFetcher();
|
751
754
|
this._currentDataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
|
752
755
|
this.initDataUnitLoaders();
|
753
756
|
this._currentDataUnit.addInterceptor({
|
@@ -761,11 +764,10 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
761
764
|
}
|
762
765
|
});
|
763
766
|
if (!this._currentDataUnit.metadata) {
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
});
|
767
|
+
await this._currentDataUnit.loadMetadata();
|
768
|
+
this.crudConfig = Object.assign({}, attachCrudConfig);
|
769
|
+
await this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
|
770
|
+
this.disableEditFieldsNotInForm();
|
769
771
|
}
|
770
772
|
}
|
771
773
|
initDataUnitLoaders() {
|
@@ -53,6 +53,8 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
53
53
|
this.formItemsReady = createEvent(this, "formItemsReady", 7);
|
54
54
|
this._keyDownHandler = async (event) => this.keyDownListener(event);
|
55
55
|
this._viewHistory = [];
|
56
|
+
this._customEditors = new Map();
|
57
|
+
this._customRenders = new Map();
|
56
58
|
this._dataUnit = undefined;
|
57
59
|
this._dataState = undefined;
|
58
60
|
this.attachmentRegisterKey = undefined;
|
@@ -111,6 +113,31 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
111
113
|
async getFilterBar() {
|
112
114
|
return await this._snkGrid.getFilterBar();
|
113
115
|
}
|
116
|
+
/**
|
117
|
+
* Registra um editor customizado para campos da grade e formulário.
|
118
|
+
*/
|
119
|
+
async addCustomEditor(fieldName, customEditor) {
|
120
|
+
if (this._guidesViewer && this._snkGrid) {
|
121
|
+
this._guidesViewer.addCustomEditor(fieldName, customEditor);
|
122
|
+
this._snkGrid.addCustomEditor(fieldName, customEditor);
|
123
|
+
return;
|
124
|
+
}
|
125
|
+
const newCustomEditors = new Map(this._customEditors);
|
126
|
+
newCustomEditors.set(fieldName, customEditor);
|
127
|
+
this._customEditors = newCustomEditors;
|
128
|
+
}
|
129
|
+
/**
|
130
|
+
* Registra um render customizado para colunas da grid.
|
131
|
+
*/
|
132
|
+
async addGridCustomRender(fieldName, customRender) {
|
133
|
+
if (this._snkGrid) {
|
134
|
+
this._snkGrid.addGridCustomRender(fieldName, customRender);
|
135
|
+
return;
|
136
|
+
}
|
137
|
+
const newCustomRenders = new Map(this._customRenders);
|
138
|
+
newCustomRenders.set(fieldName, customRender);
|
139
|
+
this._customRenders = newCustomRenders;
|
140
|
+
}
|
114
141
|
/**
|
115
142
|
* Registra um formatador de valores para uma coluna da grid.
|
116
143
|
*/
|
@@ -182,6 +209,29 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
182
209
|
const joinedPrimaryKeys = recordCriteria.map(({ value }) => value).join('_');
|
183
210
|
return joinedPrimaryKeys;
|
184
211
|
}
|
212
|
+
setCustomRenders() {
|
213
|
+
if (!this._snkGrid) {
|
214
|
+
return;
|
215
|
+
}
|
216
|
+
for (const [fieldName, customRender] of this._customRenders) {
|
217
|
+
this._snkGrid.addGridCustomRender(fieldName, customRender);
|
218
|
+
this._customRenders.delete(fieldName);
|
219
|
+
}
|
220
|
+
}
|
221
|
+
setCustomEditors() {
|
222
|
+
if (!this._snkGrid || !this._guidesViewer) {
|
223
|
+
return;
|
224
|
+
}
|
225
|
+
for (const [fieldName, customEditor] of this._customEditors) {
|
226
|
+
this._guidesViewer.addCustomEditor(fieldName, customEditor);
|
227
|
+
this._snkGrid.addCustomEditor(fieldName, customEditor);
|
228
|
+
this._customEditors.delete(fieldName);
|
229
|
+
}
|
230
|
+
}
|
231
|
+
componentDidRender() {
|
232
|
+
this.setCustomRenders();
|
233
|
+
this.setCustomEditors();
|
234
|
+
}
|
185
235
|
componentWillLoad() {
|
186
236
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
187
237
|
let parent = this._element.parentElement;
|
@@ -395,6 +445,8 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
395
445
|
"closeConfigurator": [64],
|
396
446
|
"reloadFilterBar": [64],
|
397
447
|
"getFilterBar": [64],
|
448
|
+
"addCustomEditor": [64],
|
449
|
+
"addGridCustomRender": [64],
|
398
450
|
"addCustomValueFormatter": [64],
|
399
451
|
"removeCustomValueFormatter": [64],
|
400
452
|
"setFieldProp": [64]
|
@@ -76,6 +76,8 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
76
76
|
this._formEditorConfigManager = undefined;
|
77
77
|
this._formEditorDataUnit = undefined;
|
78
78
|
this._fieldToGetFocus = undefined;
|
79
|
+
this._customEditors = undefined;
|
80
|
+
this._customRenders = undefined;
|
79
81
|
this._fieldsProps = {};
|
80
82
|
}
|
81
83
|
observeDataUnit() {
|
@@ -107,6 +109,19 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
107
109
|
async findField() {
|
108
110
|
await openFieldSearch(this._moreOptions, this._fieldSearch);
|
109
111
|
}
|
112
|
+
/**
|
113
|
+
* Registra um editor customizado para campos da grade e formulário
|
114
|
+
*/
|
115
|
+
async addCustomEditor(fieldName, customEditor) {
|
116
|
+
this._customEditors = Object.assign(Object.assign({}, this._customEditors), { [fieldName]: customEditor });
|
117
|
+
}
|
118
|
+
/**
|
119
|
+
* Registra um render customizado para colunas da grid.
|
120
|
+
*/
|
121
|
+
async addGridCustomRender(fieldName, customRender) {
|
122
|
+
this._customRenders = Object.assign(Object.assign({}, this._customRenders), { [fieldName]: customRender });
|
123
|
+
}
|
124
|
+
;
|
110
125
|
/**
|
111
126
|
* Altera/adiciona uma propriedade nos metadados do campo.
|
112
127
|
*/
|
@@ -258,7 +273,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
258
273
|
if (sheet == undefined) {
|
259
274
|
return;
|
260
275
|
}
|
261
|
-
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); }, fieldsProps: params.fieldsProps });
|
276
|
+
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); }, customEditors: params.propsCustomEditor, fieldsProps: params.fieldsProps });
|
262
277
|
})));
|
263
278
|
}
|
264
279
|
wrapDetail(levels, content) {
|
@@ -300,14 +315,14 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
300
315
|
else {
|
301
316
|
detailBranch = this.selectedGuide;
|
302
317
|
}
|
303
|
-
content = this.wrapDetail(levels, h("snk-detail-view", { ref: (ref) => this._currentDetail = ref, dataUnitName: this.getDataUnitName(levels, childEntityName), onSnkDetailGuidesChange: (evt) => this.updateGuide(evt.detail), entityName: childEntityName, selectedForm: formName, branchGuide: detailBranch, guideItemPath: this._breadcrumbItems, key: `detail${detailId}`, canEdit: this.canEdit, onSnkSwitchGuide: evt => this._guideNavigator.selectGuide(evt.detail), resourceID: this.resourceID, taskbarCustomContainerId: this.detailTaskbarCustomContainerId }));
|
318
|
+
content = this.wrapDetail(levels, h("snk-detail-view", { ref: (ref) => this._currentDetail = ref, dataUnitName: this.getDataUnitName(levels, childEntityName), onSnkDetailGuidesChange: (evt) => this.updateGuide(evt.detail), entityName: childEntityName, selectedForm: formName, branchGuide: detailBranch, guideItemPath: this._breadcrumbItems, key: `detail${detailId}`, canEdit: this.canEdit, onSnkSwitchGuide: evt => this._guideNavigator.selectGuide(evt.detail), resourceID: this.resourceID, taskbarCustomContainerId: this.detailTaskbarCustomContainerId, customEditors: this._customEditors, customRenders: this._customRenders }));
|
304
319
|
}
|
305
320
|
else {
|
306
321
|
const cardId = this.selectedGuide.id;
|
307
322
|
const sheet = this._masterFormMetadata.getSheet(cardId);
|
308
323
|
if (sheet) {
|
309
324
|
const cardConfig = (_c = (_b = this.masterFormConfig) === null || _b === void 0 ? void 0 : _b.cardsState) === null || _c === void 0 ? void 0 : _c.get(cardId);
|
310
|
-
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(), fieldsProps: this._fieldsProps }, this.presentationMode == PresentationMode.SECONDARY && this.buildTaskBar());
|
325
|
+
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(), customEditors: this._customEditors, fieldsProps: this._fieldsProps }, this.presentationMode == PresentationMode.SECONDARY && this.buildTaskBar());
|
311
326
|
}
|
312
327
|
}
|
313
328
|
return content;
|
@@ -514,6 +529,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
514
529
|
recordsValidator: this.recordsValidator,
|
515
530
|
fieldToFocus: this._fieldToGetFocus,
|
516
531
|
onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this),
|
532
|
+
propsCustomEditor: this._customEditors,
|
517
533
|
fieldsProps: this._fieldsProps
|
518
534
|
}), 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 })));
|
519
535
|
}
|
@@ -545,9 +561,13 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
545
561
|
"_formEditorConfigManager": [32],
|
546
562
|
"_formEditorDataUnit": [32],
|
547
563
|
"_fieldToGetFocus": [32],
|
564
|
+
"_customEditors": [32],
|
565
|
+
"_customRenders": [32],
|
548
566
|
"_fieldsProps": [32],
|
549
567
|
"showFormConfig": [64],
|
550
568
|
"findField": [64],
|
569
|
+
"addCustomEditor": [64],
|
570
|
+
"addGridCustomRender": [64],
|
551
571
|
"setFieldProp": [64]
|
552
572
|
}, [[2, "actionClick", "onActionClick"], [0, "snkContentCardChanged", "onContentCardChanged"]]]);
|
553
573
|
function defineCustomElement$1() {
|
@@ -782,6 +802,8 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
782
802
|
this.branchGuide = undefined;
|
783
803
|
this.canEdit = true;
|
784
804
|
this.taskbarCustomContainerId = undefined;
|
805
|
+
this.customEditors = undefined;
|
806
|
+
this.customRenders = undefined;
|
785
807
|
}
|
786
808
|
observeDataUnit(newDataUnit, oldDataUnit) {
|
787
809
|
newDataUnit === null || newDataUnit === void 0 ? void 0 : newDataUnit.subscribe(this.dataUnitActionHandler.bind(this));
|
@@ -849,10 +871,38 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
849
871
|
this._snkGrid.scrollIntoView({ behavior: "smooth", block: "start" });
|
850
872
|
}
|
851
873
|
}
|
874
|
+
/**
|
875
|
+
* Registra um editor customizado para campos da grade e formulário.
|
876
|
+
*/
|
877
|
+
async addCustomEditor(fieldName, customEditor) {
|
878
|
+
var _a;
|
879
|
+
const detailContext = this.normalizeBranchGuideId((_a = this.branchGuide) === null || _a === void 0 ? void 0 : _a.id);
|
880
|
+
this._snkGrid.addCustomEditor(fieldName, customEditor, detailContext);
|
881
|
+
this._snkFormView.addCustomEditor(fieldName, customEditor, detailContext);
|
882
|
+
}
|
883
|
+
async observerPropsCustomEditor(newValue) {
|
884
|
+
for (const fieldName in newValue) {
|
885
|
+
await this.addCustomEditor(fieldName, newValue[fieldName]);
|
886
|
+
}
|
887
|
+
}
|
888
|
+
/**
|
889
|
+
* Registra um render customizado para colunas da grid.
|
890
|
+
*/
|
891
|
+
async addGridCustomRender(fieldName, customRender) {
|
892
|
+
var _a;
|
893
|
+
const detailContext = this.normalizeBranchGuideId((_a = this.branchGuide) === null || _a === void 0 ? void 0 : _a.id);
|
894
|
+
await this._snkGrid.addGridCustomRender(fieldName, customRender, detailContext);
|
895
|
+
}
|
852
896
|
onContentCardChanged(evt) {
|
853
897
|
SnkGuidesViewer.updateContentCard(evt.detail.formName, evt.detail.cardConfig, evt.detail.propertyChanged, this.formConfigManager).then(() => forceUpdate(this));
|
854
898
|
evt.stopPropagation();
|
855
899
|
}
|
900
|
+
async observeCustomRenders(newValue) {
|
901
|
+
for (const field in newValue) {
|
902
|
+
const customRender = newValue[field];
|
903
|
+
await this.addGridCustomRender(field, customRender);
|
904
|
+
}
|
905
|
+
}
|
856
906
|
updateLabel() {
|
857
907
|
const guideItemPathSize = this.guideItemPath ? this.guideItemPath.length : 0;
|
858
908
|
if (guideItemPathSize > 0) {
|
@@ -955,6 +1005,10 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
955
1005
|
this.messagesBuilder = new SnkMessageBuilder(this.entityName);
|
956
1006
|
}
|
957
1007
|
}
|
1008
|
+
async componentDidLoad() {
|
1009
|
+
await this.observerPropsCustomEditor(this.customEditors);
|
1010
|
+
await this.observeCustomRenders(this.customRenders);
|
1011
|
+
}
|
958
1012
|
async dataUnitActionHandler(action) {
|
959
1013
|
if (action.type === Action.FIELD_INVALIDATED) {
|
960
1014
|
this.addErrorBadgeToBranchGuide();
|
@@ -964,6 +1018,9 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
964
1018
|
this.branchGuide = Object.assign(Object.assign({}, this.branchGuide), { badge: 'error' });
|
965
1019
|
this.snkDetailGuidesChange.emit(new GuideBuilder(this.branchGuide, this._formMetadata, this.dataUnit));
|
966
1020
|
}
|
1021
|
+
normalizeBranchGuideId(id) {
|
1022
|
+
return id === null || id === void 0 ? void 0 : id.replace(/child\[(.*?)\]/g, '$1').replace(/::/g, '>');
|
1023
|
+
}
|
967
1024
|
render() {
|
968
1025
|
this.updateLabel();
|
969
1026
|
//const cardConfig: IFormCardConfig = this._cardsState?.get(this.selectedForm);
|
@@ -971,7 +1028,9 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
971
1028
|
}
|
972
1029
|
static get watchers() { return {
|
973
1030
|
"dataUnit": ["observeDataUnit"],
|
974
|
-
"dataState": ["observerDataState"]
|
1031
|
+
"dataState": ["observerDataState"],
|
1032
|
+
"customEditors": ["observerPropsCustomEditor"],
|
1033
|
+
"customRenders": ["observeCustomRenders"]
|
975
1034
|
}; }
|
976
1035
|
static get style() { return snkDetailViewCss; }
|
977
1036
|
}, [6, "snk-detail-view", {
|
@@ -988,12 +1047,16 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
988
1047
|
"branchGuide": [1040],
|
989
1048
|
"canEdit": [4, "can-edit"],
|
990
1049
|
"taskbarCustomContainerId": [1, "taskbar-custom-container-id"],
|
1050
|
+
"customEditors": [16],
|
1051
|
+
"customRenders": [16],
|
991
1052
|
"_disabledButtons": [32],
|
992
1053
|
"_currentView": [32],
|
993
1054
|
"attachmentRegisterKey": [32],
|
994
1055
|
"changeViewMode": [64],
|
995
1056
|
"configGrid": [64],
|
996
|
-
"showUp": [64]
|
1057
|
+
"showUp": [64],
|
1058
|
+
"addCustomEditor": [64],
|
1059
|
+
"addGridCustomRender": [64]
|
997
1060
|
}, [[0, "snkContentCardChanged", "onContentCardChanged"]]]);
|
998
1061
|
SnkDetailView.REGEX_FORM_ID = /__FORM:[^:]+/g;
|
999
1062
|
function defineCustomElement() {
|
@@ -12,6 +12,7 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
12
12
|
this.snkContentCardChanged = createEvent(this, "snkContentCardChanged", 7);
|
13
13
|
this.snkRequestClearFieldToFocus = createEvent(this, "snkRequestClearFieldToFocus", 7);
|
14
14
|
this.formItemsReady = createEvent(this, "formItemsReady", 7);
|
15
|
+
this._customEditors = new Map();
|
15
16
|
this._fieldProps = new Map();
|
16
17
|
this.levelPath = undefined;
|
17
18
|
this.label = undefined;
|
@@ -26,6 +27,7 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
26
27
|
this.canFix = true;
|
27
28
|
this.recordsValidator = undefined;
|
28
29
|
this.fieldToFocus = undefined;
|
30
|
+
this.customEditors = undefined;
|
29
31
|
this.fieldsProps = undefined;
|
30
32
|
}
|
31
33
|
async showUp() {
|
@@ -33,6 +35,23 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
33
35
|
this._formView.showUp();
|
34
36
|
}
|
35
37
|
}
|
38
|
+
/**
|
39
|
+
* Registra um editor customizado para campos da grade e formulário
|
40
|
+
*/
|
41
|
+
async addCustomEditor(fieldName, customEditor, detailContext) {
|
42
|
+
if (this._formView) {
|
43
|
+
this._formView.addCustomEditor(fieldName, customEditor, detailContext);
|
44
|
+
return;
|
45
|
+
}
|
46
|
+
const newCustomEditors = new Map(this._customEditors);
|
47
|
+
newCustomEditors.set(fieldName, { customEditor, detailContext });
|
48
|
+
this._customEditors = newCustomEditors;
|
49
|
+
}
|
50
|
+
observePropsCustomEditor(newValue) {
|
51
|
+
for (const fieldName in newValue) {
|
52
|
+
this.addCustomEditor(fieldName, newValue[fieldName]);
|
53
|
+
}
|
54
|
+
}
|
36
55
|
/**
|
37
56
|
* Altera/adiciona uma propriedade nos metadados do campo.
|
38
57
|
*/
|
@@ -108,9 +127,11 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
108
127
|
}
|
109
128
|
}
|
110
129
|
componentDidLoad() {
|
130
|
+
this.observePropsCustomEditor(this.customEditors);
|
111
131
|
this.observeFieldsProps(this.fieldsProps);
|
112
132
|
}
|
113
133
|
componentDidRender() {
|
134
|
+
this.setCustomEditors();
|
114
135
|
this.setFieldProps();
|
115
136
|
if (this.fieldToFocus == undefined) {
|
116
137
|
return;
|
@@ -123,6 +144,15 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
123
144
|
this.snkRequestClearFieldToFocus.emit();
|
124
145
|
});
|
125
146
|
}
|
147
|
+
setCustomEditors() {
|
148
|
+
if (!this._formView) {
|
149
|
+
return;
|
150
|
+
}
|
151
|
+
for (const [fieldName, customEditorProps] of this._customEditors) {
|
152
|
+
this._formView.addCustomEditor(fieldName, customEditorProps.customEditor, customEditorProps.detailContext);
|
153
|
+
this._customEditors.delete(fieldName);
|
154
|
+
}
|
155
|
+
}
|
126
156
|
setFieldProps() {
|
127
157
|
if (!this._formView) {
|
128
158
|
return;
|
@@ -144,6 +174,7 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
144
174
|
h("ez-form-view", { ref: ref => this._formView = ref, fields: this.fields, onEzContentReady: evt => this.bindFields(evt.detail), onFormItemsReady: (event) => this.handleFormItemsReady(event) })));
|
145
175
|
}
|
146
176
|
static get watchers() { return {
|
177
|
+
"customEditors": ["observePropsCustomEditor"],
|
147
178
|
"fieldsProps": ["observeFieldsProps"]
|
148
179
|
}; }
|
149
180
|
static get style() { return snkFormViewCss; }
|
@@ -161,8 +192,10 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
161
192
|
"canFix": [4, "can-fix"],
|
162
193
|
"recordsValidator": [16],
|
163
194
|
"fieldToFocus": [1, "field-to-focus"],
|
195
|
+
"customEditors": [16],
|
164
196
|
"fieldsProps": [16],
|
165
197
|
"showUp": [64],
|
198
|
+
"addCustomEditor": [64],
|
166
199
|
"setFieldProp": [64]
|
167
200
|
}]);
|
168
201
|
function defineCustomElement() {
|
@@ -16,6 +16,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
16
16
|
this.exit = createEvent(this, "exit", 7);
|
17
17
|
this.actionClick = createEvent(this, "actionClick", 7);
|
18
18
|
this.formItemsReady = createEvent(this, "formItemsReady", 7);
|
19
|
+
this._customEditors = new Map();
|
19
20
|
this._dataUnit = undefined;
|
20
21
|
this._dataState = undefined;
|
21
22
|
this._showFormConfig = false;
|
@@ -38,6 +39,18 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
38
39
|
async hideConfig() {
|
39
40
|
this._showFormConfig = false;
|
40
41
|
}
|
42
|
+
/**
|
43
|
+
* Registra um editor customizado para campos da grade e formulário.
|
44
|
+
*/
|
45
|
+
async addCustomEditor(fieldName, customEditor) {
|
46
|
+
if (this._form) {
|
47
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
48
|
+
return;
|
49
|
+
}
|
50
|
+
const newCustomEditors = new Map(this._customEditors);
|
51
|
+
newCustomEditors.set(fieldName, customEditor);
|
52
|
+
this._customEditors = newCustomEditors;
|
53
|
+
}
|
41
54
|
/**
|
42
55
|
* Altera/adiciona uma propriedade nos metadados do campo.
|
43
56
|
*/
|
@@ -51,6 +64,18 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
51
64
|
const dataInfo = { dataUnit: this._dataUnit };
|
52
65
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
53
66
|
}
|
67
|
+
setCustomEditors() {
|
68
|
+
if (!this._form) {
|
69
|
+
return;
|
70
|
+
}
|
71
|
+
for (const [fieldName, customEditor] of this._customEditors) {
|
72
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
73
|
+
this._customEditors.delete(fieldName);
|
74
|
+
}
|
75
|
+
}
|
76
|
+
async componentDidRender() {
|
77
|
+
this.setCustomEditors();
|
78
|
+
}
|
54
79
|
async componentWillLoad() {
|
55
80
|
let parent = this._element.parentElement;
|
56
81
|
while (parent) {
|
@@ -103,7 +128,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
103
128
|
if (!this._dataUnit || !this._dataState) {
|
104
129
|
return undefined;
|
105
130
|
}
|
106
|
-
return (h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { ref: ref => this._form = ref, key: "ezForm" + this._snkDataUnit.entityName, "data-element-id": "embedded", dataUnit: this._dataUnit, config: this._configManager.getConfig(this._dataState.insertionMode, this._dataUnit), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
|
131
|
+
return (h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { ref: (ref) => this._form = ref, key: "ezForm" + this._snkDataUnit.entityName, "data-element-id": "embedded", dataUnit: this._dataUnit, config: this._configManager.getConfig(this._dataState.insertionMode, this._dataUnit), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
|
107
132
|
h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this._dataUnit, configManager: this._configManager, onConfigClose: () => this.closeConfig() })))));
|
108
133
|
}
|
109
134
|
get _element() { return this; }
|
@@ -120,6 +145,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
120
145
|
"_configManager": [32],
|
121
146
|
"showConfig": [64],
|
122
147
|
"hideConfig": [64],
|
148
|
+
"addCustomEditor": [64],
|
123
149
|
"setFieldProp": [64]
|
124
150
|
}]);
|
125
151
|
function defineCustomElement$1() {
|
@@ -94,6 +94,8 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
94
94
|
this.__registerHost();
|
95
95
|
this.actionClick = createEvent(this, "actionClick", 7);
|
96
96
|
this.gridDoubleClick = createEvent(this, "gridDoubleClick", 7);
|
97
|
+
this._customEditors = new Map();
|
98
|
+
this._customRenders = new Map();
|
97
99
|
this._topTaskbarProcessor = new TaskbarProcessor({
|
98
100
|
"snkGridTopTaskbar.regular": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
|
99
101
|
"snkGridTopTaskbar.regular.secondary": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
|
@@ -192,6 +194,30 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
192
194
|
async findColumn() {
|
193
195
|
await openFieldSearch(this._moreOptions, this._columnSearch);
|
194
196
|
}
|
197
|
+
/**
|
198
|
+
* Registra um editor customizado para campos da grade e formulário
|
199
|
+
*/
|
200
|
+
async addCustomEditor(fieldName, customEditor, detailContext) {
|
201
|
+
if (this._grid) {
|
202
|
+
this._grid.addCustomEditor(fieldName, customEditor, detailContext);
|
203
|
+
return;
|
204
|
+
}
|
205
|
+
const newCustomEditors = new Map(this._customEditors);
|
206
|
+
newCustomEditors.set(fieldName, { customEditor, detailContext });
|
207
|
+
this._customEditors = newCustomEditors;
|
208
|
+
}
|
209
|
+
/**
|
210
|
+
* Registra um render customizado para colunas da grid.
|
211
|
+
*/
|
212
|
+
async addGridCustomRender(fieldName, customRender, detailContext) {
|
213
|
+
if (this._grid) {
|
214
|
+
this._grid.addGridCustomRender(fieldName, customRender, detailContext);
|
215
|
+
return;
|
216
|
+
}
|
217
|
+
const newCustomRenders = new Map(this._customRenders);
|
218
|
+
newCustomRenders.set(fieldName, { customRender, detailContext });
|
219
|
+
this._customRenders = newCustomRenders;
|
220
|
+
}
|
195
221
|
/**
|
196
222
|
* Registra um formatador de valores para uma coluna da grid.
|
197
223
|
*/
|
@@ -290,6 +316,24 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
290
316
|
this.columnFilterDataSource.setDataUnit(this._dataUnit);
|
291
317
|
}
|
292
318
|
}
|
319
|
+
setCustomRenders() {
|
320
|
+
if (!this._grid) {
|
321
|
+
return;
|
322
|
+
}
|
323
|
+
for (const [fieldName, customRenderProps] of this._customRenders) {
|
324
|
+
this._grid.addGridCustomRender(fieldName, customRenderProps.customRender, customRenderProps.detailContext);
|
325
|
+
this._customRenders.delete(fieldName);
|
326
|
+
}
|
327
|
+
}
|
328
|
+
setCustomEditors() {
|
329
|
+
if (!this._grid) {
|
330
|
+
return;
|
331
|
+
}
|
332
|
+
for (const [fieldName, customEditorProps] of this._customEditors) {
|
333
|
+
this._grid.addCustomEditor(fieldName, customEditorProps.customEditor, customEditorProps.detailContext);
|
334
|
+
this._customEditors.delete(fieldName);
|
335
|
+
}
|
336
|
+
}
|
293
337
|
componentWillLoad() {
|
294
338
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
295
339
|
//TODO: substituir pelo metodo nativo closest
|
@@ -327,6 +371,8 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
327
371
|
componentDidRender() {
|
328
372
|
this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
|
329
373
|
this.loadGridCustomFormatters(this._dataUnit.metadata.fields);
|
374
|
+
this.setCustomRenders();
|
375
|
+
this.setCustomEditors();
|
330
376
|
}
|
331
377
|
async handleDataStateChange(evt) {
|
332
378
|
this._dataState = evt.detail;
|
@@ -485,6 +531,8 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
485
531
|
"reloadFilterBar": [64],
|
486
532
|
"getFilterBar": [64],
|
487
533
|
"findColumn": [64],
|
534
|
+
"addCustomEditor": [64],
|
535
|
+
"addGridCustomRender": [64],
|
488
536
|
"addCustomValueFormatter": [64],
|
489
537
|
"removeCustomValueFormatter": [64]
|
490
538
|
}]);
|