@sankhyalabs/sankhyablocks 1.4.0-beta.1 → 1.4.0-beta.3

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 (163) hide show
  1. package/dist/cjs/{SnkMessageBuilder-7717f1e4.js → SnkMessageBuilder-d8215915.js} +14 -119
  2. package/dist/cjs/{filter-item-type.enum-e2e1bc5b.js → filter-item-type.enum-3daf58d3.js} +2 -0
  3. package/dist/cjs/{index-b0b676c5.js → index-6fcf07f3.js} +159 -1515
  4. package/dist/cjs/loader.cjs.js +2 -18
  5. package/dist/cjs/sankhyablocks.cjs.js +4 -116
  6. package/dist/cjs/snk-application.cjs.entry.js +84 -230
  7. package/dist/cjs/snk-crud.cjs.entry.js +3 -3
  8. package/dist/cjs/snk-data-unit.cjs.entry.js +24 -32
  9. package/dist/cjs/snk-filter-bar_5.cjs.entry.js +902 -0
  10. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +2 -2
  11. package/dist/cjs/snk-filter-detail.cjs.entry.js +38 -3
  12. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +2 -2
  13. package/dist/cjs/snk-filter-number.cjs.entry.js +2 -2
  14. package/dist/cjs/snk-filter-period.cjs.entry.js +2 -2
  15. package/dist/cjs/snk-filter-personalized.cjs.entry.js +90 -0
  16. package/dist/cjs/snk-filter-search.cjs.entry.js +4 -4
  17. package/dist/cjs/snk-filter-text.cjs.entry.js +1 -1
  18. package/dist/cjs/{snk-form.cjs.entry.js → snk-form_2.cjs.entry.js} +119 -5
  19. package/dist/cjs/snk-pesquisa.cjs.entry.js +5 -5
  20. package/dist/cjs/{taskbar-elements-283c737e.js → taskbar-elements-aedfeae6.js} +1 -1
  21. package/dist/cjs/teste-pesquisa.cjs.entry.js +5 -5
  22. package/dist/collection/collection-manifest.json +2 -0
  23. package/dist/collection/components/snk-application/snk-application.js +54 -7
  24. package/dist/collection/components/snk-crud/snk-crud.js +2 -4
  25. package/dist/collection/components/snk-data-unit/snk-data-unit.js +0 -27
  26. package/dist/collection/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.js +100 -0
  27. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +161 -0
  28. package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type.enum.js +2 -0
  29. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +36 -1
  30. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +32 -9
  31. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +196 -0
  32. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +22 -0
  33. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +238 -139
  34. package/dist/collection/components/snk-grid/snk-grid.js +2 -4
  35. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +18 -10
  36. package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +14 -2
  37. package/dist/components/SnkMessageBuilder.js +15 -119
  38. package/dist/components/filter-item-type.enum.js +2 -0
  39. package/dist/components/index.d.ts +2 -0
  40. package/dist/components/index.js +2 -4
  41. package/dist/components/snk-application2.js +47 -191
  42. package/dist/components/snk-crud.js +16 -10
  43. package/dist/components/snk-data-unit.js +3 -12
  44. package/dist/components/snk-filter-bar2.js +342 -146
  45. package/dist/components/snk-filter-detail2.js +36 -1
  46. package/dist/components/snk-filter-item2.js +33 -10
  47. package/dist/components/snk-filter-list2.js +1 -1
  48. package/dist/components/snk-filter-modal.d.ts +11 -0
  49. package/dist/components/snk-filter-modal.js +6 -0
  50. package/dist/components/snk-filter-modal2.js +58 -0
  51. package/dist/components/snk-filter-personalized.d.ts +11 -0
  52. package/dist/components/snk-filter-personalized.js +108 -0
  53. package/dist/components/snk-filter-search.js +1 -1
  54. package/dist/components/snk-form2.js +1 -1
  55. package/dist/components/snk-grid2.js +16 -10
  56. package/dist/components/snk-pesquisa2.js +1 -1
  57. package/dist/components/snk-taskbar2.js +1 -1
  58. package/dist/components/teste-pesquisa.js +1 -1
  59. package/dist/{sankhyablocks/SnkMessageBuilder-a7da466b.js → esm/SnkMessageBuilder-35a20271.js} +15 -119
  60. package/dist/esm/{filter-item-type.enum-61fbf80a.js → filter-item-type.enum-a79b2fa8.js} +2 -0
  61. package/dist/{sankhyablocks/index-2b4d2d14.js → esm/index-81dda3cf.js} +160 -1508
  62. package/dist/esm/loader.js +2 -18
  63. package/dist/esm/sankhyablocks.js +4 -116
  64. package/dist/esm/snk-application.entry.js +46 -192
  65. package/dist/esm/snk-crud.entry.js +2 -2
  66. package/dist/esm/snk-data-unit.entry.js +4 -12
  67. package/dist/esm/snk-filter-bar_5.entry.js +894 -0
  68. package/dist/esm/snk-filter-binary-select.entry.js +2 -2
  69. package/dist/esm/snk-filter-detail.entry.js +38 -3
  70. package/dist/esm/snk-filter-multi-select.entry.js +2 -2
  71. package/dist/esm/snk-filter-number.entry.js +2 -2
  72. package/dist/esm/snk-filter-period.entry.js +2 -2
  73. package/dist/esm/snk-filter-personalized.entry.js +86 -0
  74. package/dist/esm/snk-filter-search.entry.js +3 -3
  75. package/dist/esm/snk-filter-text.entry.js +1 -1
  76. package/dist/esm/{snk-form.entry.js → snk-form_2.entry.js} +117 -4
  77. package/dist/esm/snk-pesquisa.entry.js +2 -2
  78. package/dist/{sankhyablocks/taskbar-elements-35d64ff9.js → esm/taskbar-elements-38eb5d51.js} +1 -1
  79. package/dist/esm/teste-pesquisa.entry.js +2 -2
  80. package/dist/sankhyablocks/index.esm.js +0 -1
  81. package/dist/sankhyablocks/p-0352c0e2.entry.js +1 -0
  82. package/dist/sankhyablocks/p-07ebda01.entry.js +1 -0
  83. package/dist/sankhyablocks/p-322c0df2.entry.js +1 -0
  84. package/dist/sankhyablocks/p-46caa101.entry.js +1 -0
  85. package/dist/sankhyablocks/p-473cedf9.entry.js +1 -0
  86. package/dist/sankhyablocks/p-586e2522.js +1 -0
  87. package/dist/sankhyablocks/p-86f15ffe.js +1 -0
  88. package/dist/sankhyablocks/p-8f3c5709.entry.js +1 -0
  89. package/dist/sankhyablocks/p-97009a2c.entry.js +1 -0
  90. package/dist/sankhyablocks/p-9be74b46.entry.js +74 -0
  91. package/dist/sankhyablocks/p-9dd2b8cb.js +1 -0
  92. package/dist/sankhyablocks/p-a8b59c61.entry.js +1 -0
  93. package/dist/sankhyablocks/p-aecf3e0a.entry.js +1 -0
  94. package/dist/sankhyablocks/p-c1c3b5d8.entry.js +1 -0
  95. package/dist/sankhyablocks/p-c78cb79a.entry.js +1 -0
  96. package/dist/sankhyablocks/p-c9eec639.entry.js +1 -0
  97. package/dist/sankhyablocks/p-dc482a42.entry.js +1 -0
  98. package/dist/sankhyablocks/p-fac2b6a9.js +2 -0
  99. package/dist/sankhyablocks/p-fb705f81.entry.js +1 -0
  100. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -129
  101. package/dist/types/components/snk-application/snk-application.d.ts +4 -1
  102. package/dist/types/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.d.ts +4 -0
  103. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +23 -0
  104. package/dist/types/components/snk-filter-bar/filter-item/filter-item-type.enum.d.ts +3 -1
  105. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +2 -0
  106. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +23 -0
  107. package/dist/types/components.d.ts +56 -8
  108. package/package.json +3 -3
  109. package/react/components.d.ts +19 -0
  110. package/react/components.js +19 -0
  111. package/react/components.js.map +1 -1
  112. package/dist/cjs/app-globals-3a1e7e63.js +0 -5
  113. package/dist/cjs/css-shim-b8158822.js +0 -6
  114. package/dist/cjs/dom-36862b77.js +0 -75
  115. package/dist/cjs/index-02201bc9.js +0 -2397
  116. package/dist/cjs/shadow-css-346c0795.js +0 -389
  117. package/dist/cjs/snk-filter-bar.cjs.entry.js +0 -278
  118. package/dist/cjs/snk-filter-item.cjs.entry.js +0 -154
  119. package/dist/cjs/snk-filter-list.cjs.entry.js +0 -91
  120. package/dist/cjs/snk-grid.cjs.entry.js +0 -79
  121. package/dist/cjs/snk-taskbar.cjs.entry.js +0 -160
  122. package/dist/cjs/taskbar-processor-6bd0d35c.js +0 -47
  123. package/dist/components/index2.js +0 -2384
  124. package/dist/esm/SnkMessageBuilder-a7da466b.js +0 -303
  125. package/dist/esm/app-globals-0f993ce5.js +0 -3
  126. package/dist/esm/css-shim-b3f2ee8d.js +0 -4
  127. package/dist/esm/dom-665d6011.js +0 -73
  128. package/dist/esm/index-2b4d2d14.js +0 -3262
  129. package/dist/esm/index-f1d3e4da.js +0 -2384
  130. package/dist/esm/shadow-css-b18e99d7.js +0 -387
  131. package/dist/esm/snk-filter-bar.entry.js +0 -274
  132. package/dist/esm/snk-filter-item.entry.js +0 -150
  133. package/dist/esm/snk-filter-list.entry.js +0 -87
  134. package/dist/esm/snk-grid.entry.js +0 -75
  135. package/dist/esm/snk-taskbar.entry.js +0 -156
  136. package/dist/esm/taskbar-elements-35d64ff9.js +0 -90
  137. package/dist/esm/taskbar-processor-aa6772c9.js +0 -45
  138. package/dist/sankhyablocks/app-globals-0f993ce5.js +0 -3
  139. package/dist/sankhyablocks/css-shim-b3f2ee8d.js +0 -4
  140. package/dist/sankhyablocks/dom-665d6011.js +0 -73
  141. package/dist/sankhyablocks/filter-item-type.enum-61fbf80a.js +0 -12
  142. package/dist/sankhyablocks/index-f1d3e4da.js +0 -2384
  143. package/dist/sankhyablocks/shadow-css-b18e99d7.js +0 -387
  144. package/dist/sankhyablocks/snk-application.entry.js +0 -8148
  145. package/dist/sankhyablocks/snk-crud.entry.js +0 -66
  146. package/dist/sankhyablocks/snk-data-unit.entry.js +0 -276
  147. package/dist/sankhyablocks/snk-filter-bar.entry.js +0 -274
  148. package/dist/sankhyablocks/snk-filter-binary-select.entry.js +0 -43
  149. package/dist/sankhyablocks/snk-filter-detail.entry.js +0 -45
  150. package/dist/sankhyablocks/snk-filter-item.entry.js +0 -150
  151. package/dist/sankhyablocks/snk-filter-list.entry.js +0 -87
  152. package/dist/sankhyablocks/snk-filter-multi-select.entry.js +0 -19
  153. package/dist/sankhyablocks/snk-filter-number.entry.js +0 -20
  154. package/dist/sankhyablocks/snk-filter-period.entry.js +0 -33
  155. package/dist/sankhyablocks/snk-filter-search.entry.js +0 -40
  156. package/dist/sankhyablocks/snk-filter-text.entry.js +0 -18
  157. package/dist/sankhyablocks/snk-form.entry.js +0 -129
  158. package/dist/sankhyablocks/snk-grid.entry.js +0 -75
  159. package/dist/sankhyablocks/snk-pesquisa.entry.js +0 -311
  160. package/dist/sankhyablocks/snk-taskbar.entry.js +0 -156
  161. package/dist/sankhyablocks/taskbar-processor-aa6772c9.js +0 -45
  162. package/dist/sankhyablocks/teste-pesquisa.entry.js +0 -33
  163. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +0 -51
