@sankhyalabs/sankhyablocks 8.11.1 → 8.12.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/dist/cjs/{SnkFormConfigManager-906ee5f7.js → SnkFormConfigManager-467907f6.js} +21 -4
  2. package/dist/cjs/{SnkMessageBuilder-fbc33123.js → SnkMessageBuilder-7293d0ad.js} +9 -1
  3. package/dist/cjs/{taskbar-processor-bce3f499.js → field-search-ca27041a.js} +7 -0
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  6. package/dist/cjs/snk-application.cjs.entry.js +1 -1
  7. package/dist/cjs/snk-attach.cjs.entry.js +1 -1
  8. package/dist/cjs/snk-crud.cjs.entry.js +24 -0
  9. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  10. package/dist/cjs/{snk-data-unit-04d76538.js → snk-data-unit-1bc69073.js} +1 -1
  11. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  12. package/dist/cjs/snk-detail-view.cjs.entry.js +4 -4
  13. package/dist/cjs/snk-form-view.cjs.entry.js +14 -0
  14. package/dist/cjs/snk-form.cjs.entry.js +1 -1
  15. package/dist/cjs/snk-grid.cjs.entry.js +52 -6
  16. package/dist/cjs/{snk-guides-viewer-5b82abc4.js → snk-guides-viewer-f94f2113.js} +78 -13
  17. package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
  18. package/dist/cjs/snk-simple-crud.cjs.entry.js +133 -6
  19. package/dist/collection/components/snk-attach/snk-attach.js +1 -1
  20. package/dist/collection/components/snk-crud/snk-crud.js +25 -1
  21. package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +45 -0
  22. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +98 -11
  23. package/dist/collection/components/snk-form/SnkFormConfigManager.js +22 -5
  24. package/dist/collection/components/snk-grid/snk-grid.js +69 -4
  25. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +136 -6
  26. package/dist/collection/components/snk-taskbar/snk-taskbar.js +1 -0
  27. package/dist/collection/components/snk-taskbar/subcomponents/field-search.js +4 -0
  28. package/dist/collection/lib/message/SnkMessageBuilder.js +2 -0
  29. package/dist/collection/lib/message/resources/snk-crud.msg.js +1 -0
  30. package/dist/collection/lib/message/resources/snk-grid.msg.js +3 -1
  31. package/dist/collection/lib/message/resources/snk-simple-crud.msg.js +4 -0
  32. package/dist/components/SnkFormConfigManager.js +22 -5
  33. package/dist/components/SnkMessageBuilder.js +9 -1
  34. package/dist/components/{SnkMultiSelectionListDataSource.js → field-search.js} +6 -1
  35. package/dist/components/snk-attach2.js +1 -1
  36. package/dist/components/snk-crud.js +25 -1
  37. package/dist/components/snk-detail-view2.js +80 -12
  38. package/dist/components/snk-form-view2.js +15 -0
  39. package/dist/components/snk-grid2.js +52 -5
  40. package/dist/components/snk-simple-crud2.js +135 -6
  41. package/dist/esm/{SnkFormConfigManager-8aedc650.js → SnkFormConfigManager-587e9030.js} +22 -5
  42. package/dist/esm/{SnkMessageBuilder-f60c5443.js → SnkMessageBuilder-ca843d1b.js} +9 -1
  43. package/dist/esm/{taskbar-processor-94402e6e.js → field-search-c6938ee4.js} +7 -1
  44. package/dist/esm/loader.js +1 -1
  45. package/dist/esm/sankhyablocks.js +1 -1
  46. package/dist/esm/snk-application.entry.js +1 -1
  47. package/dist/esm/snk-attach.entry.js +1 -1
  48. package/dist/esm/snk-crud.entry.js +25 -1
  49. package/dist/esm/snk-data-exporter.entry.js +2 -2
  50. package/dist/esm/{snk-data-unit-ad5cf70c.js → snk-data-unit-6208ebf0.js} +1 -1
  51. package/dist/esm/snk-data-unit.entry.js +2 -2
  52. package/dist/esm/snk-detail-view.entry.js +4 -4
  53. package/dist/esm/snk-form-view.entry.js +14 -0
  54. package/dist/esm/snk-form.entry.js +1 -1
  55. package/dist/esm/snk-grid.entry.js +51 -5
  56. package/dist/esm/{snk-guides-viewer-f68589c4.js → snk-guides-viewer-86171cf4.js} +77 -12
  57. package/dist/esm/snk-guides-viewer.entry.js +3 -3
  58. package/dist/esm/snk-simple-crud.entry.js +133 -6
  59. package/dist/sankhyablocks/p-03dcc5ff.entry.js +1 -0
  60. package/dist/sankhyablocks/p-2028633c.js +1 -0
  61. package/dist/sankhyablocks/{p-c8b1ebf1.entry.js → p-257feef3.entry.js} +2 -2
  62. package/dist/sankhyablocks/{p-a2bd1825.entry.js → p-2e963486.entry.js} +1 -1
  63. package/dist/sankhyablocks/{p-cd2a285d.js → p-32f0935f.js} +1 -1
  64. package/dist/sankhyablocks/{p-dc7412bf.entry.js → p-35fe6e61.entry.js} +1 -1
  65. package/dist/sankhyablocks/p-3ecd72a4.js +1 -0
  66. package/dist/sankhyablocks/p-4775a293.entry.js +1 -0
  67. package/dist/sankhyablocks/{p-787edf13.entry.js → p-50734e76.entry.js} +1 -1
  68. package/dist/sankhyablocks/p-50e18dee.entry.js +1 -0
  69. package/dist/sankhyablocks/p-672380c5.js +1 -0
  70. package/dist/sankhyablocks/{p-5de077f3.entry.js → p-729f5f5b.entry.js} +1 -1
  71. package/dist/sankhyablocks/p-d2666ae0.entry.js +1 -0
  72. package/dist/sankhyablocks/p-de56f563.entry.js +1 -0
  73. package/dist/sankhyablocks/p-f5059aa8.entry.js +1 -0
  74. package/dist/sankhyablocks/p-ff6064e7.js +1 -0
  75. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  76. package/dist/types/components/snk-crud/snk-crud.d.ts +3 -0
  77. package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +10 -1
  78. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +25 -1
  79. package/dist/types/components/snk-form/SnkFormConfigManager.d.ts +6 -1
  80. package/dist/types/components/snk-grid/snk-grid.d.ts +7 -0
  81. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +23 -2
  82. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +2 -3
  83. package/dist/types/components/snk-taskbar/subcomponents/field-search.d.ts +2 -0
  84. package/dist/types/components.d.ts +20 -0
  85. package/dist/types/lib/message/resources/snk-simple-crud.msg.d.ts +2 -0
  86. package/package.json +1 -1
  87. package/dist/sankhyablocks/p-152f0949.entry.js +0 -1
  88. package/dist/sankhyablocks/p-16eaa54b.entry.js +0 -1
  89. package/dist/sankhyablocks/p-74545be0.js +0 -1
  90. package/dist/sankhyablocks/p-86b9846a.entry.js +0 -1
  91. package/dist/sankhyablocks/p-9be1dfd5.entry.js +0 -1
  92. package/dist/sankhyablocks/p-aa3b0d19.js +0 -1
  93. package/dist/sankhyablocks/p-bceed094.js +0 -1
  94. package/dist/sankhyablocks/p-c2beb95c.js +0 -1
  95. package/dist/sankhyablocks/p-c555075c.entry.js +0 -1
  96. package/dist/sankhyablocks/p-cea081b7.entry.js +0 -1
