@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-71072.0 → 0.0.0-bugfix-dev-KB-76362.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.
Files changed (146) hide show
  1. package/dist/cjs/{SnkMessageBuilder-bae64d0d.js → SnkMessageBuilder-7691a2c1.js} +10 -0
  2. package/dist/cjs/index-f9e81701.js +8 -0
  3. package/dist/cjs/input-distinct-search_2.cjs.entry.js +471 -0
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  6. package/dist/cjs/snk-actions-button_4.cjs.entry.js +22 -25
  7. package/dist/cjs/snk-application.cjs.entry.js +2 -18
  8. package/dist/cjs/snk-config-options_3.cjs.entry.js +5 -17
  9. package/dist/cjs/snk-crud.cjs.entry.js +2 -8
  10. package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -5
  11. package/dist/cjs/{snk-data-unit-3d9b6ed4.js → snk-data-unit-7dbdad0e.js} +14 -26
  12. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  13. package/dist/cjs/snk-detail-view.cjs.entry.js +2 -2
  14. package/dist/cjs/snk-distinct-search.cjs.entry.js +123 -0
  15. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +0 -9
  16. package/dist/cjs/snk-filter-text.cjs.entry.js +1 -2
  17. package/dist/cjs/snk-grid.cjs.entry.js +2 -10
  18. package/dist/cjs/{snk-guides-viewer-2139481c.js → snk-guides-viewer-eee43c8b.js} +1 -1
  19. package/dist/cjs/snk-guides-viewer.cjs.entry.js +1 -1
  20. package/dist/cjs/snk-simple-crud.cjs.entry.js +4 -7
  21. package/dist/cjs/snk-taskbar.cjs.entry.js +37 -40
  22. package/dist/collection/collection-manifest.json +3 -0
  23. package/dist/collection/components/snk-actions-button/snk-actions-button.js +26 -27
  24. package/dist/collection/components/snk-application/snk-application.js +1 -41
  25. package/dist/collection/components/snk-crud/snk-crud.js +2 -26
  26. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +1 -1
  27. package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +3 -3
  28. package/dist/collection/components/snk-data-unit/snk-data-unit.js +13 -25
  29. package/dist/collection/components/snk-distinct-search/snk-distinct-search.css +4 -0
  30. package/dist/collection/components/snk-distinct-search/snk-distinct-search.js +372 -0
  31. package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.css +110 -0
  32. package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.js +544 -0
  33. package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.css +28 -0
  34. package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.js +593 -0
  35. package/dist/collection/components/snk-distinct-search/utils/filter-distinct-search.js +15 -0
  36. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +1 -2
  37. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +1 -5
  38. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +0 -20
  39. package/dist/collection/components/snk-form-config/snk-form-config.js +5 -17
  40. package/dist/collection/components/snk-grid/snk-grid.js +2 -28
  41. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +4 -25
  42. package/dist/collection/components/snk-taskbar/snk-taskbar.js +38 -41
  43. package/dist/collection/lib/http/data-fetcher/fetchers/distinct-search-fetcher.js +25 -0
  44. package/dist/collection/lib/http/data-fetcher/fetchers/parameters-fecher.js +1 -7
  45. package/dist/collection/lib/message/SnkMessageBuilder.js +2 -0
  46. package/dist/collection/lib/message/resources/snk-distinct-search.msg.js +9 -0
  47. package/dist/components/SnkMessageBuilder.js +10 -0
  48. package/dist/components/filter-distinct-search.js +17 -0
  49. package/dist/components/index.d.ts +3 -0
  50. package/dist/components/index.js +3 -0
  51. package/dist/components/input-distinct-search.d.ts +11 -0
  52. package/dist/components/input-distinct-search.js +6 -0
  53. package/dist/components/input-distinct-search2.js +264 -0
  54. package/dist/components/search-modal.d.ts +11 -0
  55. package/dist/components/search-modal.js +6 -0
  56. package/dist/components/search-modal2.js +264 -0
  57. package/dist/components/snk-actions-button2.js +26 -27
  58. package/dist/components/snk-application2.js +2 -19
  59. package/dist/components/snk-crud.js +2 -9
  60. package/dist/components/snk-data-exporter2.js +3 -3
  61. package/dist/components/snk-data-unit2.js +13 -25
  62. package/dist/components/snk-detail-view2.js +1 -1
  63. package/dist/components/snk-distinct-search.d.ts +11 -0
  64. package/dist/components/snk-distinct-search.js +163 -0
  65. package/dist/components/snk-filter-bar2.js +0 -6
  66. package/dist/components/snk-filter-item2.js +1 -5
  67. package/dist/components/snk-filter-text.js +1 -2
  68. package/dist/components/snk-form-config2.js +5 -17
  69. package/dist/components/snk-grid2.js +2 -11
  70. package/dist/components/snk-simple-crud2.js +4 -8
  71. package/dist/components/snk-taskbar2.js +38 -41
  72. package/dist/esm/{SnkMessageBuilder-6fff4a4c.js → SnkMessageBuilder-7ace6803.js} +10 -0
  73. package/dist/esm/index-a7d3d3f1.js +8 -0
  74. package/dist/esm/input-distinct-search_2.entry.js +466 -0
  75. package/dist/esm/loader.js +1 -1
  76. package/dist/esm/sankhyablocks.js +1 -1
  77. package/dist/esm/snk-actions-button_4.entry.js +23 -26
  78. package/dist/esm/snk-application.entry.js +3 -19
  79. package/dist/esm/snk-config-options_3.entry.js +5 -17
  80. package/dist/esm/snk-crud.entry.js +2 -8
  81. package/dist/esm/snk-data-exporter.entry.js +5 -5
  82. package/dist/esm/{snk-data-unit-9fa7d2b9.js → snk-data-unit-7a579dbd.js} +14 -26
  83. package/dist/esm/snk-data-unit.entry.js +2 -2
  84. package/dist/esm/snk-detail-view.entry.js +2 -2
  85. package/dist/esm/snk-distinct-search.entry.js +119 -0
  86. package/dist/esm/snk-filter-bar_4.entry.js +1 -10
  87. package/dist/esm/snk-filter-text.entry.js +1 -2
  88. package/dist/esm/snk-grid.entry.js +2 -10
  89. package/dist/esm/{snk-guides-viewer-b7ed39eb.js → snk-guides-viewer-e8ca764a.js} +1 -1
  90. package/dist/esm/snk-guides-viewer.entry.js +1 -1
  91. package/dist/esm/snk-simple-crud.entry.js +4 -7
  92. package/dist/esm/snk-taskbar.entry.js +38 -41
  93. package/dist/sankhyablocks/{p-483ef1fa.entry.js → p-00f9fe5c.entry.js} +1 -1
  94. package/dist/sankhyablocks/p-0e250436.entry.js +1 -0
  95. package/dist/sankhyablocks/p-154aa2a6.entry.js +11 -0
  96. package/dist/sankhyablocks/p-18cb1acb.entry.js +1 -0
  97. package/dist/sankhyablocks/p-1dbd5c18.entry.js +1 -0
  98. package/dist/sankhyablocks/p-2aae03a1.entry.js +1 -0
  99. package/dist/sankhyablocks/p-30ebcbe0.entry.js +1 -0
  100. package/dist/sankhyablocks/p-3858a2e4.entry.js +1 -0
  101. package/dist/sankhyablocks/{p-4138da61.entry.js → p-42130213.entry.js} +1 -1
  102. package/dist/sankhyablocks/p-563b7c28.entry.js +1 -0
  103. package/dist/sankhyablocks/p-96a89d58.entry.js +1 -0
  104. package/dist/sankhyablocks/p-987c7328.entry.js +1 -0
  105. package/dist/sankhyablocks/{p-e390641b.entry.js → p-b389ed49.entry.js} +1 -1
  106. package/dist/sankhyablocks/p-c75fae8e.js +1 -0
  107. package/dist/sankhyablocks/p-d8665750.js +1 -0
  108. package/dist/sankhyablocks/{p-e97be1c8.js → p-e3a285a2.js} +1 -1
  109. package/dist/sankhyablocks/p-f0aaad2b.entry.js +1 -0
  110. package/dist/sankhyablocks/{p-0d2a2e9e.entry.js → p-f4e221b2.entry.js} +1 -1
  111. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  112. package/dist/types/components/snk-actions-button/snk-actions-button.d.ts +2 -3
  113. package/dist/types/components/snk-application/snk-application.d.ts +1 -6
  114. package/dist/types/components/snk-crud/snk-crud.d.ts +0 -4
  115. package/dist/types/components/snk-distinct-search/snk-distinct-search.d.ts +83 -0
  116. package/dist/types/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.d.ts +105 -0
  117. package/dist/types/components/snk-distinct-search/subcomponents/search-modal/search-modal.d.ts +127 -0
  118. package/dist/types/components/snk-distinct-search/types/index.d.ts +12 -0
  119. package/dist/types/components/snk-distinct-search/utils/filter-distinct-search.d.ts +4 -0
  120. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +0 -2
  121. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +0 -4
  122. package/dist/types/components/snk-grid/snk-grid.d.ts +0 -4
  123. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +0 -2
  124. package/dist/types/components.d.ts +393 -31
  125. package/dist/types/lib/http/data-fetcher/fetchers/distinct-search-fetcher.d.ts +6 -0
  126. package/dist/types/lib/http/data-fetcher/fetchers/parameters-fecher.d.ts +0 -1
  127. package/dist/types/lib/message/resources/snk-distinct-search.msg.d.ts +2 -0
  128. package/package.json +1 -1
  129. package/react/components.d.ts +3 -0
  130. package/react/components.js +3 -0
  131. package/react/components.js.map +1 -1
  132. package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type-mask.enum.js +0 -8
  133. package/dist/sankhyablocks/p-0387d9d7.entry.js +0 -1
  134. package/dist/sankhyablocks/p-17425c72.js +0 -1
  135. package/dist/sankhyablocks/p-1d3ce0d9.entry.js +0 -1
  136. package/dist/sankhyablocks/p-342eeb3b.js +0 -1
  137. package/dist/sankhyablocks/p-3728d2aa.entry.js +0 -11
  138. package/dist/sankhyablocks/p-4e1f992e.entry.js +0 -1
  139. package/dist/sankhyablocks/p-619aeac8.entry.js +0 -1
  140. package/dist/sankhyablocks/p-89c92727.entry.js +0 -1
  141. package/dist/sankhyablocks/p-a3fadd0b.entry.js +0 -1
  142. package/dist/sankhyablocks/p-af7f7b3e.entry.js +0 -1
  143. package/dist/sankhyablocks/p-ec43fcc8.entry.js +0 -1
  144. package/dist/types/components/snk-actions-button/interfaces/index.d.ts +0 -3
  145. package/dist/types/components/snk-filter-bar/filter-item/filter-item-type-mask.enum.d.ts +0 -7
  146. /package/dist/collection/components/{snk-actions-button/interfaces → snk-distinct-search/types}/index.js +0 -0
