@sankhyalabs/sankhyablocks 1.4.0-beta.2 → 1.4.0-beta.4

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 (152) hide show
  1. package/dist/cjs/{index-b0b676c5.js → index-6fcf07f3.js} +159 -1515
  2. package/dist/cjs/loader.cjs.js +2 -18
  3. package/dist/cjs/sankhyablocks.cjs.js +4 -116
  4. package/dist/cjs/snk-application.cjs.entry.js +53 -217
  5. package/dist/cjs/snk-crud.cjs.entry.js +9 -3
  6. package/dist/cjs/snk-data-unit.cjs.entry.js +23 -23
  7. package/dist/cjs/snk-filter-bar_5.cjs.entry.js +883 -0
  8. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
  9. package/dist/cjs/snk-filter-detail.cjs.entry.js +32 -21
  10. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +1 -1
  11. package/dist/cjs/snk-filter-number.cjs.entry.js +1 -1
  12. package/dist/cjs/snk-filter-period.cjs.entry.js +1 -1
  13. package/dist/cjs/snk-filter-personalized.cjs.entry.js +23 -31
  14. package/dist/cjs/snk-filter-search.cjs.entry.js +3 -12
  15. package/dist/cjs/snk-filter-text.cjs.entry.js +1 -1
  16. package/dist/cjs/{snk-form.cjs.entry.js → snk-form_2.cjs.entry.js} +119 -5
  17. package/dist/cjs/snk-pesquisa.cjs.entry.js +5 -5
  18. package/dist/cjs/{taskbar-elements-283c737e.js → taskbar-elements-aedfeae6.js} +1 -1
  19. package/dist/cjs/teste-pesquisa.cjs.entry.js +5 -5
  20. package/dist/collection/components/snk-crud/snk-crud.js +29 -0
  21. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +0 -39
  22. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +0 -39
  23. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +30 -36
  24. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +3 -14
  25. package/dist/collection/components/snk-filter-bar/filter-list/snk-filter-list.js +4 -12
  26. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +3 -3
  27. package/dist/components/index.js +0 -4
  28. package/dist/components/snk-application2.js +13 -177
  29. package/dist/components/snk-crud.js +9 -2
  30. package/dist/components/snk-data-unit.js +2 -2
  31. package/dist/components/snk-filter-bar2.js +4 -2
  32. package/dist/components/snk-filter-detail2.js +31 -21
  33. package/dist/components/snk-filter-item2.js +4 -15
  34. package/dist/components/snk-filter-list2.js +5 -13
  35. package/dist/components/snk-filter-modal2.js +4 -19
  36. package/dist/components/snk-filter-personalized.js +3 -13
  37. package/dist/components/snk-filter-search.js +2 -13
  38. package/dist/components/snk-form2.js +1 -1
  39. package/dist/components/snk-grid2.js +1 -1
  40. package/dist/components/snk-pesquisa2.js +1 -1
  41. package/dist/components/snk-taskbar2.js +1 -1
  42. package/dist/components/teste-pesquisa.js +1 -1
  43. package/dist/{sankhyablocks/index-2b4d2d14.js → esm/index-81dda3cf.js} +160 -1508
  44. package/dist/esm/loader.js +2 -18
  45. package/dist/esm/sankhyablocks.js +4 -116
  46. package/dist/esm/snk-application.entry.js +14 -178
  47. package/dist/esm/snk-crud.entry.js +8 -2
  48. package/dist/esm/snk-data-unit.entry.js +3 -3
  49. package/dist/esm/{snk-filter-bar.entry.js → snk-filter-bar_5.entry.js} +417 -4
  50. package/dist/esm/snk-filter-binary-select.entry.js +1 -1
  51. package/dist/esm/snk-filter-detail.entry.js +32 -21
  52. package/dist/esm/snk-filter-multi-select.entry.js +1 -1
  53. package/dist/esm/snk-filter-number.entry.js +1 -1
  54. package/dist/esm/snk-filter-period.entry.js +1 -1
  55. package/dist/esm/snk-filter-personalized.entry.js +3 -11
  56. package/dist/esm/snk-filter-search.entry.js +2 -11
  57. package/dist/esm/snk-filter-text.entry.js +1 -1
  58. package/dist/{sankhyablocks/snk-form.entry.js → esm/snk-form_2.entry.js} +117 -4
  59. package/dist/esm/snk-pesquisa.entry.js +2 -2
  60. package/dist/esm/{taskbar-elements-35d64ff9.js → taskbar-elements-38eb5d51.js} +1 -1
  61. package/dist/esm/teste-pesquisa.entry.js +2 -2
  62. package/dist/sankhyablocks/index.esm.js +0 -1
  63. package/dist/sankhyablocks/p-01823784.entry.js +1 -0
  64. package/dist/sankhyablocks/p-0352c0e2.entry.js +1 -0
  65. package/dist/sankhyablocks/p-07ebda01.entry.js +1 -0
  66. package/dist/sankhyablocks/p-46caa101.entry.js +1 -0
  67. package/dist/sankhyablocks/p-586e2522.js +1 -0
  68. package/dist/sankhyablocks/p-6f8303f3.entry.js +1 -0
  69. package/dist/sankhyablocks/p-746fc78b.entry.js +1 -0
  70. package/dist/sankhyablocks/p-77216252.entry.js +1 -0
  71. package/dist/sankhyablocks/p-86f15ffe.js +1 -0
  72. package/dist/sankhyablocks/p-8bbc0cbb.entry.js +74 -0
  73. package/dist/sankhyablocks/p-8f3c5709.entry.js +1 -0
  74. package/dist/sankhyablocks/p-97009a2c.entry.js +1 -0
  75. package/dist/sankhyablocks/p-9dd2b8cb.js +1 -0
  76. package/dist/sankhyablocks/p-aecf3e0a.entry.js +1 -0
  77. package/dist/sankhyablocks/p-c1c3b5d8.entry.js +1 -0
  78. package/dist/sankhyablocks/p-c9eec639.entry.js +1 -0
  79. package/dist/sankhyablocks/p-eea6444c.entry.js +1 -0
  80. package/dist/sankhyablocks/p-fac2b6a9.js +2 -0
  81. package/dist/sankhyablocks/p-fb705f81.entry.js +1 -0
  82. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -129
  83. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +0 -2
  84. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +0 -2
  85. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +1 -1
  86. package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +1 -1
  87. package/dist/types/components.d.ts +4 -10
  88. package/package.json +1 -1
  89. package/react/components.d.ts +19 -0
  90. package/react/components.js +19 -0
  91. package/react/components.js.map +1 -1
  92. package/dist/cjs/app-globals-3a1e7e63.js +0 -5
  93. package/dist/cjs/css-shim-b8158822.js +0 -6
  94. package/dist/cjs/dom-36862b77.js +0 -75
  95. package/dist/cjs/index-84fe3b86.js +0 -20
  96. package/dist/cjs/index-93965c41.js +0 -141
  97. package/dist/cjs/index-e90ae303.js +0 -2408
  98. package/dist/cjs/shadow-css-346c0795.js +0 -389
  99. package/dist/cjs/snk-filter-bar.cjs.entry.js +0 -466
  100. package/dist/cjs/snk-filter-item.cjs.entry.js +0 -177
  101. package/dist/cjs/snk-filter-list.cjs.entry.js +0 -91
  102. package/dist/cjs/snk-filter-modal.cjs.entry.js +0 -37
  103. package/dist/cjs/snk-grid.cjs.entry.js +0 -79
  104. package/dist/cjs/snk-taskbar.cjs.entry.js +0 -160
  105. package/dist/cjs/taskbar-processor-6bd0d35c.js +0 -47
  106. package/dist/components/index2.js +0 -2394
  107. package/dist/components/index3.js +0 -139
  108. package/dist/esm/app-globals-0f993ce5.js +0 -3
  109. package/dist/esm/css-shim-b3f2ee8d.js +0 -4
  110. package/dist/esm/dom-665d6011.js +0 -73
  111. package/dist/esm/index-2b4d2d14.js +0 -3262
  112. package/dist/esm/index-5992b7e6.js +0 -139
  113. package/dist/esm/index-c683b2b0.js +0 -2394
  114. package/dist/esm/index-c71285cb.js +0 -17
  115. package/dist/esm/shadow-css-b18e99d7.js +0 -387
  116. package/dist/esm/snk-filter-item.entry.js +0 -173
  117. package/dist/esm/snk-filter-list.entry.js +0 -87
  118. package/dist/esm/snk-filter-modal.entry.js +0 -33
  119. package/dist/esm/snk-form.entry.js +0 -129
  120. package/dist/esm/snk-grid.entry.js +0 -75
  121. package/dist/esm/snk-taskbar.entry.js +0 -156
  122. package/dist/esm/taskbar-processor-aa6772c9.js +0 -45
  123. package/dist/sankhyablocks/SnkMessageBuilder-35a20271.js +0 -199
  124. package/dist/sankhyablocks/app-globals-0f993ce5.js +0 -3
  125. package/dist/sankhyablocks/css-shim-b3f2ee8d.js +0 -4
  126. package/dist/sankhyablocks/dom-665d6011.js +0 -73
  127. package/dist/sankhyablocks/filter-item-type.enum-a79b2fa8.js +0 -14
  128. package/dist/sankhyablocks/index-5992b7e6.js +0 -139
  129. package/dist/sankhyablocks/index-c683b2b0.js +0 -2394
  130. package/dist/sankhyablocks/index-c71285cb.js +0 -17
  131. package/dist/sankhyablocks/shadow-css-b18e99d7.js +0 -387
  132. package/dist/sankhyablocks/snk-application.entry.js +0 -8166
  133. package/dist/sankhyablocks/snk-crud.entry.js +0 -66
  134. package/dist/sankhyablocks/snk-data-unit.entry.js +0 -268
  135. package/dist/sankhyablocks/snk-filter-bar.entry.js +0 -462
  136. package/dist/sankhyablocks/snk-filter-binary-select.entry.js +0 -43
  137. package/dist/sankhyablocks/snk-filter-detail.entry.js +0 -80
  138. package/dist/sankhyablocks/snk-filter-item.entry.js +0 -173
  139. package/dist/sankhyablocks/snk-filter-list.entry.js +0 -87
  140. package/dist/sankhyablocks/snk-filter-modal.entry.js +0 -33
  141. package/dist/sankhyablocks/snk-filter-multi-select.entry.js +0 -19
  142. package/dist/sankhyablocks/snk-filter-number.entry.js +0 -20
  143. package/dist/sankhyablocks/snk-filter-period.entry.js +0 -33
  144. package/dist/sankhyablocks/snk-filter-personalized.entry.js +0 -85
  145. package/dist/sankhyablocks/snk-filter-search.entry.js +0 -40
  146. package/dist/sankhyablocks/snk-filter-text.entry.js +0 -18
  147. package/dist/sankhyablocks/snk-grid.entry.js +0 -75
  148. package/dist/sankhyablocks/snk-pesquisa.entry.js +0 -311
  149. package/dist/sankhyablocks/snk-taskbar.entry.js +0 -156
  150. package/dist/sankhyablocks/taskbar-elements-35d64ff9.js +0 -90
  151. package/dist/sankhyablocks/taskbar-processor-aa6772c9.js +0 -45
  152. package/dist/sankhyablocks/teste-pesquisa.entry.js +0 -33
