@ditojs/admin 2.0.3 → 2.0.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditojs/admin",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "type": "module",
5
5
  "description": "Dito.js Admin is a schema based admin interface for Dito.js Server, featuring auto-generated views and forms and built with Vue.js",
6
6
  "repository": "https://github.com/ditojs/dito/tree/master/packages/admin",
@@ -33,7 +33,7 @@
33
33
  "not ie_mob > 0"
34
34
  ],
35
35
  "dependencies": {
36
- "@ditojs/ui": "^2.0.3",
36
+ "@ditojs/ui": "^2.0.4",
37
37
  "@ditojs/utils": "^2.0.1",
38
38
  "@kyvg/vue3-notification": "^2.9.0",
39
39
  "@lk77/vue3-color": "^3.0.6",
@@ -58,13 +58,15 @@
58
58
  "@tiptap/extension-underline": "^2.0.2",
59
59
  "@tiptap/pm": "^2.0.2",
60
60
  "@tiptap/vue-3": "^2.0.2",
61
+ "@vueuse/integrations": "^10.0.0-beta.2",
61
62
  "codeflask": "^1.4.1",
62
63
  "filesize": "^10.0.7",
63
64
  "filesize-parser": "^1.5.0",
65
+ "focus-trap": "^7.4.0",
64
66
  "nanoid": "^4.0.2",
67
+ "sortablejs": "^1.15.0",
65
68
  "tinycolor2": "^1.6.0",
66
69
  "vue": "^3.2.47",
67
- "vue-draggable-plus": "^0.1.1",
68
70
  "vue-multiselect": "^3.0.0-beta.1",
69
71
  "vue-router": "^4.1.6",
70
72
  "vue-upload-component": "^3.1.8"
@@ -80,7 +82,7 @@
80
82
  "vite": "^4.2.1"
81
83
  },
82
84
  "types": "types",
83
- "gitHead": "5ca73cc4cf410fbaa95a8e7079cb5c264cc67b7c",
85
+ "gitHead": "ee7c025d76cf6a59825a407455d3b990e0f016ed",
84
86
  "scripts": {
85
87
  "build": "vite build",
86
88
  "watch": "yarn build --mode 'development' --watch",
@@ -6,16 +6,17 @@
6
6
  :style="{ '--width': `${settings.width}px` }"
7
7
  @click="settings.clickToClose && close()"
8
8
  )
