@ditojs/admin 2.93.0 → 2.95.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.
Files changed (47) hide show
  1. package/dist/dito-admin.css +1 -1
  2. package/dist/dito-admin.es.js +1672 -1522
  3. package/dist/dito-admin.umd.js +6 -6
  4. package/package.json +6 -6
  5. package/src/components/DitoAccount.vue +7 -1
  6. package/src/components/DitoCreateButton.vue +6 -2
  7. package/src/components/DitoDialog.vue +1 -1
  8. package/src/components/DitoErrors.vue +1 -0
  9. package/src/components/DitoForm.vue +1 -0
  10. package/src/components/DitoFormInner.vue +5 -0
  11. package/src/components/DitoHeader.vue +1 -1
  12. package/src/components/DitoLabel.vue +6 -1
  13. package/src/components/DitoMenu.vue +1 -0
  14. package/src/components/DitoNavigation.vue +1 -1
  15. package/src/components/DitoNotifications.vue +1 -1
  16. package/src/components/DitoPane.vue +3 -0
  17. package/src/components/DitoPanel.vue +2 -0
  18. package/src/components/DitoSchema.vue +1 -0
  19. package/src/components/DitoScopes.vue +1 -0
  20. package/src/components/DitoSpinner.vue +2 -0
  21. package/src/components/DitoTableHead.vue +10 -0
  22. package/src/components/DitoTabs.vue +18 -2
  23. package/src/components/DitoTrail.vue +2 -1
  24. package/src/components/DitoTreeItem.vue +22 -3
  25. package/src/mixins/DitoMixin.js +4 -2
  26. package/src/mixins/PulldownMixin.js +9 -0
  27. package/src/types/DitoTypeCheckboxes.vue +2 -0
  28. package/src/types/DitoTypeList.vue +2 -0
  29. package/src/types/DitoTypeMultiselect.vue +2 -0
  30. package/src/types/DitoTypeRadio.vue +2 -0
  31. package/src/types/DitoTypeUpload.vue +4 -4
  32. package/types/index.d.ts +74 -11
  33. package/types/tests/admin.test-d.ts +0 -27
  34. package/types/tests/component-buttons.test-d.ts +0 -44
  35. package/types/tests/component-list.test-d.ts +0 -159
  36. package/types/tests/component-misc.test-d.ts +0 -137
  37. package/types/tests/component-object.test-d.ts +0 -69
  38. package/types/tests/component-section.test-d.ts +0 -174
  39. package/types/tests/component-select.test-d.ts +0 -107
  40. package/types/tests/components.test-d.ts +0 -81
  41. package/types/tests/context.test-d.ts +0 -31
  42. package/types/tests/fixtures.ts +0 -24
  43. package/types/tests/form.test-d.ts +0 -109
  44. package/types/tests/instance.test-d.ts +0 -20
  45. package/types/tests/schema-features.test-d.ts +0 -402
  46. package/types/tests/variance.test-d.ts +0 -125
  47. package/types/tests/view.test-d.ts +0 -146
