@ditojs/admin 2.9.0 → 2.9.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.
@@ -0,0 +1,119 @@
1
+ <template lang="pug">
2
+ .dito-trail
3
+ ul
4
+ li(
5
+ v-for="component in trail"
6
+ )
7
+ a.dito-link(
8
+ :class="getLinkClass(component)"
9
+ :href="getComponentHref(component)"
10
+ @click.prevent.stop="onClickComponent(component)"
11
+ )
12
+ span(:class="getSpanClass(component)")
13
+ | {{ component.breadcrumb }}
14
+ slot
15
+ </template>
16
+
17
+ <script>
18
+ import DitoComponent from '../DitoComponent.js'
19
+
20
+ // @vue/component
21
+ export default DitoComponent.component('DitoTrail', {
22
+ computed: {
23
+ trail() {
24
+ return this.appState.routeComponents.filter(
25
+ component => !!component.routeRecord
26
+ )
27
+ }
28
+ },
29
+
30
+ methods: {
31
+ getComponentPath(component) {
32
+ // Do the same as in `DitoMenu`: Link menu items to the first children.
33
+ const { schema } = component
34
+ return schema.type === 'menu'
35
+ ? Object.values(schema.items)[0].fullPath
36
+ : component.path
37
+ },
38
+
39
+ getComponentHref(component) {
40
+ return this.$router.resolve(this.getComponentPath(component)).href
41
+ },
42
+
43
+ onClickComponent(component) {
44
+ this.$router.push({
45
+ path: this.getComponentPath(component),
46
+ force: true
47
+ })
48
+ },
49
+
50
+ getLinkClass(component) {
51
+ return {
52
+ 'dito-active': component.path === this.$route.path
53
+ }
54
+ },
55
+
56
+ getSpanClass(component) {
57
+ return {
58
+ 'dito-dirty': component.isDirty
59
+ }
60
+ }
61
+ }
62
+ })
63
+ </script>
64
+
65
+ <style lang="scss">
66
+ @import '../styles/_imports';
67
+
68
+ .dito-trail {
69
+ display: flex;
70
+ box-sizing: border-box;
71
+ height: 3em;
72
+
73
+ ul {
74
+ display: flex;
75
+ }
76
+
77
+ li {
78
+ white-space: nowrap;
79
+ }
80
+
81
+ a {
82
+ position: relative;
83
+ display: block;
84
+
85
+ &:hover {
86
+ span {
87
+ color: $color-light;
88
+ }
89
+ }
90
+ }
91
+
92
+ li:not(:last-child) a {
93
+ $angle: 33deg;
94
+
95
+ &::before,
96
+ &::after {
97
+ position: absolute;
98
+ content: '';
99
+ width: 1px;
100
+ height: 0.75em;
101
+ right: -0.25em;
102
+ background: $color-white;
103
+ opacity: 0.5;
104
+ }
105
+
106
+ &::before {
107
+ top: 50%;
108
+ transform: rotate($angle);
109
+ transform-origin: top;
110
+ }
111
+
112
+ &::after {
113
+ bottom: 50%;
114
+ transform: rotate(-$angle);
115
+ transform-origin: bottom;
116
+ }
117
+ }
118
+ }
119
+ </style>
@@ -101,11 +101,15 @@ export default DitoComponent.component('DitoView', {
101
101
  },
102
102
 
103
103
  watch: {
104
- $route(to, from) {
105
- // See if the route changes completely, and clear the data if it does.
106
- if (this.isFullRouteChange(to, from)) {
107
- this.isLoading = false
108
- this.data = {}
104
+ $route: {
105
+ // https://github.com/vuejs/vue-router/issues/3393#issuecomment-1158470149
106
+ flush: 'post',
107
+ handler(to, from) {
108
+ // See if the route changes completely, and clear the data if it does.
109
+ if (this.isFullRouteChange(to, from)) {
110
+ this.isLoading = false
111
+ this.data = {}
112
+ }
109
113
  }
110
114
  }
111
115
  },
@@ -5,8 +5,10 @@
5
5
 
6
6
  export { default as DitoRoot } from './DitoRoot.vue'
7
7
  export { default as DitoMenu } from './DitoMenu.vue'
8
+ export { default as DitoTrail } from './DitoTrail.vue'
8
9
  export { default as DitoHeader } from './DitoHeader.vue'
9
10
  export { default as DitoNavigation } from './DitoNavigation.vue'
11
+ export { default as DitoNotifications } from './DitoNotifications.vue'
10
12
  export { default as DitoSidebar } from './DitoSidebar.vue'
11
13
  export { default as DitoAccount } from './DitoAccount.vue'
12
14
  export { default as DitoDialog } from './DitoDialog.vue'
@@ -34,4 +36,5 @@ export { default as DitoTableHead } from './DitoTableHead.vue'
34
36
  export { default as DitoTableCell } from './DitoTableCell.vue'
35
37
  export { default as DitoUploadFile } from './DitoUploadFile.vue'
36
38
  export { default as DitoDraggable } from './DitoDraggable.vue'
39
+ export { default as DitoSpinner } from './DitoSpinner.vue'
37
40
  export { default as DitoVNode } from './DitoVNode.vue'
@@ -164,15 +164,15 @@ export default {
164
164
  next(ok)
165
165
  },
166
166
 
167
- getRoutePath(templatePath) {
167
+ getRoutePath(recordPath) {
168
168
  // Maps the route's actual path to the matched routes by counting its
169
169
  // parts separated by '/', splitting the path into the mapped parts
170
170
  // containing actual parameters.
171
171
  const { path } = this.$route
172
- return templatePath
172
+ return recordPath
173
173
  ? path
174
174
  .split('/')
175
- .slice(0, templatePath.split('/').length)
175
+ .slice(0, recordPath.split('/').length)
176
176
  .join('/')
177
177
  : path
178
178
  },
@@ -314,12 +314,20 @@ export default {
314
314
  },
315
315
 
316
316
  watch: {
317
- $route(to, from) {
318
- if (this.providesData && from.path === to.path && from.hash === to.hash) {
319
- // Paths and hashes remain the same, so only queries have changed.
320
- // Update filter and reload data without clearing.
321
- this.query = to.query
322
- this.loadData(false)
317
+ $route: {
318
+ // https://github.com/vuejs/vue-router/issues/3393#issuecomment-1158470149
319
+ flush: 'post',
320
+ handler(to, from) {
321
+ if (
322
+ this.providesData &&
323
+ from.path === to.path &&
324
+ from.hash === to.hash
325
+ ) {
326
+ // Paths and hashes remain the same, so only queries have changed.
327
+ // Update filter and reload data without clearing.
328
+ this.query = to.query
329
+ this.loadData(false)
330
+ }
323
331
  }
324
332
  },
325
333
 
@@ -7,4 +7,3 @@
7
7
  @import '_table';
8
8
  @import '_info';
9
9
  @import '_tippy';
10
- @import '_notifications';
@@ -1,54 +0,0 @@
1
- @use 'sass:color';
2
-
3
- @mixin type($background) {
4
- background: color.adjust($background, $lightness: 5%);
5
- color: $color-white;
6
- border-left: 12px solid color.adjust($background, $lightness: -10%);
7
- }
8
-
9
- .dito-notifications {
10
- .dito-notification {
11
- padding: 8px;
12
- margin: 12px 12px 0;
13
- font-size: inherit;
14
- color: $color-white;
15
- border-radius: $border-radius;
16
- box-shadow: $shadow-window;
17
-
18
- .notification-title {
19
- font-weight: bold;
20
- padding-bottom: 8px;
21
- }
22
-
23
- .notification-content {
24
- p {
25
- margin: 0;
26
-
27
- & + p {
28
- margin-top: 8px;
29
- }
30
- }
31
- }
32
-
33
- &,
34
- &.info {
35
- @include type($color-active);
36
- }
37
-
38
- &.success {
39
- @include type($color-success);
40
- }
41
-
42
- &.warning {
43
- @include type($color-warning);
44
- }
45
-
46
- &.error {
47
- @include type($color-error);
48
- }
49
- }
50
-
51
- .vue-notification-wrapper {
52
- overflow: visible;
53
- }
54
- }