9
- form.dito-scroll-parent(@submit.prevent="submit")
10
- dito-schema.dito-scroll(
11
- :schema="schema"
12
- :data="dialogData"
13
- )
14
- template(#buttons)
15
- dito-buttons.dito-buttons-large(
16
- :buttons="buttonSchemas"
17
- :data="dialogData"
18
- )
9
+ use-focus-trap(:options="{ immediate: true }")
10
+ form.dito-scroll-parent(@submit.prevent="submit")
11
+ dito-schema.dito-scroll(
12
+ :schema="schema"
13
+ :data="dialogData"
14
+ )
15
+ template(#buttons)
16
+ dito-buttons.dito-buttons-large(
17
+ :buttons="buttonSchemas"
18
+ :data="dialogData"
19
+ )
19
20
  </template>
20
21
 
21
22
  <style lang="sass">
@@ -65,9 +66,12 @@ import { clone } from '@ditojs/utils'
65
66
  import { addEvents } from '@ditojs/ui/src'
66
67
  import DitoComponent from '../DitoComponent.js'
67
68
  import { getButtonSchemas } from '../utils/schema.js'
69
+ import { UseFocusTrap } from '@vueuse/integrations/useFocusTrap/component'
68
70
 
69
71
  // @vue/component
70
72
  export default DitoComponent.component('dito-dialog', {
73
+ components: { UseFocusTrap },
74
+
71
75
  provide() {
72
76
  return {
73
77
  $dialogComponent: () => this
@@ -60,14 +60,12 @@
60
60
  :store="store"
61
61
  :disabled="disabled"
62
62
  )
63
- vue-draggable(
63
+ use-sortable(
64
64
  v-if="childrenSchema"
65
65
  v-show="opened"
66
66
  :modelValue="updateOrder(childrenSchema, childrenList)"
67
67
  @update:modelValue="value => childrenList = value"
68
- @start="onStartDrag"
69
- @end="onEndDrag($event, childrenSchema)"
70
- v-bind="getDragOptions(childrenDraggable, true)"
68
+ :options="getSortableOptions(childrenDraggable, true)"
71
69
  )
72
70
  dito-tree-item(
73
71
  v-for="(item, index) in childrenItems"
@@ -152,17 +150,15 @@
152
150
  </style>
153
151
 
154
152
  <script>
155
- import { VueDraggable } from 'vue-draggable-plus'
156
153
  import DitoComponent from '../DitoComponent.js'
157
- import OrderedMixin from '../mixins/OrderedMixin.js'
154
+ import SortableMixin from '../mixins/SortableMixin.js'
158
155
  import { appendDataPath } from '../utils/data.js'
159
156
  import { getSchemaAccessor } from '../utils/accessor.js'
160
157
  import { getNamedSchemas, hasFormSchema } from '../utils/schema.js'
161
158
 
162
159
  // @vue/component
163
160
  export default DitoComponent.component('dito-tree-item', {
164
- components: { VueDraggable },
165
- mixins: [OrderedMixin],
161
+ mixins: [SortableMixin],
166
162
  inject: ['container'],
167
163
 
168
164
  props: {
@@ -245,19 +245,6 @@ export default {
245
245
  }
246
246
  },
247
247
 
248
- getDragOptions(draggable, fallback = false) {
249
- return {
250
- animation: 150,
251
- disabled: !draggable,
252
- handle: '.dito-button-drag',
253
- dragClass: 'dito-drag-active',
254
- chosenClass: 'dito-drag-chosen',
255
- ghostClass: 'dito-drag-ghost',
256
- fallbackClass: 'dito-drag-fallback',
257
- forceFallback: fallback
258
- }
259
- },
260
-
261
248
  // TODO: Rename *Link() to *Route().
262
249
  getQueryLink(query) {
263
250
  return {
@@ -1,7 +1,9 @@
1
- import ItemMixin from '../mixins/ItemMixin.js'
1
+ import ItemMixin from './ItemMixin.js'
2
+ import { UseSortable } from '@vueuse/integrations/useSortable/component'
2
3
 
3
4
  // @vue/component
4
5
  export default {
6
+ components: { UseSortable },
5
7
  mixins: [ItemMixin],
6
8
 
7
9
  data() {
@@ -11,6 +13,21 @@ export default {
11
13
  },
12
14
 
13
15
  methods: {
16
+ getSortableOptions(draggable, fallback = false) {
17
+ return {
18
+ animation: 150,
19
+ disabled: !draggable,
20
+ handle: '.dito-button-drag',
21
+ dragClass: 'dito-sortable-active',
22
+ chosenClass: 'dito-sortable-chosen',
23
+ ghostClass: 'dito-sortable-ghost',
24
+ fallbackClass: 'dito-sortable-fallback',
25
+ forceFallback: fallback,
26
+ onStart: this.onStartDrag,
27
+ onEnd: this.onEndDrag
28
+ }
29
+ },
30
+
14
31
  onStartDrag() {
15
32
  this.dragging = true
16
33
  },
@@ -1,4 +1,4 @@
1
- .dito-drag-fallback
1
+ .dito-sortable-fallback
2
2
  filter: drop-shadow(0 2px 4px $color-shadow)
3
3
 
4
4
  // Nested <td> need to also switch to `display: block` style during dragging
@@ -5,6 +5,6 @@
5
5
  @import '_pulldown'
6
6
  @import '_layout'
7
7
  @import '_scroll'
8
- @import '_drag'
8
+ @import '_sortable'
9
9
  @import '_table'
10
10
  @import '_notifications'
@@ -38,13 +38,11 @@
38
38
  :columns="columns"
39
39
  :hasEditButtons="hasEditButtons"
40
40
  )
41
- vue-draggable(
41
+ use-sortable(
42
42
  tag="tbody"
43
43
  :modelValue="updateOrder(sourceSchema, listData, paginationRange)"
44
44
  @update:modelValue="value => listData = value"
45
- @start="onStartDrag"
46
- @end="onEndDrag"
47
- :v-bind="getDragOptions(draggable)"
45
+ :options="getSortableOptions(draggable)"
48
46
  )
49
47
  tr(
50
48
  v-for="item, index in listData"
@@ -176,11 +174,10 @@
176
174
  </style>
177
175
 
178
176
  <script>
179
- import { VueDraggable } from 'vue-draggable-plus'
180
177
  import TypeComponent from '../TypeComponent.js'
181
178
  import DitoContext from '../DitoContext.js'
182
179
  import SourceMixin from '../mixins/SourceMixin.js'
183
- import OrderedMixin from '../mixins/OrderedMixin.js'
180
+ import SortableMixin from '../mixins/SortableMixin.js'
184
181
  import {
185
182
  getNamedSchemas, getViewEditPath,
186
183
  resolveSchemaComponent, resolveSchemaComponents
@@ -191,8 +188,7 @@ import { pickBy, equals, hyphenate } from '@ditojs/utils'
191
188
 
192
189
  // @vue/component
193
190
  export default TypeComponent.register('list', {
194
- components: { VueDraggable },
195
- mixins: [SourceMixin, OrderedMixin],
191
+ mixins: [SourceMixin, SortableMixin],
196
192
 
197
193
  getSourceType(type) {
198
194
  // No need for transformation here. See TypeTreeList for details.
@@ -12,12 +12,10 @@
12
12
  span Status
13
13
  th
14
14
  span
15
- vue-draggable(
15
+ use-sortable(
16
16
  tag="tbody"
17
- @start="onStartDrag"
18
- @end="onEndDrag"
19
17
  v-model="files"
20
- v-bind="getDragOptions(draggable)"
18
+ :options="getSortableOptions(draggable)"
21
19
  )
22
20
  tr(
23
21
  v-for="(file, index) in files"
@@ -107,21 +105,20 @@
107
105
  </style>
108
106
 
109
107
  <script>
110
- import VueUpload from 'vue-upload-component'
111
- import { VueDraggable } from 'vue-draggable-plus'
112
108
  import TypeComponent from '../TypeComponent.js'
113
109
  import DitoContext from '../DitoContext.js'
114
- import OrderedMixin from '../mixins/OrderedMixin.js'
110
+ import SortableMixin from '../mixins/SortableMixin.js'
115
111
  import parseFileSize from 'filesize-parser'
116
112
  import { getSchemaAccessor } from '../utils/accessor.js'
117
113
  import { formatFileSize } from '../utils/units.js'
118
114
  import { appendDataPath } from '../utils/data.js'
119
115
  import { isArray, asArray, escapeHtml } from '@ditojs/utils'
116
+ import VueUpload from 'vue-upload-component'
120
117
 
121
118
  // @vue/component
122
119
  export default TypeComponent.register('upload', {
123
- components: { VueUpload, VueDraggable },
124
- mixins: [OrderedMixin],
120
+ components: { VueUpload },
121
+ mixins: [SortableMixin],
125
122
 
126
123
  data() {
127
124
  return {