@ditojs/admin 2.0.5 → 2.1.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 (116) hide show
  1. package/dist/dito-admin.es.js +1511 -1435
  2. package/dist/dito-admin.umd.js +4 -4
  3. package/dist/style.css +1 -1
  4. package/package.json +31 -31
  5. package/src/DitoAdmin.js +66 -31
  6. package/src/DitoComponent.js +4 -1
  7. package/src/DitoContext.js +13 -5
  8. package/src/{TypeComponent.js → DitoTypeComponent.js} +8 -5
  9. package/src/components/DitoAccount.vue +20 -19
  10. package/src/components/DitoButtons.vue +14 -12
  11. package/src/components/DitoClipboard.vue +16 -8
  12. package/src/components/DitoContainer.vue +56 -43
  13. package/src/components/DitoCreateButton.vue +20 -15
  14. package/src/components/DitoDialog.vue +69 -48
  15. package/src/components/DitoEditButtons.vue +16 -14
  16. package/src/components/DitoElement.vue +2 -3
  17. package/src/components/DitoErrors.vue +18 -13
  18. package/src/components/DitoForm.vue +41 -24
  19. package/src/components/DitoFormNested.vue +12 -10
  20. package/src/components/DitoHeader.vue +103 -69
  21. package/src/components/DitoLabel.vue +108 -81
  22. package/src/components/DitoMenu.vue +52 -36
  23. package/src/components/DitoPagination.vue +9 -7
  24. package/src/components/DitoPane.vue +53 -45
  25. package/src/components/DitoPanel.vue +62 -42
  26. package/src/components/DitoPanels.vue +11 -10
  27. package/src/components/DitoRoot.vue +57 -46
  28. package/src/components/DitoSchema.vue +179 -131
  29. package/src/components/DitoSchemaInlined.vue +39 -28
  30. package/src/components/DitoScopes.vue +41 -31
  31. package/src/components/DitoSpinner.vue +31 -40
  32. package/src/components/DitoTableCell.vue +9 -9
  33. package/src/components/DitoTableHead.vue +52 -37
  34. package/src/components/DitoTabs.vue +39 -29
  35. package/src/components/DitoTreeItem.vue +140 -86
  36. package/src/components/DitoVNode.vue +1 -1
  37. package/src/components/DitoView.vue +13 -11
  38. package/src/mixins/DataMixin.js +11 -9
  39. package/src/mixins/DitoMixin.js +47 -25
  40. package/src/mixins/EmitterMixin.js +2 -1
  41. package/src/mixins/ItemMixin.js +15 -10
  42. package/src/mixins/LoadingMixin.js +2 -1
  43. package/src/mixins/NumberMixin.js +15 -10
  44. package/src/mixins/OptionsMixin.js +24 -12
  45. package/src/mixins/ResourceMixin.js +42 -34
  46. package/src/mixins/RouteMixin.js +8 -8
  47. package/src/mixins/SortableMixin.js +1 -1
  48. package/src/mixins/SourceMixin.js +68 -34
  49. package/src/mixins/TypeMixin.js +5 -4
  50. package/src/mixins/ValidationMixin.js +3 -0
  51. package/src/styles/_base.scss +17 -0
  52. package/src/styles/_button.scss +212 -0
  53. package/src/styles/_imports.scss +2 -0
  54. package/src/styles/_layout.scss +22 -0
  55. package/src/styles/_notifications.scss +54 -0
  56. package/src/styles/_pulldown.scss +39 -0
  57. package/src/styles/_scroll.scss +15 -0
  58. package/src/styles/_settings.scss +68 -0
  59. package/src/styles/_sortable.scss +13 -0
  60. package/src/styles/_table.scss +224 -0
  61. package/src/styles/style.scss +9 -0
  62. package/src/types/DitoTypeButton.vue +72 -0
  63. package/src/types/{TypeCheckbox.vue → DitoTypeCheckbox.vue} +12 -11
  64. package/src/types/{TypeCheckboxes.vue → DitoTypeCheckboxes.vue} +21 -15
  65. package/src/types/{TypeCode.vue → DitoTypeCode.vue} +46 -34
  66. package/src/types/{TypeColor.vue → DitoTypeColor.vue} +71 -52
  67. package/src/types/{TypeComponent.vue → DitoTypeComponent.vue} +2 -2
  68. package/src/types/DitoTypeComputed.vue +54 -0
  69. package/src/types/DitoTypeDate.vue +64 -0
  70. package/src/types/DitoTypeLabel.vue +23 -0
  71. package/src/types/{TypeList.vue → DitoTypeList.vue} +83 -61
  72. package/src/types/{TypeMarkup.vue → DitoTypeMarkup.vue} +172 -122
  73. package/src/types/DitoTypeMultiselect.vue +434 -0
  74. package/src/types/DitoTypeNumber.vue +46 -0
  75. package/src/types/{TypeObject.vue → DitoTypeObject.vue} +41 -26
  76. package/src/types/{TypePanel.vue → DitoTypePanel.vue} +2 -2
  77. package/src/types/{TypeProgress.vue → DitoTypeProgress.vue} +4 -6
  78. package/src/types/{TypeRadio.vue → DitoTypeRadio.vue} +17 -13
  79. package/src/types/{TypeSection.vue → DitoTypeSection.vue} +17 -17
  80. package/src/types/{TypeSelect.vue → DitoTypeSelect.vue} +39 -35
  81. package/src/types/{TypeSlider.vue → DitoTypeSlider.vue} +29 -23
  82. package/src/types/{TypeSwitch.vue → DitoTypeSwitch.vue} +15 -13
  83. package/src/types/DitoTypeText.vue +77 -0
  84. package/src/types/{TypeTextarea.vue → DitoTypeTextarea.vue} +17 -14
  85. package/src/types/DitoTypeTreeList.vue +191 -0
  86. package/src/types/{TypeUpload.vue → DitoTypeUpload.vue} +92 -65
  87. package/src/types/index.js +26 -26
  88. package/src/utils/SchemaGraph.js +21 -13
  89. package/src/utils/accessor.js +17 -9
  90. package/src/utils/data.js +4 -1
  91. package/src/utils/filter.js +8 -10
  92. package/src/utils/options.js +3 -3
  93. package/src/utils/resource.js +12 -10
  94. package/src/utils/schema.js +190 -125
  95. package/src/utils/type.js +31 -20
  96. package/src/validations/_decimals.js +1 -2
  97. package/types/index.d.ts +27 -23
  98. package/src/styles/_base.sass +0 -15
  99. package/src/styles/_button.sass +0 -127
  100. package/src/styles/_imports.sass +0 -2
  101. package/src/styles/_layout.sass +0 -13
  102. package/src/styles/_notifications.sass +0 -33
  103. package/src/styles/_pulldown.sass +0 -26
  104. package/src/styles/_scroll.sass +0 -13
  105. package/src/styles/_settings.sass +0 -55
  106. package/src/styles/_sortable.sass +0 -9
  107. package/src/styles/_table.sass +0 -153
  108. package/src/styles/style.sass +0 -10
  109. package/src/types/TypeButton.vue +0 -73
  110. package/src/types/TypeComputed.vue +0 -53
  111. package/src/types/TypeDate.vue +0 -64
  112. package/src/types/TypeLabel.vue +0 -19
  113. package/src/types/TypeMultiselect.vue +0 -376
  114. package/src/types/TypeNumber.vue +0 -44
  115. package/src/types/TypeText.vue +0 -67
  116. package/src/types/TypeTreeList.vue +0 -164
