@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.
- package/dist/dito-admin.es.js +1511 -1435
- package/dist/dito-admin.umd.js +4 -4
- package/dist/style.css +1 -1
- package/package.json +31 -31
- package/src/DitoAdmin.js +66 -31
- package/src/DitoComponent.js +4 -1
- package/src/DitoContext.js +13 -5
- package/src/{TypeComponent.js → DitoTypeComponent.js} +8 -5
- package/src/components/DitoAccount.vue +20 -19
- package/src/components/DitoButtons.vue +14 -12
- package/src/components/DitoClipboard.vue +16 -8
- package/src/components/DitoContainer.vue +56 -43
- package/src/components/DitoCreateButton.vue +20 -15
- package/src/components/DitoDialog.vue +69 -48
- package/src/components/DitoEditButtons.vue +16 -14
- package/src/components/DitoElement.vue +2 -3
- package/src/components/DitoErrors.vue +18 -13
- package/src/components/DitoForm.vue +41 -24
- package/src/components/DitoFormNested.vue +12 -10
- package/src/components/DitoHeader.vue +103 -69
- package/src/components/DitoLabel.vue +108 -81
- package/src/components/DitoMenu.vue +52 -36
- package/src/components/DitoPagination.vue +9 -7
- package/src/components/DitoPane.vue +53 -45
- package/src/components/DitoPanel.vue +62 -42
- package/src/components/DitoPanels.vue +11 -10
- package/src/components/DitoRoot.vue +57 -46
- package/src/components/DitoSchema.vue +179 -131
- package/src/components/DitoSchemaInlined.vue +39 -28
- package/src/components/DitoScopes.vue +41 -31
- package/src/components/DitoSpinner.vue +31 -40
- package/src/components/DitoTableCell.vue +9 -9
- package/src/components/DitoTableHead.vue +52 -37
- package/src/components/DitoTabs.vue +39 -29
- package/src/components/DitoTreeItem.vue +140 -86
- package/src/components/DitoVNode.vue +1 -1
- package/src/components/DitoView.vue +13 -11
- package/src/mixins/DataMixin.js +11 -9
- package/src/mixins/DitoMixin.js +47 -25
- package/src/mixins/EmitterMixin.js +2 -1
- package/src/mixins/ItemMixin.js +15 -10
- package/src/mixins/LoadingMixin.js +2 -1
- package/src/mixins/NumberMixin.js +15 -10
- package/src/mixins/OptionsMixin.js +24 -12
- package/src/mixins/ResourceMixin.js +42 -34
- package/src/mixins/RouteMixin.js +8 -8
- package/src/mixins/SortableMixin.js +1 -1
- package/src/mixins/SourceMixin.js +68 -34
- package/src/mixins/TypeMixin.js +5 -4
- package/src/mixins/ValidationMixin.js +3 -0
- package/src/styles/_base.scss +17 -0
- package/src/styles/_button.scss +212 -0
- package/src/styles/_imports.scss +2 -0
- package/src/styles/_layout.scss +22 -0
- package/src/styles/_notifications.scss +54 -0
- package/src/styles/_pulldown.scss +39 -0
- package/src/styles/_scroll.scss +15 -0
- package/src/styles/_settings.scss +68 -0
- package/src/styles/_sortable.scss +13 -0
- package/src/styles/_table.scss +224 -0
- package/src/styles/style.scss +9 -0
- package/src/types/DitoTypeButton.vue +72 -0
- package/src/types/{TypeCheckbox.vue → DitoTypeCheckbox.vue} +12 -11
- package/src/types/{TypeCheckboxes.vue → DitoTypeCheckboxes.vue} +21 -15
- package/src/types/{TypeCode.vue → DitoTypeCode.vue} +46 -34
- package/src/types/{TypeColor.vue → DitoTypeColor.vue} +71 -52
- package/src/types/{TypeComponent.vue → DitoTypeComponent.vue} +2 -2
- package/src/types/DitoTypeComputed.vue +54 -0
- package/src/types/DitoTypeDate.vue +64 -0
- package/src/types/DitoTypeLabel.vue +23 -0
- package/src/types/{TypeList.vue → DitoTypeList.vue} +83 -61
- package/src/types/{TypeMarkup.vue → DitoTypeMarkup.vue} +172 -122
- package/src/types/DitoTypeMultiselect.vue +434 -0
- package/src/types/DitoTypeNumber.vue +46 -0
- package/src/types/{TypeObject.vue → DitoTypeObject.vue} +41 -26
- package/src/types/{TypePanel.vue → DitoTypePanel.vue} +2 -2
- package/src/types/{TypeProgress.vue → DitoTypeProgress.vue} +4 -6
- package/src/types/{TypeRadio.vue → DitoTypeRadio.vue} +17 -13
- package/src/types/{TypeSection.vue → DitoTypeSection.vue} +17 -17
- package/src/types/{TypeSelect.vue → DitoTypeSelect.vue} +39 -35
- package/src/types/{TypeSlider.vue → DitoTypeSlider.vue} +29 -23
- package/src/types/{TypeSwitch.vue → DitoTypeSwitch.vue} +15 -13
- package/src/types/DitoTypeText.vue +77 -0
- package/src/types/{TypeTextarea.vue → DitoTypeTextarea.vue} +17 -14
- package/src/types/DitoTypeTreeList.vue +191 -0
- package/src/types/{TypeUpload.vue → DitoTypeUpload.vue} +92 -65
- package/src/types/index.js +26 -26
- package/src/utils/SchemaGraph.js +21 -13
- package/src/utils/accessor.js +17 -9
- package/src/utils/data.js +4 -1
- package/src/utils/filter.js +8 -10
- package/src/utils/options.js +3 -3
- package/src/utils/resource.js +12 -10
- package/src/utils/schema.js +190 -125
- package/src/utils/type.js +31 -20
- package/src/validations/_decimals.js +1 -2
- package/types/index.d.ts +27 -23
- package/src/styles/_base.sass +0 -15
- package/src/styles/_button.sass +0 -127
- package/src/styles/_imports.sass +0 -2
- package/src/styles/_layout.sass +0 -13
- package/src/styles/_notifications.sass +0 -33
- package/src/styles/_pulldown.sass +0 -26
- package/src/styles/_scroll.sass +0 -13
- package/src/styles/_settings.sass +0 -55
- package/src/styles/_sortable.sass +0 -9
- package/src/styles/_table.sass +0 -153
- package/src/styles/style.sass +0 -10
- package/src/types/TypeButton.vue +0 -73
- package/src/types/TypeComputed.vue +0 -53
- package/src/types/TypeDate.vue +0 -64
- package/src/types/TypeLabel.vue +0 -19
- package/src/types/TypeMultiselect.vue +0 -376
- package/src/types/TypeNumber.vue +0 -44
- package/src/types/TypeText.vue +0 -67
- package/src/types/TypeTreeList.vue +0 -164
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
//- Only show panels in tabs when the tabs are also visible.
|
|
3
3
|
component.dito-panel(
|
|
4
|
-
:is="panelTag"
|
|
5
4
|
v-show="visible && (!panelTabComponent || panelTabComponent.visible)"
|
|
5
|
+
:is="panelTag"
|
|
6
6
|
@submit.prevent
|
|
7
7
|
)
|
|
8
8
|
label.dito-panel-title {{ getLabel(schema) }}
|
|
9
|
-
|
|
9
|
+
DitoSchema.dito-panel-schema(
|
|
10
10
|
:schema="panelSchema"
|
|
11
11
|
:dataPath="panelDataPath"
|
|
12
12
|
:data="panelData"
|
|
@@ -16,7 +16,7 @@ component.dito-panel(
|
|
|
16
16
|
:hasOwnData="hasOwnData"
|
|
17
17
|
)
|
|
18
18
|
template(#buttons)
|
|
19
|
-
|
|
19
|
+
DitoButtons(
|
|
20
20
|
:buttons="buttonSchemas"
|
|
21
21
|
:dataPath="panelDataPath"
|
|
22
22
|
:data="panelData"
|
|
@@ -26,44 +26,6 @@ component.dito-panel(
|
|
|
26
26
|
)
|
|
27
27
|
</template>
|
|
28
28
|
|
|
29
|
-
<style lang="sass">
|
|
30
|
-
@import '../styles/_imports'
|
|
31
|
-
|
|
32
|
-
.dito-panel
|
|
33
|
-
margin-bottom: $content-padding
|
|
34
|
-
.dito-panel-title
|
|
35
|
-
display: block
|
|
36
|
-
box-sizing: border-box
|
|
37
|
-
padding: $input-padding
|
|
38
|
-
background: $button-color
|
|
39
|
-
border: $border-style
|
|
40
|
-
border-top-left-radius: $border-radius
|
|
41
|
-
border-top-right-radius: $border-radius
|
|
42
|
-
.dito-panel-schema
|
|
43
|
-
font-size: $font-size-small
|
|
44
|
-
background: $content-color-background
|
|
45
|
-
border: $border-style
|
|
46
|
-
border-top: 0
|
|
47
|
-
border-bottom-left-radius: $border-radius
|
|
48
|
-
border-bottom-right-radius: $border-radius
|
|
49
|
-
> .dito-schema-content
|
|
50
|
-
padding: $form-spacing-half $form-spacing
|
|
51
|
-
> .dito-buttons
|
|
52
|
-
--button-margin: #{$form-spacing}
|
|
53
|
-
padding: $form-spacing-half 0
|
|
54
|
-
.dito-object
|
|
55
|
-
border: 0
|
|
56
|
-
padding: 0
|
|
57
|
-
.dito-label
|
|
58
|
-
margin: 0
|
|
59
|
-
label
|
|
60
|
-
font-weight: normal
|
|
61
|
-
.dito-pane
|
|
62
|
-
margin: 0 (-$form-spacing-half)
|
|
63
|
-
.dito-container
|
|
64
|
-
padding: $form-spacing-half
|
|
65
|
-
</style>
|
|
66
|
-
|
|
67
29
|
<script>
|
|
68
30
|
import { isFunction } from '@ditojs/utils'
|
|
69
31
|
import DitoComponent from '../DitoComponent.js'
|
|
@@ -72,7 +34,7 @@ import { getButtonSchemas } from '../utils/schema.js'
|
|
|
72
34
|
import { getSchemaAccessor } from '../utils/accessor.js'
|
|
73
35
|
|
|
74
36
|
// @vue/component
|
|
75
|
-
export default DitoComponent.component('
|
|
37
|
+
export default DitoComponent.component('DitoPanel', {
|
|
76
38
|
mixins: [ValidatorMixin],
|
|
77
39
|
|
|
78
40
|
provide() {
|
|
@@ -177,3 +139,61 @@ export default DitoComponent.component('dito-panel', {
|
|
|
177
139
|
}
|
|
178
140
|
})
|
|
179
141
|
</script>
|
|
142
|
+
|
|
143
|
+
<style lang="scss">
|
|
144
|
+
@import '../styles/_imports';
|
|
145
|
+
|
|
146
|
+
.dito-panel {
|
|
147
|
+
margin-bottom: $content-padding;
|
|
148
|
+
|
|
149
|
+
.dito-panel-title {
|
|
150
|
+
display: block;
|
|
151
|
+
box-sizing: border-box;
|
|
152
|
+
padding: $input-padding;
|
|
153
|
+
background: $button-color;
|
|
154
|
+
border: $border-style;
|
|
155
|
+
border-top-left-radius: $border-radius;
|
|
156
|
+
border-top-right-radius: $border-radius;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.dito-panel-schema {
|
|
160
|
+
font-size: $font-size-small;
|
|
161
|
+
background: $content-color-background;
|
|
162
|
+
border: $border-style;
|
|
163
|
+
border-top: 0;
|
|
164
|
+
border-bottom-left-radius: $border-radius;
|
|
165
|
+
border-bottom-right-radius: $border-radius;
|
|
166
|
+
|
|
167
|
+
> .dito-schema-content {
|
|
168
|
+
padding: $form-spacing-half $form-spacing;
|
|
169
|
+
|
|
170
|
+
> .dito-buttons {
|
|
171
|
+
--button-margin: #{$form-spacing};
|
|
172
|
+
|
|
173
|
+
padding: $form-spacing-half 0;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.dito-object {
|
|
178
|
+
border: 0;
|
|
179
|
+
padding: 0;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.dito-label {
|
|
183
|
+
margin: 0;
|
|
184
|
+
|
|
185
|
+
label {
|
|
186
|
+
font-weight: normal;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.dito-pane {
|
|
191
|
+
margin: 0 (-$form-spacing-half);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.dito-container {
|
|
195
|
+
padding: $form-spacing-half;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
</style>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
template(
|
|
6
6
|
v-for="{ schema, dataPath, tabComponent } in panels"
|
|
7
7
|
)
|
|
8
|
-
|
|
8
|
+
DitoPanel(
|
|
9
9
|
v-if="shouldRender(schema)"
|
|
10
10
|
:key="getPanelKey(dataPath, tabComponent)"
|
|
11
11
|
:schema="schema"
|
|
@@ -18,19 +18,11 @@
|
|
|
18
18
|
)
|
|
19
19
|
</template>
|
|
20
20
|
|
|
21
|
-
<style lang="sass">
|
|
22
|
-
@import '../styles/_imports'
|
|
23
|
-
|
|
24
|
-
.dito-panels
|
|
25
|
-
max-width: $content-sidebar-width
|
|
26
|
-
min-width: calc($content-sidebar-width / 2)
|
|
27
|
-
</style>
|
|
28
|
-
|
|
29
21
|
<script>
|
|
30
22
|
import DitoComponent from '../DitoComponent.js'
|
|
31
23
|
|
|
32
24
|
// @vue/component
|
|
33
|
-
export default DitoComponent.component('
|
|
25
|
+
export default DitoComponent.component('DitoPanels', {
|
|
34
26
|
props: {
|
|
35
27
|
panels: { type: Array, default: null },
|
|
36
28
|
data: { type: Object, required: true },
|
|
@@ -48,3 +40,12 @@ export default DitoComponent.component('dito-panels', {
|
|
|
48
40
|
}
|
|
49
41
|
})
|
|
50
42
|
</script>
|
|
43
|
+
|
|
44
|
+
<style lang="scss">
|
|
45
|
+
@import '../styles/_imports';
|
|
46
|
+
|
|
47
|
+
.dito-panels {
|
|
48
|
+
max-width: $content-sidebar-width;
|
|
49
|
+
min-width: calc($content-sidebar-width / 2);
|
|
50
|
+
}
|
|
51
|
+
</style>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
.dito-root
|
|
3
|
-
|
|
3
|
+
VueNotifications.dito-notifications(
|
|
4
4
|
ref="notifications"
|
|
5
5
|
position="top right"
|
|
6
6
|
classes="dito-notification"
|
|
7
7
|
)
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
TransitionGroup(name="dito-dialog")
|
|
9
|
+
DitoDialog(
|
|
10
10
|
v-for="(dialog, key) in dialogs"
|
|
11
11
|
:key="key"
|
|
12
12
|
:components="dialog.components"
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
:settings="dialog.settings"
|
|
17
17
|
@remove="removeDialog(key)"
|
|
18
18
|
)
|
|
19
|
-
|
|
19
|
+
DitoMenu
|
|
20
20
|
main.dito-page.dito-scroll-parent
|
|
21
|
-
|
|
21
|
+
DitoHeader(
|
|
22
22
|
:spinner="options.spinner"
|
|
23
23
|
:isLoading="isLoading"
|
|
24
24
|
)
|
|
25
|
-
|
|
25
|
+
DitoAccount(
|
|
26
26
|
v-if="user"
|
|
27
27
|
)
|
|
28
28
|
a.dito-login(
|
|
@@ -30,31 +30,9 @@
|
|
|
30
30
|
@click="rootComponent.login()"
|
|
31
31
|
)
|
|
32
32
|
span Login
|
|
33
|
-
|
|
33
|
+
RouterView
|
|
34
34
|
</template>
|
|
35
35
|
|
|
36
|
-
<style lang="sass">
|
|
37
|
-
@import '../styles/style'
|
|
38
|
-
|
|
39
|
-
.dito-app,
|
|
40
|
-
.dito-root
|
|
41
|
-
width: 100%
|
|
42
|
-
height: 100%
|
|
43
|
-
display: flex
|
|
44
|
-
|
|
45
|
-
.dito-root
|
|
46
|
-
.dito-page
|
|
47
|
-
background: $content-color-background
|
|
48
|
-
// The root-level views and forms may have a `.dito-schema-header` that
|
|
49
|
-
// should appear layered over `.dito-menu`, while having `overlay: hidden`
|
|
50
|
-
// set by `.dito-scroll-parent` to delegate scrolling to `.dito-scroll`.
|
|
51
|
-
// In order to not have the header clipped, adjust the top here:
|
|
52
|
-
> .dito-form,
|
|
53
|
-
> .dito-view
|
|
54
|
-
margin-top: -$menu-height
|
|
55
|
-
padding-top: $menu-height
|
|
56
|
-
</style>
|
|
57
|
-
|
|
58
36
|
<script>
|
|
59
37
|
import { asArray, mapConcurrently, stripTags } from '@ditojs/utils'
|
|
60
38
|
import DitoComponent from '../DitoComponent.js'
|
|
@@ -63,13 +41,15 @@ import DitoView from '../components/DitoView.vue'
|
|
|
63
41
|
import DitoDialog from './DitoDialog.vue'
|
|
64
42
|
import DomMixin from '../mixins/DomMixin.js'
|
|
65
43
|
import {
|
|
66
|
-
processView,
|
|
44
|
+
processView,
|
|
45
|
+
resolveSchemas,
|
|
46
|
+
processSchemaComponents
|
|
67
47
|
} from '../utils/schema.js'
|
|
68
48
|
|
|
69
49
|
// @vue/component
|
|
70
|
-
export default DitoComponent.component('
|
|
71
|
-
components: { DitoDialog },
|
|
50
|
+
export default DitoComponent.component('DitoRoot', {
|
|
72
51
|
mixins: [DomMixin],
|
|
52
|
+
components: { DitoDialog },
|
|
73
53
|
|
|
74
54
|
provide() {
|
|
75
55
|
return {
|
|
@@ -140,21 +120,27 @@ export default DitoComponent.component('dito-root', {
|
|
|
140
120
|
|
|
141
121
|
methods: {
|
|
142
122
|
notify({ type = 'info', title, text } = {}) {
|
|
143
|
-
title ||=
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
123
|
+
title ||= (
|
|
124
|
+
{
|
|
125
|
+
warning: 'Warning',
|
|
126
|
+
error: 'Error',
|
|
127
|
+
info: 'Information',
|
|
128
|
+
success: 'Success'
|
|
129
|
+
}[type] ||
|
|
130
|
+
'Notification'
|
|
131
|
+
)
|
|
149
132
|
text = `<p>${
|
|
150
133
|
asArray(text).join('</p> <p>')
|
|
151
134
|
}</p>`.replace(/\n|\r\n|\r/g, '<br>')
|
|
152
|
-
const log =
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
135
|
+
const log = (
|
|
136
|
+
{
|
|
137
|
+
warning: 'warn',
|
|
138
|
+
error: 'error',
|
|
139
|
+
info: 'log',
|
|
140
|
+
success: 'log'
|
|
141
|
+
}[type] ||
|
|
142
|
+
'error'
|
|
143
|
+
)
|
|
158
144
|
// eslint-disable-next-line no-console
|
|
159
145
|
console[log](stripTags(text))
|
|
160
146
|
const { notifications = true } = this.api
|
|
@@ -189,7 +175,7 @@ export default DitoComponent.component('dito-root', {
|
|
|
189
175
|
await processSchemaComponents(this.api, { components }, routes, 0)
|
|
190
176
|
if (routes.length > 0) {
|
|
191
177
|
throw new Error(
|
|
192
|
-
|
|
178
|
+
'Dialogs do not support components that produce routes'
|
|
193
179
|
)
|
|
194
180
|
}
|
|
195
181
|
const key = `dialog-${++dialogId}`
|
|
@@ -343,7 +329,6 @@ export default DitoComponent.component('dito-root', {
|
|
|
343
329
|
this.$router.replace(fullPath)
|
|
344
330
|
}
|
|
345
331
|
}
|
|
346
|
-
|
|
347
332
|
})
|
|
348
333
|
|
|
349
334
|
let dialogId = 0
|
|
@@ -362,3 +347,29 @@ function addRoutes(router, routes) {
|
|
|
362
347
|
}
|
|
363
348
|
}
|
|
364
349
|
</script>
|
|
350
|
+
|
|
351
|
+
<style lang="scss">
|
|
352
|
+
@import '../styles/style';
|
|
353
|
+
|
|
354
|
+
.dito-app,
|
|
355
|
+
.dito-root {
|
|
356
|
+
width: 100%;
|
|
357
|
+
height: 100%;
|
|
358
|
+
display: flex;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.dito-root {
|
|
362
|
+
.dito-page {
|
|
363
|
+
background: $content-color-background;
|
|
364
|
+
// The root-level views and forms may have a `.dito-schema-header` that
|
|
365
|
+
// should appear layered over `.dito-menu`, while having `overlay: hidden`
|
|
366
|
+
// set by `.dito-scroll-parent` to delegate scrolling to `.dito-scroll`.
|
|
367
|
+
// In order to not have the header clipped, adjust the top here:
|
|
368
|
+
> .dito-form,
|
|
369
|
+
> .dito-view {
|
|
370
|
+
margin-top: -$menu-height;
|
|
371
|
+
padding-top: $menu-height;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
</style>
|