@@ -1,125 +0,0 @@
1
- import { assertType, describe, it } from 'vitest'
2
- import type {
3
- View,
4
- Form,
5
- Component,
6
- PanelSchema,
7
- ButtonSchema,
8
- ResolvableForm
9
- } from '../index.d.ts'
10
- import type { Entry, Parent } from './fixtures.ts'
11
-
12
- type DeepItem = {
13
- title: string
14
- items: { type: string }[]
15
- tags: string[]
16
- }
17
-
18
- describe('Variance: typed schemas assignable to any', () => {
19
- it('Component<Entry> is assignable to Component<any>', () => {
20
- const component: Component<Entry> = {
21
- type: 'text'
22
- }
23
- assertType<Component<any>>(component)
24
- })
25
-
26
- it('ButtonSchema<Entry> is assignable to Component<any>', () => {
27
- const button: ButtonSchema<Entry> = {
28
- type: 'button',
29
- text: 'Click me'
30
- }
31
- assertType<Component<any>>(button)
32
- })
33
-
34
- it('PanelSchema<Entry> is assignable to PanelSchema<any>', () => {
35
- const panel: PanelSchema<Entry> = {
36
- type: 'panel',
37
- components: {
38
- title: { type: 'text' }
39
- }
40
- }
41
- assertType<PanelSchema<any>>(panel)
42
- })
43
-
44
- it('View<Entry> is assignable to View<any>', () => {
45
- const view: View<Entry> = {
46
- type: 'view',
47
- components: {
48
- title: { type: 'text' }
49
- }
50
- }
51
- assertType<View<any>>(view)
52
- })
53
-
54
- it('View<Entry> with panels is assignable to View<any>', () => {
55
- const view: View<Entry> = {
56
- type: 'view',
57
- components: {
58
- title: { type: 'text' }
59
- },
60
- panels: {
61
- sidebar: {
62
- type: 'panel',
63
- components: {
64
- title: { type: 'text' }
65
- }
66
- }
67
- }
68
- }
69
- assertType<View<any>>(view)
70
- })
71
-
72
- it('Record of typed views assignable to Record<string, View<any>>', () => {
73
- const views = {
74
- entries: {
75
- type: 'view',
76
- components: {
77
- title: { type: 'text' }
78
- }
79
- } satisfies View<Entry>
80
- }
81
- assertType<Record<string, View<any>>>(views)
82
- })
83
-
84
- it('Form<Entry> is assignable to ResolvableForm<any>', () => {
85
- const form: Form<Entry> = {
86
- type: 'form',
87
- components: {
88
- title: { type: 'text' }
89
- }
90
- }
91
- assertType<ResolvableForm<any>>(form)
92
- })
93
-
94
- it('Form<Parent> (array props) is assignable to ResolvableForm<any>', () => {
95
- const form: Form<Parent> = {
96
- type: 'form',
97
- components: {
98
- title: { type: 'text' }
99
- }
100
- }
101
- assertType<ResolvableForm<any>>(form)
102
- })
103
-
104
- it('Form with primitive + nested arrays is assignable to ResolvableForm<any>', () => {
105
- const form: Form<DeepItem> = {
106
- type: 'form',
107
- components: {
108
- title: { type: 'text' }
109
- }
110
- }
111
- assertType<ResolvableForm<any>>(form)
112
- })
113
-
114
- it('Record of typed forms assignable to Record<string, ResolvableForm>', () => {
115
- const forms = {
116
- entry: {
117
- type: 'form',
118
- components: {
119
- title: { type: 'text' }
120
- }
121
- } satisfies Form<Entry>
122
- }
123
- assertType<Record<string, ResolvableForm>>(forms)
124
- })
125
- })
@@ -1,146 +0,0 @@
1
- import { expectTypeOf, assertType, describe, it } from 'vitest'
2
- import type { Form, View } from '../index.d.ts'
3
- import type { Entry } from './fixtures.ts'
4
-
5
- describe('View with list component', () => {
6
- it('accepts view with single list component and inline form', () => {
7
- const view: View<Entry> = {
8
- type: 'view',
9
- component: {
10
- type: 'list',
11
- itemLabel: 'title',
12
- form: {
13
- type: 'form',
14
- components: {
15
- title: { type: 'text' }
16
- }
17
- }
18
- }
19
- }
20
- })
21
-
22
- it('accepts view with single list component and Form variable', () => {
23
- const entryForm: Form<Entry> = {
24
- type: 'form',
25
- components: {
26
- title: { type: 'text' }
27
- }
28
- }
29
-
30
- const view: View<Entry> = {
31
- type: 'view',
32
- component: {
33
- type: 'list',
34
- itemLabel: 'title',
35
- form: entryForm
36
- }
37
- }
38
- })
39
-
40
- it('accepts view with single list component and promised form', () => {
41
- const promisedForm: Promise<Record<string, Form<Entry>>> = Promise.resolve({
42
- entryForm: { type: 'form', components: {} }
43
- })
44
-
45
- const view: View<Entry> = {
46
- type: 'view',
47
- component: {
48
- type: 'list',
49
- itemLabel: 'title',
50
- form: promisedForm
51
- }
52
- }
53
- })
54
-
55
- it('accepts view with components map', () => {
56
- const view: View<Entry> = {
57
- type: 'view',
58
- components: {
59
- title: {
60
- type: 'text',
61
- format({ item }) {
62
- expectTypeOf(item).not.toBeAny()
63
- expectTypeOf(item.title).toBeString()
64
- }
65
- }
66
- }
67
- }
68
- })
69
- })
70
-
71
- describe('View tabs and events', () => {
72
- it('accepts tabs on a view', () => {
73
- const view: View<Entry> = {
74
- type: 'view',
75
- tabs: {
76
- overview: {
77
- type: 'tab',
78
- label: 'Overview'
79
- },
80
- details: {
81
- type: 'tab',
82
- label: 'Details',
83
- defaultTab: true
84
- }
85
- }
86
- }
87
- })
88
-
89
- it('accepts events on a view', () => {
90
- const view: View<Entry> = {
91
- type: 'view',
92
- events: {
93
- open({ item, open }) {
94
- expectTypeOf(item).not.toBeAny()
95
- expectTypeOf(item.title).toBeString()
96
- expectTypeOf(open).toBeBoolean()
97
- },
98
- change({ item }) {
99
- expectTypeOf(item).not.toBeAny()
100
- expectTypeOf(item.id).toBeNumber()
101
- }
102
- }
103
- }
104
- })
105
- })
106
-
107
- describe('List filters', () => {
108
- it('accepts filter with custom components using arbitrary keys', () => {
109
- const view: View<Entry> = {
110
- type: 'view',
111
- component: {
112
- type: 'list',
113
- filters: {
114
- title: {
115
- filter: 'text',
116
- operators: ['contains', 'equals']
117
- },
118
- createdAt: {
119
- filter: 'date-range'
120
- },
121
- status: {
122
- components: {
123
- pattern: {
124
- type: 'select',
125
- options: ['active', 'inactive']
126
- }
127
- }
128
- }
129
- }
130
- }
131
- }
132
- })
133
-
134
- it('accepts boolean and sticky filters', () => {
135
- const view: View<Entry> = {
136
- type: 'view',
137
- component: {
138
- type: 'list',
139
- filters: {
140
- sticky: true,
141
- title: true
142
- }
143
- }
144
- }
145
- })
146
- })