@dile/crud 2.10.0 → 2.10.2

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 (42) hide show
  1. package/package.json +3 -3
  2. package/components/action/src/DileCrudSingleActions.spec.js +0 -126
  3. package/components/action/src/__screenshots__/DileCrudSingleActions.spec.js/DileCrudSingleActions-with-triggerAction-closing-dialog-with-ESC-and-reopening-without-data-shows-reset-form-1.png +0 -0
  4. package/components/action/src/__screenshots__/DileCrudSingleActions.spec.js/DileCrudSingleActions-with-triggerAction-initialData-is-cleared-after-being-applied-1.png +0 -0
  5. package/components/action/src/__screenshots__/DileCrudSingleActions.spec.js/DileCrudSingleActions-with-triggerAction-initialData-is-only-applied-once-and-cleared-after-opening-1.png +0 -0
  6. package/components/action/src/__screenshots__/DileCrudSingleActions.spec.js/DileCrudSingleActions-with-triggerAction-triggerAction-behavior-matches-original-when-no-initialData-1.png +0 -0
  7. package/components/action/src/__screenshots__/DileCrudSingleActions.spec.js/DileCrudSingleActions-with-triggerAction-triggerAction-opens-confirm-dialog-1.png +0 -0
  8. package/components/action/src/__screenshots__/DileCrudSingleActions.spec.js/DileCrudSingleActions-with-triggerAction-triggerAction-with-initialData-sets-form-values-1.png +0 -0
  9. package/components/action/src/__screenshots__/DileCrudSingleActions.spec.js/DileCrudSingleActions-with-triggerAction-triggerAction-with-initialData-sets-form-values-before-opening-dialog-1.png +0 -0
  10. package/components/action/src/__screenshots__/DileCrudSingleActions.spec.js/DileCrudSingleActions-with-triggerAction-triggerAction-without-initialData-resets-form-1.png +0 -0
  11. package/components/action/src/__screenshots__/DileCrudSingleActions.spec.js/DileCrudSingleActions-with-triggerAction-triggerAction-without-initialData-resets-form-to-empty-1.png +0 -0
  12. package/components/ajax/ajax.spec.js +0 -35
  13. package/components/ajax-select-crud/ajax-select-crud-overlay.spec.js +0 -186
  14. package/components/crud/__screenshots__/crud.spec.js/dile-crud-list-grid-view-switch-defaults-to-the-item-template-and-toggles-to-the-grid-on-click-when-both-views-are-configured-1.png +0 -0
  15. package/components/crud/__screenshots__/crud.spec.js/dile-crud-list-grid-view-switch-does-not-render-the-switch-button-when-customization-disableListWiewSwitch-is-true-1.png +0 -0
  16. package/components/crud/crud.spec.js +0 -453
  17. package/components/file-uploader/file-uploader.spec.js +0 -32
  18. package/components/list/__screenshots__/crud-data-grid.spec.js/dile-crud-data-grid-always-forces-sort-mode-to-external-regardless-of-config-1.png +0 -0
  19. package/components/list/__screenshots__/crud-data-grid.spec.js/dile-crud-data-grid-forwards-stickyFirstColumn--striped--responsiveMode-and-emptyMessage-with-sensible-defaults-1.png +0 -0
  20. package/components/list/__screenshots__/crud-data-grid.spec.js/dile-crud-data-grid-leaves-computeRowId-unset-when-config-computeItemId-is-not-a-function-1.png +0 -0
  21. package/components/list/__screenshots__/crud-list.spec.js/dile-crud-list-scope-changes-and-page-reset-keeps-the-current-page-on-refresh---and-goes-back-to-page-1-on-refresh---resetPage--true----1.png +0 -0
  22. package/components/list/__screenshots__/crud-list.spec.js/dile-crud-list-scope-changes-and-page-reset-reloads-from-the-first-page-with-the-new-scope-when-belongsTo-and-relationId-change-1.png +0 -0
  23. package/components/list/__screenshots__/crud-list.spec.js/dile-crud-list-scope-changes-and-page-reset-reloads-when-only-relationId-changes-1.png +0 -0
  24. package/components/list/crud-data-grid.spec.js +0 -207
  25. package/components/list/crud-item-actions.spec.js +0 -122
  26. package/components/list/crud-list.spec.js +0 -455
  27. package/components/many-relation/many-relation.spec.js +0 -154
  28. package/components/select-ajax-simple/select-ajax-simple.spec.js +0 -133
  29. package/components/single/src/DileCrudSingle.spec.js +0 -151
  30. package/components/single/src/__screenshots__/DileCrudSingle.spec.js/DileCrudSingle-triggerAction-and-triggerDirectAction-triggerAction-delegates-to-singleActionsElement-triggerAction-1.png +0 -0
  31. package/components/single/src/__screenshots__/DileCrudSingle.spec.js/DileCrudSingle-triggerAction-and-triggerDirectAction-triggerAction-without-initialData-works-1.png +0 -0
  32. package/components/single/src/__screenshots__/DileCrudSingle.spec.js/DileCrudSingle-triggerAction-and-triggerDirectAction-triggerDirectAction-delegates-to-singleActionsElement-triggerAction-1.png +0 -0
  33. package/components/single/src/__screenshots__/DileCrudSingle.spec.js/DileCrudSingle-triggerAction-and-triggerDirectAction-triggerDirectAction-without-initialData-still-works--backward-compatibility--1.png +0 -0
  34. package/components/steps-form/__screenshots__/steps-form.spec.js/dile-steps-form-translates-the-navigation-labels-with-the-language-property-1.png +0 -0
  35. package/components/steps-form/steps-form.spec.js +0 -230
  36. package/components/ui/__screenshots__/crud-sort-form.spec.js/dile-crud-sort-form-clicking-the-label-of-an-inactive-option-switches-to-it-using-its-own-configured-direction--without-flipping-it-1.png +0 -0
  37. package/components/ui/__screenshots__/crud-sort-form.spec.js/dile-crud-sort-form-clicking-the-label-of-the-already-active-option-toggles-its-direction-instead-of-doing-nothing-1.png +0 -0
  38. package/components/ui/__screenshots__/crud-sort-form.spec.js/dile-crud-sort-form-syncSort-suppresses-exactly-one-radio-group-echo--preserving-the-synced-direction-instead-of-falling-back-to-the-option-static-default-1.png +0 -0
  39. package/components/ui/crud-sort-form.spec.js +0 -132
  40. package/lib/CrudConfigBuilder.spec.js +0 -32
  41. package/lib/deepMerge.spec.js +0 -45
  42. package/lib/listViewMode.spec.js +0 -73
