@sankhyalabs/core 0.0.0-bugfix-dev-KB-44620.0 → 0.0.0-bugfix-dev-KB-53946.0
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/.docs/classes/Change.md +11 -11
- package/.docs/classes/DataUnit.md +180 -130
- package/.docs/classes/IDBRepository.md +22 -0
- package/.docs/classes/MaskFormatter.md +13 -9
- package/.docs/classes/SelectionInfo.md +25 -11
- package/.docs/enumerations/ChangeOperation.md +4 -4
- package/.docs/enumerations/SelectionMode.md +2 -2
- package/.docs/interfaces/DUActionInterceptor.md +1 -1
- package/.docs/interfaces/IRepository.md +18 -0
- package/.docs/interfaces/LoadDataRequest.md +1 -1
- package/.docs/interfaces/PageRequest.md +3 -3
- package/.docs/interfaces/QuickFilter.md +3 -3
- package/.docs/interfaces/Record.md +4 -4
- package/.docs/interfaces/SavedRecord.md +5 -5
- package/.docs/interfaces/WaitingChange.md +3 -3
- package/.docs/namespaces/MaskFormatter/type-aliases/MaskCharacter.md +1 -1
- package/.docs/namespaces/MaskFormatter/variables/MaskCharacter.md +1 -1
- package/.docs/type-aliases/DataUnitEventOptions.md +1 -1
- package/dist/dataunit/DataUnit.d.ts +16 -4
- package/dist/dataunit/DataUnit.js +41 -8
- package/dist/dataunit/DataUnit.js.map +1 -1
- package/dist/dataunit/formatting/PrettyFormatter.js +2 -2
- package/dist/dataunit/formatting/PrettyFormatter.js.map +1 -1
- package/dist/dataunit/loading/LoadDataRequest.d.ts +1 -1
- package/dist/dataunit/state/slice/SelectionSlice.js +2 -2
- package/dist/dataunit/state/slice/SelectionSlice.js.map +1 -1
- package/dist/repository/IRepository.d.ts +6 -0
- package/dist/repository/indexeddb/IDBRepository.d.ts +1 -0
- package/dist/repository/indexeddb/IDBRepository.js +3 -0
- package/dist/repository/indexeddb/IDBRepository.js.map +1 -1
- package/dist/utils/MaskFormatter.d.ts +2 -1
- package/dist/utils/MaskFormatter.js +5 -1
- package/dist/utils/MaskFormatter.js.map +1 -1
- package/dist/utils/SortingUtils.d.ts +9 -0
- package/dist/utils/SortingUtils.js +24 -0
- package/dist/utils/SortingUtils.js.map +1 -0
- package/package.json +1 -1
- package/reports/test-report.xml +73 -73
- package/src/dataunit/DataUnit.ts +56 -18
- package/src/dataunit/formatting/PrettyFormatter.ts +2 -2
- package/src/dataunit/loading/LoadDataRequest.ts +1 -1
- package/src/dataunit/state/slice/SelectionSlice.ts +2 -2
- package/src/repository/IRepository.ts +7 -0
- package/src/repository/indexeddb/IDBRepository.ts +4 -0
- package/src/utils/MaskFormatter.ts +5 -1
- package/src/utils/SortingUtils.ts +30 -0
|
@@ -279,6 +279,28 @@ src/repository/indexeddb/IDBRepository.ts:319
|
|
|
279
279
|
|
|
280
280
|
***
|
|
281
281
|
|
|
282
|
+
### getFromCache()
|
|
283
|
+
|
|
284
|
+
> **getFromCache**(): `undefined` \| `T`[]
|
|
285
|
+
|
|
286
|
+
Retorna todos os registros que estão em cache no momento
|
|
287
|
+
|
|
288
|
+
#### Returns
|
|
289
|
+
|
|
290
|
+
`undefined` \| `T`[]
|
|
291
|
+
|
|
292
|
+
Todos registros que estão em cache no momento
|
|
293
|
+
|
|
294
|
+
#### Implementation of
|
|
295
|
+
|
|
296
|
+
[`IRepository`](../interfaces/IRepository.md).[`getFromCache`](../interfaces/IRepository.md#getfromcache)
|
|
297
|
+
|
|
298
|
+
#### Source
|
|
299
|
+
|
|
300
|
+
src/repository/indexeddb/IDBRepository.ts:324
|
|
301
|
+
|
|
302
|
+
***
|
|
303
|
+
|
|
282
304
|
### getItemPosition()
|
|
283
305
|
|
|
284
306
|
> `private` **getItemPosition**(`db`, `itemTest`): `Promise`\<`number`\>
|
|
@@ -129,7 +129,7 @@ src/utils/MaskFormatter.ts:55
|
|
|
129
129
|
|
|
130
130
|
#### Source
|
|
131
131
|
|
|
132
|
-
src/utils/MaskFormatter.ts:
|
|
132
|
+
src/utils/MaskFormatter.ts:379
|
|
133
133
|
|
|
134
134
|
***
|
|
135
135
|
|
|
@@ -149,7 +149,7 @@ src/utils/MaskFormatter.ts:54
|
|
|
149
149
|
|
|
150
150
|
#### Source
|
|
151
151
|
|
|
152
|
-
src/utils/MaskFormatter.ts:
|
|
152
|
+
src/utils/MaskFormatter.ts:393
|
|
153
153
|
|
|
154
154
|
***
|
|
155
155
|
|
|
@@ -179,7 +179,7 @@ src/utils/MaskFormatter.ts:49
|
|
|
179
179
|
|
|
180
180
|
#### Source
|
|
181
181
|
|
|
182
|
-
src/utils/MaskFormatter.ts:
|
|
182
|
+
src/utils/MaskFormatter.ts:304
|
|
183
183
|
|
|
184
184
|
***
|
|
185
185
|
|
|
@@ -209,7 +209,7 @@ src/utils/MaskFormatter.ts:52
|
|
|
209
209
|
|
|
210
210
|
#### Source
|
|
211
211
|
|
|
212
|
-
src/utils/MaskFormatter.ts:
|
|
212
|
+
src/utils/MaskFormatter.ts:285
|
|
213
213
|
|
|
214
214
|
***
|
|
215
215
|
|
|
@@ -219,7 +219,7 @@ src/utils/MaskFormatter.ts:281
|
|
|
219
219
|
|
|
220
220
|
#### Source
|
|
221
221
|
|
|
222
|
-
src/utils/MaskFormatter.ts:
|
|
222
|
+
src/utils/MaskFormatter.ts:356
|
|
223
223
|
|
|
224
224
|
***
|
|
225
225
|
|
|
@@ -239,7 +239,7 @@ src/utils/MaskFormatter.ts:51
|
|
|
239
239
|
|
|
240
240
|
#### Source
|
|
241
241
|
|
|
242
|
-
src/utils/MaskFormatter.ts:
|
|
242
|
+
src/utils/MaskFormatter.ts:333
|
|
243
243
|
|
|
244
244
|
## Accessors
|
|
245
245
|
|
|
@@ -271,7 +271,7 @@ src/utils/MaskFormatter.ts:87
|
|
|
271
271
|
|
|
272
272
|
### format()
|
|
273
273
|
|
|
274
|
-
> **format**(`value`): `string`
|
|
274
|
+
> **format**(`value`, `trimBefore`): `string`
|
|
275
275
|
|
|
276
276
|
Formata a string passada baseada na máscara definda pelo atributo mask.
|
|
277
277
|
|
|
@@ -281,6 +281,10 @@ Formata a string passada baseada na máscara definda pelo atributo mask.
|
|
|
281
281
|
|
|
282
282
|
Valor a ser formatado.
|
|
283
283
|
|
|
284
|
+
• **trimBefore**: `boolean`= `false`
|
|
285
|
+
|
|
286
|
+
Executa um trim para remover espaços em branco.
|
|
287
|
+
|
|
284
288
|
#### Returns
|
|
285
289
|
|
|
286
290
|
`string`
|
|
@@ -289,7 +293,7 @@ O valor processado de acordo com o padrão.
|
|
|
289
293
|
|
|
290
294
|
#### Source
|
|
291
295
|
|
|
292
|
-
src/utils/MaskFormatter.ts:
|
|
296
|
+
src/utils/MaskFormatter.ts:102
|
|
293
297
|
|
|
294
298
|
***
|
|
295
299
|
|
|
@@ -305,4 +309,4 @@ Prepara a formatação internamente de acordo com o padrão.
|
|
|
305
309
|
|
|
306
310
|
#### Source
|
|
307
311
|
|
|
308
|
-
src/utils/MaskFormatter.ts:
|
|
312
|
+
src/utils/MaskFormatter.ts:122
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
|
|
31
31
|
#### Source
|
|
32
32
|
|
|
33
|
-
src/dataunit/DataUnit.ts:
|
|
33
|
+
src/dataunit/DataUnit.ts:1960
|
|
34
34
|
|
|
35
35
|
## Properties
|
|
36
36
|
|
|
@@ -40,7 +40,7 @@ src/dataunit/DataUnit.ts:1925
|
|
|
40
40
|
|
|
41
41
|
#### Source
|
|
42
42
|
|
|
43
|
-
src/dataunit/DataUnit.ts:
|
|
43
|
+
src/dataunit/DataUnit.ts:1957
|
|
44
44
|
|
|
45
45
|
***
|
|
46
46
|
|
|
@@ -50,7 +50,7 @@ src/dataunit/DataUnit.ts:1919
|
|
|
50
50
|
|
|
51
51
|
#### Source
|
|
52
52
|
|
|
53
|
-
src/dataunit/DataUnit.ts:
|
|
53
|
+
src/dataunit/DataUnit.ts:1958
|
|
54
54
|
|
|
55
55
|
***
|
|
56
56
|
|
|
@@ -60,7 +60,21 @@ src/dataunit/DataUnit.ts:1921
|
|
|
60
60
|
|
|
61
61
|
#### Source
|
|
62
62
|
|
|
63
|
-
src/dataunit/DataUnit.ts:
|
|
63
|
+
src/dataunit/DataUnit.ts:1954
|
|
64
|
+
|
|
65
|
+
***
|
|
66
|
+
|
|
67
|
+
### getAllRecords()?
|
|
68
|
+
|
|
69
|
+
> `optional` **getAllRecords**: () => `undefined` \| [`Record`](../interfaces/Record.md)[]
|
|
70
|
+
|
|
71
|
+
#### Returns
|
|
72
|
+
|
|
73
|
+
`undefined` \| [`Record`](../interfaces/Record.md)[]
|
|
74
|
+
|
|
75
|
+
#### Source
|
|
76
|
+
|
|
77
|
+
src/dataunit/DataUnit.ts:1956
|
|
64
78
|
|
|
65
79
|
***
|
|
66
80
|
|
|
@@ -70,7 +84,7 @@ src/dataunit/DataUnit.ts:1922
|
|
|
70
84
|
|
|
71
85
|
#### Source
|
|
72
86
|
|
|
73
|
-
src/dataunit/DataUnit.ts:
|
|
87
|
+
src/dataunit/DataUnit.ts:1953
|
|
74
88
|
|
|
75
89
|
***
|
|
76
90
|
|
|
@@ -80,7 +94,7 @@ src/dataunit/DataUnit.ts:1920
|
|
|
80
94
|
|
|
81
95
|
#### Source
|
|
82
96
|
|
|
83
|
-
src/dataunit/DataUnit.ts:
|
|
97
|
+
src/dataunit/DataUnit.ts:1955
|
|
84
98
|
|
|
85
99
|
## Accessors
|
|
86
100
|
|
|
@@ -94,7 +108,7 @@ src/dataunit/DataUnit.ts:1923
|
|
|
94
108
|
|
|
95
109
|
#### Source
|
|
96
110
|
|
|
97
|
-
src/dataunit/DataUnit.ts:
|
|
111
|
+
src/dataunit/DataUnit.ts:1988
|
|
98
112
|
|
|
99
113
|
***
|
|
100
114
|
|
|
@@ -108,7 +122,7 @@ src/dataunit/DataUnit.ts:1950
|
|
|
108
122
|
|
|
109
123
|
#### Source
|
|
110
124
|
|
|
111
|
-
src/dataunit/DataUnit.ts:
|
|
125
|
+
src/dataunit/DataUnit.ts:1978
|
|
112
126
|
|
|
113
127
|
***
|
|
114
128
|
|
|
@@ -122,7 +136,7 @@ src/dataunit/DataUnit.ts:1940
|
|
|
122
136
|
|
|
123
137
|
#### Source
|
|
124
138
|
|
|
125
|
-
src/dataunit/DataUnit.ts:
|
|
139
|
+
src/dataunit/DataUnit.ts:1968
|
|
126
140
|
|
|
127
141
|
## Methods
|
|
128
142
|
|
|
@@ -136,7 +150,7 @@ src/dataunit/DataUnit.ts:1933
|
|
|
136
150
|
|
|
137
151
|
#### Source
|
|
138
152
|
|
|
139
|
-
src/dataunit/DataUnit.ts:
|
|
153
|
+
src/dataunit/DataUnit.ts:1995
|
|
140
154
|
|
|
141
155
|
***
|
|
142
156
|
|
|
@@ -150,4 +164,4 @@ src/dataunit/DataUnit.ts:1957
|
|
|
150
164
|
|
|
151
165
|
#### Source
|
|
152
166
|
|
|
153
|
-
src/dataunit/DataUnit.ts:
|
|
167
|
+
src/dataunit/DataUnit.ts:1999
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
#### Source
|
|
16
16
|
|
|
17
|
-
src/dataunit/DataUnit.ts:
|
|
17
|
+
src/dataunit/DataUnit.ts:1839
|
|
18
18
|
|
|
19
19
|
***
|
|
20
20
|
|
|
@@ -24,7 +24,7 @@ src/dataunit/DataUnit.ts:1805
|
|
|
24
24
|
|
|
25
25
|
#### Source
|
|
26
26
|
|
|
27
|
-
src/dataunit/DataUnit.ts:
|
|
27
|
+
src/dataunit/DataUnit.ts:1841
|
|
28
28
|
|
|
29
29
|
***
|
|
30
30
|
|
|
@@ -34,7 +34,7 @@ src/dataunit/DataUnit.ts:1807
|
|
|
34
34
|
|
|
35
35
|
#### Source
|
|
36
36
|
|
|
37
|
-
src/dataunit/DataUnit.ts:
|
|
37
|
+
src/dataunit/DataUnit.ts:1838
|
|
38
38
|
|
|
39
39
|
***
|
|
40
40
|
|
|
@@ -44,4 +44,4 @@ src/dataunit/DataUnit.ts:1804
|
|
|
44
44
|
|
|
45
45
|
#### Source
|
|
46
46
|
|
|
47
|
-
src/dataunit/DataUnit.ts:
|
|
47
|
+
src/dataunit/DataUnit.ts:1840
|
|
@@ -96,6 +96,24 @@ src/repository/IRepository.ts:23
|
|
|
96
96
|
|
|
97
97
|
***
|
|
98
98
|
|
|
99
|
+
### getFromCache()
|
|
100
|
+
|
|
101
|
+
> **getFromCache**(): `undefined` \| `T`[]
|
|
102
|
+
|
|
103
|
+
Retorna todos os registros que estão em cache no momento
|
|
104
|
+
|
|
105
|
+
#### Returns
|
|
106
|
+
|
|
107
|
+
`undefined` \| `T`[]
|
|
108
|
+
|
|
109
|
+
Todos registros que estão em cache no momento
|
|
110
|
+
|
|
111
|
+
#### Source
|
|
112
|
+
|
|
113
|
+
src/repository/IRepository.ts:88
|
|
114
|
+
|
|
115
|
+
***
|
|
116
|
+
|
|
99
117
|
### insert()
|
|
100
118
|
|
|
101
119
|
> **insert**(`itemReference`, `items`): `Promise`\<`void`\>
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
#### Source
|
|
16
16
|
|
|
17
|
-
src/dataunit/DataUnit.ts:
|
|
17
|
+
src/dataunit/DataUnit.ts:1927
|
|
18
18
|
|
|
19
19
|
***
|
|
20
20
|
|
|
@@ -24,7 +24,7 @@ src/dataunit/DataUnit.ts:1893
|
|
|
24
24
|
|
|
25
25
|
#### Source
|
|
26
26
|
|
|
27
|
-
src/dataunit/DataUnit.ts:
|
|
27
|
+
src/dataunit/DataUnit.ts:1928
|
|
28
28
|
|
|
29
29
|
***
|
|
30
30
|
|
|
@@ -34,4 +34,4 @@ src/dataunit/DataUnit.ts:1894
|
|
|
34
34
|
|
|
35
35
|
#### Source
|
|
36
36
|
|
|
37
|
-
src/dataunit/DataUnit.ts:
|
|
37
|
+
src/dataunit/DataUnit.ts:1929
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
#### Source
|
|
16
16
|
|
|
17
|
-
src/dataunit/DataUnit.ts:
|
|
17
|
+
src/dataunit/DataUnit.ts:1934
|
|
18
18
|
|
|
19
19
|
***
|
|
20
20
|
|
|
@@ -24,7 +24,7 @@ src/dataunit/DataUnit.ts:1900
|
|
|
24
24
|
|
|
25
25
|
#### Source
|
|
26
26
|
|
|
27
|
-
src/dataunit/DataUnit.ts:
|
|
27
|
+
src/dataunit/DataUnit.ts:1935
|
|
28
28
|
|
|
29
29
|
***
|
|
30
30
|
|
|
@@ -34,4 +34,4 @@ src/dataunit/DataUnit.ts:1901
|
|
|
34
34
|
|
|
35
35
|
#### Source
|
|
36
36
|
|
|
37
|
-
src/dataunit/DataUnit.ts:
|
|
37
|
+
src/dataunit/DataUnit.ts:1933
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
#### Source
|
|
24
24
|
|
|
25
|
-
src/dataunit/DataUnit.ts:
|
|
25
|
+
src/dataunit/DataUnit.ts:1829
|
|
26
26
|
|
|
27
27
|
***
|
|
28
28
|
|
|
@@ -32,7 +32,7 @@ src/dataunit/DataUnit.ts:1795
|
|
|
32
32
|
|
|
33
33
|
#### Source
|
|
34
34
|
|
|
35
|
-
src/dataunit/DataUnit.ts:
|
|
35
|
+
src/dataunit/DataUnit.ts:1828
|
|
36
36
|
|
|
37
37
|
***
|
|
38
38
|
|
|
@@ -42,7 +42,7 @@ src/dataunit/DataUnit.ts:1794
|
|
|
42
42
|
|
|
43
43
|
#### Source
|
|
44
44
|
|
|
45
|
-
src/dataunit/DataUnit.ts:
|
|
45
|
+
src/dataunit/DataUnit.ts:1826
|
|
46
46
|
|
|
47
47
|
***
|
|
48
48
|
|
|
@@ -52,4 +52,4 @@ src/dataunit/DataUnit.ts:1792
|
|
|
52
52
|
|
|
53
53
|
#### Source
|
|
54
54
|
|
|
55
|
-
src/dataunit/DataUnit.ts:
|
|
55
|
+
src/dataunit/DataUnit.ts:1827
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
#### Source
|
|
20
20
|
|
|
21
|
-
src/dataunit/DataUnit.ts:
|
|
21
|
+
src/dataunit/DataUnit.ts:1834
|
|
22
22
|
|
|
23
23
|
***
|
|
24
24
|
|
|
@@ -32,7 +32,7 @@ src/dataunit/DataUnit.ts:1800
|
|
|
32
32
|
|
|
33
33
|
#### Source
|
|
34
34
|
|
|
35
|
-
src/dataunit/DataUnit.ts:
|
|
35
|
+
src/dataunit/DataUnit.ts:1829
|
|
36
36
|
|
|
37
37
|
***
|
|
38
38
|
|
|
@@ -46,7 +46,7 @@ src/dataunit/DataUnit.ts:1795
|
|
|
46
46
|
|
|
47
47
|
#### Source
|
|
48
48
|
|
|
49
|
-
src/dataunit/DataUnit.ts:
|
|
49
|
+
src/dataunit/DataUnit.ts:1828
|
|
50
50
|
|
|
51
51
|
***
|
|
52
52
|
|
|
@@ -60,7 +60,7 @@ src/dataunit/DataUnit.ts:1794
|
|
|
60
60
|
|
|
61
61
|
#### Source
|
|
62
62
|
|
|
63
|
-
src/dataunit/DataUnit.ts:
|
|
63
|
+
src/dataunit/DataUnit.ts:1826
|
|
64
64
|
|
|
65
65
|
***
|
|
66
66
|
|
|
@@ -74,4 +74,4 @@ src/dataunit/DataUnit.ts:1792
|
|
|
74
74
|
|
|
75
75
|
#### Source
|
|
76
76
|
|
|
77
|
-
src/dataunit/DataUnit.ts:
|
|
77
|
+
src/dataunit/DataUnit.ts:1827
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
#### Source
|
|
16
16
|
|
|
17
|
-
src/dataunit/DataUnit.ts:
|
|
17
|
+
src/dataunit/DataUnit.ts:1922
|
|
18
18
|
|
|
19
19
|
***
|
|
20
20
|
|
|
@@ -24,7 +24,7 @@ src/dataunit/DataUnit.ts:1888
|
|
|
24
24
|
|
|
25
25
|
#### Source
|
|
26
26
|
|
|
27
|
-
src/dataunit/DataUnit.ts:
|
|
27
|
+
src/dataunit/DataUnit.ts:1923
|
|
28
28
|
|
|
29
29
|
***
|
|
30
30
|
|
|
@@ -34,4 +34,4 @@ src/dataunit/DataUnit.ts:1889
|
|
|
34
34
|
|
|
35
35
|
#### Source
|
|
36
36
|
|
|
37
|
-
src/dataunit/DataUnit.ts:
|
|
37
|
+
src/dataunit/DataUnit.ts:1921
|
|
@@ -8,6 +8,7 @@ import { PaginationInfo } from "./loading/PaginationInfo.js";
|
|
|
8
8
|
*/
|
|
9
9
|
export default class DataUnit {
|
|
10
10
|
static CHANGING_PAGE_LOADING_SOURCE: string;
|
|
11
|
+
static ALL_RECORDS_SELECTION_SOURCE: string;
|
|
11
12
|
static DEFAULT_DATAUNIT_NAME: string;
|
|
12
13
|
private _uuid;
|
|
13
14
|
private _name;
|
|
@@ -28,6 +29,7 @@ export default class DataUnit {
|
|
|
28
29
|
saveLoader?: (dataUnit: DataUnit, changes: Array<Change>) => Promise<Array<SavedRecord>>;
|
|
29
30
|
removeLoader?: (dataUnit: DataUnit, recordIds: Array<string>) => Promise<Array<string>>;
|
|
30
31
|
recordLoader?: (dataUnit: DataUnit, recordIds: Array<string>) => Promise<Array<Record>>;
|
|
32
|
+
allRecordsLoader?: (dataUnit: DataUnit) => Array<Record> | undefined;
|
|
31
33
|
constructor(name?: string, parentDataUnit?: DataUnit);
|
|
32
34
|
/**
|
|
33
35
|
* Desfaz vinculos do DataUnit. Chamado quando o DU não é mais necessário.
|
|
@@ -557,7 +559,7 @@ export default class DataUnit {
|
|
|
557
559
|
* @returns - Objeto com informações como registros selecionados e seleção por critério.
|
|
558
560
|
*
|
|
559
561
|
**/
|
|
560
|
-
getSelectionInfo(): SelectionInfo
|
|
562
|
+
getSelectionInfo(): SelectionInfo;
|
|
561
563
|
/**
|
|
562
564
|
*
|
|
563
565
|
* Retorna apenas um registro selecionado no Dataunit
|
|
@@ -603,10 +605,19 @@ export default class DataUnit {
|
|
|
603
605
|
*
|
|
604
606
|
* Retorna se existe algum tipo de alteração pendente.
|
|
605
607
|
*
|
|
608
|
+
* @param ignoreChildren: Define se deverá ignorar alterações pendentes no DataUnit filho.
|
|
606
609
|
* @returns Verdadeiro se existir alterações pendentes.
|
|
607
610
|
*
|
|
608
611
|
*/
|
|
609
|
-
isDirty(): boolean;
|
|
612
|
+
isDirty(ignoreChildren?: boolean): boolean;
|
|
613
|
+
/**
|
|
614
|
+
*
|
|
615
|
+
* Retorna se existe alterações pendentes no DataUnit pai.
|
|
616
|
+
*
|
|
617
|
+
* @returns Verdadeiro se existir alterações pendentes e Falso caso não exista alterações ou não exista DataUnit pai.
|
|
618
|
+
*
|
|
619
|
+
*/
|
|
620
|
+
isParentDirty(): boolean;
|
|
610
621
|
/**
|
|
611
622
|
*
|
|
612
623
|
* Retorna se existe algum DataUnit detail com alterações pendentes.
|
|
@@ -978,11 +989,12 @@ export declare enum SelectionMode {
|
|
|
978
989
|
SOME_RECORDS = "SOME_RECORDS"
|
|
979
990
|
}
|
|
980
991
|
export declare class SelectionInfo {
|
|
981
|
-
private _records;
|
|
982
992
|
mode: SelectionMode;
|
|
983
|
-
private _total?;
|
|
984
993
|
filters?: Array<Filter>;
|
|
985
994
|
sort?: Array<Sort>;
|
|
995
|
+
getAllRecords?: () => Array<Record> | undefined;
|
|
996
|
+
private _records;
|
|
997
|
+
private _total?;
|
|
986
998
|
constructor(records: Array<Record>, mode?: SelectionMode, total?: number, filters?: Array<Filter>, sort?: Array<Sort>);
|
|
987
999
|
get records(): Array<Record> | undefined;
|
|
988
1000
|
get recordIds(): Array<string> | undefined;
|
|
@@ -29,6 +29,7 @@ import { v4 as uuid } from "uuid";
|
|
|
29
29
|
import { DataUnitStorage } from "./DataUnitStorage.js";
|
|
30
30
|
import { getInvalidFieldMessage, InvalidFieldsReducer } from "./state/slice/InvalidFieldsSlice.js";
|
|
31
31
|
import { getLoadingProperties, LoadingPropertiesReducer } from "./state/slice/LoadingProperties.js";
|
|
32
|
+
import SortingUtils from "../utils/SortingUtils.js";
|
|
32
33
|
/***
|
|
33
34
|
* `DataUnit`: Atua como uma camada de abstração entre o back-end e a interface do usuário.
|
|
34
35
|
*/
|
|
@@ -50,6 +51,8 @@ export default class DataUnit {
|
|
|
50
51
|
case Action.NEXT_SELECTED:
|
|
51
52
|
case Action.PREVIOUS_SELECTED:
|
|
52
53
|
case Action.DATA_LOADED:
|
|
54
|
+
case Action.RECORDS_ADDED:
|
|
55
|
+
case Action.EDITION_CANCELED:
|
|
53
56
|
this.clearDataUnit();
|
|
54
57
|
const selectedRecord = (_a = this._parentDataUnit) === null || _a === void 0 ? void 0 : _a.getSelectedRecord();
|
|
55
58
|
if (selectedRecord != undefined && !this.isNewRecord(selectedRecord.__record__id__)) {
|
|
@@ -578,13 +581,13 @@ export default class DataUnit {
|
|
|
578
581
|
*/
|
|
579
582
|
getFormattedValue(fieldName, value) {
|
|
580
583
|
const descriptor = this.getField(fieldName);
|
|
581
|
-
if (value
|
|
584
|
+
if (value == undefined) {
|
|
582
585
|
value = this.getFieldValue(fieldName);
|
|
583
586
|
}
|
|
584
587
|
else if (typeof value === "string" && (descriptor === null || descriptor === void 0 ? void 0 : descriptor.dataType) != DataType.TEXT) {
|
|
585
588
|
value = this.valueFromString(fieldName, value);
|
|
586
589
|
}
|
|
587
|
-
if (value
|
|
590
|
+
if (value == undefined) {
|
|
588
591
|
return "";
|
|
589
592
|
}
|
|
590
593
|
return getFormattedValue(value, descriptor);
|
|
@@ -793,6 +796,9 @@ export default class DataUnit {
|
|
|
793
796
|
copySelected(executionCtx) {
|
|
794
797
|
const selectionInfo = this.getSelectionInfo();
|
|
795
798
|
if (selectionInfo) {
|
|
799
|
+
if (selectionInfo.isAllRecords()) {
|
|
800
|
+
throw new Error("Erro interno: Impossível copiar os registros selecionados pois a seleção atual é virtual.");
|
|
801
|
+
}
|
|
796
802
|
const selectedRecords = selectionInfo.records;
|
|
797
803
|
if (selectedRecords) {
|
|
798
804
|
this.dispatchAction(Action.RECORDS_COPIED, prepareCopiedRecord(this._stateManager, selectedRecords, this.getParentRecordId()), executionCtx);
|
|
@@ -988,7 +994,7 @@ export default class DataUnit {
|
|
|
988
994
|
setSelection(selection, executionCtx) {
|
|
989
995
|
return new Promise(resolve => {
|
|
990
996
|
this.dispatchAction(Action.SELECTION_CHANGED, { type: "id", selection }, executionCtx)
|
|
991
|
-
.then(() => resolve(getSelectionInfo(
|
|
997
|
+
.then(() => resolve(this.getSelectionInfo()));
|
|
992
998
|
});
|
|
993
999
|
}
|
|
994
1000
|
/**
|
|
@@ -1039,7 +1045,14 @@ export default class DataUnit {
|
|
|
1039
1045
|
*
|
|
1040
1046
|
**/
|
|
1041
1047
|
getSelectionInfo() {
|
|
1042
|
-
|
|
1048
|
+
var _a;
|
|
1049
|
+
const selectionInfo = getSelectionInfo(this._stateManager);
|
|
1050
|
+
selectionInfo.getAllRecords = () => { var _a; return (_a = this.allRecordsLoader) === null || _a === void 0 ? void 0 : _a.call(this, this); };
|
|
1051
|
+
if (selectionInfo.sort != undefined && selectionInfo.sort.length > 0) {
|
|
1052
|
+
const sortingFunction = SortingUtils.getSortingFunction(this, selectionInfo.sort);
|
|
1053
|
+
(_a = selectionInfo.records) === null || _a === void 0 ? void 0 : _a.sort(sortingFunction);
|
|
1054
|
+
}
|
|
1055
|
+
return selectionInfo;
|
|
1043
1056
|
}
|
|
1044
1057
|
/**
|
|
1045
1058
|
*
|
|
@@ -1138,12 +1151,25 @@ export default class DataUnit {
|
|
|
1138
1151
|
*
|
|
1139
1152
|
* Retorna se existe algum tipo de alteração pendente.
|
|
1140
1153
|
*
|
|
1154
|
+
* @param ignoreChildren: Define se deverá ignorar alterações pendentes no DataUnit filho.
|
|
1141
1155
|
* @returns Verdadeiro se existir alterações pendentes.
|
|
1142
1156
|
*
|
|
1143
1157
|
*/
|
|
1144
|
-
isDirty() {
|
|
1158
|
+
isDirty(ignoreChildren) {
|
|
1159
|
+
if (ignoreChildren)
|
|
1160
|
+
return isDirty(this._stateManager);
|
|
1145
1161
|
return isDirty(this._stateManager) || this.childrenIsDirty();
|
|
1146
1162
|
}
|
|
1163
|
+
/**
|
|
1164
|
+
*
|
|
1165
|
+
* Retorna se existe alterações pendentes no DataUnit pai.
|
|
1166
|
+
*
|
|
1167
|
+
* @returns Verdadeiro se existir alterações pendentes e Falso caso não exista alterações ou não exista DataUnit pai.
|
|
1168
|
+
*
|
|
1169
|
+
*/
|
|
1170
|
+
isParentDirty() {
|
|
1171
|
+
return this._parentDataUnit ? this._parentDataUnit.isDirty(true) : false;
|
|
1172
|
+
}
|
|
1147
1173
|
/**
|
|
1148
1174
|
*
|
|
1149
1175
|
* Retorna se existe algum DataUnit detail com alterações pendentes.
|
|
@@ -1576,10 +1602,13 @@ export default class DataUnit {
|
|
|
1576
1602
|
getSelection() {
|
|
1577
1603
|
console.warn("DataUnit: O método `getSelection` foi descontinuado. Use o método `getSelectionInfo`.");
|
|
1578
1604
|
const selection = this.getSelectionInfo();
|
|
1579
|
-
if (selection
|
|
1605
|
+
if (selection == undefined) {
|
|
1606
|
+
return [];
|
|
1607
|
+
}
|
|
1608
|
+
if (selection.isAllRecords()) {
|
|
1580
1609
|
throw new Error("Erro interno: Impossível retornar os registros selecionados. A seleção atual é virtual. Use o método `getSelectionInfo`.");
|
|
1581
1610
|
}
|
|
1582
|
-
return
|
|
1611
|
+
return selection === null || selection === void 0 ? void 0 : selection.recordIds;
|
|
1583
1612
|
}
|
|
1584
1613
|
/**
|
|
1585
1614
|
* Adiciona um campo stand-alone ao dataUnit.
|
|
@@ -1622,6 +1651,7 @@ export default class DataUnit {
|
|
|
1622
1651
|
}
|
|
1623
1652
|
}
|
|
1624
1653
|
DataUnit.CHANGING_PAGE_LOADING_SOURCE = "CHANGING_PAGE_LOADING_SOURCE";
|
|
1654
|
+
DataUnit.ALL_RECORDS_SELECTION_SOURCE = "ALL_RECORDS_SELECTION_SOURCE";
|
|
1625
1655
|
DataUnit.DEFAULT_DATAUNIT_NAME = "dataunit";
|
|
1626
1656
|
export var ChangeOperation;
|
|
1627
1657
|
(function (ChangeOperation) {
|
|
@@ -1707,7 +1737,10 @@ export class SelectionInfo {
|
|
|
1707
1737
|
}
|
|
1708
1738
|
get records() {
|
|
1709
1739
|
if (this.isAllRecords()) {
|
|
1710
|
-
|
|
1740
|
+
if (this.getAllRecords != undefined) {
|
|
1741
|
+
return this.getAllRecords();
|
|
1742
|
+
}
|
|
1743
|
+
throw new Error("Erro interno: Impossível retornar os registros selecionados numa seleção virtual.");
|
|
1711
1744
|
}
|
|
1712
1745
|
return this._records;
|
|
1713
1746
|
}
|