@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-75070.1 → 0.0.0-bugfix-dev-KB-77074.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{SnkMessageBuilder-bae64d0d.js → SnkMessageBuilder-7691a2c1.js} +10 -0
- package/dist/cjs/index-f9e81701.js +8 -0
- package/dist/cjs/input-distinct-search_2.cjs.entry.js +469 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +22 -25
- package/dist/cjs/snk-application.cjs.entry.js +1 -11
- package/dist/cjs/snk-crud.cjs.entry.js +2 -8
- package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
- package/dist/cjs/{snk-data-unit-3d9b6ed4.js → snk-data-unit-7dbdad0e.js} +14 -26
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +1 -1
- package/dist/cjs/snk-distinct-search.cjs.entry.js +123 -0
- package/dist/cjs/snk-filter-bar_4.cjs.entry.js +0 -3
- package/dist/cjs/snk-grid.cjs.entry.js +2 -10
- package/dist/cjs/snk-simple-crud.cjs.entry.js +4 -39
- package/dist/cjs/snk-taskbar.cjs.entry.js +35 -37
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/snk-actions-button/snk-actions-button.js +26 -27
- package/dist/collection/components/snk-application/snk-application.js +1 -41
- package/dist/collection/components/snk-crud/snk-crud.js +2 -26
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +13 -25
- package/dist/collection/components/snk-distinct-search/snk-distinct-search.css +4 -0
- package/dist/collection/components/snk-distinct-search/snk-distinct-search.js +372 -0
- package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.css +109 -0
- package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.js +542 -0
- package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.css +27 -0
- package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.js +600 -0
- package/dist/collection/components/snk-distinct-search/utils/filter-distinct-search.js +13 -0
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +0 -18
- package/dist/collection/components/snk-grid/snk-grid.js +2 -28
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +5 -58
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +36 -38
- package/dist/collection/lib/http/data-fetcher/fetchers/distinct-search-fetcher.js +25 -0
- package/dist/collection/lib/message/SnkMessageBuilder.js +2 -0
- package/dist/collection/lib/message/resources/snk-distinct-search.msg.js +9 -0
- package/dist/components/SnkMessageBuilder.js +10 -0
- package/dist/components/filter-distinct-search.js +15 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +3 -0
- package/dist/components/input-distinct-search.d.ts +11 -0
- package/dist/components/input-distinct-search.js +6 -0
- package/dist/components/input-distinct-search2.js +262 -0
- package/dist/components/search-modal.d.ts +11 -0
- package/dist/components/search-modal.js +6 -0
- package/dist/components/search-modal2.js +264 -0
- package/dist/components/snk-actions-button2.js +26 -27
- package/dist/components/snk-application2.js +1 -12
- package/dist/components/snk-crud.js +2 -9
- package/dist/components/snk-data-unit2.js +13 -25
- package/dist/components/snk-distinct-search.d.ts +11 -0
- package/dist/components/snk-distinct-search.js +163 -0
- package/dist/components/snk-filter-bar2.js +0 -4
- package/dist/components/snk-grid2.js +2 -11
- package/dist/components/snk-simple-crud2.js +5 -41
- package/dist/components/snk-taskbar2.js +36 -38
- package/dist/esm/{SnkMessageBuilder-6fff4a4c.js → SnkMessageBuilder-7ace6803.js} +10 -0
- package/dist/esm/index-a7d3d3f1.js +8 -0
- package/dist/esm/input-distinct-search_2.entry.js +464 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +23 -26
- package/dist/esm/snk-application.entry.js +2 -12
- package/dist/esm/snk-crud.entry.js +2 -8
- package/dist/esm/snk-data-exporter.entry.js +2 -2
- package/dist/esm/{snk-data-unit-9fa7d2b9.js → snk-data-unit-7a579dbd.js} +14 -26
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +1 -1
- package/dist/esm/snk-distinct-search.entry.js +119 -0
- package/dist/esm/snk-filter-bar_4.entry.js +0 -3
- package/dist/esm/snk-grid.entry.js +2 -10
- package/dist/esm/snk-simple-crud.entry.js +5 -40
- package/dist/esm/snk-taskbar.entry.js +36 -38
- package/dist/sankhyablocks/{p-7075b789.entry.js → p-00f9fe5c.entry.js} +1 -1
- package/dist/sankhyablocks/p-0e250436.entry.js +1 -0
- package/dist/sankhyablocks/p-154aa2a6.entry.js +11 -0
- package/dist/sankhyablocks/p-18cb1acb.entry.js +1 -0
- package/dist/sankhyablocks/p-1dbd5c18.entry.js +1 -0
- package/dist/sankhyablocks/p-2aae03a1.entry.js +1 -0
- package/dist/sankhyablocks/p-37074cc3.entry.js +1 -0
- package/dist/sankhyablocks/p-3858a2e4.entry.js +1 -0
- package/dist/sankhyablocks/p-563b7c28.entry.js +1 -0
- package/dist/sankhyablocks/{p-43353d86.entry.js → p-b389ed49.entry.js} +1 -1
- package/dist/sankhyablocks/p-c75fae8e.js +1 -0
- package/dist/sankhyablocks/p-d8665750.js +1 -0
- package/dist/sankhyablocks/p-f0aaad2b.entry.js +1 -0
- package/dist/sankhyablocks/{p-0d2a2e9e.entry.js → p-f4e221b2.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/snk-actions-button.d.ts +2 -3
- package/dist/types/components/snk-application/snk-application.d.ts +1 -6
- package/dist/types/components/snk-crud/snk-crud.d.ts +0 -4
- package/dist/types/components/snk-distinct-search/snk-distinct-search.d.ts +83 -0
- package/dist/types/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.d.ts +105 -0
- package/dist/types/components/snk-distinct-search/subcomponents/search-modal/search-modal.d.ts +126 -0
- package/dist/types/components/snk-distinct-search/types/index.d.ts +8 -0
- package/dist/types/components/snk-distinct-search/utils/filter-distinct-search.d.ts +3 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +0 -4
- package/dist/types/components/snk-grid/snk-grid.d.ts +0 -4
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +0 -3
- package/dist/types/components.d.ts +393 -31
- package/dist/types/lib/http/data-fetcher/fetchers/distinct-search-fetcher.d.ts +6 -0
- package/dist/types/lib/message/resources/snk-distinct-search.msg.d.ts +2 -0
- package/package.json +1 -1
- package/react/components.d.ts +3 -0
- package/react/components.js +3 -0
- package/react/components.js.map +1 -1
- package/dist/sankhyablocks/p-17425c72.js +0 -1
- package/dist/sankhyablocks/p-200a5481.entry.js +0 -11
- package/dist/sankhyablocks/p-342eeb3b.js +0 -1
- package/dist/sankhyablocks/p-520c7c38.entry.js +0 -1
- package/dist/sankhyablocks/p-83e71703.entry.js +0 -1
- package/dist/sankhyablocks/p-a3fadd0b.entry.js +0 -1
- package/dist/sankhyablocks/p-ac26df7a.entry.js +0 -1
- package/dist/sankhyablocks/p-af7f7b3e.entry.js +0 -1
- package/dist/sankhyablocks/p-c51ad0e7.entry.js +0 -1
- package/dist/types/components/snk-actions-button/interfaces/index.d.ts +0 -3
- /package/dist/collection/components/{snk-actions-button/interfaces → snk-distinct-search/types}/index.js +0 -0
|
@@ -73,7 +73,6 @@ export class SnkGrid {
|
|
|
73
73
|
this.autoLoad = undefined;
|
|
74
74
|
this.autoFocus = true;
|
|
75
75
|
this.enableGridInsert = false;
|
|
76
|
-
this.enableLockManger = false;
|
|
77
76
|
}
|
|
78
77
|
/**
|
|
79
78
|
* Exibe a janela de configurações da grade.
|
|
@@ -161,17 +160,10 @@ export class SnkGrid {
|
|
|
161
160
|
this._grid.setFocus();
|
|
162
161
|
}
|
|
163
162
|
async handleClick(event) {
|
|
164
|
-
var _a;
|
|
165
163
|
if (this.hasToBlockEvent(event)) {
|
|
166
164
|
event.preventDefault();
|
|
167
165
|
event.stopPropagation();
|
|
168
|
-
|
|
169
|
-
return;
|
|
170
|
-
const newEvent = new event.constructor(event.type, event);
|
|
171
|
-
(_a = event.target) === null || _a === void 0 ? void 0 : _a.dispatchEvent(newEvent);
|
|
172
|
-
}
|
|
173
|
-
if (this._grid && !this._grid.contains(event.target)) {
|
|
174
|
-
this._grid.stopEdit();
|
|
166
|
+
await this._dataUnit.cancelEdition();
|
|
175
167
|
}
|
|
176
168
|
}
|
|
177
169
|
hasToBlockEvent(event) {
|
|
@@ -462,7 +454,7 @@ export class SnkGrid {
|
|
|
462
454
|
return undefined;
|
|
463
455
|
}
|
|
464
456
|
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--extra-small" }, this._showSnkFilterBar &&
|
|
465
|
-
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert
|
|
457
|
+
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this.getGridHeaderButtons(), presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
|
466
458
|
}
|
|
467
459
|
static get is() { return "snk-grid"; }
|
|
468
460
|
static get encapsulation() { return "scoped"; }
|
|
@@ -926,24 +918,6 @@ export class SnkGrid {
|
|
|
926
918
|
"attribute": "enable-grid-insert",
|
|
927
919
|
"reflect": false,
|
|
928
920
|
"defaultValue": "false"
|
|
929
|
-
},
|
|
930
|
-
"enableLockManger": {
|
|
931
|
-
"type": "boolean",
|
|
932
|
-
"mutable": false,
|
|
933
|
-
"complexType": {
|
|
934
|
-
"original": "boolean",
|
|
935
|
-
"resolved": "boolean",
|
|
936
|
-
"references": {}
|
|
937
|
-
},
|
|
938
|
-
"required": false,
|
|
939
|
-
"optional": true,
|
|
940
|
-
"docs": {
|
|
941
|
-
"tags": [],
|
|
942
|
-
"text": "Ativa o gerenciamento de locks na grade."
|
|
943
|
-
},
|
|
944
|
-
"attribute": "enable-lock-manger",
|
|
945
|
-
"reflect": false,
|
|
946
|
-
"defaultValue": "false"
|
|
947
921
|
}
|
|
948
922
|
};
|
|
949
923
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApplicationContext, DataType, ElementIDUtils, FloatingManager, JSUtils,
|
|
1
|
+
import { ApplicationContext, DataType, ElementIDUtils, FloatingManager, JSUtils, ObjectUtils, StringUtils, UserInterface, } from '@sankhyalabs/core';
|
|
2
2
|
import { CSSVarsUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
3
3
|
import { h } from '@stencil/core';
|
|
4
4
|
import { SIMPLE_CRUD_MODE, VIEW_MODE } from '../../lib/utils/constants';
|
|
@@ -41,7 +41,6 @@ export class SnkSimpleCrud {
|
|
|
41
41
|
this.mode = SIMPLE_CRUD_MODE.SERVER;
|
|
42
42
|
this.gridConfig = undefined;
|
|
43
43
|
this.formConfig = undefined;
|
|
44
|
-
this.enableLockManger = false;
|
|
45
44
|
this._formFields = [];
|
|
46
45
|
this._fieldsProps = new Map();
|
|
47
46
|
this._enableContinuousInsert = true;
|
|
@@ -341,7 +340,6 @@ export class SnkSimpleCrud {
|
|
|
341
340
|
}
|
|
342
341
|
componentDidLoad() {
|
|
343
342
|
CSSVarsUtils.applyVarsGrid(this._element, this._grid);
|
|
344
|
-
this.initKeyboardManager();
|
|
345
343
|
}
|
|
346
344
|
setCustomRenders() {
|
|
347
345
|
if (!this._grid) {
|
|
@@ -727,49 +725,16 @@ export class SnkSimpleCrud {
|
|
|
727
725
|
return;
|
|
728
726
|
this.goToView(VIEW_MODE.FORM);
|
|
729
727
|
}
|
|
730
|
-
async initKeyboardManager() {
|
|
731
|
-
const keyboardManager = new KeyboardManager();
|
|
732
|
-
if (keyboardManager) {
|
|
733
|
-
const dataUnit = this.dataUnit || await this._snkDataUnit.getDataUnit();
|
|
734
|
-
async function saveDataUnitHandlingFocus() {
|
|
735
|
-
const element = document.activeElement;
|
|
736
|
-
const isDocumentBody = (element == document.body);
|
|
737
|
-
if (!isDocumentBody)
|
|
738
|
-
element.blur();
|
|
739
|
-
await dataUnit.saveData();
|
|
740
|
-
if (!isDocumentBody && element.setFocus != undefined) {
|
|
741
|
-
element.setFocus();
|
|
742
|
-
return;
|
|
743
|
-
}
|
|
744
|
-
if (!isDocumentBody)
|
|
745
|
-
element.focus();
|
|
746
|
-
}
|
|
747
|
-
keyboardManager
|
|
748
|
-
.bind("F7", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados.", element: this._element })
|
|
749
|
-
.bind("F8", dataUnit.addRecord.bind(dataUnit), { description: "Adiciona um novo registro.", element: this._element })
|
|
750
|
-
.bind("F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
|
|
751
|
-
.bind("Escape", () => {
|
|
752
|
-
if (dataUnit.isDirty()) {
|
|
753
|
-
dataUnit.cancelEdition();
|
|
754
|
-
}
|
|
755
|
-
}, {
|
|
756
|
-
debounceTime: 1000,
|
|
757
|
-
description: "Cancela uma ação.", element: this._element
|
|
758
|
-
});
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
renderTaskbarContent() {
|
|
762
|
-
var _a;
|
|
763
|
-
return (h("snk-taskbar", { class: this._currentViewMode === VIEW_MODE.FORM && "ez-box ez-box--shadow ez-padding--small", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })));
|
|
764
|
-
}
|
|
765
728
|
/* istanbul ignore next */
|
|
766
729
|
render() {
|
|
730
|
+
var _a;
|
|
767
731
|
if (this.dataUnit == undefined) {
|
|
768
732
|
return;
|
|
769
733
|
}
|
|
770
|
-
|
|
734
|
+
const taskbarContent = (h("snk-taskbar", { class: this._currentViewMode === VIEW_MODE.FORM && "ez-box ez-box--shadow ez-padding--small", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })));
|
|
735
|
+
return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: this.handleDataUnitOnInsertionMode.bind(this), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID && !this.enableGridInsert, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, this._currentViewMode === VIEW_MODE.FORM && taskbarContent, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
|
771
736
|
? undefined
|
|
772
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert,
|
|
737
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert }, this._currentViewMode === VIEW_MODE.GRID && taskbarContent, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
|
773
738
|
}
|
|
774
739
|
static get is() { return "snk-simple-crud"; }
|
|
775
740
|
static get encapsulation() { return "scoped"; }
|
|
@@ -905,24 +870,6 @@ export class SnkSimpleCrud {
|
|
|
905
870
|
"text": ""
|
|
906
871
|
}
|
|
907
872
|
},
|
|
908
|
-
"enableLockManger": {
|
|
909
|
-
"type": "boolean",
|
|
910
|
-
"mutable": false,
|
|
911
|
-
"complexType": {
|
|
912
|
-
"original": "boolean",
|
|
913
|
-
"resolved": "boolean",
|
|
914
|
-
"references": {}
|
|
915
|
-
},
|
|
916
|
-
"required": false,
|
|
917
|
-
"optional": true,
|
|
918
|
-
"docs": {
|
|
919
|
-
"tags": [],
|
|
920
|
-
"text": ""
|
|
921
|
-
},
|
|
922
|
-
"attribute": "enable-lock-manger",
|
|
923
|
-
"reflect": false,
|
|
924
|
-
"defaultValue": "false"
|
|
925
|
-
},
|
|
926
873
|
"multipleSelection": {
|
|
927
874
|
"type": "boolean",
|
|
928
875
|
"mutable": false,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApplicationContext, ElementIDUtils, OverflowDirection, OverflowWatcher, StringUtils, OVERFLOWED_CLASS_NAME
|
|
1
|
+
import { ApplicationContext, ElementIDUtils, OverflowDirection, OverflowWatcher, StringUtils, OVERFLOWED_CLASS_NAME } from '@sankhyalabs/core';
|
|
2
2
|
import { h, Host } from '@stencil/core';
|
|
3
3
|
import { AuthorizationConfig } from '../snk-configurator/AuthorizationConfig';
|
|
4
4
|
import { AuthorizationElements, buildCustomButton, buildElem, TaskbarElement, VisibleWhenForbidden, } from './elements/taskbar-elements';
|
|
@@ -149,44 +149,42 @@ export class SnkTaskbar {
|
|
|
149
149
|
return key ? (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, {}) : "";
|
|
150
150
|
}
|
|
151
151
|
elementClick(elem) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
break;
|
|
185
|
-
}
|
|
152
|
+
if (this.dataUnit) {
|
|
153
|
+
switch (elem) {
|
|
154
|
+
case TaskbarElement.PREVIOUS:
|
|
155
|
+
this.dataUnit.previousRecord();
|
|
156
|
+
break;
|
|
157
|
+
case TaskbarElement.NEXT:
|
|
158
|
+
this.dataUnit.nextRecord();
|
|
159
|
+
break;
|
|
160
|
+
case TaskbarElement.REFRESH:
|
|
161
|
+
this.dataUnit.loadData();
|
|
162
|
+
break;
|
|
163
|
+
case TaskbarElement.CLONE:
|
|
164
|
+
this.dataUnit.copySelected();
|
|
165
|
+
break;
|
|
166
|
+
case TaskbarElement.REMOVE:
|
|
167
|
+
this.dataUnit.removeSelectedRecords();
|
|
168
|
+
break;
|
|
169
|
+
case TaskbarElement.INSERT:
|
|
170
|
+
this.dataUnit.addRecord();
|
|
171
|
+
break;
|
|
172
|
+
case TaskbarElement.CANCEL:
|
|
173
|
+
this.dataUnit.cancelEdition();
|
|
174
|
+
break;
|
|
175
|
+
case TaskbarElement.SAVE:
|
|
176
|
+
if (!this._isWaitingForSave) {
|
|
177
|
+
this._isWaitingForSave = true;
|
|
178
|
+
this.dataUnit.saveData()
|
|
179
|
+
.finally(() => {
|
|
180
|
+
this._isWaitingForSave = false;
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
break;
|
|
186
184
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
185
|
+
}
|
|
186
|
+
if (this.isEnabled(elem))
|
|
187
|
+
this.actionClick.emit(elem);
|
|
190
188
|
}
|
|
191
189
|
isEnabled(elem) {
|
|
192
190
|
if (!this.isAllowed(elem)) {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DataFetcher } from "../DataFetcher";
|
|
2
|
+
export default class DistinctSearchFetcher {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.SERVICE = 'mge@Pesquisa.getSelectDistinct';
|
|
5
|
+
}
|
|
6
|
+
buildRequestBody(coluna, instancia) {
|
|
7
|
+
return {
|
|
8
|
+
selectDistinct: {
|
|
9
|
+
instancia,
|
|
10
|
+
coluna,
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
parseResponseBody(response) {
|
|
15
|
+
var _a, _b, _c;
|
|
16
|
+
const ocorrencias = (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.ocorrencias) === null || _a === void 0 ? void 0 : _a.ocorrencia) === null || _b === void 0 ? void 0 : _b.map(({ $ }) => $)) !== null && _c !== void 0 ? _c : [];
|
|
17
|
+
return ocorrencias;
|
|
18
|
+
}
|
|
19
|
+
async fetchItens(coluna, instancia) {
|
|
20
|
+
const requestBody = this.buildRequestBody(coluna, instancia);
|
|
21
|
+
const response = await DataFetcher.get().callServiceBroker(this.SERVICE, requestBody);
|
|
22
|
+
const parsedResponse = this.parseResponseBody(response);
|
|
23
|
+
return parsedResponse;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -7,6 +7,7 @@ import snkCrudMessages from "./resources/snk-crud.msg";
|
|
|
7
7
|
import snkSimpleCrudMessages from "./resources/snk-simple-crud.msg";
|
|
8
8
|
import fileViewerMessages from "./resources/file-viewer.msg";
|
|
9
9
|
import snkApplicationMessages from "./resources/snk-application.msg";
|
|
10
|
+
import snkDistinctSearchMessages from "./resources/snk-distinct-search.msg";
|
|
10
11
|
import { snkFormConfigMessages, snkConfigOptionsMessages, snkFieldConfigMessages, snkTabConfigMessages } from "./resources/snk-form.msg";
|
|
11
12
|
import { snkConfiguratorMessages } from "./resources/snk-configurator.msg";
|
|
12
13
|
import { snkGridMessages, snkGridConfigMessages } from "./resources/snk-grid.msg";
|
|
@@ -48,6 +49,7 @@ export class SnkMessageBuilder {
|
|
|
48
49
|
snkEntityList: snkEntityListMessages,
|
|
49
50
|
snkActionsButton: snkActionsButtonMessages,
|
|
50
51
|
snkPrintSelector: snkPrintSelectorMessages,
|
|
52
|
+
snkDistinctSearch: snkDistinctSearchMessages,
|
|
51
53
|
};
|
|
52
54
|
this._currentOperation = OperationMap.CLEAN;
|
|
53
55
|
this._domainName = domainName;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const snkDistinctSearchMessages = {
|
|
2
|
+
titleBadgeNew: "novo",
|
|
3
|
+
titleAdd: "Adicionar",
|
|
4
|
+
availableResults: "resultados disponíveis",
|
|
5
|
+
availableResult: "resultado disponível",
|
|
6
|
+
limitResult: "Esta pesquisa foi limitada, existem mais resultados",
|
|
7
|
+
emptyResult: "Nenhum resultado disponível. <br/>Você pode adicionar um novo termo",
|
|
8
|
+
};
|
|
9
|
+
export default snkDistinctSearchMessages;
|
|
@@ -172,6 +172,15 @@ const snkAttachMessages$1 = {
|
|
|
172
172
|
}
|
|
173
173
|
};
|
|
174
174
|
|
|
175
|
+
const snkDistinctSearchMessages = {
|
|
176
|
+
titleBadgeNew: "novo",
|
|
177
|
+
titleAdd: "Adicionar",
|
|
178
|
+
availableResults: "resultados disponíveis",
|
|
179
|
+
availableResult: "resultado disponível",
|
|
180
|
+
limitResult: "Esta pesquisa foi limitada, existem mais resultados",
|
|
181
|
+
emptyResult: "Nenhum resultado disponível. <br/>Você pode adicionar um novo termo",
|
|
182
|
+
};
|
|
183
|
+
|
|
175
184
|
const snkConfigOptionsMessages = {
|
|
176
185
|
label: {
|
|
177
186
|
nameField: "Nome do Campo *",
|
|
@@ -552,6 +561,7 @@ class SnkMessageBuilder {
|
|
|
552
561
|
snkEntityList: snkEntityListMessages,
|
|
553
562
|
snkActionsButton: snkActionsButtonMessages,
|
|
554
563
|
snkPrintSelector: snkPrintSelectorMessages,
|
|
564
|
+
snkDistinctSearch: snkDistinctSearchMessages,
|
|
555
565
|
};
|
|
556
566
|
this._currentOperation = OperationMap.CLEAN;
|
|
557
567
|
this._domainName = domainName;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
function normalizeString(text = "") {
|
|
2
|
+
return text.normalize('NFD').replace(/[\u0300-\u036f/\s'"&.-]/g, "").toUpperCase();
|
|
3
|
+
}
|
|
4
|
+
function filterItems(searchArgument, distinctItems, maxItems) {
|
|
5
|
+
const normalizedSearch = normalizeString(searchArgument);
|
|
6
|
+
const filteredDistincts = distinctItems.filter((item) => normalizeString(item).startsWith(normalizedSearch));
|
|
7
|
+
return filteredDistincts.slice(0, maxItems - 1);
|
|
8
|
+
}
|
|
9
|
+
function getMatchOption(value, distinctItems) {
|
|
10
|
+
const normalizedSearch = normalizeString(value);
|
|
11
|
+
const item = distinctItems.find((item) => normalizeString(item) === normalizedSearch);
|
|
12
|
+
return item;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { filterItems as f, getMatchOption as g, normalizeString as n };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/* sankhyablocks custom elements */
|
|
2
|
+
export { InputDistinctSearch as InputDistinctSearch } from '../types/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search';
|
|
3
|
+
export { SearchModal as SearchModal } from '../types/components/snk-distinct-search/subcomponents/search-modal/search-modal';
|
|
2
4
|
export { SnkActionsButton as SnkActionsButton } from '../types/components/snk-actions-button/snk-actions-button';
|
|
3
5
|
export { SnkActionsForm as SnkActionsForm } from '../types/components/snk-actions-button/subcomponents/snk-actions-form';
|
|
4
6
|
export { SnkApplication as SnkApplication } from '../types/components/snk-application/snk-application';
|
|
@@ -11,6 +13,7 @@ export { SnkCustomSlotElements as SnkCustomSlotElements } from '../types/compone
|
|
|
11
13
|
export { SnkDataExporter as SnkDataExporter } from '../types/components/snk-data-exporter/snk-data-exporter';
|
|
12
14
|
export { SnkDataUnit as SnkDataUnit } from '../types/components/snk-data-unit/snk-data-unit';
|
|
13
15
|
export { SnkDetailView as SnkDetailView } from '../types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view';
|
|
16
|
+
export { SnkDistinctSearch as SnkDistinctSearch } from '../types/components/snk-distinct-search/snk-distinct-search';
|
|
14
17
|
export { SnkEntityList as SnkEntityList } from '../types/components/snk-entity-list/snk-entity-list';
|
|
15
18
|
export { SnkExporterEmailSender as SnkExporterEmailSender } from '../types/components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender';
|
|
16
19
|
export { SnkExpressionGroup as SnkExpressionGroup } from '../types/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group';
|
package/dist/components/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { setAssetPath, setNonce, setPlatformOptions } from '@stencil/core/internal/client';
|
|
2
|
+
export { InputDistinctSearch, defineCustomElement as defineCustomElementInputDistinctSearch } from './input-distinct-search.js';
|
|
3
|
+
export { SearchModal, defineCustomElement as defineCustomElementSearchModal } from './search-modal.js';
|
|
2
4
|
export { SnkActionsButton, defineCustomElement as defineCustomElementSnkActionsButton } from './snk-actions-button.js';
|
|
3
5
|
export { SnkActionsForm, defineCustomElement as defineCustomElementSnkActionsForm } from './snk-actions-form.js';
|
|
4
6
|
export { SnkApplication, defineCustomElement as defineCustomElementSnkApplication } from './snk-application.js';
|
|
@@ -11,6 +13,7 @@ export { SnkCustomSlotElements, defineCustomElement as defineCustomElementSnkCus
|
|
|
11
13
|
export { SnkDataExporter, defineCustomElement as defineCustomElementSnkDataExporter } from './snk-data-exporter.js';
|
|
12
14
|
export { SnkDataUnit, defineCustomElement as defineCustomElementSnkDataUnit } from './snk-data-unit.js';
|
|
13
15
|
export { SnkDetailView, defineCustomElement as defineCustomElementSnkDetailView } from './snk-detail-view.js';
|
|
16
|
+
export { SnkDistinctSearch, defineCustomElement as defineCustomElementSnkDistinctSearch } from './snk-distinct-search.js';
|
|
14
17
|
export { SnkEntityList, defineCustomElement as defineCustomElementSnkEntityList } from './snk-entity-list.js';
|
|
15
18
|
export { SnkExporterEmailSender, defineCustomElement as defineCustomElementSnkExporterEmailSender } from './snk-exporter-email-sender.js';
|
|
16
19
|
export { SnkExpressionGroup, defineCustomElement as defineCustomElementSnkExpressionGroup } from './snk-expression-group.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface InputDistinctSearch extends Components.InputDistinctSearch, HTMLElement {}
|
|
4
|
+
export const InputDistinctSearch: {
|
|
5
|
+
prototype: InputDistinctSearch;
|
|
6
|
+
new (): InputDistinctSearch;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|