@sankhyalabs/ezui 1.1.104 → 1.1.107

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 (60) hide show
  1. package/dist/cjs/{AssetsUtils-69356e76.js → AssetsUtils-697927e8.js} +52 -52
  2. package/dist/cjs/{FloatingManager-6cfeb947.js → FloatingManager-751368a8.js} +121 -121
  3. package/dist/cjs/{UnitMetadata-4b90ead3.js → UnitMetadata-de809a4b.js} +1305 -1305
  4. package/dist/cjs/ez-calendar_16.cjs.entry.js +89 -75
  5. package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
  6. package/dist/cjs/ez-grid.cjs.entry.js +20 -2
  7. package/dist/cjs/ez-modal_2.cjs.entry.js +2 -2
  8. package/dist/cjs/ez-popover.cjs.entry.js +2 -2
  9. package/dist/cjs/ez-toast.cjs.entry.js +8 -4
  10. package/dist/cjs/ezui.cjs.js +1 -1
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/collection/components/ez-check/ez-check.js +3 -0
  13. package/dist/collection/components/ez-dialog/ez-dialog.css +1 -1
  14. package/dist/collection/components/ez-form/ez-form.js +8 -1
  15. package/dist/collection/components/ez-form/fieldbuilder/tpl/CheckBox.tpl.js +1 -1
  16. package/dist/collection/components/ez-form/fieldbuilder/tpl/ComboBox.tpl.js +1 -1
  17. package/dist/collection/components/ez-form/fieldbuilder/tpl/DateInput.tpl.js +3 -3
  18. package/dist/collection/components/ez-form/fieldbuilder/tpl/FileInput.tpl.js +1 -1
  19. package/dist/collection/components/ez-form/fieldbuilder/tpl/NumberInput.tpl.js +1 -1
  20. package/dist/collection/components/ez-form/fieldbuilder/tpl/SearchInput.tpl.js +1 -1
  21. package/dist/collection/components/ez-form/fieldbuilder/tpl/TextArea.tpl.js +1 -1
  22. package/dist/collection/components/ez-form/fieldbuilder/tpl/TextInput.tpl.js +1 -1
  23. package/dist/collection/components/ez-form/structure/FormSheet.js +2 -1
  24. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +20 -2
  25. package/dist/collection/components/ez-text-area/ez-text-area.css +1 -1
  26. package/dist/collection/components/ez-text-area/ez-text-area.js +1 -1
  27. package/dist/collection/components/ez-text-input/ez-text-input.css +1 -2
  28. package/dist/collection/components/ez-toast/ez-toast.css +8 -2
  29. package/dist/collection/components/ez-toast/ez-toast.js +27 -8
  30. package/dist/collection/utils/ApplicationUtils.js +6 -1
  31. package/dist/custom-elements/index.js +1624 -1588
  32. package/dist/esm/{AssetsUtils-0e207bec.js → AssetsUtils-f75711ac.js} +52 -52
  33. package/dist/esm/{FloatingManager-bb90ef41.js → FloatingManager-ee1f7fdf.js} +121 -121
  34. package/dist/esm/{UnitMetadata-8951d803.js → UnitMetadata-d300ae38.js} +1305 -1305
  35. package/dist/esm/ez-calendar_16.entry.js +89 -75
  36. package/dist/esm/ez-dialog.entry.js +1 -1
  37. package/dist/esm/ez-grid.entry.js +20 -2
  38. package/dist/esm/ez-modal_2.entry.js +2 -2
  39. package/dist/esm/ez-popover.entry.js +2 -2
  40. package/dist/esm/ez-toast.entry.js +8 -4
  41. package/dist/esm/ezui.js +1 -1
  42. package/dist/esm/loader.js +1 -1
  43. package/dist/ezui/ezui.esm.js +1 -1
  44. package/dist/ezui/{p-e06e47f1.entry.js → p-24ff7d92.entry.js} +1 -1
  45. package/dist/ezui/{p-18c00d88.entry.js → p-3e6fa4ca.entry.js} +1 -1
  46. package/dist/ezui/{p-ec7c1b86.js → p-47cf74f0.js} +0 -0
  47. package/dist/ezui/p-780fbe22.entry.js +1 -0
  48. package/dist/ezui/p-81fc41a5.js +1 -0
  49. package/dist/ezui/p-9ea5b22e.entry.js +1 -0
  50. package/dist/ezui/{p-ddd0ef12.js → p-b05feb1f.js} +0 -0
  51. package/dist/ezui/{p-7294c815.entry.js → p-c451d6e6.entry.js} +1 -1
  52. package/dist/ezui/{p-da0f5393.entry.js → p-db1797d7.entry.js} +26 -26
  53. package/dist/types/components/ez-form/ez-form.d.ts +1 -0
  54. package/dist/types/components/ez-toast/ez-toast.d.ts +4 -0
  55. package/dist/types/components.d.ts +8 -0
  56. package/dist/types/utils/ApplicationUtils.d.ts +5 -1
  57. package/package.json +1 -1
  58. package/dist/ezui/p-2259c926.entry.js +0 -1
  59. package/dist/ezui/p-b217f40b.entry.js +0 -1
  60. package/dist/ezui/p-c6760545.js +0 -1
@@ -117,1580 +117,1580 @@ let EzButton$1 = class extends HTMLElement$1 {
117
117
  static get style() { return ezButtonCss; }
118
118
  };
119
119
 
