@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-75070.0 → 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.
Files changed (117) 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 +469 -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 +1 -11
  8. package/dist/cjs/snk-crud.cjs.entry.js +2 -8
  9. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  10. package/dist/cjs/{snk-data-unit-3d9b6ed4.js → snk-data-unit-7dbdad0e.js} +14 -26
  11. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  12. package/dist/cjs/snk-detail-view.cjs.entry.js +1 -1
  13. package/dist/cjs/snk-distinct-search.cjs.entry.js +123 -0
  14. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +0 -3
  15. package/dist/cjs/snk-grid.cjs.entry.js +2 -10
  16. package/dist/cjs/snk-simple-crud.cjs.entry.js +4 -39
  17. package/dist/cjs/snk-taskbar.cjs.entry.js +35 -37
  18. package/dist/collection/collection-manifest.json +3 -0
  19. package/dist/collection/components/snk-actions-button/snk-actions-button.js +26 -27
  20. package/dist/collection/components/snk-application/snk-application.js +1 -41
  21. package/dist/collection/components/snk-crud/snk-crud.js +2 -26
  22. package/dist/collection/components/snk-data-unit/snk-data-unit.js +13 -25
  23. package/dist/collection/components/snk-distinct-search/snk-distinct-search.css +4 -0
  24. package/dist/collection/components/snk-distinct-search/snk-distinct-search.js +372 -0
  25. package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.css +109 -0
  26. package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.js +542 -0
  27. package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.css +27 -0
  28. package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.js +600 -0
  29. package/dist/collection/components/snk-distinct-search/utils/filter-distinct-search.js +13 -0
  30. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +0 -18
  31. package/dist/collection/components/snk-grid/snk-grid.js +2 -28
  32. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +5 -58
  33. package/dist/collection/components/snk-taskbar/snk-taskbar.js +36 -38
  34. package/dist/collection/lib/http/data-fetcher/fetchers/distinct-search-fetcher.js +25 -0
  35. package/dist/collection/lib/message/SnkMessageBuilder.js +2 -0
  36. package/dist/collection/lib/message/resources/snk-distinct-search.msg.js +9 -0
  37. package/dist/components/SnkMessageBuilder.js +10 -0
  38. package/dist/components/filter-distinct-search.js +15 -0
  39. package/dist/components/index.d.ts +3 -0
  40. package/dist/components/index.js +3 -0
  41. package/dist/components/input-distinct-search.d.ts +11 -0
  42. package/dist/components/input-distinct-search.js +6 -0
  43. package/dist/components/input-distinct-search2.js +262 -0
  44. package/dist/components/search-modal.d.ts +11 -0
  45. package/dist/components/search-modal.js +6 -0
  46. package/dist/components/search-modal2.js +264 -0
  47. package/dist/components/snk-actions-button2.js +26 -27
  48. package/dist/components/snk-application2.js +1 -12
  49. package/dist/components/snk-crud.js +2 -9
  50. package/dist/components/snk-data-unit2.js +13 -25
  51. package/dist/components/snk-distinct-search.d.ts +11 -0
  52. package/dist/components/snk-distinct-search.js +163 -0
  53. package/dist/components/snk-filter-bar2.js +0 -4
  54. package/dist/components/snk-grid2.js +2 -11
  55. package/dist/components/snk-simple-crud2.js +5 -41
  56. package/dist/components/snk-taskbar2.js +36 -38
  57. package/dist/esm/{SnkMessageBuilder-6fff4a4c.js → SnkMessageBuilder-7ace6803.js} +10 -0
  58. package/dist/esm/index-a7d3d3f1.js +8 -0
  59. package/dist/esm/input-distinct-search_2.entry.js +464 -0
  60. package/dist/esm/loader.js +1 -1
  61. package/dist/esm/sankhyablocks.js +1 -1
  62. package/dist/esm/snk-actions-button_4.entry.js +23 -26
  63. package/dist/esm/snk-application.entry.js +2 -12
  64. package/dist/esm/snk-crud.entry.js +2 -8
  65. package/dist/esm/snk-data-exporter.entry.js +2 -2
  66. package/dist/esm/{snk-data-unit-9fa7d2b9.js → snk-data-unit-7a579dbd.js} +14 -26
  67. package/dist/esm/snk-data-unit.entry.js +2 -2
  68. package/dist/esm/snk-detail-view.entry.js +1 -1
  69. package/dist/esm/snk-distinct-search.entry.js +119 -0
  70. package/dist/esm/snk-filter-bar_4.entry.js +0 -3
  71. package/dist/esm/snk-grid.entry.js +2 -10
  72. package/dist/esm/snk-simple-crud.entry.js +5 -40
  73. package/dist/esm/snk-taskbar.entry.js +36 -38
  74. package/dist/sankhyablocks/{p-7075b789.entry.js → p-00f9fe5c.entry.js} +1 -1
  75. package/dist/sankhyablocks/p-0e250436.entry.js +1 -0
  76. package/dist/sankhyablocks/p-154aa2a6.entry.js +11 -0
  77. package/dist/sankhyablocks/p-18cb1acb.entry.js +1 -0
  78. package/dist/sankhyablocks/p-1dbd5c18.entry.js +1 -0
  79. package/dist/sankhyablocks/p-2aae03a1.entry.js +1 -0
  80. package/dist/sankhyablocks/p-37074cc3.entry.js +1 -0
  81. package/dist/sankhyablocks/p-3858a2e4.entry.js +1 -0
  82. package/dist/sankhyablocks/p-563b7c28.entry.js +1 -0
  83. package/dist/sankhyablocks/{p-43353d86.entry.js → p-b389ed49.entry.js} +1 -1
  84. package/dist/sankhyablocks/p-c75fae8e.js +1 -0
  85. package/dist/sankhyablocks/p-d8665750.js +1 -0
  86. package/dist/sankhyablocks/p-f0aaad2b.entry.js +1 -0
  87. package/dist/sankhyablocks/{p-0d2a2e9e.entry.js → p-f4e221b2.entry.js} +1 -1
  88. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  89. package/dist/types/components/snk-actions-button/snk-actions-button.d.ts +2 -3
  90. package/dist/types/components/snk-application/snk-application.d.ts +1 -6
  91. package/dist/types/components/snk-crud/snk-crud.d.ts +0 -4
  92. package/dist/types/components/snk-distinct-search/snk-distinct-search.d.ts +83 -0
  93. package/dist/types/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.d.ts +105 -0
  94. package/dist/types/components/snk-distinct-search/subcomponents/search-modal/search-modal.d.ts +126 -0
  95. package/dist/types/components/snk-distinct-search/types/index.d.ts +8 -0
  96. package/dist/types/components/snk-distinct-search/utils/filter-distinct-search.d.ts +3 -0
  97. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +0 -4
  98. package/dist/types/components/snk-grid/snk-grid.d.ts +0 -4
  99. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +0 -3
  100. package/dist/types/components.d.ts +393 -31
  101. package/dist/types/lib/http/data-fetcher/fetchers/distinct-search-fetcher.d.ts +6 -0
  102. package/dist/types/lib/message/resources/snk-distinct-search.msg.d.ts +2 -0
  103. package/package.json +1 -1
  104. package/react/components.d.ts +3 -0
  105. package/react/components.js +3 -0
  106. package/react/components.js.map +1 -1
  107. package/dist/sankhyablocks/p-17425c72.js +0 -1
  108. package/dist/sankhyablocks/p-200a5481.entry.js +0 -11
  109. package/dist/sankhyablocks/p-342eeb3b.js +0 -1
  110. package/dist/sankhyablocks/p-520c7c38.entry.js +0 -1
  111. package/dist/sankhyablocks/p-83e71703.entry.js +0 -1
  112. package/dist/sankhyablocks/p-a3fadd0b.entry.js +0 -1
  113. package/dist/sankhyablocks/p-ac26df7a.entry.js +0 -1
  114. package/dist/sankhyablocks/p-af7f7b3e.entry.js +0 -1
  115. package/dist/sankhyablocks/p-c51ad0e7.entry.js +0 -1
  116. package/dist/types/components/snk-actions-button/interfaces/index.d.ts +0 -3
  117. /package/dist/collection/components/{snk-actions-button/interfaces → snk-distinct-search/types}/index.js +0 -0
