@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-81596.0 → 0.0.0-bugfix-dev-KB-81596.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 (170) hide show
  1. package/dist/cjs/{DataBinder-e92314c2.js → DataBinder-c2060474.js} +3 -2
  2. package/dist/cjs/FormLayout-c2451c7f.js +7 -0
  3. package/dist/cjs/{constants-2714478b.js → constants-569271bc.js} +4 -0
  4. package/dist/cjs/ez-actions-button.cjs.entry.js +2 -1
  5. package/dist/cjs/ez-card-item_2.cjs.entry.js +3 -1217
  6. package/dist/cjs/ez-collapsible-box.cjs.entry.js +2 -1
  7. package/dist/cjs/ez-combo-box-list_3.cjs.entry.js +3 -2
  8. package/dist/cjs/ez-combo-box.cjs.entry.js +2 -7
  9. package/dist/cjs/ez-date-input.cjs.entry.js +1 -1
  10. package/dist/cjs/ez-date-time-input.cjs.entry.js +1 -1
  11. package/dist/cjs/ez-form-view.cjs.entry.js +18 -10
  12. package/dist/cjs/ez-form.cjs.entry.js +29 -3
  13. package/dist/cjs/ez-grid.cjs.entry.js +165 -28
  14. package/dist/cjs/ez-list.cjs.entry.js +2 -2
  15. package/dist/cjs/ez-modal-container.cjs.entry.js +1 -1
  16. package/dist/cjs/ez-modal.cjs.entry.js +1 -1
  17. package/dist/cjs/ez-popup.cjs.entry.js +1 -1
  18. package/dist/cjs/ez-search-plus.cjs.entry.js +369 -0
  19. package/dist/cjs/ez-search-result-list.cjs.entry.js +98 -0
  20. package/dist/cjs/ez-search.cjs.entry.js +3 -2
  21. package/dist/cjs/ez-split-item.cjs.entry.js +2 -1
  22. package/dist/cjs/ez-text-input.cjs.entry.js +20 -87
  23. package/dist/cjs/ez-tooltip.cjs.entry.js +104 -29
  24. package/dist/cjs/ezui.cjs.js +1 -1
  25. package/dist/cjs/floating-ui.dom.esm-017acce4.js +1404 -0
  26. package/dist/cjs/index-a7b0c73d.js +8 -0
  27. package/dist/cjs/loader.cjs.js +1 -1
  28. package/dist/cjs/{ICustomRender-6fafffce.js → types-6a5df0c7.js} +8 -0
  29. package/dist/collection/collection-manifest.json +12 -0
  30. package/dist/collection/components/ez-combo-box/ez-combo-box.js +1 -8
  31. package/dist/collection/components/ez-date-input/ez-date-input.js +1 -1
  32. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +1 -1
  33. package/dist/collection/components/ez-form/ez-form.js +31 -4
  34. package/dist/collection/components/ez-form-view/ez-form-view.css +8 -0
  35. package/dist/collection/components/ez-form-view/ez-form-view.js +21 -2
  36. package/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder.js +3 -1
  37. package/dist/collection/components/ez-form-view/fieldbuilder/templates/SearchInputPlus.tpl.js +6 -0
  38. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +96 -16
  39. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +21 -4
  40. package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +31 -7
  41. package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellEditor.js +2 -0
  42. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/SearchPlus.tpl.js +15 -0
  43. package/dist/collection/components/ez-list/ez-list.js +2 -2
  44. package/dist/collection/components/ez-modal/ez-modal.js +1 -1
  45. package/dist/collection/components/ez-modal-container/ez-modal-container.js +1 -1
  46. package/dist/collection/components/ez-popup/ez-popup.js +1 -1
  47. package/dist/collection/components/ez-search-plus/ez-search-plus.css +373 -0
  48. package/dist/collection/components/ez-search-plus/ez-search-plus.js +952 -0
  49. package/dist/collection/components/ez-search-plus/subcomponent/ez-search-result-list/ez-search-result-list.css +227 -0
  50. package/dist/collection/components/ez-search-plus/subcomponent/ez-search-result-list/ez-search-result-list.js +279 -0
  51. package/dist/collection/components/ez-text-input/ez-text-input.css +18 -2
  52. package/dist/collection/components/ez-text-input/ez-text-input.js +39 -60
  53. package/dist/collection/components/ez-tooltip/ez-tooltip.css +52 -12
  54. package/dist/collection/components/ez-tooltip/ez-tooltip.js +217 -46
  55. package/dist/collection/utils/constants.js +2 -0
  56. package/dist/collection/utils/form/DataBinder.js +3 -2
  57. package/dist/collection/utils/form/interfaces/FormLayout.js +5 -0
  58. package/dist/collection/utils/form/interfaces/index.js +1 -1
  59. package/dist/collection/utils/index.js +2 -0
  60. package/dist/collection/utils/search/types.js +7 -0
  61. package/dist/custom-elements/index.d.ts +12 -0
  62. package/dist/custom-elements/index.js +992 -170
  63. package/dist/esm/{DataBinder-9c877244.js → DataBinder-89946126.js} +3 -2
  64. package/dist/esm/FormLayout-54092963.js +7 -0
  65. package/dist/esm/constants-b036528f.js +7 -0
  66. package/dist/esm/ez-actions-button.entry.js +2 -1
  67. package/dist/esm/ez-card-item_2.entry.js +1 -1215
  68. package/dist/esm/ez-collapsible-box.entry.js +2 -1
  69. package/dist/esm/ez-combo-box-list_3.entry.js +2 -1
  70. package/dist/esm/ez-combo-box.entry.js +2 -7
  71. package/dist/esm/ez-date-input.entry.js +1 -1
  72. package/dist/esm/ez-date-time-input.entry.js +1 -1
  73. package/dist/esm/ez-form-view.entry.js +19 -11
  74. package/dist/esm/ez-form.entry.js +30 -4
  75. package/dist/esm/ez-grid.entry.js +164 -27
  76. package/dist/esm/ez-list.entry.js +2 -2
  77. package/dist/esm/ez-modal-container.entry.js +1 -1
  78. package/dist/esm/ez-modal.entry.js +1 -1
  79. package/dist/esm/ez-popup.entry.js +1 -1
  80. package/dist/esm/ez-search-plus.entry.js +365 -0
  81. package/dist/esm/ez-search-result-list.entry.js +94 -0
  82. package/dist/esm/ez-search.entry.js +3 -2
  83. package/dist/esm/ez-split-item.entry.js +2 -1
  84. package/dist/esm/ez-text-input.entry.js +20 -87
  85. package/dist/esm/ez-tooltip.entry.js +105 -30
  86. package/dist/esm/ezui.js +1 -1
  87. package/dist/esm/floating-ui.dom.esm-5d3da819.js +1398 -0
  88. package/dist/esm/index-baa5e267.js +8 -0
  89. package/dist/esm/loader.js +1 -1
  90. package/dist/esm/{ICustomRender-875b5a40.js → types-6f6b2650.js} +9 -1
  91. package/dist/ezui/ezui.esm.js +1 -1
  92. package/dist/ezui/p-0bffeffc.entry.js +1 -0
  93. package/dist/ezui/p-173f68ea.js +1 -0
  94. package/dist/ezui/p-1a060042.entry.js +1 -0
  95. package/dist/ezui/{p-cb5cd243.entry.js → p-1ec8bdd2.entry.js} +46 -46
  96. package/dist/ezui/p-248d4f54.entry.js +1 -0
  97. package/dist/ezui/p-3176a6ef.entry.js +1 -0
  98. package/dist/ezui/p-4e0628a7.entry.js +1 -0
  99. package/dist/ezui/p-5895e687.js +1 -0
  100. package/dist/ezui/p-5a14f506.entry.js +1 -0
  101. package/dist/ezui/p-5ec0ae79.entry.js +1 -0
  102. package/dist/ezui/p-5eea9886.js +1 -0
  103. package/dist/ezui/p-81145609.entry.js +1 -0
  104. package/dist/ezui/p-84b1c99e.entry.js +1 -0
  105. package/dist/ezui/p-8ac8093c.entry.js +1 -0
  106. package/dist/ezui/p-9142b27a.entry.js +1 -0
  107. package/dist/ezui/p-9567b31a.entry.js +1 -0
  108. package/dist/ezui/p-9f22e1dc.entry.js +1 -0
  109. package/dist/ezui/{p-acddfb2e.js → p-a64cfcfc.js} +1 -1
  110. package/dist/ezui/p-bf9dec89.entry.js +1 -0
  111. package/dist/ezui/p-c5df78be.entry.js +1 -0
  112. package/dist/ezui/p-cd07f8be.entry.js +1 -0
  113. package/dist/ezui/p-e07e4671.js +1 -0
  114. package/dist/ezui/p-e3544d23.entry.js +1 -0
  115. package/dist/ezui/p-ecaac11f.entry.js +1 -0
  116. package/dist/ezui/p-f4861c6a.entry.js +1 -0
  117. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +0 -2
  118. package/dist/types/components/ez-form/ez-form.d.ts +5 -1
  119. package/dist/types/components/ez-form-view/ez-form-view.d.ts +4 -0
  120. package/dist/types/components/ez-form-view/fieldbuilder/templates/SearchInputPlus.tpl.d.ts +2 -0
  121. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +4 -0
  122. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +5 -2
  123. package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +1 -0
  124. package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +1 -0
  125. package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/SearchPlus.tpl.d.ts +3 -0
  126. package/dist/types/components/ez-search-plus/ez-search-plus.d.ts +184 -0
  127. package/dist/types/components/ez-search-plus/subcomponent/ez-search-result-list/ez-search-result-list.d.ts +26 -0
  128. package/dist/types/components/ez-text-input/ez-text-input.d.ts +6 -9
  129. package/dist/types/components/ez-tooltip/ez-tooltip.d.ts +37 -5
  130. package/dist/types/components.d.ts +338 -12
  131. package/dist/types/utils/constants.d.ts +2 -0
  132. package/dist/types/utils/form/interfaces/FormLayout.d.ts +4 -0
  133. package/dist/types/utils/form/interfaces/index.d.ts +1 -0
  134. package/dist/types/utils/index.d.ts +2 -0
  135. package/dist/types/utils/search/types.d.ts +12 -0
  136. package/package.json +3 -3
  137. package/react/components.d.ts +62 -60
  138. package/react/components.js +2 -0
  139. package/react/components.js.map +1 -1
  140. package/react/react-component-lib/createComponent.d.ts +1 -1
  141. package/react/react-component-lib/createComponent.js.map +1 -1
  142. package/react/react-component-lib/createOverlayComponent.js.map +1 -1
  143. package/react/react-component-lib/interfaces.js +1 -0
  144. package/react/react-component-lib/utils/attachProps.d.ts +1 -1
  145. package/react/react-component-lib/utils/attachProps.js.map +1 -1
  146. package/react/react-component-lib/utils/dev.js.map +1 -1
  147. package/react/react-component-lib/utils/index.d.ts +2 -2
  148. package/react/react-component-lib/utils/index.js.map +1 -1
  149. package/dist/collection/utils/ResponsiveInputUtils.js +0 -26
  150. package/dist/esm/constants-4e0d35b7.js +0 -5
  151. package/dist/ezui/p-05e1f4e7.js +0 -1
  152. package/dist/ezui/p-17eabf46.entry.js +0 -1
  153. package/dist/ezui/p-1ad6c61b.entry.js +0 -1
  154. package/dist/ezui/p-20cb13fa.entry.js +0 -1
  155. package/dist/ezui/p-23b6128c.entry.js +0 -1
  156. package/dist/ezui/p-3195a7a7.entry.js +0 -1
  157. package/dist/ezui/p-4607fb89.js +0 -1
  158. package/dist/ezui/p-556468d9.entry.js +0 -1
  159. package/dist/ezui/p-6cdd3e0a.entry.js +0 -1
  160. package/dist/ezui/p-788467fe.entry.js +0 -1
  161. package/dist/ezui/p-af1a478e.entry.js +0 -1
  162. package/dist/ezui/p-bbdc3996.entry.js +0 -1
  163. package/dist/ezui/p-c297aa52.entry.js +0 -1
  164. package/dist/ezui/p-cb1535f7.entry.js +0 -1
  165. package/dist/ezui/p-cf87aacb.entry.js +0 -1
  166. package/dist/ezui/p-dcf3c8e5.entry.js +0 -1
  167. package/dist/ezui/p-e347df9c.entry.js +0 -1
  168. package/dist/ezui/p-f5931caa.entry.js +0 -1
  169. package/dist/ezui/p-fd0a19d6.entry.js +0 -1
  170. package/dist/types/utils/ResponsiveInputUtils.d.ts +0 -6