@@ -1,45 +0,0 @@
1
- import { r as registerInstance, e as createEvent, h, f as Host } from './index-2b4d2d14.js';
2
- import { F as FilterItemType } from './filter-item-type.enum-61fbf80a.js';
3
-
4
- const SnkFilterDetail = class {
5
- constructor(hostRef) {
6
- registerInstance(this, hostRef);
7
- this.filterChange = createEvent(this, "filterChange", 7);
8
- }
9
- changeConfig(newConfig) {
10
- this.filterChange.emit(newConfig);
11
- }
12
- getContentEditor() {
13
- switch (this.config.type) {
14
- case FilterItemType.BINARY_SELECT:
15
- return "snk-filter-binary-select";
16
- case FilterItemType.MULTI_SELECT:
17
- return "snk-filter-multi-select";
18
- case FilterItemType.PERIOD:
19
- return "snk-filter-period";
20
- case FilterItemType.SEARCH:
21
- return "snk-filter-search";
22
- case FilterItemType.NUMBER:
23
- return "snk-filter-number";
24
- }
25
- return "snk-filter-text";
26
- }
27
- removeItem() {
28
- this.changeConfig(Object.assign(Object.assign({}, this.config), { visible: false, fixed: false, value: undefined }));
29
- }
30
- getPopUpHeaderButtons() {
31
- if (this.config.hardFixed) {
32
- return undefined;
33
- }
34
- return ([
35
- h("ez-icon", { title: this.getMessage("snkFilterBar.removeFilter"), class: "sc-snk-filter-bar snk-filter-item__editor-header-button", iconName: "delete", onClick: () => this.removeItem() }),
36
- h("ez-icon", { title: this.getMessage(this.config.fixed ? "snkFilterBar.unpinFilter" : "snkFilterBar.pinFilter"), class: "ez-margin-left--small sc-snk-filter-bar snk-filter-item__editor-header-button", iconName: this.config.fixed ? "un-pin" : "push-pin", onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { fixed: !this.config.fixed })) })
37
- ]);
38
- }
39
- render() {
40
- const ContentEditor = this.getContentEditor();
41
- return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(ContentEditor, { ref: ref => this._editor = ref, value: this.config.value, config: this.config, fix: () => this.keepOpened = true, unfix: () => this.keepOpened = false }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined })) }), h("ez-button", { label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { value: this._editor["value"] })), class: "ez-button--primary ez-padding-left--medium" }))));
42
- }
43
- };
44
-
45
- export { SnkFilterDetail as snk_filter_detail };
@@ -1,150 +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-f1d3e4da.js';
3
- import { F as FilterItemType } from './filter-item-type.enum-61fbf80a.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
- return false;
26
- };
27
- }
28
- async showUp(open = false) {
29
- this._filterItemElement.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" });
30
- if (open) {
31
- window.requestAnimationFrame(() => {
32
- this.showDetail();
33
- });
34
- }
35
- }
36
- showDetail() {
37
- this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, left: this.getScrollOffset() });
38
- this.detailIsVisible = true;
39
- }
40
- getScrollOffset() {
41
- return `${this._filterItemElement.getBoundingClientRect().left + 12}px`;
42
- }
43
- hideDetail() {
44
- if (this._floatingID != undefined) {
45
- FloatingManager.close(this._floatingID);
46
- }
47
- this._floatingID = undefined;
48
- this.detailIsVisible = false;
49
- }
50
- //---------------------------------------------
51
- // Event handlers
52
- //---------------------------------------------
53
- clickListener(evt) {
54
- if ([this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
55
- if (evt.target === this._rightIconElement && this.config.value != undefined) {
56
- this.filterChange.emit(Object.assign(Object.assign({}, this.config), { value: undefined }));
57
- }
58
- else {
59
- if (this.detailIsVisible) {
60
- this.hideDetail();
61
- }
62
- else {
63
- this.showDetail();
64
- }
65
- }
66
- evt.preventDefault();
67
- evt.stopImmediatePropagation();
68
- evt.stopPropagation();
69
- }
70
- }
71
- mouseDownListener(evt) {
72
- if (this.detailIsVisible && [this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
73
- evt.preventDefault();
74
- evt.stopImmediatePropagation();
75
- evt.stopPropagation();
76
- }
77
- }
78
- getLabel() {
79
- const { type, value, label, props } = this.config;
80
- if (value) {
81
- if (type === FilterItemType.BINARY_SELECT) {
82
- const [optOne, optTwo] = props.options;
83
- if (optOne.name === value) {
84
- return optOne.label;
85
- }
86
- if (optTwo.name === value) {
87
- return optTwo.label;
88
- }
89
- }
90
- if (type === FilterItemType.MULTI_SELECT) {
91
- const opt = props.options.find(opt => opt.value === value);
92
- return `${label}: ${opt.label}`;
93
- }
94
- if (type === FilterItemType.PERIOD) {
95
- let { end, start } = value;
96
- if (typeof end === "string") {
97
- end = new Date(end);
98
- end.setMinutes(end.getMinutes() + end.getTimezoneOffset());
99
- }
100
- if (typeof start === "string") {
101
- start = new Date(start);
102
- start.setMinutes(start.getMinutes() + start.getTimezoneOffset());
103
- }
104
- const dateFormater = new Intl.DateTimeFormat("pt-BR");
105
- if (end && start) {
106
- return `${label}: ${dateFormater.format(start)} a ${dateFormater.format(end)}`;
107
- }
108
- else {
109
- if (start) {
110
- return `${label}: A partir de ${dateFormater.format(start)}`;
111
- }
112
- else if (end) {
113
- return `${label}: Até ${dateFormater.format(end)}`;
114
- }
115
- else {
116
- return label;
117
- }
118
- }
119
- }
120
- if (type === FilterItemType.SEARCH) {
121
- return `${label}: ${value.value} - ${value.label}`;
122
- }
123
- return `${label}: ${value}`;
124
- }
125
- return label;
126
- }
127
- componentDidRender() {
128
- if (this._floatingID == undefined) {
129
- if (this._popover) {
130
- this._popover.remove();
131
- }
132
- }
133
- }
134
- filterChangeListener() {
135
- this.hideDetail();
136
- }
137
- getIconName() {
138
- if (this.config.value != undefined) {
139
- return "close";
140
- }
141
- return this.detailIsVisible ? "chevron-up" : "chevron-down";
142
- }
143
- render() {
144
- const leftIcon = this.config.type === FilterItemType.PERIOD ? "calendar" : undefined;
145
- 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.getIconName(), 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 }))));
146
- }
147
- get _filterItemElement() { return getElement(this); }
148
- };
149
-
150
- 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, g as ArrayUtils } from './index-f1d3e4da.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,19 +0,0 @@
1
- import { r as registerInstance, h } from './index-2b4d2d14.js';
2
- import { F as FilterItemType } from './filter-item-type.enum-61fbf80a.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-61fbf80a.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-61fbf80a.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,40 +0,0 @@
1
- import { r as registerInstance, h } from './index-2b4d2d14.js';
2
- import { A as ApplicationContext } from './index-f1d3e4da.js';
3
- import { F as FilterItemType } from './filter-item-type.enum-61fbf80a.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,129 +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-f1d3e4da.js';
3
- import { T as TaskbarProcessor } from './taskbar-processor-aa6772c9.js';
4
-
5
- const snkFormCss = ".sc-snk-form-h{display:block}.snk-form.sc-snk-form{position:relative;padding:var(--space--large);padding-top:var(--space--medium)}.snk-form__header.sc-snk-form{position:relative;padding-top:var(--space--medium);padding-bottom:var(--space--medium);margin-bottom:var(--space--medium)}.snk-form__header--fixed.sc-snk-form{position:sticky;top:0;background:var(--background--body);z-index:var(--more-visible, 2);padding-left:var(--space--large);padding-right:var(--space--large);margin-left:calc(var(--space--large) * -1);margin-right:calc(var(--space--large) * -1);width:calc(100% + (var(--space--large) * 2))}";
6
-
7
- const SnkForm = class {
8
- constructor(hostRef) {
9
- registerInstance(this, hostRef);
10
- this.exit = createEvent(this, "exit", 7);
11
- this.actionClick = createEvent(this, "actionClick", 7);
12
- this._taskbarProcessor = new TaskbarProcessor({
13
- "snkForm.regular": ["PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "GRID_MODE", "INSERT"],
14
- "snkForm.finish_edition": ["CANCEL", "SAVE"]
15
- });
16
- }
17
- getFormConfig() {
18
- return (this._dataState && this._dataState.insertionMode ? this._insertionFormConfig : this._editionFormConfig);
19
- }
20
- getInsertionHiddenFields(formConfig) {
21
- const hiddenFields = [];
22
- formConfig === null || formConfig === void 0 ? void 0 : formConfig.forEach(cfg => {
23
- const def = this._dataUnit.getField(cfg.name);
24
- if (def === null || def === void 0 ? void 0 : def.readOnly) {
25
- hiddenFields.push(cfg.name);
26
- }
27
- });
28
- return hiddenFields;
29
- }
30
- exitForm() {
31
- if (this._dataUnit.isDirty()) {
32
- this._dataUnit.cancelEdition({ after: () => this.exit.emit() });
33
- }
34
- else {
35
- this.exit.emit();
36
- }
37
- }
38
- getDisabledButtons() {
39
- const disabled = [];
40
- if (!this._dataState.hasPrevious) {
41
- disabled.push("PREVIOUS");
42
- }
43
- if (!this._dataState.hasNext) {
44
- disabled.push("NEXT");
45
- }
46
- return disabled;
47
- }
48
- loadInsertionConfig() {
49
- if (this._dataUnit && this._configLoaded) {
50
- this._insertionFormConfig = this._editionFormConfig.filter(fieldCfg => {
51
- const def = this._dataUnit.getField(fieldCfg.name);
52
- if (def === null || def === void 0 ? void 0 : def.readOnly) {
53
- return false;
54
- }
55
- return true;
56
- });
57
- }
58
- }
59
- /**
60
- * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
61
- * através de um pequeno modulo na estrutura da aplicação:
62
- * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
63
- * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-form.msg.ts"
64
- */
65
- getMessage(key) {
66
- return this._application.messagesBuilder.getMessage(key, this.getMessageParams());
67
- }
68
- getMessageParams() {
69
- var _a;
70
- return ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectedRecords) ? this._dataState.selectedRecords[0] : undefined;
71
- }
72
- componentWillLoad() {
73
- this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
74
- if (this._application) {
75
- this._application.loadFormConfig(this.configName).then(cfg => {
76
- this._configLoaded = true;
77
- this._editionFormConfig = cfg;
78
- this.loadInsertionConfig();
79
- });
80
- //Forçamos a carga dos acessos pra aproveitar a request inicial.
81
- this._application.getAllAccess();
82
- }
83
- let parent = this._element.parentElement;
84
- while (parent) {
85
- if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
86
- this._snkDataUnit = parent;
87
- this._dataUnit = this._snkDataUnit.dataUnit;
88
- this._dataState = this._snkDataUnit.dataState;
89
- if (this._dataUnit) {
90
- this.loadInsertionConfig();
91
- }
92
- else {
93
- this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
94
- this._dataUnit = evt.detail;
95
- this.loadInsertionConfig();
96
- });
97
- }
98
- this._snkDataUnit.addEventListener("dataStateChange", (evt) => {
99
- this._dataState = evt.detail;
100
- });
101
- break;
102
- }
103
- parent = parent.parentElement;
104
- }
105
- }
106
- componentWillRender() {
107
- var _a;
108
- const taskbarId = ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "snkForm.finish_edition" : "snkForm.regular";
109
- const disabledButtons = [];
110
- if (!this._dataState || !this._dataState.hasPrevious) {
111
- disabledButtons.push("PREVIOUS");
112
- }
113
- if (!this._dataState || !this._dataState.hasNext) {
114
- disabledButtons.push("NEXT");
115
- }
116
- this._taskbarProcessor.process(taskbarId, this.taskbarManager, this._dataState, disabledButtons);
117
- }
118
- render() {
119
- var _a;
120
- if (!this._configLoaded || !this._dataUnit || !this._dataState) {
121
- return undefined;
122
- }
123
- return (h("section", { class: "snk-form" }, h("div", { class: "snk-form__header snk-form__header--fixed ez-row" }, h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6", key: "formHeader" }, h("ez-button", { title: this.getMessage("snkForm.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small", onClick: () => this.exitForm() }), h("h1", { class: "ez-title ez-title--primary ez-title--xlarge ez-align--middle" }, this.getMessage("snkForm.title"))), h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6 ez-align--right" }, h("snk-taskbar", { key: "formTaskbar", buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, actionsList: this.actionsList, primaryButton: ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", dataUnit: this._dataUnit }))), h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { key: "ezForm" + this._snkDataUnit.entityName, dataUnit: this._dataUnit, config: this.getFormConfig(), recordsValidator: this.recordsValidator }))))));
124
- }
125
- get _element() { return getElement(this); }
126
- };
127
- SnkForm.style = snkFormCss;
128
-
129
- export { SnkForm as snk_form };
@@ -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-f1d3e4da.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 };