@sankhyalabs/sankhyablocks 5.5.0 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/dist/cjs/{SnkMessageBuilder-26da04f7.js → SnkMessageBuilder-e64dce7f.js} +14 -0
  2. package/dist/cjs/index-8d94b7e0.js +7 -0
  3. package/dist/cjs/index-de79181a.js +201 -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 +2 -1
  8. package/dist/cjs/snk-crud.cjs.entry.js +2 -1
  9. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  10. package/dist/cjs/{snk-data-unit-c43df27b.js → snk-data-unit-85d6565e.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 -3
  13. package/dist/cjs/snk-expression-item.cjs.entry.js +213 -0
  14. package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +435 -0
  15. package/dist/cjs/snk-grid.cjs.entry.js +3 -2
  16. package/dist/cjs/{snk-guides-viewer-e6a65393.js → snk-guides-viewer-9784c527.js} +1 -1
  17. package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -2
  18. package/dist/cjs/snk-personalized-filter.cjs.entry.js +126 -0
  19. package/dist/cjs/snk-simple-bar_2.cjs.entry.js +2 -1
  20. package/dist/cjs/snk-taskbar.cjs.entry.js +2 -1
  21. package/dist/cjs/taskbar-elements-bc2598f9.js +118 -0
  22. package/dist/collection/collection-manifest.json +2 -0
  23. package/dist/collection/components/snk-filter-field-search/snk-filter-field-search.js +62 -69
  24. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.css +4 -0
  25. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +87 -0
  26. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/filter-operands/filter-operands.js +34 -0
  27. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.css +97 -0
  28. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.js +298 -0
  29. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.js +2 -2
  30. package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +63 -0
  31. package/dist/collection/lib/message/SnkMessageBuilder.js +2 -0
  32. package/dist/collection/lib/message/resources/snk-personalized-filter.msg.js +12 -0
  33. package/dist/collection/lib/store/index.js +2 -1
  34. package/dist/components/SnkMessageBuilder.js +14 -0
  35. package/dist/components/index.d.ts +2 -0
  36. package/dist/components/index.js +2 -0
  37. package/dist/components/index2.js +1 -1
  38. package/dist/components/index3.js +199 -0
  39. package/dist/components/snk-data-exporter2.js +1 -1
  40. package/dist/components/snk-expression-item.d.ts +11 -0
  41. package/dist/components/snk-expression-item.js +6 -0
  42. package/dist/components/snk-expression-item2.js +241 -0
  43. package/dist/components/snk-filter-field-search.js +1 -200
  44. package/dist/{esm/snk-filter-field-search.entry.js → components/snk-filter-field-search2.js} +65 -38
  45. package/dist/components/snk-filter-param-config.js +1 -273
  46. package/dist/{esm/snk-filter-param-config.entry.js → components/snk-filter-param-config2.js} +35 -11
  47. package/dist/components/snk-grid2.js +2 -1
  48. package/dist/components/snk-personalized-filter.d.ts +11 -0
  49. package/dist/components/snk-personalized-filter.js +158 -0
  50. package/dist/components/snk-taskbar2.js +3 -197
  51. package/dist/esm/{SnkMessageBuilder-7a9392e6.js → SnkMessageBuilder-f3590f65.js} +14 -0
  52. package/dist/esm/{index-6519a79e.js → index-507e19ec.js} +1 -1
  53. package/dist/esm/index-620ac460.js +7 -0
  54. package/dist/esm/index-8efbf198.js +199 -0
  55. package/dist/esm/loader.js +1 -1
  56. package/dist/esm/sankhyablocks.js +1 -1
  57. package/dist/esm/snk-application.entry.js +1 -1
  58. package/dist/esm/snk-attach.entry.js +3 -2
  59. package/dist/esm/snk-crud.entry.js +3 -2
  60. package/dist/esm/snk-data-exporter.entry.js +3 -3
  61. package/dist/esm/{snk-data-unit-f9e4c694.js → snk-data-unit-50b1660c.js} +1 -1
  62. package/dist/esm/snk-data-unit.entry.js +2 -2
  63. package/dist/esm/snk-detail-view.entry.js +5 -4
  64. package/dist/esm/snk-expression-item.entry.js +209 -0
  65. package/dist/esm/snk-filter-field-search_2.entry.js +430 -0
  66. package/dist/esm/snk-grid.entry.js +3 -2
  67. package/dist/esm/{snk-guides-viewer-62a9f74d.js → snk-guides-viewer-4d12f268.js} +2 -2
  68. package/dist/esm/snk-guides-viewer.entry.js +4 -3
  69. package/dist/esm/snk-personalized-filter.entry.js +122 -0
  70. package/dist/esm/snk-simple-bar_2.entry.js +3 -2
  71. package/dist/esm/snk-taskbar.entry.js +3 -2
  72. package/dist/esm/taskbar-elements-e6af3e93.js +115 -0
  73. package/dist/sankhyablocks/p-1dcfd32a.entry.js +1 -0
  74. package/dist/sankhyablocks/p-27e264d9.entry.js +1 -0
  75. package/dist/sankhyablocks/p-343699ad.entry.js +1 -0
  76. package/dist/sankhyablocks/{p-f2223502.js → p-3d3263b4.js} +1 -1
  77. package/dist/sankhyablocks/{p-b2523981.entry.js → p-3fbe2d69.entry.js} +1 -1
  78. package/dist/sankhyablocks/p-433dfa63.entry.js +1 -0
  79. package/dist/sankhyablocks/{p-f132e371.js → p-4c2015a9.js} +1 -1
  80. package/dist/sankhyablocks/p-4eefe631.entry.js +1 -0
  81. package/dist/sankhyablocks/p-6a02e236.js +1 -0
  82. package/dist/sankhyablocks/p-8bdf5e57.entry.js +1 -0
  83. package/dist/sankhyablocks/{p-a412992c.entry.js → p-c4417efb.entry.js} +1 -1
  84. package/dist/sankhyablocks/{p-92a0fca4.js → p-c9477950.js} +1 -1
  85. package/dist/sankhyablocks/{p-aeffd219.js → p-ccd26e3a.js} +1 -1
  86. package/dist/sankhyablocks/p-d410f45a.js +1 -0
  87. package/dist/sankhyablocks/p-df8f13b4.entry.js +1 -0
  88. package/dist/sankhyablocks/p-e9f42525.entry.js +1 -0
  89. package/dist/sankhyablocks/p-f344b811.entry.js +1 -0
  90. package/dist/sankhyablocks/p-f4184ce7.js +1 -0
  91. package/dist/sankhyablocks/p-fd4ed40a.entry.js +1 -0
  92. package/dist/sankhyablocks/p-ff96b509.entry.js +27 -0
  93. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  94. package/dist/types/components/snk-filter-field-search/interfaces/index.d.ts +14 -4
  95. package/dist/types/components/snk-filter-field-search/snk-filter-field-search.d.ts +13 -10
  96. package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +20 -0
  97. package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-item/filter-operands/filter-operands.d.ts +9 -0
  98. package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.d.ts +54 -0
  99. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IExpressionItem.d.ts +4 -2
  100. package/dist/types/components.d.ts +83 -9
  101. package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +7 -0
  102. package/dist/types/lib/message/resources/snk-personalized-filter.msg.d.ts +1 -0
  103. package/dist/types/lib/store/index.d.ts +1 -0
  104. package/package.json +1 -1
  105. package/react/components.d.ts +2 -0
  106. package/react/components.js +2 -0
  107. package/react/components.js.map +1 -1
  108. package/dist/cjs/snk-filter-field-search.cjs.entry.js +0 -185
  109. package/dist/cjs/snk-filter-param-config.cjs.entry.js +0 -256
  110. package/dist/cjs/taskbar-elements-80285601.js +0 -313
  111. package/dist/esm/taskbar-elements-055ba1ad.js +0 -309
  112. package/dist/sankhyablocks/p-4512cc6c.entry.js +0 -1
  113. package/dist/sankhyablocks/p-5cbbe1f7.entry.js +0 -1
  114. package/dist/sankhyablocks/p-63d01871.entry.js +0 -1
  115. package/dist/sankhyablocks/p-741b00ef.entry.js +0 -1
  116. package/dist/sankhyablocks/p-79d22df0.entry.js +0 -1
  117. package/dist/sankhyablocks/p-93d8fe00.entry.js +0 -1
  118. package/dist/sankhyablocks/p-999d1953.entry.js +0 -1
  119. package/dist/sankhyablocks/p-c3efd4eb.entry.js +0 -1
  120. package/dist/sankhyablocks/p-ebe876f5.entry.js +0 -1
  121. package/dist/sankhyablocks/p-ed438690.js +0 -1
  122. package/dist/sankhyablocks/p-f3d0c744.entry.js +0 -1
@@ -1,4 +1,4 @@
1
- import { h, r as registerInstance, c as createEvent } from './index-cfd4bb13.js';
1
+ import { h, proxyCustomElement, HTMLElement, createEvent } from '@stencil/core/internal/client';
2
2
  import { UserInterface, JSUtils, ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
3
3
 
4
4
  var SelectedItemType;
@@ -33,66 +33,69 @@ const ListItem = ({ userInterface, description }) => {
33
33
  const snkFilterFieldSearchCss = ".sc-snk-filter-field-search-h{--snk-filter-field-search--container-width:468px;--snk-filter-field-search--container-height:322px}.snk-filter-field-search__container.sc-snk-filter-field-search{display:flex;flex-direction:column;padding:var(--space--medium);width:var(--snk-filter-field-search--container-width);height:var(--snk-filter-field-search--container-height)}.snk-filter-field-search__section.sc-snk-filter-field-search{display:grid;grid-template-columns:1fr 1fr;place-items:flex-start;overflow:hidden;gap:var(--space--small)}.snk-filter-field-search__input.sc-snk-filter-field-search{margin-bottom:var(--space--medium)}.snk-filter-field-search__list_container.sc-snk-filter-field-search{display:flex;flex-direction:column}.snk-filter-field-search__list.sc-snk-filter-field-search{overflow-y:auto}";
34
34
 
35
35
  const SNK_CONTEXT_KEY = "__SNK__APPLICATION__";
36
- const SnkFilterFieldSearch = class {
37
- constructor(hostRef) {
38
- registerInstance(this, hostRef);
36
+ const SnkFilterFieldSearch = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
37
+ constructor() {
38
+ super();
39
+ this.__registerHost();
39
40
  this.ezSelectFilterItem = createEvent(this, "ezSelectFilterItem", 7);
40
41
  this._filterMetadataStorage = new Map();
41
- this._dataSource = null;
42
+ this._currentMetadata = null;
42
43
  this._filterText = "";
43
44
  this._isLoading = false;
44
45
  this.searchable = true;
46
+ this.fieldsDataSource = undefined;
45
47
  this.breadcrumbItems = [];
46
48
  this.linkItems = [];
47
49
  this.fieldItems = [];
48
50
  }
49
51
  /**
50
- * Define a fonte de dados do componente.
51
- * @param {IFilterLink} currentLink - Link atual da entidade.
52
- * @param {IFilterMetadata} fetchData - callback que executa a busca de dados.
53
- * @throws {Error} - Quando os metadados não forem válidos.
54
- * @throws {Error} - Quando o link atual não for do tipo link.
55
- */
56
- async setDataSource(currentLink, fetchData) {
52
+ * Realiza a abertura do componente e faz a primeira carga
53
+ * de dados.
54
+ * */
55
+ async show() {
57
56
  var _a;
57
+ (_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.show();
58
+ return this.loadData();
59
+ }
60
+ /**
61
+ * Filtra a fonte de dados do componente.
62
+ * @param {string} filterText - Texto para filtrar a fonte de dados.
63
+ * @throws {Error} - Quando o componente estiver com a propriedade searchable como true.
64
+ */
65
+ async applyFilter(filterText) {
66
+ if (this.searchable)
67
+ throw new Error('This method is not available when searchable is true');
68
+ this.handleFilterChange(filterText);
69
+ }
70
+ async loadData() {
58
71
  this._isLoading = true;
59
- let metadata = this._filterMetadataStorage.get(currentLink.uri);
72
+ let metadata;
73
+ if (this._currentLink != undefined) {
74
+ metadata = this._filterMetadataStorage.get(this._currentLink.uri);
75
+ }
60
76
  if (!metadata) {
61
- metadata = await fetchData(currentLink);
62
- this._filterMetadataStorage.set(currentLink.uri, metadata);
77
+ metadata = await this.fieldsDataSource.fetchData(this._currentLink);
78
+ this._currentLink = metadata.currentLink;
79
+ this._filterMetadataStorage.set(this._currentLink.uri, metadata);
63
80
  }
64
81
  const { fields, links } = metadata || {};
65
82
  if (!Array.isArray(fields) || !Array.isArray(links))
66
83
  throw new Error('Invalid metadata');
67
- if (currentLink.type !== SelectedItemType.LINK)
68
- throw new Error('The current link must be a link type');
69
- this._dataSource = metadata;
70
- this._currentLink = currentLink;
84
+ this._currentMetadata = metadata;
71
85
  this.mapDataSourceToLinkItems();
72
86
  this.mapDataSourceToFieldItems();
73
87
  this._isLoading = false;
74
- (_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.show();
75
88
  this._ezFieldList.scrollToTop();
76
89
  this._ezLinkList.scrollToTop();
77
90
  }
78
- /**
79
- * Filtra a fonte de dados do componente.
80
- * @param {string} filterText - Texto para filtrar a fonte de dados.
81
- * @throws {Error} - Quando o componente estiver com a propriedade searchable como true.
82
- */
83
- async filterDataSource(filterText) {
84
- if (this.searchable)
85
- throw new Error('This method is not available when searchable is true');
86
- this.handleFilterChange(filterText);
87
- }
88
91
  mapDataSourceToLinkItems() {
89
92
  var _a;
90
- const { links } = this._dataSource;
93
+ const { links } = this._currentMetadata;
91
94
  const filterLinkLabelMessage = this.getMessage('snkFilterFieldSearch.linkLabel', { link: (_a = this._currentLink) === null || _a === void 0 ? void 0 : _a.description });
92
95
  const items = links.map(link => (Object.assign({ label: link.description }, link)));
93
96
  this.linkItems = [{
94
97
  group: filterLinkLabelMessage,
95
- items
98
+ items,
96
99
  }];
97
100
  if (this.breadcrumbItems.length === 0) {
98
101
  this.breadcrumbItems = [Object.assign({ id: JSUtils.generateUUID(), label: this._currentLink.description }, this._currentLink)];
@@ -100,7 +103,7 @@ const SnkFilterFieldSearch = class {
100
103
  }
101
104
  mapDataSourceToFieldItems() {
102
105
  var _a;
103
- const { fields } = this._dataSource;
106
+ const { fields } = this._currentMetadata;
104
107
  const filterFieldLabelMessage = this.getMessage('snkFilterFieldSearch.fieldLabel', { link: (_a = this._currentLink) === null || _a === void 0 ? void 0 : _a.description });
105
108
  const filteredFields = fields.filter(field => {
106
109
  if (!this._currentLink)
@@ -132,7 +135,10 @@ const SnkFilterFieldSearch = class {
132
135
  else {
133
136
  this.breadcrumbItems = [...this.breadcrumbItems, Object.assign({ id: JSUtils.generateUUID(), label: item.description }, item)];
134
137
  }
135
- this.ezSelectFilterItem.emit(Object.assign(Object.assign({}, item), { type: SelectedItemType.LINK }));
138
+ const selectedItem = Object.assign(Object.assign({}, item), { type: SelectedItemType.LINK });
139
+ this._currentLink = selectedItem;
140
+ this.ezSelectFilterItem.emit(selectedItem);
141
+ this.loadData();
136
142
  }
137
143
  handleSelectField({ detail: item }) {
138
144
  var _a;
@@ -173,9 +179,30 @@ const SnkFilterFieldSearch = class {
173
179
  render() {
174
180
  var _a;
175
181
  const searchLabelMessage = this.getMessage('snkFilterFieldSearch.searchLabel');
176
- return (h("ez-popover", Object.assign({ ref: (el) => this._ezPopover = el, role: "dialog", "aria-hidden": !((_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.opened) }, this.getElementID('EzPopover')), h("div", { class: "snk-filter-field-search__container" }, h("header", { class: "snk-filter-field-search__header" }, this.searchable && !!searchLabelMessage && (h("ez-filter-input", Object.assign({ class: "snk-filter-field-search__input", label: searchLabelMessage, asyncSearch: true, canShowError: false, onEzSearching: (event) => this.handleFilterChange.bind(this)(event.detail), "aria-label": searchLabelMessage, "aria-required": "false", "aria-invalid": "false" }, this.getElementID('EzFilterInput')))), this.breadcrumbItems.length > 0 && (h("ez-breadcrumb", Object.assign({ items: this.breadcrumbItems, onSelectedItem: this.handleSelectLink.bind(this), role: "navigation", "aria-current": "step" }, this.getElementID('EzBreadcrumb')))), h("hr", { class: "ez-divider-horizontal ez-margin-vertical--medium" })), h("section", { class: "snk-filter-field-search__section" }, h("ez-list", Object.assign({ ref: (el) => this._ezLinkList = el, class: "snk-filter-field-search__list", id: "filterLinkList", useGroups: true, dataSource: this.linkItems, onEzSelectItem: this.handleSelectLink.bind(this), hoverFeedback: true, ezSelectable: true, itemSlotBuilder: ({ fieldCount }) => h("ez-badge", { label: fieldCount }), "aria-describedby": "filterLinkLabel" }, this.getElementID('EzListLinks'))), h("ez-list", Object.assign({ ref: (el) => this._ezFieldList = el, class: "snk-filter-field-search__list", id: "filterFieldList", useGroups: true, dataSource: this.fieldItems, onEzSelectItem: this.handleSelectField.bind(this), hoverFeedback: true, ezSelectable: true, itemSlotBuilder: ListItem, "aria-describedby": "filterFieldLabel" }, this.getElementID('EzListFields')))))));
182
+ return (h("ez-popover", Object.assign({ ref: (el) => this._ezPopover = el, role: "dialog", overlayType: "none", "aria-hidden": !((_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.opened) }, this.getElementID('EzPopover')), h("div", { class: "snk-filter-field-search__container" }, h("header", { class: "snk-filter-field-search__header" }, this.searchable && !!searchLabelMessage && (h("ez-filter-input", Object.assign({ class: "snk-filter-field-search__input", label: searchLabelMessage, asyncSearch: true, canShowError: false, onEzSearching: (event) => this.handleFilterChange.bind(this)(event.detail), "aria-label": searchLabelMessage, "aria-required": "false", "aria-invalid": "false" }, this.getElementID('EzFilterInput')))), this.breadcrumbItems.length > 0 && (h("ez-breadcrumb", Object.assign({ items: this.breadcrumbItems, onSelectedItem: this.handleSelectLink.bind(this), role: "navigation", "aria-current": "step" }, this.getElementID('EzBreadcrumb')))), h("hr", { class: "ez-divider-horizontal ez-margin-vertical--medium" })), h("section", { class: "snk-filter-field-search__section" }, h("ez-list", Object.assign({ ref: (el) => this._ezLinkList = el, class: "snk-filter-field-search__list", id: "filterLinkList", useGroups: true, dataSource: this.linkItems, onEzSelectItem: this.handleSelectLink.bind(this), hoverFeedback: true, ezSelectable: true, itemSlotBuilder: ({ fieldCount }) => h("ez-badge", { label: fieldCount }), "aria-describedby": "filterLinkLabel" }, this.getElementID('EzListLinks'))), h("ez-list", Object.assign({ ref: (el) => this._ezFieldList = el, class: "snk-filter-field-search__list", id: "filterFieldList", useGroups: true, dataSource: this.fieldItems, onEzSelectItem: this.handleSelectField.bind(this), hoverFeedback: true, ezSelectable: true, itemSlotBuilder: ListItem, "aria-describedby": "filterFieldLabel" }, this.getElementID('EzListFields')))))));
177
183
  }
178
- };
179
- SnkFilterFieldSearch.style = snkFilterFieldSearchCss;
184
+ static get style() { return snkFilterFieldSearchCss; }
185
+ }, [2, "snk-filter-field-search", {
186
+ "searchable": [4],
187
+ "fieldsDataSource": [16],
188
+ "breadcrumbItems": [32],
189
+ "linkItems": [32],
190
+ "fieldItems": [32],
191
+ "show": [64],
192
+ "applyFilter": [64]
193
+ }]);
194
+ function defineCustomElement() {
195
+ if (typeof customElements === "undefined") {
196
+ return;
197
+ }
198
+ const components = ["snk-filter-field-search"];
199
+ components.forEach(tagName => { switch (tagName) {
200
+ case "snk-filter-field-search":
201
+ if (!customElements.get(tagName)) {
202
+ customElements.define(tagName, SnkFilterFieldSearch);
203
+ }
204
+ break;
205
+ } });
206
+ }
180
207
 
181
- export { SnkFilterFieldSearch as snk_filter_field_search };
208
+ export { SnkFilterFieldSearch as S, SelectedItemType as a, defineCustomElement as d };
@@ -1,276 +1,4 @@
1
- import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
- import { StringUtils, DataType, ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
3
- import { ModalAction } from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container';
4
- import { F as FilterOperand, a as FilterConfigType, b as FilterEntities, c as FilterUserConfigTypes } from './index2.js';
5
-
6
- class PersonalizedFilterUtils {
7
- /**
8
- * Cria uma expressão de filtro a partir de um IExpressionItem.
9
- * @param expressionItem - Objeto com os parâmetros necessários para montar a expressão.
10
- * @returns Retorna a expressão de filtro.
11
- */
12
- static buildFilterExpression(expressionItem) {
13
- if (expressionItem == undefined) {
14
- return;
15
- }
16
- const value = this.buildVariableParameterValue(expressionItem);
17
- let expression = expressionItem.expression || "";
18
- switch (expressionItem.operand) {
19
- case FilterOperand.IN:
20
- expression += ` ${expressionItem.operand} (${value})`;
21
- break;
22
- case FilterOperand.NULL:
23
- case FilterOperand.NOT_NULL:
24
- expression += ` IS ${value}`;
25
- break;
26
- case FilterOperand.LIKE:
27
- expression += ` LIKE '%${value}%'`;
28
- break;
29
- case FilterOperand.START_WITH:
30
- expression += ` LIKE '${value}%'`;
31
- break;
32
- case FilterOperand.FINISHED_WITH:
33
- expression += ` LIKE '%${value}'`;
34
- break;
35
- default:
36
- expression += ` ${expressionItem.operand} ${value}`;
37
- }
38
- return expression;
39
- }
40
- /**
41
- * Obtém o valor do parâmetro a partir de um IExpressionItem.
42
- * @param expressionItem - Objeto com os parâmetros necessários para montar a expressão.
43
- * @returns Retorna o valor do parâmetro.
44
- */
45
- static buildVariableParameterValue(expressionItem) {
46
- if (expressionItem == undefined) {
47
- return;
48
- }
49
- if (expressionItem.systemConfig != undefined) {
50
- const systemConfig = expressionItem.systemConfig;
51
- return `?:{entidade=${systemConfig.entity || ""};campo=${systemConfig.fieldName || ""}}`;
52
- }
53
- if (expressionItem.userConfig != undefined) {
54
- const userConfig = expressionItem.userConfig;
55
- return `?:{desc=${userConfig.description || ""};tipo=${userConfig.type || ""}}`;
56
- }
57
- return `?:{entidade=${expressionItem.entityName || ""};campo=${expressionItem.fieldName || ""}}`;
58
- }
59
- }
60
-
61
- const snkFilterParamConfigCss = ".sc-snk-filter-param-config-h{--snk-filter-param-config__expression--color:var(--title--primary, #2b3a54);display:flex;position:relative}.snk-filter-param-config__expression.sc-snk-filter-param-config{--text-area__input--disabled--color:var(--snk-filter-param-config__expression--color)}";
62
-
63
- const SnkFilterParamConfig$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
64
- constructor() {
65
- super();
66
- this.__registerHost();
67
- this._opened = false;
68
- this._configType = FilterConfigType.SYSTEM_CONFIG;
69
- this._expressionItem = undefined;
70
- this._informedInstance = false;
71
- this._canSave = false;
72
- this.messagesBuilder = undefined;
73
- }
74
- open(expressionItem) {
75
- this._opened = true;
76
- this._expressionItem = expressionItem;
77
- this.loadValues();
78
- return new Promise(accept => {
79
- this._promiseResolver = accept;
80
- });
81
- }
82
- close() {
83
- this._opened = false;
84
- return new Promise(accept => {
85
- this._promiseResolver = accept;
86
- });
87
- }
88
- /**
89
- * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
90
- * através de um pequeno modulo na estrutura da aplicação:
91
- * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
92
- * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-param-config.msg.ts"
93
- */
94
- getMessage(key, params) {
95
- return this.messagesBuilder.getMessage(key, params);
96
- }
97
- getConfigValue(configName, inputName, inputAlias = "") {
98
- var _a, _b, _c;
99
- return ((_b = (_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a[configName]) === null || _b === void 0 ? void 0 : _b[inputName])
100
- || ((_c = this._expressionItem) === null || _c === void 0 ? void 0 : _c[inputAlias || inputName]);
101
- }
102
- loadValues() {
103
- var _a;
104
- const entityName = this.getConfigValue("systemConfig", "entity", "entityName");
105
- const fieldName = this.getConfigValue("systemConfig", "fieldName");
106
- const description = this.getConfigValue("userConfig", "description");
107
- const type = this.getConfigValue("userConfig", "type");
108
- if (((_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a.userConfig) != undefined) {
109
- this._configType = FilterConfigType.USER_CONFIG;
110
- }
111
- else {
112
- this._configType = FilterConfigType.SYSTEM_CONFIG;
113
- }
114
- if (!StringUtils.isEmpty(entityName) && !StringUtils.isEmpty(fieldName)) {
115
- this._instanceElement.value = { value: entityName, label: "" };
116
- this._fieldElement.value = { value: fieldName, label: "" };
117
- }
118
- if (!StringUtils.isEmpty(description) && !StringUtils.isEmpty(type)) {
119
- this._descriptionElement.value = description;
120
- this._typeElement.value = type;
121
- }
122
- this.buildFilterExpression();
123
- }
124
- changeDefinitionUsed(option) {
125
- this._configType = option !== null && option !== void 0 ? option : FilterConfigType.SYSTEM_CONFIG;
126
- if (this._configType === FilterConfigType.SYSTEM_CONFIG) {
127
- const entityName = this.getConfigValue("systemConfig", "entity", "entityName");
128
- const fieldName = this.getConfigValue("systemConfig", "fieldName");
129
- this._instanceElement.value = this._instanceElement.value || { value: entityName, label: "" };
130
- this._fieldElement.value = this._fieldElement.value || { value: fieldName, label: "" };
131
- }
132
- else if (this._configType === FilterConfigType.USER_CONFIG) {
133
- const description = this.getConfigValue("userConfig", "description");
134
- const type = this.getConfigValue("userConfig", "type");
135
- this._descriptionElement.value = this._descriptionElement.value || description;
136
- this._typeElement.value = this._typeElement.value || type;
137
- }
138
- this.buildFilterExpression();
139
- }
140
- getTypeValue() {
141
- var _a;
142
- const value = (_a = this._typeElement) === null || _a === void 0 ? void 0 : _a.value;
143
- return ((value === null || value === void 0 ? void 0 : value.value) || value);
144
- }
145
- getExpressionValues() {
146
- var _a, _b, _c, _d, _e;
147
- let systemConfig;
148
- let userConfig;
149
- if (this._configType === FilterConfigType.SYSTEM_CONFIG) {
150
- const entity = (_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value;
151
- const fieldName = (_d = (_c = this._fieldElement) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.value;
152
- systemConfig = { entity, fieldName };
153
- }
154
- else if (this._configType === FilterConfigType.USER_CONFIG) {
155
- const description = (_e = this._descriptionElement) === null || _e === void 0 ? void 0 : _e.value;
156
- const type = this.getTypeValue();
157
- userConfig = { description, type };
158
- }
159
- return Object.assign(Object.assign(Object.assign({}, this._expressionItem), { systemConfig }), { userConfig });
160
- }
161
- isEnabled(value) {
162
- return this._configType === value;
163
- }
164
- isInformedInstance() {
165
- var _a, _b;
166
- return !StringUtils.isEmpty((_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value);
167
- }
168
- save() {
169
- var _a;
170
- this._expressionItem = Object.assign(Object.assign({}, this.getExpressionValues()), { expression: (_a = this._expressionElement) === null || _a === void 0 ? void 0 : _a.value });
171
- this._promiseResolver(this._expressionItem);
172
- this._opened = false;
173
- }
174
- buildFilterExpression() {
175
- var _a;
176
- this._informedInstance = this.isInformedInstance();
177
- const expression = PersonalizedFilterUtils.buildFilterExpression(this.getExpressionValues());
178
- this._expressionElement.value = expression || ((_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a.expression);
179
- this._canSave = this.getCanSave();
180
- }
181
- handleChangeInstance() {
182
- this._informedInstance = this.isInformedInstance();
183
- if (this._fieldElement != undefined && !StringUtils.isEmpty(this._fieldElement.value)) {
184
- this._fieldElement.value = null;
185
- }
186
- this.buildFilterExpression();
187
- }
188
- getInstanceCriteria() {
189
- var _a, _b;
190
- const value = (_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value;
191
- return {
192
- expression: "this.NOMETAB = (SELECT NOMETAB FROM TDDINS WHERE NOMEINSTANCIA = ?)",
193
- params: [
194
- {
195
- name: "NOMEINSTANCIA",
196
- dataType: DataType.TEXT,
197
- value
198
- }
199
- ]
200
- };
201
- }
202
- onSearch({ mode, argument }, entity) {
203
- if (this._application == undefined) {
204
- return;
205
- }
206
- const isField = entity === FilterEntities.FIELD;
207
- const criteria = isField ? this.getInstanceCriteria() : undefined;
208
- const messageKey = `snkFilterParamConfig.label${isField ? "Field" : "Instance"}`;
209
- const entityDescription = this.getMessage(messageKey);
210
- const searchOptions = {
211
- descriptionFieldName: isField ? "DESCRCAMPO" : "DESCRINSTANCIA",
212
- codeFieldName: isField ? "NOMECAMPO" : "NOMEINSTANCIA",
213
- showInactives: false
214
- };
215
- const options = {
216
- entity,
217
- entityDescription,
218
- criteria,
219
- searchOptions
220
- };
221
- return this._application.executePreparedSearch(mode, argument, options);
222
- }
223
- getElementID(sufix) {
224
- return {
225
- [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(sufix)
226
- };
227
- }
228
- getCanSave() {
229
- var _a;
230
- if (this._configType === FilterConfigType.USER_CONFIG) {
231
- const description = (_a = this._descriptionElement) === null || _a === void 0 ? void 0 : _a.value;
232
- const type = this.getTypeValue();
233
- return !StringUtils.isEmpty(description) && !StringUtils.isEmpty(type);
234
- }
235
- return true;
236
- }
237
- componentWillLoad() {
238
- this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
239
- }
240
- render() {
241
- ElementIDUtils.addIDInfoIfNotExists(this._element, 'snkFilterParamConfig');
242
- return (h("ez-popup", Object.assign({ useHeader: false, size: "small", heightMode: "auto", opened: this._opened }, this.getElementID("popup")), h("ez-modal-container", Object.assign({ onEzModalAction: (evt) => {
243
- if (evt.detail === ModalAction.CLOSE)
244
- this.close();
245
- }, modalTitle: this.getMessage("snkFilterParamConfig.modalTitle") }, this.getElementID("modalContainer")), h("div", { class: "ez-flex" }, h("div", { class: "ez-col ez-col--sd-6 ez-flex--column" }, h("ez-radio-button", Object.assign({ value: this._configType, onEzChange: (evt) => this.changeDefinitionUsed(evt.detail) }, this.getElementID("systemConfigOption")), h("ez-radio-button-option", { label: this.getMessage("snkFilterParamConfig.labelSystemConfig"), value: FilterConfigType.SYSTEM_CONFIG })), h("ez-search", Object.assign({ ref: (ref) => this._instanceElement = ref, label: this.getMessage("snkFilterParamConfig.labelInstance"), enabled: this.isEnabled(FilterConfigType.SYSTEM_CONFIG), suppressEmptyOption: true, showOptionValue: false, showSelectedValue: false, onEzChange: () => this.handleChangeInstance(), optionLoader: (searchArgument) => this.onSearch(searchArgument, FilterEntities.INSTANCE) }, this.getElementID("configFindEntity"))), h("ez-search", Object.assign({ ref: (ref) => this._fieldElement = ref, label: this.getMessage("snkFilterParamConfig.labelField"), enabled: this.isEnabled(FilterConfigType.SYSTEM_CONFIG) && this._informedInstance, suppressEmptyOption: true, showOptionValue: false, showSelectedValue: false, onEzChange: () => this.buildFilterExpression(), optionLoader: (searchArgument) => this.onSearch(searchArgument, FilterEntities.FIELD) }, this.getElementID("configFindField")))), h("div", { class: "ez-flex ez-padding--medium" }, h("hr", { class: "ez-divider-vertical" })), h("div", { class: "ez-col ez-col--sd-6 ez-flex--column" }, h("ez-radio-button", Object.assign({ value: this._configType, onEzChange: (evt) => this.changeDefinitionUsed(evt.detail) }, this.getElementID("userConfigOption")), h("ez-radio-button-option", { label: this.getMessage("snkFilterParamConfig.labelUserConfig"), value: FilterConfigType.USER_CONFIG })), h("ez-text-input", Object.assign({ ref: (ref) => this._descriptionElement = ref, label: this.getMessage("snkFilterParamConfig.labelDescription"), enabled: this.isEnabled(FilterConfigType.USER_CONFIG), onEzChange: () => this.buildFilterExpression() }, this.getElementID("configParamLabel"))), h("ez-combo-box", Object.assign({ ref: (ref) => this._typeElement = ref, label: this.getMessage("snkFilterParamConfig.labelType"), enabled: this.isEnabled(FilterConfigType.USER_CONFIG), suppressEmptyOption: true, onEzChange: () => this.buildFilterExpression() }, this.getElementID("configParamType")), Object.keys(FilterUserConfigTypes).map((configType) => {
246
- return (h("option", { value: FilterUserConfigTypes[configType] }, this.getMessage(`snkFilterParamConfig.labelTypeValues.${configType.toLowerCase()}`)));
247
- })))), h("ez-text-area", Object.assign({ ref: (ref) => this._expressionElement = ref, class: "snk-filter-param-config__expression", label: this.getMessage("snkFilterParamConfig.labelExpression"), enabled: false }, this.getElementID("presentationExpression"))), h("div", { class: "ez-col ez-col--sd-12 ez-flex--justify-end ez-margin-vertical--small" }, h("ez-button", Object.assign({ class: "ez-padding-right--medium", label: this.getMessage("snkFilterParamConfig.labelCancel"), onClick: () => this.close() }, this.getElementID("cancelEditParam"))), h("ez-button", Object.assign({ class: "ez-button--primary", label: this.getMessage("snkFilterParamConfig.labelSave"), onClick: () => this.save(), enabled: this._canSave }, this.getElementID("saveEditParam")))))));
248
- }
249
- get _element() { return this; }
250
- static get style() { return snkFilterParamConfigCss; }
251
- }, [2, "snk-filter-param-config", {
252
- "messagesBuilder": [1040],
253
- "_opened": [32],
254
- "_configType": [32],
255
- "_expressionItem": [32],
256
- "_informedInstance": [32],
257
- "_canSave": [32],
258
- "open": [64],
259
- "close": [64]
260
- }]);
261
- function defineCustomElement$1() {
262
- if (typeof customElements === "undefined") {
263
- return;
264
- }
265
- const components = ["snk-filter-param-config"];
266
- components.forEach(tagName => { switch (tagName) {
267
- case "snk-filter-param-config":
268
- if (!customElements.get(tagName)) {
269
- customElements.define(tagName, SnkFilterParamConfig$1);
270
- }
271
- break;
272
- } });
273
- }
1
+ import { S as SnkFilterParamConfig$1, d as defineCustomElement$1 } from './snk-filter-param-config2.js';
274
2
 
275
3
  const SnkFilterParamConfig = SnkFilterParamConfig$1;
276
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,7 +1,7 @@
1
- import { r as registerInstance, h, g as getElement } from './index-cfd4bb13.js';
1
+ import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
2
  import { StringUtils, DataType, ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
3
3
  import { ModalAction } from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container';
4
- import { F as FilterOperand, c as FilterConfigType, d as FilterEntities, e as FilterUserConfigTypes } from './index-6519a79e.js';
4
+ import { a as FilterOperand, d as FilterConfigType, e as FilterEntities, F as FilterUserConfigTypes } from './index2.js';
5
5
 
6
6
  class PersonalizedFilterUtils {
7
7
  /**
@@ -58,11 +58,12 @@ class PersonalizedFilterUtils {
58
58
  }
59
59
  }
60
60
 
61
- const snkFilterParamConfigCss = ".sc-snk-filter-param-config-h{--snk-filter-param-config__expression--color:var(--title--primary, #2b3a54);display:flex;position:relative}.snk-filter-param-config__expression.sc-snk-filter-param-config{--text-area__input--disabled--color:var(--snk-filter-param-config__expression--color)}";
61
+ const snkFilterParamConfigCss = ":host{--snk-filter-param-config__expression--color:var(--title--primary, #2b3a54);display:flex;position:relative}.snk-filter-param-config__expression{--text-area__input--disabled--color:var(--snk-filter-param-config__expression--color)}";
62
62
 
63
- const SnkFilterParamConfig = class {
64
- constructor(hostRef) {
65
- registerInstance(this, hostRef);
63
+ const SnkFilterParamConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
64
+ constructor() {
65
+ super();
66
+ this.__registerHost();
66
67
  this._opened = false;
67
68
  this._configType = FilterConfigType.SYSTEM_CONFIG;
68
69
  this._expressionItem = undefined;
@@ -91,7 +92,8 @@ const SnkFilterParamConfig = class {
91
92
  * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-param-config.msg.ts"
92
93
  */
93
94
  getMessage(key, params) {
94
- return this.messagesBuilder.getMessage(key, params);
95
+ var _a;
96
+ return (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, params);
95
97
  }
96
98
  getConfigValue(configName, inputName, inputAlias = "") {
97
99
  var _a, _b, _c;
@@ -245,8 +247,30 @@ const SnkFilterParamConfig = class {
245
247
  return (h("option", { value: FilterUserConfigTypes[configType] }, this.getMessage(`snkFilterParamConfig.labelTypeValues.${configType.toLowerCase()}`)));
246
248
  })))), h("ez-text-area", Object.assign({ ref: (ref) => this._expressionElement = ref, class: "snk-filter-param-config__expression", label: this.getMessage("snkFilterParamConfig.labelExpression"), enabled: false }, this.getElementID("presentationExpression"))), h("div", { class: "ez-col ez-col--sd-12 ez-flex--justify-end ez-margin-vertical--small" }, h("ez-button", Object.assign({ class: "ez-padding-right--medium", label: this.getMessage("snkFilterParamConfig.labelCancel"), onClick: () => this.close() }, this.getElementID("cancelEditParam"))), h("ez-button", Object.assign({ class: "ez-button--primary", label: this.getMessage("snkFilterParamConfig.labelSave"), onClick: () => this.save(), enabled: this._canSave }, this.getElementID("saveEditParam")))))));
247
249
  }
248
- get _element() { return getElement(this); }
249
- };
250
- SnkFilterParamConfig.style = snkFilterParamConfigCss;
250
+ get _element() { return this; }
251
+ static get style() { return snkFilterParamConfigCss; }
252
+ }, [0, "snk-filter-param-config", {
253
+ "messagesBuilder": [1040],
254
+ "_opened": [32],
255
+ "_configType": [32],
256
+ "_expressionItem": [32],
257
+ "_informedInstance": [32],
258
+ "_canSave": [32],
259
+ "open": [64],
260
+ "close": [64]
261
+ }]);
262
+ function defineCustomElement() {
263
+ if (typeof customElements === "undefined") {
264
+ return;
265
+ }
266
+ const components = ["snk-filter-param-config"];
267
+ components.forEach(tagName => { switch (tagName) {
268
+ case "snk-filter-param-config":
269
+ if (!customElements.get(tagName)) {
270
+ customElements.define(tagName, SnkFilterParamConfig);
271
+ }
272
+ break;
273
+ } });
274
+ }
251
275
 
252
- export { SnkFilterParamConfig as snk_filter_param_config };
276
+ export { SnkFilterParamConfig as S, defineCustomElement as d };
@@ -1,10 +1,11 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
2
  import { VersionUtils, ElementIDUtils, ApplicationContext, DataType } from '@sankhyalabs/core';
3
3
  import { UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
4
- import { T as TaskbarElement, s as store, d as defineCustomElement$1 } from './snk-taskbar2.js';
4
+ import { T as TaskbarElement, d as defineCustomElement$1 } from './snk-taskbar2.js';
5
5
  import { C as ConfigStorage } from './ConfigStorage.js';
6
6
  import { P as PresentationMode } from './index2.js';
7
7
  import { T as TaskbarProcessor } from './taskbar-processor.js';
8
+ import { s as store } from './index3.js';
8
9
  import { d as defineCustomElement$a } from './snk-data-exporter2.js';
9
10
  import { d as defineCustomElement$9 } from './snk-exporter-email-sender2.js';
10
11
  import { d as defineCustomElement$8 } from './snk-filter-bar2.js';
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface SnkPersonalizedFilter extends Components.SnkPersonalizedFilter, HTMLElement {}
4
+ export const SnkPersonalizedFilter: {
5
+ prototype: SnkPersonalizedFilter;
6
+ new (): SnkPersonalizedFilter;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;