@sankhyalabs/sankhyablocks 1.1.23 → 1.1.27

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 (186) hide show
  1. package/dist/cjs/ApplicationUtils-05b74ee9.js +39 -0
  2. package/dist/cjs/AssetsUtils-bd004f63.js +24 -0
  3. package/dist/cjs/CSSVarsUtils-75ca9c64.js +19 -0
  4. package/dist/cjs/_commonjsHelpers-537d719a.js +20 -0
  5. package/dist/cjs/ez-action-chip.cjs.entry.js +27 -0
  6. package/dist/cjs/ez-application.cjs.entry.js +26 -0
  7. package/dist/cjs/ez-button_4.cjs.entry.js +660 -0
  8. package/dist/cjs/ez-calendar.cjs.entry.js +223 -0
  9. package/dist/cjs/ez-collapsible-box.cjs.entry.js +47 -0
  10. package/dist/cjs/ez-combo-box.cjs.entry.js +278 -0
  11. package/dist/cjs/ez-date-input.cjs.entry.js +102 -0
  12. package/dist/cjs/ez-date-time-input.cjs.entry.js +145 -0
  13. package/dist/cjs/ez-dialog.cjs.entry.js +89 -0
  14. package/dist/cjs/ez-form.cjs.entry.js +785 -0
  15. package/dist/cjs/ez-grid.cjs.entry.js +110485 -0
  16. package/dist/cjs/ez-icon.cjs.entry.js +41 -0
  17. package/dist/cjs/ez-label-chip.cjs.entry.js +104 -0
  18. package/dist/cjs/ez-modal_2.cjs.entry.js +316 -0
  19. package/dist/cjs/ez-number-input.cjs.entry.js +86 -0
  20. package/dist/cjs/ez-popover.cjs.entry.js +120 -0
  21. package/dist/cjs/ez-popup.cjs.entry.js +48 -0
  22. package/dist/cjs/ez-search.cjs.entry.js +64 -0
  23. package/dist/cjs/ez-tabselector.cjs.entry.js +198 -0
  24. package/dist/cjs/ez-text-area.cjs.entry.js +114 -0
  25. package/dist/cjs/ez-text-input.cjs.entry.js +201 -0
  26. package/dist/cjs/ez-time-input.cjs.entry.js +118 -0
  27. package/dist/cjs/ez-toast.cjs.entry.js +44 -0
  28. package/dist/cjs/ez-upload.cjs.entry.js +356 -0
  29. package/dist/cjs/index-6ac5268e.js +1769 -0
  30. package/dist/cjs/loader.cjs.js +2 -2
  31. package/dist/cjs/sankhyablocks.cjs.js +2 -2
  32. package/dist/cjs/snk-application.cjs.entry.js +52 -1313
  33. package/dist/cjs/test-du.cjs.entry.js +76 -0
  34. package/dist/collection/collection-manifest.json +36 -1
  35. package/dist/collection/components/snk-application/snk-application.js +8 -4
  36. package/dist/{collection/temp → components}/ApplicationUtils.js +37 -31
  37. package/dist/components/AssetsUtils.js +22 -0
  38. package/dist/components/CSSVarsUtils.js +17 -0
  39. package/dist/components/_commonjsHelpers.js +17 -0
  40. package/dist/components/ez-action-chip.js +44 -0
  41. package/dist/components/ez-application.js +39 -0
  42. package/dist/components/ez-button.js +6 -0
  43. package/dist/components/ez-button2.js +105 -0
  44. package/dist/components/ez-calendar.js +6 -0
  45. package/dist/components/ez-calendar2.js +242 -0
  46. package/dist/components/ez-check.js +6 -0
  47. package/dist/components/ez-check2.js +94 -0
  48. package/dist/components/ez-collapsible-box.js +67 -0
  49. package/dist/components/ez-combo-box.js +6 -0
  50. package/dist/components/ez-combo-box2.js +311 -0
  51. package/dist/components/ez-date-input.js +135 -0
  52. package/dist/components/ez-date-time-input.js +179 -0
  53. package/dist/components/ez-dialog.js +124 -0
  54. package/dist/components/ez-form.js +6 -0
  55. package/dist/components/ez-form2.js +807 -0
  56. package/dist/components/ez-grid.js +110576 -0
  57. package/dist/components/ez-icon.js +6 -0
  58. package/dist/components/ez-icon2.js +56 -0
  59. package/dist/components/ez-label-chip.js +125 -0
  60. package/dist/components/ez-list.js +6 -0
  61. package/dist/components/ez-list2.js +523 -0
  62. package/dist/components/ez-modal.js +6 -0
  63. package/dist/components/ez-modal2.js +82 -0
  64. package/dist/components/ez-number-input.js +115 -0
  65. package/dist/components/ez-popover.js +145 -0
  66. package/dist/components/ez-popup.js +67 -0
  67. package/dist/components/ez-search.js +100 -0
  68. package/dist/components/ez-tabselector.js +6 -0
  69. package/dist/components/ez-tabselector2.js +213 -0
  70. package/dist/components/ez-text-area.js +137 -0
  71. package/dist/components/ez-text-input.js +6 -0
  72. package/dist/components/ez-text-input2.js +223 -0
  73. package/dist/components/ez-time-input.js +153 -0
  74. package/dist/components/ez-toast.js +64 -0
  75. package/dist/components/ez-upload.js +382 -0
  76. package/dist/components/grid-config.js +6 -0
  77. package/dist/components/grid-config2.js +318 -0
  78. package/dist/components/select-box.js +6 -0
  79. package/dist/components/select-box2.js +47 -0
  80. package/dist/components/snk-application.js +5 -1266
  81. package/dist/components/test-du.js +101 -0
  82. package/dist/esm/ApplicationUtils-e0b6d857.js +37 -0
  83. package/dist/esm/AssetsUtils-98074c9c.js +22 -0
  84. package/dist/esm/CSSVarsUtils-0787c3f3.js +17 -0
  85. package/dist/esm/_commonjsHelpers-9943807e.js +17 -0
  86. package/dist/esm/ez-action-chip.entry.js +23 -0
  87. package/dist/esm/ez-application.entry.js +22 -0
  88. package/dist/esm/ez-button_4.entry.js +653 -0
  89. package/dist/esm/ez-calendar.entry.js +219 -0
  90. package/dist/esm/ez-collapsible-box.entry.js +43 -0
  91. package/dist/esm/ez-combo-box.entry.js +274 -0
  92. package/dist/esm/ez-date-input.entry.js +98 -0
  93. package/dist/esm/ez-date-time-input.entry.js +141 -0
  94. package/dist/esm/ez-dialog.entry.js +85 -0
  95. package/dist/esm/ez-form.entry.js +781 -0
  96. package/dist/esm/ez-grid.entry.js +110481 -0
  97. package/dist/esm/ez-icon.entry.js +37 -0
  98. package/dist/esm/ez-label-chip.entry.js +100 -0
  99. package/dist/esm/ez-modal_2.entry.js +311 -0
  100. package/dist/esm/ez-number-input.entry.js +82 -0
  101. package/dist/esm/ez-popover.entry.js +116 -0
  102. package/dist/esm/ez-popup.entry.js +44 -0
  103. package/dist/esm/ez-search.entry.js +60 -0
  104. package/dist/esm/ez-tabselector.entry.js +194 -0
  105. package/dist/esm/ez-text-area.entry.js +110 -0
  106. package/dist/esm/ez-text-input.entry.js +197 -0
  107. package/dist/esm/ez-time-input.entry.js +114 -0
  108. package/dist/esm/ez-toast.entry.js +40 -0
  109. package/dist/esm/ez-upload.entry.js +352 -0
  110. package/dist/esm/index-df166135.js +1738 -0
  111. package/dist/esm/loader.js +2 -2
  112. package/dist/esm/sankhyablocks.js +2 -2
  113. package/dist/esm/snk-application.entry.js +6 -1267
  114. package/dist/esm/test-du.entry.js +72 -0
  115. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-action-chip/ez-action-chip.css +67 -0
  116. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-application/ez-application.css +3 -0
  117. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-button/ez-button.css +180 -0
  118. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-calendar/ez-calendar.css +319 -0
  119. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-check/ez-check.css +327 -0
  120. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +162 -0
  121. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-combo-box/ez-combo-box.css +217 -0
  122. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-input/ez-date-input.css +49 -0
  123. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-time-input/ez-date-time-input.css +44 -0
  124. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-dialog/ez-dialog.css +527 -0
  125. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-form/ez-form.css +5 -0
  126. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/ez-grid.css +31 -0
  127. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.css +129 -0
  128. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/select-box/select-box.css +10 -0
  129. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-icon/ez-icon.css +176 -0
  130. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-label-chip/ez-label-chip.css +139 -0
  131. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-list/ez-list.css +335 -0
  132. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-modal/ez-modal.css +358 -0
  133. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-number-input/ez-number-input.css +4 -0
  134. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popover/ez-popover.css +44 -0
  135. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popup/ez-popup.css +405 -0
  136. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-search/ez-search.css +3 -0
  137. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-tabselector/ez-tabselector.css +138 -0
  138. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-area/ez-text-area.css +165 -0
  139. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-input/ez-text-input.css +196 -0
  140. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-time-input/ez-time-input.css +10 -0
  141. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-toast/ez-toast.css +127 -0
  142. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-upload/ez-upload.css +568 -0
  143. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/test-du/test-du.css +3 -0
  144. package/dist/sankhyablocks/p-08e1cded.entry.js +1 -0
  145. package/dist/sankhyablocks/p-0a77ac95.entry.js +57 -0
  146. package/dist/sankhyablocks/p-112455b1.js +1 -0
  147. package/dist/sankhyablocks/p-126c4aaa.entry.js +1 -0
  148. package/dist/sankhyablocks/p-1421b89a.entry.js +1 -0
  149. package/dist/sankhyablocks/p-1beadcaf.entry.js +1 -0
  150. package/dist/sankhyablocks/p-1c423f5d.entry.js +1 -0
  151. package/dist/sankhyablocks/p-28a0dbf0.entry.js +1 -0
  152. package/dist/sankhyablocks/p-4763d5c2.js +1 -0
  153. package/dist/sankhyablocks/p-4c66200a.entry.js +1 -0
  154. package/dist/sankhyablocks/p-5dc772be.entry.js +1 -0
  155. package/dist/sankhyablocks/p-5ff3e300.entry.js +1 -0
  156. package/dist/sankhyablocks/p-7122cec4.entry.js +1 -0
  157. package/dist/sankhyablocks/p-811b4b9d.js +1 -0
  158. package/dist/sankhyablocks/p-813fe4f7.js +1 -0
  159. package/dist/sankhyablocks/p-9b33a005.entry.js +1 -0
  160. package/dist/sankhyablocks/p-9e22ec87.entry.js +1 -0
  161. package/dist/sankhyablocks/p-9f7239df.entry.js +1 -0
  162. package/dist/sankhyablocks/p-9f7e6e48.js +1 -0
  163. package/dist/sankhyablocks/p-a47e0537.entry.js +1 -0
  164. package/dist/sankhyablocks/p-a9aba60a.entry.js +1 -0
  165. package/dist/sankhyablocks/p-afda7940.entry.js +1 -0
  166. package/dist/sankhyablocks/p-b3a83eaf.entry.js +1 -0
  167. package/dist/sankhyablocks/p-b96a8d40.entry.js +1 -0
  168. package/dist/sankhyablocks/p-c61c0e40.entry.js +1 -0
  169. package/dist/sankhyablocks/p-ca29d028.entry.js +1 -0
  170. package/dist/sankhyablocks/p-cd17abb1.entry.js +1 -0
  171. package/dist/sankhyablocks/p-d3a5366d.entry.js +369 -0
  172. package/dist/sankhyablocks/p-d5703a41.entry.js +1 -0
  173. package/dist/sankhyablocks/p-e5f77a59.entry.js +1 -0
  174. package/dist/sankhyablocks/p-e9e94d51.entry.js +1 -0
  175. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  176. package/dist/types/components/snk-application/snk-application.d.ts +1 -1
  177. package/dist/types/components.d.ts +1 -1
  178. package/package.json +11 -3
  179. package/react/components.d.ts +29 -0
  180. package/react/components.js +29 -0
  181. package/react/components.js.map +1 -1
  182. package/dist/cjs/index-20a7d705.js +0 -733
  183. package/dist/esm/index-8d3572c4.js +0 -707
  184. package/dist/sankhyablocks/p-5fa264b9.js +0 -1
  185. package/dist/sankhyablocks/p-f3bdd8c3.entry.js +0 -57
  186. package/dist/types/temp/ApplicationUtils.d.ts +0 -7
