@controleonline/ui-default 1.0.269 → 1.0.272

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 (91) hide show
  1. package/.github/workflows/integration-source-gate.yml +68 -0
  2. package/.github/workflows/manager-worker.yml +19 -0
  3. package/AGENTS.md +46 -50
  4. package/docs/technical/Contrato-de-colunas.md +67 -0
  5. package/docs/technical/Default-Components.md +76 -0
  6. package/docs/technical/DefaultForm.md +80 -0
  7. package/docs/technical/DefaultInput-e-DefaultSelect.md +73 -0
  8. package/docs/technical/DefaultTable.md +203 -0
  9. package/docs/wiki.md +1 -0
  10. package/package.json +22 -21
  11. package/scripts/validate-wiki-pointer.cjs +13 -0
  12. package/src/react/components/address/DefaultAddress.js +435 -0
  13. package/src/react/components/address/DefaultAddress.styles.js +133 -0
  14. package/src/react/components/address/DefaultAddressMapPane.js +55 -0
  15. package/src/react/components/address/LatLonReadonlyFields.js +51 -0
  16. package/src/react/components/address/defaultAddressHelpers.js +163 -0
  17. package/src/react/components/address/defaultAddressStyles.js +136 -0
  18. package/src/react/components/address/defaultAddressUtils.js +129 -0
  19. package/src/react/components/extra-data/DefaultExtraData.js +152 -0
  20. package/src/react/components/extra-data/DefaultExtraData.styles.js +61 -0
  21. package/src/react/components/files/DefaultFile.js +231 -46
  22. package/src/react/components/files/DefaultFileColumn.js +123 -0
  23. package/src/react/components/files/DefaultFileColumn.styles.js +52 -0
  24. package/src/react/components/files/DefaultFileColumn.utils.js +104 -0
  25. package/src/react/components/filters/CompactFilterSelector.js +51 -35
  26. package/src/react/components/filters/DefaultColumnFilter.js +58 -41
  27. package/src/react/components/filters/DefaultExternalFilters.js +331 -265
  28. package/src/react/components/form/DefaultForm.js +99 -79
  29. package/src/react/components/help/DefaultTooltip.js +59 -33
  30. package/src/react/components/help/DefaultTooltip.styles.js +23 -3
  31. package/src/react/components/inputs/DefaultColorInput.js +153 -0
  32. package/src/react/components/inputs/DefaultFeatherIconPicker.js +146 -0
  33. package/src/react/components/inputs/DefaultFeatherIconPicker.styles.js +113 -0
  34. package/src/react/components/inputs/DefaultInput.js +69 -5
  35. package/src/react/components/inputs/DefaultInput.styles.js +26 -0
  36. package/src/react/components/inputs/DefaultSelect.js +134 -123
  37. package/src/react/components/inputs/defaultInputUtils.js +69 -43
  38. package/src/react/components/map/DefaultGoogleMap.styles.js +9 -2
  39. package/src/react/components/map/DefaultGoogleMap.web.js +49 -28
  40. package/src/react/components/map/DefaultMap.native.js +73 -73
  41. package/src/react/components/map/DefaultMap.shared.js +911 -762
  42. package/src/react/components/map/DefaultMap.web.js +124 -68
  43. package/src/react/components/table/DefaultColumnMenu.js +109 -108
  44. package/src/react/components/table/DefaultDebug.js +45 -38
  45. package/src/react/components/table/DefaultSearchModal.js +9 -1
  46. package/src/react/components/table/DefaultTable.grouping.js +98 -0
  47. package/src/react/components/table/DefaultTable.js +215 -109
  48. package/src/react/components/table/DefaultTable.styles.js +367 -314
  49. package/src/react/components/table/DefaultTableBody.js +13 -8
  50. package/src/react/components/table/DefaultTableCards.js +20 -1
  51. package/src/react/components/table/DefaultTableControls.js +180 -205
  52. package/src/react/components/table/DefaultTableImportModal.js +108 -0
  53. package/src/react/components/table/DefaultTableInput.js +1 -0
  54. package/src/react/components/table/DefaultTableRowActions.js +1 -1
  55. package/src/react/components/table/DefaultTableRows.js +224 -363
  56. package/src/react/components/table/DefaultTableSearch.js +28 -5
  57. package/src/react/components/table/DefaultTableToolbar.js +92 -3
  58. package/src/react/components/table/useDefaultTablePagination.js +56 -7
  59. package/src/react/components/table/useDefaultTableStoreSync.js +164 -0
  60. package/src/react/components/upload/DefaultUpload.js +436 -0
  61. package/src/react/components/upload/DefaultUpload.styles.js +153 -0
  62. package/src/react/components/upload/DefaultUploadAttachmentsList.js +138 -0
  63. package/src/react/components/upload/DefaultUploadManagerModal.js +247 -0
  64. package/src/react/components/upload/defaultUploadHelpers.js +108 -0
  65. package/src/react/components/upload/defaultUploadLibrary.js +248 -0
  66. package/src/react/components/upload/fileUpload.js +93 -0
  67. package/src/react/hooks/usePostalCodeLookup.js +145 -0
  68. package/src/react/index.js +6 -0
  69. package/src/react/services/addressFormUtils.js +196 -0
  70. package/src/react/services/addressGeo.js +227 -0
  71. package/src/react/utils/tableVisibleColumnsPreferences.js +29 -12
  72. package/src/tests/react/components/address/defaultAddressHelpers.test.js +104 -0
  73. package/src/tests/react/components/files/DefaultFile.test.js +6 -6
  74. package/src/tests/react/components/form/DefaultForm.test.js +123 -0
  75. package/src/tests/react/components/inputs/DefaultSelect.test.js +108 -79
  76. package/src/tests/react/components/table/DefaultTable.grouping.test.js +49 -0
  77. package/src/tests/react/components/table/DefaultTable.test.js +54 -2
  78. package/src/tests/react/components/table/DefaultTableControls.filters.test.mjs +21 -0
  79. package/src/tests/react/components/table/resolveRowBackgroundColor.test.mjs +45 -0
  80. package/src/tests/react/components/table/useDefaultTableStoreSync.test.js +161 -0
  81. package/src/tests/react/components/upload/DefaultUpload.test.js +353 -0
  82. package/src/tests/react/components/upload/defaultUploadLibrary.test.js +82 -0
  83. package/src/tests/react/components/upload/peopleMediaLibraryPreview.test.mjs +57 -0
  84. package/src/tests/react/hooks/usePostalCodeLookup.test.js +40 -0
  85. package/src/tests/react/services/SMOKE-637-cep-hydrate.md +45 -0
  86. package/src/tests/react/services/addressFormUtils.test.js +176 -0
  87. package/src/tests/react/services/addressGeoLookup.async.test.js +104 -0
  88. package/src/tests/react/services/addressGeoLookup.test.js +105 -0
  89. package/src/tests/react/services/smoke-637/form-cep-12941040.png +0 -0
  90. package/src/tests/react/services/smoke-637/index.html +132 -0
  91. package/src/tests/react/utils/tableVisibleColumnsPreferences.test.js +84 -48
