@ditojs/admin 2.8.0 → 2.8.2

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.
@@ -1,15 +1,14 @@
1
1
  <template lang="pug">
2
- .dito-multiselect(
3
- :class=`{
4
- 'dito-multiselect-single': !multiple,
5
- 'dito-multiselect-multiple': multiple
6
- }`
7
- )
2
+ .dito-multiselect
8
3
  .dito-multiselect__inner
9
4
  VueMultiselect(
10
5
  ref="element"
11
6
  v-model="selectedOptions"
12
- :class="{ 'multiselect--show-highlight': showHighlight }"
7
+ :class=`{
8
+ 'multiselect--multiple': multiple,
9
+ 'multiselect--loading': isLoading,
10
+ 'multiselect--highlight': showHighlight
11
+ }`
13
12
  :showLabels="false"
14
13
  :placeholder="placeholder"
15
14
  tagPlaceholder="Press enter to add new tag"
@@ -38,6 +37,7 @@
38
37
  :disabled="disabled"
39
38
  @click="clear"
40
39
  )
40
+ //- Edit button is never disabled, even if the field is disabled.
41
41
  DitoEditButtons(
42
42
  v-if="editable"
43
43
  :schema="schema"
@@ -45,7 +45,7 @@
45
45
  :data="data"
46
46
  :meta="meta"
47
47
  :store="store"
48
- :disabled="disabled"
48
+ :disabled="false"
49
49
  :editable="editable"
50
50
  :editPath="editPath"
51
51
  )
@@ -240,16 +240,6 @@ $tag-line-height: 1em;
240
240
  position: relative;
241
241
  }
242
242
 
243
- // TODO: BEM
244
- &.dito-multiselect-single {
245
- --input-width: 100%;
246
- }
247
-
248
- // TODO: BEM
249
- &.dito-multiselect-multiple {
250
- --input-width: auto;
251
- }
252
-
253
243
  .dito-edit-buttons {
254
244
  margin-left: $form-spacing-half;
255
245
  }
@@ -257,10 +247,16 @@ $tag-line-height: 1em;
257
247
  .multiselect {
258
248
  $self: last-selector(&);
259
249
 
250
+ --input-width: 100%;
251
+
260
252
  font-size: inherit;
261
253
  min-height: inherit;
262
254
  color: $color-black;
263
255
 
256
+ &--multiple {
257
+ --input-width: auto;
258
+ }
259
+
264
260
  &__tags {
265
261
  display: flex;
266
262
  font-size: inherit;
@@ -372,11 +368,11 @@ $tag-line-height: 1em;
372
368
  }
373
369
 
374
370
  // Only show the highlight once the pulldown has received mouse or
375
- // keyboard interaction, in which case `&--show-highlight` will be set,
371
+ // keyboard interaction, in which case `&--highlight` will be set,
376
372
  // which is controlled by `pointerDirty` in vue-multiselect.
377
373
  // Until then, clear the highlight style, but only if it isn't also
378
374
  // disabled or selected, in which case we want to keep the style.
379
- @at-root #{$self}:not(#{$self}--show-highlight)
375
+ @at-root #{$self}:not(#{$self}--highlight)
380
376
  #{$option}:not(#{$option}--disabled):not(#{$option}--selected) {
381
377
  color: $color-text;
382
378
  background: transparent;
@@ -390,7 +386,7 @@ $tag-line-height: 1em;
390
386
  color: $color-white;
391
387
  }
392
388
 
393
- @at-root #{$self}#{$self}--show-highlight #{last-selector(&)} {
389
+ @at-root #{$self}#{$self}--highlight #{last-selector(&)} {
394
390
  color: $color-text-inverted;
395
391
  background: $color-active;
396
392
  }
@@ -401,7 +397,7 @@ $tag-line-height: 1em;
401
397
  color: $color-text;
402
398
  background: $color-highlight;
403
399
 
404
- @at-root #{$self}#{$self}--show-highlight &#{$option}--highlight {
400
+ @at-root #{$self}#{$self}--highlight &#{$option}--highlight {
405
401
  color: $color-text-inverted;
406
402
  }
407
403
  }
@@ -489,6 +485,16 @@ $tag-line-height: 1em;
489
485
  }
490
486
  }
491
487
  }
488
+
489
+ &--loading {
490
+ #{$self}__tags {
491
+ border-radius: $border-radius;
492
+ }
493
+
494
+ #{$self}__content-wrapper {
495
+ display: none;
496
+ }
497
+ }
492
498
  }