@@ -2,1242 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-20a7d705.js');
5
+ const index = require('./index-6ac5268e.js');
6
+ const core = require('@sankhyalabs/core');
7
+ const _commonjsHelpers = require('./_commonjsHelpers-537d719a.js');
8
+ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
6
9
 
7
- /**
8
- * Classe com utiliários comuns para Strings.
9
- */
10
- class StringUtils {
11
- /**
12
- * Verifica se a string está vazia.
13
- * Valores null e undefined são considerados como vazio.
14
- *
15
- * @param value String para ser validada.
16
- */
17
- static isEmpty(value) {
18
- if (value == undefined || value === null) {
19
- return true;
20
- }
21
- value = value.toString();
22
- value = value.trim();
23
- if (value.length === 0) {
24
- return true;
25
- }
26
- return false;
27
- }
28
- /**
29
- * Remove acentos de vogais, substitui Ç por c e retorna a string em caixa alta.
30
- *
31
- * @param value String para ser transformada.
32
- */
33
- static replaceAccentuatedChars(text) {
34
- text = text.toUpperCase();
35
- text = text.replace(/[À]/, "A");
36
- text = text.replace(/[Á]/, "A");
37
- text = text.replace(/[Â]/, "A");
38
- text = text.replace(/[Ã]/, "A");
39
- text = text.replace(/[Ä]/, "A");
40
- text = text.replace(/[È]/, "E");
41
- text = text.replace(/[É]/, "E");
42
- text = text.replace(/[Ê]/, "E");
43
- text = text.replace(/[Ë]/, "E");
44
- text = text.replace(/[Ì]/, "I");
45
- text = text.replace(/[Í]/, "I");
46
- text = text.replace(/[Î]/, "I");
47
- text = text.replace(/[Ï]/, "I");
48
- text = text.replace(/[Ò]/, "O");
49
- text = text.replace(/[Ó]/, "O");
50
- text = text.replace(/[Ô]/, "O");
51
- text = text.replace(/[Ö]/, "O");
52
- text = text.replace(/[Ù]/, "U");
53
- text = text.replace(/[Ú]/, "U");
54
- text = text.replace(/[Û]/, "U");
55
- text = text.replace(/[Ü]/, "U");
56
- text = text.replace(/[Ç]/, "C");
57
- return text.replace(/[^a-z0-9]/gi, '');
58
- }
59
- }
60
-
61
- /**
62
- * `MaskFormatter` é usado para formatar strings. Seu comportamento
63
- * é controlado pela formato do atributo `mask` que especifica quais
64
- * caracteres são válidos e onde devem estar posicionados, intercalando-os
65
- * com eventuais caracteres literais expressados no padrão informado.
66
- * Sua implementação é inspirada pela implementação em Java do [MaskFormatter](https://docs.oracle.com/javase/7/docs/api/javax/swing/text/MaskFormatter.html).
67
- *
68
- * Para o padrão da máscara podem ser usados os seguintes caracteres especiais:
69
- *
70
- * | Caractere | Comportamento |
71
- * |:---------:|-------------------------------------------------------------------------------------------------------------|
72
- * | # | Qualquer número |
73
- * | ' | "Escapa" o caractere que vem na sequência. Útil quando desejamos converter um caractere especial em literal.|
74
- * | U | Qualquer letra. Transforma letras maiúsculas em maiúsculas. |
75
- * | L | Qualquer letra. Transforma letras maiúsculas em minúsculas. |
76
- * | A | Qualquer letra ou número. |
77
- * | ? | Qualquer letra. Preserva maiúsculas e minúsculas. |
78
- * | * | Qualquer caractere. |
79
- *
80
- * Os demais caracteres presentes no padrão serão tratados como literais, isto é,
81
- * serão apenas inseridos naquela posição.
82
- *
83
- * Quando o o valor a ser formatado é menor que a máscara um 'placeHolder'
84
- * será inserido em cada posição ausente, completando a formatação.
85
- * Por padrão será usado um espaço em branco como 'placeHolder' mas
86
- * esse valor pode ser alterado.
87
- *
88
- * For por exemplo:
89
- * '''
90
- * const formatter: MaskFormatter = new MaskFormatter("###-####");
91
- * formatter.placeholder = '_';
92
- * console.log(formatter.format("123"));
93
- * '''
94
- * resultaria na string '123-____'.
95
- *
96
- * ##Veja mais alguns exemplos:
97
- * |Padrão |Máscara |Entrada |Saída |
98
- * |----------------|------------------|--------------|------------------|
99
- * |Telefone |(##) ####-#### |3432192515 |(34) 3219-2515 |
100
- * |CPF |###.###.###-## |12345678901 |123.456.789-01 |
101
- * |CNPJ |##.###.###/####-##|12345678901234|12.345.678/9012-34|
102
- * |CEP |##.###-### |12345678 |12.345-678 |
103
- * |PLACA (veículo) |UUU-#### |abc1234 |ABC-1234 |
104
- * |Cor RGB |'#AAAAAA |00000F0 |#0000F0 |
105
- *
106
- */
107
- class MaskFormatter {
108
- constructor(mask) {
109
- this._mask = '';
110
- this._maskChars = new Array();
111
- /**
112
- * Determina qual caractere será usado dos caracteres não presentes no valor
113
- * ou seja, aqueles que o usuário ainda não informou. Por padrão usamos um espaço
114
- */
115
- this.placeholder = ' ';
116
- this.mask = mask;
117
- }
118
- /**
119
- * Setter para mask. Trata-se do padrão que se espera ao formatar o texto.
120
- */
121
- set mask(mask) {
122
- this._mask = mask;
123
- this.updateInternalMask();
124
- }
125
- /**
126
- * Getter para mask
127
- *
128
- * @return A última máscara informada.
129
- */
130
- get mask() {
131
- return this._mask;
132
- }
133
- /**
134
- * Formata a string passada baseada na máscara definda pelo atributo mask.
135
- *
136
- * @param value Valor a ser formatado
137
- * @return O valor processado de acordo com o padrão
138
- */
139
- format(value) {
140
- let result = '';
141
- const index = [0];
142
- let counter = 0;
143
- const maxCounter = this._maskChars.length;
144
- while (counter < maxCounter) {
145
- result = this._maskChars[counter].append(result, value, index);
146
- counter++;
147
- }
148
- return result;
149
- }
150
- /**
151
- * Preparamos a formatação internamente de acordo com o padrão.
152
- */
153
- updateInternalMask() {
154
- this._maskChars.length = 0;
155
- if (this.mask != null) {
156
- let counter = 0;
157
- const maxCounter = this.mask.length;
158
- while (counter < maxCounter) {
159
- let maskChar = this.mask.charAt(counter);
160
- switch (maskChar) {
161
- case MaskFormatter.DIGIT_KEY:
162
- this._maskChars.push(new MaskFormatter.DigitMaskCharacter(this, maskChar));
163
- break;
164
- case MaskFormatter.LITERAL_KEY:
165
- if (++counter < maxCounter) {
166
- maskChar = this.mask.charAt(counter);
167
- this._maskChars.push(new MaskFormatter.LiteralCharacter(this, maskChar));
168
- }
169
- break;
170
- case MaskFormatter.UPPERCASE_KEY:
171
- this._maskChars.push(new MaskFormatter.UpperCaseCharacter(this, maskChar));
172
- break;
173
- case MaskFormatter.LOWERCASE_KEY:
174
- this._maskChars.push(new MaskFormatter.LowerCaseCharacter(this, maskChar));
175
- break;
176
- case MaskFormatter.ALPHA_NUMERIC_KEY:
177
- this._maskChars.push(new MaskFormatter.AlphaNumericCharacter(this, maskChar));
178
- break;
179
- case MaskFormatter.CHARACTER_KEY:
180
- this._maskChars.push(new MaskFormatter.CharCharacter(this, maskChar));
181
- break;
182
- case MaskFormatter.ANYTHING_KEY:
183
- this._maskChars.push(new MaskFormatter.MaskCharacter(this, maskChar));
184
- break;
185
- default:
186
- this._maskChars.push(new MaskFormatter.LiteralCharacter(this, maskChar));
187
- break;
188
- }
189
- counter++;
190
- }
191
- }
192
- }
193
- }
194
- MaskFormatter.DIGIT_KEY = "#";
195
- MaskFormatter.LITERAL_KEY = "'";
196
- MaskFormatter.UPPERCASE_KEY = "U";
197
- MaskFormatter.LOWERCASE_KEY = "L";
198
- MaskFormatter.ALPHA_NUMERIC_KEY = "A";
199
- MaskFormatter.CHARACTER_KEY = "?";
200
- MaskFormatter.ANYTHING_KEY = "*";
201
- //
202
- // Classes internas usadas para representar a máscara.
203
- //
204
- MaskFormatter.MaskCharacter = class {
205
- constructor(maskFormatter, type) {
206
- this.maskFormatter = maskFormatter;
207
- this.type = type;
208
- }
209
- /**
210
- * Cada subclasse deve sobrescrever o retornando true, caso represente
211
- * um caractere literal. Por padrão o retorno é false.
212
- */
213
- isLiteral() {
214
- return false;
215
- }
216
- /**
217
- * Returns true if <code>aChar</code> is a valid reprensentation of
218
- * the receiver. The default implementation returns true if the
219
- * receiver represents a literal character and <code>getChar</code>
220
- * == aChar. Otherwise, this will return true is <code>aChar</code>
221
- * is contained in the valid characters and not contained
222
- * in the invalid characters.
223
- */
224
- isValidCharacter(aChar) {
225
- if (this.isLiteral()) {
226
- return (this.getChar(aChar) == aChar);
227
- }
228
- aChar = this.getChar(aChar);
229
- return true;
230
- }
231
- /**
232
- * Returns the character to insert for <code>aChar</code>. The
233
- * default implementation returns <code>aChar</code>. Subclasses
234
- * that wish to do some sort of mapping, perhaps lower case to upper
235
- * case should override this and do the necessary mapping.
236
- */
237
- getChar(aChar) {
238
- return aChar;
239
- }
240
- /**
241
- * Appends the necessary character in <code>formatting</code> at
242
- * <code>index</code> to <code>buff</code>.
243
- */
244
- append(result, formatting, index) {
245
- const inString = index[0] < formatting.length;
246
- const aChar = inString ? formatting.charAt(index[0]) : '';
247
- if (this.isLiteral()) {
248
- const literal = this.getChar(aChar);
249
- result += literal;
250
- if (literal === aChar) {
251
- index[0] = index[0] + 1;
252
- }
253
- }
254
- else if (index[0] >= formatting.length) {
255
- result += this.maskFormatter.placeholder;
256
- index[0] = index[0] + 1;
257
- }
258
- else if (this.isValidCharacter(aChar)) {
259
- result += this.getChar(aChar);
260
- index[0] = index[0] + 1;
261
- }
262
- else {
263
- throw new Error(`Valor inválido: "${aChar}". Na posição ${index[0] + 1} espera-se ${this.getFormatMessage()}.`);
264
- }
265
- return result;
266
- }
267
- getFormatMessage() {
268
- let message;
269
- switch (this.type) {
270
- case MaskFormatter.UPPERCASE_KEY:
271
- case MaskFormatter.LOWERCASE_KEY:
272
- case MaskFormatter.CHARACTER_KEY:
273
- message = 'uma letra';
274
- break;
275
- case MaskFormatter.DIGIT_KEY:
276
- message = 'um número';
277
- break;
278
- case MaskFormatter.ALPHA_NUMERIC_KEY:
279
- message = 'uma letra ou um número';
280
- break;
281
- default:
282
- message = '';
283
- }
284
- return message;
285
- }
286
- };
287
- MaskFormatter.LiteralCharacter = class extends MaskFormatter.MaskCharacter {
288
- constructor(maskFormatter, fixedChar) {
289
- super(maskFormatter, fixedChar);
290
- this._fixedChar = fixedChar;
291
- }
292
- isLiteral() {
293
- return true;
294
- }
295
- getChar(aChar) {
296
- return this._fixedChar;
297
- }
298
- };
299
- MaskFormatter.DigitMaskCharacter = class extends MaskFormatter.MaskCharacter {
300
- isValidCharacter(aChar) {
301
- return (this.isDigit(aChar) && super.isValidCharacter(aChar));
302
- }
303
- isDigit(char) {
304
- return char >= '0' && char <= '9';
305
- }
306
- };
307
- MaskFormatter.UpperCaseCharacter = class extends MaskFormatter.MaskCharacter {
308
- isValidCharacter(aChar) {
309
- return (/[a-z]/i.test(aChar) && super.isValidCharacter(aChar));
310
- }
311
- getChar(aChar) {
312
- return aChar.toUpperCase();
313
- }
314
- };
315
- MaskFormatter.LowerCaseCharacter = class extends MaskFormatter.MaskCharacter {
316
- isValidCharacter(aChar) {
317
- return (/[a-z]/i.test(aChar) && super.isValidCharacter(aChar));
318
- }
319
- getChar(aChar) {
320
- return aChar.toLocaleLowerCase();
321
- }
322
- };
323
- MaskFormatter.AlphaNumericCharacter = class extends MaskFormatter.MaskCharacter {
324
- isValidCharacter(aChar) {
325
- //FIXME: talvez seja problema usar regex aqui... avaliar se existe forma mais barata
326
- return (/[a-z0-9]/i.test(aChar)) && super.isValidCharacter(aChar);
327
- }
328
- };
329
- MaskFormatter.CharCharacter = class extends MaskFormatter.MaskCharacter {
330
- isValidCharacter(aChar) {
331
- //FIXME: talvez seja problema usar regex aqui... avaliar se existe forma mais barata
332
- return (/[a-z]/i.test(aChar) && super.isValidCharacter(aChar));
333
- }
334
- };
335
-
336
- class DateUtils {
337
- static clearTime(date, adjustDayLightSavingTime = true) {
338
- const newDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0, 0);
339
- return adjustDayLightSavingTime ? DateUtils.adjustDLST(newDate) : newDate;
340
- }
341
- static strToDate(strValue, adjustDayLightSavingTime = true, monthYearMode = false) {
342
- /** monthYearMode é um booleano para usar o formato MM/YYYY.
343
- * Quando ativado, é retornado o primeiro dia do mês apenas para construir a data.
344
- * Não há necessidade de verificar o horário de verão quando utilizado esse modo. */
345
- let parts;
346
- if (monthYearMode) {
347
- parts = /^(1[0-2]|0[1-9]|[1-9])[^\d]?(\d{2}|\d{4})(?:\s(\d{1,2}):(\d{1,2}):?(\d{0,2}))?$/.exec(strValue);
348
- }
349
- else {
350
- parts = /^(3[01]|[1-2]\d|0[1-9]|[1-9])[^\d]?(1[0-2]|0[1-9]|[1-9])[^\d]?(\d{2}|\d{4})(?:\s(\d{1,2}):(\d{1,2}):?(\d{0,2}))?$/.exec(strValue);
351
- }
352
- if (!parts) {
353
- return undefined;
354
- }
355
- var day = monthYearMode ? 1 : Number(parts[1]);
356
- var month = Number(parts[(monthYearMode ? 1 : 2)]);
357
- var year = Number(parts[(monthYearMode ? 2 : 3)]);
358
- var hour = Number(parts[(monthYearMode ? 3 : 4)] || 0);
359
- var min = Number(parts[(monthYearMode ? 4 : 5)] || 0);
360
- var sec = Number(parts[(monthYearMode ? 5 : 6)] || 0);
361
- if (year < 100) {
362
- year += year < 30 ? 2000 : 1900;
363
- }
364
- let date = new Date(year, month - 1, day, hour, min, sec, 0);
365
- if (adjustDayLightSavingTime === true && !monthYearMode && hour == 0) {
366
- date = DateUtils.adjustDLST(date);
367
- }
368
- return date;
369
- }
370
- static adjustDLST(date) {
371
- //Work around para corrigir o Bug do horário de verão.
372
- if (date.getHours() == 23) {
373
- return new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1, 1, 0, 0, 0);
374
- }
375
- return date;
376
- }
377
- }
378
-
379
- new MaskFormatter("##:##");
380
-
381
- /**
382
- * Representa as propriedades necessárias para se executar uma requisição.
383
- */
384
- /** Representa os verbos HTTP suportados */
385
- var Method;
386
- (function (Method) {
387
- Method[Method["GET"] = 0] = "GET";
388
- Method[Method["PUT"] = 1] = "PUT";
389
- Method[Method["POST"] = 2] = "POST";
390
- Method[Method["DELETE"] = 3] = "DELETE";
391
- })(Method || (Method = {}));
392
-
393
- var DataType;
394
- (function (DataType) {
395
- DataType["NUMBER"] = "NUMBER";
396
- DataType["DATE"] = "DATE";
397
- DataType["TEXT"] = "TEXT";
398
- DataType["BOOLEAN"] = "BOOLEAN";
399
- DataType["OBJECT"] = "OBJECT";
400
- })(DataType || (DataType = {}));
401
- const convertType = (dataType, value) => {
402
- if (value === undefined || value === null) {
403
- return value;
404
- }
405
- switch (dataType) {
406
- case DataType.NUMBER:
407
- return value === "" || isNaN(value) ? null : Number(value);
408
- case DataType.OBJECT:
409
- return typeof value === "string" ? JSON.parse(value) : value;
410
- case DataType.BOOLEAN:
411
- return Boolean(value);
412
- case DataType.DATE:
413
- return new Date(value.toString());
414
- default:
415
- return value;
416
- }
417
- };
418
-
419
- class DataUnitAction {
420
- constructor(type, payload) {
421
- this._type = type;
422
- this._payload = payload;
423
- }
424
- get type() {
425
- return this._type;
426
- }
427
- get payload() {
428
- return this._payload;
429
- }
430
- }
431
- var Action;
432
- (function (Action) {
433
- Action["LOADING_METADATA"] = "loadingMetadata";
434
- Action["METADATA_LOADED"] = "metadataLoaded";
435
- Action["LOADING_DATA"] = "loadingData";
436
- Action["DATA_LOADED"] = "dataLoaded";
437
- Action["SAVING_DATA"] = "savingData";
438
- Action["DATA_SAVED"] = "dataSaved";
439
- Action["REMOVING_RECORDS"] = "removingRecords";
440
- Action["RECORDS_REMOVED"] = "recordsRemoved";
441
- Action["RECORDS_ADDED"] = "recordsAdded";
442
- Action["RECORDS_COPIED"] = "recordsCopied";
443
- Action["DATA_CHANGED"] = "dataChanged";
444
- Action["EDITION_CANCELED"] = "editionCanceled";
445
- Action["CHANGE_UNDONE"] = "changeUndone";
446
- Action["CHANGE_REDONE"] = "changeRedone";
447
- Action["SELECTION_CHANGED"] = "selectionChanged";
448
- Action["NEXT_SELECTED"] = "nextSelected";
449
- Action["PREVIOUS_SELECTED"] = "previousSelected";
450
- Action["STATE_CHANGED"] = "stateChanged";
451
- })(Action || (Action = {}));
452
-
453
- /**
454
- * Essa classe representa uma interpretação do padrão de projetos Flux.
455
- * No padrão Flux os dados da aplicação são chamados de "estado" e existem
456
- * algumas regras para gerenciamento/manipulação desse estado:
457
- *
458
- * 1 - O estado é imutável.
459
- * 2 - Toda modificação de estado é representada por uma "ação".
460
- * 3 - Quando "ações" acontecem a "store" cria um novo estado e notifica a todos interessados.
461
- *
462
- * Nessa interpretação desse design pattern, o StateManager faz o papel da store,
463
- * notificando os manipuladores de estado (handlers), que são responsáveis por pedaços
464
- * do estado (slices).
465
- *
466
- * O StateManager mantém dois tipos de estados: "Histórico" e "Não Histórico". No estado
467
- * "Histórico", sempre que uma alteração de estado acontece, o estado anterior é guardado em
468
- * uma pilha, o que permite que possamos voltar no tempo, desfazendo algumas ações
469
- */
470
- class StateManager {
471
- constructor(reducers) {
472
- this._past = [];
473
- this._future = [];
474
- this._present = {};
475
- this._nonHist = {};
476
- this._histClean = false;
477
- this._reducers = reducers;
478
- }
479
- process(action) {
480
- const oldPresent = this._present;
481
- let hasHistChange = false;
482
- this._histClean = false;
483
- this._reducers.forEach(reducer => {
484
- const sliceName = reducer.sliceName;
485
- const isHistoric = this.isHistoric(sliceName);
486
- const oldSlice = this.getSlice(sliceName, isHistoric);
487
- const newSlice = reducer.reduce(this, oldSlice, action);
488
- if (newSlice !== oldSlice) {
489
- this.updateSlice(sliceName, newSlice, isHistoric);
490
- hasHistChange || (hasHistChange = isHistoric);
491
- }
492
- });
493
- if (hasHistChange && !this._histClean) {
494
- this._past.push(oldPresent);
495
- this._future = [];
496
- document.dispatchEvent(new CustomEvent("undoableAction", { detail: this }));
497
- }
498
- }
499
- select(sliceName, selector) {
500
- const isHistoric = this.isHistoric(sliceName);
501
- return selector(this.getSlice(sliceName, isHistoric));
502
- }
503
- isHistoric(slice) {
504
- return slice.startsWith("hist::");
505
- }
506
- updateSlice(name, slice, isHistoric) {
507
- if (isHistoric) {
508
- this._present = Object.assign(Object.assign({}, this._present), { [name]: slice });
509
- if (slice === undefined) {
510
- delete this._present[name];
511
- }
512
- }
513
- else {
514
- this._nonHist = Object.assign(Object.assign({}, this._nonHist), { [name]: slice });
515
- if (slice === undefined) {
516
- delete this._nonHist[name];
517
- }
518
- }
519
- }
520
- getSlice(name, isHistoric) {
521
- return isHistoric ? this._present[name] : this._nonHist[name];
522
- }
523
- canUndo() {
524
- return this._past.length > 0;
525
- }
526
- canRedo() {
527
- return this._future.length > 0;
528
- }
529
- undo() {
530
- if (this.canUndo()) {
531
- this._future.push(this._present);
532
- this._present = this._past.pop();
533
- }
534
- }
535
- redo() {
536
- if (this.canRedo()) {
537
- this._past.push(this._present);
538
- this._present = this._future.pop();
539
- }
540
- }
541
- clearUndo() {
542
- this._histClean = true;
543
- this._past = [];
544
- this._future = [];
545
- }
546
- persist() {
547
- }
548
- }
549
-
550
- class HistReducerImpl {
551
- constructor() {
552
- this.sliceName = "";
553
- }
554
- reduce(stateManager, _currentState, action) {
555
- switch (action.type) {
556
- case Action.DATA_SAVED:
557
- case Action.EDITION_CANCELED:
558
- stateManager.clearUndo();
559
- break;
560
- case Action.CHANGE_UNDONE:
561
- stateManager.undo();
562
- break;
563
- case Action.CHANGE_REDONE:
564
- stateManager.redo();
565
- break;
566
- }
567
- }
568
- }
569
- const HistReducer = new HistReducerImpl();
570
- const canUndo = (stateManager) => {
571
- return stateManager.canUndo();
572
- };
573
- const canRedo = (stateManager) => {
574
- return stateManager.canRedo();
575
- };
576
-
577
- class UnitMetadataReducerImpl {
578
- constructor() {
579
- this.sliceName = "unitMetadata";
580
- }
581
- reduce(_stateManager, currentState, action) {
582
- if (action.type === Action.METADATA_LOADED) {
583
- return action.payload;
584
- }
585
- return currentState;
586
- }
587
- }
588
- const UnitMetadataReducer = new UnitMetadataReducerImpl();
589
- const getMetadata = (stateManager) => {
590
- return stateManager.select(UnitMetadataReducer.sliceName, (state) => state);
591
- };
592
- const getField = (stateManager, fieldName) => {
593
- const md = getMetadata(stateManager);
594
- return md ? md.fields.find(fmd => fmd.name === fieldName) : undefined;
595
- };
596
-
597
- class RemovedRecordsReducerImpl {
598
- constructor() {
599
- this.sliceName = "hist::removedRecords";
600
- }
601
- reduce(_stateManager, currentState, action) {
602
- switch (action.type) {
603
- case Action.RECORDS_REMOVED:
604
- const { records, buffered } = action.payload;
605
- if (buffered) {
606
- return (currentState || []).concat(records);
607
- }
608
- return currentState;
609
- case Action.EDITION_CANCELED:
610
- case Action.DATA_SAVED:
611
- return undefined;
612
- }
613
- return currentState;
614
- }
615
- }
616
- const RemovedRecordsReducer = new RemovedRecordsReducerImpl();
617
- const getRemovedRecords = (stateManager) => {
618
- return stateManager.select(RemovedRecordsReducer.sliceName, (state) => state);
619
- };
620
-
621
- class RecordsReducerImpl {
622
- constructor() {
623
- this.sliceName = "records";
624
- }
625
- reduce(stateManager, currentState, action) {
626
- switch (action.type) {
627
- case Action.DATA_LOADED:
628
- return action.payload;
629
- case Action.RECORDS_REMOVED:
630
- const { records, buffered } = action.payload;
631
- if (!buffered) {
632
- return currentState.filter(r => !records.includes(r.__record__id__));
633
- }
634
- return currentState;
635
- case Action.DATA_SAVED:
636
- const recordsMap = new Map();
637
- const currentRecords = getRecords(stateManager);
638
- if (currentRecords) {
639
- const removed = getRemovedRecords(stateManager) || [];
640
- currentRecords.forEach(r => {
641
- if (!removed.includes(r.__record__id__)) {
642
- recordsMap.set(r.__record__id__, r);
643
- }
644
- });
645
- }
646
- const savedRecords = action.payload.records;
647
- savedRecords.forEach(sr => {
648
- const recordId = sr.__old__id__ || sr.__record__id__;
649
- const newRecord = Object.assign({}, sr);
650
- delete newRecord["__old__id__"];
651
- recordsMap.set(recordId, newRecord);
652
- });
653
- return Array.from(recordsMap.values());
654
- }
655
- return currentState;
656
- }
657
- }
658
- const RecordsReducer = new RecordsReducerImpl();
659
- const getRecords = (stateManager) => {
660
- return stateManager.select(RecordsReducer.sliceName, (state) => state);
661
- };
662
-
663
- class AddedRecordsReducerImpl {
664
- constructor() {
665
- this.sliceName = "hist::addedRecords";
666
- }
667
- reduce(_stateManager, currentState, action) {
668
- switch (action.type) {
669
- case Action.RECORDS_ADDED:
670
- case Action.RECORDS_COPIED:
671
- return (currentState || []).concat(action.payload);
672
- case Action.DATA_SAVED:
673
- case Action.EDITION_CANCELED:
674
- return undefined;
675
- }
676
- return currentState;
677
- }
678
- }
679
- const AddedRecordsReducer = new AddedRecordsReducerImpl();
680
- const getAddedRecords = (stateManager) => {
681
- return stateManager.select(AddedRecordsReducer.sliceName, (state) => state);
682
- };
683
- const prepareAddedRecordId = (stateManager, source) => {
684
- let index = (getAddedRecords(stateManager) || []).length;
685
- return source.map(item => { return Object.assign(Object.assign({}, item), { __record__id__: "NEW_" + (index++) }); });
686
- };
687
-
688
- class ChangesReducerImpl {
689
- constructor() {
690
- this.sliceName = "hist::changes";
691
- }
692
- reduce(stateManager, currentState, action) {
693
- switch (action.type) {
694
- case Action.DATA_CHANGED:
695
- const selection = action.payload.records || getSelection(stateManager);
696
- if (selection) {
697
- const newState = new Map(currentState);
698
- selection.forEach(recordId => {
699
- const newChanges = Object.assign(Object.assign({}, newState.get(recordId)), action.payload);
700
- delete newChanges.records;
701
- newState.set(recordId, newChanges);
702
- });
703
- return newState;
704
- }
705
- return currentState;
706
- case Action.DATA_SAVED:
707
- case Action.EDITION_CANCELED:
708
- return undefined;
709
- }
710
- return currentState;
711
- }
712
- }
713
- const ChangesReducer = new ChangesReducerImpl();
714
- const getChanges = (stateManager) => {
715
- return stateManager.select(ChangesReducer.sliceName, (state) => state);
716
- };
717
- const isDirty = (stateManager) => {
718
- if (getAddedRecords(stateManager) !== undefined) {
719
- return true;
720
- }
721
- if (getRemovedRecords(stateManager) !== undefined) {
722
- return true;
723
- }
724
- return getChanges(stateManager) !== undefined;
725
- };
726
- const getChangesToSave = (dataUnit, stateManager) => {
727
- const result = [];
728
- const changes = getChanges(stateManager);
729
- const records = getRecords(stateManager);
730
- records === null || records === void 0 ? void 0 : records.forEach(r => {
731
- if (changes) {
732
- const c = changes.get(r.__record__id__);
733
- if (c) {
734
- result.push(new Change(dataUnit, r, c, ChangeOperation.UPDATE));
735
- }
736
- }
737
- });
738
- const addedRecords = getAddedRecords(stateManager);
739
- if (addedRecords) {
740
- addedRecords.forEach(r => {
741
- result.push(new Change(dataUnit, r, changes === null || changes === void 0 ? void 0 : changes.get(r.__record__id__), ChangeOperation.INSERT));
742
- });
743
- }
744
- const removedRecords = getRemovedRecords(stateManager);
745
- const recordsById = {};
746
- records === null || records === void 0 ? void 0 : records.forEach(r => recordsById[r.__record__id__] = r);
747
- if (removedRecords) {
748
- removedRecords.forEach(id => {
749
- result.push(new Change(dataUnit, recordsById[id], undefined, ChangeOperation.DELETE));
750
- });
751
- }
752
- return result;
753
- };
754
-
755
- class CurrentRecordsReducerImpl {
756
- constructor() {
757
- this.sliceName = "currentRecords";
758
- }
759
- reduce(stateManager, _currentState, _action) {
760
- let records = getRecords(stateManager);
761
- const added = getAddedRecords(stateManager);
762
- if (!records && !added) {
763
- return undefined;
764
- }
765
- if (added) {
766
- records = (records || []).concat(added);
767
- }
768
- const removedRecords = getRemovedRecords(stateManager);
769
- if (removedRecords) {
770
- records = records.filter(r => !removedRecords.includes(r.__record__id__));
771
- }
772
- const changes = getChanges(stateManager);
773
- return new Map(records.map(r => {
774
- const recordId = r.__record__id__;
775
- const record = Object.assign(Object.assign({}, r), changes === null || changes === void 0 ? void 0 : changes.get(recordId));
776
- return [recordId, record];
777
- }));
778
- }
779
- }
780
- const CurrentRecordsReducer = new CurrentRecordsReducerImpl();
781
- const getCurrentRecords = (stateManager) => {
782
- return stateManager.select(CurrentRecordsReducer.sliceName, (state) => state);
783
- };
784
- const getFieldValue = (stateManager, fieldName) => {
785
- const selection = getSelection(stateManager);
786
- if (selection && selection.length > 0) {
787
- const currentRecords = getCurrentRecords(stateManager);
788
- if (currentRecords) {
789
- const record = currentRecords.get(selection[0]);
790
- return record ? record[fieldName] : undefined;
791
- }
792
- }
793
- return undefined;
794
- };
795
-
796
- class SelectionReducerImpl {
797
- constructor() {
798
- this.sliceName = "hist::selection";
799
- }
800
- reduce(stateManager, currentState, action) {
801
- switch (action.type) {
802
- case Action.RECORDS_ADDED:
803
- case Action.RECORDS_COPIED:
804
- return action.payload.map((r) => r.__record__id__);
805
- case Action.DATA_SAVED:
806
- return updateSavedIds(stateManager, action.payload.records);
807
- case Action.RECORDS_REMOVED:
808
- const removed = action.payload.records;
809
- if (currentState && removed) {
810
- return currentState.filter(recordId => !removed.includes(recordId));
811
- }
812
- return currentState;
813
- case Action.NEXT_SELECTED:
814
- case Action.PREVIOUS_SELECTED:
815
- const currentRecords = getCurrentRecords(stateManager);
816
- if (currentRecords && currentRecords.size > 0) {
817
- let index;
818
- if (!currentState || currentState.length === 0) {
819
- index = action.type === Action.PREVIOUS_SELECTED ? 0 : Math.min(1, currentRecords.size);
820
- }
821
- else {
822
- index = getItemIndex(currentState[0], currentRecords) + (action.type === Action.PREVIOUS_SELECTED ? -1 : 1);
823
- }
824
- if (index < currentRecords.size && index >= 0) {
825
- return [Array.from(currentRecords.values())[index].__record__id__];
826
- }
827
- }
828
- return undefined;
829
- case Action.SELECTION_CHANGED:
830
- const { type, selection: selectionSource } = action.payload;
831
- if (selectionSource && type === "index") {
832
- const currentRecords = getCurrentRecords(stateManager);
833
- if (currentRecords) {
834
- const records = Array.from(currentRecords.values());
835
- const selectionById = [];
836
- selectionSource.forEach((i) => {
837
- if (i > 0 && i < currentRecords.size) {
838
- selectionById.push(records[i].__record__id__);
839
- }
840
- });
841
- return selectionById;
842
- }
843
- }
844
- return selectionSource;
845
- }
846
- return currentState;
847
- }
848
- }
849
- const SelectionReducer = new SelectionReducerImpl();
850
- const getSelection = (stateManager) => {
851
- let selection = stateManager.select(SelectionReducer.sliceName, (state) => state);
852
- const currentRecords = Array.from((getCurrentRecords(stateManager) || new Map()).keys());
853
- if (selection) {
854
- selection = selection.filter(id => currentRecords.includes(id));
855
- }
856
- if (!selection || selection.length === 0) {
857
- if (currentRecords && currentRecords.length > 0) {
858
- return [currentRecords[0]];
859
- }
860
- }
861
- return selection;
862
- };
863
- const hasNext = (stateManager) => {
864
- const records = getCurrentRecords(stateManager);
865
- if (records) {
866
- const selection = stateManager.select(SelectionReducer.sliceName, (state) => state);
867
- if (!selection || selection.length === 0) {
868
- return records.size > 0;
869
- }
870
- return records.size > (getItemIndex(selection[0], records) + 1);
871
- }
872
- return false;
873
- };
874
- const hasPrevious = (stateManager) => {
875
- const records = getCurrentRecords(stateManager);
876
- if (records) {
877
- const selection = stateManager.select(SelectionReducer.sliceName, (state) => state);
878
- if (!selection || selection.length === 0) {
879
- return false;
880
- }
881
- return getItemIndex(selection[0], records) > 0;
882
- }
883
- return false;
884
- };
885
- function getItemIndex(key, map) {
886
- return Array.from(map.keys()).indexOf(key);
887
- }
888
- function updateSavedIds(stateManager, savedRecords) {
889
- const currentSelection = getSelection(stateManager);
890
- if (currentSelection) {
891
- const newSelection = [];
892
- currentSelection.forEach(id => {
893
- const record = savedRecords.find(r => r.__old__id__ === id);
894
- if (record) {
895
- newSelection.push(record.__record__id__);
896
- }
897
- else {
898
- newSelection.push(id);
899
- }
900
- });
901
- return newSelection;
902
- }
903
- return currentSelection;
904
- }
905
-
906
- var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
907
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
908
- return new (P || (P = Promise))(function (resolve, reject) {
909
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
910
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
911
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
912
- step((generator = generator.apply(thisArg, _arguments || [])).next());
913
- });
914
- };
915
- class DataUnit {
916
- constructor(name) {
917
- this._name = name;
918
- this._stateManager = new StateManager([
919
- HistReducer,
920
- UnitMetadataReducer,
921
- RecordsReducer,
922
- RemovedRecordsReducer,
923
- AddedRecordsReducer,
924
- SelectionReducer,
925
- ChangesReducer,
926
- CurrentRecordsReducer
927
- ]);
928
- this._observers = [];
929
- this._filterProviders = [];
930
- this._sortingProvider = undefined;
931
- this._interceptors = [];
932
- }
933
- get name() {
934
- return this._name;
935
- }
936
- // Métodos privados
937
- validateAndTypeValue(fieldName, newValue) {
938
- //FIXME: Validações devem ser feitas aqui
939
- const descriptor = this.getField(fieldName);
940
- return descriptor ? convertType(descriptor.dataType, newValue) : newValue;
941
- }
942
- getFilters() {
943
- let filters = undefined;
944
- this._filterProviders.forEach(p => {
945
- const f = p.getFilter(this.name);
946
- if (f) {
947
- filters = (filters || []).concat(f);
948
- }
949
- });
950
- return filters;
951
- }
952
- getSort() {
953
- return this._sortingProvider ? this._sortingProvider.getSort(this._name) : undefined;
954
- }
955
- // Loaders
956
- loadMetadata() {
957
- return __awaiter(this, void 0, void 0, function* () {
958
- this.dispatchAction(Action.LOADING_METADATA);
959
- return new Promise((resolve, fail) => {
960
- if (this.metadataLoader) {
961
- this.metadataLoader(this).then(metadata => {
962
- this.metadata = metadata;
963
- resolve(this.metadata);
964
- }).catch(error => fail(error));
965
- }
966
- });
967
- });
968
- }
969
- loadData() {
970
- return __awaiter(this, void 0, void 0, function* () {
971
- this.dispatchAction(Action.LOADING_DATA);
972
- return new Promise((resolve, fail) => {
973
- if (this.dataLoader) {
974
- const sort = this.getSort();
975
- const filters = this.getFilters();
976
- this.dataLoader(this, sort, filters).then(records => {
977
- this.records = records;
978
- resolve(this.records);
979
- }).catch(error => fail(error));
980
- }
981
- });
982
- });
983
- }
984
- saveData() {
985
- return __awaiter(this, void 0, void 0, function* () {
986
- const changes = getChangesToSave(this._name, this._stateManager);
987
- if (changes.length > 0) {
988
- this.dispatchAction(Action.SAVING_DATA);
989
- return new Promise((resolve, fail) => {
990
- if (this.saveLoader) {
991
- this.saveLoader(this, changes).then(records => this.dispatchAction(Action.DATA_SAVED, { changes, records })).catch(error => fail(error));
992
- }
993
- });
994
- }
995
- return Promise.resolve();
996
- });
997
- }
998
- removeSelectedRecords(buffered = false) {
999
- return __awaiter(this, void 0, void 0, function* () {
1000
- const selection = getSelection(this._stateManager);
1001
- if (selection) {
1002
- return this.removeRecords(selection, buffered);
1003
- }
1004
- return Promise.resolve(selection);
1005
- });
1006
- }
1007
- removeRecords(records, buffered = false) {
1008
- return __awaiter(this, void 0, void 0, function* () {
1009
- if (records) {
1010
- if (buffered || !this.removeLoader) {
1011
- this.dispatchAction(Action.RECORDS_REMOVED, { records, buffered: true });
1012
- }
1013
- else {
1014
- this.dispatchAction(Action.REMOVING_RECORDS);
1015
- return new Promise((resolve, fail) => {
1016
- if (this.removeLoader) {
1017
- this.removeLoader(this, records).then(records => {
1018
- this.dispatchAction(Action.RECORDS_REMOVED, { records, buffered: false });
1019
- resolve(records);
1020
- }).catch(error => fail(error));
1021
- }
1022
- });
1023
- }
1024
- }
1025
- return Promise.resolve(records);
1026
- });
1027
- }
1028
- // API
1029
- valueFromString(fieldName, value) {
1030
- const descriptor = this.getField(fieldName);
1031
- return descriptor ? convertType(descriptor.dataType, value) : value;
1032
- }
1033
- addInterceptor(interceptor) {
1034
- this._interceptors.push(interceptor);
1035
- }
1036
- addFilterProvider(provider) {
1037
- this._filterProviders.push(provider);
1038
- }
1039
- set sortingProvider(provider) {
1040
- this._sortingProvider = provider;
1041
- }
1042
- set metadata(md) {
1043
- this.dispatchAction(Action.METADATA_LOADED, md);
1044
- }
1045
- get metadata() {
1046
- return getMetadata(this._stateManager);
1047
- }
1048
- set records(r) {
1049
- this.dispatchAction(Action.DATA_LOADED, r);
1050
- }
1051
- get records() {
1052
- const records = getCurrentRecords(this._stateManager);
1053
- return records ? Array.from(records.values()) : [];
1054
- }
1055
- getField(fieldName) {
1056
- return getField(this._stateManager, fieldName);
1057
- }
1058
- addRecord() {
1059
- this.dispatchAction(Action.RECORDS_ADDED, prepareAddedRecordId(this._stateManager, [{}]));
1060
- }
1061
- copySelected() {
1062
- const selectedRecords = this.getSelectedRecords();
1063
- if (selectedRecords) {
1064
- this.dispatchAction(Action.RECORDS_COPIED, prepareAddedRecordId(this._stateManager, selectedRecords));
1065
- }
1066
- }
1067
- getFieldValue(fieldName) {
1068
- return getFieldValue(this._stateManager, fieldName);
1069
- }
1070
- setFieldValue(fieldName, newValue, records) {
1071
- const typedValue = this.validateAndTypeValue(fieldName, newValue);
1072
- const currentValue = this.getFieldValue(fieldName);
1073
- if (currentValue !== typedValue) {
1074
- this.dispatchAction(Action.DATA_CHANGED, { [fieldName]: typedValue, records });
1075
- }
1076
- }
1077
- getSelection() {
1078
- return getSelection(this._stateManager);
1079
- }
1080
- setSelection(selection) {
1081
- this.dispatchAction(Action.SELECTION_CHANGED, { type: "id", selection });
1082
- }
1083
- setSelectionByIndex(selection) {
1084
- this.dispatchAction(Action.SELECTION_CHANGED, { type: "index", selection });
1085
- }
1086
- getSelectedRecords() {
1087
- const selection = this.getSelection();
1088
- if (selection) {
1089
- const currentRecords = this.records;
1090
- return currentRecords === null || currentRecords === void 0 ? void 0 : currentRecords.filter(r => selection.includes(r.__record__id__));
1091
- }
1092
- }
1093
- nextRecord() {
1094
- this.dispatchAction(Action.NEXT_SELECTED);
1095
- }
1096
- previousRecord() {
1097
- this.dispatchAction(Action.PREVIOUS_SELECTED);
1098
- }
1099
- cancelEdition() {
1100
- this.dispatchAction(Action.EDITION_CANCELED);
1101
- }
1102
- isDirty() {
1103
- return isDirty(this._stateManager);
1104
- }
1105
- hasNext() {
1106
- return hasNext(this._stateManager);
1107
- }
1108
- hasPrevious() {
1109
- return hasPrevious(this._stateManager);
1110
- }
1111
- canUndo() {
1112
- return canUndo(this._stateManager);
1113
- }
1114
- canRedo() {
1115
- return canRedo(this._stateManager);
1116
- }
1117
- undo() {
1118
- this.dispatchAction(Action.CHANGE_UNDONE);
1119
- }
1120
- redo() {
1121
- this.dispatchAction(Action.CHANGE_REDONE);
1122
- }
1123
- toString() {
1124
- return this.name;
1125
- }
1126
- // Actions / State manager
1127
- dispatchAction(actionType, payload) {
1128
- var _a;
1129
- let action = new DataUnitAction(actionType, payload);
1130
- (_a = this._interceptors) === null || _a === void 0 ? void 0 : _a.forEach(interceptor => {
1131
- if (action) {
1132
- action = interceptor.interceptAction(action);
1133
- }
1134
- });
1135
- if (action) {
1136
- this._stateManager.process(action);
1137
- this._observers.forEach(f => f(action));
1138
- }
1139
- }
1140
- subscribe(observer) {
1141
- this._observers.push(observer);
1142
- }
1143
- unsubscribe(observer) {
1144
- this._observers = this._observers.filter(f => f !== observer);
1145
- }
1146
- }
1147
- var ChangeOperation;
1148
- (function (ChangeOperation) {
1149
- ChangeOperation["INSERT"] = "INSERT";
1150
- ChangeOperation["UPDATE"] = "UPDATE";
1151
- ChangeOperation["DELETE"] = "DELETE";
1152
- })(ChangeOperation || (ChangeOperation = {}));
1153
- class Change {
1154
- constructor(dataUnit, record, updates, operation) {
1155
- this.dataUnit = dataUnit;
1156
- this.record = record;
1157
- this.updatingFields = updates;
1158
- this._operation = operation;
1159
- }
1160
- get operation() {
1161
- return this._operation.toString();
1162
- }
1163
- isInsert() {
1164
- return this._operation === ChangeOperation.INSERT;
1165
- }
1166
- isDelete() {
1167
- return this._operation === ChangeOperation.DELETE;
1168
- }
1169
- isUpdate() {
1170
- return this._operation === ChangeOperation.UPDATE;
1171
- }
1172
- }
1173
-
1174
- var SortMode;
1175
- (function (SortMode) {
1176
- SortMode["ASC"] = "ASC";
1177
- SortMode["DESC"] = "DESC";
1178
- })(SortMode || (SortMode = {}));
1179
- var DependencyType;
1180
- (function (DependencyType) {
1181
- DependencyType["SEARCHING"] = "SEARCHING";
1182
- DependencyType["REQUIREMENT"] = "REQUIREMENT";
1183
- DependencyType["VISIBILITY"] = "REQUIREMENT";
1184
- })(DependencyType || (DependencyType = {}));
1185
- var UserInterface;
1186
- (function (UserInterface) {
1187
- UserInterface["FILE"] = "FILE";
1188
- UserInterface["IMAGE"] = "IMAGE";
1189
- UserInterface["DATE"] = "DATE";
1190
- UserInterface["DATETIME"] = "DATETIME";
1191
- UserInterface["TIME"] = "TIME";
1192
- UserInterface["ELAPSEDTIME"] = "ELAPSEDTIME";
1193
- UserInterface["CHECKBOX"] = "CHECKBOX";
1194
- UserInterface["SWITCH"] = "SWITCH";
1195
- UserInterface["OPTIONSELECTOR"] = "OPTIONSELECTOR";
1196
- UserInterface["DECIMALNUMBER"] = "DECIMALNUMBER";
1197
- UserInterface["INTEGERNUMBER"] = "INTEGERNUMBER";
1198
- UserInterface["SEARCH"] = "SEARCH";
1199
- UserInterface["SHORTTEXT"] = "SHORTTEXT";
1200
- UserInterface["PASSWORD"] = "PASSWORD";
1201
- UserInterface["MASKEDTEXT"] = "MASKEDTEXT";
1202
- UserInterface["LONGTEXT"] = "LONGTEXT";
1203
- UserInterface["HTML"] = "HTML";
1204
- })(UserInterface || (UserInterface = {}));
1205
-
1206
- class ApplicationContext {
1207
- static getContextValue(key) {
1208
- return ApplicationContext.getCtx()[key];
1209
- }
1210
- static setContextValue(key, value) {
1211
- ApplicationContext.getCtx()[key] = value;
1212
- }
1213
- static getCtx() {
1214
- let ctx = window.___snkcore___ctx___;
1215
- if (!ctx) {
1216
- ctx = {};
1217
- window.___snkcore___ctx___ = ctx;
1218
- }
1219
- return ctx;
1220
- }
1221
- }
1222
-
1223
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
1224
-
1225
- function createCommonjsModule(fn, basedir, module) {
1226
- return module = {
1227
- path: basedir,
1228
- exports: {},
1229
- require: function (path, base) {
1230
- return commonjsRequire();
1231
- }
1232
- }, fn(module, module.exports), module.exports;
1233
- }
1234
-
1235
- function commonjsRequire () {
1236
- throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
1237
- }
1238
-
1239
- var browserPonyfill = createCommonjsModule(function (module, exports) {
1240
- var global = typeof self !== 'undefined' ? self : commonjsGlobal;
10
+ var browserPonyfill = _commonjsHelpers.createCommonjsModule(function (module, exports) {
11
+ var global = typeof self !== 'undefined' ? self : _commonjsHelpers.commonjsGlobal;
1241
12
  var __self__ = (function () {
1242
13
  function F() {
1243
14
  this.fetch = false;
@@ -1793,7 +564,7 @@ exports.Response = ctx.Response;
1793
564
  module.exports = exports;
1794
565
  });
1795
566
 
1796
- var isObjectLike_1 = createCommonjsModule(function (module, exports) {
567
+ var isObjectLike_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
1797
568
 
1798
569
  Object.defineProperty(exports, '__esModule', {
1799
570
  value: true,
@@ -1809,7 +580,7 @@ function isObjectLike(value) {
1809
580
  }
1810
581
  });
1811
582
 
1812
- var invariant_1 = createCommonjsModule(function (module, exports) {
583
+ var invariant_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
1813
584
 
1814
585
  Object.defineProperty(exports, '__esModule', {
1815
586
  value: true,
@@ -1827,7 +598,7 @@ function invariant(condition, message) {
1827
598
  }
1828
599
  });
1829
600
 
1830
- var location_1 = createCommonjsModule(function (module, exports) {
601
+ var location_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
1831
602
 
1832
603
  Object.defineProperty(exports, '__esModule', {
1833
604
  value: true,
@@ -1867,7 +638,7 @@ function getLocation(source, position) {
1867
638
  }
1868
639
  });
1869
640
 
1870
- var printLocation_1 = createCommonjsModule(function (module, exports) {
641
+ var printLocation_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
1871
642
 
1872
643
  Object.defineProperty(exports, '__esModule', {
1873
644
  value: true,
@@ -1943,7 +714,7 @@ function printPrefixedLines(lines) {
1943
714
  }
1944
715
  });
1945
716
 
1946
- var GraphQLError_1 = createCommonjsModule(function (module, exports) {
717
+ var GraphQLError_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
1947
718
 
1948
719
  Object.defineProperty(exports, '__esModule', {
1949
720
  value: true,
@@ -2212,7 +983,7 @@ function formatError(error) {
2212
983
  }
2213
984
  });
2214
985
 
2215
- var syntaxError_1 = createCommonjsModule(function (module, exports) {
986
+ var syntaxError_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
2216
987
 
2217
988
  Object.defineProperty(exports, '__esModule', {
2218
989
  value: true,
@@ -2233,7 +1004,7 @@ function syntaxError(source, position, description) {
2233
1004
  }
2234
1005
  });
2235
1006
 
2236
- var ast = createCommonjsModule(function (module, exports) {
1007
+ var ast = _commonjsHelpers.createCommonjsModule(function (module, exports) {
2237
1008
 
2238
1009
  Object.defineProperty(exports, '__esModule', {
2239
1010
  value: true,
@@ -2459,7 +1230,7 @@ exports.OperationTypeNode = OperationTypeNode;
2459
1230
  })(OperationTypeNode || (exports.OperationTypeNode = OperationTypeNode = {}));
2460
1231
  });
2461
1232
 
2462
- var directiveLocation = createCommonjsModule(function (module, exports) {
1233
+ var directiveLocation = _commonjsHelpers.createCommonjsModule(function (module, exports) {
2463
1234
 
2464
1235
  Object.defineProperty(exports, '__esModule', {
2465
1236
  value: true,
@@ -2501,7 +1272,7 @@ exports.DirectiveLocation = DirectiveLocation;
2501
1272
  })(DirectiveLocation || (exports.DirectiveLocation = DirectiveLocation = {}));
2502
1273
  });
2503
1274
 
2504
- var kinds = createCommonjsModule(function (module, exports) {
1275
+ var kinds = _commonjsHelpers.createCommonjsModule(function (module, exports) {
2505
1276
 
2506
1277
  Object.defineProperty(exports, '__esModule', {
2507
1278
  value: true,
@@ -2567,7 +1338,7 @@ exports.Kind = Kind;
2567
1338
  })(Kind || (exports.Kind = Kind = {}));
2568
1339
  });
2569
1340
 
2570
- var characterClasses = createCommonjsModule(function (module, exports) {
1341
+ var characterClasses = _commonjsHelpers.createCommonjsModule(function (module, exports) {
2571
1342
 
2572
1343
  Object.defineProperty(exports, '__esModule', {
2573
1344
  value: true,
@@ -2644,7 +1415,7 @@ function isNameContinue(code) {
2644
1415
  }
2645
1416
  });
2646
1417
 
2647
- var blockString = createCommonjsModule(function (module, exports) {
1418
+ var blockString = _commonjsHelpers.createCommonjsModule(function (module, exports) {
2648
1419
 
2649
1420
  Object.defineProperty(exports, '__esModule', {
2650
1421
  value: true,
@@ -2841,7 +1612,7 @@ function printBlockString(value, options) {
2841
1612
  }
2842
1613
  });
2843
1614
 
2844
- var tokenKind = createCommonjsModule(function (module, exports) {
1615
+ var tokenKind = _commonjsHelpers.createCommonjsModule(function (module, exports) {
2845
1616
 
2846
1617
  Object.defineProperty(exports, '__esModule', {
2847
1618
  value: true,
@@ -2887,7 +1658,7 @@ exports.TokenKind = TokenKind;
2887
1658
  })(TokenKind || (exports.TokenKind = TokenKind = {}));
2888
1659
  });
2889
1660
 
2890
- var lexer = createCommonjsModule(function (module, exports) {
1661
+ var lexer = _commonjsHelpers.createCommonjsModule(function (module, exports) {
2891
1662
 
2892
1663
  Object.defineProperty(exports, '__esModule', {
2893
1664
  value: true,
@@ -3895,7 +2666,7 @@ function readName(lexer, start) {
3895
2666
  }
3896
2667
  });
3897
2668
 
3898
- var devAssert_1 = createCommonjsModule(function (module, exports) {
2669
+ var devAssert_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
3899
2670
 
3900
2671
  Object.defineProperty(exports, '__esModule', {
3901
2672
  value: true,
@@ -3911,7 +2682,7 @@ function devAssert(condition, message) {
3911
2682
  }
3912
2683
  });
3913
2684
 
3914
- var inspect_1 = createCommonjsModule(function (module, exports) {
2685
+ var inspect_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
3915
2686
 
3916
2687
  Object.defineProperty(exports, '__esModule', {
3917
2688
  value: true,
@@ -4034,7 +2805,7 @@ function getObjectTag(object) {
4034
2805
  }
4035
2806
  });
4036
2807
 
4037
- var instanceOf_1 = createCommonjsModule(function (module, exports) {
2808
+ var instanceOf_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
4038
2809
 
4039
2810
  Object.defineProperty(exports, '__esModule', {
4040
2811
  value: true,
@@ -4060,7 +2831,7 @@ const instanceOf =
4060
2831
  exports.instanceOf = instanceOf;
4061
2832
  });
4062
2833
 
4063
- var source = createCommonjsModule(function (module, exports) {
2834
+ var source = _commonjsHelpers.createCommonjsModule(function (module, exports) {
4064
2835
 
4065
2836
  Object.defineProperty(exports, '__esModule', {
4066
2837
  value: true,
@@ -4127,7 +2898,7 @@ function isSource(source) {
4127
2898
  }
4128
2899
  });
4129
2900
 
4130
- var parser = createCommonjsModule(function (module, exports) {
2901
+ var parser = _commonjsHelpers.createCommonjsModule(function (module, exports) {
4131
2902
 
4132
2903
  Object.defineProperty(exports, '__esModule', {
4133
2904
  value: true,
@@ -5696,7 +4467,7 @@ function getTokenKindDesc(kind) {
5696
4467
  }
5697
4468
  });
5698
4469
 
5699
- var printString_1 = createCommonjsModule(function (module, exports) {
4470
+ var printString_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
5700
4471
 
5701
4472
  Object.defineProperty(exports, '__esModule', {
5702
4473
  value: true,
@@ -5881,7 +4652,7 @@ const escapeSequences = [
5881
4652
  ];
5882
4653
  });
5883
4654
 
5884
- var visitor = createCommonjsModule(function (module, exports) {
4655
+ var visitor = _commonjsHelpers.createCommonjsModule(function (module, exports) {
5885
4656
 
5886
4657
  Object.defineProperty(exports, '__esModule', {
5887
4658
  value: true,
@@ -6260,7 +5031,7 @@ function getVisitFn(visitor, kind, isLeaving) {
6260
5031
  }
6261
5032
  });
6262
5033
 
6263
- var printer = createCommonjsModule(function (module, exports) {
5034
+ var printer = _commonjsHelpers.createCommonjsModule(function (module, exports) {
6264
5035
 
6265
5036
  Object.defineProperty(exports, '__esModule', {
6266
5037
  value: true,
@@ -6694,7 +5465,7 @@ var _public = {
6694
5465
  /* eslint-env browser */
6695
5466
  var browser = typeof self == 'object' ? self.FormData : window.FormData;
6696
5467
 
6697
- var defaultJsonSerializer = createCommonjsModule(function (module, exports) {
5468
+ var defaultJsonSerializer = _commonjsHelpers.createCommonjsModule(function (module, exports) {
6698
5469
  Object.defineProperty(exports, "__esModule", { value: true });
6699
5470
  exports.defaultJsonSerializer = void 0;
6700
5471
  exports.defaultJsonSerializer = {
@@ -6704,8 +5475,8 @@ exports.defaultJsonSerializer = {
6704
5475
  //# sourceMappingURL=defaultJsonSerializer.js.map
6705
5476
  });
6706
5477
 
6707
- var createRequestBody_1 = createCommonjsModule(function (module, exports) {
6708
- var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
5478
+ var createRequestBody_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
5479
+ var __importDefault = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlobal.__importDefault) || function (mod) {
6709
5480
  return (mod && mod.__esModule) ? mod : { "default": mod };
6710
5481
  };
6711
5482
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -6761,7 +5532,7 @@ exports.default = createRequestBody;
6761
5532
  //# sourceMappingURL=createRequestBody.js.map
6762
5533
  });
6763
5534
 
6764
- var parseArgs = createCommonjsModule(function (module, exports) {
5535
+ var parseArgs = _commonjsHelpers.createCommonjsModule(function (module, exports) {
6765
5536
  Object.defineProperty(exports, "__esModule", { value: true });
6766
5537
  exports.parseBatchRequestsExtendedArgs = exports.parseRawRequestExtendedArgs = exports.parseRequestExtendedArgs = exports.parseBatchRequestArgs = exports.parseRawRequestArgs = exports.parseRequestArgs = void 0;
6767
5538
  function parseRequestArgs(documentOrOptions, variables, requestHeaders) {
@@ -6834,8 +5605,8 @@ exports.parseBatchRequestsExtendedArgs = parseBatchRequestsExtendedArgs;
6834
5605
  //# sourceMappingURL=parseArgs.js.map
6835
5606
  });
6836
5607
 
6837
- var types = createCommonjsModule(function (module, exports) {
6838
- var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
5608
+ var types = _commonjsHelpers.createCommonjsModule(function (module, exports) {
5609
+ var __extends = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlobal.__extends) || (function () {
6839
5610
  var extendStatics = function (d, b) {
6840
5611
  extendStatics = Object.setPrototypeOf ||
6841
5612
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
@@ -6884,8 +5655,8 @@ exports.ClientError = ClientError;
6884
5655
  //# sourceMappingURL=types.js.map
6885
5656
  });
6886
5657
 
6887
- var dist = createCommonjsModule(function (module, exports) {
6888
- var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
5658
+ var dist = _commonjsHelpers.createCommonjsModule(function (module, exports) {
5659
+ var __assign = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlobal.__assign) || function () {
6889
5660
  __assign = Object.assign || function(t) {
6890
5661
  for (var s, i = 1, n = arguments.length; i < n; i++) {
6891
5662
  s = arguments[i];
@@ -6896,26 +5667,26 @@ var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
6896
5667
  };
6897
5668
  return __assign.apply(this, arguments);
6898
5669
  };
6899
- var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5670
+ var __createBinding = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6900
5671
  if (k2 === undefined) k2 = k;
6901
5672
  Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
6902
5673
  }) : (function(o, m, k, k2) {
6903
5674
  if (k2 === undefined) k2 = k;
6904
5675
  o[k2] = m[k];
6905
5676
  }));
6906
- var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
5677
+ var __setModuleDefault = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
6907
5678
  Object.defineProperty(o, "default", { enumerable: true, value: v });
6908
5679
  }) : function(o, v) {
6909
5680
  o["default"] = v;
6910
5681
  });
6911
- var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
5682
+ var __importStar = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlobal.__importStar) || function (mod) {
6912
5683
  if (mod && mod.__esModule) return mod;
6913
5684
  var result = {};
6914
5685
  if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
6915
5686
  __setModuleDefault(result, mod);
6916
5687
  return result;
6917
5688
  };
6918
- var __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
5689
+ var __awaiter = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
6919
5690
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
6920
5691
  return new (P || (P = Promise))(function (resolve, reject) {
6921
5692
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -6924,7 +5695,7 @@ var __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisAr
6924
5695
  step((generator = generator.apply(thisArg, _arguments || [])).next());
6925
5696
  });
6926
5697
  };
6927
- var __generator = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
5698
+ var __generator = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlobal.__generator) || function (thisArg, body) {
6928
5699
  var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
6929
5700
  return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
6930
5701
  function verb(n) { return function (v) { return step([n, v]); }; }
@@ -6951,7 +5722,7 @@ var __generator = (commonjsGlobal && commonjsGlobal.__generator) || function (th
6951
5722
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
6952
5723
  }
6953
5724
  };
6954
- var __rest = (commonjsGlobal && commonjsGlobal.__rest) || function (s, e) {
5725
+ var __rest = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlobal.__rest) || function (s, e) {
6955
5726
  var t = {};
6956
5727
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
6957
5728
  t[p] = s[p];
@@ -6962,7 +5733,7 @@ var __rest = (commonjsGlobal && commonjsGlobal.__rest) || function (s, e) {
6962
5733
  }
6963
5734
  return t;
6964
5735
  };
6965
- var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
5736
+ var __importDefault = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlobal.__importDefault) || function (mod) {
6966
5737
  return (mod && mod.__esModule) ? mod : { "default": mod };
6967
5738
  };
6968
5739
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -7580,7 +6351,7 @@ class DataUnitFetcher {
7580
6351
  }`);
7581
6352
  }
7582
6353
  getDataUnit(entityName, resourceID) {
7583
- const dataUnit = new DataUnit(`dd://${entityName}/${resourceID}`);
6354
+ const dataUnit = new core.DataUnit(`dd://${entityName}/${resourceID}`);
7584
6355
  dataUnit.metadataLoader = (dataUnit) => this.loadMetadata(dataUnit);
7585
6356
  dataUnit.dataLoader = (dataUnit, sort, filters) => this.loadData(dataUnit, sort, filters);
7586
6357
  dataUnit.saveLoader = (dataUnit, changes) => this.saveData(dataUnit, changes);
@@ -7690,7 +6461,7 @@ class DataUnitFetcher {
7690
6461
  }
7691
6462
  removeRecords(dataUnit, recordIds) {
7692
6463
  const changes = recordIds.map((recordId) => {
7693
- return { dataUnit: dataUnit.name, operation: ChangeOperation.DELETE, recordId };
6464
+ return { dataUnit: dataUnit.name, operation: core.ChangeOperation.DELETE, recordId };
7694
6465
  });
7695
6466
  return new Promise((resolve, reject) => {
7696
6467
  HttpFetcher.get()
@@ -7778,7 +6549,7 @@ class ParametersFetcher {
7778
6549
  }
7779
6550
  async asDate(name, resourceID) {
7780
6551
  const paramArr = await this.getParam(name, resourceID);
7781
- return DateUtils.strToDate(this.getValue(paramArr));
6552
+ return core.DateUtils.strToDate(this.getValue(paramArr));
7782
6553
  }
7783
6554
  async getBatchParams(names, resourceID) {
7784
6555
  const paramArr = await this.getParam(names.join(","), resourceID);
@@ -7791,44 +6562,12 @@ class ParametersFetcher {
7791
6562
  if (Array.isArray(obj) && obj.length > 0) {
7792
6563
  obj = obj[0];
7793
6564
  }
7794
- if (StringUtils.isEmpty(obj.resource))
6565
+ if (core.StringUtils.isEmpty(obj.resource))
7795
6566
  return "";
7796
6567
  return obj.resource;
7797
6568
  }
7798
6569
  }
7799
6570
 
7800
- class ApplicationUtils {
7801
- static async showDialog(title, message, icon = null, confirm, critical = false) {
7802
- return new Promise(resolve => {
7803
- let dialog = document.querySelector("ez-dialog");
7804
- if (!dialog) {
7805
- dialog = document.createElement("ez-dialog");
7806
- window.document.body.appendChild(dialog);
7807
- }
7808
- dialog.show(title, message, critical, confirm, icon).then(ok => resolve(ok));
7809
- });
7810
- }
7811
- static async alert(title, message, icon = null) {
7812
- return ApplicationUtils.showDialog(title, message, icon, false, false);
7813
- }
7814
- static async error(title, message, icon = null) {
7815
- return ApplicationUtils.showDialog(title, message, icon, false, true);
7816
- }
7817
- static async confirm(title, message, icon = null, critical = false) {
7818
- return ApplicationUtils.showDialog(title, message, icon, true, critical);
7819
- }
7820
- static async info(message) {
7821
- let toast = document.querySelector("ez-toast");
7822
- if (!toast) {
7823
- toast = document.createElement("ez-toast");
7824
- window.document.body.appendChild(toast);
7825
- }
7826
- toast.message = message;
7827
- toast.fadeTime = 4000;
7828
- toast.show();
7829
- }
7830
- }
7831
-
7832
6571
  class ResourceFetcher {
7833
6572
  constructor() {
7834
6573
  this.templateByQuery = new Map();
@@ -7978,16 +6717,16 @@ const SnkApplication = class {
7978
6717
  return Promise.resolve(this.resourceID);
7979
6718
  }
7980
6719
  async alert(title, message, icon) {
7981
- return ApplicationUtils.alert(title, message, icon);
6720
+ return utils.ApplicationUtils.alert(title, message, icon);
7982
6721
  }
7983
6722
  async error(title, message, icon) {
7984
- return ApplicationUtils.error(title, message, icon);
6723
+ return utils.ApplicationUtils.error(title, message, icon);
7985
6724
  }
7986
6725
  async confirm(title, message, icon, critical) {
7987
- return ApplicationUtils.confirm(title, message, icon, critical);
6726
+ return utils.ApplicationUtils.confirm(title, message, icon, critical);
7988
6727
  }
7989
- async info(message) {
7990
- return ApplicationUtils.info(message);
6728
+ async info(message, options = undefined) {
6729
+ return utils.ApplicationUtils.info(message, options);
7991
6730
  }
7992
6731
  async loadFormConfig(name) {
7993
6732
  return this.formConfigFetcher.loadFormConfig(name, this.resourceID);
@@ -8011,7 +6750,7 @@ const SnkApplication = class {
8011
6750
  return this._formConfigFetcher;
8012
6751
  }
8013
6752
  componentWillLoad() {
8014
- ApplicationContext.setContextValue("__EZUI__SEARCH__OPTION__LOADER__", pesquisaLoadOptions);
6753
+ core.ApplicationContext.setContextValue("__EZUI__SEARCH__OPTION__LOADER__", pesquisaLoadOptions);
8015
6754
  }
8016
6755
  componentDidLoad() {
8017
6756
  this.applicationLoading.emit(true);