@@ -44,6 +44,7 @@ describe('tableVisibleColumnsPreferences', () => {
44
44
  { name: 'price', visible: false },
45
45
  ];
46
46
  const scope = {
47
+ companyKey: '42',
47
48
  storeKey: 'financialEntries',
48
49
  routeKey: 'receivables',
49
50
  };
@@ -76,15 +77,17 @@ describe('tableVisibleColumnsPreferences', () => {
76
77
  });
77
78
  });
78
79
 
79
- it('builds the route and store preference scope', () => {
80
+ it('builds the company, route and store preference scope', () => {
80
81
  global.location = {pathname: '/order-history-page'};
81
82
 
82
83
  expect(
83
84
  resolveDefaultTablePreferenceScope({
85
+ companyId: 42,
84
86
  route: {name: 'IgnoredRoute'},
85
87
  storeName: 'orders',
86
88
  }),
87
89
  ).toEqual({
90
+ companyKey: '42',
88
91
  routeKey: 'order-history-page',
89
92
  storeKey: 'orders',
90
93
  });
@@ -97,11 +100,13 @@ describe('tableVisibleColumnsPreferences', () => {
97
100
 
98
101
  expect(
99
102
  resolveDefaultTablePreferenceScope({
103
+ companyId: '99',
100
104
  preferenceKey: 'product_showcase_items',
101
105
  route: {name: 'ProductShowcasesPage'},
102
106
  storeName: 'product_showcase_items',
103
107
  }),
104
108
  ).toEqual({
109
+ companyKey: '99',
105
110
  routeKey: 'product_showcase_items',
106
111
  storeKey: 'product_showcase_items',
107
112
  });
@@ -129,15 +134,17 @@ describe('tableVisibleColumnsPreferences', () => {
129
134
  });
130
135
  });
131
136
 
132
- it('reads and writes visible columns under default-table[store][route]', () => {
137
+ it('reads and writes visible columns under default-table[company][store][route]', () => {
133
138
  global.localStorage.setItem(
134
139
  DEFAULT_TABLE_PREFERENCES_STORAGE_KEY,
135
140
  JSON.stringify({
136
141
  theme: 'light',
137
- financialEntries: {
138
- receivables: {
139
- [TABLE_VISIBLE_COLUMNS_PREFERENCES_KEY]: {
140
- id: false,
142
+ '42': {
143
+ financialEntries: {
144
+ receivables: {
145
+ [TABLE_VISIBLE_COLUMNS_PREFERENCES_KEY]: {
146
+ id: false,
147
+ },
141
148
  },
142
149
  },
143
150
  },
@@ -149,6 +156,7 @@ describe('tableVisibleColumnsPreferences', () => {
149
156
  });
150
157
 
151
158
  persistVisibleColumnsPreference({
159
+ companyKey: '42',
152
160
  storeKey: 'financialEntries',
153
161
  routeKey: 'payables',
154
162
  }, {
@@ -162,29 +170,33 @@ describe('tableVisibleColumnsPreferences', () => {
162
170
  ),
163
171
  ).toEqual({
164
172
  theme: 'light',
165
- financialEntries: {
166
- receivables: {
167
- [TABLE_VISIBLE_COLUMNS_PREFERENCES_KEY]: {
168
- id: false,
173
+ '42': {
174
+ financialEntries: {
175
+ receivables: {
176
+ [TABLE_VISIBLE_COLUMNS_PREFERENCES_KEY]: {
177
+ id: false,
178
+ },
169
179
  },
170
- },
171
- payables: {
172
- [TABLE_VISIBLE_COLUMNS_PREFERENCES_KEY]: {
173
- id: true,
174
- status: false,
180
+ payables: {
181
+ [TABLE_VISIBLE_COLUMNS_PREFERENCES_KEY]: {
182
+ id: true,
183
+ status: false,
184
+ },
175
185
  },
176
186
  },
177
187
  },
178
188
  });
179
189
  });
180
190
 
181
- it('reads and writes view mode under default-table[store][route]', () => {
191
+ it('reads and writes view mode under default-table[company][store][route]', () => {
182
192
  global.localStorage.setItem(
183
193
  DEFAULT_TABLE_PREFERENCES_STORAGE_KEY,
184
194
  JSON.stringify({
185
- financialEntries: {
186
- payables: {
187
- [TABLE_VIEW_MODE_PREFERENCES_KEY]: 'cards',
195
+ '42': {
196
+ financialEntries: {
197
+ payables: {
198
+ [TABLE_VIEW_MODE_PREFERENCES_KEY]: 'cards',
199
+ },
188
200
  },
189
201
  },
190
202
  }),
@@ -192,7 +204,7 @@ describe('tableVisibleColumnsPreferences', () => {
192
204
 
193
205
  expect(
194
206
  resolveStoredTableViewModePreference(
195
- {storeKey: 'financialEntries', routeKey: 'payables'},
207
+ {companyKey: '42', storeKey: 'financialEntries', routeKey: 'payables'},
196
208
  'table',
197
209
  ),
198
210
  ).toBe('cards');
@@ -208,26 +220,30 @@ describe('tableVisibleColumnsPreferences', () => {
208
220
  global.localStorage.getItem(DEFAULT_TABLE_PREFERENCES_STORAGE_KEY),
209
221
  ),
210
222
  ).toEqual({
211
- financialEntries: {
212
- payables: {
213
- [TABLE_VIEW_MODE_PREFERENCES_KEY]: 'cards',
214
- },
215
- receivables: {
216
- [TABLE_VIEW_MODE_PREFERENCES_KEY]: 'table',
223
+ '42': {
224
+ financialEntries: {
225
+ payables: {
226
+ [TABLE_VIEW_MODE_PREFERENCES_KEY]: 'cards',
227
+ },
228
+ receivables: {
229
+ [TABLE_VIEW_MODE_PREFERENCES_KEY]: 'table',
230
+ },
217
231
  },
218
232
  },
219
233
  });
220
234
  });
221
235
 
222
- it('reads and writes sort under default-table[store][route]', () => {
236
+ it('reads and writes sort under default-table[company][store][route]', () => {
223
237
  global.localStorage.setItem(
224
238
  DEFAULT_TABLE_PREFERENCES_STORAGE_KEY,
225
239
  JSON.stringify({
226
- financialEntries: {
227
- payables: {
228
- [TABLE_SORT_PREFERENCES_KEY]: {
229
- direction: 'asc',
230
- field: 'price',
240
+ '42': {
241
+ financialEntries: {
242
+ payables: {
243
+ [TABLE_SORT_PREFERENCES_KEY]: {
244
+ direction: 'asc',
245
+ field: 'price',
246
+ },
231
247
  },
232
248
  },
233
249
  },
@@ -236,6 +252,7 @@ describe('tableVisibleColumnsPreferences', () => {
236
252
 
237
253
  expect(
238
254
  resolveStoredTableSortPreference({
255
+ companyKey: '42',
239
256
  storeKey: 'financialEntries',
240
257
  routeKey: 'payables',
241
258
  }),
@@ -256,24 +273,26 @@ describe('tableVisibleColumnsPreferences', () => {
256
273
  global.localStorage.getItem(DEFAULT_TABLE_PREFERENCES_STORAGE_KEY),
257
274
  ),
258
275
  ).toEqual({
259
- financialEntries: {
260
- payables: {
261
- [TABLE_SORT_PREFERENCES_KEY]: {
262
- direction: 'asc',
263
- field: 'price',
276
+ '42': {
277
+ financialEntries: {
278
+ payables: {
279
+ [TABLE_SORT_PREFERENCES_KEY]: {
280
+ direction: 'asc',
281
+ field: 'price',
282
+ },
264
283
  },
265
- },
266
- receivables: {
267
- [TABLE_SORT_PREFERENCES_KEY]: {
268
- direction: 'desc',
269
- field: 'dueDate',
284
+ receivables: {
285
+ [TABLE_SORT_PREFERENCES_KEY]: {
286
+ direction: 'desc',
287
+ field: 'dueDate',
288
+ },
270
289
  },
271
290
  },
272
291
  },
273
292
  });
274
293
  });
275
294
 
276
- it('reads and writes filters under default-table[store][route]', () => {
295
+ it('reads and writes filters under default-table[company][store][route]', () => {
277
296
  persistTableFiltersPreference(scope, {
278
297
  search: '72813',
279
298
  status: 'paid',
@@ -289,14 +308,31 @@ describe('tableVisibleColumnsPreferences', () => {
289
308
  global.localStorage.getItem(DEFAULT_TABLE_PREFERENCES_STORAGE_KEY),
290
309
  ),
291
310
  ).toEqual({
292
- financialEntries: {
293
- receivables: {
294
- [TABLE_FILTER_PREFERENCES_KEY]: {
295
- search: '72813',
296
- status: 'paid',
311
+ '42': {
312
+ financialEntries: {
313
+ receivables: {
314
+ [TABLE_FILTER_PREFERENCES_KEY]: {
315
+ search: '72813',
316
+ status: 'paid',
317
+ },
297
318
  },
298
319
  },
299
320
  },
300
321
  });
301
322
  });
323
+
324
+ it('ignores scopes without a company key', () => {
325
+ persistTableFiltersPreference(
326
+ {storeKey: 'orders', routeKey: 'order-history-page'},
327
+ {app: 'POS'},
328
+ );
329
+
330
+ expect(global.localStorage.getItem(DEFAULT_TABLE_PREFERENCES_STORAGE_KEY)).toBeNull();
331
+ expect(
332
+ resolveStoredTableFiltersPreference({
333
+ storeKey: 'orders',
334
+ routeKey: 'order-history-page',
335
+ }),
336
+ ).toBeNull();
337
+ });
302
338
  });