@@ -83,7 +83,6 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
83
83
  this.enableGridInsert = false;
84
84
  this.domainMessagesBuilder = undefined;
85
85
  this.ignoreReadOnlyFormFields = undefined;
86
- this.enableLockManger = false;
87
86
  this.setCustomFormTitle = undefined;
88
87
  this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
89
88
  }
@@ -324,16 +323,11 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
324
323
  if (!isDocumentBody)
325
324
  element.focus();
326
325
  }
327
- async function handleAddRecord() {
328
- if (!dataUnit.hasNewRecord()) {
329
- dataUnit.addRecord();
330
- }
331
- }
332
326
  keyboardManager
333
327
  .bind("F6", this.toggleView.bind(this), { description: "Alterna entre modo formulário e grade.", element: this._element })
334
328
  .bind("F7", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados.", element: this._element })
335
329
  .bind("ctrl + \\", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados.", element: this._element })
336
- .bind("F8", handleAddRecord.bind(this), { description: "Adiciona um novo registro.", element: this._element })
330
+ .bind("F8", dataUnit.addRecord.bind(dataUnit), { description: "Adiciona um novo registro.", element: this._element })
337
331
  .bind("F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
338
332
  .bind("ctrl + F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
339
333
  .bind("ctrl + .", () => {
@@ -430,7 +424,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
430
424
  return;
431
425
  }
432
426
  this._snkDataUnit.ignoreSaveMessage = (this._currentViewMode === VIEW_MODE.GRID && !this.enableGridInsert);
433
- 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, 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" }))));
427
+ 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" }))));
434
428
  }
435
429
  get _element() { return this; }
436
430
  static get watchers() { return {
@@ -459,7 +453,6 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
459
453
  "enableGridInsert": [4, "enable-grid-insert"],
460
454
  "domainMessagesBuilder": [1, "domain-messages-builder"],
461
455
  "ignoreReadOnlyFormFields": [4, "ignore-read-only-form-fields"],
462
- "enableLockManger": [4, "enable-lock-manger"],
463
456
  "setCustomFormTitle": [16],
464
457
  "_dataUnit": [32],
465
458
  "_dataState": [32],
@@ -24,7 +24,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
24
24
  this._rowMetadataCache = new Map();
25
25
  this.REGEX_DATAUNIT_NAME = /dd:\/\/(.+?)\//;
26
26
  this._dataUnitObserver = async (action) => {
27
- const duState = await this.buildDataState(action.type);
27
+ const duState = this.buildDataState(action.type);
28
28
  this.dataState = duState;
29
29
  this.messagesBuilder.currentOperation = this.getMessageOperation();
30
30
  switch (action.type) {
@@ -136,22 +136,14 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
136
136
  async getRowMetadata(record) {
137
137
  return this.doGetRowMetadata(record);
138
138
  }
139
- async doGetRowMetadata(record) {
139
+ doGetRowMetadata(record) {
140
140
  const selectedRecord = this.dataUnit.getSelectedRecord();
141
141
  if (!record && !selectedRecord) {
142
142
  return;
143
143
  }
144
144
  const currentRecord = record || selectedRecord;
145
145
  const recordId = typeof currentRecord === 'string' ? currentRecord : currentRecord.__record__id__;
146
- let rowMetadata = this._metadataByRow.get(recordId);
147
- /*
148
- Nao fazemos cache de metadataByRow pra registros novos, pois a chave do mesmo
149
- muda ao ser salvo, por isso essa tratativa é necessária para que o dataState fique com metadados
150
- corretos nao confiando apenas no _metadataByRow
151
- */
152
- if (this.dataUnit.isNewRecord(recordId) && !rowMetadata) {
153
- rowMetadata = await this.handleLoadRowMetadata(selectedRecord);
154
- }
146
+ const rowMetadata = this._metadataByRow.get(recordId);
155
147
  if (!rowMetadata) {
156
148
  return;
157
149
  }
@@ -345,7 +337,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
345
337
  case Action.RECORDS_COPIED:
346
338
  return this.interceptRecordsCopied(action);
347
339
  case Action.DATA_CHANGED:
348
- await this.handleLoadRowMetadata(action.payload);
340
+ await this.handleLoadRowMetadata(action);
349
341
  return await this.interceptDataChange(action);
350
342
  case Action.CHANGING_DATA:
351
343
  return await this.interceptDataChange(action);
@@ -365,9 +357,8 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
365
357
  return action;
366
358
  }
367
359
  }
368
- async handleLoadRowMetadata(record) {
369
- if (!record)
370
- return;
360
+ async handleLoadRowMetadata(action) {
361
+ const record = action.type === Action.DATA_CHANGED ? action.payload : action.payload.changes[0].record;
371
362
  const keysPayload = Object.keys(record);
372
363
  const rmpField = keysPayload.find((field) => this._fieldsWithRmp.includes(field));
373
364
  if (rmpField) {
@@ -446,7 +437,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
446
437
  isAllowed(flag) {
447
438
  return this._permissions ? this._permissions.isSup || this._permissions[flag] : false;
448
439
  }
449
- async buildDataState(actionType) {
440
+ buildDataState(actionType) {
450
441
  var _a;
451
442
  const selectionInfo = this.dataUnit.getSelectionInfo();
452
443
  const isStartingInsertionMode = (this.dataUnit.hasDirtyRecords() || this.dataUnit.hasWaitingChanges()) && (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isEmpty());
@@ -454,7 +445,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
454
445
  let rowMetadata = (_a = this.dataState) === null || _a === void 0 ? void 0 : _a.rowMetadata;
455
446
  const allowedOverwrite = [Action.SELECTION_CHANGED, Action.EDITION_CANCELED, Action.NEXT_SELECTED, Action.PREVIOUS_SELECTED];
456
447
  if (selectedRecord && (!rowMetadata || allowedOverwrite.includes(actionType))) {
457
- rowMetadata = await this.doGetRowMetadata(selectedRecord);
448
+ rowMetadata = this.doGetRowMetadata(selectedRecord);
458
449
  }
459
450
  else if (rowMetadata) {
460
451
  rowMetadata.getProp = this.buildGetPropRowMetadata(rowMetadata);
@@ -476,20 +467,17 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
476
467
  });
477
468
  }
478
469
  async handleDataSaved(action) {
479
- var _a, _b, _c;
480
- 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);
470
+ const newRowMetadata = await this.handleLoadRowMetadata(action);
481
471
  if (newRowMetadata) {
482
472
  newRowMetadata.getProp = this.buildGetPropRowMetadata(newRowMetadata);
483
473
  }
484
474
  const recordId = action.payload.records[0].__record__id__;
485
475
  this._metadataByRow.set(recordId, newRowMetadata);
486
- this.dataState = await this.buildDataState();
487
- let saveOperation = action.payload.changes[0]._operation.toLowerCase();
488
- if (saveOperation == 'copy')
489
- saveOperation = OperationMap.CLONE;
490
- if (this.ignoreSaveMessage && ![OperationMap.CLONE, OperationMap.INSERT].includes(saveOperation)) {
476
+ this.dataState = this.buildDataState();
477
+ if (this.ignoreSaveMessage) {
491
478
  return;
492
479
  }
480
+ const saveOperation = action.payload.changes[0]._operation.toLowerCase();
493
481
  const msg = this.getMessage("snkDataUnit.saveInfo", action.payload.records[0], saveOperation);
494
482
  if (msg != undefined) {
495
483
  this.showSuccessMessage(msg);
@@ -582,7 +570,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
582
570
  const { records } = this.getMetadataByRow(this.dataUnit);
583
571
  this.dataUnit.records = records;
584
572
  }
585
- this.dataState = await this.buildDataState();
573
+ this.dataState = this.buildDataState();
586
574
  let resolver;
587
575
  while (resolver = this._onDataUnitResolve.pop()) {
588
576
  resolver(this.dataUnit);
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface SnkDistinctSearch extends Components.SnkDistinctSearch, HTMLElement {}
4
+ export const SnkDistinctSearch: {
5
+ prototype: SnkDistinctSearch;
6
+ new (): SnkDistinctSearch;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,163 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import { D as DataFetcher } from './DataFetcher.js';
3
+ import { ApplicationContext } from '@sankhyalabs/core';
4
+ import { d as defineCustomElement$3 } from './input-distinct-search2.js';
5
+ import { d as defineCustomElement$2 } from './search-modal2.js';
6
+
7
+ class DistinctSearchFetcher {
8
+ constructor() {
9
+ this.SERVICE = 'mge@Pesquisa.getSelectDistinct';
10
+ }
11
+ buildRequestBody(coluna, instancia) {
12
+ return {
13
+ selectDistinct: {
14
+ instancia,
15
+ coluna,
16
+ }
17
+ };
18
+ }
19
+ parseResponseBody(response) {
20
+ var _a, _b, _c;
21
+ 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 : [];
22
+ return ocorrencias;
23
+ }
24
+ async fetchItens(coluna, instancia) {
25
+ const requestBody = this.buildRequestBody(coluna, instancia);
26
+ const response = await DataFetcher.get().callServiceBroker(this.SERVICE, requestBody);
27
+ const parsedResponse = this.parseResponseBody(response);
28
+ return parsedResponse;
29
+ }
30
+ }
31
+
32
+ const snkDistinctSearchCss = ".sc-snk-distinct-search-h{display:block;width:100%}";
33
+
34
+ const SnkDistinctSearch$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
35
+ constructor() {
36
+ super();
37
+ this.__registerHost();
38
+ this.changeValue = createEvent(this, "changeValue", 7);
39
+ this.onIconClick = () => {
40
+ this._searchModalElement.value = this.value || "";
41
+ this._searchModalElement.openModal();
42
+ };
43
+ this.distinctItems = undefined;
44
+ this.value = "";
45
+ this.label = "";
46
+ this.configSearch = undefined;
47
+ this.maxItems = 100;
48
+ this.debounceTime = 300;
49
+ this.canShowError = false;
50
+ this.mode = 'regular';
51
+ this.restrict = undefined;
52
+ this.errorMessage = undefined;
53
+ }
54
+ /**
55
+ * Método para limpa o campo de entrada de pesquisa
56
+ */
57
+ clearInput() {
58
+ this._inputDistinctSearch.clearInput();
59
+ }
60
+ /**
61
+ * Retorna se o conteúdo é inválido.
62
+ */
63
+ isInvalid() {
64
+ return this._inputDistinctSearch.isInvalid();
65
+ }
66
+ /**
67
+ * Remove o foco do campo
68
+ */
69
+ setBlur() {
70
+ this._inputDistinctSearch.setBlur();
71
+ }
72
+ /**
73
+ * Aplica o foco do campo
74
+ */
75
+ setFocus() {
76
+ this._inputDistinctSearch.setFocus();
77
+ }
78
+ /**
79
+ * Método para fechar o modal
80
+ */
81
+ closeModal() {
82
+ this._searchModalElement.closeModal();
83
+ }
84
+ /**
85
+ * Método para abrir o modal
86
+ */
87
+ openModal() {
88
+ this._searchModalElement.openModal();
89
+ }
90
+ async componentWillLoad() {
91
+ await this.fetchDistinctItems();
92
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
93
+ }
94
+ async fetchDistinctItems() {
95
+ const distinctFetcher = new DistinctSearchFetcher();
96
+ const response = await distinctFetcher.fetchItens(this.configSearch.column, this.configSearch.instance);
97
+ this.distinctItems = [...response];
98
+ }
99
+ onChange(event) {
100
+ event.stopPropagation();
101
+ this.value = event.detail.value;
102
+ this._inputDistinctSearch.selectValue(event.detail.value, event.detail.isNewItem);
103
+ this.changeValue.emit(event.detail);
104
+ }
105
+ onPopupClose() {
106
+ this._inputDistinctSearch.setFocus();
107
+ }
108
+ getMessage(key) {
109
+ return this._application.messagesBuilder.getMessage(key, null);
110
+ }
111
+ renderEmptyMessage() {
112
+ return (h("span", { innerHTML: this.getMessage("snkDistinctSearch.emptyResult") }));
113
+ }
114
+ render() {
115
+ 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) })));
116
+ }
117
+ static get style() { return snkDistinctSearchCss; }
118
+ }, [2, "snk-distinct-search", {
119
+ "value": [1025],
120
+ "label": [1],
121
+ "configSearch": [16],
122
+ "maxItems": [2, "max-items"],
123
+ "debounceTime": [2, "debounce-time"],
124
+ "canShowError": [4, "can-show-error"],
125
+ "mode": [1],
126
+ "restrict": [1],
127
+ "errorMessage": [1, "error-message"],
128
+ "distinctItems": [32],
129
+ "clearInput": [64],
130
+ "isInvalid": [64],
131
+ "setBlur": [64],
132
+ "setFocus": [64],
133
+ "closeModal": [64],
134
+ "openModal": [64]
135
+ }]);
136
+ function defineCustomElement$1() {
137
+ if (typeof customElements === "undefined") {
138
+ return;
139
+ }
140
+ const components = ["snk-distinct-search", "input-distinct-search", "search-modal"];
141
+ components.forEach(tagName => { switch (tagName) {
142
+ case "snk-distinct-search":
143
+ if (!customElements.get(tagName)) {
144
+ customElements.define(tagName, SnkDistinctSearch$1);
145
+ }
146
+ break;
147
+ case "input-distinct-search":
148
+ if (!customElements.get(tagName)) {
149
+ defineCustomElement$3();
150
+ }
151
+ break;
152
+ case "search-modal":
153
+ if (!customElements.get(tagName)) {
154
+ defineCustomElement$2();
155
+ }
156
+ break;
157
+ } });
158
+ }
159
+
160
+ const SnkDistinctSearch = SnkDistinctSearch$1;
161
+ const defineCustomElement = defineCustomElement$1;
162
+
163
+ export { SnkDistinctSearch, defineCustomElement };
@@ -290,7 +290,6 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
290
290
  this.disablePersonalizedFilter = undefined;
291
291
  this.filterBarLegacyConfigName = undefined;
292
292
  this.autoLoad = undefined;
293
- this.afterFilterModalApply = undefined;
294
293
  this.allowDefault = undefined;
295
294
  this.scrollerLocked = false;
296
295
  this.showPersonalizedFilter = false;
@@ -644,9 +643,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
644
643
  */
645
644
  async showFilterModal() {
646
645
  const callbackOnApplyFilter = (filters) => {
647
- var _a;
648
646
  this.filterConfig = filters.map(this.normalizeItem).sort((a, b) => this._filtersComparator(a, b));
649
- (_a = this.afterFilterModalApply) === null || _a === void 0 ? void 0 : _a.call(this);
650
647
  };
651
648
  let filtersConfigCopy = ObjectUtils.copy(this.filterConfig);
652
649
  filtersConfigCopy = filtersConfigCopy.sort((itemA, itemB) => {
@@ -738,7 +735,6 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
738
735
  "disablePersonalizedFilter": [4, "disable-personalized-filter"],
739
736
  "filterBarLegacyConfigName": [1, "filter-bar-legacy-config-name"],
740
737
  "autoLoad": [4, "auto-load"],
741
- "afterFilterModalApply": [16],
742
738
  "allowDefault": [32],
743
739
  "scrollerLocked": [32],
744
740
  "showPersonalizedFilter": [32],
@@ -153,7 +153,6 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
153
153
  this.autoLoad = undefined;
154
154
  this.autoFocus = true;
155
155
  this.enableGridInsert = false;
156
- this.enableLockManger = false;
157
156
  }
158
157
  /**
159
158
  * Exibe a janela de configurações da grade.
@@ -241,17 +240,10 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
241
240
  this._grid.setFocus();
242
241
  }
243
242
  async handleClick(event) {
244
- var _a;
245
243
  if (this.hasToBlockEvent(event)) {
246
244
  event.preventDefault();
247
245
  event.stopPropagation();
248
- if (!await this._dataUnit.cancelEdition())
249
- return;
250
- const newEvent = new event.constructor(event.type, event);
251
- (_a = event.target) === null || _a === void 0 ? void 0 : _a.dispatchEvent(newEvent);
252
- }
253
- if (this._grid && !this._grid.contains(event.target)) {
254
- this._grid.stopEdit();
246
+ await this._dataUnit.cancelEdition();
255
247
  }
256
248
  }
257
249
  hasToBlockEvent(event) {
@@ -542,7 +534,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
542
534
  return undefined;
543
535
  }
544
536
  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 &&
545
- 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, enableLockManger: this.enableLockManger }, 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 }))));
537
+ 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 }))));
546
538
  }
547
539
  get _element() { return this; }
548
540
  static get watchers() { return {
@@ -574,7 +566,6 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
574
566
  "autoLoad": [4, "auto-load"],
575
567
  "autoFocus": [4, "auto-focus"],
576
568
  "enableGridInsert": [4, "enable-grid-insert"],
577
- "enableLockManger": [4, "enable-lock-manger"],
578
569
  "_dataUnit": [32],
579
570
  "_dataState": [32],
580
571
  "_gridConfig": [32],
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { UserInterface, StringUtils, ApplicationContext, ObjectUtils, DataType, JSUtils, FloatingManager, KeyboardManager, ElementIDUtils } from '@sankhyalabs/core';
2
+ import { UserInterface, StringUtils, ApplicationContext, ObjectUtils, DataType, JSUtils, FloatingManager, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { CSSVarsUtils } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { V as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants.js';
5
5
  import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
@@ -123,7 +123,6 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
123
123
  this.mode = SIMPLE_CRUD_MODE.SERVER;
124
124
  this.gridConfig = undefined;
125
125
  this.formConfig = undefined;
126
- this.enableLockManger = false;
127
126
  this._formFields = [];
128
127
  this._fieldsProps = new Map();
129
128
  this._enableContinuousInsert = true;
@@ -423,7 +422,6 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
423
422
  }
424
423
  componentDidLoad() {
425
424
  CSSVarsUtils.applyVarsGrid(this._element, this._grid);
426
- this.initKeyboardManager();
427
425
  }
428
426
  setCustomRenders() {
429
427
  if (!this._grid) {
@@ -809,49 +807,16 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
809
807
  return;
810
808
  this.goToView(VIEW_MODE.FORM);
811
809
  }
812
- async initKeyboardManager() {
813
- const keyboardManager = new KeyboardManager();
814
- if (keyboardManager) {
815
- const dataUnit = this.dataUnit || await this._snkDataUnit.getDataUnit();
816
- async function saveDataUnitHandlingFocus() {
817
- const element = document.activeElement;
818
- const isDocumentBody = (element == document.body);
819
- if (!isDocumentBody)
820
- element.blur();
821
- await dataUnit.saveData();
822
- if (!isDocumentBody && element.setFocus != undefined) {
823
- element.setFocus();
824
- return;
825
- }
826
- if (!isDocumentBody)
827
- element.focus();
828
- }
829
- keyboardManager
830
- .bind("F7", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados.", element: this._element })
831
- .bind("F8", dataUnit.addRecord.bind(dataUnit), { description: "Adiciona um novo registro.", element: this._element })
832
- .bind("F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
833
- .bind("Escape", () => {
834
- if (dataUnit.isDirty()) {
835
- dataUnit.cancelEdition();
836
- }
837
- }, {
838
- debounceTime: 1000,
839
- description: "Cancela uma ação.", element: this._element
840
- });
841
- }
842
- }
843
- renderTaskbarContent() {
844
- var _a;
845
- 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" })));
846
- }
847
810
  /* istanbul ignore next */
848
811
  render() {
812
+ var _a;
849
813
  if (this.dataUnit == undefined) {
850
814
  return;
851
815
  }
852
- 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, 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" }, 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)
816
+ 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" })));
817
+ 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)
853
818
  ? undefined
854
- : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManger: this.enableLockManger }, this.renderTaskbarContent(), h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, this.renderTaskbarContent(), 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() }))));
819
+ : 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() }))));
855
820
  }