@@ -1,164 +0,0 @@
1
- <template lang="pug">
2
- .dito-tree-list
3
- dito-scopes(
4
- v-if="scopes"
5
- :query="query"
6
- :scopes="scopes"
7
- )
8
- .dito-tree-panel
9
- dito-tree-item(
10
- :schema="treeSchema"
11
- :dataPath="treeDataPath"
12
- :data="treeData"
13
- :draggable="draggable"
14
- :open="true"
15
- )
16
- .dito-tree-form-container(
17
- v-if="hasEditableForms"
18
- )
19
- //- Include a router-view for the optional DitoFormInlined
20
- router-view
21
- </template>
22
-
23
- <style lang="sass">
24
- @import '../styles/_imports'
25
-
26
- .dito-tree-list
27
- @extend %field
28
- .dito-tree-panel
29
- display: flex
30
- justify-content: space-between
31
- > .dito-tree-item
32
- flex: 1 1 25%
33
- > .dito-tree-form-container
34
- flex: 0 1 75%
35
- align-self: stretch
36
- background: $content-color-background
37
- border-left: $border-style
38
- border-top-right-radius: $border-radius - 1
39
- border-bottom-right-radius: $border-radius - 1
40
- margin: (-$input-padding-ver) (-$input-padding-hor)
41
- margin-left: $input-padding-hor
42
- </style>
43
-
44
- <script>
45
- import TypeComponent from '../TypeComponent.js'
46
- import SourceMixin from '../mixins/SourceMixin.js'
47
- import {
48
- hasFormSchema, getFormSchemas, resolveSchemaComponents
49
- } from '../utils/schema.js'
50
-
51
- export default TypeComponent.register([
52
- 'tree-list', 'tree-object'
53
- ],
54
- // @vue/component
55
- {
56
- mixins: [SourceMixin],
57
-
58
- provide() {
59
- return { container: this }
60
- },
61
-
62
- getSourceType(type) {
63
- return type === 'tree-object' ? 'object' : 'list'
64
- },
65
-
66
- computed: {
67
- path() {
68
- // Accessed from DitoTreeItem through `container.path`:
69
- return this.formComponent?.path
70
- },
71
-
72
- editPath() {
73
- // Accessed from DitoTreeItem through `container.editPath`:
74
- return this.$route.path.slice(this.path?.length)
75
- },
76
-
77
- treeData() {
78
- return this.isListSource
79
- ? { [this.name]: this.value }
80
- : this.value
81
- },
82
-
83
- treeDataPath() {
84
- // Remove `name` from `dataPath`, as it is added
85
- // to `treeData` and `treeSchema`
86
- return this.isListSource
87
- ? this.dataPath.slice(0, this.dataPath.length - this.name.length)
88
- : this.dataPath
89
- },
90
-
91
- treeSchema() {
92
- return this.isListSource
93
- ? {
94
- children: {
95
- name: this.name,
96
- ...this.schema
97
- }
98
- }
99
- : this.schema
100
- },
101
-
102
- hasEditableForms() {
103
- const hasEditableForms = schema => {
104
- return (
105
- hasFormSchema(schema) && (
106
- this.getSchemaValue('editable', {
107
- type: Boolean,
108
- default: false,
109
- schema
110
- }) ||
111
- schema.children &&
112
- hasEditableForms(schema.children)
113
- )
114
- )
115
- }
116
- return hasEditableForms(this.schema)
117
- }
118
- },
119
-
120
- async processSchema(
121
- api, schema, name, routes, level,
122
- nested = true, flatten = false,
123
- process = null
124
- ) {
125
- await Promise.all([
126
- resolveSchemaComponents(schema.properties),
127
- SourceMixin.processSchema(
128
- api, schema, name, routes, level,
129
- nested, flatten,
130
- // Pass process() to add more routes to childRoutes:
131
- (childRoutes, level) => {
132
- const { children } = schema
133
- if (children) {
134
- // Add `type` to the nested tree list.
135
- children.type = 'tree-list'
136
- // Recursively call `processSchema()` for the nested tree list:
137
- return this.processSchema(
138
- api, children, children.name, childRoutes, level,
139
- nested, true, // Pass `true` for `flatten` in tree lists.
140
- process
141
- )
142
- }
143
- }
144
- )
145
- ])
146
- },
147
-
148
- getFormSchemasForProcessing(schema, context) {
149
- // Convert nested children schema to stand-alone schema component,
150
- // present in each of the forms, as required by `processSchemaData()`
151
- const { children } = schema
152
- return getFormSchemas(schema, context, children
153
- ? form => ({
154
- ...form,
155
- components: {
156
- ...form.components,
157
- [children.name]: children
158
- }
159
- })
160
- : null
161
- )
162
- }
163
- })
164
- </script>