@@ -1,32 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { CrudConfigBuilder } from './CrudConfigBuilder.js';
3
-
4
- describe('CrudConfigBuilder', () => {
5
- it('merges customConfig.grid.columns over the default null grid', () => {
6
- const columns = [{ field: 'id', header: 'ID' }];
7
-
8
- const config = new CrudConfigBuilder('https://example.test/api/items', {
9
- grid: { columns },
10
- }).getConfig();
11
-
12
- expect(config.grid.columns).toEqual(columns);
13
- });
14
-
15
- it('sets the endpoint from the constructor argument', () => {
16
- const config = new CrudConfigBuilder('https://example.test/api/items', {}).getConfig();
17
-
18
- expect(config.endpoint).toBe('https://example.test/api/items');
19
- });
20
-
21
- it('getConfig(endpoint) returns a copy with an overridden endpoint without mutating the original config', () => {
22
- const builder = new CrudConfigBuilder('https://example.test/api/items', {
23
- grid: { columns: [{ field: 'id' }] },
24
- });
25
-
26
- const relatedConfig = builder.getConfig('https://example.test/api/items/1/related');
27
-
28
- expect(relatedConfig.endpoint).toBe('https://example.test/api/items/1/related');
29
- expect(builder.getConfig().endpoint).toBe('https://example.test/api/items');
30
- expect(relatedConfig.grid.columns).toEqual([{ field: 'id' }]);
31
- });
32
- });
@@ -1,45 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { deepMerge } from './deepMerge.js';
3
-
4
- describe('deepMerge', () => {
5
- it('replaces a null target property with a plain object from source', () => {
6
- const target = { grid: null };
7
- const source = { grid: { columns: [{ field: 'id' }] } };
8
-
9
- const result = deepMerge(target, source);
10
-
11
- expect(result.grid).toEqual({ columns: [{ field: 'id' }] });
12
- });
13
-
14
- it('preserves array order and content when merging a columns array under a previously-null key', () => {
15
- const columns = [
16
- { field: 'id', header: 'ID' },
17
- { field: 'name', header: 'Name' },
18
- { field: 'continent', header: 'Continent' },
19
- ];
20
-
21
- const result = deepMerge({ grid: null }, { grid: { columns } });
22
-
23
- expect(result.grid.columns).toEqual(columns);
24
- expect(result.grid.columns).not.toBe(columns);
25
- });
26
-
27
- it('does not mutate the source when merging into a null target key', () => {
28
- const source = { grid: { columns: [{ field: 'id' }] } };
29
-
30
- const result = deepMerge({ grid: null }, source);
31
- result.grid.columns.push({ field: 'extra' });
32
-
33
- expect(source.grid.columns.length).toBe(1);
34
- });
35
-
36
- it('overwrites configured overwriteProperties instances as-is instead of merging them', () => {
37
- class Adapter {}
38
- const targetAdapter = new Adapter();
39
- const sourceAdapter = new Adapter();
40
-
41
- const result = deepMerge({ responseAdapter: targetAdapter }, { responseAdapter: sourceAdapter });
42
-
43
- expect(result.responseAdapter).toBe(sourceAdapter);
44
- });
45
- });
@@ -1,73 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { html } from 'lit';
3
- import { CrudConfigBuilder } from './CrudConfigBuilder.js';
4
- import { hasGridView, hasItemView, canSwitchListView } from './listViewMode.js';
5
-
6
- describe('listViewMode', () => {
7
- it('detects a grid view from templates.grid', () => {
8
- const config = new CrudConfigBuilder('https://example.test/api', {
9
- templates: { grid: () => html`` },
10
- }).getConfig();
11
-
12
- expect(hasGridView(config)).toBe(true);
13
- });
14
-
15
- it('detects a grid view from grid.columns', () => {
16
- const config = new CrudConfigBuilder('https://example.test/api', {
17
- grid: { columns: [{ field: 'id', header: 'ID' }] },
18
- }).getConfig();
19
-
20
- expect(hasGridView(config)).toBe(true);
21
- });
22
-
23
- it('reports no grid view when neither is configured', () => {
24
- const config = new CrudConfigBuilder('https://example.test/api', {
25
- templates: { item: () => html`` },
26
- }).getConfig();
27
-
28
- expect(hasGridView(config)).toBe(false);
29
- });
30
-
31
- it('detects an item view only when templates.item was explicitly configured', () => {
32
- const withItem = new CrudConfigBuilder('https://example.test/api', {
33
- templates: { item: () => html`` },
34
- }).getConfig();
35
- const withoutItem = new CrudConfigBuilder('https://example.test/api', {
36
- grid: { columns: [{ field: 'id', header: 'ID' }] },
37
- }).getConfig();
38
-
39
- expect(hasItemView(withItem)).toBe(true);
40
- expect(hasItemView(withoutItem)).toBe(false);
41
- });
42
-
43
- it('allows switching only when both views are configured and the switch is not disabled', () => {
44
- const both = new CrudConfigBuilder('https://example.test/api', {
45
- grid: { columns: [{ field: 'id', header: 'ID' }] },
46
- templates: { item: () => html`` },
47
- }).getConfig();
48
-
49
- expect(canSwitchListView(both)).toBe(true);
50
- });
51
-
52
- it('disallows switching when customization.disableListWiewSwitch is true', () => {
53
- const config = new CrudConfigBuilder('https://example.test/api', {
54
- grid: { columns: [{ field: 'id', header: 'ID' }] },
55
- templates: { item: () => html`` },
56
- customization: { disableListWiewSwitch: true },
57
- }).getConfig();
58
-
59
- expect(canSwitchListView(config)).toBe(false);
60
- });
61
-
62
- it('disallows switching when only one view is configured', () => {
63
- const gridOnly = new CrudConfigBuilder('https://example.test/api', {
64
- grid: { columns: [{ field: 'id', header: 'ID' }] },
65
- }).getConfig();
66
- const itemOnly = new CrudConfigBuilder('https://example.test/api', {
67
- templates: { item: () => html`` },
68
- }).getConfig();
69
-
70
- expect(canSwitchListView(gridOnly)).toBe(false);
71
- expect(canSwitchListView(itemOnly)).toBe(false);
72
- });
73
- });