@controleonline/ui-default 1.0.279 → 1.0.280

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@controleonline/ui-default",
3
- "version": "1.0.279",
3
+ "version": "1.0.280",
4
4
  "author": "ControleOnline",
5
5
  "description": "ControleOnline Default Quasar UI Component",
6
6
  "license": "MIT",
@@ -64,7 +64,7 @@ const DefaultTable = ({
64
64
  onSelectionChange = null,
65
65
  onSortChange = null,
66
66
  pageSize = null,
67
- appearance = 'default',
67
+ appearance = 'compact',
68
68
  paginationMode = 'infinite',
69
69
  pinRowActions = true,
70
70
  renderCard = null,
@@ -0,0 +1,14 @@
1
+ // app-community #1092: the compact layout is the DefaultTable default.
2
+ // Pages (Order History, Financial Hub) must inherit it instead of opting in.
3
+ const fs = require('node:fs');
4
+ const path = require('node:path');
5
+
6
+ const read = relative => fs.readFileSync(path.join(__dirname, relative), 'utf8');
7
+
8
+ it('uses the compact layout as the DefaultTable default appearance', () => {
9
+ expect(read('../../../../react/components/table/DefaultTable.js')).toMatch(/^\s+appearance = 'compact',$/m);
10
+ });
11
+
12
+ it('keeps legacy appearance reachable through an explicit prop', () => {
13
+ expect(read('../../../../react/components/table/DefaultTableToolbar.js')).toMatch(/configs\.appearance === 'compact'/);
14
+ });
@@ -19,6 +19,7 @@ it('can show only search in the toolbar while hiding configured actions and cont
19
19
  renderer.act(() => {
20
20
  tree = renderer.create(
21
21
  React.createElement(DefaultTable, {
22
+ appearance: 'default',
22
23
  columns: [{key: 'name', label: 'Nome', searchable: true}],
23
24
  data: [],
24
25
  showToolbarActions: false,
@@ -42,6 +43,7 @@ it('keeps the list/card toggle visible on compact layouts even when cards are fo
42
43
  renderer.act(() => {
43
44
  tree = renderer.create(
44
45
  React.createElement(DefaultTable, {
46
+ appearance: 'default',
45
47
  columns: [{key: 'name', label: 'Nome'}],
46
48
  data: [],
47
49
  showColumnFiltersButton: false,
@@ -68,6 +70,7 @@ it('respects the compact grid/list toggle in the table body', () => {
68
70
  renderer.act(() => {
69
71
  tree = renderer.create(
70
72
  React.createElement(DefaultTable, {
73
+ appearance: 'default',
71
74
  data: [{id: 1, name: 'Pedido'}],
72
75
  showColumnFiltersButton: false,
73
76
  storeName: 'orders',
@@ -87,6 +90,7 @@ it('respects the compact grid/list toggle in the table body', () => {
87
90
  toggleViewButton.props.onPress();
88
91
  tree.update(
89
92
  React.createElement(DefaultTable, {
93
+ appearance: 'default',
90
94
  data: [{id: 1, name: 'Pedido'}],
91
95
  showColumnFiltersButton: false,
92
96
  storeName: 'orders',
@@ -118,6 +122,7 @@ it('pins identity and action columns on table view', () => {
118
122
  renderer.act(() => {
119
123
  tree = renderer.create(
120
124
  React.createElement(DefaultTable, {
125
+ appearance: 'default',
121
126
  rowActionsComponent,
122
127
  storeName: 'orders',
123
128
  }),
@@ -178,6 +183,7 @@ it('renders a custom row actions component with the configured actions width', (
178
183
  renderer.act(() => {
179
184
  tree = renderer.create(
180
185
  React.createElement(DefaultTable, {
186
+ appearance: 'default',
181
187
  onEditRow: jest.fn(),
182
188
  rowActionsComponent,
183
189
  rowActionsWidth: 180,
@@ -231,6 +237,7 @@ it('keeps only the identity column pinned when row actions are not pinned', () =
231
237
  renderer.act(() => {
232
238
  tree = renderer.create(
233
239
  React.createElement(DefaultTable, {
240
+ appearance: 'default',
234
241
  pinRowActions: false,
235
242
  rowActionsComponent,
236
243
  storeName: 'orders',
@@ -293,6 +300,7 @@ it('keeps the complete search aligned in the toolbar when there is enough room',
293
300
  renderer.act(() => {
294
301
  tree = renderer.create(
295
302
  React.createElement(DefaultTable, {
303
+ appearance: 'default',
296
304
  columns: [{key: 'name', label: 'Nome'}],
297
305
  data: [],
298
306
  storeName: 'orders',
@@ -316,6 +324,7 @@ it('hides the toolbar when the screen disables it', () => {
316
324
  renderer.act(() => {
317
325
  tree = renderer.create(
318
326
  React.createElement(DefaultTable, {
327
+ appearance: 'default',
319
328
  columns: [{key: 'name', label: 'Nome', searchable: true}],
320
329
  data: [],
321
330
  showToolbar: false,
@@ -344,6 +353,7 @@ it('keeps add available as a floating button when the toolbar is hidden', () =>
344
353
  renderer.act(() => {
345
354
  tree = renderer.create(
346
355
  React.createElement(DefaultTable, {
356
+ appearance: 'default',
347
357
  columns: [{key: 'name', label: 'Nome', searchable: true}],
348
358
  data: [],
349
359
  onAdd,
@@ -380,6 +390,7 @@ it('opens the default create form when add has no custom handler', () => {
380
390
  renderer.act(() => {
381
391
  tree = renderer.create(
382
392
  React.createElement(DefaultTable, {
393
+ appearance: 'default',
383
394
  requestParams: {receiver: 21},
384
395
  showToolbar: false,
385
396
  storeName: 'invoice',
@@ -418,6 +429,7 @@ it('collapses search into an icon on narrow toolbars and opens the search modal'
418
429
  renderer.act(() => {
419
430
  tree = renderer.create(
420
431
  React.createElement(DefaultTable, {
432
+ appearance: 'default',
421
433
  columns: [{key: 'name', label: 'Nome'}],
422
434
  data: [],
423
435
  storeName: 'orders',
@@ -13,6 +13,7 @@ it('gives collapsed search a stable accessible name without a placeholder', () =
13
13
  renderer.act(() => {
14
14
  tree = renderer.create(
15
15
  React.createElement(DefaultTable, {
16
+ appearance: 'default',
16
17
  columns: [{key: 'name', label: 'Nome'}],
17
18
  data: [],
18
19
  storeName: 'orders',
@@ -41,6 +42,7 @@ it('keeps the financial compact toolbar aligned when the total is already in the
41
42
  renderer.act(() => {
42
43
  tree = renderer.create(
43
44
  React.createElement(DefaultTable, {
45
+ appearance: 'default',
44
46
  columns: [{key: 'name', label: 'Nome'}],
45
47
  data: [],
46
48
  showTotalItemsInCompactToolbar: true,
@@ -80,6 +82,7 @@ it('opens the filters modal with filterable columns only', () => {
80
82
  renderer.act(() => {
81
83
  tree = renderer.create(
82
84
  React.createElement(DefaultTable, {
85
+ appearance: 'default',
83
86
  data: [],
84
87
  storeName: 'orders',
85
88
  }),
@@ -117,6 +120,7 @@ it('persists filters and sort under default-table[store][route]', () => {
117
120
  renderer.act(() => {
118
121
  tree = renderer.create(
119
122
  React.createElement(DefaultTable, {
123
+ appearance: 'default',
120
124
  storeName: 'orders',
121
125
  }),
122
126
  );
@@ -195,6 +199,7 @@ it('hydrates the saved sort using a stable preference key on auto tables', async
195
199
  await renderer.act(async () => {
196
200
  renderer.create(
197
201
  React.createElement(DefaultTable, {
202
+ appearance: 'default',
198
203
  storeName: 'orders',
199
204
  visibleColumnsPreferenceKey: 'order-history-page',
200
205
  }),
@@ -244,6 +249,7 @@ it('hydrates and persists controlled filters under default-table[store][route]',
244
249
  renderer.act(() => {
245
250
  tree = renderer.create(
246
251
  React.createElement(DefaultTable, {
252
+ appearance: 'default',
247
253
  filters: {},
248
254
  onFilterChange,
249
255
  storeName: 'product_showcase_items',
@@ -257,6 +263,7 @@ it('hydrates and persists controlled filters under default-table[store][route]',
257
263
  renderer.act(() => {
258
264
  tree.update(
259
265
  React.createElement(DefaultTable, {
266
+ appearance: 'default',
260
267
  filters: {integration: 'ifood'},
261
268
  onFilterChange,
262
269
  storeName: 'product_showcase_items',
@@ -294,6 +301,7 @@ it('preserves the compact toolbar total when the footer total is disabled', () =
294
301
  renderer.act(() => {
295
302
  tree = renderer.create(
296
303
  React.createElement(DefaultTable, {
304
+ appearance: 'default',
297
305
  columns: [{key: 'name', label: 'Nome'}],
298
306
  data: [],
299
307
  showTotalItemsInCompactToolbar: true,
@@ -307,6 +315,7 @@ it('preserves the compact toolbar total when the footer total is disabled', () =
307
315
  });
308
316
  it('forces cards when entering compact mode and still toggles between cards and list', () => {
309
317
  const props = {
318
+ appearance: 'default',
310
319
  columns: [{key: 'name', label: 'Nome'}],
311
320
  data: [{id: 1, name: 'Pedido 1'}],
312
321
  showColumnFiltersButton: false,
@@ -360,6 +369,7 @@ it('applies a custom rowStyle to rendered table rows', () => {
360
369
  renderer.act(() => {
361
370
  tree = renderer.create(
362
371
  React.createElement(DefaultTable, {
372
+ appearance: 'default',
363
373
  columns: [{key: 'name', label: 'Nome'}],
364
374
  data: [{id: 1, name: 'Pedido 1'}],
365
375
  onRowPress: () => {},
@@ -398,6 +408,7 @@ it('blocks row navigation while an inline cell is editing or saving', async () =
398
408
  renderer.act(() => {
399
409
  tree = renderer.create(
400
410
  React.createElement(DefaultTable, {
411
+ appearance: 'default',
401
412
  storeName: 'orders',
402
413
  actions: {save},
403
414
  columns: [{key: 'name', label: 'Nome', editable: true}],
@@ -7,6 +7,7 @@ it('protects custom card openRow while a card field is editing', () => {
7
7
  renderer.act(() => {
8
8
  tree = renderer.create(
9
9
  React.createElement(DefaultTable, {
10
+ appearance: 'default',
10
11
  columns: [{key: 'name', label: 'Nome', editable: true}],
11
12
  data: [{id: 1, name: 'Cliente'}],
12
13
  onRowPress,
@@ -44,6 +45,7 @@ it('protects both custom row action navigation callbacks during inline editing',
44
45
  mockState.windowDimensions = {width: 1024, height: 800};
45
46
  let tree;
46
47
  renderer.act(() => {tree = renderer.create(React.createElement(DefaultTable, {
48
+ appearance: 'default',
47
49
  columns: [{key: 'name', label: 'Nome', editable: true}],
48
50
  data: [{id: 1, name: 'Cliente'}], onRowPress,
49
51
  rowActionsComponent: props => React.createElement('CustomRowActions', props),
@@ -82,6 +84,7 @@ it('renders a custom footer component when provided', () => {
82
84
  renderer.act(() => {
83
85
  tree = renderer.create(
84
86
  React.createElement(DefaultTable, {
87
+ appearance: 'default',
85
88
  columns: [{key: 'name', label: 'Nome'}],
86
89
  data: [{id: 1, name: 'Pedido 1'}],
87
90
  footerComponent: FooterComponent,
@@ -113,6 +116,7 @@ it('keeps infinite scroll loading transparent over existing rows', () => {
113
116
  renderer.act(() => {
114
117
  tree = renderer.create(
115
118
  React.createElement(DefaultTable, {
119
+ appearance: 'default',
116
120
  showColumnFiltersButton: false,
117
121
  showRowActions: false,
118
122
  storeName: 'invoices',
@@ -157,6 +161,7 @@ it('uses the configured summary and labels before the store summary', () => {
157
161
  renderer.act(() => {
158
162
  tree = renderer.create(
159
163
  React.createElement(DefaultTable, {
164
+ appearance: 'default',
160
165
  columns: [{key: 'status', label: 'Situação'}],
161
166
  data: [{id: 332, status: 'Pago'}],
162
167
  showColumnFiltersButton: false,
@@ -200,6 +205,7 @@ it('opens a debug query modal when the store exposes debug.query', () => {
200
205
  renderer.act(() => {
201
206
  tree = renderer.create(
202
207
  React.createElement(DefaultTable, {
208
+ appearance: 'default',
203
209
  requestParams: {itemsPerPage: 50},
204
210
  storeName: 'orders',
205
211
  }),
@@ -239,6 +245,7 @@ it('uses store actions when no explicit table actions are passed', async () => {
239
245
  await renderer.act(async () => {
240
246
  renderer.create(
241
247
  React.createElement(DefaultTable, {
248
+ appearance: 'default',
242
249
  columns: [
243
250
  {
244
251
  key: 'jobTitle',
@@ -11,6 +11,7 @@ jest.mock('react-native', () => {
11
11
  Text: props => React.createElement('Text', props, props.children),
12
12
  FlatList: props => React.createElement('List', {}, props.data.map((item, index) => props.renderItem({item, index}))),
13
13
  StyleSheet: {create: value => value},
14
+ useWindowDimensions: () => ({width: 1024, height: 800}),
14
15
  Platform: {select: value => value.web},
15
16
  };
16
17
  });