856
821
  get _element() { return this; }
857
822
  static get watchers() { return {
@@ -870,7 +835,6 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
870
835
  "mode": [2],
871
836
  "gridConfig": [1040],
872
837
  "formConfig": [1040],
873
- "enableLockManger": [4, "enable-lock-manger"],
874
838
  "multipleSelection": [4, "multiple-selection"],
875
839
  "useCancelConfirm": [4, "use-cancel-confirm"],
876
840
  "pageSize": [2, "page-size"],
@@ -1,5 +1,5 @@
1
1
  import { h, proxyCustomElement, HTMLElement, createEvent, Host } from '@stencil/core/internal/client';
2
- import { Action, LockManager, LockManagerOperation, StringUtils, ApplicationContext, OVERFLOWED_CLASS_NAME, OverflowWatcher, OverflowDirection, ElementIDUtils } from '@sankhyalabs/core';
2
+ import { Action, StringUtils, ApplicationContext, OVERFLOWED_CLASS_NAME, OverflowWatcher, OverflowDirection, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { A as AuthorizationConfig } from './AuthorizationConfig.js';
4
4
  import { P as PresentationMode } from './ISave.js';
5
5
  import { s as store } from './index2.js';
@@ -273,44 +273,42 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
273
273
  return key ? (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, {}) : "";
274
274
  }
275
275
  elementClick(elem) {
276
- LockManager.whenResolve(this._element, LockManagerOperation.TASKBAR_CLICK).then(() => {
277
- if (this.dataUnit) {
278
- switch (elem) {
279
- case TaskbarElement.PREVIOUS:
280
- this.dataUnit.previousRecord();
281
- break;
282
- case TaskbarElement.NEXT:
283
- this.dataUnit.nextRecord();
284
- break;
285
- case TaskbarElement.REFRESH:
286
- this.dataUnit.loadData();
287
- break;
288
- case TaskbarElement.CLONE:
289
- this.dataUnit.copySelected();
290
- break;
291
- case TaskbarElement.REMOVE:
292
- this.dataUnit.removeSelectedRecords();
293
- break;
294
- case TaskbarElement.INSERT:
295
- this.dataUnit.addRecord();
296
- break;
297
- case TaskbarElement.CANCEL:
298
- this.dataUnit.cancelEdition();
299
- break;
300
- case TaskbarElement.SAVE:
301
- if (!this._isWaitingForSave) {
302
- this._isWaitingForSave = true;
303
- this.dataUnit.saveData()
304
- .finally(() => {
305
- this._isWaitingForSave = false;
306
- });
307
- }
308
- break;
309
- }
276
+ if (this.dataUnit) {
277
+ switch (elem) {
278
+ case TaskbarElement.PREVIOUS:
279
+ this.dataUnit.previousRecord();
280
+ break;
281
+ case TaskbarElement.NEXT:
282
+ this.dataUnit.nextRecord();
283
+ break;
284
+ case TaskbarElement.REFRESH:
285
+ this.dataUnit.loadData();
286
+ break;
287
+ case TaskbarElement.CLONE:
288
+ this.dataUnit.copySelected();
289
+ break;
290
+ case TaskbarElement.REMOVE:
291
+ this.dataUnit.removeSelectedRecords();
292
+ break;
293
+ case TaskbarElement.INSERT:
294
+ this.dataUnit.addRecord();
295
+ break;
296
+ case TaskbarElement.CANCEL:
297
+ this.dataUnit.cancelEdition();
298
+ break;
299
+ case TaskbarElement.SAVE:
300
+ if (!this._isWaitingForSave) {
301
+ this._isWaitingForSave = true;
302
+ this.dataUnit.saveData()
303
+ .finally(() => {
304
+ this._isWaitingForSave = false;
305
+ });
306
+ }
307
+ break;
310
308
  }
311
- if (this.isEnabled(elem))
312
- this.actionClick.emit(elem);
313
- });
309
+ }
310
+ if (this.isEnabled(elem))
311
+ this.actionClick.emit(elem);
314
312
  }
315
313
  isEnabled(elem) {
316
314
  if (!this.isAllowed(elem)) {
@@ -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;