120
- /**
121
- * Classe com utiliários comuns para Strings.
122
- */
123
- class StringUtils {
124
- /**
125
- * Verifica se a string está vazia.
126
- * Valores null e undefined são considerados como vazio.
127
- *
128
- * @param value String para ser validada.
129
- */
130
- static isEmpty(value) {
131
- if (value == undefined || value === null) {
132
- return true;
133
- }
134
- value = value.toString();
135
- value = value.trim();
136
- if (value.length === 0) {
137
- return true;
138
- }
139
- return false;
140
- }
141
- /**
142
- * Remove acentos de vogais, substitui Ç por c e retorna a string em caixa alta.
143
- *
144
- * @param value String para ser transformada.
145
- */
146
- static replaceAccentuatedChars(text) {
147
- text = text.toUpperCase();
148
- text = text.replace(/[À]/, "A");
149
- text = text.replace(/[Á]/, "A");
150
- text = text.replace(/[Â]/, "A");
151
- text = text.replace(/[Ã]/, "A");
152
- text = text.replace(/[Ä]/, "A");
153
- text = text.replace(/[È]/, "E");
154
- text = text.replace(/[É]/, "E");
155
- text = text.replace(/[Ê]/, "E");
156
- text = text.replace(/[Ë]/, "E");
157
- text = text.replace(/[Ì]/, "I");
158
- text = text.replace(/[Í]/, "I");
159
- text = text.replace(/[Î]/, "I");
160
- text = text.replace(/[Ï]/, "I");
161
- text = text.replace(/[Ò]/, "O");
162
- text = text.replace(/[Ó]/, "O");
163
- text = text.replace(/[Ô]/, "O");
164
- text = text.replace(/[Ö]/, "O");
165
- text = text.replace(/[Ù]/, "U");
166
- text = text.replace(/[Ú]/, "U");
167
- text = text.replace(/[Û]/, "U");
168
- text = text.replace(/[Ü]/, "U");
169
- text = text.replace(/[Ç]/, "C");
170
- return text.replace(/[^a-z0-9]/gi, '');
171
- }
172
- }
173
-
174
- const NUMBERINPUTS_REGEX_SCIENTIFIC_PARTS = /^([+-])?(\d+).?(\d*)[eE]([-+]?\d+)$/;
175
- /**
176
- * `NumberUtils` é uma biblioteca para manipulação de números
177
- *
178
- * `Métodos`:
179
- *
180
- * @stringToNumber: converte um número em formato de string em um valor numérico nativo do javascript
181
- * @format: arredonda um número em formato de string baseado nos parâmetros "presision" e "prettyPrecision";
182
- */
183
- class NumberUtils {
184
- }
185
- /**
186
- * @stringToNumber: converte um numero em formato de string em numero
187
- *
188
- * @param value numero em formato de string a ser convertido (Importante: formato PT-BR ou já em formato numérico: ######.##)
189
- *
190
- * @returns string based number
191
- *
192
- * @Exemples
193
- * @"100,12" | 100.12
194
- * @"100.12" | 100.12
195
- * @"-100,12" | -100.12
196
- * @"R$100,12" | 100.12
197
- * @"-R$100,12" | -100.12
198
- * @"string" | NaN
199
- */
200
- NumberUtils.stringToNumber = (value) => {
201
- if (value === '' || value === null || value === undefined) {
202
- return NaN;
203
- }
204
- if (value) {
205
- value = value.toString();
206
- var negative = (value.charAt(0) === '-');
207
- if (!NUMBERINPUTS_REGEX_SCIENTIFIC_PARTS.test(value)) {
208
- value = value.replace(/[^\d.,]/g, '');
209
- }
210
- else {
211
- value = value.replace(/^-/g, '');
212
- }
213
- //In case of simple string such as: "@@@@@@@"
214
- if (value === '') {
215
- return Number(NaN);
216
- }
217
- var indexV = value.indexOf(',');
218
- var indexP = value.indexOf('.');
219
- if (indexP > indexV) {
220
- value = value.replace(',', '');
221
- }
222
- else if (indexP < indexV) {
223
- value = value.replace(/\./g, '@').replace(',', '.').replace(/@/g, '');
224
- }
225
- if (negative) {
226
- value = '-' + value;
227
- }
228
- }
229
- return Number(value);
230
- };
231
- /**
232
- * @format: converte um numero em formato de string em um numero em formato de string formatado de acordo com os parametros de "precision" e "prettyPrecision"
233
- *
234
- * @param value numero em formato de string a ser convertido (Importante: formato PT-BR ou já em formato numérico<sem separadors de milhares>: ######.##)
235
- * @param precision (numero de decimais)
236
- * @param prettyPrecision (numero de zeros nos decimais)
237
- *
238
- * @returns numero em formato de string formatado em PT-BR
239
- */
240
- NumberUtils.format = (value, precision, prettyPrecision = NaN) => {
241
- if (value === '' || value === undefined || value === "NaN") {
242
- return NaN.toString();
243
- }
244
- let newValue = NumberUtils.stringToNumber(value);
245
- if (newValue === NaN) {
246
- return NaN.toString();
247
- }
248
- //Validation "precision":
249
- // Case1: precision < 0 => does not use precision
250
- // Case2: presicion not int => does not use precision
251
- if (precision < 0 || Math.abs(Math.round(precision * 1) / 1) !== precision) {
252
- //Once stringToNumber returns number format, we need to change to pt-br
253
- return NumberUtils.changeFormat(newValue.toString());
254
- }
255
- //Validation "prettyPrecision"
256
- let prettyPrecisionInternal = 0;
257
- // Case1: prettyPrecision < 0 => prettyPrecision does not change de format that means: prettyPrecisionInternal = precision;
258
- // Case2: prettyPrecision not int => prettyPrecision does not change de format that means: prettyPrecisionInternal = precision;
259
- if (prettyPrecision === NaN || Math.abs(Math.round(prettyPrecision * 1) / 1) !== prettyPrecision) {
260
- prettyPrecisionInternal = precision;
261
- }
262
- else {
263
- prettyPrecisionInternal = prettyPrecision;
264
- }
265
- let newValueStr;
266
- newValueStr = (Math.round(newValue * Math.pow(10, precision)) / Math.pow(10, precision)).toLocaleString('pt-br', { minimumFractionDigits: precision });
267
- //prettyPrecision
268
- const varSettingPP = precision - prettyPrecisionInternal;
269
- if (varSettingPP > 0) {
270
- for (let i = 0; i < varSettingPP; i++) {
271
- if (newValueStr.substring(newValueStr.length - 1) == "0" && precision > 0) {
272
- newValueStr = newValueStr.substring(0, newValueStr.length - 1);
273
- }
274
- }
275
- }
276
- //in Case "." or "," in the end of the string
277
- if (newValueStr.substring(newValueStr.length - 1) == "." || newValueStr.substring(newValueStr.length - 1) == ",") {
278
- newValueStr = newValueStr.substring(0, newValueStr.length - 1);
279
- }
280
- return newValueStr;
281
- };
282
- /**
283
- * @keepOnlyDecimalSeparator: retira os separadores de milhar de um número em formato de string
284
- *
285
- * @param value numero em formato de string a ser convertido
286
- * @param formatnumber (formatação de ENTRADA e SAÍDA do utilitário: pt-BR="###.###,##" en-US="###,###.##"; Default: "pt-BR")
287
- *
288
- * @returns numero em formato de string formatado apenas com separador decimal
289
- */
290
- NumberUtils.keepOnlyDecimalSeparator = (value, formatnumber = 'pt-BR') => {
291
- //Formatting formatnumber to be able to get lowercases
292
- formatnumber = formatnumber.toUpperCase();
293
- //Formatting value following formatnumber parameter
294
- //keep only decimal character in order to correct format the string
295
- //This transformation is due the "stringtoNumber" method is a general method that tries to convert all formated strings
296
- if (formatnumber === 'EN-US') {
297
- value = value.replace(/\,/g, '');
298
- }
299
- else {
300
- value = value.replace(/\./g, '');
301
- }
302
- return value;
303
- };
304
- /**
305
- * @changeFormat: troca o formato do numero string de "PT-BR" para "EN-US" e vice-versa
306
- *
307
- * @param value numero em formato de string a ser convertido
308
- *
309
- * @returns numero em formato de string formatado de "PT-BR" para "EN-US" e vice-versa
310
- */
311
- NumberUtils.changeFormat = (value) => {
312
- //Formatting output following formatnumber
313
- return value.replace(/\./g, '_').replace(/\,/g, '.').replace(/\_/g, ',');
314
- };
315
-
316
- /**
317
- * `MaskFormatter` é usado para formatar strings. Seu comportamento
318
- * é controlado pela formato do atributo `mask` que especifica quais
319
- * caracteres são válidos e onde devem estar posicionados, intercalando-os
320
- * com eventuais caracteres literais expressados no padrão informado.
321
- * Sua implementação é inspirada pela implementação em Java do [MaskFormatter](https://docs.oracle.com/javase/7/docs/api/javax/swing/text/MaskFormatter.html).
322
- *
323
- * Para o padrão da máscara podem ser usados os seguintes caracteres especiais:
324
- *
325
- * | Caractere | Comportamento |
326
- * |:---------:|-------------------------------------------------------------------------------------------------------------|
327
- * | # | Qualquer número |
328
- * | ' | "Escapa" o caractere que vem na sequência. Útil quando desejamos converter um caractere especial em literal.|
329
- * | U | Qualquer letra. Transforma letras maiúsculas em maiúsculas. |
330
- * | L | Qualquer letra. Transforma letras maiúsculas em minúsculas. |
331
- * | A | Qualquer letra ou número. |
332
- * | ? | Qualquer letra. Preserva maiúsculas e minúsculas. |
333
- * | * | Qualquer caractere. |
334
- *
335
- * Os demais caracteres presentes no padrão serão tratados como literais, isto é,
336
- * serão apenas inseridos naquela posição.
337
- *
338
- * Quando o o valor a ser formatado é menor que a máscara um 'placeHolder'
339
- * será inserido em cada posição ausente, completando a formatação.
340
- * Por padrão será usado um espaço em branco como 'placeHolder' mas
341
- * esse valor pode ser alterado.
342
- *
343
- * For por exemplo:
344
- * '''
345
- * const formatter: MaskFormatter = new MaskFormatter("###-####");
346
- * formatter.placeholder = '_';
347
- * console.log(formatter.format("123"));
348
- * '''
349
- * resultaria na string '123-____'.
350
- *
351
- * ##Veja mais alguns exemplos:
352
- * |Padrão |Máscara |Entrada |Saída |
353
- * |----------------|------------------|--------------|------------------|
354
- * |Telefone |(##) ####-#### |3432192515 |(34) 3219-2515 |
355
- * |CPF |###.###.###-## |12345678901 |123.456.789-01 |
356
- * |CNPJ |##.###.###/####-##|12345678901234|12.345.678/9012-34|
357
- * |CEP |##.###-### |12345678 |12.345-678 |
358
- * |PLACA (veículo) |UUU-#### |abc1234 |ABC-1234 |
359
- * |Cor RGB |'#AAAAAA |00000F0 |#0000F0 |
360
- *
361
- */
362
- class MaskFormatter {
363
- constructor(mask) {
364
- this._mask = '';
365
- this._maskChars = new Array();
366
- /**
367
- * Determina qual caractere será usado dos caracteres não presentes no valor
368
- * ou seja, aqueles que o usuário ainda não informou. Por padrão usamos um espaço
369
- */
370
- this.placeholder = ' ';
371
- this.mask = mask;
372
- }
373
- /**
374
- * Setter para mask. Trata-se do padrão que se espera ao formatar o texto.
375
- */
376
- set mask(mask) {
377
- this._mask = mask;
378
- this.updateInternalMask();
379
- }
380
- /**
381
- * Getter para mask
382
- *
383
- * @return A última máscara informada.
384
- */
385
- get mask() {
386
- return this._mask;
387
- }
388
- /**
389
- * Formata a string passada baseada na máscara definda pelo atributo mask.
390
- *
391
- * @param value Valor a ser formatado
392
- * @return O valor processado de acordo com o padrão
393
- */
394
- format(value) {
395
- let result = '';
396
- const index = [0];
397
- let counter = 0;
398
- const maxCounter = this._maskChars.length;
399
- while (counter < maxCounter) {
400
- result = this._maskChars[counter].append(result, value, index);
401
- counter++;
402
- }
403
- return result;
404
- }
405
- /**
406
- * Preparamos a formatação internamente de acordo com o padrão.
407
- */
408
- updateInternalMask() {
409
- this._maskChars.length = 0;
410
- if (this.mask != null) {
411
- let counter = 0;
412
- const maxCounter = this.mask.length;
413
- while (counter < maxCounter) {
414
- let maskChar = this.mask.charAt(counter);
415
- switch (maskChar) {
416
- case MaskFormatter.DIGIT_KEY:
417
- this._maskChars.push(new MaskFormatter.DigitMaskCharacter(this, maskChar));
418
- break;
419
- case MaskFormatter.LITERAL_KEY:
420
- if (++counter < maxCounter) {
421
- maskChar = this.mask.charAt(counter);
422
- this._maskChars.push(new MaskFormatter.LiteralCharacter(this, maskChar));
423
- }
424
- break;
425
- case MaskFormatter.UPPERCASE_KEY:
426
- this._maskChars.push(new MaskFormatter.UpperCaseCharacter(this, maskChar));
427
- break;
428
- case MaskFormatter.LOWERCASE_KEY:
429
- this._maskChars.push(new MaskFormatter.LowerCaseCharacter(this, maskChar));
430
- break;
431
- case MaskFormatter.ALPHA_NUMERIC_KEY:
432
- this._maskChars.push(new MaskFormatter.AlphaNumericCharacter(this, maskChar));
433
- break;
434
- case MaskFormatter.CHARACTER_KEY:
435
- this._maskChars.push(new MaskFormatter.CharCharacter(this, maskChar));
436
- break;
437
- case MaskFormatter.ANYTHING_KEY:
438
- this._maskChars.push(new MaskFormatter.MaskCharacter(this, maskChar));
439
- break;
440
- default:
441
- this._maskChars.push(new MaskFormatter.LiteralCharacter(this, maskChar));
442
- break;
443
- }
444
- counter++;
445
- }
446
- }
447
- }
448
- }
449
- MaskFormatter.DIGIT_KEY = "#";
450
- MaskFormatter.LITERAL_KEY = "'";
451
- MaskFormatter.UPPERCASE_KEY = "U";
452
- MaskFormatter.LOWERCASE_KEY = "L";
453
- MaskFormatter.ALPHA_NUMERIC_KEY = "A";
454
- MaskFormatter.CHARACTER_KEY = "?";
455
- MaskFormatter.ANYTHING_KEY = "*";
456
- //
457
- // Classes internas usadas para representar a máscara.
458
- //
459
- MaskFormatter.MaskCharacter = class {
460
- constructor(maskFormatter, type) {
461
- this.maskFormatter = maskFormatter;
462
- this.type = type;
463
- }
464
- /**
465
- * Cada subclasse deve sobrescrever o retornando true, caso represente
466
- * um caractere literal. Por padrão o retorno é false.
467
- */
468
- isLiteral() {
469
- return false;
470
- }
471
- /**
472
- * Returns true if <code>aChar</code> is a valid reprensentation of
473
- * the receiver. The default implementation returns true if the
474
- * receiver represents a literal character and <code>getChar</code>
475
- * == aChar. Otherwise, this will return true is <code>aChar</code>
476
- * is contained in the valid characters and not contained
477
- * in the invalid characters.
478
- */
479
- isValidCharacter(aChar) {
480
- if (this.isLiteral()) {
481
- return (this.getChar(aChar) == aChar);
482
- }
483
- aChar = this.getChar(aChar);
484
- return true;
485
- }
486
- /**
487
- * Returns the character to insert for <code>aChar</code>. The
488
- * default implementation returns <code>aChar</code>. Subclasses
489
- * that wish to do some sort of mapping, perhaps lower case to upper
490
- * case should override this and do the necessary mapping.
491
- */
492
- getChar(aChar) {
493
- return aChar;
494
- }
495
- /**
496
- * Appends the necessary character in <code>formatting</code> at
497
- * <code>index</code> to <code>buff</code>.
498
- */
499
- append(result, formatting, index) {
500
- const inString = index[0] < formatting.length;
501
- const aChar = inString ? formatting.charAt(index[0]) : '';
502
- if (this.isLiteral()) {
503
- const literal = this.getChar(aChar);
504
- result += literal;
505
- if (literal === aChar) {
506
- index[0] = index[0] + 1;
507
- }
508
- }
509
- else if (index[0] >= formatting.length) {
510
- result += this.maskFormatter.placeholder;
511
- index[0] = index[0] + 1;
512
- }
513
- else if (this.isValidCharacter(aChar)) {
514
- result += this.getChar(aChar);
515
- index[0] = index[0] + 1;
516
- }
517
- else {
518
- throw new Error(`Valor inválido: "${aChar}". Na posição ${index[0] + 1} espera-se ${this.getFormatMessage()}.`);
519
- }
520
- return result;
521
- }
522
- getFormatMessage() {
523
- let message;
524
- switch (this.type) {
525
- case MaskFormatter.UPPERCASE_KEY:
526
- case MaskFormatter.LOWERCASE_KEY:
527
- case MaskFormatter.CHARACTER_KEY:
528
- message = 'uma letra';
529
- break;
530
- case MaskFormatter.DIGIT_KEY:
531
- message = 'um número';
532
- break;
533
- case MaskFormatter.ALPHA_NUMERIC_KEY:
534
- message = 'uma letra ou um número';
535
- break;
536
- default:
537
- message = '';
538
- }
539
- return message;
540
- }
541
- };
542
- MaskFormatter.LiteralCharacter = class extends MaskFormatter.MaskCharacter {
543
- constructor(maskFormatter, fixedChar) {
544
- super(maskFormatter, fixedChar);
545
- this._fixedChar = fixedChar;
546
- }
547
- isLiteral() {
548
- return true;
549
- }
550
- getChar(aChar) {
551
- return this._fixedChar;
552
- }
553
- };
554
- MaskFormatter.DigitMaskCharacter = class extends MaskFormatter.MaskCharacter {
555
- isValidCharacter(aChar) {
556
- return (this.isDigit(aChar) && super.isValidCharacter(aChar));
557
- }
558
- isDigit(char) {
559
- return char >= '0' && char <= '9';
560
- }
561
- };
562
- MaskFormatter.UpperCaseCharacter = class extends MaskFormatter.MaskCharacter {
563
- isValidCharacter(aChar) {
564
- return (/[a-z]/i.test(aChar) && super.isValidCharacter(aChar));
565
- }
566
- getChar(aChar) {
567
- return aChar.toUpperCase();
568
- }
569
- };
570
- MaskFormatter.LowerCaseCharacter = class extends MaskFormatter.MaskCharacter {
571
- isValidCharacter(aChar) {
572
- return (/[a-z]/i.test(aChar) && super.isValidCharacter(aChar));
573
- }
574
- getChar(aChar) {
575
- return aChar.toLocaleLowerCase();
576
- }
577
- };
578
- MaskFormatter.AlphaNumericCharacter = class extends MaskFormatter.MaskCharacter {
579
- isValidCharacter(aChar) {
580
- //FIXME: talvez seja problema usar regex aqui... avaliar se existe forma mais barata
581
- return (/[a-z0-9]/i.test(aChar)) && super.isValidCharacter(aChar);
582
- }
583
- };
584
- MaskFormatter.CharCharacter = class extends MaskFormatter.MaskCharacter {
585
- isValidCharacter(aChar) {
586
- //FIXME: talvez seja problema usar regex aqui... avaliar se existe forma mais barata
587
- return (/[a-z]/i.test(aChar) && super.isValidCharacter(aChar));
588
- }
589
- };
590
-
591
- class FloatingEntry {
592
- constructor(parent, content, opts) {
593
- try {
594
- this.weakRefParent = new WeakRef(parent);
595
- this.weakRefContent = new WeakRef(content);
596
- }
597
- catch (error) {
598
- this.strongRefParent = parent;
599
- this.strongRefContent = content;
600
- }
601
- this.options = opts;
602
- }
603
- get parent() {
604
- if (this.weakRefParent) {
605
- return this.weakRefParent.deref();
606
- }
607
- return this.strongRefParent;
608
- }
609
- get content() {
610
- if (this.weakRefContent) {
611
- return this.weakRefContent.deref();
612
- }
613
- return this.strongRefContent;
614
- }
615
- }
616
- class FloatingManager {
617
- static init() {
618
- FloatingManager.entries = [];
619
- document.addEventListener('mousedown', FloatingManager.handleDocumentEvent);
620
- document.addEventListener('keydown', FloatingManager.handleKeyboardEvent);
621
- FloatingManager.initialized = true;
622
- }
623
- static innerClick(container, node) {
624
- if (container.contains(node)) {
625
- return true;
626
- }
627
- if (container.shadowRoot && container.shadowRoot.contains(node)) {
628
- return true;
629
- }
630
- return false;
631
- }
632
- static doClose(id, entry, target) {
633
- if (!target || entry.options.autoClose) {
634
- const parent = entry.parent;
635
- const content = entry.content;
636
- if (parent && content) {
637
- const innerClickFunction = entry.options.innerClickTest ? entry.options.innerClickTest : FloatingManager.innerClick;
638
- if (!target || !innerClickFunction(content, target)) {
639
- content.remove();
640
- delete FloatingManager.entries[id];
641
- }
642
- }
643
- else {
644
- delete FloatingManager.entries[id];
645
- }
646
- }
647
- }
648
- static handleDocumentEvent(event) {
649
- FloatingManager.entries.forEach((entry, index) => {
650
- FloatingManager.doClose(index, entry, event.composedPath()[0]);
651
- });
652
- }
653
- static handleKeyboardEvent(event) {
654
- if (event.key === 'Escape') {
655
- for (let index = FloatingManager.entries.length; index >= 0; index--) {
656
- const entry = FloatingManager.entries[index];
657
- if (entry) {
658
- FloatingManager.close(index);
659
- break;
660
- }
661
- }
662
- }
663
- }
664
- static applyStyle(element, propertyName, value) {
665
- if (value) {
666
- element.style.setProperty(propertyName, value);
667
- }
668
- }
669
- static getFloatIndex(content, parent) {
670
- for (let index = 0; index < FloatingManager.entries.length; index++) {
671
- const entry = FloatingManager.entries[index];
672
- if (entry && content === entry.content && parent === entry.parent) {
673
- return index;
674
- }
675
- }
676
- return -1;
677
- }
678
- static isFloating(id) {
679
- return FloatingManager.entries[id] !== undefined;
680
- }
681
- static float(content, parent, options = { autoClose: true }) {
682
- if (!FloatingManager.initialized) {
683
- FloatingManager.init();
684
- }
685
- const alreadyFloatingIndex = FloatingManager.getFloatIndex(content, parent);
686
- if (alreadyFloatingIndex > -1) {
687
- return alreadyFloatingIndex;
688
- }
689
- content.style.position = 'absolute';
690
- FloatingManager.applyStyle(content, "top", options.top);
691
- FloatingManager.applyStyle(content, "left", options.left);
692
- FloatingManager.applyStyle(content, "right", options.right);
693
- FloatingManager.applyStyle(content, "bottom", options.bottom);
694
- parent.appendChild(content);
695
- FloatingManager.entries.push(new FloatingEntry(parent, content, options));
696
- return FloatingManager.entries.length - 1;
697
- }
698
- static updateFloatPosition(content, parent, options = { autoClose: true }) {
699
- const alreadyFloatingIndex = FloatingManager.getFloatIndex(content, parent);
700
- if (alreadyFloatingIndex > -1) {
701
- FloatingManager.applyStyle(content, "top", options.top);
702
- FloatingManager.applyStyle(content, "left", options.left);
703
- FloatingManager.applyStyle(content, "right", options.right);
704
- FloatingManager.applyStyle(content, "bottom", options.bottom);
705
- }
706
- }
707
- static close(id) {
708
- if (FloatingManager.entries[id]) {
709
- FloatingManager.doClose(id, FloatingManager.entries[id], undefined);
710
- }
711
- }
712
- }
713
-
714
- class DateUtils {
715
- static clearTime(date, adjustDayLightSavingTime = true) {
716
- const newDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0, 0);
717
- return adjustDayLightSavingTime ? DateUtils.adjustDLST(newDate) : newDate;
718
- }
719
- static strToDate(strValue, adjustDayLightSavingTime = true, monthYearMode = false) {
720
- /** monthYearMode é um booleano para usar o formato MM/YYYY.
721
- * Quando ativado, é retornado o primeiro dia do mês apenas para construir a data.
722
- * Não há necessidade de verificar o horário de verão quando utilizado esse modo. */
723
- let parts;
724
- if (monthYearMode) {
725
- 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);
726
- }
727
- else {
728
- 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);
729
- }
730
- if (!parts) {
731
- return undefined;
732
- }
733
- var day = monthYearMode ? 1 : Number(parts[1]);
734
- var month = Number(parts[(monthYearMode ? 1 : 2)]);
735
- var year = Number(parts[(monthYearMode ? 2 : 3)]);
736
- var hour = Number(parts[(monthYearMode ? 3 : 4)] || 0);
737
- var min = Number(parts[(monthYearMode ? 4 : 5)] || 0);
738
- var sec = Number(parts[(monthYearMode ? 5 : 6)] || 0);
739
- if (year < 100) {
740
- year += year < 30 ? 2000 : 1900;
741
- }
742
- let date = new Date(year, month - 1, day, hour, min, sec, 0);
743
- if (adjustDayLightSavingTime === true && !monthYearMode && hour == 0) {
744
- date = DateUtils.adjustDLST(date);
745
- }
746
- return date;
747
- }
748
- static adjustDLST(date) {
749
- //Work around para corrigir o Bug do horário de verão.
750
- if (date.getHours() == 23) {
751
- return new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1, 1, 0, 0, 0);
752
- }
753
- return date;
754
- }
755
- }
756
-
757
- /**
758
- * `TimeFormatter` é um utilitário para formatação de strings desformatadas em strings válidas de horários
759
- */
760
- class TimeFormatter {
761
- /**
762
- * @prepareValue: converts an unformated time string into a formatted time.
763
- *
764
- * @param value unformated time string to convert
765
- *
766
- * @returns formatted time string
767
- *
768
- * @Exemples
769
- * @"1012" | "10:12"
770
- * @"10:12" | "10:12:00"
771
- * @"100112" | "10:01:12"
772
- */
773
- static prepareValue(value, showSeconds) {
774
- if (value && value.length > 0 && value != "NaN") {
775
- let validationValue = value.replace(/:/g, "");
776
- if (showSeconds) {
777
- this._maskFormatter.mask = "##:##:##";
778
- if (validationValue.length < 6) {
779
- while (validationValue.length < 6) {
780
- validationValue = "0".concat(validationValue);
781
- }
782
- }
783
- }
784
- else {
785
- this._maskFormatter.mask = "##:##";
786
- if (validationValue.length < 4) {
787
- while (validationValue.length < 4) {
788
- validationValue = "0".concat(validationValue);
789
- }
790
- }
791
- }
792
- if (this._maskFormatter) {
793
- try {
794
- value = this._maskFormatter.format(validationValue);
795
- return value;
796
- }
797
- catch (e) {
798
- throw new Error(e.message);
799
- }
800
- }
801
- }
802
- return '';
803
- }
804
- /**
805
- * @validateTime: validates if an input string has the corect time format.
806
- *
807
- * @param value input string to validate
808
- *
809
- * @returns true or false
810
- *
811
- * @Exemples
812
- * @"1012" | true
813
- * @"14e4" | false
814
- * @"2624" | false
815
- */
816
- static validateTime(value, showSeconds) {
817
- let isValid = true;
818
- if (value) {
819
- let validationValue = value.replace(/:/g, "");
820
- if (showSeconds) {
821
- if (!["1", "2", "0"].includes(validationValue[0])) {
822
- isValid = false;
823
- }
824
- if (!["0", "1", "2", "3", "4", "5"].includes(validationValue[2])) {
825
- isValid = false;
826
- }
827
- if (!["0", "1", "2", "3", "4", "5"].includes(validationValue[4])) {
828
- isValid = false;
829
- }
830
- if (validationValue[0] == "2" && !["0", "1", "2", "3"].includes(validationValue[1])) {
831
- isValid = false;
832
- }
833
- }
834
- else {
835
- if (!["1", "2", "0"].includes(validationValue[0])) {
836
- isValid = false;
837
- }
838
- if (!["0", "1", "2", "3", "4", "5"].includes(validationValue[2])) {
839
- isValid = false;
840
- }
841
- if (validationValue[0] == "2" && !["0", "1", "2", "3"].includes(validationValue[1])) {
842
- isValid = false;
843
- }
844
- }
845
- }
846
- else {
847
- isValid = false;
848
- }
849
- return isValid;
850
- }
851
- }
120
+ /**
121
+ * Classe com utiliários comuns para Strings.
122
+ */
123
+ class StringUtils {
124
+ /**
125
+ * Verifica se a string está vazia.
126
+ * Valores null e undefined são considerados como vazio.
127
+ *
128
+ * @param value String para ser validada.
129
+ */
130
+ static isEmpty(value) {
131
+ if (value == undefined || value === null) {
132
+ return true;
133
+ }
134
+ value = value.toString();
135
+ value = value.trim();
136
+ if (value.length === 0) {
137
+ return true;
138
+ }
139
+ return false;
140
+ }
141
+ /**
142
+ * Remove acentos de vogais, substitui Ç por c e retorna a string em caixa alta.
143
+ *
144
+ * @param value String para ser transformada.
145
+ */
146
+ static replaceAccentuatedChars(text) {
147
+ text = text.toUpperCase();
148
+ text = text.replace(/[À]/, "A");
149
+ text = text.replace(/[Á]/, "A");
150
+ text = text.replace(/[Â]/, "A");
151
+ text = text.replace(/[Ã]/, "A");
152
+ text = text.replace(/[Ä]/, "A");
153
+ text = text.replace(/[È]/, "E");
154
+ text = text.replace(/[É]/, "E");
155
+ text = text.replace(/[Ê]/, "E");
156
+ text = text.replace(/[Ë]/, "E");
157
+ text = text.replace(/[Ì]/, "I");
158
+ text = text.replace(/[Í]/, "I");
159
+ text = text.replace(/[Î]/, "I");
160
+ text = text.replace(/[Ï]/, "I");
161
+ text = text.replace(/[Ò]/, "O");
162
+ text = text.replace(/[Ó]/, "O");
163
+ text = text.replace(/[Ô]/, "O");
164
+ text = text.replace(/[Ö]/, "O");
165
+ text = text.replace(/[Ù]/, "U");
166
+ text = text.replace(/[Ú]/, "U");
167
+ text = text.replace(/[Û]/, "U");
168
+ text = text.replace(/[Ü]/, "U");
169
+ text = text.replace(/[Ç]/, "C");
170
+ return text.replace(/[^a-z0-9]/gi, '');
171
+ }
172
+ }
173
+
174
+ const NUMBERINPUTS_REGEX_SCIENTIFIC_PARTS = /^([+-])?(\d+).?(\d*)[eE]([-+]?\d+)$/;
175
+ /**
176
+ * `NumberUtils` é uma biblioteca para manipulação de números
177
+ *
178
+ * `Métodos`:
179
+ *
180
+ * @stringToNumber: converte um número em formato de string em um valor numérico nativo do javascript
181
+ * @format: arredonda um número em formato de string baseado nos parâmetros "presision" e "prettyPrecision";
182
+ */
183
+ class NumberUtils {
184
+ }
185
+ /**
186
+ * @stringToNumber: converte um numero em formato de string em numero
187
+ *
188
+ * @param value numero em formato de string a ser convertido (Importante: formato PT-BR ou já em formato numérico: ######.##)
189
+ *
190
+ * @returns string based number
191
+ *
192
+ * @Exemples
193
+ * @"100,12" | 100.12
194
+ * @"100.12" | 100.12
195
+ * @"-100,12" | -100.12
196
+ * @"R$100,12" | 100.12
197
+ * @"-R$100,12" | -100.12
198
+ * @"string" | NaN
199
+ */
200
+ NumberUtils.stringToNumber = (value) => {
201
+ if (value === '' || value === null || value === undefined) {
202
+ return NaN;
203
+ }
204
+ if (value) {
205
+ value = value.toString();
206
+ const negative = (value.charAt(0) === '-');
207
+ if (!NUMBERINPUTS_REGEX_SCIENTIFIC_PARTS.test(value)) {
208
+ value = value.replace(/[^\d.,]/g, '');
209
+ }
210
+ else {
211
+ value = value.replace(/^-/g, '');
212
+ }
213
+ //In case of simple string such as: "@@@@@@@"
214
+ if (value === '') {
215
+ return Number(NaN);
216
+ }
217
+ const indexV = value.indexOf(',');
218
+ const indexP = value.indexOf('.');
219
+ if (indexP > indexV) {
220
+ value = value.replace(',', '');
221
+ }
222
+ else if (indexP < indexV) {
223
+ value = value.replace(/\./g, '@').replace(',', '.').replace(/@/g, '');
224
+ }
225
+ if (negative) {
226
+ value = '-' + value;
227
+ }
228
+ }
229
+ return Number(value);
230
+ };
231
+ /**
232
+ * @format: converte um numero em formato de string em um numero em formato de string formatado de acordo com os parametros de "precision" e "prettyPrecision"
233
+ *
234
+ * @param value numero em formato de string a ser convertido (Importante: formato PT-BR ou já em formato numérico<sem separadors de milhares>: ######.##)
235
+ * @param precision (numero de decimais)
236
+ * @param prettyPrecision (numero de zeros nos decimais)
237
+ *
238
+ * @returns numero em formato de string formatado em PT-BR
239
+ */
240
+ NumberUtils.format = (value, precision, prettyPrecision = NaN) => {
241
+ if (value === '' || value === undefined || value === "NaN") {
242
+ return NaN.toString();
243
+ }
244
+ const newValue = NumberUtils.stringToNumber(value);
245
+ if (isNaN(newValue)) {
246
+ return NaN.toString();
247
+ }
248
+ //Validation "precision":
249
+ // Case1: precision < 0 => does not use precision
250
+ // Case2: presicion not int => does not use precision
251
+ if (precision < 0 || Math.abs(Math.round(precision * 1) / 1) !== precision) {
252
+ //Once stringToNumber returns number format, we need to change to pt-br
253
+ return NumberUtils.changeFormat(newValue.toString());
254
+ }
255
+ //Validation "prettyPrecision"
256
+ let prettyPrecisionInternal = 0;
257
+ // Case1: prettyPrecision < 0 => prettyPrecision does not change de format that means: prettyPrecisionInternal = precision;
258
+ // Case2: prettyPrecision not int => prettyPrecision does not change de format that means: prettyPrecisionInternal = precision;
259
+ if (isNaN(prettyPrecision) || Math.abs(Math.round(prettyPrecision * 1) / 1) !== prettyPrecision) {
260
+ prettyPrecisionInternal = precision;
261
+ }
262
+ else {
263
+ prettyPrecisionInternal = prettyPrecision;
264
+ }
265
+ let newValueStr;
266
+ newValueStr = (Math.round(newValue * Math.pow(10, precision)) / Math.pow(10, precision)).toLocaleString('pt-br', { minimumFractionDigits: precision });
267
+ //prettyPrecision
268
+ const varSettingPP = precision - prettyPrecisionInternal;
269
+ if (varSettingPP > 0) {
270
+ for (let i = 0; i < varSettingPP; i++) {
271
+ if (newValueStr.substring(newValueStr.length - 1) == "0" && precision > 0) {
272
+ newValueStr = newValueStr.substring(0, newValueStr.length - 1);
273
+ }
274
+ }
275
+ }
276
+ //in Case "." or "," in the end of the string
277
+ if (newValueStr.substring(newValueStr.length - 1) == "." || newValueStr.substring(newValueStr.length - 1) == ",") {
278
+ newValueStr = newValueStr.substring(0, newValueStr.length - 1);
279
+ }
280
+ return newValueStr;
281
+ };
282
+ /**
283
+ * @keepOnlyDecimalSeparator: retira os separadores de milhar de um número em formato de string
284
+ *
285
+ * @param value numero em formato de string a ser convertido
286
+ * @param formatnumber (formatação de ENTRADA e SAÍDA do utilitário: pt-BR="###.###,##" en-US="###,###.##"; Default: "pt-BR")
287
+ *
288
+ * @returns numero em formato de string formatado apenas com separador decimal
289
+ */
290
+ NumberUtils.keepOnlyDecimalSeparator = (value, formatnumber = 'pt-BR') => {
291
+ //Formatting formatnumber to be able to get lowercases
292
+ formatnumber = formatnumber.toUpperCase();
293
+ //Formatting value following formatnumber parameter
294
+ //keep only decimal character in order to correct format the string
295
+ //This transformation is due the "stringtoNumber" method is a general method that tries to convert all formated strings
296
+ if (formatnumber === 'EN-US') {
297
+ value = value.replace(/\,/g, '');
298
+ }
299
+ else {
300
+ value = value.replace(/\./g, '');
301
+ }
302
+ return value;
303
+ };
304
+ /**
305
+ * @changeFormat: troca o formato do numero string de "PT-BR" para "EN-US" e vice-versa
306
+ *
307
+ * @param value numero em formato de string a ser convertido
308
+ *
309
+ * @returns numero em formato de string formatado de "PT-BR" para "EN-US" e vice-versa
310
+ */
311
+ NumberUtils.changeFormat = (value) => {
312
+ //Formatting output following formatnumber
313
+ return value.replace(/\./g, '_').replace(/\,/g, '.').replace(/\_/g, ',');
314
+ };
315
+
316
+ /**
317
+ * `MaskFormatter` é usado para formatar strings. Seu comportamento
318
+ * é controlado pela formato do atributo `mask` que especifica quais
319
+ * caracteres são válidos e onde devem estar posicionados, intercalando-os
320
+ * com eventuais caracteres literais expressados no padrão informado.
321
+ * Sua implementação é inspirada pela implementação em Java do [MaskFormatter](https://docs.oracle.com/javase/7/docs/api/javax/swing/text/MaskFormatter.html).
322
+ *
323
+ * Para o padrão da máscara podem ser usados os seguintes caracteres especiais:
324
+ *
325
+ * | Caractere | Comportamento |
326
+ * |:---------:|-------------------------------------------------------------------------------------------------------------|
327
+ * | # | Qualquer número |
328
+ * | ' | "Escapa" o caractere que vem na sequência. Útil quando desejamos converter um caractere especial em literal.|
329
+ * | U | Qualquer letra. Transforma letras maiúsculas em maiúsculas. |
330
+ * | L | Qualquer letra. Transforma letras maiúsculas em minúsculas. |
331
+ * | A | Qualquer letra ou número. |
332
+ * | ? | Qualquer letra. Preserva maiúsculas e minúsculas. |
333
+ * | * | Qualquer caractere. |
334
+ *
335
+ * Os demais caracteres presentes no padrão serão tratados como literais, isto é,
336
+ * serão apenas inseridos naquela posição.
337
+ *
338
+ * Quando o o valor a ser formatado é menor que a máscara um 'placeHolder'
339
+ * será inserido em cada posição ausente, completando a formatação.
340
+ * Por padrão será usado um espaço em branco como 'placeHolder' mas
341
+ * esse valor pode ser alterado.
342
+ *
343
+ * For por exemplo:
344
+ * '''
345
+ * const formatter: MaskFormatter = new MaskFormatter("###-####");
346
+ * formatter.placeholder = '_';
347
+ * console.log(formatter.format("123"));
348
+ * '''
349
+ * resultaria na string '123-____'.
350
+ *
351
+ * ##Veja mais alguns exemplos:
352
+ * |Padrão |Máscara |Entrada |Saída |
353
+ * |----------------|------------------|--------------|------------------|
354
+ * |Telefone |(##) ####-#### |3432192515 |(34) 3219-2515 |
355
+ * |CPF |###.###.###-## |12345678901 |123.456.789-01 |
356
+ * |CNPJ |##.###.###/####-##|12345678901234|12.345.678/9012-34|
357
+ * |CEP |##.###-### |12345678 |12.345-678 |
358
+ * |PLACA (veículo) |UUU-#### |abc1234 |ABC-1234 |
359
+ * |Cor RGB |'#AAAAAA |00000F0 |#0000F0 |
360
+ *
361
+ */
362
+ class MaskFormatter {
363
+ constructor(mask) {
364
+ this._mask = '';
365
+ this._maskChars = new Array();
366
+ /**
367
+ * Determina qual caractere será usado dos caracteres não presentes no valor
368
+ * ou seja, aqueles que o usuário ainda não informou. Por padrão usamos um espaço
369
+ */
370
+ this.placeholder = ' ';
371
+ this.mask = mask;
372
+ }
373
+ /**
374
+ * Setter para mask. Trata-se do padrão que se espera ao formatar o texto.
375
+ */
376
+ set mask(mask) {
377
+ this._mask = mask;
378
+ this.updateInternalMask();
379
+ }
380
+ /**
381
+ * Getter para mask
382
+ *
383
+ * @return A última máscara informada.
384
+ */
385
+ get mask() {
386
+ return this._mask;
387
+ }
388
+ /**
389
+ * Formata a string passada baseada na máscara definda pelo atributo mask.
390
+ *
391
+ * @param value Valor a ser formatado
392
+ * @return O valor processado de acordo com o padrão
393
+ */
394
+ format(value) {
395
+ let result = '';
396
+ const index = [0];
397
+ let counter = 0;
398
+ const maxCounter = this._maskChars.length;
399
+ while (counter < maxCounter) {
400
+ result = this._maskChars[counter].append(result, value, index);
401
+ counter++;
402
+ }
403
+ return result;
404
+ }
405
+ /**
406
+ * Preparamos a formatação internamente de acordo com o padrão.
407
+ */
408
+ updateInternalMask() {
409
+ this._maskChars.length = 0;
410
+ if (this.mask != null) {
411
+ let counter = 0;
412
+ const maxCounter = this.mask.length;
413
+ while (counter < maxCounter) {
414
+ let maskChar = this.mask.charAt(counter);
415
+ switch (maskChar) {
416
+ case MaskFormatter.DIGIT_KEY:
417
+ this._maskChars.push(new MaskFormatter.DigitMaskCharacter(this, maskChar));
418
+ break;
419
+ case MaskFormatter.LITERAL_KEY:
420
+ if (++counter < maxCounter) {
421
+ maskChar = this.mask.charAt(counter);
422
+ this._maskChars.push(new MaskFormatter.LiteralCharacter(this, maskChar));
423
+ }
424
+ break;
425
+ case MaskFormatter.UPPERCASE_KEY:
426
+ this._maskChars.push(new MaskFormatter.UpperCaseCharacter(this, maskChar));
427
+ break;
428
+ case MaskFormatter.LOWERCASE_KEY:
429
+ this._maskChars.push(new MaskFormatter.LowerCaseCharacter(this, maskChar));
430
+ break;
431
+ case MaskFormatter.ALPHA_NUMERIC_KEY:
432
+ this._maskChars.push(new MaskFormatter.AlphaNumericCharacter(this, maskChar));
433
+ break;
434
+ case MaskFormatter.CHARACTER_KEY:
435
+ this._maskChars.push(new MaskFormatter.CharCharacter(this, maskChar));
436
+ break;
437
+ case MaskFormatter.ANYTHING_KEY:
438
+ this._maskChars.push(new MaskFormatter.MaskCharacter(this, maskChar));
439
+ break;
440
+ default:
441
+ this._maskChars.push(new MaskFormatter.LiteralCharacter(this, maskChar));
442
+ break;
443
+ }
444
+ counter++;
445
+ }
446
+ }
447
+ }
448
+ }
449
+ MaskFormatter.DIGIT_KEY = "#";
450
+ MaskFormatter.LITERAL_KEY = "'";
451
+ MaskFormatter.UPPERCASE_KEY = "U";
452
+ MaskFormatter.LOWERCASE_KEY = "L";
453
+ MaskFormatter.ALPHA_NUMERIC_KEY = "A";
454
+ MaskFormatter.CHARACTER_KEY = "?";
455
+ MaskFormatter.ANYTHING_KEY = "*";
456
+ //
457
+ // Classes internas usadas para representar a máscara.
458
+ //
459
+ MaskFormatter.MaskCharacter = class {
460
+ constructor(maskFormatter, type) {
461
+ this.maskFormatter = maskFormatter;
462
+ this.type = type;
463
+ }
464
+ /**
465
+ * Cada subclasse deve sobrescrever o retornando true, caso represente
466
+ * um caractere literal. Por padrão o retorno é false.
467
+ */
468
+ isLiteral() {
469
+ return false;
470
+ }
471
+ /**
472
+ * Returns true if <code>aChar</code> is a valid reprensentation of
473
+ * the receiver. The default implementation returns true if the
474
+ * receiver represents a literal character and <code>getChar</code>
475
+ * == aChar. Otherwise, this will return true is <code>aChar</code>
476
+ * is contained in the valid characters and not contained
477
+ * in the invalid characters.
478
+ */
479
+ isValidCharacter(aChar) {
480
+ if (this.isLiteral()) {
481
+ return (this.getChar(aChar) == aChar);
482
+ }
483
+ aChar = this.getChar(aChar);
484
+ return true;
485
+ }
486
+ /**
487
+ * Returns the character to insert for <code>aChar</code>. The
488
+ * default implementation returns <code>aChar</code>. Subclasses
489
+ * that wish to do some sort of mapping, perhaps lower case to upper
490
+ * case should override this and do the necessary mapping.
491
+ */
492
+ getChar(aChar) {
493
+ return aChar;
494
+ }
495
+ /**
496
+ * Appends the necessary character in <code>formatting</code> at
497
+ * <code>index</code> to <code>buff</code>.
498
+ */
499
+ append(result, formatting, index) {
500
+ const inString = index[0] < formatting.length;
501
+ const aChar = inString ? formatting.charAt(index[0]) : '';
502
+ if (this.isLiteral()) {
503
+ const literal = this.getChar(aChar);
504
+ result += literal;
505
+ if (literal === aChar) {
506
+ index[0] = index[0] + 1;
507
+ }
508
+ }
509
+ else if (index[0] >= formatting.length) {
510
+ result += this.maskFormatter.placeholder;
511
+ index[0] = index[0] + 1;
512
+ }
513
+ else if (this.isValidCharacter(aChar)) {
514
+ result += this.getChar(aChar);
515
+ index[0] = index[0] + 1;
516
+ }
517
+ else {
518
+ throw new Error(`Valor inválido: "${aChar}". Na posição ${index[0] + 1} espera-se ${this.getFormatMessage()}.`);
519
+ }
520
+ return result;
521
+ }
522
+ getFormatMessage() {
523
+ let message;
524
+ switch (this.type) {
525
+ case MaskFormatter.UPPERCASE_KEY:
526
+ case MaskFormatter.LOWERCASE_KEY:
527
+ case MaskFormatter.CHARACTER_KEY:
528
+ message = 'uma letra';
529
+ break;
530
+ case MaskFormatter.DIGIT_KEY:
531
+ message = 'um número';
532
+ break;
533
+ case MaskFormatter.ALPHA_NUMERIC_KEY:
534
+ message = 'uma letra ou um número';
535
+ break;
536
+ default:
537
+ message = '';
538
+ }
539
+ return message;
540
+ }
541
+ };
542
+ MaskFormatter.LiteralCharacter = class extends MaskFormatter.MaskCharacter {
543
+ constructor(maskFormatter, fixedChar) {
544
+ super(maskFormatter, fixedChar);
545
+ this._fixedChar = fixedChar;
546
+ }
547
+ isLiteral() {
548
+ return true;
549
+ }
550
+ getChar(aChar) {
551
+ return this._fixedChar;
552
+ }
553
+ };
554
+ MaskFormatter.DigitMaskCharacter = class extends MaskFormatter.MaskCharacter {
555
+ isValidCharacter(aChar) {
556
+ return (this.isDigit(aChar) && super.isValidCharacter(aChar));
557
+ }
558
+ isDigit(char) {
559
+ return char >= '0' && char <= '9';
560
+ }
561
+ };
562
+ MaskFormatter.UpperCaseCharacter = class extends MaskFormatter.MaskCharacter {
563
+ isValidCharacter(aChar) {
564
+ return (/[a-z]/i.test(aChar) && super.isValidCharacter(aChar));
565
+ }
566
+ getChar(aChar) {
567
+ return aChar.toUpperCase();
568
+ }
569
+ };
570
+ MaskFormatter.LowerCaseCharacter = class extends MaskFormatter.MaskCharacter {
571
+ isValidCharacter(aChar) {
572
+ return (/[a-z]/i.test(aChar) && super.isValidCharacter(aChar));
573
+ }
574
+ getChar(aChar) {
575
+ return aChar.toLocaleLowerCase();
576
+ }
577
+ };
578
+ MaskFormatter.AlphaNumericCharacter = class extends MaskFormatter.MaskCharacter {
579
+ isValidCharacter(aChar) {
580
+ //FIXME: talvez seja problema usar regex aqui... avaliar se existe forma mais barata
581
+ return (/[a-z0-9]/i.test(aChar)) && super.isValidCharacter(aChar);
582
+ }
583
+ };
584
+ MaskFormatter.CharCharacter = class extends MaskFormatter.MaskCharacter {
585
+ isValidCharacter(aChar) {
586
+ //FIXME: talvez seja problema usar regex aqui... avaliar se existe forma mais barata
587
+ return (/[a-z]/i.test(aChar) && super.isValidCharacter(aChar));
588
+ }
589
+ };
590
+
591
+ class FloatingEntry {
592
+ constructor(parent, content, opts) {
593
+ try {
594
+ this.weakRefParent = new WeakRef(parent);
595
+ this.weakRefContent = new WeakRef(content);
596
+ }
597
+ catch (error) {
598
+ this.strongRefParent = parent;
599
+ this.strongRefContent = content;
600
+ }
601
+ this.options = opts;
602
+ }
603
+ get parent() {
604
+ if (this.weakRefParent) {
605
+ return this.weakRefParent.deref();
606
+ }
607
+ return this.strongRefParent;
608
+ }
609
+ get content() {
610
+ if (this.weakRefContent) {
611
+ return this.weakRefContent.deref();
612
+ }
613
+ return this.strongRefContent;
614
+ }
615
+ }
616
+ class FloatingManager {
617
+ static init() {
618
+ FloatingManager.entries = [];
619
+ document.addEventListener('mousedown', FloatingManager.handleDocumentEvent);
620
+ document.addEventListener('keydown', FloatingManager.handleKeyboardEvent);
621
+ FloatingManager.initialized = true;
622
+ }
623
+ static innerClick(container, node) {
624
+ if (container.contains(node)) {
625
+ return true;
626
+ }
627
+ if (container.shadowRoot && container.shadowRoot.contains(node)) {
628
+ return true;
629
+ }
630
+ return false;
631
+ }
632
+ static doClose(id, entry, target) {
633
+ if (!target || entry.options.autoClose) {
634
+ const parent = entry.parent;
635
+ const content = entry.content;
636
+ if (parent && content) {
637
+ const innerClickFunction = entry.options.innerClickTest ? entry.options.innerClickTest : FloatingManager.innerClick;
638
+ if (!target || !innerClickFunction(content, target)) {
639
+ content.remove();
640
+ delete FloatingManager.entries[id];
641
+ }
642
+ }
643
+ else {
644
+ delete FloatingManager.entries[id];
645
+ }
646
+ }
647
+ }
648
+ static handleDocumentEvent(event) {
649
+ FloatingManager.entries.forEach((entry, index) => {
650
+ FloatingManager.doClose(index, entry, event.composedPath()[0]);
651
+ });
652
+ }
653
+ static handleKeyboardEvent(event) {
654
+ if (event.key === 'Escape') {
655
+ for (let index = FloatingManager.entries.length; index >= 0; index--) {
656
+ const entry = FloatingManager.entries[index];
657
+ if (entry) {
658
+ FloatingManager.close(index);
659
+ break;
660
+ }
661
+ }
662
+ }
663
+ }
664
+ static applyStyle(element, propertyName, value) {
665
+ if (value) {
666
+ element.style.setProperty(propertyName, value);
667
+ }
668
+ }
669
+ static getFloatIndex(content, parent) {
670
+ for (let index = 0; index < FloatingManager.entries.length; index++) {
671
+ const entry = FloatingManager.entries[index];
672
+ if (entry && content === entry.content && parent === entry.parent) {
673
+ return index;
674
+ }
675
+ }
676
+ return -1;
677
+ }
678
+ static isFloating(id) {
679
+ return FloatingManager.entries[id] !== undefined;
680
+ }
681
+ static float(content, parent, options = { autoClose: true }) {
682
+ if (!FloatingManager.initialized) {
683
+ FloatingManager.init();
684
+ }
685
+ const alreadyFloatingIndex = FloatingManager.getFloatIndex(content, parent);
686
+ if (alreadyFloatingIndex > -1) {
687
+ return alreadyFloatingIndex;
688
+ }
689
+ content.style.position = 'absolute';
690
+ FloatingManager.applyStyle(content, "top", options.top);
691
+ FloatingManager.applyStyle(content, "left", options.left);
692
+ FloatingManager.applyStyle(content, "right", options.right);
693
+ FloatingManager.applyStyle(content, "bottom", options.bottom);
694
+ parent.appendChild(content);
695
+ FloatingManager.entries.push(new FloatingEntry(parent, content, options));
696
+ return FloatingManager.entries.length - 1;
697
+ }
698
+ static updateFloatPosition(content, parent, options = { autoClose: true }) {
699
+ const alreadyFloatingIndex = FloatingManager.getFloatIndex(content, parent);
700
+ if (alreadyFloatingIndex > -1) {
701
+ FloatingManager.applyStyle(content, "top", options.top);
702
+ FloatingManager.applyStyle(content, "left", options.left);
703
+ FloatingManager.applyStyle(content, "right", options.right);
704
+ FloatingManager.applyStyle(content, "bottom", options.bottom);
705
+ }
706
+ }
707
+ static close(id) {
708
+ if (FloatingManager.entries[id]) {
709
+ FloatingManager.doClose(id, FloatingManager.entries[id], undefined);
710
+ }
711
+ }
712
+ }
713
+
714
+ class DateUtils {
715
+ static clearTime(date, adjustDayLightSavingTime = true) {
716
+ const newDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0, 0);
717
+ return adjustDayLightSavingTime ? DateUtils.adjustDLST(newDate) : newDate;
718
+ }
719
+ static strToDate(strValue, adjustDayLightSavingTime = true, monthYearMode = false) {
720
+ /** monthYearMode é um booleano para usar o formato MM/YYYY.
721
+ * Quando ativado, é retornado o primeiro dia do mês apenas para construir a data.
722
+ * Não há necessidade de verificar o horário de verão quando utilizado esse modo. */
723
+ let parts;
724
+ if (monthYearMode) {
725
+ 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);
726
+ }
727
+ else {
728
+ 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);
729
+ }
730
+ if (!parts) {
731
+ return undefined;
732
+ }
733
+ const day = monthYearMode ? 1 : Number(parts[1]);
734
+ const month = Number(parts[(monthYearMode ? 1 : 2)]);
735
+ let year = Number(parts[(monthYearMode ? 2 : 3)]);
736
+ const hour = Number(parts[(monthYearMode ? 3 : 4)] || 0);
737
+ const min = Number(parts[(monthYearMode ? 4 : 5)] || 0);
738
+ const sec = Number(parts[(monthYearMode ? 5 : 6)] || 0);
739
+ if (year < 100) {
740
+ year += year < 30 ? 2000 : 1900;
741
+ }
742
+ let date = new Date(year, month - 1, day, hour, min, sec, 0);
743
+ if (adjustDayLightSavingTime === true && !monthYearMode && hour == 0) {
744
+ date = DateUtils.adjustDLST(date);
745
+ }
746
+ return date;
747
+ }
748
+ static adjustDLST(date) {
749
+ //Work around para corrigir o Bug do horário de verão.
750
+ if (date.getHours() == 23) {
751
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1, 1, 0, 0, 0);
752
+ }
753
+ return date;
754
+ }
755
+ }
756
+
757
+ /**
758
+ * `TimeFormatter` é um utilitário para formatação de strings desformatadas em strings válidas de horários
759
+ */
760
+ class TimeFormatter {
761
+ /**
762
+ * @prepareValue: converts an unformated time string into a formatted time.
763
+ *
764
+ * @param value unformated time string to convert
765
+ *
766
+ * @returns formatted time string
767
+ *
768
+ * @Exemples
769
+ * @"1012" | "10:12"
770
+ * @"10:12" | "10:12:00"
771
+ * @"100112" | "10:01:12"
772
+ */
773
+ static prepareValue(value, showSeconds) {
774
+ if (value && value.length > 0 && value != "NaN") {
775
+ let validationValue = value.replace(/:/g, "");
776
+ if (showSeconds) {
777
+ this._maskFormatter.mask = "##:##:##";
778
+ if (validationValue.length < 6) {
779
+ while (validationValue.length < 6) {
780
+ validationValue = "0".concat(validationValue);
781
+ }
782
+ }
783
+ }
784
+ else {
785
+ this._maskFormatter.mask = "##:##";
786
+ if (validationValue.length < 4) {
787
+ while (validationValue.length < 4) {
788
+ validationValue = "0".concat(validationValue);
789
+ }
790
+ }
791
+ }
792
+ if (this._maskFormatter) {
793
+ try {
794
+ value = this._maskFormatter.format(validationValue);
795
+ return value;
796
+ }
797
+ catch (e) {
798
+ throw new Error(e.message);
799
+ }
800
+ }
801
+ }
802
+ return '';
803
+ }
804
+ /**
805
+ * @validateTime: validates if an input string has the corect time format.
806
+ *
807
+ * @param value input string to validate
808
+ *
809
+ * @returns true or false
810
+ *
811
+ * @Exemples
812
+ * @"1012" | true
813
+ * @"14e4" | false
814
+ * @"2624" | false
815
+ */
816
+ static validateTime(value, showSeconds) {
817
+ let isValid = true;
818
+ if (value) {
819
+ let validationValue = value.replace(/:/g, "");
820
+ if (showSeconds) {
821
+ if (!["1", "2", "0"].includes(validationValue[0])) {
822
+ isValid = false;
823
+ }
824
+ if (!["0", "1", "2", "3", "4", "5"].includes(validationValue[2])) {
825
+ isValid = false;
826
+ }
827
+ if (!["0", "1", "2", "3", "4", "5"].includes(validationValue[4])) {
828
+ isValid = false;
829
+ }
830
+ if (validationValue[0] == "2" && !["0", "1", "2", "3"].includes(validationValue[1])) {
831
+ isValid = false;
832
+ }
833
+ }
834
+ else {
835
+ if (!["1", "2", "0"].includes(validationValue[0])) {
836
+ isValid = false;
837
+ }
838
+ if (!["0", "1", "2", "3", "4", "5"].includes(validationValue[2])) {
839
+ isValid = false;
840
+ }
841
+ if (validationValue[0] == "2" && !["0", "1", "2", "3"].includes(validationValue[1])) {
842
+ isValid = false;
843
+ }
844
+ }
845
+ }
846
+ else {
847
+ isValid = false;
848
+ }
849
+ return isValid;
850
+ }
851
+ }
852
852
  TimeFormatter._maskFormatter = new MaskFormatter("##:##");