493
499
  }
494
500
  </style>
@@ -37,6 +37,7 @@
37
37
  :disabled="disabled"
38
38
  @click="clear"
39
39
  )
40
+ //- Edit button is never disabled, even if the field is disabled.
40
41
  DitoEditButtons(
41
42
  v-if="editable"
42
43
  :schema="schema"
@@ -44,7 +45,7 @@
44
45
  :data="data"
45
46
  :meta="meta"
46
47
  :store="store"
47
- :disabled="disabled"
48
+ :disabled="false"
48
49
  :editable="editable"
49
50
  :editPath="editPath"
50
51
  )
@@ -35,7 +35,7 @@
35
35
  DitoDraggable(
36
36
  v-model="files"
37
37
  tag="tbody"
38
- :options="getSortableOptions()"
38
+ :options="getDraggableOptions()"
39
39
  :draggable="draggable"
40
40
  )
41
41
  template(
@@ -485,11 +485,11 @@ export function getFormSchemas(schema, context, modifyForm) {
485
485
 
486
486
  let { form, forms } = schema
487
487
  if (!form && !forms) {
488
- const { components, tabs, compact, clipboard } = schema
488
+ const { name, compact, clipboard, tabs, components } = schema
489
489
  if (components || tabs) {
490
- // Convert inlined components to forms, also supporting `tabs`, `compact`
491
- // and `clipboard` settings.
492
- form = { components, tabs, compact, clipboard }
490
+ // Convert inlined forms to stand-alone forms, supporting `name`,
491
+ // `compact`, `clipboard`, `tabs` and `components` settings.
492
+ form = { type: 'form', name, compact, clipboard, tabs, components }
493
493
  } else {
494
494
  // No `forms`, `form` or `components`, return and empty `forms` object.
495
495
  return {}
@@ -702,10 +702,11 @@ function cloneItem(sourceSchema, item, options) {
702
702
 
703
703
  export function processData(schema, sourceSchema, data, dataPath, {
704
704
  component,
705
+ rootData,
705
706
  schemaOnly, // whether to only include data covered by the schema, or all data
706
707
  target
707
708
  } = {}) {
708
- const options = { component, schemaOnly, target, rootData: data }
709
+ const options = { component, rootData, schemaOnly, target }
709
710
  const processedData = cloneItem(sourceSchema, data, options)
710
711
  const graph = new SchemaGraph()
711
712
 
@@ -837,15 +838,15 @@ export function processSchemaData(
837
838
  const componentDataPath = getDataPath(dataPath, name)
838
839
 
839
840
  const processItem = (item, index = null) => {
840
- const dataPath =
841
+ const itemDataPath =
841
842
  index !== null
842
843
  ? getDataPath(componentDataPath, index)
843
844
  : componentDataPath
844
845
  const context = new DitoContext(options.component, {
845
846
  schema: componentSchema,
846
- data,
847
+ data: item,
847
848
  value: item,
848
- dataPath,
849
+ dataPath: itemDataPath,
849
850
  index,
850
851
  rootData: options.rootData
851
852
  })
@@ -862,7 +863,7 @@ export function processSchemaData(
862
863
  return processSchemaData(
863
864
  form,
864
865
  item,
865
- dataPath,
866
+ itemDataPath,
866
867
  processedItem,
867
868
  processBefore,
868
869
  processAfter,
@@ -882,6 +883,7 @@ export function processSchemaData(
882
883
  componentDataPath,
883
884
  processedData
884
885
  )
886
+
885
887
  let value = processedData ? processedData[name] : data[name]
886
888
  if (value != null && hasFormSchema(componentSchema)) {
887
889
  // Recursively process data on nested form items.
@@ -897,6 +899,7 @@ export function processSchemaData(
897
899
  processedData[name] = value
898
900
  }
899
901
  }
902
+
900
903
  processAfter?.(
901
904
  componentSchema,
902
905
  data,
@@ -1,13 +0,0 @@
1
- .dito-sortable-fallback {
2
- filter: drop-shadow(0 2px 4px $color-shadow);
3
-
4
- // Nested <td> need to also switch to `display: block` style during dragging
5
- &,
6
- td {
7
- display: flex;
8
-
9
- > * {
10
- flex: 1;
11
- }
12
- }
13
- }