@@ -6,7 +6,7 @@ import { EzGridCustomHeader } from './components/EzGridCustomHeader';
6
6
  import { CellRendererStatus } from './components/cellRendererStatus';
7
7
  import SelectionHeader from './components/selectionHeader';
8
8
  import gridTerms from './i18n/pt-BR';
9
- import { DISTINCT_FILTER_NAME_PREFIX, EZ_GRID_LOADING_SOURCE } from '../../../../utils/constants';
9
+ import { DISTINCT_FILTER_NAME_PREFIX, EZ_GRID_LOADING_SOURCE, PRESENTATION_COL_ID_PROP_NAME, PRESENTATION_FROM_COL_PROP_NAME } from '../../../../utils/constants';
10
10
  import GridEditionManager from './GridEditionManager';
11
11
  import { ModuleRegistry } from '@ag-grid-community/core';
12
12
  import { EnterpriseCoreModule } from '@ag-grid-enterprise/core';
@@ -44,7 +44,6 @@ export default class AgGridController {
44
44
  this.DEFAULT_FONT_SIZE_HTML5 = 32;
45
45
  this.DEFAULT_ICON_SIZE = 12;
46
46
  this.DEFAULT_MAX_SIZE = 200;
47
- this.DOC_WIDTH = 800;
48
47
  this._menuItems = [];
49
48
  this._idAttribName = '__record__id__';
50
49
  this._gridConfig = [];
@@ -53,6 +52,7 @@ export default class AgGridController {
53
52
  this._customFormatters = new Map();
54
53
  this._gridShowDom = false;
55
54
  this.peddingExecutionsOnGridShow = [];
55
+ this._lastColsConfig = undefined;
56
56
  ModuleRegistry.registerModules([
57
57
  EnterpriseCoreModule,
58
58
  RangeSelectionModule,
@@ -647,7 +647,9 @@ export default class AgGridController {
647
647
  }
648
648
  }
649
649
  isColumnEditable(rowIndex, column) {
650
- if (column.getColDef().headerName === '' || rowIndex === -1)
650
+ if (column.getColDef().headerName === ''
651
+ || column.getColDef().headerName === this.CHECK_BOX_COL_ID
652
+ || rowIndex === -1)
651
653
  return false;
652
654
  const rowId = this._dataUnit.records[rowIndex][this._idAttribName];
653
655
  const rowNode = this._gridOptions.api.getRowNode(rowId);
@@ -665,7 +667,7 @@ export default class AgGridController {
665
667
  this._gridOptions.api.setFocusedCell(rowIndex, firstCell);
666
668
  }
667
669
  setColumnsDef(cols) {
668
- const checkBoxColumn = Object.assign({ colId: this.CHECK_BOX_COL_ID, headerName: '', checkboxSelection: true, width: 29, suppressMovable: true, suppressAutoSize: true, suppressMenu: true, lockPosition: true, pinned: true }, (this._multipleSelection && { headerComponent: 'ezGridHeaderComponent', headerClass: 'ag-column-select-header' }));
670
+ const checkBoxColumn = Object.assign({ colId: this.CHECK_BOX_COL_ID, headerName: this.CHECK_BOX_COL_ID, checkboxSelection: true, width: 29, suppressMovable: true, suppressAutoSize: true, suppressMenu: true, lockPosition: true, pinned: true }, (this._multipleSelection && { headerComponent: 'ezGridHeaderComponent', headerClass: 'ag-column-select-header' }));
669
671
  const newColDefs = this._options.suppressCheckBoxCol ? [] : [checkBoxColumn];
670
672
  if (this._statusResolver != undefined) {
671
673
  newColDefs.push({
@@ -693,8 +695,39 @@ export default class AgGridController {
693
695
  });
694
696
  this._colDefs = newColDefs;
695
697
  if (this._gridOptions && this._gridOptions.api) {
698
+ this.setColsDefsWithStateIfNeeded(this._colDefs);
699
+ }
700
+ }
701
+ setColsDefsWithStateIfNeeded(colDefs) {
702
+ if (!this._lastColsConfig) {
696
703
  this._gridOptions.api.setColumnDefs(this._colDefs);
697
704
  }
705
+ /*
706
+ Caso a definição de colunas esteja sendo atualizada,
707
+ e existe uma config aplicada, temos que considerar essa
708
+ config ao adicionar nova definição de colunas.
709
+ PS: Poderia apenas chamar o setColumnsState, porém,
710
+ isso impactaria em performance, e o usuário ia perceber
711
+ a mudança das colunas visualmente na grade, o que traria
712
+ uma experiencia ruim.
713
+ */
714
+ const colDefsWithConfigs = this.getColsDefWithConfigApplied(colDefs, this._lastColsConfig);
715
+ this._gridOptions.api.setColumnDefs(colDefsWithConfigs);
716
+ }
717
+ getColsDefWithConfigApplied(colDefs, colsConfig) {
718
+ //Cria map de colunas existentes na config e seu índice
719
+ const orderMap = colsConfig.reduce((map, col, index) => {
720
+ map[col.name] = index;
721
+ return map;
722
+ }, {});
723
+ //Remove colunas que não existem na config
724
+ const filteredColsDefs = colDefs.filter((col) => !orderMap.hasOwnProperty(col.colId));
725
+ //Ordena colunas baseada na config aplicada
726
+ const sortedColumnDefs = filteredColsDefs.sort((a, b) => {
727
+ var _a, _b;
728
+ return ((_a = orderMap[a.field]) !== null && _a !== void 0 ? _a : Number.MAX_VALUE) - ((_b = orderMap[b.field]) !== null && _b !== void 0 ? _b : Number.MAX_VALUE);
729
+ });
730
+ return sortedColumnDefs;
698
731
  }
699
732
  hideSelectionColumn() {
700
733
  var _a, _b;
@@ -728,6 +761,7 @@ export default class AgGridController {
728
761
  if (this._grid === undefined) {
729
762
  throw new Error('Erro interno: Grid ainda não inicializado.');
730
763
  }
764
+ this._lastColsConfig = state;
731
765
  const colDef = this._gridOptions.columnApi.getColumns();
732
766
  let columns = this.getColumnsDef();
733
767
  let visibleColumns = [];
@@ -736,14 +770,39 @@ export default class AgGridController {
736
770
  const columnsOffset = colDef.length - columns.length;
737
771
  this._gridConfig = state;
738
772
  let sort = [];
739
- state.forEach((cfgColumn, index) => {
773
+ let currentIndex = 0;
774
+ state.forEach((cfgColumn) => {
775
+ var _a, _b;
740
776
  const colWidth = this.getColumnWidth(cfgColumn);
741
- this._gridOptions.columnApi.moveColumn(cfgColumn.name, index + columnsOffset);
777
+ this._gridOptions.columnApi.moveColumn(cfgColumn.name, currentIndex + columnsOffset);
742
778
  this._gridOptions.columnApi.setColumnWidth(cfgColumn.name, colWidth);
743
779
  visibleColumns.push(cfgColumn.name);
744
780
  if (cfgColumn.ascending !== undefined) {
745
781
  sort.push({ colId: cfgColumn.name, sort: cfgColumn.ascending !== true ? 'desc' : 'asc', sortIndex: cfgColumn.orderIndex });
746
782
  }
783
+ currentIndex++;
784
+ const fieldMD = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getField(cfgColumn.name);
785
+ /*
786
+ Migração para o SEARCHPLUS, caso de uso:
787
+ - Agora existe uma coluna para o campo de descrição do relaciona
788
+ - Essa col, não existe na config da grade que já foi salva pelo DS
789
+ - Nesse caso, precisamos inserir a coluna de descrição automaticamente para que
790
+ os usuários não percam a apresentação do campo de descrição.
791
+ PS: Caso esteja herdando do HTML5, devemos manter a config como está la
792
+ */
793
+ if (this.needToAddDescriptionColumn(cfgColumn, fieldMD, state)) {
794
+ const descriptionColID = (_b = fieldMD === null || fieldMD === void 0 ? void 0 : fieldMD.properties) === null || _b === void 0 ? void 0 : _b[PRESENTATION_COL_ID_PROP_NAME];
795
+ if (!descriptionColID)
796
+ return;
797
+ const descriptionCol = this._gridOptions.columnApi.getColumn(descriptionColID);
798
+ const descriptionColDef = descriptionCol === null || descriptionCol === void 0 ? void 0 : descriptionCol.getColDef();
799
+ const descriptionHeaderName = descriptionColDef === null || descriptionColDef === void 0 ? void 0 : descriptionColDef.headerName;
800
+ const descriptionColSize = this.getColumnWidthByLabel(descriptionHeaderName);
801
+ this._gridOptions.columnApi.moveColumn(descriptionColID, currentIndex + columnsOffset);
802
+ this._gridOptions.columnApi.setColumnWidth(descriptionColID, descriptionColSize);
803
+ visibleColumns.push(descriptionColID);
804
+ currentIndex++;
805
+ }
747
806
  });
748
807
  let invisibleColumns = columns.filter(column => !visibleColumns.includes(column.name)).map(column => column.name);
749
808
  this._gridOptions.columnApi.setColumnsVisible(visibleColumns, true);
@@ -753,10 +812,15 @@ export default class AgGridController {
753
812
  defaultState: { sort: null },
754
813
  });
755
814
  }
756
- getAdaptiveWidth(width) {
757
- const widthGrid = this._container.clientWidth;
758
- const adaptiveWidth = (this.DOC_WIDTH * width) / widthGrid;
759
- return Math.round(adaptiveWidth);
815
+ needToAddDescriptionColumn(cfgColumn, fieldMD, stateConfig) {
816
+ var _a, _b;
817
+ if (!fieldMD) {
818
+ return false;
819
+ }
820
+ const configVersion = ((_a = cfgColumn.configVersion) !== null && _a !== void 0 ? _a : 0);
821
+ const isSearchPlus = (fieldMD === null || fieldMD === void 0 ? void 0 : fieldMD.userInterface) == UserInterface.SEARCHPLUS;
822
+ const descriptionColID = (_b = fieldMD === null || fieldMD === void 0 ? void 0 : fieldMD.properties) === null || _b === void 0 ? void 0 : _b[PRESENTATION_COL_ID_PROP_NAME];
823
+ return isSearchPlus && configVersion < 1 && stateConfig.find(col => col.name === descriptionColID) != undefined;
760
824
  }
761
825
  getColumnsState() {
762
826
  if (this._grid === undefined) {
@@ -767,7 +831,7 @@ export default class AgGridController {
767
831
  .map(s => {
768
832
  const column = this._gridOptions.columnApi.getColumn(s.colId);
769
833
  const def = column.getColDef();
770
- const width = this.getAdaptiveWidth(column.getActualWidth());
834
+ const width = column.getActualWidth();
771
835
  const label = def.headerName;
772
836
  const name = def.checkboxSelection ? '__SELECTION__' : s.colId;
773
837
  const colState = { label, name };
@@ -817,7 +881,7 @@ export default class AgGridController {
817
881
  return filterOptions.map(item => item.check).includes(true);
818
882
  }
819
883
  buildColDef(source) {
820
- var _a, _b, _c;
884
+ var _a, _b, _c, _d;
821
885
  let tooltip = undefined;
822
886
  const propSortable = StringUtils.getBooleanValue((_a = source.props) === null || _a === void 0 ? void 0 : _a.get('gridSortable'), true);
823
887
  if ((_b = source.props) === null || _b === void 0 ? void 0 : _b.get('gridHeaderTooltip')) {
@@ -839,6 +903,11 @@ export default class AgGridController {
839
903
  showColumnFilter: (leftPosition) => this.showFilterColumn({ columnName: source.name, columnLabel: source.label, leftPosition, filteredOptions: this._filteredColumns.get(source.name), fromIcon: true }),
840
904
  },
841
905
  valueFormatter: params => {
906
+ var _a, _b, _c, _d;
907
+ const presentationFrom = (_a = source === null || source === void 0 ? void 0 : source.props) === null || _a === void 0 ? void 0 : _a.get(PRESENTATION_FROM_COL_PROP_NAME);
908
+ if (presentationFrom) {
909
+ return (_d = (_c = (_b = params === null || params === void 0 ? void 0 : params.data) === null || _b === void 0 ? void 0 : _b[presentationFrom]) === null || _c === void 0 ? void 0 : _c.label) !== null && _d !== void 0 ? _d : "";
910
+ }
842
911
  if (params.value === undefined || params.value === null) {
843
912
  return "";
844
913
  }
@@ -858,6 +927,7 @@ export default class AgGridController {
858
927
  return this.getFormatterByColumn(params, source);
859
928
  },
860
929
  cellStyle: this.getStyleByColumn(source),
930
+ editable: !((_d = source.props) === null || _d === void 0 ? void 0 : _d.has(PRESENTATION_FROM_COL_PROP_NAME))
861
931
  });
862
932
  }
863
933
  setCustomFormatters(customFormatters) {
@@ -873,8 +943,11 @@ export default class AgGridController {
873
943
  };
874
944
  }
875
945
  getStyleByColumn(source) {
946
+ var _a;
876
947
  let cellStyle = this.getInitCellStyle();
877
- switch (source === null || source === void 0 ? void 0 : source.userInterface) {
948
+ const primitiveUIType = (_a = source === null || source === void 0 ? void 0 : source.props) === null || _a === void 0 ? void 0 : _a.get("PRIMITIVETUIYPE");
949
+ const uitype = source === null || source === void 0 ? void 0 : source.userInterface;
950
+ switch (primitiveUIType !== null && primitiveUIType !== void 0 ? primitiveUIType : uitype) {
878
951
  case UserInterface.DECIMALNUMBER:
879
952
  case UserInterface.INTEGERNUMBER:
880
953
  cellStyle['text-align'] = 'right';
@@ -890,7 +963,7 @@ export default class AgGridController {
890
963
  return cellStyle;
891
964
  }
892
965
  getFormatterByColumn(params, source) {
893
- var _a;
966
+ var _a, _b, _c, _d;
894
967
  if ((source === null || source === void 0 ? void 0 : source.userInterface) === 'OPTIONSELECTOR' && source.options) {
895
968
  const prop = source === null || source === void 0 ? void 0 : source.options;
896
969
  let options;
@@ -927,6 +1000,9 @@ export default class AgGridController {
927
1000
  return params === null || params === void 0 ? void 0 : params.value;
928
1001
  }
929
1002
  }
1003
+ if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.SEARCHPLUS) {
1004
+ return (_d = (_c = (_b = params === null || params === void 0 ? void 0 : params.value) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : params === null || params === void 0 ? void 0 : params.value) !== null && _d !== void 0 ? _d : "";
1005
+ }
930
1006
  if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.DECIMALNUMBER) {
931
1007
  if (params.value != undefined) {
932
1008
  const precision = Number(source.props.get('precision')) || 2;
@@ -1100,7 +1176,7 @@ export default class AgGridController {
1100
1176
  this._gridOptions.api.stopEditing();
1101
1177
  }
1102
1178
  getColumnWidth(cfgColumn) {
1103
- var _a, _b;
1179
+ var _a, _b, _c, _d, _e, _f;
1104
1180
  if (cfgColumn == undefined) {
1105
1181
  return;
1106
1182
  }
@@ -1112,10 +1188,14 @@ export default class AgGridController {
1112
1188
  return parseInt(cfgColumn.width) + this.DEFAULT_FONT_SIZE_HTML5;
1113
1189
  }
1114
1190
  const field = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getField(cfgColumn.name);
1191
+ const label = (_b = field === null || field === void 0 ? void 0 : field.label) !== null && _b !== void 0 ? _b : (_f = (_e = (_d = (_c = this._gridOptions) === null || _c === void 0 ? void 0 : _c.columnApi) === null || _d === void 0 ? void 0 : _d.getColumn(cfgColumn.name)) === null || _e === void 0 ? void 0 : _e.getColDef()) === null || _f === void 0 ? void 0 : _f.headerName;
1115
1192
  if ((field === null || field === void 0 ? void 0 : field.userInterface) === UserInterface.SEARCH) {
1116
1193
  return this.DEFAULT_MAX_SIZE;
1117
1194
  }
1118
- const labelSize = (((_b = field === null || field === void 0 ? void 0 : field.label) === null || _b === void 0 ? void 0 : _b.length) || 0) * this.DEFAULT_FONT_SIZE + this.DEFAULT_ICON_SIZE;
1195
+ return this.getColumnWidthByLabel(label);
1196
+ }
1197
+ getColumnWidthByLabel(label) {
1198
+ const labelSize = ((label === null || label === void 0 ? void 0 : label.length) || 0) * this.DEFAULT_FONT_SIZE + this.DEFAULT_ICON_SIZE;
1119
1199
  return labelSize > this.DEFAULT_MAX_SIZE ? this.DEFAULT_MAX_SIZE : labelSize;
1120
1200
  }
1121
1201
  }
@@ -1,5 +1,5 @@
1
- import { Action, ObjectUtils } from '@sankhyalabs/core';
2
- import { EZ_GRID_LOADING_SOURCE } from "../../../../utils/constants";
1
+ import { Action, ObjectUtils, UserInterface } from '@sankhyalabs/core';
2
+ import { EZ_GRID_LOADING_SOURCE, PRESENTATION_COL_ID_PROP_NAME, PRESENTATION_FROM_COL_PROP_NAME } from "../../../../utils/constants";
3
3
  import { DataSourceInterceptor } from "./DataSourceInterceptor";
4
4
  export default class DataSource {
5
5
  handleDataSaved(action) {
@@ -245,14 +245,20 @@ export default class DataSource {
245
245
  return indexA - indexB;
246
246
  });
247
247
  this._dataUnit.metadata.fields.forEach(f => {
248
- var _a;
248
+ var _a, _b;
249
249
  if (f.visible !== false && f.name !== this.RECORD_ARCHIVE) {
250
250
  const props = new Map();
251
251
  const properties = this._dataUnit.getField(f.name).properties;
252
252
  for (const value in properties) {
253
253
  props.set(value, properties[value]);
254
254
  }
255
- columnDefs.push({ label: f.label, name: f.name, userInterface: f.userInterface, options: (_a = this._dataUnit.getField(f.name).properties) === null || _a === void 0 ? void 0 : _a.options, props });
255
+ const col = { label: f.label, name: f.name, userInterface: f.userInterface, options: (_a = this._dataUnit.getField(f.name).properties) === null || _a === void 0 ? void 0 : _a.options, props };
256
+ columnDefs.push(col);
257
+ if (f.userInterface === UserInterface.SEARCHPLUS && ((_b = f.properties) === null || _b === void 0 ? void 0 : _b.DESCRIPTIONFIELD)) {
258
+ const descriptionCol = this.buildDescriptionColumn(f);
259
+ columnDefs.push(descriptionCol);
260
+ f.properties[PRESENTATION_COL_ID_PROP_NAME] = descriptionCol.name;
261
+ }
256
262
  }
257
263
  });
258
264
  }
@@ -262,4 +268,15 @@ export default class DataSource {
262
268
  console.warn(error);
263
269
  }
264
270
  }
271
+ buildDescriptionColumn(field) {
272
+ var _a, _b, _c, _d;
273
+ const props = new Map();
274
+ props.set(PRESENTATION_FROM_COL_PROP_NAME, field.name);
275
+ return {
276
+ label: `${(_a = field.properties) === null || _a === void 0 ? void 0 : _a.DESCRIPTIONFIELDLABEL} (${(_b = field.properties) === null || _b === void 0 ? void 0 : _b.DESCRIPTIONENTITY})`,
277
+ name: `${(_c = field.properties) === null || _c === void 0 ? void 0 : _c.ENTITYNAME}.${(_d = field.properties) === null || _d === void 0 ? void 0 : _d.DESCRIPTIONFIELD}`,
278
+ userInterface: UserInterface.SHORTTEXT,
279
+ props
280
+ };
281
+ }
265
282
  }
@@ -1,12 +1,14 @@
1
- import { LockManager, LockManagerOperation, UserInterface } from '@sankhyalabs/core';
1
+ import { LockManager, LockManagerOperation, StringUtils, UserInterface } from '@sankhyalabs/core';
2
2
  import { KeyCode, } from "@ag-grid-community/core";
3
3
  import { RecordValidationProcessor } from '../../../../utils/validators/recordvalidator/RecordValidationProcessor';
4
4
  import EzCellEditor from './editor/EzCellEditor';
5
5
  import EzGridCustomCellEditor from './components/EzGridCustomCellEditor';
6
6
  import EzGridCustomCellRender from './components/EzGridCustomCellRender';
7
7
  import { DataBinder } from '../../../../utils';
8
+ import { PRESENTATION_COL_ID_PROP_NAME } from '../../../../utils/constants';
8
9
  export default class GridEditionManager {
9
10
  constructor(dataUnit, useEnterLikeTab, recordsValidator, editionIsDisabled, customEditors, customRenders, enableContinuousInsert, enableGridInsert, lockerId) {
11
+ this._inProgressChanges = [];
10
12
  this._dataUnit = dataUnit;
11
13
  this._recordValidationProcessor = new RecordValidationProcessor(this._dataUnit, {
12
14
  getRequiredFields: () => this.getRequiredFields(),
@@ -106,6 +108,12 @@ export default class GridEditionManager {
106
108
  return this._enableContinuousInsert && (this._dataUnit.records.length - 1) === ((_a = this._lastCellEdited) === null || _a === void 0 ? void 0 : _a.rowIndex);
107
109
  }
108
110
  async proceedAutoSave() {
111
+ var _a;
112
+ //Aguarda outras promises entrarem na fila
113
+ await new Promise(resolve => setTimeout(resolve, 100));
114
+ if (this._inProgressChanges.length) {
115
+ await Promise.all((_a = this._inProgressChanges) === null || _a === void 0 ? void 0 : _a.map(({ promise }) => promise));
116
+ }
109
117
  if (!this._dataUnit.isDirty()) {
110
118
  this.saveSuccess();
111
119
  return true;
@@ -176,7 +184,9 @@ export default class GridEditionManager {
176
184
  }
177
185
  configureColumn(col) {
178
186
  col.cellEditor = 'ezCellEditor';
179
- col.editable = params => this.canEdit(params);
187
+ if (col.editable != false) {
188
+ col.editable = params => this.canEdit(params);
189
+ }
180
190
  col.suppressKeyboardEvent = (params) => {
181
191
  if (params.event.key === KeyCode.ESCAPE && params.editing) {
182
192
  return this._dataUnit.isDirty();
@@ -360,6 +370,14 @@ export default class GridEditionManager {
360
370
  return;
361
371
  }
362
372
  if (value instanceof Promise) {
373
+ const progressChange = {
374
+ promise: undefined,
375
+ resolve: () => { }
376
+ };
377
+ progressChange.promise = new Promise((resolve) => {
378
+ progressChange.resolve = resolve;
379
+ });
380
+ this._inProgressChanges.push(progressChange);
363
381
  this.handlePromiseValue(event, value);
364
382
  return;
365
383
  }
@@ -373,16 +391,22 @@ export default class GridEditionManager {
373
391
  const resolved = await value;
374
392
  return this.updateCellValue(event, resolved);
375
393
  }
376
- updateCellValue(event, newValue) {
377
- var _a;
394
+ async updateCellValue(event, newValue) {
395
+ var _a, _b, _c, _d;
378
396
  const fieldName = event.colDef.field;
379
- event.node.setData(Object.assign(Object.assign({}, event.data), { [fieldName]: newValue }));
380
- (_a = this._currentEditLock) === null || _a === void 0 ? void 0 : _a.call(this);
397
+ const newData = { [fieldName]: newValue };
398
+ const descriptionColName = (_b = (_a = this._dataUnit.getField(fieldName)) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b[PRESENTATION_COL_ID_PROP_NAME];
399
+ if (!StringUtils.isEmpty(descriptionColName)) {
400
+ newData[descriptionColName] = newValue === null || newValue === void 0 ? void 0 : newValue.label;
401
+ }
402
+ event.node.setData(Object.assign(Object.assign({}, event.data), { newData }));
403
+ (_c = this._currentEditLock) === null || _c === void 0 ? void 0 : _c.call(this);
381
404
  if (event.oldValue !== newValue) {
382
405
  this._isGridEdition = true;
383
- this._dataUnit.setFieldValue(fieldName, newValue, [event.data.__record__id__], { suppressCreateNewRecord: true });
406
+ await this._dataUnit.setFieldValue(fieldName, newValue, [event.data.__record__id__], { suppressCreateNewRecord: true });
384
407
  this._lastCellEdited = { rowIndex: event.rowIndex, column: event.column, rowPinned: undefined };
385
408
  }
409
+ (_d = this._inProgressChanges) === null || _d === void 0 ? void 0 : _d.forEach(({ resolve }) => resolve(newValue));
386
410
  }
387
411
  setCellEditors(customEditors) {
388
412
  var _a;
@@ -4,6 +4,7 @@ import { buildTextAreaInput, buildTextInput } from "./templates/TextInput.tpl";
4
4
  import { buildDate, buildDateTime, buildTime } from "./templates/DateInput.tpl";
5
5
  import { buildDecimal, buildInteger } from "./templates/NumberInput.tpl";
6
6
  import { buildComboBox, buildSwitch } from "./templates/ComboBox.tpl";
7
+ import { buildSearchPlus } from "./templates/SearchPlus.tpl";
7
8
  import { buildSearch } from "./templates/Search.tpl";
8
9
  const uiBuilders = new Map();
9
10
  uiBuilders.set(UserInterface.DATE, buildDate);
@@ -16,6 +17,7 @@ uiBuilders.set(UserInterface.CHECKBOX, buildSwitch);
16
17
  uiBuilders.set(UserInterface.OPTIONSELECTOR, buildComboBox);
17
18
  uiBuilders.set(UserInterface.LONGTEXT, buildTextAreaInput);
18
19
  uiBuilders.set(UserInterface.SEARCH, buildSearch);
20
+ uiBuilders.set(UserInterface.SEARCHPLUS, buildSearchPlus);
19
21
  export default class EzCellEditor {
20
22
  init(params) {
21
23
  this._rowData = params.data;
@@ -0,0 +1,15 @@
1
+ import { ApplicationContext, HTMLBuilder } from '@sankhyalabs/core';
2
+ export const buildSearchPlus = ({ name, required, readOnly, dataUnit }) => {
3
+ const ezSearch = HTMLBuilder.parseElement(`<ez-search-plus
4
+ class="ez-grid grid_editor"
5
+ mode="slim"
6
+ suppress-empty-option=${required}
7
+ enabled=${!readOnly}
8
+ hide-description-input=${true}
9
+ />`);
10
+ const loader = ApplicationContext.getContextValue("__EZUI__SEARCH__PLUS__OPTION__LOADER__");
11
+ ezSearch.optionLoader = (argument) => loader(argument, name, dataUnit);
12
+ ezSearch.autoFocus = true;
13
+ ezSearch.valueGetter = () => ezSearch.getValueAsync();
14
+ return ezSearch;
15
+ };
@@ -576,7 +576,7 @@ export class EzList {
576
576
  return { id: item.id, label: item.label, check: evt.detail };
577
577
  }
578
578
  renderListWithGroups() {
579
- return h("div", { class: 'group-container', ref: el => (this._groupContainer = el), tabIndex: 0, onKeyDown: event => this.keyDownHandler(event) }, this._listGroupItems.map(group => {
579
+ return h("div", { class: 'group-container', ref: el => (this._groupContainer = el), tabIndex: this.ezSelectable ? 0 : undefined, onKeyDown: event => this.keyDownHandler(event) }, this._listGroupItems.map(group => {
580
580
  return (h("div", { id: this.getDivGroupId(group.group), class: 'group', key: group.group + group.items.length, onDrop: () => this.onDropGroup(group) }, h("label", { draggable: false, class: 'group-name', title: group.group }, group.group), h("section", { class: 'section-container', onDragOver: ev => ev.preventDefault() }, h("div", { class: 'group-items-container' }, h("div", { class: 'draggable-list' }, group.items.map((item, index) => (h("li", Object.assign({ id: 'item_' + item.id, class: {
581
581
  'selectable-container': this.ezSelectable,
582
582
  'hover-feedback': this.hoverFeedback,
@@ -586,7 +586,7 @@ export class EzList {
586
586
  }));
587
587
  }
588
588
  renderList() {
589
- return h("div", { class: 'items-container', ref: el => (this._itemContainer = el), tabIndex: 0, onKeyDown: event => {
589
+ return h("div", { class: 'items-container', ref: el => (this._itemContainer = el), tabIndex: this.ezSelectable ? 0 : undefined, onKeyDown: event => {
590
590
  this.keyDownHandler(event);
591
591
  } }, h("div", { class: 'draggable-list' }, this._listItems.map((item, index) => (h("li", Object.assign({ id: 'item_' + item.id, class: {
592
592
  'selectable-container': this.ezSelectable,
@@ -25,7 +25,7 @@ export class EzModal {
25
25
  }
26
26
  componentDidLoad() {
27
27
  this.observeOpened();
28
- new KeyboardManager({ propagate: false, element: this._element })
28
+ new KeyboardManager({ propagate: false, element: this._element, enableShadowDom: true })
29
29
  .bind("Enter", this.ezModalAction.emit.bind("OK"))
30
30
  .bind("Escape", () => this.closeModal())
31
31
  .bind("Esc", () => this.closeModal());
@@ -48,7 +48,7 @@ export class EzModalContainer {
48
48
  this._closeButton.focus();
49
49
  }
50
50
  render() {
51
- return (h(Host, null, h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusLast() }), h("div", { ref: ref => this._modalRef = ref, tabIndex: -1, class: "ez-modal-container__header-container" }, this.showTitleBar && (h("div", { class: "ez-modal-container__header ez-margin-bottom--medium" }, h("div", { class: "ez-col ez-align--middle ez-modal-container__title" }, h("h2", { class: "ez-text ez-title--large ez-title--primary ez-text--bold ez-margin-vertical--extra-small" }, this.modalTitle), this.modalSubTitle && (h("div", { class: "ez-text ez-text--medium ez-text--primary ez-margin-vertical--extra-small" }, this.modalSubTitle))), (this.showCloseButton && h("button", { ref: ref => this._closeButton = ref, class: "ez-modal-container__close-button", onClick: () => this.ezModalAction.emit(ModalAction.CLOSE) }, h("ez-icon", { class: "ez-modal-container__close-icon", size: "medium", iconName: "close" })))))), h("div", { class: "ez-modal-container__content" }, h("slot", null)), h("div", { class: "ez-modal-container__footer" }, this.cancelIsVisible() && (h("ez-button", { label: this.cancelButtonLabel, enabled: this.cancelButtonStatus !== ModalButtonStatus.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction.CANCEL) })), this.okIsVisible() && (h("ez-button", { ref: ref => this._okButton = ref, class: "ez-button--primary", label: this.okButtonLabel, enabled: this.okButtonStatus !== ModalButtonStatus.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction.OK) }))), h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusFirst() })));
51
+ return (h(Host, null, h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusLast() }), h("div", { ref: ref => this._modalRef = ref, tabIndex: -1, class: "ez-modal-container__header-container" }, this.showTitleBar && (h("div", { class: "ez-modal-container__header ez-margin-bottom--medium" }, h("div", { class: "ez-col ez-align--middle ez-modal-container__title" }, h("h2", { class: "ez-text ez-title--large ez-title--primary ez-text--bold ez-margin-vertical--extra-small" }, this.modalTitle), this.modalSubTitle && (h("div", { class: "ez-text ez-text--medium ez-text--primary ez-margin-vertical--extra-small" }, this.modalSubTitle))), (this.showCloseButton && h("button", { ref: ref => this._closeButton = ref, class: "ez-modal-container__close-button", onClick: () => this.ezModalAction.emit(ModalAction.CLOSE) }, h("ez-icon", { class: "ez-modal-container__close-icon", size: "medium", iconName: "close" })))))), h("div", { tabIndex: -1, class: "ez-modal-container__content" }, h("slot", null)), h("div", { tabIndex: -1, class: "ez-modal-container__footer" }, this.cancelIsVisible() && (h("ez-button", { label: this.cancelButtonLabel, enabled: this.cancelButtonStatus !== ModalButtonStatus.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction.CANCEL) })), this.okIsVisible() && (h("ez-button", { ref: ref => this._okButton = ref, class: "ez-button--primary", label: this.okButtonLabel, enabled: this.okButtonStatus !== ModalButtonStatus.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction.OK) }))), h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusFirst() })));
52
52
  }
53
53
  static get is() { return "ez-modal-container"; }
54
54
  static get encapsulation() { return "scoped"; }
@@ -25,7 +25,7 @@ export class EzPopup {
25
25
  if (this.opened && this._popupRef) {
26
26
  this._popupRef.focus();
27
27
  }
28
- new KeyboardManager({ propagate: false, element: this._element })
28
+ new KeyboardManager({ propagate: false, element: this._element, enableShadowDom: true })
29
29
  .bind("Enter", this.ezPopupAction.emit.bind("OK"))
30
30
  .bind("Escape", () => this.closePopup())
31
31
  .bind("Esc", () => this.closePopup());