@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,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
- dito-schema.dito-panel-schema(
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
- dito-buttons(
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('dito-panel', {
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
- dito-panel(
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('dito-panels', {
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
- vue-notifications.dito-notifications(
3
+ VueNotifications.dito-notifications(
4
4
  ref="notifications"
5
5
  position="top right"
6
6
  classes="dito-notification"
7
7
  )
8
- transition-group(name="dito-dialog")
9
- dito-dialog(
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
- dito-menu
19
+ DitoMenu
20
20
  main.dito-page.dito-scroll-parent
21
- dito-header(
21
+ DitoHeader(
22
22
  :spinner="options.spinner"
23
23
  :isLoading="isLoading"
24
24
  )
25
- dito-account(
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
- router-view
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, resolveSchemas, processSchemaComponents
44
+ processView,
45
+ resolveSchemas,
46
+ processSchemaComponents
67
47
  } from '../utils/schema.js'
68
48
 
69
49
  // @vue/component
70
- export default DitoComponent.component('dito-root', {
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
- warning: 'Warning',
145
- error: 'Error',
146
- info: 'Information',
147
- success: 'Success'
148
- }[type] || 'Notification'
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
- warning: 'warn',
154
- error: 'error',
155
- info: 'log',
156
- success: 'log'
157
- }[type] || 'error'
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
- `Dialog components cannot contain routes, only components with schemas.`
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>