@@ -1,173 +0,0 @@
1
- import { r as registerInstance, e as createEvent, h, f as Host, g as getElement } from './index-2b4d2d14.js';
2
- import { F as FloatingManager } from './index-c683b2b0.js';
3
- import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
4
-
5
- const SnkFilterItem = class {
6
- constructor(hostRef) {
7
- registerInstance(this, hostRef);
8
- this.filterChange = createEvent(this, "filterChange", 7);
9
- this.innerClickCheck = (floatingContainer, node) => {
10
- if (this._popover.keepOpened) {
11
- return true;
12
- }
13
- if (node && floatingContainer) {
14
- if (!node.offsetParent) {
15
- return true;
16
- }
17
- let current = node;
18
- do {
19
- if (current === floatingContainer) {
20
- return true;
21
- }
22
- } while ((current = current.offsetParent) != null);
23
- }
24
- this.detailIsVisible = false;
25
- this.executeCloseCallback();
26
- return false;
27
- };
28
- }
29
- async showUp(open = false) {
30
- return new Promise(resolve => {
31
- this._filterItemElement.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" });
32
- if (open) {
33
- window.requestAnimationFrame(() => {
34
- this._closeCallback = resolve;
35
- this.showDetail();
36
- });
37
- }
38
- });
39
- }
40
- showDetail() {
41
- this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, left: this.getScrollOffset() });
42
- this.detailIsVisible = true;
43
- }
44
- getScrollOffset() {
45
- return `${this._filterItemElement.getBoundingClientRect().left + 12}px`;
46
- }
47
- hideDetail() {
48
- if (this._floatingID != undefined) {
49
- FloatingManager.close(this._floatingID);
50
- }
51
- this._floatingID = undefined;
52
- this.detailIsVisible = false;
53
- this.executeCloseCallback();
54
- }
55
- executeCloseCallback() {
56
- if (this._closeCallback) {
57
- this._closeCallback();
58
- this._closeCallback = undefined;
59
- }
60
- }
61
- //---------------------------------------------
62
- // Event handlers
63
- //---------------------------------------------
64
- clickListener(evt) {
65
- if ([this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
66
- if (evt.target === this._rightIconElement && this.config.value != undefined) {
67
- this.filterChange.emit(Object.assign(Object.assign({}, this.config), { value: undefined }));
68
- }
69
- else {
70
- if (this.detailIsVisible) {
71
- this.hideDetail();
72
- }
73
- else {
74
- this.showDetail();
75
- }
76
- }
77
- evt.preventDefault();
78
- evt.stopImmediatePropagation();
79
- evt.stopPropagation();
80
- }
81
- }
82
- mouseDownListener(evt) {
83
- if (this.detailIsVisible && [this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
84
- evt.preventDefault();
85
- evt.stopImmediatePropagation();
86
- evt.stopPropagation();
87
- }
88
- }
89
- getLabel() {
90
- const { type, value, label, props } = this.config;
91
- if (value) {
92
- if (type === FilterItemType.BINARY_SELECT) {
93
- const [optOne, optTwo] = props.options;
94
- if (optOne.name === value) {
95
- return optOne.label;
96
- }
97
- if (optTwo.name === value) {
98
- return optTwo.label;
99
- }
100
- }
101
- if (type === FilterItemType.MULTI_SELECT) {
102
- const opt = props.options.find(opt => opt.value === value);
103
- return `${label}: ${opt.label}`;
104
- }
105
- if (type === FilterItemType.PERIOD) {
106
- let { end, start } = value;
107
- if (typeof end === "string") {
108
- end = new Date(end);
109
- end.setMinutes(end.getMinutes() + end.getTimezoneOffset());
110
- }
111
- if (typeof start === "string") {
112
- start = new Date(start);
113
- start.setMinutes(start.getMinutes() + start.getTimezoneOffset());
114
- }
115
- const dateFormater = new Intl.DateTimeFormat("pt-BR");
116
- if (end && start) {
117
- return `${label}: ${dateFormater.format(start)} a ${dateFormater.format(end)}`;
118
- }
119
- else {
120
- if (start) {
121
- return `${label}: A partir de ${dateFormater.format(start)}`;
122
- }
123
- else if (end) {
124
- return `${label}: Até ${dateFormater.format(end)}`;
125
- }
126
- else {
127
- return label;
128
- }
129
- }
130
- }
131
- if (type === FilterItemType.SEARCH) {
132
- return `${label}: ${value.value} - ${value.label}`;
133
- }
134
- if (type === FilterItemType.PERSONALIZED) {
135
- return label;
136
- }
137
- return `${label}: ${value}`;
138
- }
139
- return label;
140
- }
141
- componentDidRender() {
142
- if (this._floatingID == undefined) {
143
- if (this._popover) {
144
- this._popover.remove();
145
- }
146
- }
147
- }
148
- filterChangeListener() {
149
- this.hideDetail();
150
- }
151
- getRightIconName() {
152
- if (this.config.value != undefined) {
153
- return "close";
154
- }
155
- return this.detailIsVisible ? "chevron-up" : "chevron-down";
156
- }
157
- getLeftIconName() {
158
- switch (this.config.type) {
159
- case FilterItemType.PERIOD:
160
- return "calendar";
161
- case FilterItemType.PERSONALIZED:
162
- return "tune";
163
- }
164
- return undefined;
165
- }
166
- render() {
167
- const leftIcon = this.getLeftIconName();
168
- return (h(Host, null, h("ez-chip", { ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.config.value != undefined }, leftIcon ? h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem, key: this.config.id }))));
169
- }
170
- get _filterItemElement() { return getElement(this); }
171
- };
172
-
173
- export { SnkFilterItem as snk_filter_item };
@@ -1,87 +0,0 @@
1
- import { r as registerInstance, e as createEvent, h, f as Host, g as getElement } from './index-2b4d2d14.js';
2
- import { F as FloatingManager, h as ArrayUtils } from './index-c683b2b0.js';
3
-
4
- const SHOW_MORE_ITEM_NAME = "__SHOWMORE__";
5
- const MAX_FILTERS = 5;
6
- const SnkFilterList = class {
7
- constructor(hostRef) {
8
- registerInstance(this, hostRef);
9
- this.snkItemSelected = createEvent(this, "snkItemSelected", 7);
10
- this.innerClickCheck = (floatingContainer, node) => {
11
- if (node && floatingContainer) {
12
- if (!node.offsetParent) {
13
- return true;
14
- }
15
- let current = node;
16
- do {
17
- if (current === floatingContainer || current === this._element) {
18
- return true;
19
- }
20
- } while ((current = current.offsetParent) != null);
21
- }
22
- this._detailIsVisible = false;
23
- return false;
24
- };
25
- }
26
- showList() {
27
- this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck });
28
- this._detailIsVisible = true;
29
- this._showAll = false;
30
- this._filterArgument = "";
31
- }
32
- hideList() {
33
- if (this._floatingID != undefined) {
34
- FloatingManager.close(this._floatingID);
35
- }
36
- this._floatingID = undefined;
37
- this._detailIsVisible = false;
38
- }
39
- buttonClick() {
40
- if (this._detailIsVisible) {
41
- this.hideList();
42
- }
43
- else {
44
- this.showList();
45
- }
46
- }
47
- componentDidRender() {
48
- if (this._floatingID == undefined) {
49
- if (this._popover) {
50
- this._popover.remove();
51
- }
52
- }
53
- }
54
- buildItemElement(item) {
55
- return (h("div", { class: "ez-col ez-col--sd-12 ez-align--middle ez-padding--small sc-snk-filter-bar snk-filter-bar__filter-list-item", onClick: () => this.itemSelected(item.name) }, item.iconName ? h("ez-icon", { iconName: item.iconName, size: "small", class: `ez-padding-right--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__icon ${item.iconClass || ""}` }) : undefined, h("div", { class: `ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__label ${item.labelClass || ""}` }, item.label)));
56
- }
57
- itemSelected(itemName) {
58
- if (itemName === SHOW_MORE_ITEM_NAME) {
59
- this._showAll = true;
60
- }
61
- else {
62
- this.hideList();
63
- this.snkItemSelected.emit(itemName);
64
- }
65
- }
66
- getFilterItems() {
67
- const items = this.items ? ArrayUtils.applyStringFilter(this._filterArgument, this.items.filter(item => item.kind === "FILTER")) : [];
68
- if (items.length === 0) {
69
- return h("div", { class: "ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-items-container--empty" }, this.emptyText);
70
- }
71
- const hideItems = !this._filterArgument && !this._showAll && (items.length > MAX_FILTERS + 1);
72
- if (hideItems) {
73
- items.splice(MAX_FILTERS);
74
- items.push({ kind: "INTERNAL", label: "Mostrar mais", iconName: "dots-horizontal", name: SHOW_MORE_ITEM_NAME, iconClass: "snk-filter-bar__filter-list-item__icon--secondary", labelClass: "snk-filter-bar__filter-list-item__label--secondary" });
75
- }
76
- return h("div", { class: "sc-snk-filter-bar snk-filter-bar__filter-list-items-container" }, items.map(item => this.buildItemElement(item)));
77
- }
78
- getFooterItems() {
79
- return this.items.filter(item => item.kind === "FOOTER");
80
- }
81
- render() {
82
- return (h(Host, { class: "ez-flex ez-flex--column" }, h("ez-button", { class: this.buttonClass, label: this.label, onClick: () => this.buttonClick(), mode: this.iconName ? "icon" : undefined, iconName: this.iconName, size: "small" }, h("slot", { name: "leftIcon" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("div", { class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem }, h("ez-filter-input", { ref: ref => this._filterInput = ref, mode: "slim", label: this.findFilterText, value: this._filterArgument, onEzChange: (evt) => this._filterArgument = evt.detail }), this.getFilterItems(), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), this.items ? this.getFooterItems().map(item => this.buildItemElement(item)) : undefined))));
83
- }
84
- get _element() { return getElement(this); }
85
- };
86
-
87
- export { SnkFilterList as snk_filter_list };
@@ -1,33 +0,0 @@
1
- import { r as registerInstance, h } from './index-2b4d2d14.js';
2
- import { a as ModalButtonStatus } from './index-c71285cb.js';
3
- import { h as ArrayUtils } from './index-c683b2b0.js';
4
-
5
- const SnkFilterModal = class {
6
- constructor(hostRef) {
7
- registerInstance(this, hostRef);
8
- }
9
- updateValue(id, value) {
10
- this.items = this.items.map(item => {
11
- if (item.id === id) {
12
- return Object.assign(Object.assign({}, item), { active: value });
13
- }
14
- return item;
15
- });
16
- }
17
- getActiveFiltersMsg() {
18
- const activeFilters = this.items.filter(item => item.active).length;
19
- if (activeFilters === 0) {
20
- return this.getMessage("snkFilterBar.noActiveFilters");
21
- }
22
- return this.getMessage(activeFilters > 1 ? "snkFilterBar.activeFilters" : "snkFilterBar.activeFilter", { ACTIVE_FILTERS: activeFilters });
23
- }
24
- getFilteredItems() {
25
- return this.items ? ArrayUtils.applyStringFilter(this._filterArgument, this.items) : [];
26
- }
27
- render() {
28
- const allowCancel = this.items.filter(item => item.active).length > 0;
29
- return (h("ez-modal-container", { modalTitle: this.modalTitle, modalSubTitle: this.modalSubTitle, cancelButtonLabel: this.cancelButtonLabel, okButtonLabel: this.okButtonLabel, onEzModalAction: evt => this.processModalAction(evt.detail), cancelButtonStatus: allowCancel ? ModalButtonStatus.ENABLED : ModalButtonStatus.DISABLED }, h("div", { class: "sc-snk-filter-bar snk-filter-bar__filter-modal-content" }, h("div", null, this.useSearch ? h("ez-filter-input", { label: this.getMessage("snkFilterBar.modalFindFilter"), onEzChange: (evt) => this._filterArgument = evt.detail }) : undefined), this.getFilteredItems().length > 0 ? h("div", { class: "ez-text ez-text--medium ez-text--primary ez-padding-bottom--small" }, this.getActiveFiltersMsg()) : undefined, h("div", null, this.getFilteredItems().map(item => h("div", { class: "ez-padding--medium sc-snk-filter-bar snk-filter-bar__filter-modal-item ez-align--middle ez-margin-bottom--small" }, h("ez-check", { class: "sc-snk-filter-bar snk-filter-bar__filter-modal-item__check", onEzChange: evt => this.updateValue(item.id, evt.detail), enabled: item.enabled, value: item.active, mode: "switch" }), h("div", { class: "ez-text ez-title--primary ez-text--medium ez-margin-left--medium sc-snk-filter-bar snk-filter-bar__filter-modal-item__label" }, item.label)))), h("div", { class: "ez-text ez-text--large ez-align--middle ez-text--secondary ez-text--center ez-padding-bottom--large" }, this.infoText))));
30
- }
31
- };
32
-
33
- export { SnkFilterModal as snk_filter_modal };
@@ -1,19 +0,0 @@
1
- import { r as registerInstance, h } from './index-2b4d2d14.js';
2
- import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
3
-
4
- const SnkFilterMultiSelect = class {
5
- constructor(hostRef) {
6
- registerInstance(this, hostRef);
7
- }
8
- ezChangeListener(evt) {
9
- this.value = evt.detail.value;
10
- }
11
- render() {
12
- if (!this.config || this.config.type !== FilterItemType.MULTI_SELECT) {
13
- return undefined;
14
- }
15
- return (h("ez-combo-box", { label: this.config.label, value: this.config.value, options: this.config.props.options }));
16
- }
17
- };
18
-
19
- export { SnkFilterMultiSelect as snk_filter_multi_select };
@@ -1,20 +0,0 @@
1
- import { r as registerInstance, h } from './index-2b4d2d14.js';
2
- import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
3
-
4
- const SnkFilterPeriod = class {
5
- constructor(hostRef) {
6
- registerInstance(this, hostRef);
7
- }
8
- ezChangeListener(evt) {
9
- this.value = evt.detail;
10
- }
11
- render() {
12
- var _a;
13
- if (!this.config || this.config.type !== FilterItemType.NUMBER) {
14
- return undefined;
15
- }
16
- return (h("ez-number-input", { label: this.config.label, value: this.config.value, precision: (_a = this.config.props) === null || _a === void 0 ? void 0 : _a.precision }));
17
- }
18
- };
19
-
20
- export { SnkFilterPeriod as snk_filter_number };
@@ -1,33 +0,0 @@
1
- import { r as registerInstance, h } from './index-2b4d2d14.js';
2
- import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
3
-
4
- const SnkFilterPeriod = class {
5
- constructor(hostRef) {
6
- registerInstance(this, hostRef);
7
- }
8
- ezChangeListener() {
9
- const start = this._startDate.value;
10
- const end = this._endDate.value;
11
- this.value = (start || end ? { start, end } : undefined);
12
- }
13
- getDate(prop) {
14
- const objValue = this.value ? this.value[prop] : null;
15
- if (objValue instanceof Date) {
16
- return objValue;
17
- }
18
- if (typeof objValue === "string") {
19
- let date = new Date(objValue);
20
- date.setMinutes(date.getMinutes() + date.getTimezoneOffset());
21
- return date;
22
- }
23
- return null;
24
- }
25
- render() {
26
- if (!this.config || this.config.type !== FilterItemType.PERIOD) {
27
- return undefined;
28
- }
29
- return (h("div", { class: "ez-col ez-col--nowrap" }, h("ez-date-input", { label: this.config.label, ref: ref => this._startDate = ref, value: this.getDate("start") }), h("label", { class: "ez-text ez-text--medium ez-text--primary ez-margin--medium" }, "at\u00E9"), h("ez-date-input", { label: this.config.label, ref: ref => this._endDate = ref, value: this.getDate("end") })));
30
- }
31
- };
32
-
33
- export { SnkFilterPeriod as snk_filter_period };
@@ -1,85 +0,0 @@
1
- import { r as registerInstance, h, f as Host } from './index-2b4d2d14.js';
2
- import { U as UserInterface, c as convertType, A as ApplicationContext } from './index-c683b2b0.js';
3
- import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
4
-
5
- const SnkFilterPersonalized = class {
6
- constructor(hostRef) {
7
- registerInstance(this, hostRef);
8
- }
9
- getValue(param, index) {
10
- if (this.value && index >= 0 && index < this.value.length) {
11
- const rawValue = this.value[index];
12
- if (param.type === UserInterface.SEARCH) {
13
- return rawValue;
14
- }
15
- return convertType(param.dataType, rawValue);
16
- }
17
- return undefined;
18
- }
19
- setValue(index, value) {
20
- if (this.value == undefined) {
21
- this.value = Array(index).fill(null);
22
- }
23
- else {
24
- this.value = [...this.value];
25
- }
26
- this.value[index] = value;
27
- if (this.value.filter(item => item != undefined).length == 0) {
28
- this.value = null;
29
- }
30
- }
31
- doSearch(mode, argument, param) {
32
- const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
33
- if (this.fix) {
34
- this.fix();
35
- }
36
- return new Promise((resolve, reject) => {
37
- application.executePreparedSearch(mode, argument, param.searchContext)
38
- .then(result => {
39
- resolve(result);
40
- if (this.unfix) {
41
- this.unfix();
42
- }
43
- }).catch(reason => {
44
- reject(reason);
45
- if (this.unfix) {
46
- this.unfix();
47
- }
48
- });
49
- });
50
- }
51
- getParamsInterface() {
52
- var _a, _b, _c;
53
- const params = (_c = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.personalizedFilter) === null || _c === void 0 ? void 0 : _c.parameters;
54
- return params.map((param, index) => {
55
- var _a;
56
- switch (param.type) {
57
- case UserInterface.SEARCH:
58
- return h("ez-search", { suppressEmptyOption: true, value: this.getValue(param, index), onEzChange: evt => this.setValue(index, evt.detail), label: param.label, optionLoader: ({ mode, argument }) => this.doSearch(mode, argument, param) });
59
- case UserInterface.SWITCH:
60
- case UserInterface.CHECKBOX:
61
- const mode = UserInterface.SWITCH === param.type ? "switch" : "regular";
62
- return h("ez-check", { class: "ez-padding-bottom--medium", mode: mode, value: this.getValue(param, index), label: param.label, onEzChange: evt => this.setValue(index, evt.detail) });
63
- case UserInterface.DECIMALNUMBER:
64
- case UserInterface.INTEGERNUMBER:
65
- return h("ez-number-input", { label: param.label, value: this.getValue(param, index), precision: (_a = param.props) === null || _a === void 0 ? void 0 : _a.precision, onEzChange: evt => this.setValue(index, evt.detail) });
66
- case UserInterface.OPTIONSELECTOR:
67
- return h("ez-combo-box", { label: param.label, value: this.getValue(param, index), options: param.options, onEzChange: evt => { var _a; return this.setValue(index, (_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value); } });
68
- case UserInterface.DATE:
69
- return h("ez-date-input", { label: param.label, value: this.getValue(param, index), onEzChange: evt => this.setValue(index, evt.detail) });
70
- case UserInterface.DATETIME:
71
- return h("ez-date-time-input", { label: param.label, value: this.getValue(param, index), onEzChange: evt => this.setValue(index, evt.detail) });
72
- default:
73
- return h("ez-text-input", { label: param.label, value: this.getValue(param, index), onEzChange: evt => this.setValue(index, evt.detail) });
74
- }
75
- });
76
- }
77
- render() {
78
- if (!this.config || this.config.type !== FilterItemType.PERSONALIZED) {
79
- return undefined;
80
- }
81
- return (h(Host, null, this.getParamsInterface()));
82
- }
83
- };
84
-
85
- export { SnkFilterPersonalized as snk_filter_personalized };
@@ -1,40 +0,0 @@
1
- import { r as registerInstance, h } from './index-2b4d2d14.js';
2
- import { A as ApplicationContext } from './index-c683b2b0.js';
3
- import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
4
-
5
- const SnkFilterSearch = class {
6
- constructor(hostRef) {
7
- registerInstance(this, hostRef);
8
- }
9
- ezChangeListener(_evt) {
10
- this.value = this._searchInput.value;
11
- }
12
- doSearch(mode, argument) {
13
- const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
14
- if (this.fix) {
15
- this.fix();
16
- }
17
- return new Promise((resolve, reject) => {
18
- application.executePreparedSearch(mode, argument, this.config.props.searchContext)
19
- .then(result => {
20
- resolve(result);
21
- if (this.unfix) {
22
- this.unfix();
23
- }
24
- }).catch(reason => {
25
- reject(reason);
26
- if (this.unfix) {
27
- this.unfix();
28
- }
29
- });
30
- });
31
- }
32
- render() {
33
- if (!this.config || this.config.type !== FilterItemType.SEARCH) {
34
- return undefined;
35
- }
36
- return (h("ez-search", { suppressEmptyOption: true, value: this.config.value, label: this.config.label, ref: ref => this._searchInput = ref, optionLoader: ({ mode, argument }) => this.doSearch(mode, argument) }));
37
- }
38
- };
39
-
40
- export { SnkFilterSearch as snk_filter_search };
@@ -1,18 +0,0 @@
1
- import { r as registerInstance, h } from './index-2b4d2d14.js';
2
-
3
- const SnkFilterText = class {
4
- constructor(hostRef) {
5
- registerInstance(this, hostRef);
6
- }
7
- ezChangeListener(evt) {
8
- this.value = evt.detail;
9
- }
10
- render() {
11
- if (!this.config) {
12
- return undefined;
13
- }
14
- return (h("ez-text-input", { label: this.config.label, value: this.config.value }));
15
- }
16
- };
17
-
18
- export { SnkFilterText as snk_filter_text };
@@ -1,75 +0,0 @@
1
- import { r as registerInstance, e as createEvent, h, g as getElement } from './index-2b4d2d14.js';
2
- import { A as ApplicationContext } from './index-c683b2b0.js';
3
- import { T as TaskbarElement } from './taskbar-elements-35d64ff9.js';
4
- import { T as TaskbarProcessor } from './taskbar-processor-aa6772c9.js';
5
-
6
- const snkGridCss = ".snk-grid__container.sc-snk-grid{display:flex;height:100%;width:100%}.snk-grid__header.sc-snk-grid{display:flex;flex-wrap:nowrap;width:100%}.snk-grid__filter-bar.sc-snk-grid{width:100%}.snk-grid__header-divider.sc-snk-grid{margin-bottom:var(--space--small)}";
7
-
8
- const SnkGrid = class {
9
- constructor(hostRef) {
10
- registerInstance(this, hostRef);
11
- this.actionClick = createEvent(this, "actionClick", 7);
12
- this.gridDoubleClick = createEvent(this, "gridDoubleClick", 7);
13
- this._topTaskbarProcessor = new TaskbarProcessor({
14
- "snkGridTopTaskbar": ["FORM_MODE", "CONFIG_GRID", "INSERT"]
15
- });
16
- this._headerTaskbarProcessor = new TaskbarProcessor({
17
- "snkGridHeaderTaskbar.unselected": ["REFRESH"],
18
- "snkGridHeaderTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "REFRESH"]
19
- });
20
- }
21
- actionClickHandler(evt) {
22
- if (evt.detail === TaskbarElement.CONFIG_GRID && this._grid) {
23
- this._grid.openGridConfig();
24
- }
25
- }
26
- saveConfig(config) {
27
- const snkApplication = ApplicationContext.getContextValue("__SNK__APPLICATION__");
28
- if (snkApplication) {
29
- snkApplication.saveGridConfig(config);
30
- }
31
- }
32
- componentWillLoad() {
33
- const snkApplication = ApplicationContext.getContextValue("__SNK__APPLICATION__");
34
- if (snkApplication) {
35
- snkApplication.loadGridConfig(this.configName).then(cfg => {
36
- this._gridConfig = cfg;
37
- this._configLoaded = true;
38
- });
39
- //Forçamos a carga dos acessos pra aproveitar a request inicial.
40
- snkApplication.getAllAccess();
41
- }
42
- let parent = this._element.parentElement;
43
- while (parent) {
44
- if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
45
- this._snkDataUnit = parent;
46
- this._dataUnit = this._snkDataUnit.dataUnit;
47
- if (!this._dataUnit) {
48
- this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
49
- this._dataUnit = evt.detail;
50
- });
51
- }
52
- this._snkDataUnit.addEventListener("dataStateChange", (evt) => {
53
- this._dataState = evt.detail;
54
- });
55
- break;
56
- }
57
- parent = parent.parentElement;
58
- }
59
- }
60
- componentWillRender() {
61
- const headerTaskbarId = this._dataState && this._dataState.selectedRecords.length > 0 ? "snkGridHeaderTaskbar.selected" : "snkGridHeaderTaskbar.unselected";
62
- this._headerTaskbarProcessor.process(headerTaskbarId, this.taskbarManager, this._dataState);
63
- this._topTaskbarProcessor.process("snkGridTopTaskbar", this.taskbarManager, this._dataState);
64
- }
65
- render() {
66
- if (!this._configLoaded || !this._dataUnit) {
67
- return undefined;
68
- }
69
- return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-padding-bottom--medium ez-margin-bottom--medium" }, h("snk-filter-bar", { dataUnit: this._dataUnit, class: "snk-grid__filter-bar ez-align--top", configName: this.configName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), h("snk-taskbar", { class: "ez-padding-left--medium", onActionClick: evt => this.actionClickHandler(evt), key: "topTaskbar", dataUnit: this._dataUnit, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: "INSERT" })), h("ez-grid", { ref: ref => this._grid = ref, dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: evt => { this.saveConfig(evt.detail); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver }, h("snk-taskbar", { dataUnit: this._dataUnit, buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList })), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" }))));
70
- }
71
- get _element() { return getElement(this); }
72
- };
73
- SnkGrid.style = snkGridCss;
74
-
75
- export { SnkGrid as snk_grid };