853
853
 
854
- /**
855
- * Representa as propriedades necessárias para se executar uma requisição.
856
- */
857
- /** Representa os verbos HTTP suportados */
858
- var Method;
859
- (function (Method) {
860
- Method[Method["GET"] = 0] = "GET";
861
- Method[Method["PUT"] = 1] = "PUT";
862
- Method[Method["POST"] = 2] = "POST";
863
- Method[Method["DELETE"] = 3] = "DELETE";
854
+ /**
855
+ * Representa as propriedades necessárias para se executar uma requisição.
856
+ */
857
+ /** Representa os verbos HTTP suportados */
858
+ var Method;
859
+ (function (Method) {
860
+ Method[Method["GET"] = 0] = "GET";
861
+ Method[Method["PUT"] = 1] = "PUT";
862
+ Method[Method["POST"] = 2] = "POST";
863
+ Method[Method["DELETE"] = 3] = "DELETE";
864
864
  })(Method || (Method = {}));
865
865
 
866
- var DataType;
867
- (function (DataType) {
868
- DataType["NUMBER"] = "NUMBER";
869
- DataType["DATE"] = "DATE";
870
- DataType["TEXT"] = "TEXT";
871
- DataType["BOOLEAN"] = "BOOLEAN";
872
- DataType["OBJECT"] = "OBJECT";
873
- })(DataType || (DataType = {}));
874
- const convertType = (dataType, value) => {
875
- if (value === undefined || value === null) {
876
- return value;
877
- }
878
- switch (dataType) {
879
- case DataType.NUMBER:
880
- return value === "" || isNaN(value) ? null : Number(value);
881
- case DataType.OBJECT:
882
- return typeof value === "string" ? JSON.parse(value) : value;
883
- case DataType.BOOLEAN:
884
- return Boolean(value);
885
- case DataType.DATE:
886
- return new Date(value.toString());
887
- default:
888
- return value;
889
- }
890
- };
891
-
892
- class DataUnitAction {
893
- constructor(type, payload) {
894
- this._type = type;
895
- this._payload = payload;
896
- }
897
- get type() {
898
- return this._type;
899
- }
900
- get payload() {
901
- return this._payload;
902
- }
903
- }
904
- var Action;
905
- (function (Action) {
906
- Action["LOADING_METADATA"] = "loadingMetadata";
907
- Action["METADATA_LOADED"] = "metadataLoaded";
908
- Action["LOADING_DATA"] = "loadingData";
909
- Action["DATA_LOADED"] = "dataLoaded";
910
- Action["SAVING_DATA"] = "savingData";
911
- Action["DATA_SAVED"] = "dataSaved";
912
- Action["REMOVING_RECORDS"] = "removingRecords";
913
- Action["RECORDS_REMOVED"] = "recordsRemoved";
914
- Action["RECORDS_ADDED"] = "recordsAdded";
915
- Action["RECORDS_COPIED"] = "recordsCopied";
916
- Action["DATA_CHANGED"] = "dataChanged";
917
- Action["EDITION_CANCELED"] = "editionCanceled";
918
- Action["CHANGE_UNDONE"] = "changeUndone";
919
- Action["CHANGE_REDONE"] = "changeRedone";
920
- Action["SELECTION_CHANGED"] = "selectionChanged";
921
- Action["NEXT_SELECTED"] = "nextSelected";
922
- Action["PREVIOUS_SELECTED"] = "previousSelected";
923
- Action["STATE_CHANGED"] = "stateChanged";
866
+ var DataType;
867
+ (function (DataType) {
868
+ DataType["NUMBER"] = "NUMBER";
869
+ DataType["DATE"] = "DATE";
870
+ DataType["TEXT"] = "TEXT";
871
+ DataType["BOOLEAN"] = "BOOLEAN";
872
+ DataType["OBJECT"] = "OBJECT";
873
+ })(DataType || (DataType = {}));
874
+ const convertType = (dataType, value) => {
875
+ if (value === undefined || value === null) {
876
+ return value;
877
+ }
878
+ switch (dataType) {
879
+ case DataType.NUMBER:
880
+ return value === "" || isNaN(value) ? null : Number(value);
881
+ case DataType.OBJECT:
882
+ return typeof value === "string" ? JSON.parse(value) : value;
883
+ case DataType.BOOLEAN:
884
+ return Boolean(value);
885
+ case DataType.DATE:
886
+ return new Date(value.toString());
887
+ default:
888
+ return value;
889
+ }
890
+ };
891
+
892
+ class DataUnitAction {
893
+ constructor(type, payload) {
894
+ this._type = type;
895
+ this._payload = payload;
896
+ }
897
+ get type() {
898
+ return this._type;
899
+ }
900
+ get payload() {
901
+ return this._payload;
902
+ }
903
+ }
904
+ var Action;
905
+ (function (Action) {
906
+ Action["LOADING_METADATA"] = "loadingMetadata";
907
+ Action["METADATA_LOADED"] = "metadataLoaded";
908
+ Action["LOADING_DATA"] = "loadingData";
909
+ Action["DATA_LOADED"] = "dataLoaded";
910
+ Action["SAVING_DATA"] = "savingData";
911
+ Action["DATA_SAVED"] = "dataSaved";
912
+ Action["REMOVING_RECORDS"] = "removingRecords";
913
+ Action["RECORDS_REMOVED"] = "recordsRemoved";
914
+ Action["RECORDS_ADDED"] = "recordsAdded";
915
+ Action["RECORDS_COPIED"] = "recordsCopied";
916
+ Action["DATA_CHANGED"] = "dataChanged";
917
+ Action["EDITION_CANCELED"] = "editionCanceled";
918
+ Action["CHANGE_UNDONE"] = "changeUndone";
919
+ Action["CHANGE_REDONE"] = "changeRedone";
920
+ Action["SELECTION_CHANGED"] = "selectionChanged";
921
+ Action["NEXT_SELECTED"] = "nextSelected";
922
+ Action["PREVIOUS_SELECTED"] = "previousSelected";
923
+ Action["STATE_CHANGED"] = "stateChanged";
924
924
  })(Action || (Action = {}));
925
925
 
926
- /**
927
- * Essa classe representa uma interpretação do padrão de projetos Flux.
928
- * No padrão Flux os dados da aplicação são chamados de "estado" e existem
929
- * algumas regras para gerenciamento/manipulação desse estado:
930
- *
931
- * 1 - O estado é imutável.
932
- * 2 - Toda modificação de estado é representada por uma "ação".
933
- * 3 - Quando "ações" acontecem a "store" cria um novo estado e notifica a todos interessados.
934
- *
935
- * Nessa interpretação desse design pattern, o StateManager faz o papel da store,
936
- * notificando os manipuladores de estado (handlers), que são responsáveis por pedaços
937
- * do estado (slices).
938
- *
939
- * O StateManager mantém dois tipos de estados: "Histórico" e "Não Histórico". No estado
940
- * "Histórico", sempre que uma alteração de estado acontece, o estado anterior é guardado em
941
- * uma pilha, o que permite que possamos voltar no tempo, desfazendo algumas ações
942
- */
943
- class StateManager {
944
- constructor(reducers) {
945
- this._past = [];
946
- this._future = [];
947
- this._present = {};
948
- this._nonHist = {};
949
- this._histClean = false;
950
- this._reducers = reducers;
951
- }
952
- process(action) {
953
- const oldPresent = this._present;
954
- let hasHistChange = false;
955
- this._histClean = false;
956
- this._reducers.forEach(reducer => {
957
- const sliceName = reducer.sliceName;
958
- const isHistoric = this.isHistoric(sliceName);
959
- const oldSlice = this.getSlice(sliceName, isHistoric);
960
- const newSlice = reducer.reduce(this, oldSlice, action);
961
- if (newSlice !== oldSlice) {
962
- this.updateSlice(sliceName, newSlice, isHistoric);
963
- hasHistChange || (hasHistChange = isHistoric);
964
- }
965
- });
966
- if (hasHistChange && !this._histClean) {
967
- this._past.push(oldPresent);
968
- this._future = [];
969
- document.dispatchEvent(new CustomEvent("undoableAction", { detail: this }));
970
- }
971
- }
972
- select(sliceName, selector) {
973
- const isHistoric = this.isHistoric(sliceName);
974
- return selector(this.getSlice(sliceName, isHistoric));
975
- }
976
- isHistoric(slice) {
977
- return slice.startsWith("hist::");
978
- }
979
- updateSlice(name, slice, isHistoric) {
980
- if (isHistoric) {
981
- this._present = Object.assign(Object.assign({}, this._present), { [name]: slice });
982
- if (slice === undefined) {
983
- delete this._present[name];
984
- }
985
- }
986
- else {
987
- this._nonHist = Object.assign(Object.assign({}, this._nonHist), { [name]: slice });
988
- if (slice === undefined) {
989
- delete this._nonHist[name];
990
- }
991
- }
992
- }
993
- getSlice(name, isHistoric) {
994
- return isHistoric ? this._present[name] : this._nonHist[name];
995
- }
996
- canUndo() {
997
- return this._past.length > 0;
998
- }
999
- canRedo() {
1000
- return this._future.length > 0;
1001
- }
1002
- undo() {
1003
- if (this.canUndo()) {
1004
- this._future.push(this._present);
1005
- this._present = this._past.pop();
1006
- }
1007
- }
1008
- redo() {
1009
- if (this.canRedo()) {
1010
- this._past.push(this._present);
1011
- this._present = this._future.pop();
1012
- }
1013
- }
1014
- clearUndo() {
1015
- this._histClean = true;
1016
- this._past = [];
1017
- this._future = [];
1018
- }
1019
- persist() {
1020
- }
1021
- }
1022
-
1023
- class HistReducerImpl {
1024
- constructor() {
1025
- this.sliceName = "";
1026
- }
1027
- reduce(stateManager, _currentState, action) {
1028
- switch (action.type) {
1029
- case Action.DATA_SAVED:
1030
- case Action.EDITION_CANCELED:
1031
- stateManager.clearUndo();
1032
- break;
1033
- case Action.CHANGE_UNDONE:
1034
- stateManager.undo();
1035
- break;
1036
- case Action.CHANGE_REDONE:
1037
- stateManager.redo();
1038
- break;
1039
- }
1040
- }
1041
- }
1042
- const HistReducer = new HistReducerImpl();
1043
- const canUndo = (stateManager) => {
1044
- return stateManager.canUndo();
1045
- };
1046
- const canRedo = (stateManager) => {
1047
- return stateManager.canRedo();
1048
- };
1049
-
1050
- class UnitMetadataReducerImpl {
1051
- constructor() {
1052
- this.sliceName = "unitMetadata";
1053
- }
1054
- reduce(_stateManager, currentState, action) {
1055
- if (action.type === Action.METADATA_LOADED) {
1056
- return action.payload;
1057
- }
1058
- return currentState;
1059
- }
1060
- }
1061
- const UnitMetadataReducer = new UnitMetadataReducerImpl();
1062
- const getMetadata = (stateManager) => {
1063
- return stateManager.select(UnitMetadataReducer.sliceName, (state) => state);
1064
- };
1065
- const getField = (stateManager, fieldName) => {
1066
- const md = getMetadata(stateManager);
1067
- return md ? md.fields.find(fmd => fmd.name === fieldName) : undefined;
1068
- };
1069
-
1070
- class RemovedRecordsReducerImpl {
1071
- constructor() {
1072
- this.sliceName = "hist::removedRecords";
1073
- }
1074
- reduce(_stateManager, currentState, action) {
1075
- switch (action.type) {
1076
- case Action.RECORDS_REMOVED:
1077
- const { records, buffered } = action.payload;
1078
- if (buffered) {
1079
- return (currentState || []).concat(records);
1080
- }
1081
- return currentState;
1082
- case Action.EDITION_CANCELED:
1083
- case Action.DATA_SAVED:
1084
- return undefined;
1085
- }
1086
- return currentState;
1087
- }
1088
- }
1089
- const RemovedRecordsReducer = new RemovedRecordsReducerImpl();
1090
- const getRemovedRecords = (stateManager) => {
1091
- return stateManager.select(RemovedRecordsReducer.sliceName, (state) => state);
1092
- };
1093
-
1094
- class RecordsReducerImpl {
1095
- constructor() {
1096
- this.sliceName = "records";
1097
- }
1098
- reduce(stateManager, currentState, action) {
1099
- switch (action.type) {
1100
- case Action.DATA_LOADED:
1101
- return action.payload;
1102
- case Action.RECORDS_REMOVED:
1103
- const { records, buffered } = action.payload;
1104
- if (!buffered) {
1105
- return currentState.filter(r => !records.includes(r.__record__id__));
1106
- }
1107
- return currentState;
1108
- case Action.DATA_SAVED:
1109
- const recordsMap = new Map();
1110
- const currentRecords = getRecords(stateManager);
1111
- if (currentRecords) {
1112
- const removed = getRemovedRecords(stateManager) || [];
1113
- currentRecords.forEach(r => {
1114
- if (!removed.includes(r.__record__id__)) {
1115
- recordsMap.set(r.__record__id__, r);
1116
- }
1117
- });
1118
- }
1119
- const savedRecords = action.payload.records;
1120
- savedRecords.forEach(sr => {
1121
- const recordId = sr.__old__id__ || sr.__record__id__;
1122
- const newRecord = Object.assign({}, sr);
1123
- delete newRecord["__old__id__"];
1124
- recordsMap.set(recordId, newRecord);
1125
- });
1126
- return Array.from(recordsMap.values());
1127
- }
1128
- return currentState;
1129
- }
1130
- }
1131
- const RecordsReducer = new RecordsReducerImpl();
1132
- const getRecords = (stateManager) => {
1133
- return stateManager.select(RecordsReducer.sliceName, (state) => state);
1134
- };
1135
-
1136
- class AddedRecordsReducerImpl {
1137
- constructor() {
1138
- this.sliceName = "hist::addedRecords";
1139
- }
1140
- reduce(_stateManager, currentState, action) {
1141
- switch (action.type) {
1142
- case Action.RECORDS_ADDED:
1143
- case Action.RECORDS_COPIED:
1144
- return (currentState || []).concat(action.payload);
1145
- case Action.DATA_SAVED:
1146
- case Action.EDITION_CANCELED:
1147
- return undefined;
1148
- }
1149
- return currentState;
1150
- }
1151
- }
1152
- const AddedRecordsReducer = new AddedRecordsReducerImpl();
1153
- const getAddedRecords = (stateManager) => {
1154
- return stateManager.select(AddedRecordsReducer.sliceName, (state) => state);
1155
- };
1156
- const prepareAddedRecordId = (stateManager, source) => {
1157
- let index = (getAddedRecords(stateManager) || []).length;
1158
- return source.map(item => { return Object.assign(Object.assign({}, item), { __record__id__: "NEW_" + (index++) }); });
1159
- };
1160
-
1161
- class ChangesReducerImpl {
1162
- constructor() {
1163
- this.sliceName = "hist::changes";
1164
- }
1165
- reduce(stateManager, currentState, action) {
1166
- switch (action.type) {
1167
- case Action.DATA_CHANGED:
1168
- const selection = action.payload.records || getSelection(stateManager);
1169
- if (selection) {
1170
- const newState = new Map(currentState);
1171
- selection.forEach(recordId => {
1172
- const newChanges = Object.assign(Object.assign({}, newState.get(recordId)), action.payload);
1173
- delete newChanges.records;
1174
- newState.set(recordId, newChanges);
1175
- });
1176
- return newState;
1177
- }
1178
- return currentState;
1179
- case Action.DATA_SAVED:
1180
- case Action.EDITION_CANCELED:
1181
- return undefined;
1182
- }
1183
- return currentState;
1184
- }
1185
- }
1186
- const ChangesReducer = new ChangesReducerImpl();
1187
- const getChanges = (stateManager) => {
1188
- return stateManager.select(ChangesReducer.sliceName, (state) => state);
1189
- };
1190
- const isDirty = (stateManager) => {
1191
- if (getAddedRecords(stateManager) !== undefined) {
1192
- return true;
1193
- }
1194
- if (getRemovedRecords(stateManager) !== undefined) {
1195
- return true;
1196
- }
1197
- return getChanges(stateManager) !== undefined;
1198
- };
1199
- const getChangesToSave = (dataUnit, stateManager) => {
1200
- const result = [];
1201
- const changes = getChanges(stateManager);
1202
- const records = getRecords(stateManager);
1203
- records === null || records === void 0 ? void 0 : records.forEach(r => {
1204
- if (changes) {
1205
- const c = changes.get(r.__record__id__);
1206
- if (c) {
1207
- result.push(new Change(dataUnit, r, c, ChangeOperation.UPDATE));
1208
- }
1209
- }
1210
- });
1211
- const addedRecords = getAddedRecords(stateManager);
1212
- if (addedRecords) {
1213
- addedRecords.forEach(r => {
1214
- result.push(new Change(dataUnit, r, changes === null || changes === void 0 ? void 0 : changes.get(r.__record__id__), ChangeOperation.INSERT));
1215
- });
1216
- }
1217
- const removedRecords = getRemovedRecords(stateManager);
1218
- const recordsById = {};
1219
- records === null || records === void 0 ? void 0 : records.forEach(r => recordsById[r.__record__id__] = r);
1220
- if (removedRecords) {
1221
- removedRecords.forEach(id => {
1222
- result.push(new Change(dataUnit, recordsById[id], undefined, ChangeOperation.DELETE));
1223
- });
1224
- }
1225
- return result;
1226
- };
1227
-
1228
- class CurrentRecordsReducerImpl {
1229
- constructor() {
1230
- this.sliceName = "currentRecords";
1231
- }
1232
- reduce(stateManager, _currentState, _action) {
1233
- let records = getRecords(stateManager);
1234
- const added = getAddedRecords(stateManager);
1235
- if (!records && !added) {
1236
- return undefined;
1237
- }
1238
- if (added) {
1239
- records = (records || []).concat(added);
1240
- }
1241
- const removedRecords = getRemovedRecords(stateManager);
1242
- if (removedRecords) {
1243
- records = records.filter(r => !removedRecords.includes(r.__record__id__));
1244
- }
1245
- const changes = getChanges(stateManager);
1246
- return new Map(records.map(r => {
1247
- const recordId = r.__record__id__;
1248
- const record = Object.assign(Object.assign({}, r), changes === null || changes === void 0 ? void 0 : changes.get(recordId));
1249
- return [recordId, record];
1250
- }));
1251
- }
1252
- }
1253
- const CurrentRecordsReducer = new CurrentRecordsReducerImpl();
1254
- const getCurrentRecords = (stateManager) => {
1255
- return stateManager.select(CurrentRecordsReducer.sliceName, (state) => state);
1256
- };
1257
- const getFieldValue = (stateManager, fieldName) => {
1258
- const selection = getSelection(stateManager);
1259
- if (selection && selection.length > 0) {
1260
- const currentRecords = getCurrentRecords(stateManager);
1261
- if (currentRecords) {
1262
- const record = currentRecords.get(selection[0]);
1263
- return record ? record[fieldName] : undefined;
1264
- }
1265
- }
1266
- return undefined;
1267
- };
1268
-
1269
- class SelectionReducerImpl {
1270
- constructor() {
1271
- this.sliceName = "hist::selection";
1272
- }
1273
- reduce(stateManager, currentState, action) {
1274
- switch (action.type) {
1275
- case Action.RECORDS_ADDED:
1276
- case Action.RECORDS_COPIED:
1277
- return action.payload.map((r) => r.__record__id__);
1278
- case Action.DATA_SAVED:
1279
- return updateSavedIds(stateManager, action.payload.records);
1280
- case Action.RECORDS_REMOVED:
1281
- const removed = action.payload.records;
1282
- if (currentState && removed) {
1283
- return currentState.filter(recordId => !removed.includes(recordId));
1284
- }
1285
- return currentState;
1286
- case Action.NEXT_SELECTED:
1287
- case Action.PREVIOUS_SELECTED:
1288
- const currentRecords = getCurrentRecords(stateManager);
1289
- if (currentRecords && currentRecords.size > 0) {
1290
- let index;
1291
- if (!currentState || currentState.length === 0) {
1292
- index = action.type === Action.PREVIOUS_SELECTED ? 0 : Math.min(1, currentRecords.size);
1293
- }
1294
- else {
1295
- index = getItemIndex(currentState[0], currentRecords) + (action.type === Action.PREVIOUS_SELECTED ? -1 : 1);
1296
- }
1297
- if (index < currentRecords.size && index >= 0) {
1298
- return [Array.from(currentRecords.values())[index].__record__id__];
1299
- }
1300
- }
1301
- return undefined;
1302
- case Action.SELECTION_CHANGED:
1303
- const { type, selection: selectionSource } = action.payload;
1304
- if (selectionSource && type === "index") {
1305
- const currentRecords = getCurrentRecords(stateManager);
1306
- if (currentRecords) {
1307
- const records = Array.from(currentRecords.values());
1308
- const selectionById = [];
1309
- selectionSource.forEach((i) => {
1310
- if (i > 0 && i < currentRecords.size) {
1311
- selectionById.push(records[i].__record__id__);
1312
- }
1313
- });
1314
- return selectionById;
1315
- }
1316
- }
1317
- return selectionSource;
1318
- }
1319
- return currentState;
1320
- }
1321
- }
1322
- const SelectionReducer = new SelectionReducerImpl();
1323
- const getSelection = (stateManager) => {
1324
- let selection = stateManager.select(SelectionReducer.sliceName, (state) => state);
1325
- const currentRecords = Array.from((getCurrentRecords(stateManager) || new Map()).keys());
1326
- if (selection) {
1327
- selection = selection.filter(id => currentRecords.includes(id));
1328
- }
1329
- if (!selection || selection.length === 0) {
1330
- if (currentRecords && currentRecords.length > 0) {
1331
- return [currentRecords[0]];
1332
- }
1333
- }
1334
- return selection;
1335
- };
1336
- const hasNext = (stateManager) => {
1337
- const records = getCurrentRecords(stateManager);
1338
- if (records) {
1339
- const selection = stateManager.select(SelectionReducer.sliceName, (state) => state);
1340
- if (!selection || selection.length === 0) {
1341
- return records.size > 0;
1342
- }
1343
- return records.size > (getItemIndex(selection[0], records) + 1);
1344
- }
1345
- return false;
1346
- };
1347
- const hasPrevious = (stateManager) => {
1348
- const records = getCurrentRecords(stateManager);
1349
- if (records) {
1350
- const selection = stateManager.select(SelectionReducer.sliceName, (state) => state);
1351
- if (!selection || selection.length === 0) {
1352
- return false;
1353
- }
1354
- return getItemIndex(selection[0], records) > 0;
1355
- }
1356
- return false;
1357
- };
1358
- function getItemIndex(key, map) {
1359
- return Array.from(map.keys()).indexOf(key);
1360
- }
1361
- function updateSavedIds(stateManager, savedRecords) {
1362
- const currentSelection = getSelection(stateManager);
1363
- if (currentSelection) {
1364
- const newSelection = [];
1365
- currentSelection.forEach(id => {
1366
- const record = savedRecords.find(r => r.__old__id__ === id);
1367
- if (record) {
1368
- newSelection.push(record.__record__id__);
1369
- }
1370
- else {
1371
- newSelection.push(id);
1372
- }
1373
- });
1374
- return newSelection;
1375
- }
1376
- return currentSelection;
1377
- }
1378
-
1379
- var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
1380
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1381
- return new (P || (P = Promise))(function (resolve, reject) {
1382
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
1383
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
1384
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
1385
- step((generator = generator.apply(thisArg, _arguments || [])).next());
1386
- });
1387
- };
1388
- class DataUnit {
1389
- constructor(name) {
1390
- this._name = name;
1391
- this._stateManager = new StateManager([
1392
- HistReducer,
1393
- UnitMetadataReducer,
1394
- RecordsReducer,
1395
- RemovedRecordsReducer,
1396
- AddedRecordsReducer,
1397
- SelectionReducer,
1398
- ChangesReducer,
1399
- CurrentRecordsReducer
1400
- ]);
1401
- this._observers = [];
1402
- this._filterProviders = [];
1403
- this._sortingProvider = undefined;
1404
- this._interceptors = [];
1405
- }
1406
- get name() {
1407
- return this._name;
1408
- }
1409
- // Métodos privados
1410
- validateAndTypeValue(fieldName, newValue) {
1411
- //FIXME: Validações devem ser feitas aqui
1412
- const descriptor = this.getField(fieldName);
1413
- return descriptor ? convertType(descriptor.dataType, newValue) : newValue;
1414
- }
1415
- getFilters() {
1416
- let filters = undefined;
1417
- this._filterProviders.forEach(p => {
1418
- const f = p.getFilter(this.name);
1419
- if (f) {
1420
- filters = (filters || []).concat(f);
1421
- }
1422
- });
1423
- return filters;
1424
- }
1425
- getSort() {
1426
- return this._sortingProvider ? this._sortingProvider.getSort(this._name) : undefined;
1427
- }
1428
- // Loaders
1429
- loadMetadata() {
1430
- return __awaiter(this, void 0, void 0, function* () {
1431
- this.dispatchAction(Action.LOADING_METADATA);
1432
- return new Promise((resolve, fail) => {
1433
- if (this.metadataLoader) {
1434
- this.metadataLoader(this).then(metadata => {
1435
- this.metadata = metadata;
1436
- resolve(this.metadata);
1437
- }).catch(error => fail(error));
1438
- }
1439
- });
1440
- });
1441
- }
1442
- loadData() {
1443
- return __awaiter(this, void 0, void 0, function* () {
1444
- this.dispatchAction(Action.LOADING_DATA);
1445
- return new Promise((resolve, fail) => {
1446
- if (this.dataLoader) {
1447
- const sort = this.getSort();
1448
- const filters = this.getFilters();
1449
- this.dataLoader(this, sort, filters).then(records => {
1450
- this.records = records;
1451
- resolve(this.records);
1452
- }).catch(error => fail(error));
1453
- }
1454
- });
1455
- });
1456
- }
1457
- saveData() {
1458
- return __awaiter(this, void 0, void 0, function* () {
1459
- const changes = getChangesToSave(this._name, this._stateManager);
1460
- if (changes.length > 0) {
1461
- this.dispatchAction(Action.SAVING_DATA);
1462
- return new Promise((resolve, fail) => {
1463
- if (this.saveLoader) {
1464
- this.saveLoader(this, changes).then(records => this.dispatchAction(Action.DATA_SAVED, { changes, records })).catch(error => fail(error));
1465
- }
1466
- });
1467
- }
1468
- return Promise.resolve();
1469
- });
1470
- }
1471
- removeSelectedRecords(buffered = false) {
1472
- return __awaiter(this, void 0, void 0, function* () {
1473
- const selection = getSelection(this._stateManager);
1474
- if (selection) {
1475
- return this.removeRecords(selection, buffered);
1476
- }
1477
- return Promise.resolve(selection);
1478
- });
1479
- }
1480
- removeRecords(records, buffered = false) {
1481
- return __awaiter(this, void 0, void 0, function* () {
1482
- if (records) {
1483
- if (buffered || !this.removeLoader) {
1484
- this.dispatchAction(Action.RECORDS_REMOVED, { records, buffered: true });
1485
- }
1486
- else {
1487
- this.dispatchAction(Action.REMOVING_RECORDS);
1488
- return new Promise((resolve, fail) => {
1489
- if (this.removeLoader) {
1490
- this.removeLoader(this, records).then(records => {
1491
- this.dispatchAction(Action.RECORDS_REMOVED, { records, buffered: false });
1492
- resolve(records);
1493
- }).catch(error => fail(error));
1494
- }
1495
- });
1496
- }
1497
- }
1498
- return Promise.resolve(records);
1499
- });
1500
- }
1501
- // API
1502
- valueFromString(fieldName, value) {
1503
- const descriptor = this.getField(fieldName);
1504
- return descriptor ? convertType(descriptor.dataType, value) : value;
1505
- }
1506
- addInterceptor(interceptor) {
1507
- this._interceptors.push(interceptor);
1508
- }
1509
- addFilterProvider(provider) {
1510
- this._filterProviders.push(provider);
1511
- }
1512
- set sortingProvider(provider) {
1513
- this._sortingProvider = provider;
1514
- }
1515
- set metadata(md) {
1516
- this.dispatchAction(Action.METADATA_LOADED, md);
1517
- }
1518
- get metadata() {
1519
- return getMetadata(this._stateManager);
1520
- }
1521
- set records(r) {
1522
- this.dispatchAction(Action.DATA_LOADED, r);
1523
- }
1524
- get records() {
1525
- const records = getCurrentRecords(this._stateManager);
1526
- return records ? Array.from(records.values()) : [];
1527
- }
1528
- getField(fieldName) {
1529
- return getField(this._stateManager, fieldName);
1530
- }
1531
- addRecord() {
1532
- this.dispatchAction(Action.RECORDS_ADDED, prepareAddedRecordId(this._stateManager, [{}]));
1533
- }
1534
- copySelected() {
1535
- const selectedRecords = this.getSelectedRecords();
1536
- if (selectedRecords) {
1537
- this.dispatchAction(Action.RECORDS_COPIED, prepareAddedRecordId(this._stateManager, selectedRecords));
1538
- }
1539
- }
1540
- getFieldValue(fieldName) {
1541
- return getFieldValue(this._stateManager, fieldName);
1542
- }
1543
- setFieldValue(fieldName, newValue, records) {
1544
- const typedValue = this.validateAndTypeValue(fieldName, newValue);
1545
- const currentValue = this.getFieldValue(fieldName);
1546
- if (currentValue !== typedValue) {
1547
- this.dispatchAction(Action.DATA_CHANGED, { [fieldName]: typedValue, records });
1548
- }
1549
- }
1550
- getSelection() {
1551
- return getSelection(this._stateManager);
1552
- }
1553
- setSelection(selection) {
1554
- this.dispatchAction(Action.SELECTION_CHANGED, { type: "id", selection });
1555
- }
1556
- setSelectionByIndex(selection) {
1557
- this.dispatchAction(Action.SELECTION_CHANGED, { type: "index", selection });
1558
- }
1559
- getSelectedRecords() {
1560
- const selection = this.getSelection();
1561
- if (selection) {
1562
- const currentRecords = this.records;
1563
- return currentRecords === null || currentRecords === void 0 ? void 0 : currentRecords.filter(r => selection.includes(r.__record__id__));
1564
- }
1565
- }
1566
- nextRecord() {
1567
- this.dispatchAction(Action.NEXT_SELECTED);
1568
- }
1569
- previousRecord() {
1570
- this.dispatchAction(Action.PREVIOUS_SELECTED);
1571
- }
1572
- cancelEdition() {
1573
- this.dispatchAction(Action.EDITION_CANCELED);
1574
- }
1575
- isDirty() {
1576
- return isDirty(this._stateManager);
1577
- }
1578
- hasNext() {
1579
- return hasNext(this._stateManager);
1580
- }
1581
- hasPrevious() {
1582
- return hasPrevious(this._stateManager);
1583
- }
1584
- canUndo() {
1585
- return canUndo(this._stateManager);
1586
- }
1587
- canRedo() {
1588
- return canRedo(this._stateManager);
1589
- }
1590
- undo() {
1591
- this.dispatchAction(Action.CHANGE_UNDONE);
1592
- }
1593
- redo() {
1594
- this.dispatchAction(Action.CHANGE_REDONE);
1595
- }
1596
- toString() {
1597
- return this.name;
1598
- }
1599
- // Actions / State manager
1600
- dispatchAction(actionType, payload) {
1601
- var _a;
1602
- let action = new DataUnitAction(actionType, payload);
1603
- (_a = this._interceptors) === null || _a === void 0 ? void 0 : _a.forEach(interceptor => {
1604
- if (action) {
1605
- action = interceptor.interceptAction(action);
1606
- }
1607
- });
1608
- if (action) {
1609
- this._stateManager.process(action);
1610
- this._observers.forEach(f => f(action));
1611
- }
1612
- }
1613
- subscribe(observer) {
1614
- this._observers.push(observer);
1615
- }
1616
- unsubscribe(observer) {
1617
- this._observers = this._observers.filter(f => f !== observer);
1618
- }
1619
- }
1620
- var ChangeOperation;
1621
- (function (ChangeOperation) {
1622
- ChangeOperation["INSERT"] = "INSERT";
1623
- ChangeOperation["UPDATE"] = "UPDATE";
1624
- ChangeOperation["DELETE"] = "DELETE";
1625
- })(ChangeOperation || (ChangeOperation = {}));
1626
- class Change {
1627
- constructor(dataUnit, record, updates, operation) {
1628
- this.dataUnit = dataUnit;
1629
- this.record = record;
1630
- this.updatingFields = updates;
1631
- this._operation = operation;
1632
- }
1633
- get operation() {
1634
- return this._operation.toString();
1635
- }
1636
- isInsert() {
1637
- return this._operation === ChangeOperation.INSERT;
1638
- }
1639
- isDelete() {
1640
- return this._operation === ChangeOperation.DELETE;
1641
- }
1642
- isUpdate() {
1643
- return this._operation === ChangeOperation.UPDATE;
1644
- }
1645
- }
1646
-
1647
- var SortMode;
1648
- (function (SortMode) {
1649
- SortMode["ASC"] = "ASC";
1650
- SortMode["DESC"] = "DESC";
1651
- })(SortMode || (SortMode = {}));
1652
- var DependencyType;
1653
- (function (DependencyType) {
1654
- DependencyType["SEARCHING"] = "SEARCHING";
1655
- DependencyType["REQUIREMENT"] = "REQUIREMENT";
1656
- DependencyType["VISIBILITY"] = "REQUIREMENT";
1657
- })(DependencyType || (DependencyType = {}));
1658
- var UserInterface;
1659
- (function (UserInterface) {
1660
- UserInterface["FILE"] = "FILE";
1661
- UserInterface["IMAGE"] = "IMAGE";
1662
- UserInterface["DATE"] = "DATE";
1663
- UserInterface["DATETIME"] = "DATETIME";
1664
- UserInterface["TIME"] = "TIME";
1665
- UserInterface["ELAPSEDTIME"] = "ELAPSEDTIME";
1666
- UserInterface["CHECKBOX"] = "CHECKBOX";
1667
- UserInterface["SWITCH"] = "SWITCH";
1668
- UserInterface["OPTIONSELECTOR"] = "OPTIONSELECTOR";
1669
- UserInterface["DECIMALNUMBER"] = "DECIMALNUMBER";
1670
- UserInterface["INTEGERNUMBER"] = "INTEGERNUMBER";
1671
- UserInterface["SEARCH"] = "SEARCH";
1672
- UserInterface["SHORTTEXT"] = "SHORTTEXT";
1673
- UserInterface["PASSWORD"] = "PASSWORD";
1674
- UserInterface["MASKEDTEXT"] = "MASKEDTEXT";
1675
- UserInterface["LONGTEXT"] = "LONGTEXT";
1676
- UserInterface["HTML"] = "HTML";
926
+ /**
927
+ * Essa classe representa uma interpretação do padrão de projetos Flux.
928
+ * No padrão Flux os dados da aplicação são chamados de "estado" e existem
929
+ * algumas regras para gerenciamento/manipulação desse estado:
930
+ *
931
+ * 1 - O estado é imutável.
932
+ * 2 - Toda modificação de estado é representada por uma "ação".
933
+ * 3 - Quando "ações" acontecem a "store" cria um novo estado e notifica a todos interessados.
934
+ *
935
+ * Nessa interpretação desse design pattern, o StateManager faz o papel da store,
936
+ * notificando os manipuladores de estado (handlers), que são responsáveis por pedaços
937
+ * do estado (slices).
938
+ *
939
+ * O StateManager mantém dois tipos de estados: "Histórico" e "Não Histórico". No estado
940
+ * "Histórico", sempre que uma alteração de estado acontece, o estado anterior é guardado em
941
+ * uma pilha, o que permite que possamos voltar no tempo, desfazendo algumas ações
942
+ */
943
+ class StateManager {
944
+ constructor(reducers) {
945
+ this._past = [];
946
+ this._future = [];
947
+ this._present = {};
948
+ this._nonHist = {};
949
+ this._histClean = false;
950
+ this._reducers = reducers;
951
+ }
952
+ process(action) {
953
+ const oldPresent = this._present;
954
+ let hasHistChange = false;
955
+ this._histClean = false;
956
+ this._reducers.forEach(reducer => {
957
+ const sliceName = reducer.sliceName;
958
+ const isHistoric = this.isHistoric(sliceName);
959
+ const oldSlice = this.getSlice(sliceName, isHistoric);
960
+ const newSlice = reducer.reduce(this, oldSlice, action);
961
+ if (newSlice !== oldSlice) {
962
+ this.updateSlice(sliceName, newSlice, isHistoric);
963
+ hasHistChange || (hasHistChange = isHistoric);
964
+ }
965
+ });
966
+ if (hasHistChange && !this._histClean) {
967
+ this._past.push(oldPresent);
968
+ this._future = [];
969
+ document.dispatchEvent(new CustomEvent("undoableAction", { detail: this }));
970
+ }
971
+ }
972
+ select(sliceName, selector) {
973
+ const isHistoric = this.isHistoric(sliceName);
974
+ return selector(this.getSlice(sliceName, isHistoric));
975
+ }
976
+ isHistoric(slice) {
977
+ return slice.startsWith("hist::");
978
+ }
979
+ updateSlice(name, slice, isHistoric) {
980
+ if (isHistoric) {
981
+ this._present = Object.assign(Object.assign({}, this._present), { [name]: slice });
982
+ if (slice === undefined) {
983
+ delete this._present[name];
984
+ }
985
+ }
986
+ else {
987
+ this._nonHist = Object.assign(Object.assign({}, this._nonHist), { [name]: slice });
988
+ if (slice === undefined) {
989
+ delete this._nonHist[name];
990
+ }
991
+ }
992
+ }
993
+ getSlice(name, isHistoric) {
994
+ return isHistoric ? this._present[name] : this._nonHist[name];
995
+ }
996
+ canUndo() {
997
+ return this._past.length > 0;
998
+ }
999
+ canRedo() {
1000
+ return this._future.length > 0;
1001
+ }
1002
+ undo() {
1003
+ if (this.canUndo()) {
1004
+ this._future.push(this._present);
1005
+ this._present = this._past.pop();
1006
+ }
1007
+ }
1008
+ redo() {
1009
+ if (this.canRedo()) {
1010
+ this._past.push(this._present);
1011
+ this._present = this._future.pop();
1012
+ }
1013
+ }
1014
+ clearUndo() {
1015
+ this._histClean = true;
1016
+ this._past = [];
1017
+ this._future = [];
1018
+ }
1019
+ persist() {
1020
+ }
1021
+ }
1022
+
1023
+ class HistReducerImpl {
1024
+ constructor() {
1025
+ this.sliceName = "";
1026
+ }
1027
+ reduce(stateManager, _currentState, action) {
1028
+ switch (action.type) {
1029
+ case Action.DATA_SAVED:
1030
+ case Action.EDITION_CANCELED:
1031
+ stateManager.clearUndo();
1032
+ break;
1033
+ case Action.CHANGE_UNDONE:
1034
+ stateManager.undo();
1035
+ break;
1036
+ case Action.CHANGE_REDONE:
1037
+ stateManager.redo();
1038
+ break;
1039
+ }
1040
+ }
1041
+ }
1042
+ const HistReducer = new HistReducerImpl();
1043
+ const canUndo = (stateManager) => {
1044
+ return stateManager.canUndo();
1045
+ };
1046
+ const canRedo = (stateManager) => {
1047
+ return stateManager.canRedo();
1048
+ };
1049
+
1050
+ class UnitMetadataReducerImpl {
1051
+ constructor() {
1052
+ this.sliceName = "unitMetadata";
1053
+ }
1054
+ reduce(_stateManager, currentState, action) {
1055
+ if (action.type === Action.METADATA_LOADED) {
1056
+ return action.payload;
1057
+ }
1058
+ return currentState;
1059
+ }
1060
+ }
1061
+ const UnitMetadataReducer = new UnitMetadataReducerImpl();
1062
+ const getMetadata = (stateManager) => {
1063
+ return stateManager.select(UnitMetadataReducer.sliceName, (state) => state);
1064
+ };
1065
+ const getField = (stateManager, fieldName) => {
1066
+ const md = getMetadata(stateManager);
1067
+ return md ? md.fields.find(fmd => fmd.name === fieldName) : undefined;
1068
+ };
1069
+
1070
+ class RemovedRecordsReducerImpl {
1071
+ constructor() {
1072
+ this.sliceName = "hist::removedRecords";
1073
+ }
1074
+ reduce(_stateManager, currentState, action) {
1075
+ switch (action.type) {
1076
+ case Action.RECORDS_REMOVED:
1077
+ const { records, buffered } = action.payload;
1078
+ if (buffered) {
1079
+ return (currentState || []).concat(records);
1080
+ }
1081
+ return currentState;
1082
+ case Action.EDITION_CANCELED:
1083
+ case Action.DATA_SAVED:
1084
+ return undefined;
1085
+ }
1086
+ return currentState;
1087
+ }
1088
+ }
1089
+ const RemovedRecordsReducer = new RemovedRecordsReducerImpl();
1090
+ const getRemovedRecords = (stateManager) => {
1091
+ return stateManager.select(RemovedRecordsReducer.sliceName, (state) => state);
1092
+ };
1093
+
1094
+ class RecordsReducerImpl {
1095
+ constructor() {
1096
+ this.sliceName = "records";
1097
+ }
1098
+ reduce(stateManager, currentState, action) {
1099
+ switch (action.type) {
1100
+ case Action.DATA_LOADED:
1101
+ return action.payload;
1102
+ case Action.RECORDS_REMOVED:
1103
+ const { records, buffered } = action.payload;
1104
+ if (!buffered) {
1105
+ return currentState.filter(r => !records.includes(r.__record__id__));
1106
+ }
1107
+ return currentState;
1108
+ case Action.DATA_SAVED:
1109
+ const recordsMap = new Map();
1110
+ const currentRecords = getRecords(stateManager);
1111
+ if (currentRecords) {
1112
+ const removed = getRemovedRecords(stateManager) || [];
1113
+ currentRecords.forEach(r => {
1114
+ if (!removed.includes(r.__record__id__)) {
1115
+ recordsMap.set(r.__record__id__, r);
1116
+ }
1117
+ });
1118
+ }
1119
+ const savedRecords = action.payload.records;
1120
+ savedRecords.forEach(sr => {
1121
+ const recordId = sr.__old__id__ || sr.__record__id__;
1122
+ const newRecord = Object.assign({}, sr);
1123
+ delete newRecord["__old__id__"];
1124
+ recordsMap.set(recordId, newRecord);
1125
+ });
1126
+ return Array.from(recordsMap.values());
1127
+ }
1128
+ return currentState;
1129
+ }
1130
+ }
1131
+ const RecordsReducer = new RecordsReducerImpl();
1132
+ const getRecords = (stateManager) => {
1133
+ return stateManager.select(RecordsReducer.sliceName, (state) => state);
1134
+ };
1135
+
1136
+ class AddedRecordsReducerImpl {
1137
+ constructor() {
1138
+ this.sliceName = "hist::addedRecords";
1139
+ }
1140
+ reduce(_stateManager, currentState, action) {
1141
+ switch (action.type) {
1142
+ case Action.RECORDS_ADDED:
1143
+ case Action.RECORDS_COPIED:
1144
+ return (currentState || []).concat(action.payload);
1145
+ case Action.DATA_SAVED:
1146
+ case Action.EDITION_CANCELED:
1147
+ return undefined;
1148
+ }
1149
+ return currentState;
1150
+ }
1151
+ }
1152
+ const AddedRecordsReducer = new AddedRecordsReducerImpl();
1153
+ const getAddedRecords = (stateManager) => {
1154
+ return stateManager.select(AddedRecordsReducer.sliceName, (state) => state);
1155
+ };
1156
+ const prepareAddedRecordId = (stateManager, source) => {
1157
+ let index = (getAddedRecords(stateManager) || []).length;
1158
+ return source.map(item => { return Object.assign(Object.assign({}, item), { __record__id__: "NEW_" + (index++) }); });
1159
+ };
1160
+
1161
+ class ChangesReducerImpl {
1162
+ constructor() {
1163
+ this.sliceName = "hist::changes";
1164
+ }
1165
+ reduce(stateManager, currentState, action) {
1166
+ switch (action.type) {
1167
+ case Action.DATA_CHANGED:
1168
+ const selection = action.payload.records || getSelection(stateManager);
1169
+ if (selection) {
1170
+ const newState = new Map(currentState);
1171
+ selection.forEach(recordId => {
1172
+ const newChanges = Object.assign(Object.assign({}, newState.get(recordId)), action.payload);
1173
+ delete newChanges.records;
1174
+ newState.set(recordId, newChanges);
1175
+ });
1176
+ return newState;
1177
+ }
1178
+ return currentState;
1179
+ case Action.DATA_SAVED:
1180
+ case Action.EDITION_CANCELED:
1181
+ return undefined;
1182
+ }
1183
+ return currentState;
1184
+ }
1185
+ }
1186
+ const ChangesReducer = new ChangesReducerImpl();
1187
+ const getChanges = (stateManager) => {
1188
+ return stateManager.select(ChangesReducer.sliceName, (state) => state);
1189
+ };
1190
+ const isDirty = (stateManager) => {
1191
+ if (getAddedRecords(stateManager) !== undefined) {
1192
+ return true;
1193
+ }
1194
+ if (getRemovedRecords(stateManager) !== undefined) {
1195
+ return true;
1196
+ }
1197
+ return getChanges(stateManager) !== undefined;
1198
+ };
1199
+ const getChangesToSave = (dataUnit, stateManager) => {
1200
+ const result = [];
1201
+ const changes = getChanges(stateManager);
1202
+ const records = getRecords(stateManager);
1203
+ records === null || records === void 0 ? void 0 : records.forEach(r => {
1204
+ if (changes) {
1205
+ const c = changes.get(r.__record__id__);
1206
+ if (c) {
1207
+ result.push(new Change(dataUnit, r, c, ChangeOperation.UPDATE));
1208
+ }
1209
+ }
1210
+ });
1211
+ const addedRecords = getAddedRecords(stateManager);
1212
+ if (addedRecords) {
1213
+ addedRecords.forEach(r => {
1214
+ result.push(new Change(dataUnit, r, changes === null || changes === void 0 ? void 0 : changes.get(r.__record__id__), ChangeOperation.INSERT));
1215
+ });
1216
+ }
1217
+ const removedRecords = getRemovedRecords(stateManager);
1218
+ const recordsById = {};
1219
+ records === null || records === void 0 ? void 0 : records.forEach(r => recordsById[r.__record__id__] = r);
1220
+ if (removedRecords) {
1221
+ removedRecords.forEach(id => {
1222
+ result.push(new Change(dataUnit, recordsById[id], undefined, ChangeOperation.DELETE));
1223
+ });
1224
+ }
1225
+ return result;
1226
+ };
1227
+
1228
+ class CurrentRecordsReducerImpl {
1229
+ constructor() {
1230
+ this.sliceName = "currentRecords";
1231
+ }
1232
+ reduce(stateManager) {
1233
+ let records = getRecords(stateManager);
1234
+ const added = getAddedRecords(stateManager);
1235
+ if (!records && !added) {
1236
+ return undefined;
1237
+ }
1238
+ if (added) {
1239
+ records = (records || []).concat(added);
1240
+ }
1241
+ const removedRecords = getRemovedRecords(stateManager);
1242
+ if (removedRecords) {
1243
+ records = records.filter(r => !removedRecords.includes(r.__record__id__));
1244
+ }
1245
+ const changes = getChanges(stateManager);
1246
+ return new Map(records.map(r => {
1247
+ const recordId = r.__record__id__;
1248
+ const record = Object.assign(Object.assign({}, r), changes === null || changes === void 0 ? void 0 : changes.get(recordId));
1249
+ return [recordId, record];
1250
+ }));
1251
+ }
1252
+ }
1253
+ const CurrentRecordsReducer = new CurrentRecordsReducerImpl();
1254
+ const getCurrentRecords = (stateManager) => {
1255
+ return stateManager.select(CurrentRecordsReducer.sliceName, (state) => state);
1256
+ };
1257
+ const getFieldValue = (stateManager, fieldName) => {
1258
+ const selection = getSelection(stateManager);
1259
+ if (selection && selection.length > 0) {
1260
+ const currentRecords = getCurrentRecords(stateManager);
1261
+ if (currentRecords) {
1262
+ const record = currentRecords.get(selection[0]);
1263
+ return record ? record[fieldName] : undefined;
1264
+ }
1265
+ }
1266
+ return undefined;
1267
+ };
1268
+
1269
+ class SelectionReducerImpl {
1270
+ constructor() {
1271
+ this.sliceName = "hist::selection";
1272
+ }
1273
+ reduce(stateManager, currentState, action) {
1274
+ switch (action.type) {
1275
+ case Action.RECORDS_ADDED:
1276
+ case Action.RECORDS_COPIED:
1277
+ return action.payload.map((r) => r.__record__id__);
1278
+ case Action.DATA_SAVED:
1279
+ return updateSavedIds(stateManager, action.payload.records);
1280
+ case Action.RECORDS_REMOVED:
1281
+ const removed = action.payload.records;
1282
+ if (currentState && removed) {
1283
+ return currentState.filter(recordId => !removed.includes(recordId));
1284
+ }
1285
+ return currentState;
1286
+ case Action.NEXT_SELECTED:
1287
+ case Action.PREVIOUS_SELECTED:
1288
+ const currentRecords = getCurrentRecords(stateManager);
1289
+ if (currentRecords && currentRecords.size > 0) {
1290
+ let index;
1291
+ if (!currentState || currentState.length === 0) {
1292
+ index = action.type === Action.PREVIOUS_SELECTED ? 0 : Math.min(1, currentRecords.size);
1293
+ }
1294
+ else {
1295
+ index = getItemIndex(currentState[0], currentRecords) + (action.type === Action.PREVIOUS_SELECTED ? -1 : 1);
1296
+ }
1297
+ if (index < currentRecords.size && index >= 0) {
1298
+ return [Array.from(currentRecords.values())[index].__record__id__];
1299
+ }
1300
+ }
1301
+ return undefined;
1302
+ case Action.SELECTION_CHANGED:
1303
+ const { type, selection: selectionSource } = action.payload;
1304
+ if (selectionSource && type === "index") {
1305
+ const currentRecords = getCurrentRecords(stateManager);
1306
+ if (currentRecords) {
1307
+ const records = Array.from(currentRecords.values());
1308
+ const selectionById = [];
1309
+ selectionSource.forEach((i) => {
1310
+ if (i > 0 && i < currentRecords.size) {
1311
+ selectionById.push(records[i].__record__id__);
1312
+ }
1313
+ });
1314
+ return selectionById;
1315
+ }
1316
+ }
1317
+ return selectionSource;
1318
+ }
1319
+ return currentState;
1320
+ }
1321
+ }
1322
+ const SelectionReducer = new SelectionReducerImpl();
1323
+ const getSelection = (stateManager) => {
1324
+ let selection = stateManager.select(SelectionReducer.sliceName, (state) => state);
1325
+ const currentRecords = Array.from((getCurrentRecords(stateManager) || new Map()).keys());
1326
+ if (selection) {
1327
+ selection = selection.filter(id => currentRecords.includes(id));
1328
+ }
1329
+ if (!selection || selection.length === 0) {
1330
+ if (currentRecords && currentRecords.length > 0) {
1331
+ return [currentRecords[0]];
1332
+ }
1333
+ }
1334
+ return selection;
1335
+ };
1336
+ const hasNext = (stateManager) => {
1337
+ const records = getCurrentRecords(stateManager);
1338
+ if (records) {
1339
+ const selection = stateManager.select(SelectionReducer.sliceName, (state) => state);
1340
+ if (!selection || selection.length === 0) {
1341
+ return records.size > 0;
1342
+ }
1343
+ return records.size > (getItemIndex(selection[0], records) + 1);
1344
+ }
1345
+ return false;
1346
+ };
1347
+ const hasPrevious = (stateManager) => {
1348
+ const records = getCurrentRecords(stateManager);
1349
+ if (records) {
1350
+ const selection = stateManager.select(SelectionReducer.sliceName, (state) => state);
1351
+ if (!selection || selection.length === 0) {
1352
+ return false;
1353
+ }
1354
+ return getItemIndex(selection[0], records) > 0;
1355
+ }
1356
+ return false;
1357
+ };
1358
+ function getItemIndex(key, map) {
1359
+ return Array.from(map.keys()).indexOf(key);
1360
+ }
1361
+ function updateSavedIds(stateManager, savedRecords) {
1362
+ const currentSelection = getSelection(stateManager);
1363
+ if (currentSelection) {
1364
+ const newSelection = [];
1365
+ currentSelection.forEach(id => {
1366
+ const record = savedRecords.find(r => r.__old__id__ === id);
1367
+ if (record) {
1368
+ newSelection.push(record.__record__id__);
1369
+ }
1370
+ else {
1371
+ newSelection.push(id);
1372
+ }
1373
+ });
1374
+ return newSelection;
1375
+ }
1376
+ return currentSelection;
1377
+ }
1378
+
1379
+ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
1380
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1381
+ return new (P || (P = Promise))(function (resolve, reject) {
1382
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
1383
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
1384
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
1385
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
1386
+ });
1387
+ };
1388
+ class DataUnit {
1389
+ constructor(name) {
1390
+ this._name = name;
1391
+ this._stateManager = new StateManager([
1392
+ HistReducer,
1393
+ UnitMetadataReducer,
1394
+ RecordsReducer,
1395
+ RemovedRecordsReducer,
1396
+ AddedRecordsReducer,
1397
+ SelectionReducer,
1398
+ ChangesReducer,
1399
+ CurrentRecordsReducer
1400
+ ]);
1401
+ this._observers = [];
1402
+ this._filterProviders = [];
1403
+ this._sortingProvider = undefined;
1404
+ this._interceptors = [];
1405
+ }
1406
+ get name() {
1407
+ return this._name;
1408
+ }
1409
+ // Métodos privados
1410
+ validateAndTypeValue(fieldName, newValue) {
1411
+ //FIXME: Validações devem ser feitas aqui
1412
+ const descriptor = this.getField(fieldName);
1413
+ return descriptor ? convertType(descriptor.dataType, newValue) : newValue;
1414
+ }
1415
+ getFilters() {
1416
+ let filters = undefined;
1417
+ this._filterProviders.forEach(p => {
1418
+ const f = p.getFilter(this.name);
1419
+ if (f) {
1420
+ filters = (filters || []).concat(f);
1421
+ }
1422
+ });
1423
+ return filters;
1424
+ }
1425
+ getSort() {
1426
+ return this._sortingProvider ? this._sortingProvider.getSort(this._name) : undefined;
1427
+ }
1428
+ // Loaders
1429
+ loadMetadata() {
1430
+ return __awaiter(this, void 0, void 0, function* () {
1431
+ this.dispatchAction(Action.LOADING_METADATA);
1432
+ return new Promise((resolve, fail) => {
1433
+ if (this.metadataLoader) {
1434
+ this.metadataLoader(this).then(metadata => {
1435
+ this.metadata = metadata;
1436
+ resolve(this.metadata);
1437
+ }).catch(error => fail(error));
1438
+ }
1439
+ });
1440
+ });
1441
+ }
1442
+ loadData() {
1443
+ return __awaiter(this, void 0, void 0, function* () {
1444
+ this.dispatchAction(Action.LOADING_DATA);
1445
+ return new Promise((resolve, fail) => {
1446
+ if (this.dataLoader) {
1447
+ const sort = this.getSort();
1448
+ const filters = this.getFilters();
1449
+ this.dataLoader(this, sort, filters).then(records => {
1450
+ this.records = records;
1451
+ resolve(this.records);
1452
+ }).catch(error => fail(error));
1453
+ }
1454
+ });
1455
+ });
1456
+ }
1457
+ saveData() {
1458
+ return __awaiter(this, void 0, void 0, function* () {
1459
+ const changes = getChangesToSave(this._name, this._stateManager);
1460
+ if (changes.length > 0) {
1461
+ this.dispatchAction(Action.SAVING_DATA);
1462
+ return new Promise((resolve, fail) => {
1463
+ if (this.saveLoader) {
1464
+ this.saveLoader(this, changes).then(records => this.dispatchAction(Action.DATA_SAVED, { changes, records })).catch(error => fail(error));
1465
+ }
1466
+ });
1467
+ }
1468
+ return Promise.resolve();
1469
+ });
1470
+ }
1471
+ removeSelectedRecords(buffered = false) {
1472
+ return __awaiter(this, void 0, void 0, function* () {
1473
+ const selection = getSelection(this._stateManager);
1474
+ if (selection) {
1475
+ return this.removeRecords(selection, buffered);
1476
+ }
1477
+ return Promise.resolve(selection);
1478
+ });
1479
+ }
1480
+ removeRecords(records, buffered = false) {
1481
+ return __awaiter(this, void 0, void 0, function* () {
1482
+ if (records) {
1483
+ if (buffered || !this.removeLoader) {
1484
+ this.dispatchAction(Action.RECORDS_REMOVED, { records, buffered: true });
1485
+ }
1486
+ else {
1487
+ this.dispatchAction(Action.REMOVING_RECORDS);
1488
+ return new Promise((resolve, fail) => {
1489
+ if (this.removeLoader) {
1490
+ this.removeLoader(this, records).then(records => {
1491
+ this.dispatchAction(Action.RECORDS_REMOVED, { records, buffered: false });
1492
+ resolve(records);
1493
+ }).catch(error => fail(error));
1494
+ }
1495
+ });
1496
+ }
1497
+ }
1498
+ return Promise.resolve(records);
1499
+ });
1500
+ }
1501
+ // API
1502
+ valueFromString(fieldName, value) {
1503
+ const descriptor = this.getField(fieldName);
1504
+ return descriptor ? convertType(descriptor.dataType, value) : value;
1505
+ }
1506
+ addInterceptor(interceptor) {
1507
+ this._interceptors.push(interceptor);
1508
+ }
1509
+ addFilterProvider(provider) {
1510
+ this._filterProviders.push(provider);
1511
+ }
1512
+ set sortingProvider(provider) {
1513
+ this._sortingProvider = provider;
1514
+ }
1515
+ set metadata(md) {
1516
+ this.dispatchAction(Action.METADATA_LOADED, md);
1517
+ }
1518
+ get metadata() {
1519
+ return getMetadata(this._stateManager);
1520
+ }
1521
+ set records(r) {
1522
+ this.dispatchAction(Action.DATA_LOADED, r);
1523
+ }
1524
+ get records() {
1525
+ const records = getCurrentRecords(this._stateManager);
1526
+ return records ? Array.from(records.values()) : [];
1527
+ }
1528
+ getField(fieldName) {
1529
+ return getField(this._stateManager, fieldName);
1530
+ }
1531
+ addRecord() {
1532
+ this.dispatchAction(Action.RECORDS_ADDED, prepareAddedRecordId(this._stateManager, [{}]));
1533
+ }
1534
+ copySelected() {
1535
+ const selectedRecords = this.getSelectedRecords();
1536
+ if (selectedRecords) {
1537
+ this.dispatchAction(Action.RECORDS_COPIED, prepareAddedRecordId(this._stateManager, selectedRecords));
1538
+ }
1539
+ }
1540
+ getFieldValue(fieldName) {
1541
+ return getFieldValue(this._stateManager, fieldName);
1542
+ }
1543
+ setFieldValue(fieldName, newValue, records) {
1544
+ const typedValue = this.validateAndTypeValue(fieldName, newValue);
1545
+ const currentValue = this.getFieldValue(fieldName);
1546
+ if (currentValue !== typedValue) {
1547
+ this.dispatchAction(Action.DATA_CHANGED, { [fieldName]: typedValue, records });
1548
+ }
1549
+ }
1550
+ getSelection() {
1551
+ return getSelection(this._stateManager);
1552
+ }
1553
+ setSelection(selection) {
1554
+ this.dispatchAction(Action.SELECTION_CHANGED, { type: "id", selection });
1555
+ }
1556
+ setSelectionByIndex(selection) {
1557
+ this.dispatchAction(Action.SELECTION_CHANGED, { type: "index", selection });
1558
+ }
1559
+ getSelectedRecords() {
1560
+ const selection = this.getSelection();
1561
+ if (selection) {
1562
+ const currentRecords = this.records;
1563
+ return currentRecords === null || currentRecords === void 0 ? void 0 : currentRecords.filter(r => selection.includes(r.__record__id__));
1564
+ }
1565
+ }
1566
+ nextRecord() {
1567
+ this.dispatchAction(Action.NEXT_SELECTED);
1568
+ }
1569
+ previousRecord() {
1570
+ this.dispatchAction(Action.PREVIOUS_SELECTED);
1571
+ }
1572
+ cancelEdition() {
1573
+ this.dispatchAction(Action.EDITION_CANCELED);
1574
+ }
1575
+ isDirty() {
1576
+ return isDirty(this._stateManager);
1577
+ }
1578
+ hasNext() {
1579
+ return hasNext(this._stateManager);
1580
+ }
1581
+ hasPrevious() {
1582
+ return hasPrevious(this._stateManager);
1583
+ }
1584
+ canUndo() {
1585
+ return canUndo(this._stateManager);
1586
+ }
1587
+ canRedo() {
1588
+ return canRedo(this._stateManager);
1589
+ }
1590
+ undo() {
1591
+ this.dispatchAction(Action.CHANGE_UNDONE);
1592
+ }
1593
+ redo() {
1594
+ this.dispatchAction(Action.CHANGE_REDONE);
1595
+ }
1596
+ toString() {
1597
+ return this.name;
1598
+ }
1599
+ // Actions / State manager
1600
+ dispatchAction(actionType, payload) {
1601
+ var _a;
1602
+ let action = new DataUnitAction(actionType, payload);
1603
+ (_a = this._interceptors) === null || _a === void 0 ? void 0 : _a.forEach(interceptor => {
1604
+ if (action) {
1605
+ action = interceptor.interceptAction(action);
1606
+ }
1607
+ });
1608
+ if (action) {
1609
+ this._stateManager.process(action);
1610
+ this._observers.forEach(f => f(action));
1611
+ }
1612
+ }
1613
+ subscribe(observer) {
1614
+ this._observers.push(observer);
1615
+ }
1616
+ unsubscribe(observer) {
1617
+ this._observers = this._observers.filter(f => f !== observer);
1618
+ }
1619
+ }
1620
+ var ChangeOperation;
1621
+ (function (ChangeOperation) {
1622
+ ChangeOperation["INSERT"] = "INSERT";
1623
+ ChangeOperation["UPDATE"] = "UPDATE";
1624
+ ChangeOperation["DELETE"] = "DELETE";
1625
+ })(ChangeOperation || (ChangeOperation = {}));
1626
+ class Change {
1627
+ constructor(dataUnit, record, updates, operation) {
1628
+ this.dataUnit = dataUnit;
1629
+ this.record = record;
1630
+ this.updatingFields = updates;
1631
+ this._operation = operation;
1632
+ }
1633
+ get operation() {
1634
+ return this._operation.toString();
1635
+ }
1636
+ isInsert() {
1637
+ return this._operation === ChangeOperation.INSERT;
1638
+ }
1639
+ isDelete() {
1640
+ return this._operation === ChangeOperation.DELETE;
1641
+ }
1642
+ isUpdate() {
1643
+ return this._operation === ChangeOperation.UPDATE;
1644
+ }
1645
+ }
1646
+
1647
+ var SortMode;
1648
+ (function (SortMode) {
1649
+ SortMode["ASC"] = "ASC";
1650
+ SortMode["DESC"] = "DESC";
1651
+ })(SortMode || (SortMode = {}));
1652
+ var DependencyType;
1653
+ (function (DependencyType) {
1654
+ DependencyType["SEARCHING"] = "SEARCHING";
1655
+ DependencyType["REQUIREMENT"] = "REQUIREMENT";
1656
+ DependencyType["VISIBILITY"] = "REQUIREMENT";
1657
+ })(DependencyType || (DependencyType = {}));
1658
+ var UserInterface;
1659
+ (function (UserInterface) {
1660
+ UserInterface["FILE"] = "FILE";
1661
+ UserInterface["IMAGE"] = "IMAGE";
1662
+ UserInterface["DATE"] = "DATE";
1663
+ UserInterface["DATETIME"] = "DATETIME";
1664
+ UserInterface["TIME"] = "TIME";
1665
+ UserInterface["ELAPSEDTIME"] = "ELAPSEDTIME";
1666
+ UserInterface["CHECKBOX"] = "CHECKBOX";
1667
+ UserInterface["SWITCH"] = "SWITCH";
1668
+ UserInterface["OPTIONSELECTOR"] = "OPTIONSELECTOR";
1669
+ UserInterface["DECIMALNUMBER"] = "DECIMALNUMBER";
1670
+ UserInterface["INTEGERNUMBER"] = "INTEGERNUMBER";
1671
+ UserInterface["SEARCH"] = "SEARCH";
1672
+ UserInterface["SHORTTEXT"] = "SHORTTEXT";
1673
+ UserInterface["PASSWORD"] = "PASSWORD";
1674
+ UserInterface["MASKEDTEXT"] = "MASKEDTEXT";
1675
+ UserInterface["LONGTEXT"] = "LONGTEXT";
1676
+ UserInterface["HTML"] = "HTML";
1677
1677
  })(UserInterface || (UserInterface = {}));
1678
1678
 
1679
- class ApplicationContext {
1680
- static getContextValue(key) {
1681
- return ApplicationContext.getCtx()[key];
1682
- }
1683
- static setContextValue(key, value) {
1684
- ApplicationContext.getCtx()[key] = value;
1685
- }
1686
- static getCtx() {
1687
- let ctx = window.___snkcore___ctx___;
1688
- if (!ctx) {
1689
- ctx = {};
1690
- window.___snkcore___ctx___ = ctx;
1691
- }
1692
- return ctx;
1693
- }
1679
+ class ApplicationContext {
1680
+ static getContextValue(key) {
1681
+ return ApplicationContext.getCtx()[key];
1682
+ }
1683
+ static setContextValue(key, value) {
1684
+ ApplicationContext.getCtx()[key] = value;
1685
+ }
1686
+ static getCtx() {
1687
+ let ctx = window.___snkcore___ctx___;
1688
+ if (!ctx) {
1689
+ ctx = {};
1690
+ window.___snkcore___ctx___ = ctx;
1691
+ }
1692
+ return ctx;
1693
+ }
1694
1694
  }
1695
1695
 
1696
1696
  const ezCalendarCss = ":host{--ez-calendar--font-family:var(--font-pattern, Arial);--ez-calendar--color:var(--title--primary, #626e82);--ez-calendar--text-shadow:var(--text-shadow, 0 0 0 #353535, 0 0 1px transparent);--ez-calendar__body--background-color:var(--background--xlight, #FFF);--ez-calendar__time--background-color:var(--background--xlight, #FAFAFA);--ez-calendar__body--padding:var(--space--medium, 12px) var(--space--small, 6px);--ez-calendar__body--border-radius:var(--border--radius-medium, 12px);--ez-calendar__body--shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-container--z-index:var(--more-visible, 2);--ez-calendar__header-line--stroke:1px;--ez-calendar__header-line--color:var(--color--strokes, #C0C0C0);--ez-calendar__nav-btn--fill:var(--text--primary, #008561);--ez-calendar__nav-btn--hover--fill:var(--color--primary, #350404);--ez-calendar__nav-btn--width:10px;--ez-calendar__nav-btn--height:16px;--ez-calendar__nav-btn--previous-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"10px\"><path d=\"M 9.7808475,13.860393 3.9204526,8.0000004 9.7808475,2.0624965 7.9301965,0.28895552 0.21915255,8.0000004 7.9301965,15.711044 Z\"/></svg>');--ez-calendar__nav-btn--next-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"10px\"><path d=\"M 0.21915251,13.860393 6.0795475,8.0000007 0.21915251,2.0624968 2.0698036,0.28895588 9.7808475,8.0000007 2.0698036,15.711044 Z\"/></svg>');--ez-calendar__cell--margin:0px 1.5px;--ez-calendar__cell--width:var(--space--large, 24px);--ez-calendar__cell--padding:1.5px 0px;--ez-calendar__cell--border-radius:var(--border--radius-small, 6px);--ez-calendar__cell--over--background-color:var(--color--primary, #E2F4EF);--ez-calendar__cell--over--color:var(--color--primary-300, #008561);--ez-calendar__cell--outset--color:var(--color--disable-primary, #E5EAF0);--ez-calendar__cell--selected--background-color:var(--color--primary, #008561);--ez-calendar__cell--selected--color:var(--color--inverted, #FFF);--ez-calendar__btn-today--color:var(--color--primary);--ez-calendar__btn-today--hover--background-color:var(--color--primary-300, #E2F4EF);--ez-calendar__btn-today--border-radius:var(--border--radius-small, 6px);position:relative;display:flex;user-select:none}.calendar__container{display:flex;z-index:var(--more-visible, 2)}.calendar{z-index:var(--more-visible, 2);display:flex;flex-direction:column;background-color:var(--ez-calendar__body--background-color);padding:var(--ez-calendar__body--padding);border-radius:var(--ez-calendar__body--border-radius);box-shadow:var(--ez-calendar__body--shadow)}.calendar__header{display:flex;justify-content:space-between;padding-bottom:var(--space--small, 6px);margin:0px var(--space--, 12px) var(--space--small, 6px) var(--space--, 12px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);border-bottom:solid var(--ez-calendar__header-line--stroke) var(--ez-calendar__header-line--color)}.calendar__btn-next,.calendar__btn-previous{outline:none;border:none;background-color:unset;cursor:pointer;padding:0px}.calendar__btn-next::after,.calendar__btn-previous::after{content:'';display:flex;background-color:var(--ez-calendar__nav-btn--fill);width:var(--ez-calendar__nav-btn--width);height:var(--ez-calendar__nav-btn--height)}.calendar__btn-previous::after{-webkit-mask-image:var(--ez-calendar__nav-btn--previous-image);mask-image:var(--ez-calendar__nav-btn--previous-image)}.calendar__btn-next::after{-webkit-mask-image:var(--ez-calendar__nav-btn--next-image);mask-image:var(--ez-calendar__nav-btn--next-image)}.calendar__btn-next:hover::after,.calendar__btn-previous:hover::after{background-color:var(--ez-calendar__nav-btn--hover--fill)}.calendar__lbl-month{font-weight:var(--text-weight--extra-large, 700);font-size:var(--title--small, 14px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.calendar__line{display:flex;padding:0px;margin:0px}.calendar__cell{display:flex;justify-content:center;align-content:center;cursor:pointer;font-size:var(--text--extra-small, 10px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);padding:var(--ez-calendar__cell--padding);margin:var(--ez-calendar__cell--margin);min-width:var(--ez-calendar__cell--width);border-radius:var(--ez-calendar__cell--border-radius)}.calendar__cell:hover{background-color:var(--ez-calendar__cell--over--background-color);color:var(--ez-calendar__cell--over--color)}.calendar__cell--secondary{color:var(--ez-calendar__cell--outset--color)}.calendar__cell--unselectable:hover{background-color:unset;border-radius:unset;cursor:unset}.calendar__cell--unselectable{font-weight:var(--text-weight--large, 600);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.calendar__cell--selected,.calendar__cell--selected:hover{background-color:var(--ez-calendar__cell--selected--background-color);color:var(--ez-calendar__cell--selected--color)}.calendar__footer{display:flex;flex-direction:column}.calendar__btn-today{border:none;background-color:unset;cursor:pointer;font-weight:var(--text-weight--large, 600);font-size:var(--title--extra-small, 12px);padding:0px;font-family:var(--ez-calendar--font-family);text-shadow:var(--ez-calendar--text-shadow);color:var(--ez-calendar__btn-today--color);border-radius:var(--ez-calendar__btn-today--border-radius)}.calendar__btn-today:hover{background-color:var(--ez-calendar__btn-today--hover--background-color)}section{display:flex}.calendar-time{margin-left:-10px;display:flex;flex-direction:column;padding:12px 0px 0px 10px;background-color:var(--ez-calendar__time--background-color);border-top-right-radius:var(--ez-calendar__body--border-radius);border-bottom-right-radius:var(--ez-calendar__body--border-radius);box-shadow:var(--ez-calendar__body--shadow)}.calendar__column{height:136px;padding:0px;margin:0px;overflow:auto}.calendar__column::-webkit-scrollbar{width:0px;max-width:0px;min-width:0px}.calendar-time__header{padding-left:var(--space--small, 6px);padding-right:var(--space--small, 6px);display:flex;justify-content:space-between;padding-bottom:var(--space--small, 6px);margin:0px var(--space--, 12px) var(--space--small, 6px) var(--space--, 12px);font-weight:var(--text-weight--extra-large, 700);font-size:var(--title--small, 14px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);border-bottom:solid var(--ez-calendar__header-line--stroke) var(--ez-calendar__header-line--color);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.separatorTime{color:#A2ABB9;padding:0px 1px;line-height:16px;font-size:17px;font-weight:normal}.endHidden{-webkit-mask-image:linear-gradient(180deg, #000 calc(100% - 48px), transparent 100%)}.calendar__column .calendar__cell{margin:0px;padding:1.5px 1.5px}";
@@ -1959,6 +1959,9 @@ let EzCheck$1 = class extends HTMLElement$1 {
1959
1959
  this.adjustMode();
1960
1960
  }
1961
1961
  changeValue() {
1962
+ if (!this.enabled) {
1963
+ return;
1964
+ }
1962
1965
  this.value = !this.value;
1963
1966
  this.ezChange.emit(this.value);
1964
1967
  }
@@ -2540,7 +2543,7 @@ let EzDateTimeInput$1 = class extends HTMLElement$1 {
2540
2543
  static get style() { return ezDateTimeInputCss; }
2541
2544
  };
2542
2545
 
2543
- const ezDialogCss = ":host{--dialog__container-padding:var(--space--large, 24px);--dialog__btn__close--background-color:var(--title--primary, #2b3a54);--dialog__btn__no--padding-right:var(--space--large, 24px);--dialog__btn__close__image:url('data:image/svg+xml;utf8,<svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" xmlns=\"http://www.w3.org/2000/svg%22%3E<path d=\"M 7.0060773,5.995511 11.461972,1.5397722 c 0.132856,-0.1328413 0.207547,-0.3130253 0.207547,-0.5009046 0,-0.18786999 -0.07469,-0.3680541 -0.207547,-0.5009048 -0.132857,-0.13284126 -0.31302,-0.20748126 -0.500927,-0.20748126 -0.187812,0 -0.36807,0.07464 -0.500926,0.20748126 L 6.0042244,4.9937015 1.5482921,0.5379628 C 1.4154357,0.40512154 1.2352533,0.33048154 1.0473657,0.33048154 c -0.18787813,0 -0.36807,0.07464 -0.50092647,0.20748126 -0.13285646,0.1328507 -0.20749026,0.31303481 -0.20749026,0.5009048 0,0.1878793 0.0746338,0.3680633 0.20749026,0.5009046 L 5.0023715,5.995511 0.54643923,10.452213 c -0.0676086,0.06534 -0.12151598,0.14352 -0.15859681,0.229916 -0.0370714,0.08639 -0.0565645,0.1794 -0.0573369,0.27335 -7.724e-4,0.09404 0.0171873,0.187331 0.0528423,0.274293 0.0356455,0.08705 0.0882688,0.166087 0.15479148,0.23256 0.0665321,0.06648 0.14562277,0.11897 0.2326735,0.154567 0.0870507,0.0356 0.18031463,0.05344 0.2743433,0.05259 0.094029,-8.5e-4 0.1869528,-0.02049 0.2733331,-0.0576 0.08639,-0.0372 0.1645078,-0.09121 0.2298029,-0.158817 L 6.0042244,6.9973204 10.460119,11.453078 c 0.132856,0.132851 0.313114,0.207444 0.500926,0.207444 0.187907,0 0.36807,-0.07459 0.500927,-0.207444 0.132856,-0.13285 0.207547,-0.313006 0.207547,-0.500904 0,-0.187898 -0.07469,-0.368054 -0.207547,-0.500905 z\"/></svg>');--dialog__title--font-pattern:var(--font-pattern, \"'Sora', 'Algerian'\");--dialog__title--padding-left:var(--space--small, 6px);--dialog__title__container--padding-bottom:var(--space--medium, 12px);--dialog__title--weight--large:var(--text-weight--large, 600);--dialog__body--font-pattern:var(--font-pattern, \"'Sora', 'Algerian'\");--dialog__body--text-shadow:var(--text-shadow, \"0 0 0 #353535, 0 0 1px transparent\");--dialog__body--text-weight--medium:var(--text-weight--medium, 400);--dialog__body--padding-bottom:var(--space--large, 24px);--dialog__body--font-size:var(--text--medium, 14px);--dialog__body--color:var(--text--primary, #626e82);--dialog__icon--color:var(--text--inverted, #fff);--dialog__critical--background-color:var(--color--alert-error-800, #BD0025);--dialog__warning--background-color:var(--color--alert-warning-500, #EFB103);--dialog-z-index:var(--most-visible, 3);--dialog--warning__image:url('data: image/svg+xml;utf8,<svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M 7.5,0 0,13 h 15 z m 0,2.73684 5.1341,8.89476 H 2.36591 Z M 6.81818,5.47368 V 8.21053 H 8.18182 V 5.47368 Z m 0,4.10527 V 10.9474 H 8.18182 V 9.57895\"/></svg>');--dialog--critical__image:url('data: image/svg+xml;utf8,<svg width=\"13\" height=\"13\" viewBox=\"0 0 13 13\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M 7.6534493,6.4948538 12.762051,1.3864299 C 12.914368,1.2341297 13,1.027552 13,0.81215179 13,0.59676225 12.914369,0.39018443 12.762051,0.23787352 12.609733,0.08557341 12.40318,0 12.187747,0 11.972425,0 11.765762,0.08557341 11.613445,0.23787352 L 6.5048431,5.3462975 1.3961977,0.23787352 C 1.2438802,0.08557341 1.0373043,0 0.82189458,0 0.60649572,0 0.39990901,0.08557341 0.24759147,0.23787352 0.09527396,0.39018443 0.00970766,0.59676225 0.00970766,0.81215179 c 0,0.21540021 0.0855663,0.42197791 0.23788381,0.57427811 L 5.3562369,6.4948538 0.24759147,11.604381 c -0.0775121,0.07492 -0.13931586,0.164543 -0.18182835,0.263595 -0.04250169,0.09905 -0.064850182,0.205678 -0.0657357237,0.313391 -8.8554258e-4,0.107813 0.0197049337,0.214771 0.0605827337,0.314472 0.04086693,0.0998 0.10119858,0.190415 0.17746563,0.266625 0.0762779,0.07622 0.16695386,0.136398 0.26675594,0.177208 0.099802,0.04082 0.20672745,0.06127 0.31452961,0.06029 0.1078025,-9.53e-4 0.21433799,-0.0235 0.31337139,-0.06604 0.099045,-0.04265 0.1886052,-0.104571 0.263465,-0.182081 L 6.5048431,7.6434102 11.613445,12.751855 c 0.152317,0.152312 0.35898,0.237831 0.574302,0.237831 0.215433,0 0.421986,-0.08552 0.574304,-0.237831 C 12.914368,12.599545 13,12.393 13,12.177578 13,11.962157 12.91437,11.75561 12.762051,11.603299 Z\"/></svg>')}h2{margin-block-start:0;margin-block-end:0;margin-inline-start:0px;margin-inline-end:0px}.overlay{position:fixed;display:flex;top:0px;z-index:var(--dialog-z-index);left:0px;width:100%;box-sizing:border-box;height:100vh;backdrop-filter:blur(4px);background:rgba(0, 4, 12, 0.4)}.dialog{display:flex;width:80%;position:absolute;top:50%;left:50%;margin-right:-50%;box-sizing:border-box;transform:translate(-50%, -50%);box-shadow:0px 0px 16px rgba(0, 38, 111, 0.122)}@media screen and (min-width: 768px){.dialog{width:50%}}@media screen and (min-width: 992px){.dialog{width:33.33333%}}.dialog__container{width:100%;background:#FFFF;border-radius:0px 6px 6px 0px;box-sizing:border-box;padding:var(--dialog__container-padding)}.dialog__critical--indicator{box-sizing:border-box;width:12px;border-radius:6px 0px 0px 6px;background-color:var(--dialog__critical--background-color)}.dialog__warning--indicator{width:12px;border-radius:6px 0px 0px 6px;box-sizing:border-box;background-color:var(--dialog__warning--background-color)}.message{font-size:var(--dialog__body--font-size);font-weight:var(--dialog__body--text-weight--medium);font-family:var(--dialog__body--font-pattern);text-shadow:var(--dialog__body--text-shadow);padding-bottom:var(--dialog__body--padding-bottom);color:var(--dialog__body--color);max-height:30vh;content-visibility:auto;margin-bottom:24px;overflow-y:auto}.changeable__icon{background:var(--dialog__warning--background-color);color:var(--dialog__icon--color);display:grid;place-items:center;width:26px;height:26px;border-radius:50%}.changeable__icon.critical{background:var(--dialog__critical--background-color)}.title{display:flex;font-family:var(--dialog__title--font-pattern);margin:0;font-weight:var(--dialog__title--weight--large);line-height:1.3}.title__container{display:flex;padding-bottom:var(--dialog__title__container--padding-bottom)}.title__box{display:flex;width:100%;align-items:center;align-self:center}.title--label{padding-left:var(--dialog__title--padding-left)}.title-icon{outline:none;border:none;background-color:var(--dialog__warning--background-color);width:26px;height:26px;border-radius:100%;padding:0;display:flex;justify-content:center;align-items:center}.title-icon--critical{background-color:var(--dialog__critical--background-color)}.btn-close{justify-content:flex-end;align-self:flex-start;align-items:flex-start;display:flex;outline:none;width:10%;border:none;background-color:unset;cursor:pointer}.btn-close::after{content:'';display:flex;background-color:var(--dialog__btn__close--background-color);width:12px;height:12px;-webkit-mask-image:var(--dialog__btn__close__image);mask-image:var(--dialog__btn__close__image)}.title-icon::after{content:'';display:flex;background-color:#FFFF;width:15px;height:15px;-webkit-mask-image:var(--dialog--warning__image);mask-image:var(--dialog--warning__image)}.title-icon--critical::after{content:'';display:flex;background-color:#FFFF;width:13px;height:13px;-webkit-mask-image:var(--dialog--critical__image);mask-image:var(--dialog--critical__image)}.button-yes-no__container{display:flex;box-sizing:border-box;align-self:center;align-items:center;justify-content:flex-end}.button__no{padding-right:var(--dialog__btn__no--padding-right)}.button__ok--container{display:flex;justify-content:flex-end}.row{width:100%;display:flex;flex-wrap:wrap}.col{display:flex;flex-wrap:wrap;align-self:flex-start;box-sizing:border-box}.col--stretch{align-self:stretch}.col--undefined{width:unset}.col--nowrap{flex-wrap:nowrap}@media screen and (min-width: 320px){.col--sd-1{width:8.33333%}.col--sd-2{width:16.66667%}.col--sd-3{width:25%}.col--sd-4{width:33.33333%}.col--sd-5{width:41.66667%}.col--sd-6{width:50%}.col--sd-7{width:58.33333%}.col--sd-8{width:66.66667%}.col--sd-9{width:75%}.col--sd-10{width:83.33333%}.col--sd-11{width:91.66667%}.col--sd-12{width:100%}}@media screen and (min-width: 480px){.col--pn-1{width:8.33333%}.col--pn-2{width:16.66667%}.col--pn-3{width:25%}.col--pn-4{width:33.33333%}.col--pn-5{width:41.66667%}.col--pn-6{width:50%}.col--pn-7{width:58.33333%}.col--pn-8{width:66.66667%}.col--pn-9{width:75%}.col--pn-10{width:83.33333%}.col--pn-11{width:91.66667%}.col--pn-12{width:100%}}@media screen and (min-width: 768px){.col--tb-1{width:8.33333%}.col--tb-2{width:16.66667%}.col--tb-3{width:25%}.col--tb-4{width:33.33333%}.col--tb-5{width:41.66667%}.col--tb-6{width:50%}.col--tb-7{width:58.33333%}.col--tb-8{width:66.66667%}.col--tb-9{width:75%}.col--tb-10{width:83.33333%}.col--tb-11{width:91.66667%}.col--tb-12{width:100%}}@media screen and (min-width: 992px){.col--md-1{width:8.33333%}.col--md-2{width:16.66667%}.col--md-3{width:25%}.col--md-4{width:33.33333%}.col--md-5{width:41.66667%}.col--md-6{width:50%}.col--md-7{width:58.33333%}.col--md-8{width:66.66667%}.col--md-9{width:75%}.col--md-10{width:83.33333%}.col--md-11{width:91.66667%}.col--md-12{width:100%}}@media screen and (min-width: 1200px){.col--ld-1{width:8.33333%}.col--ld-2{width:16.66667%}.col--ld-3{width:25%}.col--ld-4{width:33.33333%}.col--ld-5{width:41.66667%}.col--ld-6{width:50%}.col--ld-7{width:58.33333%}.col--ld-8{width:66.66667%}.col--ld-9{width:75%}.col--ld-10{width:83.33333%}.col--ld-11{width:91.66667%}.col--ld-12{width:100%}}";
2546
+ const ezDialogCss = ":host{--dialog__container-padding:var(--space--large, 24px);--dialog__btn__close--background-color:var(--title--primary, #2b3a54);--dialog__btn__no--padding-right:var(--space--large, 24px);--dialog__btn__close__image:url('data:image/svg+xml;utf8,<svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" xmlns=\"http://www.w3.org/2000/svg%22%3E<path d=\"M 7.0060773,5.995511 11.461972,1.5397722 c 0.132856,-0.1328413 0.207547,-0.3130253 0.207547,-0.5009046 0,-0.18786999 -0.07469,-0.3680541 -0.207547,-0.5009048 -0.132857,-0.13284126 -0.31302,-0.20748126 -0.500927,-0.20748126 -0.187812,0 -0.36807,0.07464 -0.500926,0.20748126 L 6.0042244,4.9937015 1.5482921,0.5379628 C 1.4154357,0.40512154 1.2352533,0.33048154 1.0473657,0.33048154 c -0.18787813,0 -0.36807,0.07464 -0.50092647,0.20748126 -0.13285646,0.1328507 -0.20749026,0.31303481 -0.20749026,0.5009048 0,0.1878793 0.0746338,0.3680633 0.20749026,0.5009046 L 5.0023715,5.995511 0.54643923,10.452213 c -0.0676086,0.06534 -0.12151598,0.14352 -0.15859681,0.229916 -0.0370714,0.08639 -0.0565645,0.1794 -0.0573369,0.27335 -7.724e-4,0.09404 0.0171873,0.187331 0.0528423,0.274293 0.0356455,0.08705 0.0882688,0.166087 0.15479148,0.23256 0.0665321,0.06648 0.14562277,0.11897 0.2326735,0.154567 0.0870507,0.0356 0.18031463,0.05344 0.2743433,0.05259 0.094029,-8.5e-4 0.1869528,-0.02049 0.2733331,-0.0576 0.08639,-0.0372 0.1645078,-0.09121 0.2298029,-0.158817 L 6.0042244,6.9973204 10.460119,11.453078 c 0.132856,0.132851 0.313114,0.207444 0.500926,0.207444 0.187907,0 0.36807,-0.07459 0.500927,-0.207444 0.132856,-0.13285 0.207547,-0.313006 0.207547,-0.500904 0,-0.187898 -0.07469,-0.368054 -0.207547,-0.500905 z\"/></svg>');--dialog__title--font-pattern:var(--font-pattern, \"'Sora', 'Algerian'\");--dialog__title--padding-left:var(--space--small, 6px);--dialog__title__container--padding-bottom:var(--space--medium, 12px);--dialog__title--weight--large:var(--text-weight--large, 600);--dialog__body--font-pattern:var(--font-pattern, \"'Sora', 'Algerian'\");--dialog__body--text-shadow:var(--text-shadow, \"0 0 0 #353535, 0 0 1px transparent\");--dialog__body--text-weight--medium:var(--text-weight--medium, 400);--dialog__body--padding-bottom:var(--space--large, 24px);--dialog__body--font-size:var(--text--medium, 14px);--dialog__body--color:var(--text--primary, #626e82);--dialog__icon--color:var(--text--inverted, #fff);--dialog__critical--background-color:var(--color--alert-error-800, #BD0025);--dialog__warning--background-color:var(--color--alert-warning-500, #EFB103);--dialog-z-index:var(--most-visible, 3);--dialog--warning__image:url('data: image/svg+xml;utf8,<svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M 7.5,0 0,13 h 15 z m 0,2.73684 5.1341,8.89476 H 2.36591 Z M 6.81818,5.47368 V 8.21053 H 8.18182 V 5.47368 Z m 0,4.10527 V 10.9474 H 8.18182 V 9.57895\"/></svg>');--dialog--critical__image:url('data: image/svg+xml;utf8,<svg width=\"13\" height=\"13\" viewBox=\"0 0 13 13\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M 7.6534493,6.4948538 12.762051,1.3864299 C 12.914368,1.2341297 13,1.027552 13,0.81215179 13,0.59676225 12.914369,0.39018443 12.762051,0.23787352 12.609733,0.08557341 12.40318,0 12.187747,0 11.972425,0 11.765762,0.08557341 11.613445,0.23787352 L 6.5048431,5.3462975 1.3961977,0.23787352 C 1.2438802,0.08557341 1.0373043,0 0.82189458,0 0.60649572,0 0.39990901,0.08557341 0.24759147,0.23787352 0.09527396,0.39018443 0.00970766,0.59676225 0.00970766,0.81215179 c 0,0.21540021 0.0855663,0.42197791 0.23788381,0.57427811 L 5.3562369,6.4948538 0.24759147,11.604381 c -0.0775121,0.07492 -0.13931586,0.164543 -0.18182835,0.263595 -0.04250169,0.09905 -0.064850182,0.205678 -0.0657357237,0.313391 -8.8554258e-4,0.107813 0.0197049337,0.214771 0.0605827337,0.314472 0.04086693,0.0998 0.10119858,0.190415 0.17746563,0.266625 0.0762779,0.07622 0.16695386,0.136398 0.26675594,0.177208 0.099802,0.04082 0.20672745,0.06127 0.31452961,0.06029 0.1078025,-9.53e-4 0.21433799,-0.0235 0.31337139,-0.06604 0.099045,-0.04265 0.1886052,-0.104571 0.263465,-0.182081 L 6.5048431,7.6434102 11.613445,12.751855 c 0.152317,0.152312 0.35898,0.237831 0.574302,0.237831 0.215433,0 0.421986,-0.08552 0.574304,-0.237831 C 12.914368,12.599545 13,12.393 13,12.177578 13,11.962157 12.91437,11.75561 12.762051,11.603299 Z\"/></svg>')}h2{margin-block-start:0;margin-block-end:0;margin-inline-start:0px;margin-inline-end:0px}.overlay{position:fixed;display:flex;top:0px;z-index:var(--dialog-z-index);left:0px;width:100%;box-sizing:border-box;height:100vh;backdrop-filter:blur(4px);background:rgba(0, 4, 12, 0.4)}.dialog{display:flex;width:80%;position:absolute;top:50%;left:50%;margin-right:-50%;box-sizing:border-box;transform:translate(-50%, -50%);box-shadow:0px 0px 16px rgba(0, 38, 111, 0.122)}@media screen and (min-width: 768px){.dialog{width:50%}}@media screen and (min-width: 992px){.dialog{width:33.33333%}}.dialog__container{width:100%;background:#FFFF;border-radius:0px 6px 6px 0px;box-sizing:border-box;padding:var(--dialog__container-padding)}.dialog__critical--indicator{box-sizing:border-box;width:12px;border-radius:6px 0px 0px 6px;background-color:var(--dialog__critical--background-color)}.dialog__warning--indicator{width:12px;border-radius:6px 0px 0px 6px;box-sizing:border-box;background-color:var(--dialog__warning--background-color)}.message{font-size:var(--dialog__body--font-size);font-weight:var(--dialog__body--text-weight--medium);font-family:var(--dialog__body--font-pattern);text-shadow:var(--dialog__body--text-shadow);padding-bottom:var(--dialog__body--padding-bottom);color:var(--dialog__body--color);max-height:30vh;content-visibility:auto;margin-bottom:24px;overflow-y:auto}.changeable__icon{background:var(--dialog__warning--background-color);--ez-icon--color:var(--dialog__icon--color);display:grid;place-items:center;width:26px;height:26px;border-radius:50%}.changeable__icon.critical{background:var(--dialog__critical--background-color)}.title{display:flex;font-family:var(--dialog__title--font-pattern);margin:0;font-weight:var(--dialog__title--weight--large);line-height:1.3}.title__container{display:flex;padding-bottom:var(--dialog__title__container--padding-bottom)}.title__box{display:flex;width:100%;align-items:center;align-self:center}.title--label{padding-left:var(--dialog__title--padding-left)}.title-icon{outline:none;border:none;background-color:var(--dialog__warning--background-color);width:26px;height:26px;border-radius:100%;padding:0;display:flex;justify-content:center;align-items:center}.title-icon--critical{background-color:var(--dialog__critical--background-color)}.btn-close{justify-content:flex-end;align-self:flex-start;align-items:flex-start;display:flex;outline:none;width:10%;border:none;background-color:unset;cursor:pointer}.btn-close::after{content:'';display:flex;background-color:var(--dialog__btn__close--background-color);width:12px;height:12px;-webkit-mask-image:var(--dialog__btn__close__image);mask-image:var(--dialog__btn__close__image)}.title-icon::after{content:'';display:flex;background-color:#FFFF;width:15px;height:15px;-webkit-mask-image:var(--dialog--warning__image);mask-image:var(--dialog--warning__image)}.title-icon--critical::after{content:'';display:flex;background-color:#FFFF;width:13px;height:13px;-webkit-mask-image:var(--dialog--critical__image);mask-image:var(--dialog--critical__image)}.button-yes-no__container{display:flex;box-sizing:border-box;align-self:center;align-items:center;justify-content:flex-end}.button__no{padding-right:var(--dialog__btn__no--padding-right)}.button__ok--container{display:flex;justify-content:flex-end}.row{width:100%;display:flex;flex-wrap:wrap}.col{display:flex;flex-wrap:wrap;align-self:flex-start;box-sizing:border-box}.col--stretch{align-self:stretch}.col--undefined{width:unset}.col--nowrap{flex-wrap:nowrap}@media screen and (min-width: 320px){.col--sd-1{width:8.33333%}.col--sd-2{width:16.66667%}.col--sd-3{width:25%}.col--sd-4{width:33.33333%}.col--sd-5{width:41.66667%}.col--sd-6{width:50%}.col--sd-7{width:58.33333%}.col--sd-8{width:66.66667%}.col--sd-9{width:75%}.col--sd-10{width:83.33333%}.col--sd-11{width:91.66667%}.col--sd-12{width:100%}}@media screen and (min-width: 480px){.col--pn-1{width:8.33333%}.col--pn-2{width:16.66667%}.col--pn-3{width:25%}.col--pn-4{width:33.33333%}.col--pn-5{width:41.66667%}.col--pn-6{width:50%}.col--pn-7{width:58.33333%}.col--pn-8{width:66.66667%}.col--pn-9{width:75%}.col--pn-10{width:83.33333%}.col--pn-11{width:91.66667%}.col--pn-12{width:100%}}@media screen and (min-width: 768px){.col--tb-1{width:8.33333%}.col--tb-2{width:16.66667%}.col--tb-3{width:25%}.col--tb-4{width:33.33333%}.col--tb-5{width:41.66667%}.col--tb-6{width:50%}.col--tb-7{width:58.33333%}.col--tb-8{width:66.66667%}.col--tb-9{width:75%}.col--tb-10{width:83.33333%}.col--tb-11{width:91.66667%}.col--tb-12{width:100%}}@media screen and (min-width: 992px){.col--md-1{width:8.33333%}.col--md-2{width:16.66667%}.col--md-3{width:25%}.col--md-4{width:33.33333%}.col--md-5{width:41.66667%}.col--md-6{width:50%}.col--md-7{width:58.33333%}.col--md-8{width:66.66667%}.col--md-9{width:75%}.col--md-10{width:83.33333%}.col--md-11{width:91.66667%}.col--md-12{width:100%}}@media screen and (min-width: 1200px){.col--ld-1{width:8.33333%}.col--ld-2{width:16.66667%}.col--ld-3{width:25%}.col--ld-4{width:33.33333%}.col--ld-5{width:41.66667%}.col--ld-6{width:50%}.col--ld-7{width:58.33333%}.col--ld-8{width:66.66667%}.col--ld-9{width:75%}.col--ld-10{width:83.33333%}.col--ld-11{width:91.66667%}.col--ld-12{width:100%}}";
2544
2547
 
2545
2548
  class Message {
2546
2549
  constructor(title, message, critical, confirm, icon, callBack) {
@@ -2625,12 +2628,12 @@ let EzDialog$1 = class extends HTMLElement$1 {
2625
2628
  };
2626
2629
 
2627
2630
  const buildTextArea = ({ name, label, readOnly }) => {
2628
- return (h("div", { class: "col col--sd-12 padding--small", key: name },
2631
+ return (h("div", { class: "col col--sd-12 padding-horizontal--small", key: name },
2629
2632
  h("ez-text-area", { enabled: !readOnly, label: label, "data-field-name": name })));
2630
2633
  };
2631
2634
 
2632
2635
  const buildTextInput = ({ name, label }) => {
2633
- return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
2636
+ return (h("div", { class: "col col--sd-12 col--tb-3 padding-horizontal--small" },
2634
2637
  h("ez-text-input", { label: label, "data-field-name": name, key: name })));
2635
2638
  };
2636
2639
 
@@ -2641,7 +2644,7 @@ const buildCheckBox = (fieldConfig) => {
2641
2644
  return buildField$1(fieldConfig.name, fieldConfig.label, fieldConfig.readOnly, false);
2642
2645
  };
2643
2646
  function buildField$1(fieldName, fieldLabel, readOnly, switchMode = false) {
2644
- return (h("div", { class: "col col--sd-12 col--tb-3 padding--small align--middle padding-bottom--large" },
2647
+ return (h("div", { class: "col col--sd-12 col--tb-3 align--middle padding-horizontal--small padding-bottom--large" },
2645
2648
  h("ez-check", { enabled: !readOnly, label: fieldLabel, mode: switchMode ? "switch" : "regular", "data-field-name": fieldName, key: fieldName })));
2646
2649
  }
2647
2650
 
@@ -2655,30 +2658,30 @@ const buildComboBox = ({ name, label, readOnly }, properties) => {
2655
2658
  else {
2656
2659
  options = prop;
2657
2660
  }
2658
- return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
2661
+ return (h("div", { class: "col col--sd-12 col--tb-3 padding-horizontal--small" },
2659
2662
  h("ez-combo-box", { enabled: !readOnly, label: label, "data-field-name": name, key: name, options: options })));
2660
2663
  };
2661
2664
 
2662
2665
  const buildSearch = ({ name, label, readOnly }) => {
2663
- return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
2666
+ return (h("div", { class: "col col--sd-12 col--tb-3 padding-horizontal--small" },
2664
2667
  h("ez-search", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
2665
2668
  };
2666
2669
 
2667
2670
  const buildFile = ({ name, label, readOnly }) => {
2668
- return (h("div", { class: "col col--sd-12 padding--small" },
2671
+ return (h("div", { class: "col col--sd-12 padding-horizontal--small" },
2669
2672
  h("ez-upload", { enabled: !readOnly, label: label, urlUpload: "", requestHeaders: "", maxFiles: 10, "data-field-name": name, key: name })));
2670
2673
  };
2671
2674
 
2672
2675
  const buildDate = ({ name, label, readOnly }) => {
2673
- return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
2676
+ return (h("div", { class: "col col--sd-12 col--tb-3 padding-horizontal--small" },
2674
2677
  h("ez-date-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
2675
2678
  };
2676
2679
  const buildTime = ({ name, label }) => {
2677
- return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
2680
+ return (h("div", { class: "col col--sd-12 col--tb-3 padding-horizontal--small" },
2678
2681
  h("ez-time-input", { label: label, "data-field-name": name, key: name })));
2679
2682
  };
2680
2683
  const buildTimeDate = ({ name, label }) => {
2681
- return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
2684
+ return (h("div", { class: "col col--sd-12 col--tb-3 padding-horizontal--small" },
2682
2685
  h("ez-date-time-input", { label: label, "data-field-name": name, key: name })));
2683
2686
  };
2684
2687
 
@@ -2691,7 +2694,7 @@ const buildInteger = ({ name, label, readOnly }) => {
2691
2694
  return buildNumeric(name, label, readOnly, 0, 0);
2692
2695
  };
2693
2696
  function buildNumeric(fieldName, fieldLabel, readOnly, precision, prettyPrecision) {
2694
- return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
2697
+ return (h("div", { class: "col col--sd-12 col--tb-3 padding-horizontal--small" },
2695
2698
  h("ez-number-input", { enabled: !readOnly, label: fieldLabel, precision: precision, prettyPrecision: prettyPrecision, "data-field-name": fieldName, key: fieldName })));
2696
2699
  }
2697
2700
 
@@ -2748,7 +2751,8 @@ const FormItem = ({ source }) => {
2748
2751
  };
2749
2752
 
2750
2753
  const FormSheet = ({ store, source }) => {
2751
- return (h("div", { class: "box__container" }, source.items.map(item => h(FormItem, { store: store, source: item }))));
2754
+ return (h("div", { class: "box__container" },
2755
+ h("div", { class: "row padding-vertical--small" }, source.items.map(item => h(FormItem, { store: store, source: item })))));
2752
2756
  };
2753
2757
 
2754
2758
  class FormMetadata {
@@ -3297,17 +3301,21 @@ class ApplicationUtils {
3297
3301
  static async confirm(title, message, icon = null, critical = false) {
3298
3302
  return ApplicationUtils.showDialog(title, message, icon, true, critical);
3299
3303
  }
3300
- static async info(message) {
3304
+ static async info(message, options = ApplicationUtils.defaultMessageOptions) {
3301
3305
  let toast = document.querySelector("ez-toast");
3302
3306
  if (!toast) {
3303
3307
  toast = document.createElement("ez-toast");
3304
3308
  window.document.body.appendChild(toast);
3305
3309
  }
3310
+ toast.canClose = options.canClose;
3306
3311
  toast.message = message;
3307
3312
  toast.fadeTime = 4000;
3308
3313
  toast.show();
3309
3314
  }
3310
3315
  }
3316
+ ApplicationUtils.defaultMessageOptions = {
3317
+ canClose: true
3318
+ };
3311
3319
 
3312
3320
  const ezFormCss = "ez-form{display:flex;flex-direction:column;width:100%}";
3313
3321
 
@@ -3339,6 +3347,9 @@ let EzForm$1 = class extends HTMLElement$1 {
3339
3347
  accept();
3340
3348
  });
3341
3349
  }
3350
+ configChanged() {
3351
+ this.processMetadata();
3352
+ }
3342
3353
  validateRequired(requiredFields, record) {
3343
3354
  const invalidFields = [];
3344
3355
  requiredFields.forEach(field => {
@@ -3423,6 +3434,9 @@ let EzForm$1 = class extends HTMLElement$1 {
3423
3434
  return (h(Host, null, this.isStatic() ? null : this.getDynamicContent()));
3424
3435
  }
3425
3436
  get _element() { return this; }
3437
+ static get watchers() { return {
3438
+ "config": ["configChanged"]
3439
+ }; }
3426
3440
  static get style() { return ezFormCss; }
3427
3441
  };
3428
3442
 
@@ -113513,6 +113527,7 @@ class AgGridController {
113513
113527
  serverSideStoreType: "partial",
113514
113528
  rowSelection: this._multipleSelection ? "multiple" : "single",
113515
113529
  serverSideDatasource: new DataSource(this._dataUnit, this._serverURL),
113530
+ getRowNodeId: (params) => params.__record__id__,
113516
113531
  getMainMenuItems: (params) => {
113517
113532
  const column = params.column;
113518
113533
  const items = [column.isPinned() ? "clearPinned" : "pinLeft", "separator"];
@@ -113521,6 +113536,16 @@ class AgGridController {
113521
113536
  action: () => m.action(column.getColId(), m.name)
113522
113537
  }));
113523
113538
  return items;
113539
+ },
113540
+ onViewportChanged: (evt) => {
113541
+ if (this._gridOptions && this._gridOptions.api && evt && evt.api) {
113542
+ if (this._dataUnit.getSelection()) {
113543
+ this._dataUnit.getSelection().forEach(id => {
113544
+ let node = evt.api.getRowNode(id);
113545
+ node.setSelected(true);
113546
+ });
113547
+ }
113548
+ }
113524
113549
  }
113525
113550
  };
113526
113551
  this.setOptionsEvents(this._gridOptions);
@@ -113691,7 +113716,14 @@ class AgGridController {
113691
113716
  }
113692
113717
  }
113693
113718
  if ((source === null || source === void 0 ? void 0 : source.userInterface) === "SEARCH") {
113694
- return ((_a = params === null || params === void 0 ? void 0 : params.value) === null || _a === void 0 ? void 0 : _a.value) + " - " + ((_b = params === null || params === void 0 ? void 0 : params.value) === null || _b === void 0 ? void 0 : _b.label);
113719
+ if (params.value !== undefined) {
113720
+ return ((_a = params === null || params === void 0 ? void 0 : params.value) === null || _a === void 0 ? void 0 : _a.value) + " - " + ((_b = params === null || params === void 0 ? void 0 : params.value) === null || _b === void 0 ? void 0 : _b.label);
113721
+ }
113722
+ }
113723
+ if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.DATE || (source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.DATETIME) {
113724
+ if (params.value !== undefined) {
113725
+ return params.value.toLocaleDateString();
113726
+ }
113695
113727
  }
113696
113728
  }
113697
113729
  buildColState(source) {
@@ -115077,7 +115109,7 @@ let EzTabselector$1 = class extends HTMLElement$1 {
115077
115109
  static get style() { return ezTabselectorCss; }
115078
115110
  };
115079
115111
 
115080
- const ezTextAreaCss = ":host{--text-area--width:100%;--text-area--border-radius:var(--border--radius-medium, 12px);--text-area--font-size:var(--text--medium, 14px);--text-area--font-family:var(--font-pattern, Arial);--text-area--font-weight:var(--text-weight--large, 500);--text-area--color:var(--title--primary, #000);--text-area__input--background-color:var(--background--medium, #e0e0e0);--text-area__input--border:var(--border--medium, 2px solid);--text-area__input--border-color:var(--text-area__input--background-color);--text-area__input--focus--border-color:var(--color--primary, #008561);--text-area__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--text-area__input--disabled--color:var(--text--disable, #AFB6C0);--text-area__input--error--border-color:#CC2936;--text-area__message_box--font-size:var(--text--small, 12px);--text-area__message_box--info--color:var(--color--success, #22085d);--text-area__message_box--error--color:var(--color--error, #FF0000);--text-area__label--floating--top:6px;--text-area__label--padding-top:12px;--text-area__label--padding-left:14px;--text-area__label--padding-right:12px;display:flex;flex-wrap:wrap;position:relative;width:var(--text-area--width)}textarea{box-sizing:border-box;border:none;resize:none;margin-top:calc(var(--space--medium, 12px) + 4px);width:100%;font-weight:var(--text-weight--large, 600);font-family:var(--text-area--font-family);font-size:var(--text-area--font-size);color:var(--text-area--color);padding:0;background:none}textarea:focus{outline:none}textarea:disabled{background-color:transparent;color:var(--text-area__input--disabled--color)}.textarea{width:100%;box-sizing:border-box;padding-left:var(--space--medium);padding-right:var(--space--extra-small);border-radius:var(--text-area--border-radius);border:var(--text-area__input--border);border-color:var(--text-area__input--border-color);background-color:var(--text-area__input--background-color)}.textarea--focus{border-color:var(--text-area__input--focus--border-color)}.textarea.hasError{color:var(--text-area--color);border-color:var(--text-area__input--error--border-color)}.message-box{min-height:16px;min-width:100%;margin-top:2px;line-height:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--text-area--font-family);font-size:var(--text-area__message_box--font-size);color:var(--text-area__message_box--info--color)}.hasError{color:var(--text-area__message_box--error--color)}.textarea__label{box-sizing:border-box;position:absolute;z-index:var(--visible);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-transition:font-size .05s, top .05s;transition:font-size .05s, top .05s;width:calc(100% - var(--text-area__label--padding-right));left:var(--text-area--space--medium);font-family:var(--text-area--font-family);font-size:var(--text-area--font-size);font-weight:var(--text-area--font-weight);color:var(--text-area--color);top:var(--text-area__label--padding-top);left:var(--text-area__label--padding-left);padding-right:var(--text-area__label--padding-right)}.textarea__label--floated{font-family:var(--text-area--font-family);font-size:var(--text--extra-small);color:var(--text--primary);top:var(--text-area__label--floating--top)}.textarea__label--disabled{color:var(--text-area__input--disabled--color)}";
115112
+ const ezTextAreaCss = ":host{--text-area--width:100%;--text-area--border-radius:var(--border--radius-medium, 12px);--text-area--font-size:var(--text--medium, 14px);--text-area--font-family:var(--font-pattern, Arial);--text-area--font-weight:var(--text-weight--large, 500);--text-area--color:var(--title--primary, #000);--text-area__input--background-color:var(--background--medium, #e0e0e0);--text-area__input--border:var(--border--medium, 2px solid);--text-area__input--border-color:var(--text-area__input--background-color);--text-area__input--focus--border-color:var(--color--primary, #008561);--text-area__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--text-area__input--disabled--color:var(--text--disable, #AFB6C0);--text-area__input--error--border-color:#CC2936;--text-area__message_box--font-size:var(--text--small, 12px);--text-area__message_box--info--color:var(--color--success, #22085d);--text-area__message_box--error--color:var(--color--error, #FF0000);--text-area__label--floating--top:6px;--text-area__label--padding-top:12px;--text-area__label--padding-left:14px;--text-area__label--padding-right:12px;display:flex;flex-wrap:wrap;position:relative;width:var(--text-area--width)}textarea{box-sizing:border-box;border:none;resize:none;margin-top:calc(var(--space--medium, 12px) + 4px);width:100%;font-weight:var(--text-weight--large, 600);font-family:var(--text-area--font-family);font-size:var(--text-area--font-size);color:var(--text-area--color);padding:0;background:none}textarea:focus{outline:none}textarea:disabled{background-color:transparent;color:var(--text-area__input--disabled--color)}.textarea{width:100%;box-sizing:border-box;padding-left:var(--space--medium);padding-right:var(--space--extra-small);border-radius:var(--text-area--border-radius);border:var(--text-area__input--border);border-color:var(--text-area__input--border-color);background-color:var(--text-area__input--background-color)}.textarea--focus{border-color:var(--text-area__input--focus--border-color)}.textarea.hasError{color:var(--text-area--color);border-color:var(--text-area__input--error--border-color)}.message-box{min-height:16px;min-width:100%;margin-top:3px;line-height:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--text-area--font-family);font-size:var(--text-area__message_box--font-size);color:var(--text-area__message_box--info--color)}.hasError{color:var(--text-area__message_box--error--color)}.textarea__label{box-sizing:border-box;position:absolute;z-index:var(--visible);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-transition:font-size .05s, top .05s;transition:font-size .05s, top .05s;width:calc(100% - var(--text-area__label--padding-right));left:var(--text-area--space--medium);font-family:var(--text-area--font-family);font-size:var(--text-area--font-size);font-weight:var(--text-area--font-weight);color:var(--text-area--color);top:var(--text-area__label--padding-top);left:var(--text-area__label--padding-left);padding-right:var(--text-area__label--padding-right)}.textarea__label--floated{font-family:var(--text-area--font-family);font-size:var(--text--extra-small);color:var(--text--primary);top:var(--text-area__label--floating--top)}.textarea__label--disabled{color:var(--text-area__input--disabled--color)}";
115081
115113
 
115082
115114
  let EzTextArea$1 = class extends HTMLElement$1 {
115083
115115
  constructor() {
@@ -115106,7 +115138,7 @@ let EzTextArea$1 = class extends HTMLElement$1 {
115106
115138
  }
115107
115139
  }
115108
115140
  updateInputValue() {
115109
- this._inputElem.value = this.value;
115141
+ this._inputElem.value = this.value === undefined ? "" : this.value;
115110
115142
  this.handleChange();
115111
115143
  this.adjustFloatingLabel();
115112
115144
  this.ezChange.emit(this.value);
@@ -115186,7 +115218,7 @@ let EzTextArea$1 = class extends HTMLElement$1 {
115186
115218
  static get style() { return ezTextAreaCss; }
115187
115219
  };
115188
115220
 
115189
- const ezTextInputCss = ":host{--ez-text-input--height:42px;--ez-text-input--width:100%;--ez-text-input__icon--width:48px;--ez-text-input--border-radius:var(--border--radius-medium, 12px);--ez-text-input--font-size:var(--text--medium, 14px);--ez-text-input--font-family:var(--font-pattern, Arial);--ez-text-input--font-weight:var(--text-weight--medium, 400);--ez-text-input--color:var(--title--primary, #000);--ez-text-input__input--background-color:var(--background--medium, #e0e0e0);--ez-text-input__input--border:var(--border--medium, 2px solid);--ez-text-input__input--border-color:var(--ez-text-input__input--background-color);--ez-text-input__input--focus--border-color:var(--color--primary, #008561);--ez-text-input__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-text-input__input--disabled--color:var(--text--disable, #AFB6C0);--ez-text-input__input--error--border-color:#CC2936;--ez-text-input__message_box--font-size:var(--text--small, 12px);--ez-text-input__message_box--info--color:var(--color--success, #22085d);--ez-text-input__message_box--error--color:var(--color--error, #FF0000);--ez-text-input__label--floating--top:6px;--ez-text-input__label--padding-top:12px;--ez-text-input__label--padding-left:14px;--ez-text-input__label--padding-right:12px;display:flex;flex-wrap:wrap;position:relative;width:var(--ez-text-input--width)}input{width:100%;box-sizing:border-box;padding:var(--space--medium, 6px);font-weight:var(--text-weight--large, 600);height:var(--ez-text-input--height);border-radius:var(--ez-text-input--border-radius);font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);border:var(--ez-text-input__input--border);border-color:var(--ez-text-input__input--border-color);background-color:var(--ez-text-input__input--background-color);color:var(--ez-text-input--color)}input:disabled{background-color:var(--ez-text-input__input--disabled--background-color);color:var(--ez-text-input__input--disabled--color)}input:focus{outline:none;border-color:var(--ez-text-input__input--focus--border-color)}input.icon--left{padding-left:var(--ez-text-input__icon--width)}input.icon--right{padding-right:var(--ez-text-input__icon--width)}input.hasError{color:var(--ez-text-input--color);border-color:var(--ez-text-input__input--error--border-color)}input.text--right{text-align:right}.message-box{display:flex;min-height:16px;min-width:100%;margin-top:2px;line-height:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input__message_box--font-size);color:var(--ez-text-input__message_box--info--color)}.hasError{color:var(--ez-text-input__message_box--error--color)}.input__label{box-sizing:border-box;position:absolute;z-index:var(--visible);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-transition:font-size .05s, top .05s;transition:font-size .05s, top .05s;width:calc(100% - var(--ez-text-input__label--padding-right));left:var(--ez-text-input--space--medium);font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color);top:var(--ez-text-input__label--padding-top);left:var(--ez-text-input__label--padding-left);padding-right:var(--ez-text-input__label--padding-right)}.input__label--floated{font-family:var(--ez-text-input--font-family);font-size:var(--text--extra-small);color:var(--text--primary);top:var(--ez-text-input__label--floating--top)}.input__label--disabled{color:var(--ez-text-input__input--disabled--color)}.input__label--left{text-align:left;left:calc(var(--ez-text-input__icon--width) + 2px);width:calc(100% - var(--ez-text-input__icon--width))}.input__label--right{right:var(--ez-text-input__icon--width);width:calc(100% - var(--ez-text-input__icon--width))}.input__label--left.input__label--right{left:calc(var(--ez-text-input__icon--width) + 2px);width:calc(100% - var(--ez-text-input__icon--width) * 2)}.input--with--label{padding-bottom:0}";
115221
+ const ezTextInputCss = ":host{--ez-text-input--height:42px;--ez-text-input--width:100%;--ez-text-input__icon--width:48px;--ez-text-input--border-radius:var(--border--radius-medium, 12px);--ez-text-input--font-size:var(--text--medium, 14px);--ez-text-input--font-family:var(--font-pattern, Arial);--ez-text-input--font-weight:var(--text-weight--medium, 400);--ez-text-input--color:var(--title--primary, #000);--ez-text-input__input--background-color:var(--background--medium, #e0e0e0);--ez-text-input__input--border:var(--border--medium, 2px solid);--ez-text-input__input--border-color:var(--ez-text-input__input--background-color);--ez-text-input__input--focus--border-color:var(--color--primary, #008561);--ez-text-input__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-text-input__input--disabled--color:var(--text--disable, #AFB6C0);--ez-text-input__input--error--border-color:#CC2936;--ez-text-input__message_box--font-size:var(--text--small, 12px);--ez-text-input__message_box--info--color:var(--color--success, #22085d);--ez-text-input__message_box--error--color:var(--color--error, #FF0000);--ez-text-input__label--floating--top:6px;--ez-text-input__label--padding-top:12px;--ez-text-input__label--padding-left:14px;--ez-text-input__label--padding-right:12px;display:flex;flex-wrap:wrap;position:relative;width:var(--ez-text-input--width)}input{width:100%;box-sizing:border-box;padding:var(--space--medium, 6px);font-weight:var(--text-weight--large, 600);height:var(--ez-text-input--height);border-radius:var(--ez-text-input--border-radius);font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);border:var(--ez-text-input__input--border);border-color:var(--ez-text-input__input--border-color);background-color:var(--ez-text-input__input--background-color);color:var(--ez-text-input--color)}input:disabled{background-color:var(--ez-text-input__input--disabled--background-color);color:var(--ez-text-input__input--disabled--color)}input:focus{outline:none;border-color:var(--ez-text-input__input--focus--border-color)}input.icon--left{padding-left:var(--ez-text-input__icon--width)}input.icon--right{padding-right:var(--ez-text-input__icon--width)}input.hasError{color:var(--ez-text-input--color);border-color:var(--ez-text-input__input--error--border-color)}input.text--right{text-align:right}.message-box{min-height:16px;min-width:100%;margin-top:3px;line-height:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input__message_box--font-size);color:var(--ez-text-input__message_box--info--color)}.hasError{color:var(--ez-text-input__message_box--error--color)}.input__label{box-sizing:border-box;position:absolute;z-index:var(--visible);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-transition:font-size .05s, top .05s;transition:font-size .05s, top .05s;width:calc(100% - var(--ez-text-input__label--padding-right));left:var(--ez-text-input--space--medium);font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color);top:var(--ez-text-input__label--padding-top);left:var(--ez-text-input__label--padding-left);padding-right:var(--ez-text-input__label--padding-right)}.input__label--floated{font-family:var(--ez-text-input--font-family);font-size:var(--text--extra-small);color:var(--text--primary);top:var(--ez-text-input__label--floating--top)}.input__label--disabled{color:var(--ez-text-input__input--disabled--color)}.input__label--left{text-align:left;left:calc(var(--ez-text-input__icon--width) + 2px);width:calc(100% - var(--ez-text-input__icon--width))}.input__label--right{right:var(--ez-text-input__icon--width);width:calc(100% - var(--ez-text-input__icon--width))}.input__label--left.input__label--right{left:calc(var(--ez-text-input__icon--width) + 2px);width:calc(100% - var(--ez-text-input__icon--width) * 2)}.input--with--label{padding-bottom:0}";
115190
115222
 
115191
115223
  let EzTextInput$1 = class extends HTMLElement$1 {
115192
115224
  constructor() {
@@ -115510,7 +115542,7 @@ let EzTimeInput$1 = class extends HTMLElement$1 {
115510
115542
  static get style() { return ezTimeInputCss; }
115511
115543
  };
115512
115544
 
115513
- const ezToastCss = ":host{--ez-toast__btn__close__image:url('data:image/svg+xml;utf8,<svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" xmlns=\"http://www.w3.org/2000/svg%22%3E<path d=\"M 7.0060773,5.995511 11.461972,1.5397722 c 0.132856,-0.1328413 0.207547,-0.3130253 0.207547,-0.5009046 0,-0.18786999 -0.07469,-0.3680541 -0.207547,-0.5009048 -0.132857,-0.13284126 -0.31302,-0.20748126 -0.500927,-0.20748126 -0.187812,0 -0.36807,0.07464 -0.500926,0.20748126 L 6.0042244,4.9937015 1.5482921,0.5379628 C 1.4154357,0.40512154 1.2352533,0.33048154 1.0473657,0.33048154 c -0.18787813,0 -0.36807,0.07464 -0.50092647,0.20748126 -0.13285646,0.1328507 -0.20749026,0.31303481 -0.20749026,0.5009048 0,0.1878793 0.0746338,0.3680633 0.20749026,0.5009046 L 5.0023715,5.995511 0.54643923,10.452213 c -0.0676086,0.06534 -0.12151598,0.14352 -0.15859681,0.229916 -0.0370714,0.08639 -0.0565645,0.1794 -0.0573369,0.27335 -7.724e-4,0.09404 0.0171873,0.187331 0.0528423,0.274293 0.0356455,0.08705 0.0882688,0.166087 0.15479148,0.23256 0.0665321,0.06648 0.14562277,0.11897 0.2326735,0.154567 0.0870507,0.0356 0.18031463,0.05344 0.2743433,0.05259 0.094029,-8.5e-4 0.1869528,-0.02049 0.2733331,-0.0576 0.08639,-0.0372 0.1645078,-0.09121 0.2298029,-0.158817 L 6.0042244,6.9973204 10.460119,11.453078 c 0.132856,0.132851 0.313114,0.207444 0.500926,0.207444 0.187907,0 0.36807,-0.07459 0.500927,-0.207444 0.132856,-0.13285 0.207547,-0.313006 0.207547,-0.500904 0,-0.187898 -0.07469,-0.368054 -0.207547,-0.500905 z\"/></svg>');--ez-toast__container-z-index:var(--more-visible, 2);--ez-toast__container--background-color:var(--color--secondary, #383c45);--ez-toast__icon--padding-left:var(--space--small, 6px)}.toast__container{position:fixed;display:flex;bottom:100px;z-index:var(--ez-toast__container-z-index);left:100px;width:30%;box-sizing:border-box;background-color:var(--ez-toast__container--background-color);border-radius:6px;align-items:center;padding:12px;visibility:hidden}.message__container{font-family:\"Sora\", \"Algerian\";text-shadow:0 0 0 #353535, 0 0 1px transparent;color:#FFFFFF;font-size:14px;width:90%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.message__conteiner--icon{padding-left:var(--ez-toast__icon--padding-left);width:80%}.btn-close{display:flex;justify-content:flex-end;padding:0;outline:none;width:10%;border:none;background-color:unset;cursor:pointer}.btn-close::after{content:'';display:flex;background-color:#FFFFFF;width:12px;height:12px;-webkit-mask-image:var(--ez-toast__btn__close__image);mask-image:var(--ez-toast__btn__close__image)}.toast__container--oppened{animation:fadein 0.5s, fadeout 0.5s 3s;visibility:visible}@-webkit-keyframes fadein{from{left:-100px;opacity:0}to{left:100px;opacity:1}}@keyframes fadein{from{left:-100px;opacity:0}to{left:100px;opacity:1}}@-webkit-keyframes fadeout{from{left:100px;opacity:1}to{bottom:0;opacity:0}}@keyframes fadeout{from{left:100px;opacity:1}to{bottom:0;opacity:0}}";
115545
+ const ezToastCss = ":host{--ez-toast__btn__close__image:url('data:image/svg+xml;utf8,<svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" xmlns=\"http://www.w3.org/2000/svg%22%3E<path d=\"M 7.0060773,5.995511 11.461972,1.5397722 c 0.132856,-0.1328413 0.207547,-0.3130253 0.207547,-0.5009046 0,-0.18786999 -0.07469,-0.3680541 -0.207547,-0.5009048 -0.132857,-0.13284126 -0.31302,-0.20748126 -0.500927,-0.20748126 -0.187812,0 -0.36807,0.07464 -0.500926,0.20748126 L 6.0042244,4.9937015 1.5482921,0.5379628 C 1.4154357,0.40512154 1.2352533,0.33048154 1.0473657,0.33048154 c -0.18787813,0 -0.36807,0.07464 -0.50092647,0.20748126 -0.13285646,0.1328507 -0.20749026,0.31303481 -0.20749026,0.5009048 0,0.1878793 0.0746338,0.3680633 0.20749026,0.5009046 L 5.0023715,5.995511 0.54643923,10.452213 c -0.0676086,0.06534 -0.12151598,0.14352 -0.15859681,0.229916 -0.0370714,0.08639 -0.0565645,0.1794 -0.0573369,0.27335 -7.724e-4,0.09404 0.0171873,0.187331 0.0528423,0.274293 0.0356455,0.08705 0.0882688,0.166087 0.15479148,0.23256 0.0665321,0.06648 0.14562277,0.11897 0.2326735,0.154567 0.0870507,0.0356 0.18031463,0.05344 0.2743433,0.05259 0.094029,-8.5e-4 0.1869528,-0.02049 0.2733331,-0.0576 0.08639,-0.0372 0.1645078,-0.09121 0.2298029,-0.158817 L 6.0042244,6.9973204 10.460119,11.453078 c 0.132856,0.132851 0.313114,0.207444 0.500926,0.207444 0.187907,0 0.36807,-0.07459 0.500927,-0.207444 0.132856,-0.13285 0.207547,-0.313006 0.207547,-0.500904 0,-0.187898 -0.07469,-0.368054 -0.207547,-0.500905 z\"/></svg>');--ez-toast__container-z-index:var(--more-visible, 2);--ez-toast__container--background-color:var(--color--secondary, #383c45);--ez-toast__icon--padding-left:var(--space--small, 6px)}.toast__container{position:fixed;display:flex;bottom:100px;z-index:var(--ez-toast__container-z-index);left:100px;width:280px;box-sizing:border-box;background-color:var(--ez-toast__container--background-color);border-radius:6px;align-items:center;padding:12px;visibility:hidden}.message__container{font-family:\"Sora\", \"Algerian\";text-shadow:0 0 0 #353535, 0 0 1px transparent;color:#FFFFFF;font-size:14px;width:90%;overflow:hidden;word-break:break-all;height:auto;-webkit-box-orient:vertical;-webkit-line-clamp:4;display:-webkit-box;text-overflow:ellipsis}.message__conteiner--icon{padding-left:var(--ez-toast__icon--padding-left);width:80%}.btn-close{margin-top:3px;display:flex;justify-content:flex-end;align-self:flex-start;padding:0;outline:none;width:10%;border:none;background-color:unset;cursor:pointer}.btn-close::after{content:'';display:flex;background-color:#FFFFFF;width:12px;height:12px;-webkit-mask-image:var(--ez-toast__btn__close__image);mask-image:var(--ez-toast__btn__close__image)}.toast__container--oppened{animation:fadein 0.5s, fadeout 0.5s 3s;visibility:visible}@-webkit-keyframes fadein{from{left:-100px;opacity:0}to{left:100px;opacity:1}}@keyframes fadein{from{left:-100px;opacity:0}to{left:100px;opacity:1}}@-webkit-keyframes fadeout{from{left:100px;opacity:1}to{bottom:0;opacity:0}}@keyframes fadeout{from{left:100px;opacity:1}to{bottom:0;opacity:0}}";
115514
115546
 
115515
115547
  let EzToast$1 = class extends HTMLElement$1 {
115516
115548
  constructor() {
@@ -115525,6 +115557,10 @@ let EzToast$1 = class extends HTMLElement$1 {
115525
115557
  * Adiciona ícone de check no componente.
115526
115558
  */
115527
115559
  this.useIcon = false;
115560
+ /**
115561
+ * Controla o uso do icone de fechar o toast.
115562
+ */
115563
+ this.canClose = true;
115528
115564
  }
115529
115565
  /**
115530
115566
  * Exibe o componente na tela.
@@ -115538,9 +115574,9 @@ let EzToast$1 = class extends HTMLElement$1 {
115538
115574
  }, this.fadeTime + 400);
115539
115575
  }
115540
115576
  render() {
115541
- return (h("div", { ref: (el) => this.container = el, class: "toast__container" }, this.useIcon ?
115542
- h("slot", { name: "icon" })
115543
- : undefined, h("div", { class: this.useIcon ? "message__container message__conteiner--icon" : "message__container", title: this.message }, " ", this.message, " "), h("button", { class: "btn-close", onClick: () => { this.container.classList.remove("toast__container--oppened"); this.container.style.animation = `none`; } })));
115577
+ return (h("div", { ref: (el) => this.container = el, class: "toast__container" }, this.useIcon &&
115578
+ h("slot", { name: "icon" }), h("div", { class: this.useIcon ? "message__container message__conteiner--icon" : "message__container", title: this.message, innerHTML: this.message }), this.canClose &&
115579
+ h("button", { class: "btn-close", onClick: () => { this.container.classList.remove("toast__container--oppened"); this.container.style.animation = `none`; } })));
115544
115580
  }
115545
115581
  static get style() { return ezToastCss; }
115546
115582
  };
@@ -116254,7 +116290,7 @@ const EzTabselector = /*@__PURE__*/proxyCustomElement(EzTabselector$1, [1,"ez-ta
116254
116290
  const EzTextArea = /*@__PURE__*/proxyCustomElement(EzTextArea$1, [1,"ez-text-area",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"rows":[1538]}]);
116255
116291
  const EzTextInput = /*@__PURE__*/proxyCustomElement(EzTextInput$1, [1,"ez-text-input",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"mask":[1],"canShowError":[516,"can-show-error"],"restrict":[1]}]);
116256
116292
  const EzTimeInput = /*@__PURE__*/proxyCustomElement(EzTimeInput$1, [1,"ez-time-input",{"label":[513],"viewValue":[1537,"view-value"],"value":[1026],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"]}]);
116257
- const EzToast = /*@__PURE__*/proxyCustomElement(EzToast$1, [1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"]}]);
116293
+ const EzToast = /*@__PURE__*/proxyCustomElement(EzToast$1, [1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"],"canClose":[1028,"can-close"]}]);
116258
116294
  const EzUpload = /*@__PURE__*/proxyCustomElement(EzUpload$1, [1,"ez-upload",{"label":[1],"enabled":[4],"maxFileSize":[2,"max-file-size"],"maxFiles":[2,"max-files"],"requestHeaders":[8,"request-headers"],"urlUpload":[1,"url-upload"],"urlDelete":[1,"url-delete"],"value":[1040]}]);
116259
116295
  const GridConfig = /*@__PURE__*/proxyCustomElement(GridConfig$1, [2,"grid-config",{"selectedTab":[1025,"selected-tab"],"columns":[1040]}]);
116260
116296
  const SelectBox = /*@__PURE__*/proxyCustomElement(SelectBox$1, [1,"select-box",{"selectedOption":[1,"selected-option"]}]);