@ditojs/admin 0.275.0 → 1.0.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.
- package/README.md +1 -1
- package/dist/dito-admin.es.js +6 -0
- package/dist/dito-admin.umd.js +5 -17942
- package/dist/style.css +1 -0
- package/package.json +21 -33
- package/src/DitoAdmin.js +13 -13
- package/src/DitoComponent.js +3 -3
- package/src/DitoContext.js +1 -1
- package/src/TypeComponent.js +3 -3
- package/src/components/DitoAccount.vue +2 -2
- package/src/components/DitoButtons.vue +2 -2
- package/src/components/DitoClipboard.vue +3 -3
- package/src/components/DitoContainer.vue +5 -5
- package/src/components/DitoCreateButton.vue +3 -3
- package/src/components/DitoDialog.vue +3 -3
- package/src/components/DitoEditButtons.vue +1 -1
- package/src/components/DitoElement.vue +1 -1
- package/src/components/DitoErrors.vue +1 -1
- package/src/components/DitoForm.vue +5 -5
- package/src/components/DitoFormNested.vue +1 -1
- package/src/components/DitoHeader.vue +4 -2
- package/src/components/DitoLabel.vue +5 -5
- package/src/components/DitoMenu.vue +1 -1
- package/src/components/DitoPagination.vue +1 -1
- package/src/components/DitoPane.vue +3 -3
- package/src/components/DitoPanel.vue +4 -4
- package/src/components/DitoPanels.vue +1 -1
- package/src/components/DitoRoot.vue +7 -7
- package/src/components/DitoSchema.vue +7 -7
- package/src/components/DitoSchemaInlined.vue +2 -2
- package/src/components/DitoScopes.vue +1 -1
- package/src/components/DitoTableCell.vue +3 -3
- package/src/components/DitoTableHead.vue +2 -2
- package/src/components/DitoTabs.vue +1 -1
- package/src/components/DitoTreeItem.vue +5 -5
- package/src/components/DitoVNode.vue +1 -1
- package/src/components/DitoView.vue +4 -4
- package/src/components/index.js +28 -28
- package/src/index.js +1 -1
- package/src/mixins/DataMixin.js +1 -1
- package/src/mixins/DitoMixin.js +7 -7
- package/src/mixins/ItemMixin.js +3 -3
- package/src/mixins/NumberMixin.js +1 -1
- package/src/mixins/OptionsMixin.js +4 -4
- package/src/mixins/OrderedMixin.js +1 -1
- package/src/mixins/PulldownMixin.js +1 -1
- package/src/mixins/ResourceMixin.js +5 -5
- package/src/mixins/RouteMixin.js +1 -1
- package/src/mixins/SourceMixin.js +9 -7
- package/src/mixins/TypeMixin.js +5 -5
- package/src/mixins/ValidationMixin.js +1 -1
- package/src/mixins/ValidatorMixin.js +1 -1
- package/src/styles/_imports.sass +1 -1
- package/src/styles/_vendors.sass +1 -0
- package/src/styles/{dito.sass → style.sass} +2 -1
- package/src/types/TypeButton.vue +3 -3
- package/src/types/TypeCheckbox.vue +1 -1
- package/src/types/TypeCheckboxes.vue +2 -2
- package/src/types/TypeCode.vue +2 -2
- package/src/types/TypeColor.vue +2 -2
- package/src/types/TypeComponent.vue +1 -1
- package/src/types/TypeComputed.vue +3 -3
- package/src/types/TypeDate.vue +2 -2
- package/src/types/TypeLabel.vue +1 -1
- package/src/types/TypeList.vue +7 -7
- package/src/types/TypeMarkup.vue +3 -3
- package/src/types/TypeMultiselect.vue +5 -5
- package/src/types/TypeNumber.vue +2 -2
- package/src/types/TypeObject.vue +3 -3
- package/src/types/TypePanel.vue +1 -1
- package/src/types/TypeProgress.vue +2 -2
- package/src/types/TypeRadio.vue +2 -2
- package/src/types/TypeSection.vue +7 -2
- package/src/types/TypeSelect.vue +2 -2
- package/src/types/TypeSlider.vue +3 -3
- package/src/types/TypeSwitch.vue +1 -1
- package/src/types/TypeText.vue +1 -1
- package/src/types/TypeTextarea.vue +2 -2
- package/src/types/TypeTreeList.vue +3 -3
- package/src/types/TypeUpload.vue +6 -6
- package/src/types/index.js +25 -25
- package/src/utils/SchemaGraph.js +1 -1
- package/src/utils/schema.js +65 -40
- package/src/validations/index.js +12 -12
- package/LICENSE +0 -20
- package/dist/demo.html +0 -8
- package/dist/dito-admin.common.js +0 -17933
- package/dist/dito-admin.common.js.map +0 -1
- package/dist/dito-admin.umd.js.map +0 -1
- package/dist/dito-admin.umd.min.js +0 -5
- package/dist/dito-admin.umd.min.js.map +0 -1
- package/static/.gitkeep +0 -0
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
15
|
<script>
|
|
16
|
-
import TypeComponent from '
|
|
17
|
-
import TypeMixin from '
|
|
18
|
-
import DataMixin from '
|
|
16
|
+
import TypeComponent from '../TypeComponent.js'
|
|
17
|
+
import TypeMixin from '../mixins/TypeMixin.js'
|
|
18
|
+
import DataMixin from '../mixins/DataMixin.js'
|
|
19
19
|
|
|
20
20
|
export default TypeComponent.register([
|
|
21
21
|
'computed', 'data', 'hidden'
|
package/src/types/TypeDate.vue
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
15
|
<script>
|
|
16
|
-
import TypeComponent from '
|
|
17
|
-
import { getSchemaAccessor } from '
|
|
16
|
+
import TypeComponent from '../TypeComponent.js'
|
|
17
|
+
import { getSchemaAccessor } from '../utils/accessor.js'
|
|
18
18
|
import { DatePicker, TimePicker, DateTimePicker } from '@ditojs/ui'
|
|
19
19
|
import { isDate } from '@ditojs/utils'
|
|
20
20
|
|
package/src/types/TypeLabel.vue
CHANGED
package/src/types/TypeList.vue
CHANGED
|
@@ -167,14 +167,14 @@
|
|
|
167
167
|
</style>
|
|
168
168
|
|
|
169
169
|
<script>
|
|
170
|
-
import TypeComponent from '
|
|
171
|
-
import DitoContext from '
|
|
172
|
-
import SourceMixin from '
|
|
173
|
-
import OrderedMixin from '
|
|
170
|
+
import TypeComponent from '../TypeComponent.js'
|
|
171
|
+
import DitoContext from '../DitoContext.js'
|
|
172
|
+
import SourceMixin from '../mixins/SourceMixin.js'
|
|
173
|
+
import OrderedMixin from '../mixins/OrderedMixin.js'
|
|
174
174
|
import VueDraggable from 'vuedraggable'
|
|
175
|
-
import { getNamedSchemas, getViewEditPath } from '
|
|
176
|
-
import { getFiltersPanel } from '
|
|
177
|
-
import { appendDataPath } from '
|
|
175
|
+
import { getNamedSchemas, getViewEditPath } from '../utils/schema.js'
|
|
176
|
+
import { getFiltersPanel } from '../utils/filter.js'
|
|
177
|
+
import { appendDataPath } from '../utils/data.js'
|
|
178
178
|
import { pickBy, equals, hyphenate } from '@ditojs/utils'
|
|
179
179
|
|
|
180
180
|
// @vue/component
|
package/src/types/TypeMarkup.vue
CHANGED
|
@@ -115,9 +115,9 @@
|
|
|
115
115
|
</style>
|
|
116
116
|
|
|
117
117
|
<script>
|
|
118
|
-
import TypeComponent from '
|
|
119
|
-
import DomMixin from '
|
|
120
|
-
import { getSchemaAccessor } from '
|
|
118
|
+
import TypeComponent from '../TypeComponent.js'
|
|
119
|
+
import DomMixin from '../mixins/DomMixin.js'
|
|
120
|
+
import { getSchemaAccessor } from '../utils/accessor.js'
|
|
121
121
|
import { Editor, EditorContent, EditorMenuBar, Mark } from 'tiptap'
|
|
122
122
|
import { toggleMark } from 'tiptap-commands'
|
|
123
123
|
import {
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
line-height: $tag-line-height
|
|
141
141
|
.multiselect__option--highlight
|
|
142
142
|
&::after
|
|
143
|
-
|
|
143
|
+
display: block
|
|
144
144
|
position: absolute
|
|
145
145
|
background: transparent
|
|
146
146
|
color: $color-white
|
|
@@ -223,11 +223,11 @@
|
|
|
223
223
|
</style>
|
|
224
224
|
|
|
225
225
|
<script>
|
|
226
|
-
import TypeComponent from '
|
|
227
|
-
import DitoContext from '
|
|
228
|
-
import OptionsMixin from '
|
|
226
|
+
import TypeComponent from '../TypeComponent.js'
|
|
227
|
+
import DitoContext from '../DitoContext.js'
|
|
228
|
+
import OptionsMixin from '../mixins/OptionsMixin.js'
|
|
229
229
|
import VueMultiselect from 'vue-multiselect'
|
|
230
|
-
import { getSchemaAccessor } from '
|
|
230
|
+
import { getSchemaAccessor } from '../utils/accessor.js'
|
|
231
231
|
import 'vue-multiselect/dist/vue-multiselect.min.css'
|
|
232
232
|
|
|
233
233
|
// @vue/component
|
package/src/types/TypeNumber.vue
CHANGED
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
</style>
|
|
23
23
|
|
|
24
24
|
<script>
|
|
25
|
-
import TypeComponent from '
|
|
26
|
-
import NumberMixin from '
|
|
25
|
+
import TypeComponent from '../TypeComponent.js'
|
|
26
|
+
import NumberMixin from '../mixins/NumberMixin.js'
|
|
27
27
|
import { InputField } from '@ditojs/ui'
|
|
28
28
|
|
|
29
29
|
export default TypeComponent.register([
|
package/src/types/TypeObject.vue
CHANGED
|
@@ -68,9 +68,9 @@
|
|
|
68
68
|
</style>
|
|
69
69
|
|
|
70
70
|
<script>
|
|
71
|
-
import TypeComponent from '
|
|
72
|
-
import DitoContext from '
|
|
73
|
-
import SourceMixin from '
|
|
71
|
+
import TypeComponent from '../TypeComponent.js'
|
|
72
|
+
import DitoContext from '../DitoContext.js'
|
|
73
|
+
import SourceMixin from '../mixins/SourceMixin.js'
|
|
74
74
|
|
|
75
75
|
// @vue/component
|
|
76
76
|
export default TypeComponent.register('object', {
|
package/src/types/TypePanel.vue
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
12
|
<script>
|
|
13
|
-
import TypeComponent from '
|
|
14
|
-
import NumberMixin from '
|
|
13
|
+
import TypeComponent from '../TypeComponent.js'
|
|
14
|
+
import NumberMixin from '../mixins/NumberMixin.js'
|
|
15
15
|
|
|
16
16
|
// @vue/component
|
|
17
17
|
export default TypeComponent.register('progress', {
|
package/src/types/TypeRadio.vue
CHANGED
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
</style>
|
|
26
26
|
|
|
27
27
|
<script>
|
|
28
|
-
import TypeComponent from '
|
|
29
|
-
import OptionsMixin from '
|
|
28
|
+
import TypeComponent from '../TypeComponent.js'
|
|
29
|
+
import OptionsMixin from '../mixins/OptionsMixin.js'
|
|
30
30
|
|
|
31
31
|
// @vue/component
|
|
32
32
|
export default TypeComponent.register('radio', {
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
</style>
|
|
23
23
|
|
|
24
24
|
<script>
|
|
25
|
-
import TypeComponent from '
|
|
26
|
-
import { getItemFormSchema } from '
|
|
25
|
+
import TypeComponent from '../TypeComponent.js'
|
|
26
|
+
import { getItemFormSchema, processSchemaComponents } from '../utils/schema.js'
|
|
27
27
|
|
|
28
28
|
// @vue/component
|
|
29
29
|
export default TypeComponent.register('section', {
|
|
@@ -41,6 +41,11 @@ export default TypeComponent.register('section', {
|
|
|
41
41
|
|
|
42
42
|
methods: {
|
|
43
43
|
getItemFormSchema
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
async processSchema(api, schema, name, routes, level) {
|
|
47
|
+
// Process section components so their forms get resolved too.
|
|
48
|
+
await processSchemaComponents(api, schema, routes, level)
|
|
44
49
|
}
|
|
45
50
|
})
|
|
46
51
|
</script>
|
package/src/types/TypeSelect.vue
CHANGED
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
</style>
|
|
69
69
|
|
|
70
70
|
<script>
|
|
71
|
-
import TypeComponent from '
|
|
72
|
-
import OptionsMixin from '
|
|
71
|
+
import TypeComponent from '../TypeComponent.js'
|
|
72
|
+
import OptionsMixin from '../mixins/OptionsMixin.js'
|
|
73
73
|
|
|
74
74
|
// @vue/component
|
|
75
75
|
export default TypeComponent.register('select', {
|
package/src/types/TypeSlider.vue
CHANGED
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
</style>
|
|
39
39
|
|
|
40
40
|
<script>
|
|
41
|
-
import TypeComponent from '
|
|
42
|
-
import NumberMixin from '
|
|
43
|
-
import { getSchemaAccessor } from '
|
|
41
|
+
import TypeComponent from '../TypeComponent.js'
|
|
42
|
+
import NumberMixin from '../mixins/NumberMixin.js'
|
|
43
|
+
import { getSchemaAccessor } from '../utils/accessor.js'
|
|
44
44
|
import { InputField } from '@ditojs/ui'
|
|
45
45
|
|
|
46
46
|
// @vue/component
|
package/src/types/TypeSwitch.vue
CHANGED
package/src/types/TypeText.vue
CHANGED
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
</style>
|
|
21
21
|
|
|
22
22
|
<script>
|
|
23
|
-
import TypeComponent from '
|
|
24
|
-
import { getSchemaAccessor } from '
|
|
23
|
+
import TypeComponent from '../TypeComponent.js'
|
|
24
|
+
import { getSchemaAccessor } from '../utils/accessor.js'
|
|
25
25
|
|
|
26
26
|
// @vue/component
|
|
27
27
|
export default TypeComponent.register('textarea', {
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
</style>
|
|
41
41
|
|
|
42
42
|
<script>
|
|
43
|
-
import TypeComponent from '
|
|
44
|
-
import SourceMixin from '
|
|
45
|
-
import { hasFormSchema, getFormSchemas } from '
|
|
43
|
+
import TypeComponent from '../TypeComponent.js'
|
|
44
|
+
import SourceMixin from '../mixins/SourceMixin.js'
|
|
45
|
+
import { hasFormSchema, getFormSchemas } from '../utils/schema.js'
|
|
46
46
|
|
|
47
47
|
export default TypeComponent.register([
|
|
48
48
|
'tree-list', 'tree-object'
|
package/src/types/TypeUpload.vue
CHANGED
|
@@ -105,15 +105,15 @@
|
|
|
105
105
|
</style>
|
|
106
106
|
|
|
107
107
|
<script>
|
|
108
|
-
import TypeComponent from '
|
|
109
|
-
import DitoContext from '
|
|
110
|
-
import OrderedMixin from '
|
|
108
|
+
import TypeComponent from '../TypeComponent.js'
|
|
109
|
+
import DitoContext from '../DitoContext.js'
|
|
110
|
+
import OrderedMixin from '../mixins/OrderedMixin.js'
|
|
111
111
|
import VueUpload from 'vue-upload-component'
|
|
112
112
|
import VueDraggable from 'vuedraggable'
|
|
113
113
|
import parseFileSize from 'filesize-parser'
|
|
114
|
-
import { getSchemaAccessor } from '
|
|
115
|
-
import { formatFileSize } from '
|
|
116
|
-
import { appendDataPath } from '
|
|
114
|
+
import { getSchemaAccessor } from '../utils/accessor.js'
|
|
115
|
+
import { formatFileSize } from '../utils/units.js'
|
|
116
|
+
import { appendDataPath } from '../utils/data.js'
|
|
117
117
|
import { isArray, asArray, escapeHtml } from '@ditojs/utils'
|
|
118
118
|
|
|
119
119
|
// @vue/component
|
package/src/types/index.js
CHANGED
|
@@ -2,28 +2,28 @@
|
|
|
2
2
|
// DitoComponent and can be retrieved through TypeComponent.get(type) and
|
|
3
3
|
// rendered through their component-names (e.g. dito-type-list).
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
5
|
+
export { default as TypeButton } from './TypeButton.vue'
|
|
6
|
+
export { default as TypeCheckbox } from './TypeCheckbox.vue'
|
|
7
|
+
export { default as TypeCheckboxes } from './TypeCheckboxes.vue'
|
|
8
|
+
export { default as TypeCode } from './TypeCode.vue'
|
|
9
|
+
export { default as TypeColor } from './TypeColor.vue'
|
|
10
|
+
export { default as TypeComponent } from './TypeComponent.vue'
|
|
11
|
+
export { default as TypeComputed } from './TypeComputed.vue'
|
|
12
|
+
export { default as TypeDate } from './TypeDate.vue'
|
|
13
|
+
export { default as TypeList } from './TypeList.vue'
|
|
14
|
+
export { default as TypeLabel } from './TypeLabel.vue'
|
|
15
|
+
export { default as TypeMarkup } from './TypeMarkup.vue'
|
|
16
|
+
export { default as TypeMultiselect } from './TypeMultiselect.vue'
|
|
17
|
+
export { default as TypeNumber } from './TypeNumber.vue'
|
|
18
|
+
export { default as TypeObject } from './TypeObject.vue'
|
|
19
|
+
export { default as TypePanel } from './TypePanel.vue'
|
|
20
|
+
export { default as TypeProgress } from './TypeProgress.vue'
|
|
21
|
+
export { default as TypeRadio } from './TypeRadio.vue'
|
|
22
|
+
export { default as TypeSection } from './TypeSection.vue'
|
|
23
|
+
export { default as TypeSelect } from './TypeSelect.vue'
|
|
24
|
+
export { default as TypeSlider } from './TypeSlider.vue'
|
|
25
|
+
export { default as TypeSwitch } from './TypeSwitch.vue'
|
|
26
|
+
export { default as TypeText } from './TypeText.vue'
|
|
27
|
+
export { default as TypeTextarea } from './TypeTextarea.vue'
|
|
28
|
+
export { default as TypeTreeList } from './TypeTreeList.vue'
|
|
29
|
+
export { default as TypeUpload } from './TypeUpload.vue'
|
package/src/utils/SchemaGraph.js
CHANGED
package/src/utils/schema.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import Vue from 'vue'
|
|
2
|
-
import DitoContext from '
|
|
3
|
-
import { getUid } from './uid'
|
|
4
|
-
import { SchemaGraph } from './SchemaGraph'
|
|
5
|
-
import { appendDataPath, isTemporaryId } from './data'
|
|
2
|
+
import DitoContext from '../DitoContext.js'
|
|
3
|
+
import { getUid } from './uid.js'
|
|
4
|
+
import { SchemaGraph } from './SchemaGraph.js'
|
|
5
|
+
import { appendDataPath, isTemporaryId } from './data.js'
|
|
6
6
|
import {
|
|
7
|
-
isObject, isString, isArray, isFunction, isPromise, clone, camelize
|
|
7
|
+
isObject, isString, isArray, isFunction, isPromise, clone, camelize, isModule
|
|
8
8
|
} from '@ditojs/utils'
|
|
9
9
|
|
|
10
10
|
const typeComponents = {}
|
|
@@ -71,20 +71,68 @@ export function everySchemaComponent(schema, callback) {
|
|
|
71
71
|
) !== false
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
export async function
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (isPromise(
|
|
79
|
-
|
|
74
|
+
export async function resolveSchema(schema, unwrapModule = false) {
|
|
75
|
+
if (isFunction(schema)) {
|
|
76
|
+
schema = schema()
|
|
77
|
+
}
|
|
78
|
+
if (isPromise(schema)) {
|
|
79
|
+
schema = await schema
|
|
80
|
+
}
|
|
81
|
+
if (isModule(schema)) {
|
|
82
|
+
// Copy to convert from module to object:
|
|
83
|
+
schema = { ...schema }
|
|
84
|
+
// Unwrap default or named schema
|
|
85
|
+
if (!schema.name && (unwrapModule || schema.default)) {
|
|
86
|
+
const keys = Object.keys(schema)
|
|
87
|
+
if (keys.length === 1) {
|
|
88
|
+
const name = keys[0]
|
|
89
|
+
schema = schema[name]
|
|
90
|
+
schema.name = name
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return schema
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export async function resolveSchemas(
|
|
98
|
+
unresolvedSchemas,
|
|
99
|
+
resolveItem = resolveSchema
|
|
100
|
+
) {
|
|
101
|
+
let schemas = isFunction(unresolvedSchemas)
|
|
102
|
+
? unresolvedSchemas()
|
|
103
|
+
: unresolvedSchemas
|
|
104
|
+
schemas = await resolveSchema(schemas, false)
|
|
105
|
+
if (isArray(schemas)) {
|
|
106
|
+
// Translate an array of dynamic import, each importing one named schema
|
|
107
|
+
// module to an object with named entries.
|
|
108
|
+
schemas = Object.fromEntries(await Promise.all(schemas.map(
|
|
109
|
+
async item => {
|
|
110
|
+
const schema = await resolveItem(item, true)
|
|
111
|
+
return [schema.name, schema]
|
|
112
|
+
}
|
|
113
|
+
)))
|
|
114
|
+
} else if (isObject(schemas)) {
|
|
115
|
+
schemas = Object.fromEntries(await Promise.all(Object.entries(schemas).map(
|
|
116
|
+
async ([key, item]) => {
|
|
117
|
+
const schema = await resolveItem(item, true)
|
|
118
|
+
return [key, schema]
|
|
119
|
+
}
|
|
120
|
+
)))
|
|
121
|
+
}
|
|
122
|
+
return schemas
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export async function resolvePanels(schema) {
|
|
126
|
+
const { panels } = schema
|
|
127
|
+
if (schema.panels) {
|
|
128
|
+
schema.panels = await resolveSchemas(panels)
|
|
80
129
|
}
|
|
81
|
-
// Copy views to convert from module to object, and keep a global reference:
|
|
82
|
-
return { ...views }
|
|
83
130
|
}
|
|
84
131
|
|
|
85
132
|
export async function processView(component, api, schema, name, routes) {
|
|
86
133
|
const children = []
|
|
87
134
|
processRouteSchema(api, schema, name)
|
|
135
|
+
await resolvePanels(schema)
|
|
88
136
|
if (isSingleComponentView(schema)) {
|
|
89
137
|
await processComponent(api, schema, name, children, 0)
|
|
90
138
|
} else {
|
|
@@ -128,7 +176,7 @@ export async function processForms(api, schema, level) {
|
|
|
128
176
|
// First resolve the forms and store the results back on the schema.
|
|
129
177
|
let { form, forms, components } = schema
|
|
130
178
|
if (forms) {
|
|
131
|
-
forms = schema.forms = await
|
|
179
|
+
forms = schema.forms = await resolveSchemas(forms, resolveForm)
|
|
132
180
|
} else if (form) {
|
|
133
181
|
form = schema.form = await resolveForm(form)
|
|
134
182
|
} else if (components) {
|
|
@@ -147,36 +195,13 @@ export async function processForms(api, schema, level) {
|
|
|
147
195
|
}
|
|
148
196
|
|
|
149
197
|
export async function resolveForm(form) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
if (isPromise(form)) {
|
|
154
|
-
form = await form
|
|
155
|
-
}
|
|
156
|
-
// When dynamically importing forms, the actual form can be received named or
|
|
157
|
-
// as `default` in a nested object, detect and handle this case:
|
|
158
|
-
if (form && !('components' in form)) {
|
|
159
|
-
// Assume the form is the first export (named or default)
|
|
160
|
-
const name = Object.keys(form)[0]
|
|
161
|
-
form = form[name]
|
|
162
|
-
if (form && name !== 'default') {
|
|
163
|
-
form.name = name
|
|
164
|
-
}
|
|
198
|
+
form = await resolveSchema(form, true)
|
|
199
|
+
if (form) {
|
|
200
|
+
await resolvePanels(form)
|
|
165
201
|
}
|
|
166
202
|
return form
|
|
167
203
|
}
|
|
168
204
|
|
|
169
|
-
export async function resolveForms(forms) {
|
|
170
|
-
const results = await Promise.all(Object.values(forms).map(resolveForm))
|
|
171
|
-
return Object.keys(forms).reduce(
|
|
172
|
-
(mapped, key, index) => {
|
|
173
|
-
mapped[key] = results[index]
|
|
174
|
-
return mapped
|
|
175
|
-
},
|
|
176
|
-
{}
|
|
177
|
-
)
|
|
178
|
-
}
|
|
179
|
-
|
|
180
205
|
export function isSingleComponentView(schema) {
|
|
181
206
|
// If the schema has a type, it is a single-component view.
|
|
182
207
|
return !!schema.type
|
package/src/validations/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export * from './_creditcard'
|
|
2
|
-
export * from './_decimals'
|
|
3
|
-
export * from './_email'
|
|
4
|
-
export * from './_hostname'
|
|
5
|
-
export * from './_domain'
|
|
6
|
-
export * from './_integer'
|
|
7
|
-
export * from './_max'
|
|
8
|
-
export * from './_min'
|
|
9
|
-
export * from './_password'
|
|
10
|
-
export * from './_range'
|
|
11
|
-
export * from './_required'
|
|
12
|
-
export * from './_url'
|
|
1
|
+
export * from './_creditcard.js'
|
|
2
|
+
export * from './_decimals.js'
|
|
3
|
+
export * from './_email.js'
|
|
4
|
+
export * from './_hostname.js'
|
|
5
|
+
export * from './_domain.js'
|
|
6
|
+
export * from './_integer.js'
|
|
7
|
+
export * from './_max.js'
|
|
8
|
+
export * from './_min.js'
|
|
9
|
+
export * from './_password.js'
|
|
10
|
+
export * from './_range.js'
|
|
11
|
+
export * from './_required.js'
|
|
12
|
+
export * from './_url.js'
|
package/LICENSE
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2018-2021 Lineto GmbH & Jürg Lehni <juerg@scratchdisk.com>
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|