@@ -42,7 +42,6 @@ export class SnkCrud {
42
42
  this.enableGridInsert = false;
43
43
  this.domainMessagesBuilder = undefined;
44
44
  this.ignoreReadOnlyFormFields = undefined;
45
- this.enableLockManger = false;
46
45
  this.setCustomFormTitle = undefined;
47
46
  this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
48
47
  }
@@ -284,16 +283,11 @@ export class SnkCrud {
284
283
  if (!isDocumentBody)
285
284
  element.focus();
286
285
  }
287
- async function handleAddRecord() {
288
- if (!dataUnit.hasNewRecord()) {
289
- dataUnit.addRecord();
290
- }
291
- }
292
286
  keyboardManager
293
287
  .bind("F6", this.toggleView.bind(this), { description: "Alterna entre modo formulário e grade.", element: this._element })
294
288
  .bind("F7", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados.", element: this._element })
295
289
  .bind("ctrl + \\", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados.", element: this._element })
296
- .bind("F8", handleAddRecord.bind(this), { description: "Adiciona um novo registro.", element: this._element })
290
+ .bind("F8", dataUnit.addRecord.bind(dataUnit), { description: "Adiciona um novo registro.", element: this._element })
297
291
  .bind("F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
298
292
  .bind("ctrl + F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
299
293
  .bind("ctrl + .", () => {
@@ -390,7 +384,7 @@ export class SnkCrud {
390
384
  return;
391
385
  }
392
386
  this._snkDataUnit.ignoreSaveMessage = (this._currentViewMode === VIEW_MODE.GRID && !this.enableGridInsert);
393
- return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", { class: 'ez-flex ez-flex--column ez-size-height--full ez-size-width--full ez-padding--medium' }, h("snk-grid", { ref: (ref) => this._snkGrid = ref, class: 'ez-flex ez-flex--column ez-size-height--full ez-size-width--full', filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableLockManger: this.enableLockManger }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName, enableGridInsert: this.enableGridInsert, getCustomTitle: this.setCustomFormTitle, ignoreReadOnlyFormFields: this.ignoreReadOnlyFormFields }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
387
+ return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName, enableGridInsert: this.enableGridInsert, getCustomTitle: this.setCustomFormTitle, ignoreReadOnlyFormFields: this.ignoreReadOnlyFormFields }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
394
388
  }
395
389
  static get is() { return "snk-crud"; }
396
390
  static get encapsulation() { return "scoped"; }
@@ -799,24 +793,6 @@ export class SnkCrud {
799
793
  "attribute": "ignore-read-only-form-fields",
800
794
  "reflect": false
801
795
  },
802
- "enableLockManger": {
803
- "type": "boolean",
804
- "mutable": false,
805
- "complexType": {
806
- "original": "boolean",
807
- "resolved": "boolean",
808
- "references": {}
809
- },
810
- "required": false,
811
- "optional": true,
812
- "docs": {
813
- "tags": [],
814
- "text": "Ativa o gerenciamento de locks na grade."
815
- },
816
- "attribute": "enable-lock-manger",
817
- "reflect": false,
818
- "defaultValue": "false"
819
- },
820
796
  "setCustomFormTitle": {
821
797
  "type": "unknown",
822
798
  "mutable": false,
@@ -440,7 +440,7 @@ export class SnkGuidesViewer {
440
440
  await this.openGuideNavigator(guideName);
441
441
  }
442
442
  if (action.type === DUAction.METADATA_LOADED) {
443
- this.loadGuides(this.noGuideSelected());
443
+ this.loadGuides(false);
444
444
  }
445
445
  }
446
446
  async addErrorBadgeToGuide(guideName) {
@@ -51,10 +51,10 @@ export default class ClientSideExporterStrategy {
51
51
  "GridXLSBuilderSP.buildXLSFromJson",
52
52
  responseBody => ({
53
53
  fileSessionKey: responseBody.chaveXLS.valor,
54
- canPrint: true,
55
- canExport: true,
56
- canSendEmail: true,
54
+ canPrint: false,
55
+ canExport: false,
57
56
  useAppPrint: false,
57
+ canSendEmail: false
58
58
  })
59
59
  ];
60
60
  }
@@ -16,7 +16,7 @@ export class SnkDataUnit {
16
16
  this._rowMetadataCache = new Map();
17
17
  this.REGEX_DATAUNIT_NAME = /dd:\/\/(.+?)\//;
18
18
  this._dataUnitObserver = async (action) => {
19
- const duState = await this.buildDataState(action.type);
19
+ const duState = this.buildDataState(action.type);
20
20
  this.dataState = duState;
21
21
  this.messagesBuilder.currentOperation = this.getMessageOperation();
22
22
  switch (action.type) {
@@ -130,22 +130,14 @@ export class SnkDataUnit {
130
130
  async getRowMetadata(record) {
131
131
  return this.doGetRowMetadata(record);
132
132
  }
133
- async doGetRowMetadata(record) {
133
+ doGetRowMetadata(record) {
134
134
  const selectedRecord = this.dataUnit.getSelectedRecord();
135
135
  if (!record && !selectedRecord) {
136
136
  return;
137
137
  }
138
138
  const currentRecord = record || selectedRecord;
139
139
  const recordId = typeof currentRecord === 'string' ? currentRecord : currentRecord.__record__id__;
140
- let rowMetadata = this._metadataByRow.get(recordId);
141
- /*
142
- Nao fazemos cache de metadataByRow pra registros novos, pois a chave do mesmo
143
- muda ao ser salvo, por isso essa tratativa é necessária para que o dataState fique com metadados
144
- corretos nao confiando apenas no _metadataByRow
145
- */
146
- if (this.dataUnit.isNewRecord(recordId) && !rowMetadata) {
147
- rowMetadata = await this.handleLoadRowMetadata(selectedRecord);
148
- }
140
+ const rowMetadata = this._metadataByRow.get(recordId);
149
141
  if (!rowMetadata) {
150
142
  return;
151
143
  }
@@ -339,7 +331,7 @@ export class SnkDataUnit {
339
331
  case Action.RECORDS_COPIED:
340
332
  return this.interceptRecordsCopied(action);
341
333
  case Action.DATA_CHANGED:
342
- await this.handleLoadRowMetadata(action.payload);
334
+ await this.handleLoadRowMetadata(action);
343
335
  return await this.interceptDataChange(action);
344
336
  case Action.CHANGING_DATA:
345
337
  return await this.interceptDataChange(action);
@@ -359,9 +351,8 @@ export class SnkDataUnit {
359
351
  return action;
360
352
  }
361
353
  }
362
- async handleLoadRowMetadata(record) {
363
- if (!record)
364
- return;
354
+ async handleLoadRowMetadata(action) {
355
+ const record = action.type === Action.DATA_CHANGED ? action.payload : action.payload.changes[0].record;
365
356
  const keysPayload = Object.keys(record);
366
357
  const rmpField = keysPayload.find((field) => this._fieldsWithRmp.includes(field));
367
358
  if (rmpField) {
@@ -440,7 +431,7 @@ export class SnkDataUnit {
440
431
  isAllowed(flag) {
441
432
  return this._permissions ? this._permissions.isSup || this._permissions[flag] : false;
442
433
  }
443
- async buildDataState(actionType) {
434
+ buildDataState(actionType) {
444
435
  var _a;
445
436
  const selectionInfo = this.dataUnit.getSelectionInfo();
446
437
  const isStartingInsertionMode = (this.dataUnit.hasDirtyRecords() || this.dataUnit.hasWaitingChanges()) && (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isEmpty());
@@ -448,7 +439,7 @@ export class SnkDataUnit {
448
439
  let rowMetadata = (_a = this.dataState) === null || _a === void 0 ? void 0 : _a.rowMetadata;
449
440
  const allowedOverwrite = [Action.SELECTION_CHANGED, Action.EDITION_CANCELED, Action.NEXT_SELECTED, Action.PREVIOUS_SELECTED];
450
441
  if (selectedRecord && (!rowMetadata || allowedOverwrite.includes(actionType))) {
451
- rowMetadata = await this.doGetRowMetadata(selectedRecord);
442
+ rowMetadata = this.doGetRowMetadata(selectedRecord);
452
443
  }
453
444
  else if (rowMetadata) {
454
445
  rowMetadata.getProp = this.buildGetPropRowMetadata(rowMetadata);
@@ -470,20 +461,17 @@ export class SnkDataUnit {
470
461
  });
471
462
  }
472
463
  async handleDataSaved(action) {
473
- var _a, _b, _c;
474
- const newRowMetadata = await this.handleLoadRowMetadata((_c = (_b = (_a = action === null || action === void 0 ? void 0 : action.payload) === null || _a === void 0 ? void 0 : _a.changes) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.record);
464
+ const newRowMetadata = await this.handleLoadRowMetadata(action);
475
465
  if (newRowMetadata) {
476
466
  newRowMetadata.getProp = this.buildGetPropRowMetadata(newRowMetadata);
477
467
  }
478
468
  const recordId = action.payload.records[0].__record__id__;
479
469
  this._metadataByRow.set(recordId, newRowMetadata);
480
- this.dataState = await this.buildDataState();
481
- let saveOperation = action.payload.changes[0]._operation.toLowerCase();
482
- if (saveOperation == 'copy')
483
- saveOperation = OperationMap.CLONE;
484
- if (this.ignoreSaveMessage && ![OperationMap.CLONE, OperationMap.INSERT].includes(saveOperation)) {
470
+ this.dataState = this.buildDataState();
471
+ if (this.ignoreSaveMessage) {
485
472
  return;
486
473
  }
474
+ const saveOperation = action.payload.changes[0]._operation.toLowerCase();
487
475
  const msg = this.getMessage("snkDataUnit.saveInfo", action.payload.records[0], saveOperation);
488
476
  if (msg != undefined) {
489
477
  this.showSuccessMessage(msg);
@@ -576,7 +564,7 @@ export class SnkDataUnit {
576
564
  const { records } = this.getMetadataByRow(this.dataUnit);
577
565
  this.dataUnit.records = records;
578
566
  }
579
- this.dataState = await this.buildDataState();
567
+ this.dataState = this.buildDataState();
580
568
  let resolver;
581
569
  while (resolver = this._onDataUnitResolve.pop()) {
582
570
  resolver(this.dataUnit);
@@ -0,0 +1,4 @@
1
+ :host {
2
+ display: block;
3
+ width: 100%;
4
+ }
@@ -0,0 +1,372 @@
1
+ import { Host, h } from '@stencil/core';
2
+ import DistinctSearchFetcher from "../../lib/http/data-fetcher/fetchers/distinct-search-fetcher";
3
+ import { ApplicationContext } from '@sankhyalabs/core';
4
+ export class SnkDistinctSearch {
5
+ constructor() {
6
+ this.onIconClick = () => {
7
+ this._searchModalElement.value = this.value || "";
8
+ this._searchModalElement.openModal();
9
+ };
10
+ this.distinctItems = undefined;
11
+ this.value = "";
12
+ this.label = "";
13
+ this.configSearch = undefined;
14
+ this.maxItems = 100;
15
+ this.debounceTime = 300;
16
+ this.canShowError = false;
17
+ this.mode = 'regular';
18
+ this.restrict = undefined;
19
+ this.errorMessage = undefined;
20
+ }
21
+ /**
22
+ * Método para limpa o campo de entrada de pesquisa
23
+ */
24
+ clearInput() {
25
+ this._inputDistinctSearch.clearInput();
26
+ }
27
+ /**
28
+ * Retorna se o conteúdo é inválido.
29
+ */
30
+ isInvalid() {
31
+ return this._inputDistinctSearch.isInvalid();
32
+ }
33
+ /**
34
+ * Remove o foco do campo
35
+ */
36
+ setBlur() {
37
+ this._inputDistinctSearch.setBlur();
38
+ }
39
+ /**
40
+ * Aplica o foco do campo
41
+ */
42
+ setFocus() {
43
+ this._inputDistinctSearch.setFocus();
44
+ }
45
+ /**
46
+ * Método para fechar o modal
47
+ */
48
+ closeModal() {
49
+ this._searchModalElement.closeModal();
50
+ }
51
+ /**
52
+ * Método para abrir o modal
53
+ */
54
+ openModal() {
55
+ this._searchModalElement.openModal();
56
+ }
57
+ async componentWillLoad() {
58
+ await this.fetchDistinctItems();
59
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
60
+ }
61
+ async fetchDistinctItems() {
62
+ const distinctFetcher = new DistinctSearchFetcher();
63
+ const response = await distinctFetcher.fetchItens(this.configSearch.column, this.configSearch.instance);
64
+ this.distinctItems = [...response];
65
+ }
66
+ onChange(event) {
67
+ event.stopPropagation();
68
+ this.value = event.detail.value;
69
+ this._inputDistinctSearch.selectValue(event.detail.value, event.detail.isNewItem);
70
+ this.changeValue.emit(event.detail);
71
+ }
72
+ onPopupClose() {
73
+ this._inputDistinctSearch.setFocus();
74
+ }
75
+ getMessage(key) {
76
+ return this._application.messagesBuilder.getMessage(key, null);
77
+ }
78
+ renderEmptyMessage() {
79
+ return (h("span", { innerHTML: this.getMessage("snkDistinctSearch.emptyResult") }));
80
+ }
81
+ render() {
82
+ return (h(Host, null, h("input-distinct-search", { ref: (ref) => this._inputDistinctSearch = ref, application: this._application, label: this.label, distinctItems: this.distinctItems, onChangeValue: this.onChange.bind(this), debounceTime: this.debounceTime, value: this.value, onIconClick: this.onIconClick, maxItems: this.maxItems, canShowError: this.canShowError, mode: this.mode, restrict: this.restrict, errorMessage: this.errorMessage }), h("search-modal", { ref: (ref) => this._searchModalElement = ref, application: this._application, listItens: this.distinctItems, onChangeValue: this.onChange.bind(this), restrict: this.restrict, value: this.value, label: this.label, emptyMessage: this.renderEmptyMessage(), maxItens: this.maxItems, debounceTime: this.debounceTime, canShowError: this.canShowError, mode: this.mode, errorMessage: this.errorMessage, onPopupClose: this.onPopupClose.bind(this) })));
83
+ }
84
+ static get is() { return "snk-distinct-search"; }
85
+ static get encapsulation() { return "scoped"; }
86
+ static get originalStyleUrls() {
87
+ return {
88
+ "$": ["snk-distinct-search.css"]
89
+ };
90
+ }
91
+ static get styleUrls() {
92
+ return {
93
+ "$": ["snk-distinct-search.css"]
94
+ };
95
+ }
96
+ static get properties() {
97
+ return {
98
+ "value": {
99
+ "type": "string",
100
+ "mutable": true,
101
+ "complexType": {
102
+ "original": "string",
103
+ "resolved": "string",
104
+ "references": {}
105
+ },
106
+ "required": false,
107
+ "optional": false,
108
+ "docs": {
109
+ "tags": [],
110
+ "text": "Valor inicial do campo."
111
+ },
112
+ "attribute": "value",
113
+ "reflect": false,
114
+ "defaultValue": "\"\""
115
+ },
116
+ "label": {
117
+ "type": "string",
118
+ "mutable": false,
119
+ "complexType": {
120
+ "original": "string",
121
+ "resolved": "string",
122
+ "references": {}
123
+ },
124
+ "required": false,
125
+ "optional": false,
126
+ "docs": {
127
+ "tags": [],
128
+ "text": "Label apresentada no input."
129
+ },
130
+ "attribute": "label",
131
+ "reflect": false,
132
+ "defaultValue": "\"\""
133
+ },
134
+ "configSearch": {
135
+ "type": "unknown",
136
+ "mutable": false,
137
+ "complexType": {
138
+ "original": "IConfigSearch",
139
+ "resolved": "IConfigSearch",
140
+ "references": {
141
+ "IConfigSearch": {
142
+ "location": "import",
143
+ "path": "./types"
144
+ }
145
+ }
146
+ },
147
+ "required": false,
148
+ "optional": false,
149
+ "docs": {
150
+ "tags": [],
151
+ "text": "Dados para busca ao servi\u00E7o."
152
+ }
153
+ },
154
+ "maxItems": {
155
+ "type": "number",
156
+ "mutable": false,
157
+ "complexType": {
158
+ "original": "number",
159
+ "resolved": "number",
160
+ "references": {}
161
+ },
162
+ "required": false,
163
+ "optional": false,
164
+ "docs": {
165
+ "tags": [],
166
+ "text": "N\u00FAmero m\u00E1ximo de itens na lista."
167
+ },
168
+ "attribute": "max-items",
169
+ "reflect": false,
170
+ "defaultValue": "100"
171
+ },
172
+ "debounceTime": {
173
+ "type": "number",
174
+ "mutable": false,
175
+ "complexType": {
176
+ "original": "number",
177
+ "resolved": "number",
178
+ "references": {}
179
+ },
180
+ "required": false,
181
+ "optional": false,
182
+ "docs": {
183
+ "tags": [],
184
+ "text": "Tempo em milissegundos para debouncing das chamadas de busca de sugest\u00F5es."
185
+ },
186
+ "attribute": "debounce-time",
187
+ "reflect": false,
188
+ "defaultValue": "300"
189
+ },
190
+ "canShowError": {
191
+ "type": "boolean",
192
+ "mutable": false,
193
+ "complexType": {
194
+ "original": "boolean",
195
+ "resolved": "boolean",
196
+ "references": {}
197
+ },
198
+ "required": false,
199
+ "optional": false,
200
+ "docs": {
201
+ "tags": [],
202
+ "text": "Se false deixa de exibir a mensagem de erro dentro do campo."
203
+ },
204
+ "attribute": "can-show-error",
205
+ "reflect": false,
206
+ "defaultValue": "false"
207
+ },
208
+ "mode": {
209
+ "type": "string",
210
+ "mutable": false,
211
+ "complexType": {
212
+ "original": "'slim' | 'regular'",
213
+ "resolved": "\"regular\" | \"slim\"",
214
+ "references": {}
215
+ },
216
+ "required": false,
217
+ "optional": false,
218
+ "docs": {
219
+ "tags": [],
220
+ "text": "Define o tamanho do campo."
221
+ },
222
+ "attribute": "mode",
223
+ "reflect": false,
224
+ "defaultValue": "'regular'"
225
+ },
226
+ "restrict": {
227
+ "type": "string",
228
+ "mutable": false,
229
+ "complexType": {
230
+ "original": "string",
231
+ "resolved": "string",
232
+ "references": {}
233
+ },
234
+ "required": false,
235
+ "optional": false,
236
+ "docs": {
237
+ "tags": [],
238
+ "text": "Express\u00E3o que define os caracteres permitidos na entrada."
239
+ },
240
+ "attribute": "restrict",
241
+ "reflect": false,
242
+ "defaultValue": "undefined"
243
+ },
244
+ "errorMessage": {
245
+ "type": "string",
246
+ "mutable": false,
247
+ "complexType": {
248
+ "original": "string",
249
+ "resolved": "string",
250
+ "references": {}
251
+ },
252
+ "required": false,
253
+ "optional": false,
254
+ "docs": {
255
+ "tags": [],
256
+ "text": "Define uma mensagem de orienta\u00E7\u00E3o ao usu\u00E1rio, colocando o campo em modo inv\u00E1lido."
257
+ },
258
+ "attribute": "error-message",
259
+ "reflect": false,
260
+ "defaultValue": "undefined"
261
+ }
262
+ };
263
+ }
264
+ static get states() {
265
+ return {
266
+ "distinctItems": {}
267
+ };
268
+ }
269
+ static get events() {
270
+ return [{
271
+ "method": "changeValue",
272
+ "name": "changeValue",
273
+ "bubbles": true,
274
+ "cancelable": true,
275
+ "composed": true,
276
+ "docs": {
277
+ "tags": [],
278
+ "text": "Emitido quando h\u00E1 uma altera\u00E7\u00E3o no valor do campo."
279
+ },
280
+ "complexType": {
281
+ "original": "IDistinctValue",
282
+ "resolved": "IDistinctValue",
283
+ "references": {
284
+ "IDistinctValue": {
285
+ "location": "import",
286
+ "path": "./types"
287
+ }
288
+ }
289
+ }
290
+ }];
291
+ }
292
+ static get methods() {
293
+ return {
294
+ "clearInput": {
295
+ "complexType": {
296
+ "signature": "() => Promise<void>",
297
+ "parameters": [],
298
+ "references": {},
299
+ "return": "Promise<void>"
300
+ },
301
+ "docs": {
302
+ "text": "M\u00E9todo para limpa o campo de entrada de pesquisa",
303
+ "tags": []
304
+ }
305
+ },
306
+ "isInvalid": {
307
+ "complexType": {
308
+ "signature": "() => Promise<boolean>",
309
+ "parameters": [],
310
+ "references": {
311
+ "Promise": {
312
+ "location": "global"
313
+ }
314
+ },
315
+ "return": "Promise<boolean>"
316
+ },
317
+ "docs": {
318
+ "text": "Retorna se o conte\u00FAdo \u00E9 inv\u00E1lido.",
319
+ "tags": []
320
+ }
321
+ },
322
+ "setBlur": {
323
+ "complexType": {
324
+ "signature": "() => Promise<void>",
325
+ "parameters": [],
326
+ "references": {},
327
+ "return": "Promise<void>"
328
+ },
329
+ "docs": {
330
+ "text": "Remove o foco do campo",
331
+ "tags": []
332
+ }
333
+ },
334
+ "setFocus": {
335
+ "complexType": {
336
+ "signature": "() => Promise<void>",
337
+ "parameters": [],
338
+ "references": {},
339
+ "return": "Promise<void>"
340
+ },
341
+ "docs": {
342
+ "text": "Aplica o foco do campo",
343
+ "tags": []
344
+ }
345
+ },
346
+ "closeModal": {
347
+ "complexType": {
348
+ "signature": "() => Promise<void>",
349
+ "parameters": [],
350
+ "references": {},
351
+ "return": "Promise<void>"
352
+ },
353
+ "docs": {
354
+ "text": "M\u00E9todo para fechar o modal",
355
+ "tags": []
356
+ }
357
+ },
358
+ "openModal": {
359
+ "complexType": {
360
+ "signature": "() => Promise<void>",
361
+ "parameters": [],
362
+ "references": {},
363
+ "return": "Promise<void>"
364
+ },
365
+ "docs": {
366
+ "text": "M\u00E9todo para abrir o modal",
367
+ "tags": []
368
+ }
369
+ }
370
+ };
371
+ }
372
+ }
@@ -0,0 +1,110 @@
1
+ :host {
2
+ /*@doc Define o tamanho máximo do popover.*/
3
+ --max-height-popover: 180px;
4
+
5
+ /* scrollbar */
6
+ /*@doc Define a cor da barra de rolagem do componente.*/
7
+ --scrollbar--color-default: var(--scrollbar--default, #626e82);
8
+ /*@doc Define a cor de fundo da barra de rolagem do componente.*/
9
+ --scrollbar--color-background: var(--scrollbar--background, #E5EAF0);
10
+ /*@doc Define a cor do hover na barra de rolagem do componente.*/
11
+ --scrollbar--color-hover: var(--scrollbar--hover, #2B3A54);
12
+ /*@doc Define a cor do active na barra de rolagem do componente.*/
13
+ --scrollbar--color-clicked: var(--scrollbar--clicked, #a2abb9);
14
+ /*@doc Define o raio da borda da barra de rolagem do componente.*/
15
+ --scrollbar--border-radius: var(--border--radius-small, 6px);
16
+ /*@doc Define a largura da barra de rolagem do componente.*/
17
+ --scrollbar--width: var(--space--medium, 12px);
18
+ }
19
+
20
+ .divider {
21
+ margin: var(--space--extra-small, 3px) 0;
22
+ border: var(--border--small, 1px solid) var(--color--disable-secondary, #F2F5F8);
23
+ }
24
+
25
+ .new-value {
26
+ color: var(--text--primary, #626e82);
27
+ padding: var(--space--2xs, 8px) var(--space--3xs, 4px);
28
+ font-size: var(--text--medium, 14px);
29
+ font-family: var(--font-pattern, Roboto);
30
+ cursor: pointer;
31
+ border-radius: var(--border--radius-small, 6px);
32
+ overflow: hidden;
33
+ text-overflow: ellipsis;
34
+ white-space: nowrap;
35
+ border: none;
36
+ background: none;
37
+ width: 100%;
38
+ display: flex;
39
+ min-height: max-content;
40
+ }
41
+
42
+ .new-value-selected {
43
+ background-color: var(--color--primary-300, #E2F4EF);
44
+ }
45
+
46
+ .new-value:hover {
47
+ background-color: var(--background--medium, #e0e0e0);
48
+ }
49
+
50
+ .popover-content {
51
+ margin: var(--space--small, 6px);
52
+ max-height: calc(var(--max-height-popover) - (2 * var(--space--small, 6px)));
53
+ display: flex;
54
+ flex-direction: column;
55
+ }
56
+
57
+ .list-container {
58
+ overflow: auto;
59
+ scrollbar-width: thin;
60
+ scrollbar-color: var(--scrollbar--color-clicked) var(--scrollbar--color-background);
61
+ padding-right: var(--space--small, 6px);
62
+ }
63
+
64
+ .list-container::-webkit-scrollbar {
65
+ background-color: var(--scrollbar--color-background);
66
+ width: var(--scrollbar--width);
67
+ max-width: var(--scrollbar--width);
68
+ min-width: var(--scrollbar--width);
69
+ }
70
+
71
+ .list-container::-webkit-scrollbar-track {
72
+ background-color: var(--scrollbar--color-background);
73
+ border-radius: var(--scrollbar--border-radius);
74
+ }
75
+
76
+ .list-container::-webkit-scrollbar-thumb {
77
+ background-color: var(--scrollbar--color-default);
78
+ border-radius: var(--scrollbar--border-radius);
79
+ }
80
+
81
+ .list-container::-webkit-scrollbar-thumb:vertical:hover,
82
+ .list-container::-webkit-scrollbar-thumb:horizontal:hover {
83
+ background-color: var(--scrollbar--color-hover);
84
+ }
85
+
86
+ .list-container::-webkit-scrollbar-thumb:vertical:active,
87
+ .list-container::-webkit-scrollbar-thumb:horizontal:active {
88
+ background-color: var(--scrollbar--color-clicked);
89
+ }
90
+
91
+ ez-popover {
92
+ --ez-popover__box--z-index: 15;
93
+ }
94
+
95
+ .space-error {
96
+ --ez-popover__margin: -19px 0 0 0;
97
+ }
98
+
99
+ ez-list {
100
+ --ez-list__item--margin: 0;
101
+ }
102
+
103
+ ez-text-input {
104
+ --ez-text-input__icon--margin: var(--space--xs, 12px);
105
+ }
106
+
107
+ .badge-primary {
108
+ --ez-badge--background-color: var(--color--primary-300);
109
+ --ez-badge--color: var(--color--primary);
110
+ }