@@ -140,9 +140,14 @@ const snkCrudMessages = {
140
140
  update: "Alterar registro",
141
141
  clean: "{{ENTITY_NAME}}"
142
142
  },
143
+ findColumn: "Buscar campos",
143
144
  goBackTitle: "Voltar"
144
145
  };
145
146
 
147
+ const snkSimpleCrudMessages = {
148
+ findColumn: "Busca de colunas",
149
+ };
150
+
146
151
  const fileViewerMessages = {
147
152
  error: {
148
153
  title: "Erro na Exportação",
@@ -234,7 +239,9 @@ const snkConfiguratorMessages = {
234
239
  labelForm: "Formulário"
235
240
  };
236
241
 
237
- const snkGridMessages = {};
242
+ const snkGridMessages = {
243
+ findColumn: "Busca de colunas"
244
+ };
238
245
  const snkGridConfigMessages = {
239
246
  gridConfiguration: "Configuração da Grade",
240
247
  columnVisibilityOrder: "Defina visibilidade e ordem das colunas.",
@@ -510,6 +517,7 @@ class SnkMessageBuilder {
510
517
  snkExporter: snkExporterMessages,
511
518
  snkDataExporter: snkDataExporterMessages,
512
519
  snkCrud: snkCrudMessages,
520
+ snkSimpleCrud: snkSimpleCrudMessages,
513
521
  fileViewer: fileViewerMessages,
514
522
  snkFilterParamConfig: snkFilterParamConfigMessages,
515
523
  snkFilterFieldSearch: snkFilterFieldSearchMessages,
@@ -1,6 +1,7 @@
1
1
  import { UserInterface, DateUtils } from '@sankhyalabs/core';
2
2
  import InMemoryFilterColumnDataSource from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
3
3
  import { a as PreloadManager } from './dataunit-fetcher.js';
4
+ import { h } from '@stencil/core/internal/client';
4
5
 
5
6
  class TaskbarProcessor {
6
7
  constructor(defaultButtons) {
@@ -86,4 +87,8 @@ class SnkMultiSelectionListDataSource {
86
87
  }
87
88
  }
88
89
 
89
- export { SnkMultiSelectionListDataSource as S, TaskbarProcessor as T };
90
+ const buildFieldSearch = (action, optionLoader, onSelectField) => {
91
+ return h("ez-search", { class: "ez-actions-button--bottom-padding", canShowError: "false", showSelectedValue: "false", showOptionValue: "false", suppressEmptyOption: "true", label: action.label, value: action.value, optionLoader: optionLoader, onEzChange: (evt) => onSelectField(evt.detail), ignoreLimitCharsToSearch: true });
92
+ };
93
+
94
+ export { SnkMultiSelectionListDataSource as S, TaskbarProcessor as T, buildFieldSearch as b };
@@ -446,7 +446,7 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
446
446
  var _a, _b;
447
447
  if (!this.dataUnit)
448
448
  return null;
449
- return (h("main", { class: "snk-attach__main" }, h("header", { class: "snk-attach__header" }, h("snk-simple-bar", { onExit: this.handleBack, messagesBuilder: this.messagesBuilder }, h("div", { slot: "rightSlot" }, h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })))), h("div", { class: "snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column" }, h("div", { class: "ez-box__container" }, h("snk-simple-crud", { ref: (el) => this._crudElement = el, dataUnit: this.dataUnit, taskbarManager: buildTaskBarManager(), gridConfig: (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid, formConfig: (_b = this.crudConfig) === null || _b === void 0 ? void 0 : _b.form, useCancelConfirm: false, onActionClick: this.handleTaskbarClick }, h("div", { slot: "snkSimpleCrudHeader" }, h("div", { class: "ez-flex ez-flex--column" }, h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkAttach.title")), h("span", { class: "ez-text ez-text--medium ez-text--secondary" }, this.getMessage("snkAttach.description")))))))));
449
+ return (h("main", { class: "snk-attach__main" }, h("header", { class: "snk-attach__header" }, h("snk-simple-bar", { onExit: this.handleBack, messagesBuilder: this.messagesBuilder }, h("div", { slot: "rightSlot" }, h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })))), h("div", { class: "snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column" }, h("div", { class: "ez-box__container" }, h("snk-simple-crud", { ref: (el) => this._crudElement = el, dataUnit: this.dataUnit, taskbarManager: buildTaskBarManager(), gridConfig: (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid, formConfig: (_b = this.crudConfig) === null || _b === void 0 ? void 0 : _b.form, useCancelConfirm: false, onActionClick: this.handleTaskbarClick, messagesBuilder: this.messagesBuilder }, h("div", { slot: "snkSimpleCrudHeader" }, h("div", { class: "ez-flex ez-flex--column" }, h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkAttach.title")), h("span", { class: "ez-text ez-text--medium ez-text--secondary" }, this.getMessage("snkAttach.description")))))))));
450
450
  }
451
451
  static get watchers() { return {
452
452
  "registerKey": ["registerKeyWatcher"]
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
- import { StringUtils, ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
2
+ import { StringUtils, ElementIDUtils, ApplicationContext, JSUtils, FloatingManager } from '@sankhyalabs/core';
3
3
  import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
4
4
  import './DataFetcher.js';
5
5
  import './dataunit-fetcher.js';
@@ -49,6 +49,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
49
49
  this.configuratorSave = createEvent(this, "configuratorSave", 7);
50
50
  this.configuratorCancel = createEvent(this, "configuratorCancel", 7);
51
51
  this.formItemsReady = createEvent(this, "formItemsReady", 7);
52
+ this._keyDownHandler = (event) => this.keyDownListener(event);
52
53
  this._viewHistory = [];
53
54
  this._dataUnit = undefined;
54
55
  this._dataState = undefined;
@@ -196,6 +197,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
196
197
  }
197
198
  disconnectedCallback() {
198
199
  this.removeShortcuts();
200
+ window.removeEventListener("keydown", this._keyDownHandler);
199
201
  }
200
202
  async initKeyboardManager() {
201
203
  const keyboardManager = await this._application.getKeyboardManager();
@@ -274,6 +276,28 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
274
276
  }
275
277
  this.configuratorCancel.emit();
276
278
  }
279
+ keyDownListener(event) {
280
+ if (!event.ctrlKey || event.key == undefined || event.key.toUpperCase() !== "F") {
281
+ return;
282
+ }
283
+ if (this._element == undefined) {
284
+ return;
285
+ }
286
+ if (JSUtils.isHiddenElement(this._element)) {
287
+ return;
288
+ }
289
+ FloatingManager.closeAll();
290
+ if (this._currentViewMode === VIEW_MODE.GRID) {
291
+ this._snkGrid.findColumn();
292
+ }
293
+ else {
294
+ this._guidesViewer.findField();
295
+ }
296
+ event.preventDefault();
297
+ }
298
+ connectedCallback() {
299
+ window.addEventListener("keydown", this._keyDownHandler, { capture: true });
300
+ }
277
301
  render() {
278
302
  if (this._resourceID == undefined) {
279
303
  return;
@@ -12,7 +12,7 @@ import './filter-item-type.enum.js';
12
12
  import './form-config-fetcher.js';
13
13
  import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
14
14
  import { V as VIEW_MODE } from './constants.js';
15
- import { T as TaskbarProcessor } from './SnkMultiSelectionListDataSource.js';
15
+ import { T as TaskbarProcessor, b as buildFieldSearch } from './field-search.js';
16
16
  import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
17
17
  import { d as defineCustomElement$s } from './snk-attach2.js';
18
18
  import { d as defineCustomElement$r } from './snk-config-options2.js';
@@ -67,10 +67,12 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
67
67
  this.presentationMode = undefined;
68
68
  this.resourceID = undefined;
69
69
  this.detailTaskbarCustomContainerId = undefined;
70
+ this._hasToCreateFieldSearch = true;
70
71
  this._breadcrumbItems = [];
71
72
  this._guides = undefined;
72
73
  this._formEditorConfigManager = undefined;
73
74
  this._formEditorDataUnit = undefined;
75
+ this._fieldToGetFocus = undefined;
74
76
  }
75
77
  observeDataUnit() {
76
78
  this.loadGuides(true);
@@ -95,6 +97,23 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
95
97
  this._formEditorConfigManager = masterConfig ? this._configManager : this._currentDetail.formConfigManager;
96
98
  this._formEditorDataUnit = masterConfig ? this.dataUnit : this._currentDetail.dataUnit;
97
99
  }
100
+ /**
101
+ * Abre o localizador de campos
102
+ */
103
+ async findField() {
104
+ if (!this._moreOptions) {
105
+ return;
106
+ }
107
+ if (!(await this._moreOptions.isOpened())) {
108
+ this._moreOptions.showActions();
109
+ return;
110
+ }
111
+ if (this._fieldSearch) {
112
+ const realElement = this._fieldSearch["$elm$"];
113
+ realElement.value = null;
114
+ requestAnimationFrame(() => realElement.setFocus());
115
+ }
116
+ }
98
117
  exitViewer() {
99
118
  if (this.dataUnit.isDirty()) {
100
119
  this.dataUnit.cancelEdition({ after: () => this.exit.emit() });
@@ -218,25 +237,26 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
218
237
  static updateContentCard(formName, cardConfig, propertyChanged, configManager) {
219
238
  return configManager.saveCardState(formName, cardConfig, propertyChanged);
220
239
  }
221
- static buildFixedForms(formConfig, formMetadata, selectedForm, dataUnit, recordsValidator, levelPath) {
222
- const cardsState = formConfig === null || formConfig === void 0 ? void 0 : formConfig.cardsState;
240
+ static buildFixedForms(params) {
241
+ var _a;
242
+ const cardsState = (_a = params.formConfig) === null || _a === void 0 ? void 0 : _a.cardsState;
223
243
  if (cardsState == undefined) {
224
244
  return;
225
245
  }
226
246
  return (h(Fragment, null, Array.from(cardsState.entries())
227
- .filter(([formName, cardConfig]) => (cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed) && formName != selectedForm)
247
+ .filter(([formName, cardConfig]) => (cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed) && formName != params.selectedForm)
228
248
  .sort(([, cardConfigA], [, cardConfigB]) => {
229
249
  const indexA = (cardConfigA === null || cardConfigA === void 0 ? void 0 : cardConfigA.fixSequence) || 0;
230
250
  const indexB = (cardConfigB === null || cardConfigB === void 0 ? void 0 : cardConfigB.fixSequence) || 0;
231
251
  return indexA - indexB;
232
252
  })
233
253
  .map(([formName, cardConfig]) => {
234
- var _a;
235
- const sheet = formMetadata.getSheet(formName);
254
+ var _a, _b;
255
+ const sheet = params.formMetadata.getSheet(formName);
236
256
  if (sheet == undefined) {
237
257
  return;
238
258
  }
239
- return h("snk-form-view", { levelPath: levelPath, label: sheet.label, name: formName, fields: sheet.fields, formMetadata: formMetadata, dataUnit: dataUnit, recordsValidator: recordsValidator, contracted: (cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.presentation) === "CONTRACTED", fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_a = formConfig === null || formConfig === void 0 ? void 0 : formConfig.summary) === null || _a === void 0 ? void 0 : _a.get(formName), key: formName });
259
+ return h("snk-form-view", { levelPath: params.levelPath, label: sheet.label, name: formName, fields: sheet.fields, formMetadata: params.formMetadata, dataUnit: params.dataUnit, recordsValidator: params.recordsValidator, contracted: (cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.presentation) === "CONTRACTED", fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_b = (_a = params.formConfig) === null || _a === void 0 ? void 0 : _a.summary) === null || _b === void 0 ? void 0 : _b.get(formName), fieldToFocus: params.fieldToFocus, key: formName, onSnkRequestClearFieldToFocus: _ => { var _a; return (_a = params.onRequestClearFieldToFocus) === null || _a === void 0 ? void 0 : _a.call(params); } });
240
260
  })));
241
261
  }
242
262
  wrapDetail(levels, content) {
@@ -285,7 +305,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
285
305
  const sheet = this._masterFormMetadata.getSheet(cardId);
286
306
  if (sheet) {
287
307
  const cardConfig = (_c = (_b = this.masterFormConfig) === null || _b === void 0 ? void 0 : _b.cardsState) === null || _c === void 0 ? void 0 : _c.get(cardId);
288
- content = h("snk-form-view", { ref: ref => this._mainForm = ref, fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_e = (_d = this.masterFormConfig) === null || _d === void 0 ? void 0 : _d.summary) === null || _e === void 0 ? void 0 : _e.get(cardId), name: cardId, label: sheet.label, fields: sheet.fields, dataUnit: this.dataUnit, formMetadata: this._masterFormMetadata, recordsValidator: this.recordsValidator, key: guideId }, this.presentationMode == PresentationMode.SECONDARY && this.buildTaskBar());
308
+ content = h("snk-form-view", { ref: ref => this._mainForm = ref, fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_e = (_d = this.masterFormConfig) === null || _d === void 0 ? void 0 : _d.summary) === null || _e === void 0 ? void 0 : _e.get(cardId), name: cardId, label: sheet.label, fields: sheet.fields, dataUnit: this.dataUnit, formMetadata: this._masterFormMetadata, recordsValidator: this.recordsValidator, fieldToFocus: this._fieldToGetFocus, key: guideId, onSnkRequestClearFieldToFocus: _ => this.clearFieldToFocusHandler() }, this.presentationMode == PresentationMode.SECONDARY && this.buildTaskBar());
289
309
  }
290
310
  }
291
311
  return content;
@@ -304,6 +324,13 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
304
324
  });
305
325
  this.resetGuideBadge(currentItem);
306
326
  }
327
+ changeGuideHandler(guideName) {
328
+ var _a;
329
+ (_a = this._guideNavigator) === null || _a === void 0 ? void 0 : _a.selectGuide(guideName);
330
+ }
331
+ clearFieldToFocusHandler() {
332
+ this._fieldToGetFocus = undefined;
333
+ }
307
334
  resetGuideBadge(selectedGuide) {
308
335
  var _a;
309
336
  this._guides = [...(_a = this._guides) === null || _a === void 0 ? void 0 : _a.map(guide => {
@@ -369,11 +396,41 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
369
396
  }
370
397
  this._guideHasChanged = false;
371
398
  }
399
+ getFieldsSearch(actionButton, item) {
400
+ if (this._fieldSearch == undefined || this._hasToCreateFieldSearch) {
401
+ this._hasToCreateFieldSearch = false;
402
+ this._moreOptions = actionButton;
403
+ actionButton.addEventListener("ezPopoverOpen", () => this.findField());
404
+ actionButton.addEventListener("ezDisconnectedActionButtons", () => this._hasToCreateFieldSearch = true);
405
+ this._fieldSearch = buildFieldSearch(item, ({ argument }) => this.fieldsOptionLoader(argument), (option) => this.onSelectField(option, actionButton));
406
+ }
407
+ return this._fieldSearch;
408
+ }
409
+ fieldsOptionLoader(argument) {
410
+ return Promise.resolve(this._configManager.getFieldsList(this.dataUnit, argument)
411
+ .map(field => ({ value: field.name, label: field.label })));
412
+ }
413
+ onSelectField(option, actionButton) {
414
+ if (option == undefined) {
415
+ return;
416
+ }
417
+ this._fieldToGetFocus = option.value;
418
+ const fieldGuideName = this.getGuideName(option.value);
419
+ if (fieldGuideName !== this.selectedGuide.id) {
420
+ this.changeGuideHandler(fieldGuideName);
421
+ }
422
+ actionButton.hideActions();
423
+ }
372
424
  getActionsList() {
425
+ const hardList = [{
426
+ value: "",
427
+ label: this.getMessage("snkCrud.findColumn"),
428
+ itemBuilder: (actionButton, item) => this.getFieldsSearch(actionButton, item)
429
+ }];
373
430
  if (this.taskbarManager != undefined && this.taskbarManager.getMoreOptions != undefined) {
374
- return this.taskbarManager.getMoreOptions(this.getTaskBarId(), this.configName, this.dataState, this.actionsList);
431
+ return hardList.concat(this.taskbarManager.getMoreOptions(this.getTaskBarId(), this.configName, this.dataState, this.actionsList));
375
432
  }
376
- return this.actionsList;
433
+ return hardList.concat(this.actionsList);
377
434
  }
378
435
  buildTaskBar() {
379
436
  var _a;
@@ -440,7 +497,15 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
440
497
  h("div", { class: "ez-margin-top--extra-small" }, h("ez-breadcrumb", Object.assign({ items: this._breadcrumbItems, onSelectedItem: (evt) => this.onBreadcrumbClickHandler(evt === null || evt === void 0 ? void 0 : evt.detail) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("breadcrumb")}` }))))), this.presentationMode != PresentationMode.SECONDARY && this.buildTaskBar()), h("div", { class: "snk-guides-viewer__container" }, showGuides ?
441
498
  h("ez-guide-navigator", { ref: (ref) => this._guideNavigator = ref, class: "snk-guides-viewer__guide-navigator", items: this._guides, selectedId: this.selectedGuide ? this.selectedGuide.id : undefined, onEzSelectionChange: evt => this.updateSelectedGuideHandler(evt.detail) })
442
499
  :
443
- h("div", null), h("div", { class: "snk-guides-viewer__detail-container" }, SnkGuidesViewer.buildFixedForms(this.masterFormConfig, this._masterFormMetadata, (_b = this.selectedGuide) === null || _b === void 0 ? void 0 : _b.id, this.dataUnit, this.recordsValidator), this.getContent())), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this.getConfigViewMode(), onConfigSelected: (evt) => this.changeConfigViewMode(evt.detail), messagesBuilder: this.messagesBuilder, onOpenConfig: (evt) => this.openConfig(evt.detail), resourceID: this.resourceID })));
500
+ h("div", null), h("div", { class: "snk-guides-viewer__detail-container" }, SnkGuidesViewer.buildFixedForms({
501
+ formConfig: this.masterFormConfig,
502
+ formMetadata: this._masterFormMetadata,
503
+ selectedForm: (_b = this.selectedGuide) === null || _b === void 0 ? void 0 : _b.id,
504
+ dataUnit: this.dataUnit,
505
+ recordsValidator: this.recordsValidator,
506
+ fieldToFocus: this._fieldToGetFocus,
507
+ onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this)
508
+ }), this.getContent())), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this.getConfigViewMode(), onConfigSelected: (evt) => this.changeConfigViewMode(evt.detail), messagesBuilder: this.messagesBuilder, onOpenConfig: (evt) => this.openConfig(evt.detail), resourceID: this.resourceID })));
444
509
  }
445
510
  static get watchers() { return {
446
511
  "dataUnit": ["observeDataUnit"],
@@ -463,11 +528,14 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
463
528
  "presentationMode": [1, "presentation-mode"],
464
529
  "resourceID": [1, "resource-i-d"],
465
530
  "detailTaskbarCustomContainerId": [1, "detail-taskbar-custom-container-id"],
531
+ "_hasToCreateFieldSearch": [32],
466
532
  "_breadcrumbItems": [32],
467
533
  "_guides": [32],
468
534
  "_formEditorConfigManager": [32],
469
535
  "_formEditorDataUnit": [32],
470
- "showFormConfig": [64]
536
+ "_fieldToGetFocus": [32],
537
+ "showFormConfig": [64],
538
+ "findField": [64]
471
539
  }, [[2, "actionClick", "onActionClick"], [0, "snkContentCardChanged", "onContentCardChanged"]]]);
472
540
  function defineCustomElement$1() {
473
541
  if (typeof customElements === "undefined") {
@@ -10,6 +10,7 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
10
10
  super();
11
11
  this.__registerHost();
12
12
  this.snkContentCardChanged = createEvent(this, "snkContentCardChanged", 7);
13
+ this.snkRequestClearFieldToFocus = createEvent(this, "snkRequestClearFieldToFocus", 7);
13
14
  this.formItemsReady = createEvent(this, "formItemsReady", 7);
14
15
  this.levelPath = undefined;
15
16
  this.label = undefined;
@@ -23,6 +24,7 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
23
24
  this.canExpand = true;
24
25
  this.canFix = true;
25
26
  this.recordsValidator = undefined;
27
+ this.fieldToFocus = undefined;
26
28
  }
27
29
  async showUp() {
28
30
  if (this._formView) {
@@ -87,6 +89,18 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
87
89
  this._dataBinder.onDisconnectedCallback();
88
90
  }
89
91
  }
92
+ componentDidRender() {
93
+ if (this.fieldToFocus == undefined) {
94
+ return;
95
+ }
96
+ if (!this.fields.some(item => item.name === this.fieldToFocus)) {
97
+ return;
98
+ }
99
+ requestAnimationFrame(() => {
100
+ this._dataBinder.setFocus(this.fieldToFocus);
101
+ this.snkRequestClearFieldToFocus.emit();
102
+ });
103
+ }
90
104
  render() {
91
105
  return (h(Host, { class: "ez-box__container" }, h("div", { class: "summary-header ez-flex ez-size-width--full" }, h("div", { class: "ez-flex ez-text ez-title--primary ez-text--bold ez-flex--justify-start ez-flex--align-items-center ez-col--sd-9" }, this.levelPath ? h("span", { class: "level-path" }, this.levelPath + " /") : undefined, this.label), h("div", { class: "ez-flex ez-flex--justify-end ez-col--sd-3" }, this.canFix &&
92
106
  h("ez-button", { class: "ez-padding-left--medium", mode: "icon", size: "small", iconName: this.fixed ? "un-pin" : "push-pin", "data-element-id": ElementIDUtils.getInternalIDInfo("toggleFixed_ezFormCard"), onClick: () => this.changeFix(), title: this.fixed ? "Desafixar" : "Fixar" }), this.canExpand &&
@@ -110,6 +124,7 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
110
124
  "canExpand": [4, "can-expand"],
111
125
  "canFix": [4, "can-fix"],
112
126
  "recordsValidator": [16],
127
+ "fieldToFocus": [1, "field-to-focus"],
113
128
  "showUp": [64]
114
129
  }]);
115
130
  function defineCustomElement() {
@@ -1,10 +1,10 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Fragment } from '@stencil/core/internal/client';
2
- import { SortMode, ElementIDUtils, ApplicationContext, DataType } from '@sankhyalabs/core';
3
- import { UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
2
+ import { ElementIDUtils, ApplicationContext, DataType } from '@sankhyalabs/core';
3
+ import { SortMode, UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
4
4
  import { d as defineCustomElement$1, T as TaskbarElement } from './snk-taskbar2.js';
5
5
  import { C as ConfigStorage } from './ConfigStorage.js';
6
6
  import { P as PresentationMode } from './index2.js';
7
- import { T as TaskbarProcessor, S as SnkMultiSelectionListDataSource } from './SnkMultiSelectionListDataSource.js';
7
+ import { T as TaskbarProcessor, S as SnkMultiSelectionListDataSource, b as buildFieldSearch } from './field-search.js';
8
8
  import { s as store } from './index3.js';
9
9
  import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
10
10
  import { d as defineCustomElement$h } from './snk-actions-button2.js';
@@ -98,6 +98,22 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
98
98
  var _a;
99
99
  (_a = this._snkFilterBar) === null || _a === void 0 ? void 0 : _a.reload();
100
100
  }
101
+ /**
102
+ * Abre o localizador de colunas
103
+ */
104
+ async findColumn() {
105
+ if (!this._moreOptions) {
106
+ return;
107
+ }
108
+ if (!(await this._moreOptions.isOpened())) {
109
+ this._moreOptions.showActions();
110
+ }
111
+ if (this._columnSearch) {
112
+ const realElement = this._columnSearch["$elm$"];
113
+ realElement.value = null;
114
+ requestAnimationFrame(() => realElement.setFocus());
115
+ }
116
+ }
101
117
  /**
102
118
  * Retorna o elemento da filter-bar da grade.
103
119
  */
@@ -342,12 +358,42 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
342
358
  getPrimaryButton() {
343
359
  return this.presentationMode === PresentationMode.PRIMARY ? "INSERT" : "";
344
360
  }
361
+ getColumnSearch(actionButton, item) {
362
+ if (this._columnSearch != undefined) {
363
+ return this._columnSearch;
364
+ }
365
+ actionButton.addEventListener("ezPopoverOpen", () => {
366
+ if (this._columnSearch) {
367
+ const realElement = this._columnSearch["$elm$"];
368
+ realElement.value = null;
369
+ }
370
+ });
371
+ this._moreOptions = actionButton;
372
+ this._columnSearch = buildFieldSearch(item, ({ argument }) => new Promise(accept => {
373
+ this._grid.filterColumns(argument).then((columns) => {
374
+ accept(columns
375
+ .filter(column => !column.hidden)
376
+ .map(column => ({ label: column.label, value: column.name })));
377
+ });
378
+ }), (option) => {
379
+ if (option != undefined) {
380
+ this._grid.locateColumn(option.value);
381
+ actionButton.hideActions();
382
+ }
383
+ });
384
+ return this._columnSearch;
385
+ }
345
386
  getActionsList() {
387
+ const hardList = [{
388
+ value: "",
389
+ label: this.messagesBuilder.getMessage("snkGrid.findColumn", {}),
390
+ itemBuilder: (actionButton, item) => this.getColumnSearch(actionButton, item)
391
+ }];
346
392
  if (this.taskbarManager != undefined && this.taskbarManager.getMoreOptions != undefined) {
347
393
  const taskbarID = this.getTopTaskBarId();
348
- return this.taskbarManager.getMoreOptions(taskbarID, this.configName, this._dataState, this.actionsList);
394
+ return hardList.concat(this.taskbarManager.getMoreOptions(taskbarID, this.configName, this._dataState, this.actionsList));
349
395
  }
350
- return this.actionsList;
396
+ return hardList.concat(this.actionsList);
351
397
  }
352
398
  handleFilterConfigUpdated(filterConfig) {
353
399
  if (!filterConfig.length) {
@@ -396,6 +442,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
396
442
  "hideConfig": [64],
397
443
  "setConfig": [64],
398
444
  "reloadFilterBar": [64],
445
+ "findColumn": [64],
399
446
  "getFilterBar": [64]
400
447
  }]);
401
448
  function defineCustomElement() {
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { ObjectUtils, ApplicationContext, DataType, UserInterface } from '@sankhyalabs/core';
2
+ import { ObjectUtils, ApplicationContext, DataType, UserInterface, JSUtils, FloatingManager } from '@sankhyalabs/core';
3
3
  import { V as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants.js';
4
4
  import { T as TaskbarElement, d as defineCustomElement$1 } from './snk-taskbar2.js';
5
5
  import './DataFetcher.js';
@@ -10,7 +10,7 @@ import '@sankhyalabs/ezui/dist/collection/utils/constants';
10
10
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
11
11
  import './filter-item-type.enum.js';
12
12
  import './form-config-fetcher.js';
13
- import { S as SnkMultiSelectionListDataSource, T as TaskbarProcessor } from './SnkMultiSelectionListDataSource.js';
13
+ import { S as SnkMultiSelectionListDataSource, T as TaskbarProcessor, b as buildFieldSearch } from './field-search.js';
14
14
  import { d as defineCustomElement$4 } from './snk-data-exporter2.js';
15
15
  import { d as defineCustomElement$3 } from './snk-data-unit2.js';
16
16
  import { d as defineCustomElement$2 } from './snk-exporter-email-sender2.js';
@@ -25,9 +25,10 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
25
25
  this.dataUnitReady = createEvent(this, "dataUnitReady", 3);
26
26
  this.actionClick = createEvent(this, "actionClick", 7);
27
27
  this.formItemsReady = createEvent(this, "formItemsReady", 7);
28
- this.REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER"];
29
- this.REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER"];
28
+ this.REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
29
+ this.REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER", "MORE_OPTIONS"];
30
30
  this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
31
+ this._keyDownHandler = (event) => this.keyDownListener(event);
31
32
  this._taskbarProcessor = new TaskbarProcessor({
32
33
  "snkSimpleCrudTaskbar.form_regular": this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(TaskbarElement.GRID_MODE),
33
34
  "snkSimpleCrudTaskbar.grid_regular": this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(TaskbarElement.FORM_MODE),
@@ -37,11 +38,13 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
37
38
  });
38
39
  this._currentViewMode = VIEW_MODE.GRID;
39
40
  this._config = undefined;
41
+ this._fieldToGetFocus = undefined;
40
42
  this.dataState = undefined;
41
43
  this.dataUnit = undefined;
42
44
  this.mode = SIMPLE_CRUD_MODE.SERVER;
43
45
  this.gridConfig = undefined;
44
46
  this.formConfig = undefined;
47
+ this._formFields = [];
45
48
  this.multipleSelection = undefined;
46
49
  this.useCancelConfirm = true;
47
50
  this.taskbarManager = undefined;
@@ -189,11 +192,135 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
189
192
  this.dataUnit.clearSelection();
190
193
  }
191
194
  }
195
+ getColumnSearch(actionButton, item) {
196
+ if (this._columnSearch != undefined) {
197
+ return this._columnSearch;
198
+ }
199
+ actionButton.addEventListener("ezPopoverOpen", () => {
200
+ if (this._columnSearch) {
201
+ const realElement = this._columnSearch["$elm$"];
202
+ realElement.value = null;
203
+ }
204
+ });
205
+ this._moreOptions = actionButton;
206
+ this._columnSearch = buildFieldSearch(item, ({ argument }) => new Promise(accept => {
207
+ this._grid.filterColumns(argument).then((columns) => {
208
+ accept(columns
209
+ .filter(column => !column.hidden)
210
+ .map(column => ({ label: column.label, value: column.name })));
211
+ });
212
+ }), (option) => {
213
+ if (option != undefined) {
214
+ this._grid.locateColumn(option.value);
215
+ actionButton.hideActions();
216
+ }
217
+ });
218
+ return this._columnSearch;
219
+ }
220
+ onSelectField(option, actionButton) {
221
+ if (option == undefined) {
222
+ return;
223
+ }
224
+ this._fieldToGetFocus = option.value;
225
+ actionButton.hideActions();
226
+ }
227
+ getFieldSearch(actionButton, item) {
228
+ if (this._fieldSearch != undefined) {
229
+ return this._fieldSearch;
230
+ }
231
+ this._moreOptions = actionButton;
232
+ actionButton.addEventListener("ezPopoverOpen", () => this.findField());
233
+ this._fieldSearch = buildFieldSearch(item, ({ argument }) => this.fieldsOptionLoader(argument), (option) => this.onSelectField(option, actionButton));
234
+ return this._fieldSearch;
235
+ }
236
+ getFormFields() {
237
+ var _a, _b;
238
+ return (_b = (_a = this.formConfig) === null || _a === void 0 ? void 0 : _a.fields) !== null && _b !== void 0 ? _b : this._formFields;
239
+ }
240
+ handleFormSetFields(fields) {
241
+ this._formFields = fields !== null && fields !== void 0 ? fields : [];
242
+ }
243
+ fieldsOptionLoader(argument) {
244
+ const searchTerm = argument === null || argument === void 0 ? void 0 : argument.toLowerCase();
245
+ const allFields = this.getFormFields().map(field => { var _a; return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(field.name); });
246
+ const filteredFields = allFields.filter(field => {
247
+ var _a, _b;
248
+ return ((_a = field.name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTerm)) ||
249
+ ((_b = field.label) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchTerm));
250
+ });
251
+ const options = filteredFields.map(field => ({ value: field.name, label: field.label }));
252
+ return Promise.resolve(options);
253
+ }
254
+ getActionsList() {
255
+ var _a, _b;
256
+ return [{
257
+ value: "",
258
+ label: (_b = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.findColumn", undefined)) !== null && _b !== void 0 ? _b : "Buscar",
259
+ itemBuilder: (actionButton, item) => (this._currentViewMode === VIEW_MODE.GRID)
260
+ ? this.getColumnSearch(actionButton, item)
261
+ : this.getFieldSearch(actionButton, item)
262
+ }];
263
+ }
264
+ keyDownListener(event) {
265
+ if (!event.ctrlKey || event.key == undefined || event.key.toUpperCase() !== "F") {
266
+ return;
267
+ }
268
+ if (this._element == undefined) {
269
+ return;
270
+ }
271
+ if (JSUtils.isHiddenElement(this._element)) {
272
+ return;
273
+ }
274
+ FloatingManager.closeAll();
275
+ if (this._currentViewMode === VIEW_MODE.GRID) {
276
+ this.findColumn();
277
+ }
278
+ else {
279
+ this.findField();
280
+ }
281
+ event.preventDefault();
282
+ }
283
+ async findField() {
284
+ if (!this._moreOptions) {
285
+ return;
286
+ }
287
+ if (!(await this._moreOptions.isOpened())) {
288
+ this._moreOptions.showActions();
289
+ return;
290
+ }
291
+ if (this._fieldSearch) {
292
+ const realElement = this._fieldSearch["$elm$"];
293
+ realElement.value = null;
294
+ requestAnimationFrame(() => realElement.setFocus());
295
+ }
296
+ }
297
+ async findColumn() {
298
+ if (!this._moreOptions) {
299
+ return;
300
+ }
301
+ if (!(await this._moreOptions.isOpened())) {
302
+ this._moreOptions.showActions();
303
+ }
304
+ if (this._columnSearch) {
305
+ const realElement = this._columnSearch["$elm$"];
306
+ realElement.value = null;
307
+ requestAnimationFrame(() => realElement.setFocus());
308
+ }
309
+ }
310
+ clearFieldToFocusHandler() {
311
+ this._fieldToGetFocus = undefined;
312
+ }
313
+ connectedCallback() {
314
+ window.addEventListener("keydown", this._keyDownHandler, { capture: true });
315
+ }
316
+ disconnectedCallback() {
317
+ window.removeEventListener("keydown", this._keyDownHandler);
318
+ }
192
319
  render() {
193
320
  var _a;
194
- return (h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium ez-margin-bottom--large", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), columnfilterDataSource: this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
321
+ return (h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium ez-margin-bottom--large", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), columnfilterDataSource: this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
195
322
  ? undefined
196
- : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { dataUnit: this.dataUnit, config: this.formConfig }))))));
323
+ : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { dataUnit: this.dataUnit, config: this.formConfig, fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }))))));
197
324
  }
198
325
  get _element() { return this; }
199
326
  static get watchers() { return {
@@ -214,6 +341,8 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
214
341
  "useEnterLikeTab": [4, "use-enter-like-tab"],
215
342
  "_currentViewMode": [32],
216
343
  "_config": [32],
344
+ "_fieldToGetFocus": [32],
345
+ "_formFields": [32],
217
346
  "goToView": [64],
218
347
  "setMetadata": [64],
219
348
  "setRecords": [64],