aloha-vue 1.9.0 → 1.9.1
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/CHANGELOG.md +4 -0
- package/docs/src/router/index.js +1 -1
- package/docs/src/views/Form/PageRouterLinkConfig/PageRouterLinkConfigBasic/PageRouterLinkConfigBasic.js +1 -1
- package/docs/src/views/Form/PageRouterLinkConfig/PageRouterLinkConfigBasic/PageRouterLinkConfigBasic.pug +1 -0
- package/package.json +1 -1
- package/src/plugins/ARouterLinkConfigPlugin.js +46 -14
- package/src/ui/ARouterLinkConfig/ARouterLinkConfig.js +22 -22
- package/src/ui/ARouterLinkConfig/compositionAPI/ParamAPI.js +2 -0
- package/src/ui/ARouterLinkConfig/compositionAPI/RouteAPI.js +1 -16
- package/src/ui/ARouterLinkConfig/compositionAPI/TargetAPI.js +0 -24
package/CHANGELOG.md
CHANGED
package/docs/src/router/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ref,
|
|
3
|
-
} from "vue";
|
|
4
|
-
|
|
5
1
|
import {
|
|
6
2
|
forEach,
|
|
7
3
|
} from "lodash-es";
|
|
8
4
|
|
|
9
|
-
export const routerLinkConfigPluginOptions =
|
|
5
|
+
export const routerLinkConfigPluginOptions = {
|
|
10
6
|
propsDefault: {
|
|
11
7
|
classColumn: "a_column a_column_12",
|
|
12
8
|
classColumns: "a_columns a_columns_count_12 a_columns_gap_y_1",
|
|
@@ -22,9 +18,49 @@ export const routerLinkConfigPluginOptions = ref({
|
|
|
22
18
|
labelTarget: "_A_ROUTER_LINK_CONFIG_LABEL_TARGET_",
|
|
23
19
|
routes: [],
|
|
24
20
|
sortOrderRoute: "asc",
|
|
21
|
+
targets: [
|
|
22
|
+
{
|
|
23
|
+
id: "_blank",
|
|
24
|
+
label: "_A_TARGET_BLANK_",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "_self",
|
|
28
|
+
label: "_A_TARGET_SELF_",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: "_parent",
|
|
32
|
+
label: "_A_TARGET_PARENT_",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: "_top",
|
|
36
|
+
label: "_A_TARGET_TOP_",
|
|
37
|
+
},
|
|
38
|
+
],
|
|
25
39
|
},
|
|
26
|
-
|
|
27
|
-
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
function setRoutes({ routes = [], excludedPathRoutes = [] }) {
|
|
43
|
+
const ROUTES = [];
|
|
44
|
+
const EXCLUDED_PATH_ROUTES_MAP = {};
|
|
45
|
+
if (excludedPathRoutes.length) {
|
|
46
|
+
forEach(excludedPathRoutes, path => {
|
|
47
|
+
EXCLUDED_PATH_ROUTES_MAP[path] = true;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
forEach(routes, route => {
|
|
51
|
+
const PATH = route.path;
|
|
52
|
+
if (route.name &&
|
|
53
|
+
!EXCLUDED_PATH_ROUTES_MAP[PATH]) {
|
|
54
|
+
ROUTES.push({
|
|
55
|
+
path: route.path,
|
|
56
|
+
name: route.name,
|
|
57
|
+
meta: route.meta,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
return ROUTES;
|
|
63
|
+
}
|
|
28
64
|
|
|
29
65
|
|
|
30
66
|
export default {
|
|
@@ -32,14 +68,10 @@ export default {
|
|
|
32
68
|
propsDefault = {},
|
|
33
69
|
excludedPathRoutes = [],
|
|
34
70
|
} = {}) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
routerLinkConfigPluginOptions.value.excludedPathRoutes[path] = true;
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
routerLinkConfigPluginOptions.value.propsDefault = {
|
|
41
|
-
...routerLinkConfigPluginOptions.value.propsDefault,
|
|
71
|
+
routerLinkConfigPluginOptions.propsDefault = {
|
|
72
|
+
...routerLinkConfigPluginOptions.propsDefault,
|
|
42
73
|
...propsDefault,
|
|
74
|
+
routes: setRoutes({ routes: propsDefault.routes, excludedPathRoutes }),
|
|
43
75
|
};
|
|
44
76
|
},
|
|
45
77
|
};
|
|
@@ -13,7 +13,6 @@ import AttributesAPI from "../ACheckbox/compositionAPI/AttributesAPI";
|
|
|
13
13
|
import ModelLocalAPI from "./compositionAPI/ModelLocalAPI";
|
|
14
14
|
import ParamAPI from "./compositionAPI/ParamAPI";
|
|
15
15
|
import RouteAPI from "./compositionAPI/RouteAPI";
|
|
16
|
-
import TargetAPI from "./compositionAPI/TargetAPI";
|
|
17
16
|
import TextAfterLabelAPI from "../ACheckbox/compositionAPI/TextAfterLabelAPI";
|
|
18
17
|
import UiAPI from "../compositionApi/UiAPI";
|
|
19
18
|
import UiDisabledAPI from "../compositionApi/UiDisabledAPI";
|
|
@@ -43,12 +42,12 @@ export default {
|
|
|
43
42
|
classColumn: {
|
|
44
43
|
type: [String, Object],
|
|
45
44
|
required: false,
|
|
46
|
-
default: () => routerLinkConfigPluginOptions.
|
|
45
|
+
default: () => routerLinkConfigPluginOptions.propsDefault.classColumn,
|
|
47
46
|
},
|
|
48
47
|
classColumns: {
|
|
49
48
|
type: [String, Object],
|
|
50
49
|
required: false,
|
|
51
|
-
default: () => routerLinkConfigPluginOptions.
|
|
50
|
+
default: () => routerLinkConfigPluginOptions.propsDefault.classColumns,
|
|
52
51
|
},
|
|
53
52
|
classFieldset: {
|
|
54
53
|
type: [String, Object],
|
|
@@ -87,22 +86,22 @@ export default {
|
|
|
87
86
|
helpTextParam: {
|
|
88
87
|
type: String,
|
|
89
88
|
required: false,
|
|
90
|
-
default: () => routerLinkConfigPluginOptions.
|
|
89
|
+
default: () => routerLinkConfigPluginOptions.propsDefault.helpTextParam,
|
|
91
90
|
},
|
|
92
91
|
helpTextQuery: {
|
|
93
92
|
type: String,
|
|
94
93
|
required: false,
|
|
95
|
-
default: () => routerLinkConfigPluginOptions.
|
|
94
|
+
default: () => routerLinkConfigPluginOptions.propsDefault.helpTextQuery,
|
|
96
95
|
},
|
|
97
96
|
helpTextRoute: {
|
|
98
97
|
type: String,
|
|
99
98
|
required: false,
|
|
100
|
-
default: () => routerLinkConfigPluginOptions.
|
|
99
|
+
default: () => routerLinkConfigPluginOptions.propsDefault.helpTextRoute,
|
|
101
100
|
},
|
|
102
101
|
helpTextTarget: {
|
|
103
102
|
type: String,
|
|
104
103
|
required: false,
|
|
105
|
-
default: () => routerLinkConfigPluginOptions.
|
|
104
|
+
default: () => routerLinkConfigPluginOptions.propsDefault.helpTextTarget,
|
|
106
105
|
},
|
|
107
106
|
htmlId: {
|
|
108
107
|
type: String,
|
|
@@ -136,7 +135,7 @@ export default {
|
|
|
136
135
|
keyIdRoute: {
|
|
137
136
|
type: String,
|
|
138
137
|
required: false,
|
|
139
|
-
default: () => routerLinkConfigPluginOptions.
|
|
138
|
+
default: () => routerLinkConfigPluginOptions.propsDefault.keyIdRoute,
|
|
140
139
|
},
|
|
141
140
|
keyLabelCallbackRoute: {
|
|
142
141
|
type: Function,
|
|
@@ -146,7 +145,7 @@ export default {
|
|
|
146
145
|
keyLabelRoute: {
|
|
147
146
|
type: String,
|
|
148
147
|
required: false,
|
|
149
|
-
default: () => routerLinkConfigPluginOptions.
|
|
148
|
+
default: () => routerLinkConfigPluginOptions.propsDefault.keyLabelRoute,
|
|
150
149
|
},
|
|
151
150
|
label: {
|
|
152
151
|
type: [String, Number],
|
|
@@ -161,17 +160,17 @@ export default {
|
|
|
161
160
|
labelParam: {
|
|
162
161
|
type: String,
|
|
163
162
|
required: false,
|
|
164
|
-
default: () => routerLinkConfigPluginOptions.
|
|
163
|
+
default: () => routerLinkConfigPluginOptions.propsDefault.labelParam,
|
|
165
164
|
},
|
|
166
165
|
labelQuery: {
|
|
167
166
|
type: String,
|
|
168
167
|
required: false,
|
|
169
|
-
default: () => routerLinkConfigPluginOptions.
|
|
168
|
+
default: () => routerLinkConfigPluginOptions.propsDefault.labelQuery,
|
|
170
169
|
},
|
|
171
170
|
labelRoute: {
|
|
172
171
|
type: String,
|
|
173
172
|
required: false,
|
|
174
|
-
default: () => routerLinkConfigPluginOptions.
|
|
173
|
+
default: () => routerLinkConfigPluginOptions.propsDefault.labelRoute,
|
|
175
174
|
},
|
|
176
175
|
labelScreenReader: {
|
|
177
176
|
type: [String, Number],
|
|
@@ -181,7 +180,7 @@ export default {
|
|
|
181
180
|
labelTarget: {
|
|
182
181
|
type: String,
|
|
183
182
|
required: false,
|
|
184
|
-
default: () => routerLinkConfigPluginOptions.
|
|
183
|
+
default: () => routerLinkConfigPluginOptions.propsDefault.labelTarget,
|
|
185
184
|
},
|
|
186
185
|
modelUndefined: {
|
|
187
186
|
type: [String, Number, Object, Array, Boolean],
|
|
@@ -191,7 +190,7 @@ export default {
|
|
|
191
190
|
modelValue: {
|
|
192
191
|
type: Object,
|
|
193
192
|
required: false,
|
|
194
|
-
default:
|
|
193
|
+
default: () => ({}),
|
|
195
194
|
},
|
|
196
195
|
required: {
|
|
197
196
|
type: Boolean,
|
|
@@ -201,7 +200,7 @@ export default {
|
|
|
201
200
|
routes: {
|
|
202
201
|
type: Array,
|
|
203
202
|
required: false,
|
|
204
|
-
default: () => routerLinkConfigPluginOptions.
|
|
203
|
+
default: () => routerLinkConfigPluginOptions.propsDefault.routes,
|
|
205
204
|
},
|
|
206
205
|
slotName: {
|
|
207
206
|
type: String,
|
|
@@ -211,9 +210,14 @@ export default {
|
|
|
211
210
|
sortOrderRoute: {
|
|
212
211
|
type: String,
|
|
213
212
|
required: false,
|
|
214
|
-
default: () => routerLinkConfigPluginOptions.
|
|
213
|
+
default: () => routerLinkConfigPluginOptions.propsDefault.sortOrderRoute,
|
|
215
214
|
validator: value => ["asc", "desc"].indexOf(value) !== -1,
|
|
216
215
|
},
|
|
216
|
+
targets: {
|
|
217
|
+
type: Array,
|
|
218
|
+
required: false,
|
|
219
|
+
default: () => routerLinkConfigPluginOptions.propsDefault.targets,
|
|
220
|
+
},
|
|
217
221
|
},
|
|
218
222
|
emits: [
|
|
219
223
|
"update:modelValue",
|
|
@@ -277,10 +281,6 @@ export default {
|
|
|
277
281
|
routePathKeyByKeyId,
|
|
278
282
|
});
|
|
279
283
|
|
|
280
|
-
const {
|
|
281
|
-
targets,
|
|
282
|
-
} = TargetAPI();
|
|
283
|
-
|
|
284
284
|
return {
|
|
285
285
|
ariaDescribedbyLocal,
|
|
286
286
|
attributesToExcludeFromRender,
|
|
@@ -301,7 +301,6 @@ export default {
|
|
|
301
301
|
onBlur,
|
|
302
302
|
onFocus,
|
|
303
303
|
routesLocal,
|
|
304
|
-
targets,
|
|
305
304
|
textAfterLabel,
|
|
306
305
|
};
|
|
307
306
|
},
|
|
@@ -356,7 +355,7 @@ export default {
|
|
|
356
355
|
class: this.classColumn,
|
|
357
356
|
}, [
|
|
358
357
|
h(ASelect, {
|
|
359
|
-
id: "
|
|
358
|
+
id: "route",
|
|
360
359
|
change: this.changeRouteModel,
|
|
361
360
|
data: this.routesLocal,
|
|
362
361
|
deselectable: true,
|
|
@@ -386,6 +385,7 @@ export default {
|
|
|
386
385
|
idPrefix: this.htmlIdLocal,
|
|
387
386
|
label: this.labelParam,
|
|
388
387
|
modelValue: this.modelValue.param || {},
|
|
388
|
+
required: this.required,
|
|
389
389
|
}),
|
|
390
390
|
]) :
|
|
391
391
|
"",
|
|
@@ -12,6 +12,7 @@ export default function ParamAPI(props, {
|
|
|
12
12
|
routePathKeyByKeyId = computed(() => ({})),
|
|
13
13
|
}) {
|
|
14
14
|
const modelValue = toRef(props, "modelValue");
|
|
15
|
+
const required = toRef(props, "required");
|
|
15
16
|
|
|
16
17
|
const extractRouteParams = path => {
|
|
17
18
|
const regex = /:([a-zA-Z0-9_]+)/g;
|
|
@@ -46,6 +47,7 @@ export default function ParamAPI(props, {
|
|
|
46
47
|
label: _id,
|
|
47
48
|
type: "text",
|
|
48
49
|
idPrefix: htmlIdLocal.value,
|
|
50
|
+
required: required.value,
|
|
49
51
|
};
|
|
50
52
|
|
|
51
53
|
CHILDREN.push(CHILD);
|
|
@@ -3,9 +3,6 @@ import {
|
|
|
3
3
|
toRef,
|
|
4
4
|
} from "vue";
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
routerLinkConfigPluginOptions,
|
|
8
|
-
} from "../../../plugins/ARouterLinkConfigPlugin";
|
|
9
6
|
import {
|
|
10
7
|
forEach,
|
|
11
8
|
get,
|
|
@@ -16,19 +13,7 @@ export default function RouteAPI(props) {
|
|
|
16
13
|
const routes = toRef(props, "routes");
|
|
17
14
|
|
|
18
15
|
const routesLocal = computed(() => {
|
|
19
|
-
|
|
20
|
-
forEach(routes.value, route => {
|
|
21
|
-
const PATH = route.path;
|
|
22
|
-
if (route.name &&
|
|
23
|
-
!routerLinkConfigPluginOptions.value.excludedPathRoutes[PATH]) {
|
|
24
|
-
ROUTES.push({
|
|
25
|
-
path: route.path,
|
|
26
|
-
name: route.name,
|
|
27
|
-
meta: route.meta,
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
return ROUTES;
|
|
16
|
+
return routes.value;
|
|
32
17
|
});
|
|
33
18
|
|
|
34
19
|
const routePathKeyByKeyId = computed(() => {
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export default function TargetAPI() {
|
|
2
|
-
const targets = [
|
|
3
|
-
{
|
|
4
|
-
id: "_blank",
|
|
5
|
-
label: "_A_TARGET_BLANK_",
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
id: "_self",
|
|
9
|
-
label: "_A_TARGET_SELF_",
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
id: "_parent",
|
|
13
|
-
label: "_A_TARGET_PARENT_",
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
id: "_top",
|
|
17
|
-
label: "_A_TARGET_TOP_",
|
|
18
|
-
},
|
|
19
|
-
];
|
|
20
|
-
|
|
21
|
-
return {
|
|
22
|
-
targets,
|
|
23
|
-
};
|
|
24
|
-
}
|