@sankhyalabs/sankhyablocks 8.16.0-dev.110 → 8.16.0-dev.111

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 (111) hide show
  1. package/dist/cjs/{SnkMessageBuilder-aecd7c18.js → SnkMessageBuilder-9deeae08.js} +4 -3
  2. package/dist/cjs/index-f9e81701.js +2 -2
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  5. package/dist/cjs/{snk-actions-button_7.cjs.entry.js → snk-actions-button_8.cjs.entry.js} +61 -0
  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 +2 -26
  9. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  10. package/dist/cjs/{snk-data-unit-ebfdb9ba.js → snk-data-unit-57916de4.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 +57 -5
  13. package/dist/cjs/snk-form-view.cjs.entry.js +19 -7
  14. package/dist/cjs/snk-grid.cjs.entry.js +22 -23
  15. package/dist/cjs/{snk-guides-viewer-fd39f437.js → snk-guides-viewer-d33379cd.js} +36 -24
  16. package/dist/cjs/snk-guides-viewer.cjs.entry.js +4 -3
  17. package/dist/cjs/snk-simple-crud.cjs.entry.js +73 -85
  18. package/dist/cjs/snk-taskbar.cjs.entry.js +7 -3
  19. package/dist/cjs/{taskbar-elements-02379452.js → taskbar-elements-6f4e06af.js} +8 -0
  20. package/dist/cjs/{field-search-68e34bf4.js → taskbar-processor-2fba34a8.js} +0 -35
  21. package/dist/collection/collection-manifest.json +1 -0
  22. package/dist/collection/components/snk-crud/snk-crud.js +2 -26
  23. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +58 -4
  24. package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +54 -7
  25. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +36 -40
  26. package/dist/collection/components/snk-grid/snk-grid.js +36 -36
  27. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +75 -85
  28. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +8 -0
  29. package/dist/collection/components/snk-taskbar/elements/taskbar-split-button/taskbar-split-button.css +0 -0
  30. package/dist/collection/components/snk-taskbar/elements/taskbar-split-button/taskbar-split-button.js +220 -0
  31. package/dist/collection/components/snk-taskbar/snk-taskbar.js +28 -2
  32. package/dist/collection/lib/message/resources/snk-crud.msg.js +1 -1
  33. package/dist/collection/lib/message/resources/snk-grid.msg.js +1 -1
  34. package/dist/collection/lib/message/resources/snk-simple-crud.msg.js +2 -1
  35. package/dist/components/ContinuousInsertUtils.js +2 -33
  36. package/dist/components/SnkMessageBuilder.js +4 -3
  37. package/dist/components/index.d.ts +1 -0
  38. package/dist/components/index.js +1 -0
  39. package/dist/components/snk-attach2.js +34 -28
  40. package/dist/components/snk-crud.js +75 -93
  41. package/dist/components/snk-detail-view2.js +193 -117
  42. package/dist/components/snk-form-view2.js +22 -8
  43. package/dist/components/snk-grid2.js +62 -57
  44. package/dist/components/snk-simple-crud2.js +104 -109
  45. package/dist/components/snk-taskbar2.js +29 -10
  46. package/dist/components/taskbar-split-button.d.ts +11 -0
  47. package/dist/components/taskbar-split-button.js +6 -0
  48. package/dist/components/taskbar-split-button2.js +87 -0
  49. package/dist/esm/{SnkMessageBuilder-12f5fe1a.js → SnkMessageBuilder-2dbd8fa2.js} +4 -3
  50. package/dist/esm/index-a7d3d3f1.js +2 -2
  51. package/dist/esm/loader.js +1 -1
  52. package/dist/esm/sankhyablocks.js +1 -1
  53. package/dist/esm/{snk-actions-button_7.entry.js → snk-actions-button_8.entry.js} +61 -1
  54. package/dist/esm/snk-application.entry.js +1 -1
  55. package/dist/esm/snk-attach.entry.js +1 -1
  56. package/dist/esm/snk-crud.entry.js +3 -27
  57. package/dist/esm/snk-data-exporter.entry.js +2 -2
  58. package/dist/esm/{snk-data-unit-03654813.js → snk-data-unit-65c9dd1a.js} +1 -1
  59. package/dist/esm/snk-data-unit.entry.js +2 -2
  60. package/dist/esm/snk-detail-view.entry.js +59 -7
  61. package/dist/esm/snk-form-view.entry.js +19 -7
  62. package/dist/esm/snk-grid.entry.js +20 -21
  63. package/dist/esm/{snk-guides-viewer-75e06feb.js → snk-guides-viewer-72953334.js} +37 -25
  64. package/dist/esm/snk-guides-viewer.entry.js +4 -3
  65. package/dist/esm/snk-simple-crud.entry.js +74 -86
  66. package/dist/esm/snk-taskbar.entry.js +7 -3
  67. package/dist/esm/{taskbar-elements-c62b6c66.js → taskbar-elements-f2cb4922.js} +8 -0
  68. package/dist/esm/{field-search-f8b1d91e.js → taskbar-processor-3436124c.js} +1 -34
  69. package/dist/sankhyablocks/p-0fadb620.js +1 -0
  70. package/dist/sankhyablocks/p-1a0caadb.js +1 -0
  71. package/dist/sankhyablocks/{p-2c08fa3e.entry.js → p-1bdffb17.entry.js} +1 -1
  72. package/dist/sankhyablocks/p-1f80174b.entry.js +1 -0
  73. package/dist/sankhyablocks/p-24a0dbd2.entry.js +1 -0
  74. package/dist/sankhyablocks/p-2f7e2251.entry.js +1 -0
  75. package/dist/sankhyablocks/p-3372178e.entry.js +1 -0
  76. package/dist/sankhyablocks/p-4689c2e6.js +1 -0
  77. package/dist/sankhyablocks/{p-271c86d3.entry.js → p-52d10014.entry.js} +1 -1
  78. package/dist/sankhyablocks/p-6a03b190.entry.js +1 -0
  79. package/dist/sankhyablocks/{p-ad07f0c5.entry.js → p-7beeabc1.entry.js} +1 -1
  80. package/dist/sankhyablocks/{p-4a93daef.entry.js → p-a4ebeec4.entry.js} +1 -1
  81. package/dist/sankhyablocks/p-bc101064.entry.js +1 -0
  82. package/dist/sankhyablocks/{p-f4d5bb7f.js → p-c9675d64.js} +1 -1
  83. package/dist/sankhyablocks/{p-4e861843.entry.js → p-ce94e6c4.entry.js} +1 -1
  84. package/dist/sankhyablocks/p-d07b18a4.js +1 -0
  85. package/dist/sankhyablocks/{p-6a0c8ce0.entry.js → p-ddf93f36.entry.js} +1 -1
  86. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  87. package/dist/types/components/snk-crud/snk-crud.d.ts +0 -3
  88. package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +12 -0
  89. package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +11 -1
  90. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +6 -6
  91. package/dist/types/components/snk-grid/snk-grid.d.ts +7 -5
  92. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +10 -10
  93. package/dist/types/components/snk-taskbar/elements/taskbar-split-button/taskbar-split-button.d.ts +44 -0
  94. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +5 -0
  95. package/dist/types/components.d.ts +107 -8
  96. package/package.json +1 -1
  97. package/react/components.d.ts +1 -0
  98. package/react/components.js +1 -0
  99. package/react/components.js.map +1 -1
  100. package/dist/collection/components/snk-taskbar/subcomponents/field-search.js +0 -31
  101. package/dist/sankhyablocks/p-1a51dfde.entry.js +0 -1
  102. package/dist/sankhyablocks/p-1db45d26.entry.js +0 -1
  103. package/dist/sankhyablocks/p-23736d75.js +0 -1
  104. package/dist/sankhyablocks/p-2d6df7e7.entry.js +0 -1
  105. package/dist/sankhyablocks/p-41da5310.js +0 -1
  106. package/dist/sankhyablocks/p-65be98c5.entry.js +0 -1
  107. package/dist/sankhyablocks/p-80f8c22c.js +0 -1
  108. package/dist/sankhyablocks/p-cc8c3bca.entry.js +0 -1
  109. package/dist/sankhyablocks/p-cf1f25ed.entry.js +0 -1
  110. package/dist/sankhyablocks/p-fb0f0087.js +0 -1
  111. package/dist/types/components/snk-taskbar/subcomponents/field-search.d.ts +0 -4
@@ -1,4 +1,4 @@
1
- import { Action as DUAction, ApplicationContext, DataType, ElementIDUtils, FloatingManager, JSUtils, KeyboardManager, ObjectUtils, StringUtils, UserInterface, } from '@sankhyalabs/core';
1
+ import { Action as DUAction, ApplicationContext, DataType, ElementIDUtils, KeyboardManager, ObjectUtils, StringUtils, UserInterface, } from '@sankhyalabs/core';
2
2
  import { CSSVarsUtils } from '@sankhyalabs/ezui/dist/collection/utils';
3
3
  import { h } from '@stencil/core';
4
4
  import { SIMPLE_CRUD_MODE, VIEW_MODE } from '../../lib/utils/constants';
@@ -7,7 +7,6 @@ import { CrudUtils, FormConfigFetcher, PresentationMode } from '../../lib';
7
7
  import TaskbarProcessor from '../snk-taskbar/processor/taskbar-processor';
8
8
  import InMemoryLoader from '../../lib/dataUnit/InMemoryLoader';
9
9
  import SnkMultiSelectionListDataSource from '../snk-grid/filtercolumn/SnkMultiSelectionListDataSource';
10
- import { buildFieldSearch, openFieldSearch } from '../snk-taskbar/subcomponents/field-search';
11
10
  import { ConfigStorage } from '../../lib/configs/ConfigStorage';
12
11
  import { SnkFormConfigManager } from '../snk-form-config/SnkFormConfigManager';
13
12
  import { REGULAR_DEFAULT_BTNS, REGULAR_SELECTED_BTNS } from './regular-buttons';
@@ -15,13 +14,14 @@ import RmPrecisionCustomValueFormatter from '../../lib/DefaultCustomFormatters/R
15
14
  import ClientSideExporterProvider from '../snk-data-exporter/providers/ClientSideExporterProvider';
16
15
  import store from '../../lib/store';
17
16
  import { ContinuousInsertUtils } from '../../lib/utils/ContinuousInsertUtils';
17
+ import { buildFieldSearch, LABEL_SEARCH_COLUMN, LABEL_SEARCH_FIELD } from '@sankhyalabs/ezui/dist/collection/utils';
18
18
  export class SnkSimpleCrud {
19
19
  constructor() {
20
20
  this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
21
- this._keyDownHandler = (event) => this.keyDownListener(event);
22
21
  this._formConfigFetcher = new FormConfigFetcher();
23
22
  this._customEditors = new Map();
24
23
  this._customRenders = new Map();
24
+ this._container = undefined;
25
25
  this._showPopUpGridConfig = false;
26
26
  this._currentViewMode = VIEW_MODE.GRID;
27
27
  this._config = undefined;
@@ -48,7 +48,7 @@ export class SnkSimpleCrud {
48
48
  this.useEnterLikeTab = false;
49
49
  this.actionsList = undefined;
50
50
  this.configName = undefined;
51
- this.showConfiguratorButtons = undefined;
51
+ this.showConfiguratorButtons = false;
52
52
  this.gridLegacyConfigName = undefined;
53
53
  this.formLegacyConfigName = undefined;
54
54
  this.ignoreReadOnlyFormFields = false;
@@ -173,6 +173,12 @@ export class SnkSimpleCrud {
173
173
  this.dataUnit.isMultipleEdition = false;
174
174
  this._viewStack.show(view);
175
175
  }
176
+ if (view === VIEW_MODE.GRID) {
177
+ requestAnimationFrame(() => this.focusToGrid());
178
+ }
179
+ if (view === VIEW_MODE.FORM) {
180
+ requestAnimationFrame(() => this.focusToForm());
181
+ }
176
182
  }
177
183
  actionClickListener(evt) {
178
184
  this.handleTaskbarAction(evt.detail);
@@ -370,6 +376,10 @@ export class SnkSimpleCrud {
370
376
  }
371
377
  }
372
378
  }
379
+ disconnectedCallback() {
380
+ var _a;
381
+ (_a = this._keyboardManager) === null || _a === void 0 ? void 0 : _a.unbindAllShortcutKeys();
382
+ }
373
383
  setCustomRenders() {
374
384
  if (!this._grid) {
375
385
  return;
@@ -547,40 +557,18 @@ export class SnkSimpleCrud {
547
557
  }
548
558
  this.configuratorCancel.emit();
549
559
  }
550
- getColumnSearch(actionButton, item) {
551
- if (this._columnSearch != undefined) {
552
- return this._columnSearch;
553
- }
554
- this._moreOptions = actionButton;
555
- this._columnSearch = buildFieldSearch(item, ({ argument }) => new Promise(accept => {
556
- this._grid.filterColumns(argument).then((columns) => {
557
- accept(columns
558
- .filter(column => !column.hidden)
559
- .map(column => ({ label: column.label, value: column.name })));
560
- });
561
- }), (option) => {
562
- var _a;
563
- if (option != undefined) {
564
- this._grid.locateColumn(option.value);
565
- (_a = actionButton["hideActions"]) === null || _a === void 0 ? void 0 : _a.call(actionButton);
566
- }
567
- });
568
- return this._columnSearch;
569
- }
570
- onSelectField(option, actionButton) {
560
+ onSelectField(option) {
571
561
  if (option == undefined) {
572
562
  return;
573
563
  }
574
564
  this._fieldToGetFocus = option.value;
575
- actionButton.hideActions();
576
565
  }
577
- getFieldSearch(actionButton, item) {
566
+ getFieldSearch(splitButton, item) {
578
567
  if (this._fieldSearch != undefined) {
579
568
  return this._fieldSearch;
580
569
  }
581
- this._moreOptions = actionButton;
582
- actionButton.addEventListener("ezPopoverOpen", () => this.findField());
583
- this._fieldSearch = buildFieldSearch(item, ({ argument }) => this.fieldsOptionLoader(argument), (option) => this.onSelectField(option, actionButton));
570
+ this._splitButtonForm = splitButton;
571
+ this._fieldSearch = buildFieldSearch(item, ({ argument }) => this.fieldsOptionLoader(argument), (option) => this.onSelectField(option));
584
572
  return this._fieldSearch;
585
573
  }
586
574
  getFormFields() {
@@ -606,17 +594,26 @@ export class SnkSimpleCrud {
606
594
  isGridInsertActive() {
607
595
  return this.enableGridInsert && this.dataUnit.hasNewRecord();
608
596
  }
597
+ getColumnSearch(splitButton, item) {
598
+ if (this._columnSearch != undefined) {
599
+ return this._columnSearch;
600
+ }
601
+ this._splitButton = splitButton;
602
+ this._columnSearch = buildFieldSearch(item, ({ argument }) => new Promise(accept => {
603
+ this._grid.filterColumns(argument).then((columns) => {
604
+ accept(columns
605
+ .filter(column => !column.hidden)
606
+ .map(column => ({ label: column.label, value: column.name })));
607
+ });
608
+ }), (option) => {
609
+ if (option != undefined) {
610
+ this._grid.locateColumn(option.value);
611
+ }
612
+ });
613
+ return this._columnSearch;
614
+ }
609
615
  getActionsList() {
610
- var _a, _b;
611
- const hardList = [{
612
- value: StringUtils.generateUUID(),
613
- label: (_b = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.findColumn", undefined)) !== null && _b !== void 0 ? _b : "Buscar",
614
- disableCloseOnSelect: true,
615
- eagerInitialize: true,
616
- itemBuilder: (actionButton, item) => (this._currentViewMode === VIEW_MODE.GRID)
617
- ? this.getColumnSearch(actionButton, item)
618
- : this.getFieldSearch(actionButton, item)
619
- }];
616
+ const hardList = [];
620
617
  if (this.enableGridInsert) {
621
618
  hardList.push(this._continuousInsertUtils.actionContinuousInsert(this.enableContinuousInsert, () => {
622
619
  this.enableContinuousInsert = !this.enableContinuousInsert;
@@ -629,8 +626,28 @@ export class SnkSimpleCrud {
629
626
  const taskbarID = this.getTopTaskBarId();
630
627
  return hardList.concat(this.taskbarManager.getMoreOptions(taskbarID, this.configName, this.dataState, this.actionsList));
631
628
  }
632
- if (this.actionsList)
633
- return hardList.concat(this.actionsList);
629
+ return hardList.concat(this.actionsList);
630
+ }
631
+ getSettingsListGrid() {
632
+ var _a, _b;
633
+ const hardList = [{
634
+ value: StringUtils.generateUUID(),
635
+ label: (_b = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.findColumn", {})) !== null && _b !== void 0 ? _b : LABEL_SEARCH_COLUMN,
636
+ disableCloseOnSelect: true,
637
+ eagerInitialize: true,
638
+ itemBuilder: (splitButton, item) => this.getColumnSearch(splitButton, item)
639
+ }];
640
+ return hardList;
641
+ }
642
+ getSettingsListForm() {
643
+ var _a, _b;
644
+ const hardList = [{
645
+ value: StringUtils.generateUUID(),
646
+ label: (_b = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.findFields", {})) !== null && _b !== void 0 ? _b : LABEL_SEARCH_FIELD,
647
+ disableCloseOnSelect: true,
648
+ eagerInitialize: true,
649
+ itemBuilder: (splitButton, item) => this.getFieldSearch(splitButton, item)
650
+ }];
634
651
  return hardList;
635
652
  }
636
653
  getTopTaskBarId() {
@@ -638,45 +655,9 @@ export class SnkSimpleCrud {
638
655
  return ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? `snkGridTopTaskbar.finish_edition${PresentationMode.PRIMARY}` :
639
656
  `snkGridTopTaskbar.regular${PresentationMode.PRIMARY}`;
640
657
  }
641
- async keyDownListener(event) {
642
- if (!event.ctrlKey || event.key == undefined || event.key.toUpperCase() !== "F") {
643
- return;
644
- }
645
- if (this._element == undefined) {
646
- return;
647
- }
648
- if (JSUtils.isHiddenElement(this._element)) {
649
- return;
650
- }
651
- FloatingManager.closeAll();
652
- if (this._currentViewMode === VIEW_MODE.GRID) {
653
- await this.findColumn();
654
- }
655
- else {
656
- await this.findField();
657
- }
658
- event.preventDefault();
659
- }
660
- async findField() {
661
- await this.openSeach(this._fieldSearch);
662
- }
663
- async findColumn() {
664
- await this.openSeach(this._columnSearch);
665
- }
666
- async openSeach(fieldSearch) {
667
- await openFieldSearch(this._moreOptions, fieldSearch);
668
- }
669
658
  clearFieldToFocusHandler() {
670
659
  this._fieldToGetFocus = undefined;
671
660
  }
672
- connectedCallback() {
673
- window.addEventListener("keydown", this._keyDownHandler, { capture: true });
674
- }
675
- disconnectedCallback() {
676
- var _a;
677
- window.removeEventListener("keydown", this._keyDownHandler);
678
- (_a = this._keyboardManager) === null || _a === void 0 ? void 0 : _a.unbindAllShortcutKeys();
679
- }
680
661
  gridConfigChangeHandler(evt) {
681
662
  evt.stopPropagation();
682
663
  if (!this.configName)
@@ -772,16 +753,23 @@ export class SnkSimpleCrud {
772
753
  }
773
754
  }, {
774
755
  debounceTime: 1000,
775
- description: "Cancela uma ação.",
776
- element: this._element
756
+ description: "Cancela uma ação.", element: this._element
777
757
  });
778
758
  }
779
759
  async handleFormConfigSaved() {
780
760
  await this.loadFormConfig(true, true);
781
761
  }
782
- renderTaskbarContent() {
762
+ focusToGrid() {
763
+ const gridElement = this._grid;
764
+ gridElement.focus();
765
+ }
766
+ focusToForm() {
767
+ const formElement = this._form;
768
+ formElement.focus();
769
+ }
770
+ renderTaskbarContent(layout) {
783
771
  var _a;
784
- return (h("snk-taskbar", { class: this._currentViewMode === VIEW_MODE.FORM && `ez-box ${this.outlineMode ? 'ez-box--outline' : 'ez-box--shadow-xsmall'} 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" })));
772
+ return (h("snk-taskbar", { class: `ez-box--no-outline ez-box ${this._currentViewMode === VIEW_MODE.FORM ? (this.outlineMode ? 'ez-box--outline' : 'ez-box--shadow-xsmall') + ' 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(), actionsSettingsList: layout === VIEW_MODE.GRID ? this.getSettingsListGrid() : this.getSettingsListForm(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: PresentationMode.SECONDARY, tabindex: "0" }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })));
785
773
  }
786
774
  /* istanbul ignore next */
787
775
  render() {
@@ -789,9 +777,9 @@ export class SnkSimpleCrud {
789
777
  if (this.dataUnit == undefined) {
790
778
  return;
791
779
  }
792
- 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), 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 ${this.outlineMode ? 'ez-box--outline' : '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)
780
+ 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), 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--no-outline ${this.outlineMode ? 'ez-box--outline' : 'ez-box--shadow'} simple-crud__container-section`, ref: (ref) => this._container = ref, tabindex: "0" }, 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 ez-box--no-outline", 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)
793
781
  ? undefined
794
- : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this.enableContinuousInsert, enableLockManagerTaskbarClick: this.enableLockManagerTaskbarClick, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, outlineMode: this.outlineMode }, 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`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), h("snk-simple-form-config", { ref: (ref) => this._snkSimpleFormConfig = ref, dataUnit: this.dataUnit, onSnkConfigSaved: this.handleFormConfigSaved.bind(this), configName: (_a = this.formLegacyConfigName) !== null && _a !== void 0 ? _a : this.configName })), 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, layoutFormConfig: this.layoutFormConfig })), 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() }))));
782
+ : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this.enableContinuousInsert, enableLockManagerTaskbarClick: this.enableLockManagerTaskbarClick, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, outlineMode: this.outlineMode, tabindex: "0" }, this.renderTaskbarContent(VIEW_MODE.GRID), h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, this.renderTaskbarContent(VIEW_MODE.FORM), h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ez-box--no-outline`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), elementFocusSearchField: this._container, tabindex: "0" }), h("snk-simple-form-config", { ref: (ref) => this._snkSimpleFormConfig = ref, dataUnit: this.dataUnit, onSnkConfigSaved: this.handleFormConfigSaved.bind(this), configName: (_a = this.formLegacyConfigName) !== null && _a !== void 0 ? _a : this.configName })), 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, layoutFormConfig: this.layoutFormConfig })), 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() }))));
795
783
  }
796
784
  static get is() { return "snk-simple-crud"; }
797
785
  static get encapsulation() { return "scoped"; }
@@ -1182,7 +1170,8 @@ export class SnkSimpleCrud {
1182
1170
  "text": "Usado para exibir os bot\u00F5es de a\u00E7\u00E3o do snk-configurator."
1183
1171
  },
1184
1172
  "attribute": "show-configurator-buttons",
1185
- "reflect": false
1173
+ "reflect": false,
1174
+ "defaultValue": "false"
1186
1175
  },
1187
1176
  "gridLegacyConfigName": {
1188
1177
  "type": "string",
@@ -1346,6 +1335,7 @@ export class SnkSimpleCrud {
1346
1335
  }
1347
1336
  static get states() {
1348
1337
  return {
1338
+ "_container": {},
1349
1339
  "_showPopUpGridConfig": {},
1350
1340
  "_currentViewMode": {},
1351
1341
  "_config": {},
@@ -87,6 +87,9 @@ export const buildElem = (element, className, dataElementId, getTitle, action, i
87
87
  case TaskbarElement.FORM_MODE:
88
88
  return iconButton("list", element, className, dataElementId, title, action, isEnabled);
89
89
  case TaskbarElement.CONFIGURATOR:
90
+ if ((actions === null || actions === void 0 ? void 0 : actions.length) > 0) {
91
+ return splitButton("settings-inverted", element, className, title, dataElementId, isEnabled, actions, action);
92
+ }
90
93
  return iconButton("settings-inverted", element, className, dataElementId, title, action, isEnabled);
91
94
  case TaskbarElement.MORE_OPTIONS:
92
95
  return actionButton(element, className, dataElementId, title, isEnabled, actions, action);
@@ -110,6 +113,11 @@ function iconButton(iconName, name, className, dataElementId, title, action, isE
110
113
  function iconTextButton(iconName, name, className, dataElementId, text, title, action, isEnabled) {
111
114
  return h("ez-button", { key: dataElementId, title: title, label: text, size: "small", class: className, "data-taskbar-label": text, "data-taskbar-icon": iconName, "data-taskbar-element": name, "data-element-id": dataElementId, enabled: isEnabled(name), onClick: () => action(name) }, h("ez-icon", { class: "ez-padding-right--small", slot: "leftIcon", iconName: iconName }));
112
115
  }
116
+ function splitButton(iconName, element, className, title, dataElementId, isEnabled, actions, action) {
117
+ return actions && actions.length > 0
118
+ ? h("taskbar-split-button", { iconName: iconName, class: className, key: dataElementId, "data-taskbar-icon": iconName, "data-taskbar-label": title, "data-taskbar-element": element, "data-element-id": dataElementId, enabled: isEnabled(element), actions: actions, title: title, action: () => action(element) })
119
+ : undefined;
120
+ }
113
121
  function actionButton(element, className, dataElementId, title, isEnabled, actions, action) {
114
122
  return actions && actions.length > 0
115
123
  ? h("taskbar-actions-button", { class: className, key: dataElementId, title: title, "data-taskbar-element": element, "data-element-id": dataElementId, enabled: isEnabled(element), actions: actions, onTaskbarActionSelected: (evt) => action(evt.detail.value) })
@@ -0,0 +1,220 @@
1
+ import { h, Host } from '@stencil/core';
2
+ export class TaskbarSplitButton {
3
+ constructor() {
4
+ this._showDropdown = false;
5
+ this.iconName = undefined;
6
+ this.action = undefined;
7
+ this.name = undefined;
8
+ this.className = undefined;
9
+ this.dataElementId = undefined;
10
+ this.title = undefined;
11
+ this.enabled = undefined;
12
+ this.actions = undefined;
13
+ }
14
+ initializeEagerItems() {
15
+ var _a;
16
+ (_a = this.actions) === null || _a === void 0 ? void 0 : _a.forEach(action => {
17
+ var _a;
18
+ if (action && action.eagerInitialize && action.itemBuilder) {
19
+ (_a = action.itemBuilder) === null || _a === void 0 ? void 0 : _a.call(action, this._splitButtonRef, action);
20
+ }
21
+ });
22
+ }
23
+ componentDidLoad() {
24
+ this.initializeEagerItems();
25
+ }
26
+ dropdownItemBuilder(item, _level) {
27
+ const itemAction = this.actions.find(action => action.value === item.id);
28
+ if (!itemAction || !itemAction.itemBuilder) {
29
+ return undefined;
30
+ }
31
+ const customContent = itemAction.itemBuilder(this._splitButtonRef, itemAction);
32
+ if (typeof customContent === 'string') {
33
+ return h("div", { innerHTML: customContent });
34
+ }
35
+ return customContent;
36
+ }
37
+ loadItems() {
38
+ return this.actions.filter(action => action !== undefined).map(action => {
39
+ var _a;
40
+ return {
41
+ id: action.value,
42
+ label: action.label,
43
+ value: action.value,
44
+ type: (_a = action.type) !== null && _a !== void 0 ? _a : 'item',
45
+ children: action.children,
46
+ iconName: action.iconName,
47
+ subAction: action.subAction,
48
+ group: action.group,
49
+ disableCloseOnSelect: action.disableCloseOnSelect,
50
+ };
51
+ });
52
+ }
53
+ render() {
54
+ return (h(Host, null, h("ez-split-button", { ref: (ref) => this._splitButtonRef = ref, key: this.dataElementId, class: `${this.className} "ez-split-button--tertiary ez-padding--medium"`, items: this.loadItems(), mode: "icon-only", iconName: this.iconName, enabled: this.enabled, show: this._showDropdown, onButtonClick: () => this.action(this.name), itemBuilder: (item, level) => this.dropdownItemBuilder(item, level) })));
55
+ }
56
+ static get is() { return "taskbar-split-button"; }
57
+ static get encapsulation() { return "scoped"; }
58
+ static get originalStyleUrls() {
59
+ return {
60
+ "$": ["taskbar-split-button.css"]
61
+ };
62
+ }
63
+ static get styleUrls() {
64
+ return {
65
+ "$": ["taskbar-split-button.css"]
66
+ };
67
+ }
68
+ static get properties() {
69
+ return {
70
+ "iconName": {
71
+ "type": "string",
72
+ "mutable": false,
73
+ "complexType": {
74
+ "original": "string",
75
+ "resolved": "string",
76
+ "references": {}
77
+ },
78
+ "required": false,
79
+ "optional": false,
80
+ "docs": {
81
+ "tags": [],
82
+ "text": "Nome do \u00EDcone a ser exibido no bot\u00E3o."
83
+ },
84
+ "attribute": "icon-name",
85
+ "reflect": false
86
+ },
87
+ "action": {
88
+ "type": "unknown",
89
+ "mutable": false,
90
+ "complexType": {
91
+ "original": "(name: string) => void",
92
+ "resolved": "(name: string) => void",
93
+ "references": {}
94
+ },
95
+ "required": false,
96
+ "optional": false,
97
+ "docs": {
98
+ "tags": [{
99
+ "name": "param",
100
+ "text": "name Nome da a\u00E7\u00E3o a ser executada."
101
+ }],
102
+ "text": "Fun\u00E7\u00E3o de callback acionada ao clicar no bot\u00E3o principal."
103
+ }
104
+ },
105
+ "name": {
106
+ "type": "string",
107
+ "mutable": false,
108
+ "complexType": {
109
+ "original": "string",
110
+ "resolved": "string",
111
+ "references": {}
112
+ },
113
+ "required": false,
114
+ "optional": false,
115
+ "docs": {
116
+ "tags": [],
117
+ "text": "Nome identificador da a\u00E7\u00E3o do bot\u00E3o."
118
+ },
119
+ "attribute": "name",
120
+ "reflect": false
121
+ },
122
+ "className": {
123
+ "type": "string",
124
+ "mutable": false,
125
+ "complexType": {
126
+ "original": "string",
127
+ "resolved": "string",
128
+ "references": {}
129
+ },
130
+ "required": false,
131
+ "optional": false,
132
+ "docs": {
133
+ "tags": [],
134
+ "text": "Classe CSS personalizada para estilizar o bot\u00E3o."
135
+ },
136
+ "attribute": "class-name",
137
+ "reflect": false
138
+ },
139
+ "dataElementId": {
140
+ "type": "string",
141
+ "mutable": false,
142
+ "complexType": {
143
+ "original": "string",
144
+ "resolved": "string",
145
+ "references": {}
146
+ },
147
+ "required": false,
148
+ "optional": false,
149
+ "docs": {
150
+ "tags": [],
151
+ "text": "Identificador de elemento para fins de rastreamento e automa\u00E7\u00E3o de testes."
152
+ },
153
+ "attribute": "data-element-id",
154
+ "reflect": false
155
+ },
156
+ "title": {
157
+ "type": "string",
158
+ "mutable": false,
159
+ "complexType": {
160
+ "original": "string",
161
+ "resolved": "string",
162
+ "references": {}
163
+ },
164
+ "required": false,
165
+ "optional": false,
166
+ "docs": {
167
+ "tags": [],
168
+ "text": "Texto que ser\u00E1 exibido no bot\u00E3o."
169
+ },
170
+ "attribute": "title",
171
+ "reflect": false
172
+ },
173
+ "enabled": {
174
+ "type": "boolean",
175
+ "mutable": false,
176
+ "complexType": {
177
+ "original": "boolean",
178
+ "resolved": "boolean",
179
+ "references": {}
180
+ },
181
+ "required": false,
182
+ "optional": false,
183
+ "docs": {
184
+ "tags": [],
185
+ "text": "Se false o usu\u00E1rio n\u00E3o pode interagir com o componente."
186
+ },
187
+ "attribute": "enabled",
188
+ "reflect": false
189
+ },
190
+ "actions": {
191
+ "type": "unknown",
192
+ "mutable": false,
193
+ "complexType": {
194
+ "original": "Array<Action>",
195
+ "resolved": "Action[]",
196
+ "references": {
197
+ "Array": {
198
+ "location": "global"
199
+ },
200
+ "Action": {
201
+ "location": "import",
202
+ "path": "../../snk-taskbar"
203
+ }
204
+ }
205
+ },
206
+ "required": false,
207
+ "optional": false,
208
+ "docs": {
209
+ "tags": [],
210
+ "text": "Define a lista de a\u00E7\u00F5es dispon\u00EDveis no dropdown do bot\u00E3o."
211
+ }
212
+ }
213
+ };
214
+ }
215
+ static get states() {
216
+ return {
217
+ "_showDropdown": {}
218
+ };
219
+ }
220
+ }
@@ -58,6 +58,7 @@ export class SnkTaskbar {
58
58
  this.buttons = undefined;
59
59
  this.customButtons = undefined;
60
60
  this.actionsList = undefined;
61
+ this.actionsSettingsList = undefined;
61
62
  this.primaryButton = undefined;
62
63
  this.disabledButtons = undefined;
63
64
  this.dataUnit = undefined;
@@ -214,7 +215,7 @@ export class SnkTaskbar {
214
215
  const taskbarElement = TaskbarElement[def.toString()];
215
216
  const dataExporterStoreKey = this._element.dataset.exporterStoreKey || this.configName;
216
217
  if (taskbarElement) {
217
- return buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.buildDynamicActionsList(), dataExporterStoreKey, this.presentationMode);
218
+ return buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), def !== TaskbarElement.CONFIGURATOR ? this.buildDynamicActionsList() : this.buildActionsSettingsList(), dataExporterStoreKey, this.presentationMode);
218
219
  }
219
220
  else {
220
221
  return buildCustomButton(def, className, this.getIdElemBtnCustom(def), elem => this.elementClick(elem), elem => this.isEnabled(elem));
@@ -223,10 +224,13 @@ export class SnkTaskbar {
223
224
  buildDynamicActionsList() {
224
225
  var _a;
225
226
  if (this._hiddenActionsList.length) {
226
- return [...((_a = this.actionsList) !== null && _a !== void 0 ? _a : []), { type: 'divider', label: "", value: "" }, ...this._hiddenActionsList];
227
+ return [...((_a = this.actionsList) !== null && _a !== void 0 ? _a : []), ...this._hiddenActionsList];
227
228
  }
228
229
  return this.actionsList;
229
230
  }
231
+ buildActionsSettingsList() {
232
+ return this.actionsSettingsList;
233
+ }
230
234
  getIdElemBtnNative(taskbarElem) {
231
235
  return StringUtils.toCamelCase(taskbarElem);
232
236
  }
@@ -618,6 +622,28 @@ export class SnkTaskbar {
618
622
  "text": "Lista de a\u00E7\u00F5es que devem ser usadas no bot\u00E3o \"Mais op\u00E7\u00F5es\" do componente snk-taskbar."
619
623
  }
620
624
  },
625
+ "actionsSettingsList": {
626
+ "type": "unknown",
627
+ "mutable": false,
628
+ "complexType": {
629
+ "original": "Array<Action>",
630
+ "resolved": "Action[]",
631
+ "references": {
632
+ "Array": {
633
+ "location": "global"
634
+ },
635
+ "Action": {
636
+ "location": "local"
637
+ }
638
+ }
639
+ },
640
+ "required": false,
641
+ "optional": false,
642
+ "docs": {
643
+ "tags": [],
644
+ "text": "Lista de a\u00E7\u00F5es que devem ser usadas no bot\u00E3o \"Mais op\u00E7\u00F5es\" do componente snk-taskbar."
645
+ }
646
+ },
621
647
  "primaryButton": {
622
648
  "type": "string",
623
649
  "mutable": false,
@@ -5,7 +5,7 @@ export const snkCrudMessages = {
5
5
  update: "Alterar registro",
6
6
  clean: "{{ENTITY_NAME}}"
7
7
  },
8
- findColumn: "Buscar campos",
8
+ findColumn: "Buscar campos (Ctrl+F)",
9
9
  goBackTitle: "Voltar"
10
10
  };
11
11
  export default snkCrudMessages;
@@ -1,5 +1,5 @@
1
1
  export const snkGridMessages = {
2
- findColumn: "Busca de colunas",
2
+ findColumn: "Busca de colunas (Ctrl+F)",
3
3
  cancelConfirmation: {
4
4
  title: "Aviso",
5
5
  message: "As alterações realizadas serão descartadas<br/><br/><b>Você realmente gostaria de cancelar?</b>",
@@ -1,5 +1,6 @@
1
1
  export const snkSimpleCrudMessages = {
2
- findColumn: "Busca de colunas",
2
+ findColumn: "Busca de colunas (Ctrl+F)",
3
+ findFields: "Busca de campos (Ctrl+F)",
3
4
  formConfigUnavaliable: {
4
5
  title: "Aviso",
5
6
  message: 'A opção "Configurar formulário" será disponibilizada em breve. Enquanto isso, acesse a configuração do fomulário através dos layouts anteriores, HTML5 ou Flex.'