@sankhyalabs/ezui 1.1.96 → 1.1.97
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.
- package/dist/cjs/UnitMetadata-2e11c5d3.js +1310 -0
- package/dist/cjs/ez-calendar_14.cjs.entry.js +58 -29
- package/dist/cjs/ez-grid.cjs.entry.js +32 -16
- package/dist/cjs/ez-icon.cjs.entry.js +2 -2
- package/dist/cjs/ez-modal_2.cjs.entry.js +1 -1
- package/dist/cjs/ez-popover.cjs.entry.js +1 -1
- package/dist/cjs/ez-time-input.cjs.entry.js +6 -6
- package/dist/collection/components/ez-form/DataBinder.js +13 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/SearchInput.tpl.js +1 -1
- package/dist/collection/components/ez-icon/ez-icon.css +5 -0
- package/dist/custom-elements/index.js +208 -6311
- package/dist/esm/UnitMetadata-8b1bbaa2.js +1304 -0
- package/dist/esm/ez-calendar_14.entry.js +31 -2
- package/dist/esm/ez-grid.entry.js +17 -1
- package/dist/esm/ez-icon.entry.js +2 -2
- package/dist/esm/ez-modal_2.entry.js +1 -1
- package/dist/esm/ez-popover.entry.js +1 -1
- package/dist/esm/ez-time-input.entry.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-07b60fe9.js +1 -0
- package/dist/ezui/p-2336c9ce.entry.js +1 -0
- package/dist/ezui/{p-2617733e.entry.js → p-45a25c30.entry.js} +1 -1
- package/dist/ezui/{p-6714a1b2.entry.js → p-532b5b24.entry.js} +10 -10
- package/dist/ezui/p-614fbb4e.entry.js +1 -0
- package/dist/ezui/{p-a943d501.entry.js → p-7165ac4f.entry.js} +1 -1
- package/dist/ezui/{p-ef393d36.entry.js → p-d3f87e18.entry.js} +1 -1
- package/dist/types/components/ez-form/DataBinder.d.ts +1 -0
- package/package.json +2 -2
- package/dist/cjs/index-6164b259.js +0 -7460
- package/dist/esm/index-74a9c220.js +0 -7452
- package/dist/ezui/p-38589c64.entry.js +0 -1
- package/dist/ezui/p-b139372f.entry.js +0 -1
- package/dist/ezui/p-c6762896.js +0 -1
|
@@ -0,0 +1,1310 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const NUMBERINPUTS_REGEX_SCIENTIFIC_PARTS = /^([+-])?(\d+).?(\d*)[eE]([-+]?\d+)$/;
|
|
4
|
+
/**
|
|
5
|
+
* `NumberUtils` é uma biblioteca para manipulação de números
|
|
6
|
+
*
|
|
7
|
+
* `Métodos`:
|
|
8
|
+
*
|
|
9
|
+
* @stringToNumber: converte um número em formato de string em um valor numérico nativo do javascript
|
|
10
|
+
* @format: arredonda um número em formato de string baseado nos parâmetros "presision" e "prettyPrecision";
|
|
11
|
+
*/
|
|
12
|
+
class NumberUtils {
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @stringToNumber: converte um numero em formato de string em numero
|
|
16
|
+
*
|
|
17
|
+
* @param value numero em formato de string a ser convertido (Importante: formato PT-BR ou já em formato numérico: ######.##)
|
|
18
|
+
*
|
|
19
|
+
* @returns string based number
|
|
20
|
+
*
|
|
21
|
+
* @Exemples
|
|
22
|
+
* @"100,12" | 100.12
|
|
23
|
+
* @"100.12" | 100.12
|
|
24
|
+
* @"-100,12" | -100.12
|
|
25
|
+
* @"R$100,12" | 100.12
|
|
26
|
+
* @"-R$100,12" | -100.12
|
|
27
|
+
* @"string" | NaN
|
|
28
|
+
*/
|
|
29
|
+
NumberUtils.stringToNumber = (value) => {
|
|
30
|
+
if (value === '' || value === null || value === undefined) {
|
|
31
|
+
return NaN;
|
|
32
|
+
}
|
|
33
|
+
if (value) {
|
|
34
|
+
value = value.toString();
|
|
35
|
+
var negative = (value.charAt(0) === '-');
|
|
36
|
+
if (!NUMBERINPUTS_REGEX_SCIENTIFIC_PARTS.test(value)) {
|
|
37
|
+
value = value.replace(/[^\d.,]/g, '');
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
value = value.replace(/^-/g, '');
|
|
41
|
+
}
|
|
42
|
+
//In case of simple string such as: "@@@@@@@"
|
|
43
|
+
if (value === '') {
|
|
44
|
+
return Number(NaN);
|
|
45
|
+
}
|
|
46
|
+
var indexV = value.indexOf(',');
|
|
47
|
+
var indexP = value.indexOf('.');
|
|
48
|
+
if (indexP > indexV) {
|
|
49
|
+
value = value.replace(',', '');
|
|
50
|
+
}
|
|
51
|
+
else if (indexP < indexV) {
|
|
52
|
+
value = value.replace(/\./g, '@').replace(',', '.').replace(/@/g, '');
|
|
53
|
+
}
|
|
54
|
+
if (negative) {
|
|
55
|
+
value = '-' + value;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return Number(value);
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* @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"
|
|
62
|
+
*
|
|
63
|
+
* @param value numero em formato de string a ser convertido (Importante: formato PT-BR ou já em formato numérico<sem separadors de milhares>: ######.##)
|
|
64
|
+
* @param precision (numero de decimais)
|
|
65
|
+
* @param prettyPrecision (numero de zeros nos decimais)
|
|
66
|
+
*
|
|
67
|
+
* @returns numero em formato de string formatado em PT-BR
|
|
68
|
+
*/
|
|
69
|
+
NumberUtils.format = (value, precision, prettyPrecision = NaN) => {
|
|
70
|
+
if (value === '' || value === undefined || value === "NaN") {
|
|
71
|
+
return NaN.toString();
|
|
72
|
+
}
|
|
73
|
+
let newValue = NumberUtils.stringToNumber(value);
|
|
74
|
+
if (newValue === NaN) {
|
|
75
|
+
return NaN.toString();
|
|
76
|
+
}
|
|
77
|
+
//Validation "precision":
|
|
78
|
+
// Case1: precision < 0 => does not use precision
|
|
79
|
+
// Case2: presicion not int => does not use precision
|
|
80
|
+
if (precision < 0 || Math.abs(Math.round(precision * 1) / 1) !== precision) {
|
|
81
|
+
//Once stringToNumber returns number format, we need to change to pt-br
|
|
82
|
+
return NumberUtils.changeFormat(newValue.toString());
|
|
83
|
+
}
|
|
84
|
+
//Validation "prettyPrecision"
|
|
85
|
+
let prettyPrecisionInternal = 0;
|
|
86
|
+
// Case1: prettyPrecision < 0 => prettyPrecision does not change de format that means: prettyPrecisionInternal = precision;
|
|
87
|
+
// Case2: prettyPrecision not int => prettyPrecision does not change de format that means: prettyPrecisionInternal = precision;
|
|
88
|
+
if (prettyPrecision === NaN || Math.abs(Math.round(prettyPrecision * 1) / 1) !== prettyPrecision) {
|
|
89
|
+
prettyPrecisionInternal = precision;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
prettyPrecisionInternal = prettyPrecision;
|
|
93
|
+
}
|
|
94
|
+
let newValueStr;
|
|
95
|
+
newValueStr = (Math.round(newValue * Math.pow(10, precision)) / Math.pow(10, precision)).toLocaleString('pt-br', { minimumFractionDigits: precision });
|
|
96
|
+
//prettyPrecision
|
|
97
|
+
const varSettingPP = precision - prettyPrecisionInternal;
|
|
98
|
+
if (varSettingPP > 0) {
|
|
99
|
+
for (let i = 0; i < varSettingPP; i++) {
|
|
100
|
+
if (newValueStr.substring(newValueStr.length - 1) == "0" && precision > 0) {
|
|
101
|
+
newValueStr = newValueStr.substring(0, newValueStr.length - 1);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
//in Case "." or "," in the end of the string
|
|
106
|
+
if (newValueStr.substring(newValueStr.length - 1) == "." || newValueStr.substring(newValueStr.length - 1) == ",") {
|
|
107
|
+
newValueStr = newValueStr.substring(0, newValueStr.length - 1);
|
|
108
|
+
}
|
|
109
|
+
return newValueStr;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* @keepOnlyDecimalSeparator: retira os separadores de milhar de um número em formato de string
|
|
113
|
+
*
|
|
114
|
+
* @param value numero em formato de string a ser convertido
|
|
115
|
+
* @param formatnumber (formatação de ENTRADA e SAÍDA do utilitário: pt-BR="###.###,##" en-US="###,###.##"; Default: "pt-BR")
|
|
116
|
+
*
|
|
117
|
+
* @returns numero em formato de string formatado apenas com separador decimal
|
|
118
|
+
*/
|
|
119
|
+
NumberUtils.keepOnlyDecimalSeparator = (value, formatnumber = 'pt-BR') => {
|
|
120
|
+
//Formatting formatnumber to be able to get lowercases
|
|
121
|
+
formatnumber = formatnumber.toUpperCase();
|
|
122
|
+
//Formatting value following formatnumber parameter
|
|
123
|
+
//keep only decimal character in order to correct format the string
|
|
124
|
+
//This transformation is due the "stringtoNumber" method is a general method that tries to convert all formated strings
|
|
125
|
+
if (formatnumber === 'EN-US') {
|
|
126
|
+
value = value.replace(/\,/g, '');
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
value = value.replace(/\./g, '');
|
|
130
|
+
}
|
|
131
|
+
return value;
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* @changeFormat: troca o formato do numero string de "PT-BR" para "EN-US" e vice-versa
|
|
135
|
+
*
|
|
136
|
+
* @param value numero em formato de string a ser convertido
|
|
137
|
+
*
|
|
138
|
+
* @returns numero em formato de string formatado de "PT-BR" para "EN-US" e vice-versa
|
|
139
|
+
*/
|
|
140
|
+
NumberUtils.changeFormat = (value) => {
|
|
141
|
+
//Formatting output following formatnumber
|
|
142
|
+
return value.replace(/\./g, '_').replace(/\,/g, '.').replace(/\_/g, ',');
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* `MaskFormatter` é usado para formatar strings. Seu comportamento
|
|
147
|
+
* é controlado pela formato do atributo `mask` que especifica quais
|
|
148
|
+
* caracteres são válidos e onde devem estar posicionados, intercalando-os
|
|
149
|
+
* com eventuais caracteres literais expressados no padrão informado.
|
|
150
|
+
* Sua implementação é inspirada pela implementação em Java do [MaskFormatter](https://docs.oracle.com/javase/7/docs/api/javax/swing/text/MaskFormatter.html).
|
|
151
|
+
*
|
|
152
|
+
* Para o padrão da máscara podem ser usados os seguintes caracteres especiais:
|
|
153
|
+
*
|
|
154
|
+
* | Caractere | Comportamento |
|
|
155
|
+
* |:---------:|-------------------------------------------------------------------------------------------------------------|
|
|
156
|
+
* | # | Qualquer número |
|
|
157
|
+
* | ' | "Escapa" o caractere que vem na sequência. Útil quando desejamos converter um caractere especial em literal.|
|
|
158
|
+
* | U | Qualquer letra. Transforma letras maiúsculas em maiúsculas. |
|
|
159
|
+
* | L | Qualquer letra. Transforma letras maiúsculas em minúsculas. |
|
|
160
|
+
* | A | Qualquer letra ou número. |
|
|
161
|
+
* | ? | Qualquer letra. Preserva maiúsculas e minúsculas. |
|
|
162
|
+
* | * | Qualquer caractere. |
|
|
163
|
+
*
|
|
164
|
+
* Os demais caracteres presentes no padrão serão tratados como literais, isto é,
|
|
165
|
+
* serão apenas inseridos naquela posição.
|
|
166
|
+
*
|
|
167
|
+
* Quando o o valor a ser formatado é menor que a máscara um 'placeHolder'
|
|
168
|
+
* será inserido em cada posição ausente, completando a formatação.
|
|
169
|
+
* Por padrão será usado um espaço em branco como 'placeHolder' mas
|
|
170
|
+
* esse valor pode ser alterado.
|
|
171
|
+
*
|
|
172
|
+
* For por exemplo:
|
|
173
|
+
* '''
|
|
174
|
+
* const formatter: MaskFormatter = new MaskFormatter("###-####");
|
|
175
|
+
* formatter.placeholder = '_';
|
|
176
|
+
* console.log(formatter.format("123"));
|
|
177
|
+
* '''
|
|
178
|
+
* resultaria na string '123-____'.
|
|
179
|
+
*
|
|
180
|
+
* ##Veja mais alguns exemplos:
|
|
181
|
+
* |Padrão |Máscara |Entrada |Saída |
|
|
182
|
+
* |----------------|------------------|--------------|------------------|
|
|
183
|
+
* |Telefone |(##) ####-#### |3432192515 |(34) 3219-2515 |
|
|
184
|
+
* |CPF |###.###.###-## |12345678901 |123.456.789-01 |
|
|
185
|
+
* |CNPJ |##.###.###/####-##|12345678901234|12.345.678/9012-34|
|
|
186
|
+
* |CEP |##.###-### |12345678 |12.345-678 |
|
|
187
|
+
* |PLACA (veículo) |UUU-#### |abc1234 |ABC-1234 |
|
|
188
|
+
* |Cor RGB |'#AAAAAA |00000F0 |#0000F0 |
|
|
189
|
+
*
|
|
190
|
+
*/
|
|
191
|
+
class MaskFormatter {
|
|
192
|
+
constructor(mask) {
|
|
193
|
+
this._mask = '';
|
|
194
|
+
this._maskChars = new Array();
|
|
195
|
+
/**
|
|
196
|
+
* Determina qual caractere será usado dos caracteres não presentes no valor
|
|
197
|
+
* ou seja, aqueles que o usuário ainda não informou. Por padrão usamos um espaço
|
|
198
|
+
*/
|
|
199
|
+
this.placeholder = ' ';
|
|
200
|
+
this.mask = mask;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Setter para mask. Trata-se do padrão que se espera ao formatar o texto.
|
|
204
|
+
*/
|
|
205
|
+
set mask(mask) {
|
|
206
|
+
this._mask = mask;
|
|
207
|
+
this.updateInternalMask();
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Getter para mask
|
|
211
|
+
*
|
|
212
|
+
* @return A última máscara informada.
|
|
213
|
+
*/
|
|
214
|
+
get mask() {
|
|
215
|
+
return this._mask;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Formata a string passada baseada na máscara definda pelo atributo mask.
|
|
219
|
+
*
|
|
220
|
+
* @param value Valor a ser formatado
|
|
221
|
+
* @return O valor processado de acordo com o padrão
|
|
222
|
+
*/
|
|
223
|
+
format(value) {
|
|
224
|
+
let result = '';
|
|
225
|
+
const index = [0];
|
|
226
|
+
let counter = 0;
|
|
227
|
+
const maxCounter = this._maskChars.length;
|
|
228
|
+
while (counter < maxCounter) {
|
|
229
|
+
result = this._maskChars[counter].append(result, value, index);
|
|
230
|
+
counter++;
|
|
231
|
+
}
|
|
232
|
+
return result;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Preparamos a formatação internamente de acordo com o padrão.
|
|
236
|
+
*/
|
|
237
|
+
updateInternalMask() {
|
|
238
|
+
this._maskChars.length = 0;
|
|
239
|
+
if (this.mask != null) {
|
|
240
|
+
let counter = 0;
|
|
241
|
+
const maxCounter = this.mask.length;
|
|
242
|
+
while (counter < maxCounter) {
|
|
243
|
+
let maskChar = this.mask.charAt(counter);
|
|
244
|
+
switch (maskChar) {
|
|
245
|
+
case MaskFormatter.DIGIT_KEY:
|
|
246
|
+
this._maskChars.push(new MaskFormatter.DigitMaskCharacter(this, maskChar));
|
|
247
|
+
break;
|
|
248
|
+
case MaskFormatter.LITERAL_KEY:
|
|
249
|
+
if (++counter < maxCounter) {
|
|
250
|
+
maskChar = this.mask.charAt(counter);
|
|
251
|
+
this._maskChars.push(new MaskFormatter.LiteralCharacter(this, maskChar));
|
|
252
|
+
}
|
|
253
|
+
break;
|
|
254
|
+
case MaskFormatter.UPPERCASE_KEY:
|
|
255
|
+
this._maskChars.push(new MaskFormatter.UpperCaseCharacter(this, maskChar));
|
|
256
|
+
break;
|
|
257
|
+
case MaskFormatter.LOWERCASE_KEY:
|
|
258
|
+
this._maskChars.push(new MaskFormatter.LowerCaseCharacter(this, maskChar));
|
|
259
|
+
break;
|
|
260
|
+
case MaskFormatter.ALPHA_NUMERIC_KEY:
|
|
261
|
+
this._maskChars.push(new MaskFormatter.AlphaNumericCharacter(this, maskChar));
|
|
262
|
+
break;
|
|
263
|
+
case MaskFormatter.CHARACTER_KEY:
|
|
264
|
+
this._maskChars.push(new MaskFormatter.CharCharacter(this, maskChar));
|
|
265
|
+
break;
|
|
266
|
+
case MaskFormatter.ANYTHING_KEY:
|
|
267
|
+
this._maskChars.push(new MaskFormatter.MaskCharacter(this, maskChar));
|
|
268
|
+
break;
|
|
269
|
+
default:
|
|
270
|
+
this._maskChars.push(new MaskFormatter.LiteralCharacter(this, maskChar));
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
counter++;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
MaskFormatter.DIGIT_KEY = "#";
|
|
279
|
+
MaskFormatter.LITERAL_KEY = "'";
|
|
280
|
+
MaskFormatter.UPPERCASE_KEY = "U";
|
|
281
|
+
MaskFormatter.LOWERCASE_KEY = "L";
|
|
282
|
+
MaskFormatter.ALPHA_NUMERIC_KEY = "A";
|
|
283
|
+
MaskFormatter.CHARACTER_KEY = "?";
|
|
284
|
+
MaskFormatter.ANYTHING_KEY = "*";
|
|
285
|
+
//
|
|
286
|
+
// Classes internas usadas para representar a máscara.
|
|
287
|
+
//
|
|
288
|
+
MaskFormatter.MaskCharacter = class {
|
|
289
|
+
constructor(maskFormatter, type) {
|
|
290
|
+
this.maskFormatter = maskFormatter;
|
|
291
|
+
this.type = type;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Cada subclasse deve sobrescrever o retornando true, caso represente
|
|
295
|
+
* um caractere literal. Por padrão o retorno é false.
|
|
296
|
+
*/
|
|
297
|
+
isLiteral() {
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Returns true if <code>aChar</code> is a valid reprensentation of
|
|
302
|
+
* the receiver. The default implementation returns true if the
|
|
303
|
+
* receiver represents a literal character and <code>getChar</code>
|
|
304
|
+
* == aChar. Otherwise, this will return true is <code>aChar</code>
|
|
305
|
+
* is contained in the valid characters and not contained
|
|
306
|
+
* in the invalid characters.
|
|
307
|
+
*/
|
|
308
|
+
isValidCharacter(aChar) {
|
|
309
|
+
if (this.isLiteral()) {
|
|
310
|
+
return (this.getChar(aChar) == aChar);
|
|
311
|
+
}
|
|
312
|
+
aChar = this.getChar(aChar);
|
|
313
|
+
return true;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Returns the character to insert for <code>aChar</code>. The
|
|
317
|
+
* default implementation returns <code>aChar</code>. Subclasses
|
|
318
|
+
* that wish to do some sort of mapping, perhaps lower case to upper
|
|
319
|
+
* case should override this and do the necessary mapping.
|
|
320
|
+
*/
|
|
321
|
+
getChar(aChar) {
|
|
322
|
+
return aChar;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Appends the necessary character in <code>formatting</code> at
|
|
326
|
+
* <code>index</code> to <code>buff</code>.
|
|
327
|
+
*/
|
|
328
|
+
append(result, formatting, index) {
|
|
329
|
+
const inString = index[0] < formatting.length;
|
|
330
|
+
const aChar = inString ? formatting.charAt(index[0]) : '';
|
|
331
|
+
if (this.isLiteral()) {
|
|
332
|
+
const literal = this.getChar(aChar);
|
|
333
|
+
result += literal;
|
|
334
|
+
if (literal === aChar) {
|
|
335
|
+
index[0] = index[0] + 1;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
else if (index[0] >= formatting.length) {
|
|
339
|
+
result += this.maskFormatter.placeholder;
|
|
340
|
+
index[0] = index[0] + 1;
|
|
341
|
+
}
|
|
342
|
+
else if (this.isValidCharacter(aChar)) {
|
|
343
|
+
result += this.getChar(aChar);
|
|
344
|
+
index[0] = index[0] + 1;
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
throw new Error(`Valor inválido: "${aChar}". Na posição ${index[0] + 1} espera-se ${this.getFormatMessage()}.`);
|
|
348
|
+
}
|
|
349
|
+
return result;
|
|
350
|
+
}
|
|
351
|
+
getFormatMessage() {
|
|
352
|
+
let message;
|
|
353
|
+
switch (this.type) {
|
|
354
|
+
case MaskFormatter.UPPERCASE_KEY:
|
|
355
|
+
case MaskFormatter.LOWERCASE_KEY:
|
|
356
|
+
case MaskFormatter.CHARACTER_KEY:
|
|
357
|
+
message = 'uma letra';
|
|
358
|
+
break;
|
|
359
|
+
case MaskFormatter.DIGIT_KEY:
|
|
360
|
+
message = 'um número';
|
|
361
|
+
break;
|
|
362
|
+
case MaskFormatter.ALPHA_NUMERIC_KEY:
|
|
363
|
+
message = 'uma letra ou um número';
|
|
364
|
+
break;
|
|
365
|
+
default:
|
|
366
|
+
message = '';
|
|
367
|
+
}
|
|
368
|
+
return message;
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
MaskFormatter.LiteralCharacter = class extends MaskFormatter.MaskCharacter {
|
|
372
|
+
constructor(maskFormatter, fixedChar) {
|
|
373
|
+
super(maskFormatter, fixedChar);
|
|
374
|
+
this._fixedChar = fixedChar;
|
|
375
|
+
}
|
|
376
|
+
isLiteral() {
|
|
377
|
+
return true;
|
|
378
|
+
}
|
|
379
|
+
getChar(aChar) {
|
|
380
|
+
return this._fixedChar;
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
MaskFormatter.DigitMaskCharacter = class extends MaskFormatter.MaskCharacter {
|
|
384
|
+
isValidCharacter(aChar) {
|
|
385
|
+
return (this.isDigit(aChar) && super.isValidCharacter(aChar));
|
|
386
|
+
}
|
|
387
|
+
isDigit(char) {
|
|
388
|
+
return char >= '0' && char <= '9';
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
MaskFormatter.UpperCaseCharacter = class extends MaskFormatter.MaskCharacter {
|
|
392
|
+
isValidCharacter(aChar) {
|
|
393
|
+
return (/[a-z]/i.test(aChar) && super.isValidCharacter(aChar));
|
|
394
|
+
}
|
|
395
|
+
getChar(aChar) {
|
|
396
|
+
return aChar.toUpperCase();
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
MaskFormatter.LowerCaseCharacter = class extends MaskFormatter.MaskCharacter {
|
|
400
|
+
isValidCharacter(aChar) {
|
|
401
|
+
return (/[a-z]/i.test(aChar) && super.isValidCharacter(aChar));
|
|
402
|
+
}
|
|
403
|
+
getChar(aChar) {
|
|
404
|
+
return aChar.toLocaleLowerCase();
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
MaskFormatter.AlphaNumericCharacter = class extends MaskFormatter.MaskCharacter {
|
|
408
|
+
isValidCharacter(aChar) {
|
|
409
|
+
//FIXME: talvez seja problema usar regex aqui... avaliar se existe forma mais barata
|
|
410
|
+
return (/[a-z0-9]/i.test(aChar)) && super.isValidCharacter(aChar);
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
MaskFormatter.CharCharacter = class extends MaskFormatter.MaskCharacter {
|
|
414
|
+
isValidCharacter(aChar) {
|
|
415
|
+
//FIXME: talvez seja problema usar regex aqui... avaliar se existe forma mais barata
|
|
416
|
+
return (/[a-z]/i.test(aChar) && super.isValidCharacter(aChar));
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* `TimeFormatter` é um utilitário para formatação de strings desformatadas em strings válidas de horários
|
|
422
|
+
*/
|
|
423
|
+
class TimeFormatter {
|
|
424
|
+
/**
|
|
425
|
+
* @prepareValue: converts an unformated time string into a formatted time.
|
|
426
|
+
*
|
|
427
|
+
* @param value unformated time string to convert
|
|
428
|
+
*
|
|
429
|
+
* @returns formatted time string
|
|
430
|
+
*
|
|
431
|
+
* @Exemples
|
|
432
|
+
* @"1012" | "10:12"
|
|
433
|
+
* @"10:12" | "10:12:00"
|
|
434
|
+
* @"100112" | "10:01:12"
|
|
435
|
+
*/
|
|
436
|
+
static prepareValue(value, showSeconds) {
|
|
437
|
+
if (value && value.length > 0 && value != "NaN") {
|
|
438
|
+
let validationValue = value.replace(/:/g, "");
|
|
439
|
+
if (showSeconds) {
|
|
440
|
+
this._maskFormatter.mask = "##:##:##";
|
|
441
|
+
if (validationValue.length < 6) {
|
|
442
|
+
while (validationValue.length < 6) {
|
|
443
|
+
validationValue = "0".concat(validationValue);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
this._maskFormatter.mask = "##:##";
|
|
449
|
+
if (validationValue.length < 4) {
|
|
450
|
+
while (validationValue.length < 4) {
|
|
451
|
+
validationValue = "0".concat(validationValue);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
if (this._maskFormatter) {
|
|
456
|
+
try {
|
|
457
|
+
value = this._maskFormatter.format(validationValue);
|
|
458
|
+
return value;
|
|
459
|
+
}
|
|
460
|
+
catch (e) {
|
|
461
|
+
throw new Error(e.message);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
return '';
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* @validateTime: validates if an input string has the corect time format.
|
|
469
|
+
*
|
|
470
|
+
* @param value input string to validate
|
|
471
|
+
*
|
|
472
|
+
* @returns true or false
|
|
473
|
+
*
|
|
474
|
+
* @Exemples
|
|
475
|
+
* @"1012" | true
|
|
476
|
+
* @"14e4" | false
|
|
477
|
+
* @"2624" | false
|
|
478
|
+
*/
|
|
479
|
+
static validateTime(value, showSeconds) {
|
|
480
|
+
let isValid = true;
|
|
481
|
+
if (value) {
|
|
482
|
+
let validationValue = value.replace(/:/g, "");
|
|
483
|
+
if (showSeconds) {
|
|
484
|
+
if (!["1", "2", "0"].includes(validationValue[0])) {
|
|
485
|
+
isValid = false;
|
|
486
|
+
}
|
|
487
|
+
if (!["0", "1", "2", "3", "4", "5"].includes(validationValue[2])) {
|
|
488
|
+
isValid = false;
|
|
489
|
+
}
|
|
490
|
+
if (!["0", "1", "2", "3", "4", "5"].includes(validationValue[4])) {
|
|
491
|
+
isValid = false;
|
|
492
|
+
}
|
|
493
|
+
if (validationValue[0] == "2" && !["0", "1", "2", "3"].includes(validationValue[1])) {
|
|
494
|
+
isValid = false;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
if (!["1", "2", "0"].includes(validationValue[0])) {
|
|
499
|
+
isValid = false;
|
|
500
|
+
}
|
|
501
|
+
if (!["0", "1", "2", "3", "4", "5"].includes(validationValue[2])) {
|
|
502
|
+
isValid = false;
|
|
503
|
+
}
|
|
504
|
+
if (validationValue[0] == "2" && !["0", "1", "2", "3"].includes(validationValue[1])) {
|
|
505
|
+
isValid = false;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
else {
|
|
510
|
+
isValid = false;
|
|
511
|
+
}
|
|
512
|
+
return isValid;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
TimeFormatter._maskFormatter = new MaskFormatter("##:##");
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Representa as propriedades necessárias para se executar uma requisição.
|
|
519
|
+
*/
|
|
520
|
+
/** Representa os verbos HTTP suportados */
|
|
521
|
+
var Method;
|
|
522
|
+
(function (Method) {
|
|
523
|
+
Method[Method["GET"] = 0] = "GET";
|
|
524
|
+
Method[Method["PUT"] = 1] = "PUT";
|
|
525
|
+
Method[Method["POST"] = 2] = "POST";
|
|
526
|
+
Method[Method["DELETE"] = 3] = "DELETE";
|
|
527
|
+
})(Method || (Method = {}));
|
|
528
|
+
|
|
529
|
+
exports.DataType = void 0;
|
|
530
|
+
(function (DataType) {
|
|
531
|
+
DataType["NUMBER"] = "NUMBER";
|
|
532
|
+
DataType["DATE"] = "DATE";
|
|
533
|
+
DataType["TEXT"] = "TEXT";
|
|
534
|
+
DataType["BOOLEAN"] = "BOOLEAN";
|
|
535
|
+
DataType["OBJECT"] = "OBJECT";
|
|
536
|
+
})(exports.DataType || (exports.DataType = {}));
|
|
537
|
+
const convertType = (dataType, value) => {
|
|
538
|
+
if (value === undefined || value === null) {
|
|
539
|
+
return value;
|
|
540
|
+
}
|
|
541
|
+
switch (dataType) {
|
|
542
|
+
case exports.DataType.NUMBER:
|
|
543
|
+
return value === "" || isNaN(value) ? null : Number(value);
|
|
544
|
+
case exports.DataType.OBJECT:
|
|
545
|
+
return typeof value === "string" ? JSON.parse(value) : value;
|
|
546
|
+
case exports.DataType.BOOLEAN:
|
|
547
|
+
return Boolean(value);
|
|
548
|
+
case exports.DataType.DATE:
|
|
549
|
+
return new Date(value.toString());
|
|
550
|
+
default:
|
|
551
|
+
return value;
|
|
552
|
+
}
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
class DataUnitAction {
|
|
556
|
+
constructor(type, payload) {
|
|
557
|
+
this._type = type;
|
|
558
|
+
this._payload = payload;
|
|
559
|
+
}
|
|
560
|
+
get type() {
|
|
561
|
+
return this._type;
|
|
562
|
+
}
|
|
563
|
+
get payload() {
|
|
564
|
+
return this._payload;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
exports.Action = void 0;
|
|
568
|
+
(function (Action) {
|
|
569
|
+
Action["LOADING_METADATA"] = "loadingMetadata";
|
|
570
|
+
Action["METADATA_LOADED"] = "metadataLoaded";
|
|
571
|
+
Action["LOADING_DATA"] = "loadingData";
|
|
572
|
+
Action["DATA_LOADED"] = "dataLoaded";
|
|
573
|
+
Action["SAVING_DATA"] = "savingData";
|
|
574
|
+
Action["DATA_SAVED"] = "dataSaved";
|
|
575
|
+
Action["RECORDS_REMOVED"] = "recordsRemoved";
|
|
576
|
+
Action["RECORDS_ADDED"] = "recordsAdded";
|
|
577
|
+
Action["RECORDS_COPIED"] = "recordsCopied";
|
|
578
|
+
Action["DATA_CHANGED"] = "dataChanged";
|
|
579
|
+
Action["EDITION_CANCELED"] = "editionCanceled";
|
|
580
|
+
Action["CHANGE_UNDONE"] = "changeUndone";
|
|
581
|
+
Action["CHANGE_REDONE"] = "changeRedone";
|
|
582
|
+
Action["SELECTION_CHANGED"] = "selectionChanged";
|
|
583
|
+
Action["NEXT_SELECTED"] = "nextSelected";
|
|
584
|
+
Action["PREVIOUS_SELECTED"] = "previousSelected";
|
|
585
|
+
Action["STATE_CHANGED"] = "stateChanged";
|
|
586
|
+
})(exports.Action || (exports.Action = {}));
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Essa classe representa uma interpretação do padrão de projetos Flux.
|
|
590
|
+
* No padrão Flux os dados da aplicação são chamados de "estado" e existem
|
|
591
|
+
* algumas regras para gerenciamento/manipulação desse estado:
|
|
592
|
+
*
|
|
593
|
+
* 1 - O estado é imutável.
|
|
594
|
+
* 2 - Toda modificação de estado é representada por uma "ação".
|
|
595
|
+
* 3 - Quando "ações" acontecem a "store" cria um novo estado e notifica a todos interessados.
|
|
596
|
+
*
|
|
597
|
+
* Nessa interpretação desse design pattern, o StateManager faz o papel da store,
|
|
598
|
+
* notificando os manipuladores de estado (handlers), que são responsáveis por pedaços
|
|
599
|
+
* do estado (slices).
|
|
600
|
+
*
|
|
601
|
+
* O StateManager mantém dois tipos de estados: "Histórico" e "Não Histórico". No estado
|
|
602
|
+
* "Histórico", sempre que uma alteração de estado acontece, o estado anterior é guardado em
|
|
603
|
+
* uma pilha, o que permite que possamos voltar no tempo, desfazendo algumas ações
|
|
604
|
+
*/
|
|
605
|
+
class StateManager {
|
|
606
|
+
constructor(reducers) {
|
|
607
|
+
this._past = [];
|
|
608
|
+
this._future = [];
|
|
609
|
+
this._present = {};
|
|
610
|
+
this._nonHist = {};
|
|
611
|
+
this._histClean = false;
|
|
612
|
+
this._reducers = reducers;
|
|
613
|
+
}
|
|
614
|
+
process(action) {
|
|
615
|
+
const oldPresent = this._present;
|
|
616
|
+
let hasHistChange = false;
|
|
617
|
+
this._histClean = false;
|
|
618
|
+
this._reducers.forEach(reducer => {
|
|
619
|
+
const sliceName = reducer.sliceName;
|
|
620
|
+
const isHistoric = this.isHistoric(sliceName);
|
|
621
|
+
const oldSlice = this.getSlice(sliceName, isHistoric);
|
|
622
|
+
const newSlice = reducer.reduce(this, oldSlice, action);
|
|
623
|
+
if (newSlice !== oldSlice) {
|
|
624
|
+
this.updateSlice(sliceName, newSlice, isHistoric);
|
|
625
|
+
hasHistChange || (hasHistChange = isHistoric);
|
|
626
|
+
}
|
|
627
|
+
});
|
|
628
|
+
if (hasHistChange && !this._histClean) {
|
|
629
|
+
this._past.push(oldPresent);
|
|
630
|
+
this._future = [];
|
|
631
|
+
document.dispatchEvent(new CustomEvent("undoableAction", { detail: this }));
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
select(sliceName, selector) {
|
|
635
|
+
const isHistoric = this.isHistoric(sliceName);
|
|
636
|
+
return selector(this.getSlice(sliceName, isHistoric));
|
|
637
|
+
}
|
|
638
|
+
isHistoric(slice) {
|
|
639
|
+
return slice.startsWith("hist::");
|
|
640
|
+
}
|
|
641
|
+
updateSlice(name, slice, isHistoric) {
|
|
642
|
+
if (isHistoric) {
|
|
643
|
+
this._present = Object.assign(Object.assign({}, this._present), { [name]: slice });
|
|
644
|
+
if (slice === undefined) {
|
|
645
|
+
delete this._present[name];
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
else {
|
|
649
|
+
this._nonHist = Object.assign(Object.assign({}, this._nonHist), { [name]: slice });
|
|
650
|
+
if (slice === undefined) {
|
|
651
|
+
delete this._nonHist[name];
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
getSlice(name, isHistoric) {
|
|
656
|
+
return isHistoric ? this._present[name] : this._nonHist[name];
|
|
657
|
+
}
|
|
658
|
+
canUndo() {
|
|
659
|
+
return this._past.length > 0;
|
|
660
|
+
}
|
|
661
|
+
canRedo() {
|
|
662
|
+
return this._future.length > 0;
|
|
663
|
+
}
|
|
664
|
+
undo() {
|
|
665
|
+
if (this.canUndo()) {
|
|
666
|
+
this._future.push(this._present);
|
|
667
|
+
this._present = this._past.pop();
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
redo() {
|
|
671
|
+
if (this.canRedo()) {
|
|
672
|
+
this._past.push(this._present);
|
|
673
|
+
this._present = this._future.pop();
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
clearUndo() {
|
|
677
|
+
this._histClean = true;
|
|
678
|
+
this._past = [];
|
|
679
|
+
this._future = [];
|
|
680
|
+
}
|
|
681
|
+
persist() {
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
class HistReducerImpl {
|
|
686
|
+
constructor() {
|
|
687
|
+
this.sliceName = "";
|
|
688
|
+
}
|
|
689
|
+
reduce(stateManager, _currentState, action) {
|
|
690
|
+
switch (action.type) {
|
|
691
|
+
case exports.Action.DATA_SAVED:
|
|
692
|
+
case exports.Action.EDITION_CANCELED:
|
|
693
|
+
stateManager.clearUndo();
|
|
694
|
+
break;
|
|
695
|
+
case exports.Action.CHANGE_UNDONE:
|
|
696
|
+
stateManager.undo();
|
|
697
|
+
break;
|
|
698
|
+
case exports.Action.CHANGE_REDONE:
|
|
699
|
+
stateManager.redo();
|
|
700
|
+
break;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
const HistReducer = new HistReducerImpl();
|
|
705
|
+
const canUndo = (stateManager) => {
|
|
706
|
+
return stateManager.canUndo();
|
|
707
|
+
};
|
|
708
|
+
const canRedo = (stateManager) => {
|
|
709
|
+
return stateManager.canRedo();
|
|
710
|
+
};
|
|
711
|
+
|
|
712
|
+
class UnitMetadataReducerImpl {
|
|
713
|
+
constructor() {
|
|
714
|
+
this.sliceName = "unitMetadata";
|
|
715
|
+
}
|
|
716
|
+
reduce(_stateManager, currentState, action) {
|
|
717
|
+
if (action.type === exports.Action.METADATA_LOADED) {
|
|
718
|
+
return action.payload;
|
|
719
|
+
}
|
|
720
|
+
return currentState;
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
const UnitMetadataReducer = new UnitMetadataReducerImpl();
|
|
724
|
+
const getMetadata = (stateManager) => {
|
|
725
|
+
return stateManager.select(UnitMetadataReducer.sliceName, (state) => state);
|
|
726
|
+
};
|
|
727
|
+
const getField = (stateManager, fieldName) => {
|
|
728
|
+
const md = getMetadata(stateManager);
|
|
729
|
+
return md ? md.fields.find(fmd => fmd.name === fieldName) : undefined;
|
|
730
|
+
};
|
|
731
|
+
|
|
732
|
+
class RemovedRecordsReducerImpl {
|
|
733
|
+
constructor() {
|
|
734
|
+
this.sliceName = "hist::removedRecords";
|
|
735
|
+
}
|
|
736
|
+
reduce(_stateManager, currentState, action) {
|
|
737
|
+
switch (action.type) {
|
|
738
|
+
case exports.Action.RECORDS_REMOVED:
|
|
739
|
+
return (currentState || []).concat(action.payload);
|
|
740
|
+
case exports.Action.EDITION_CANCELED:
|
|
741
|
+
case exports.Action.DATA_SAVED:
|
|
742
|
+
return undefined;
|
|
743
|
+
}
|
|
744
|
+
return currentState;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
const RemovedRecordsReducer = new RemovedRecordsReducerImpl();
|
|
748
|
+
const getRemovedRecords = (stateManager) => {
|
|
749
|
+
return stateManager.select(RemovedRecordsReducer.sliceName, (state) => state);
|
|
750
|
+
};
|
|
751
|
+
|
|
752
|
+
class RecordsReducerImpl {
|
|
753
|
+
constructor() {
|
|
754
|
+
this.sliceName = "records";
|
|
755
|
+
}
|
|
756
|
+
reduce(stateManager, currentState, action) {
|
|
757
|
+
switch (action.type) {
|
|
758
|
+
case exports.Action.DATA_LOADED:
|
|
759
|
+
return action.payload;
|
|
760
|
+
case exports.Action.DATA_SAVED:
|
|
761
|
+
const recordsMap = new Map();
|
|
762
|
+
const currentRecords = getRecords(stateManager);
|
|
763
|
+
if (currentRecords) {
|
|
764
|
+
const removed = getRemovedRecords(stateManager) || [];
|
|
765
|
+
currentRecords.forEach(r => {
|
|
766
|
+
if (!removed.includes(r.__record__id__)) {
|
|
767
|
+
recordsMap.set(r.__record__id__, r);
|
|
768
|
+
}
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
const savedRecords = action.payload.records;
|
|
772
|
+
savedRecords.forEach(sr => {
|
|
773
|
+
const recordId = sr.__old__id__ || sr.__record__id__;
|
|
774
|
+
const newRecord = Object.assign({}, sr);
|
|
775
|
+
delete newRecord["__old__id__"];
|
|
776
|
+
recordsMap.set(recordId, newRecord);
|
|
777
|
+
});
|
|
778
|
+
return Array.from(recordsMap.values());
|
|
779
|
+
}
|
|
780
|
+
return currentState;
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
const RecordsReducer = new RecordsReducerImpl();
|
|
784
|
+
const getRecords = (stateManager) => {
|
|
785
|
+
return stateManager.select(RecordsReducer.sliceName, (state) => state);
|
|
786
|
+
};
|
|
787
|
+
|
|
788
|
+
class AddedRecordsReducerImpl {
|
|
789
|
+
constructor() {
|
|
790
|
+
this.sliceName = "hist::addedRecords";
|
|
791
|
+
}
|
|
792
|
+
reduce(_stateManager, currentState, action) {
|
|
793
|
+
switch (action.type) {
|
|
794
|
+
case exports.Action.RECORDS_ADDED:
|
|
795
|
+
case exports.Action.RECORDS_COPIED:
|
|
796
|
+
return (currentState || []).concat(action.payload);
|
|
797
|
+
case exports.Action.DATA_SAVED:
|
|
798
|
+
case exports.Action.EDITION_CANCELED:
|
|
799
|
+
return undefined;
|
|
800
|
+
}
|
|
801
|
+
return currentState;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
const AddedRecordsReducer = new AddedRecordsReducerImpl();
|
|
805
|
+
const getAddedRecords = (stateManager) => {
|
|
806
|
+
return stateManager.select(AddedRecordsReducer.sliceName, (state) => state);
|
|
807
|
+
};
|
|
808
|
+
const prepareAddedRecordId = (stateManager, source) => {
|
|
809
|
+
let index = (getAddedRecords(stateManager) || []).length;
|
|
810
|
+
return source.map(item => { return Object.assign(Object.assign({}, item), { __record__id__: "NEW_" + (index++) }); });
|
|
811
|
+
};
|
|
812
|
+
|
|
813
|
+
class ChangesReducerImpl {
|
|
814
|
+
constructor() {
|
|
815
|
+
this.sliceName = "hist::changes";
|
|
816
|
+
}
|
|
817
|
+
reduce(stateManager, currentState, action) {
|
|
818
|
+
switch (action.type) {
|
|
819
|
+
case exports.Action.DATA_CHANGED:
|
|
820
|
+
const selection = action.payload.records || getSelection(stateManager);
|
|
821
|
+
if (selection) {
|
|
822
|
+
const newState = new Map(currentState);
|
|
823
|
+
selection.forEach(recordId => {
|
|
824
|
+
const newChanges = Object.assign(Object.assign({}, newState.get(recordId)), action.payload);
|
|
825
|
+
delete newChanges.records;
|
|
826
|
+
newState.set(recordId, newChanges);
|
|
827
|
+
});
|
|
828
|
+
return newState;
|
|
829
|
+
}
|
|
830
|
+
return currentState;
|
|
831
|
+
case exports.Action.DATA_SAVED:
|
|
832
|
+
case exports.Action.EDITION_CANCELED:
|
|
833
|
+
return undefined;
|
|
834
|
+
}
|
|
835
|
+
return currentState;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
const ChangesReducer = new ChangesReducerImpl();
|
|
839
|
+
const getChanges = (stateManager) => {
|
|
840
|
+
return stateManager.select(ChangesReducer.sliceName, (state) => state);
|
|
841
|
+
};
|
|
842
|
+
const isDirty = (stateManager) => {
|
|
843
|
+
if (getAddedRecords(stateManager) !== undefined) {
|
|
844
|
+
return true;
|
|
845
|
+
}
|
|
846
|
+
if (getRemovedRecords(stateManager) !== undefined) {
|
|
847
|
+
return true;
|
|
848
|
+
}
|
|
849
|
+
return getChanges(stateManager) !== undefined;
|
|
850
|
+
};
|
|
851
|
+
const getChangesToSave = (dataUnit, stateManager) => {
|
|
852
|
+
const result = [];
|
|
853
|
+
const changes = getChanges(stateManager);
|
|
854
|
+
const records = getRecords(stateManager);
|
|
855
|
+
records === null || records === void 0 ? void 0 : records.forEach(r => {
|
|
856
|
+
if (changes) {
|
|
857
|
+
const c = changes.get(r.__record__id__);
|
|
858
|
+
if (c) {
|
|
859
|
+
result.push(new Change(dataUnit, r, c, ChangeOperation.UPDATE));
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
});
|
|
863
|
+
const addedRecords = getAddedRecords(stateManager);
|
|
864
|
+
if (addedRecords) {
|
|
865
|
+
addedRecords.forEach(r => {
|
|
866
|
+
result.push(new Change(dataUnit, r, changes === null || changes === void 0 ? void 0 : changes.get(r.__record__id__), ChangeOperation.INSERT));
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
const removedRecords = getRemovedRecords(stateManager);
|
|
870
|
+
const recordsById = {};
|
|
871
|
+
records === null || records === void 0 ? void 0 : records.forEach(r => recordsById[r.__record__id__] = r);
|
|
872
|
+
if (removedRecords) {
|
|
873
|
+
removedRecords.forEach(id => {
|
|
874
|
+
result.push(new Change(dataUnit, recordsById[id], undefined, ChangeOperation.DELETE));
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
return result;
|
|
878
|
+
};
|
|
879
|
+
|
|
880
|
+
class CurrentRecordsReducerImpl {
|
|
881
|
+
constructor() {
|
|
882
|
+
this.sliceName = "currentRecords";
|
|
883
|
+
}
|
|
884
|
+
reduce(stateManager, _currentState, _action) {
|
|
885
|
+
let records = getRecords(stateManager);
|
|
886
|
+
const added = getAddedRecords(stateManager);
|
|
887
|
+
if (!records && !added) {
|
|
888
|
+
return undefined;
|
|
889
|
+
}
|
|
890
|
+
if (added) {
|
|
891
|
+
records = (records || []).concat(added);
|
|
892
|
+
}
|
|
893
|
+
const removedRecords = getRemovedRecords(stateManager);
|
|
894
|
+
if (removedRecords) {
|
|
895
|
+
records = records.filter(r => !removedRecords.includes(r.__record__id__));
|
|
896
|
+
}
|
|
897
|
+
const changes = getChanges(stateManager);
|
|
898
|
+
return new Map(records.map(r => {
|
|
899
|
+
const recordId = r.__record__id__;
|
|
900
|
+
const record = Object.assign(Object.assign({}, r), changes === null || changes === void 0 ? void 0 : changes.get(recordId));
|
|
901
|
+
return [recordId, record];
|
|
902
|
+
}));
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
const CurrentRecordsReducer = new CurrentRecordsReducerImpl();
|
|
906
|
+
const getCurrentRecords = (stateManager) => {
|
|
907
|
+
return stateManager.select(CurrentRecordsReducer.sliceName, (state) => state);
|
|
908
|
+
};
|
|
909
|
+
const getFieldValue = (stateManager, fieldName) => {
|
|
910
|
+
const selection = getSelection(stateManager);
|
|
911
|
+
if (selection && selection.length > 0) {
|
|
912
|
+
const currentRecords = getCurrentRecords(stateManager);
|
|
913
|
+
if (currentRecords) {
|
|
914
|
+
const record = currentRecords.get(selection[0]);
|
|
915
|
+
return record ? record[fieldName] : undefined;
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
return undefined;
|
|
919
|
+
};
|
|
920
|
+
|
|
921
|
+
class SelectionReducerImpl {
|
|
922
|
+
constructor() {
|
|
923
|
+
this.sliceName = "hist::selection";
|
|
924
|
+
}
|
|
925
|
+
reduce(stateManager, currentState, action) {
|
|
926
|
+
switch (action.type) {
|
|
927
|
+
case exports.Action.RECORDS_ADDED:
|
|
928
|
+
case exports.Action.RECORDS_COPIED:
|
|
929
|
+
return action.payload.map((r) => r.__record__id__);
|
|
930
|
+
case exports.Action.DATA_SAVED:
|
|
931
|
+
return updateSavedIds(stateManager, action.payload.records);
|
|
932
|
+
case exports.Action.RECORDS_REMOVED:
|
|
933
|
+
const removed = action.payload;
|
|
934
|
+
if (currentState && removed) {
|
|
935
|
+
return currentState.filter(recordId => !removed.includes(recordId));
|
|
936
|
+
}
|
|
937
|
+
return currentState;
|
|
938
|
+
case exports.Action.NEXT_SELECTED:
|
|
939
|
+
case exports.Action.PREVIOUS_SELECTED:
|
|
940
|
+
const currentRecords = getCurrentRecords(stateManager);
|
|
941
|
+
if (currentRecords && currentRecords.size > 0) {
|
|
942
|
+
let index;
|
|
943
|
+
if (!currentState || currentState.length === 0) {
|
|
944
|
+
index = action.type === exports.Action.PREVIOUS_SELECTED ? 0 : Math.min(1, currentRecords.size);
|
|
945
|
+
}
|
|
946
|
+
else {
|
|
947
|
+
index = getItemIndex(currentState[0], currentRecords) + (action.type === exports.Action.PREVIOUS_SELECTED ? -1 : 1);
|
|
948
|
+
}
|
|
949
|
+
if (index < currentRecords.size && index >= 0) {
|
|
950
|
+
return [Array.from(currentRecords.values())[index].__record__id__];
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
return undefined;
|
|
954
|
+
case exports.Action.SELECTION_CHANGED:
|
|
955
|
+
const { type, selection: selectionSource } = action.payload;
|
|
956
|
+
if (selectionSource && type === "index") {
|
|
957
|
+
const currentRecords = getCurrentRecords(stateManager);
|
|
958
|
+
if (currentRecords) {
|
|
959
|
+
const records = Array.from(currentRecords.values());
|
|
960
|
+
const selectionById = [];
|
|
961
|
+
selectionSource.forEach((i) => {
|
|
962
|
+
if (i > 0 && i < currentRecords.size) {
|
|
963
|
+
selectionById.push(records[i].__record__id__);
|
|
964
|
+
}
|
|
965
|
+
});
|
|
966
|
+
return selectionById;
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
return selectionSource;
|
|
970
|
+
}
|
|
971
|
+
return currentState;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
const SelectionReducer = new SelectionReducerImpl();
|
|
975
|
+
const getSelection = (stateManager) => {
|
|
976
|
+
let selection = stateManager.select(SelectionReducer.sliceName, (state) => state);
|
|
977
|
+
const currentRecords = Array.from((getCurrentRecords(stateManager) || new Map()).keys());
|
|
978
|
+
if (selection) {
|
|
979
|
+
selection = selection.filter(id => currentRecords.includes(id));
|
|
980
|
+
}
|
|
981
|
+
if (!selection || selection.length === 0) {
|
|
982
|
+
if (currentRecords && currentRecords.length > 0) {
|
|
983
|
+
return [currentRecords[0]];
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
return selection;
|
|
987
|
+
};
|
|
988
|
+
const hasNext = (stateManager) => {
|
|
989
|
+
const records = getCurrentRecords(stateManager);
|
|
990
|
+
if (records) {
|
|
991
|
+
const selection = stateManager.select(SelectionReducer.sliceName, (state) => state);
|
|
992
|
+
if (!selection || selection.length === 0) {
|
|
993
|
+
return records.size > 0;
|
|
994
|
+
}
|
|
995
|
+
return records.size > (getItemIndex(selection[0], records) + 1);
|
|
996
|
+
}
|
|
997
|
+
return false;
|
|
998
|
+
};
|
|
999
|
+
const hasPrevious = (stateManager) => {
|
|
1000
|
+
const records = getCurrentRecords(stateManager);
|
|
1001
|
+
if (records) {
|
|
1002
|
+
const selection = stateManager.select(SelectionReducer.sliceName, (state) => state);
|
|
1003
|
+
if (!selection || selection.length === 0) {
|
|
1004
|
+
return false;
|
|
1005
|
+
}
|
|
1006
|
+
return getItemIndex(selection[0], records) > 0;
|
|
1007
|
+
}
|
|
1008
|
+
return false;
|
|
1009
|
+
};
|
|
1010
|
+
function getItemIndex(key, map) {
|
|
1011
|
+
return Array.from(map.keys()).indexOf(key);
|
|
1012
|
+
}
|
|
1013
|
+
function updateSavedIds(stateManager, savedRecords) {
|
|
1014
|
+
const currentSelection = getSelection(stateManager);
|
|
1015
|
+
if (currentSelection) {
|
|
1016
|
+
const newSelection = [];
|
|
1017
|
+
currentSelection.forEach(id => {
|
|
1018
|
+
const record = savedRecords.find(r => r.__old__id__ === id);
|
|
1019
|
+
if (record) {
|
|
1020
|
+
newSelection.push(record.__record__id__);
|
|
1021
|
+
}
|
|
1022
|
+
else {
|
|
1023
|
+
newSelection.push(id);
|
|
1024
|
+
}
|
|
1025
|
+
});
|
|
1026
|
+
return newSelection;
|
|
1027
|
+
}
|
|
1028
|
+
return currentSelection;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
1032
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1033
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1034
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
1035
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
1036
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
1037
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1038
|
+
});
|
|
1039
|
+
};
|
|
1040
|
+
class DataUnit {
|
|
1041
|
+
constructor(name) {
|
|
1042
|
+
this._name = name;
|
|
1043
|
+
this._stateManager = new StateManager([
|
|
1044
|
+
HistReducer,
|
|
1045
|
+
UnitMetadataReducer,
|
|
1046
|
+
RecordsReducer,
|
|
1047
|
+
RemovedRecordsReducer,
|
|
1048
|
+
AddedRecordsReducer,
|
|
1049
|
+
SelectionReducer,
|
|
1050
|
+
ChangesReducer,
|
|
1051
|
+
CurrentRecordsReducer
|
|
1052
|
+
]);
|
|
1053
|
+
this._observers = [];
|
|
1054
|
+
this._filterProviders = [];
|
|
1055
|
+
this._sortingProvider = undefined;
|
|
1056
|
+
this._interceptors = [];
|
|
1057
|
+
}
|
|
1058
|
+
get name() {
|
|
1059
|
+
return this._name;
|
|
1060
|
+
}
|
|
1061
|
+
// Métodos privados
|
|
1062
|
+
validateAndTypeValue(fieldName, newValue) {
|
|
1063
|
+
//FIXME: Validações devem ser feitas aqui
|
|
1064
|
+
const descriptor = this.getField(fieldName);
|
|
1065
|
+
return descriptor ? convertType(descriptor.dataType, newValue) : newValue;
|
|
1066
|
+
}
|
|
1067
|
+
getFilters() {
|
|
1068
|
+
let filters = undefined;
|
|
1069
|
+
this._filterProviders.forEach(p => {
|
|
1070
|
+
const f = p.getFilter(this.name);
|
|
1071
|
+
if (f) {
|
|
1072
|
+
filters = (filters || []).concat(f);
|
|
1073
|
+
}
|
|
1074
|
+
});
|
|
1075
|
+
return filters;
|
|
1076
|
+
}
|
|
1077
|
+
getSort() {
|
|
1078
|
+
return this._sortingProvider ? this._sortingProvider.getSort(this._name) : undefined;
|
|
1079
|
+
}
|
|
1080
|
+
// Loaders
|
|
1081
|
+
loadMetadata() {
|
|
1082
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1083
|
+
this.dispatchAction(exports.Action.LOADING_METADATA);
|
|
1084
|
+
return new Promise((resolve, fail) => {
|
|
1085
|
+
if (this.metadataLoader) {
|
|
1086
|
+
this.metadataLoader(this).then(metadata => {
|
|
1087
|
+
this.metadata = metadata;
|
|
1088
|
+
resolve(this.metadata);
|
|
1089
|
+
}).catch(error => fail(error));
|
|
1090
|
+
}
|
|
1091
|
+
});
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
loadData() {
|
|
1095
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1096
|
+
this.dispatchAction(exports.Action.LOADING_DATA);
|
|
1097
|
+
return new Promise((resolve, fail) => {
|
|
1098
|
+
if (this.dataLoader) {
|
|
1099
|
+
const sort = this.getSort();
|
|
1100
|
+
const filters = this.getFilters();
|
|
1101
|
+
this.dataLoader(this, sort, filters).then(records => {
|
|
1102
|
+
this.records = records;
|
|
1103
|
+
resolve(this.records);
|
|
1104
|
+
}).catch(error => fail(error));
|
|
1105
|
+
}
|
|
1106
|
+
});
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
saveData() {
|
|
1110
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1111
|
+
const changes = getChangesToSave(this._name, this._stateManager);
|
|
1112
|
+
if (changes.length > 0) {
|
|
1113
|
+
this.dispatchAction(exports.Action.SAVING_DATA);
|
|
1114
|
+
return new Promise((resolve, fail) => {
|
|
1115
|
+
if (this.saveLoader) {
|
|
1116
|
+
this.saveLoader(this, changes).then(records => this.dispatchAction(exports.Action.DATA_SAVED, { changes, records })).catch(error => fail(error));
|
|
1117
|
+
}
|
|
1118
|
+
});
|
|
1119
|
+
}
|
|
1120
|
+
return Promise.resolve();
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
// API
|
|
1124
|
+
valueFromString(fieldName, value) {
|
|
1125
|
+
const descriptor = this.getField(fieldName);
|
|
1126
|
+
return descriptor ? convertType(descriptor.dataType, value) : value;
|
|
1127
|
+
}
|
|
1128
|
+
addInterceptor(interceptor) {
|
|
1129
|
+
this._interceptors.push(interceptor);
|
|
1130
|
+
}
|
|
1131
|
+
addFilterProvider(provider) {
|
|
1132
|
+
this._filterProviders.push(provider);
|
|
1133
|
+
}
|
|
1134
|
+
set sortingProvider(provider) {
|
|
1135
|
+
this._sortingProvider = provider;
|
|
1136
|
+
}
|
|
1137
|
+
set metadata(md) {
|
|
1138
|
+
this.dispatchAction(exports.Action.METADATA_LOADED, md);
|
|
1139
|
+
}
|
|
1140
|
+
get metadata() {
|
|
1141
|
+
return getMetadata(this._stateManager);
|
|
1142
|
+
}
|
|
1143
|
+
set records(r) {
|
|
1144
|
+
this.dispatchAction(exports.Action.DATA_LOADED, r);
|
|
1145
|
+
}
|
|
1146
|
+
get records() {
|
|
1147
|
+
const records = getCurrentRecords(this._stateManager);
|
|
1148
|
+
return records ? Array.from(records.values()) : [];
|
|
1149
|
+
}
|
|
1150
|
+
getField(fieldName) {
|
|
1151
|
+
return getField(this._stateManager, fieldName);
|
|
1152
|
+
}
|
|
1153
|
+
addRecord() {
|
|
1154
|
+
this.dispatchAction(exports.Action.RECORDS_ADDED, prepareAddedRecordId(this._stateManager, [{}]));
|
|
1155
|
+
}
|
|
1156
|
+
copySelected() {
|
|
1157
|
+
const selectedRecords = this.getSelectedRecords();
|
|
1158
|
+
if (selectedRecords) {
|
|
1159
|
+
this.dispatchAction(exports.Action.RECORDS_COPIED, prepareAddedRecordId(this._stateManager, selectedRecords));
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
removeSelectedRecords() {
|
|
1163
|
+
const selection = getSelection(this._stateManager);
|
|
1164
|
+
if (selection) {
|
|
1165
|
+
this.dispatchAction(exports.Action.RECORDS_REMOVED, selection);
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
getFieldValue(fieldName) {
|
|
1169
|
+
return getFieldValue(this._stateManager, fieldName);
|
|
1170
|
+
}
|
|
1171
|
+
setFieldValue(fieldName, newValue, records) {
|
|
1172
|
+
const typedValue = this.validateAndTypeValue(fieldName, newValue);
|
|
1173
|
+
const currentValue = this.getFieldValue(fieldName);
|
|
1174
|
+
if (currentValue !== typedValue) {
|
|
1175
|
+
this.dispatchAction(exports.Action.DATA_CHANGED, { [fieldName]: typedValue, records });
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
getSelection() {
|
|
1179
|
+
return getSelection(this._stateManager);
|
|
1180
|
+
}
|
|
1181
|
+
setSelection(selection) {
|
|
1182
|
+
this.dispatchAction(exports.Action.SELECTION_CHANGED, { type: "id", selection });
|
|
1183
|
+
}
|
|
1184
|
+
setSelectionByIndex(selection) {
|
|
1185
|
+
this.dispatchAction(exports.Action.SELECTION_CHANGED, { type: "index", selection });
|
|
1186
|
+
}
|
|
1187
|
+
getSelectedRecords() {
|
|
1188
|
+
const selection = this.getSelection();
|
|
1189
|
+
if (selection) {
|
|
1190
|
+
const currentRecords = this.records;
|
|
1191
|
+
return currentRecords === null || currentRecords === void 0 ? void 0 : currentRecords.filter(r => selection.includes(r.__record__id__));
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
nextRecord() {
|
|
1195
|
+
this.dispatchAction(exports.Action.NEXT_SELECTED);
|
|
1196
|
+
}
|
|
1197
|
+
previousRecord() {
|
|
1198
|
+
this.dispatchAction(exports.Action.PREVIOUS_SELECTED);
|
|
1199
|
+
}
|
|
1200
|
+
cancelEdition() {
|
|
1201
|
+
this.dispatchAction(exports.Action.EDITION_CANCELED);
|
|
1202
|
+
}
|
|
1203
|
+
isDirty() {
|
|
1204
|
+
return isDirty(this._stateManager);
|
|
1205
|
+
}
|
|
1206
|
+
hasNext() {
|
|
1207
|
+
return hasNext(this._stateManager);
|
|
1208
|
+
}
|
|
1209
|
+
hasPrevious() {
|
|
1210
|
+
return hasPrevious(this._stateManager);
|
|
1211
|
+
}
|
|
1212
|
+
canUndo() {
|
|
1213
|
+
return canUndo(this._stateManager);
|
|
1214
|
+
}
|
|
1215
|
+
canRedo() {
|
|
1216
|
+
return canRedo(this._stateManager);
|
|
1217
|
+
}
|
|
1218
|
+
undo() {
|
|
1219
|
+
this.dispatchAction(exports.Action.CHANGE_UNDONE);
|
|
1220
|
+
}
|
|
1221
|
+
redo() {
|
|
1222
|
+
this.dispatchAction(exports.Action.CHANGE_REDONE);
|
|
1223
|
+
}
|
|
1224
|
+
toString() {
|
|
1225
|
+
return this.name;
|
|
1226
|
+
}
|
|
1227
|
+
// Actions / State manager
|
|
1228
|
+
dispatchAction(actionType, payload) {
|
|
1229
|
+
var _a;
|
|
1230
|
+
let action = new DataUnitAction(actionType, payload);
|
|
1231
|
+
(_a = this._interceptors) === null || _a === void 0 ? void 0 : _a.forEach(interceptor => {
|
|
1232
|
+
if (action) {
|
|
1233
|
+
action = interceptor.interceptAction(action);
|
|
1234
|
+
}
|
|
1235
|
+
});
|
|
1236
|
+
if (action) {
|
|
1237
|
+
this._stateManager.process(action);
|
|
1238
|
+
this._observers.forEach(f => f(action));
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
subscribe(observer) {
|
|
1242
|
+
this._observers.push(observer);
|
|
1243
|
+
}
|
|
1244
|
+
unsubscribe(observer) {
|
|
1245
|
+
this._observers = this._observers.filter(f => f !== observer);
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
var ChangeOperation;
|
|
1249
|
+
(function (ChangeOperation) {
|
|
1250
|
+
ChangeOperation["INSERT"] = "INSERT";
|
|
1251
|
+
ChangeOperation["UPDATE"] = "UPDATE";
|
|
1252
|
+
ChangeOperation["DELETE"] = "DELETE";
|
|
1253
|
+
})(ChangeOperation || (ChangeOperation = {}));
|
|
1254
|
+
class Change {
|
|
1255
|
+
constructor(dataUnit, record, updates, operation) {
|
|
1256
|
+
this.dataUnit = dataUnit;
|
|
1257
|
+
this.record = record;
|
|
1258
|
+
this.updatingFields = updates;
|
|
1259
|
+
this._operation = operation;
|
|
1260
|
+
}
|
|
1261
|
+
get operation() {
|
|
1262
|
+
return this._operation.toString();
|
|
1263
|
+
}
|
|
1264
|
+
isInsert() {
|
|
1265
|
+
return this._operation === ChangeOperation.INSERT;
|
|
1266
|
+
}
|
|
1267
|
+
isDelete() {
|
|
1268
|
+
return this._operation === ChangeOperation.DELETE;
|
|
1269
|
+
}
|
|
1270
|
+
isUpdate() {
|
|
1271
|
+
return this._operation === ChangeOperation.UPDATE;
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
exports.SortMode = void 0;
|
|
1276
|
+
(function (SortMode) {
|
|
1277
|
+
SortMode["ASC"] = "ASC";
|
|
1278
|
+
SortMode["DESC"] = "DESC";
|
|
1279
|
+
})(exports.SortMode || (exports.SortMode = {}));
|
|
1280
|
+
var DependencyType;
|
|
1281
|
+
(function (DependencyType) {
|
|
1282
|
+
DependencyType["SEARCHING"] = "SEARCHING";
|
|
1283
|
+
DependencyType["REQUIREMENT"] = "REQUIREMENT";
|
|
1284
|
+
DependencyType["VISIBILITY"] = "REQUIREMENT";
|
|
1285
|
+
})(DependencyType || (DependencyType = {}));
|
|
1286
|
+
exports.UserInterface = void 0;
|
|
1287
|
+
(function (UserInterface) {
|
|
1288
|
+
UserInterface["FILE"] = "FILE";
|
|
1289
|
+
UserInterface["IMAGE"] = "IMAGE";
|
|
1290
|
+
UserInterface["DATE"] = "DATE";
|
|
1291
|
+
UserInterface["DATETIME"] = "DATETIME";
|
|
1292
|
+
UserInterface["ELAPSEDTIME"] = "ELAPSEDTIME";
|
|
1293
|
+
UserInterface["CHECKBOX"] = "CHECKBOX";
|
|
1294
|
+
UserInterface["SWITCH"] = "SWITCH";
|
|
1295
|
+
UserInterface["OPTIONSELECTOR"] = "OPTIONSELECTOR";
|
|
1296
|
+
UserInterface["DECIMALNUMBER"] = "DECIMALNUMBER";
|
|
1297
|
+
UserInterface["INTEGERNUMBER"] = "INTEGERNUMBER";
|
|
1298
|
+
UserInterface["SEARCH"] = "SEARCH";
|
|
1299
|
+
UserInterface["SHORTTEXT"] = "SHORTTEXT";
|
|
1300
|
+
UserInterface["PASSWORD"] = "PASSWORD";
|
|
1301
|
+
UserInterface["MASKEDTEXT"] = "MASKEDTEXT";
|
|
1302
|
+
UserInterface["LONGTEXT"] = "LONGTEXT";
|
|
1303
|
+
UserInterface["HTML"] = "HTML";
|
|
1304
|
+
})(exports.UserInterface || (exports.UserInterface = {}));
|
|
1305
|
+
|
|
1306
|
+
exports.DataUnit = DataUnit;
|
|
1307
|
+
exports.DataUnitAction = DataUnitAction;
|
|
1308
|
+
exports.MaskFormatter = MaskFormatter;
|
|
1309
|
+
exports.NumberUtils = NumberUtils;
|
|
1310
|
+
exports.TimeFormatter = TimeFormatter;
|