@fishawack/lab-velocity 2.0.0-beta.1 → 2.0.0-beta.10
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/README.md +160 -38
- package/_Build/vue/components/Icon.vue +33 -0
- package/_Build/vue/components/Svg.vue +45 -0
- package/_Build/vue/components/basic/Button.vue +109 -0
- package/_Build/vue/components/basic/link.vue +64 -0
- package/_Build/vue/components/form/Cascader.vue +85 -0
- package/_Build/vue/components/form/Checkbox.vue +39 -0
- package/_Build/vue/components/form/CheckboxGroup.vue +91 -0
- package/_Build/vue/components/form/DatePicker.vue +116 -0
- package/_Build/vue/components/form/InputNumber.vue +89 -0
- package/_Build/vue/components/form/Select.vue +109 -0
- package/_Build/vue/components/form/Spinner.vue +5 -0
- package/_Build/vue/components/form/Switch.vue +63 -0
- package/_Build/vue/components/form/Upload.vue +101 -0
- package/_Build/vue/components/form/Wysiwyg.vue +127 -0
- package/_Build/vue/components/form/Wysiwyg2.vue +577 -0
- package/_Build/vue/components/form/basic.vue +106 -0
- package/_Build/vue/components/form/color.vue +22 -0
- package/_Build/vue/components/form/file.vue +89 -0
- package/_Build/vue/components/form/input.js +79 -0
- package/_Build/vue/components/form/input.vue +105 -0
- package/_Build/vue/components/layout/Alert.vue +38 -0
- package/_Build/vue/components/layout/Footer.vue +50 -0
- package/_Build/vue/components/layout/Header.vue +13 -0
- package/_Build/vue/components/layout/Loader.vue +59 -0
- package/_Build/vue/components/layout/Tooltip.vue +46 -0
- package/_Build/vue/components/layout/pageTitle.vue +18 -0
- package/_Build/vue/components/layout/sideBar.vue +25 -0
- package/_Build/vue/components/navigation/Breadcrumbs.vue +37 -0
- package/_Build/vue/components/navigation/BreadcrumbsItem.vue +19 -0
- package/_Build/vue/components/navigation/Menu.vue +14 -0
- package/_Build/vue/components/navigation/MenuItem.vue +20 -0
- package/_Build/vue/components/navigation/MenuItemGroup.vue +20 -0
- package/_Build/vue/components/navigation/SubMenu.vue +20 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/Upload/upload.vue +259 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/create.vue +62 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/edit.vue +98 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/index.vue +90 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/partials/form.vue +181 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/show.vue +267 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/parent.vue +36 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/create.vue +113 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/edit.vue +101 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/index.vue +112 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/partials/form.vue +174 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/show.vue +123 -0
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/parent.vue +36 -0
- package/_Build/vue/modules/AuthModule/components/AuthModal.vue +105 -0
- package/_Build/vue/modules/AuthModule/components/Chip.vue +70 -0
- package/_Build/vue/modules/AuthModule/components/Chips.vue +26 -0
- package/_Build/vue/modules/AuthModule/components/FormRole.vue +117 -0
- package/_Build/vue/modules/AuthModule/components/VBreadcrumbs.vue +33 -0
- package/_Build/vue/modules/AuthModule/components/VFormFooter.vue +52 -0
- package/_Build/vue/modules/AuthModule/components/VPageHeader.vue +38 -0
- package/_Build/vue/modules/AuthModule/components/VPasswordValidation.vue +106 -0
- package/_Build/vue/modules/AuthModule/components/VRoleLegend.vue +43 -0
- package/_Build/vue/modules/AuthModule/components/VTable.vue +136 -0
- package/_Build/vue/modules/AuthModule/components/VTableSorter.vue +252 -0
- package/_Build/vue/modules/AuthModule/js/FakeAPI.js +78 -0
- package/_Build/vue/modules/AuthModule/js/axios.js +81 -0
- package/_Build/vue/modules/AuthModule/js/router.js +295 -0
- package/_Build/vue/modules/AuthModule/js/store.js +62 -0
- package/_Build/vue/modules/AuthModule/routes/account-exists.vue +33 -0
- package/_Build/vue/modules/AuthModule/routes/change-password.vue +163 -0
- package/_Build/vue/modules/AuthModule/routes/container.vue +34 -0
- package/_Build/vue/modules/AuthModule/routes/expired-reset.vue +78 -0
- package/_Build/vue/modules/AuthModule/routes/expired-verification.vue +101 -0
- package/_Build/vue/modules/AuthModule/routes/force-reset.vue +147 -0
- package/_Build/vue/modules/AuthModule/routes/forgot.vue +91 -0
- package/_Build/vue/modules/AuthModule/routes/login.vue +139 -0
- package/_Build/vue/modules/AuthModule/routes/logincallback.vue +39 -0
- package/_Build/vue/modules/AuthModule/routes/loginheadless.vue +21 -0
- package/_Build/vue/modules/AuthModule/routes/loginsso.vue +132 -0
- package/_Build/vue/modules/AuthModule/routes/logout.vue +19 -0
- package/_Build/vue/modules/AuthModule/routes/logoutheadless.vue +25 -0
- package/_Build/vue/modules/AuthModule/routes/register.vue +171 -0
- package/_Build/vue/modules/AuthModule/routes/reset.vue +133 -0
- package/_Build/vue/modules/AuthModule/routes/success-forgot.vue +120 -0
- package/_Build/vue/modules/AuthModule/routes/success-reset.vue +35 -0
- package/_Build/vue/modules/AuthModule/routes/success-verify.vue +30 -0
- package/_Build/vue/modules/AuthModule/routes/verify.vue +110 -0
- package/_base.scss +0 -1
- package/_defaults.scss +2 -13
- package/_variables.scss +9 -4
- package/{modules/_AuthModule.scss → components/_auth.scss} +19 -68
- package/package.json +3 -8
- package/vendor.scss +0 -1
- package/components/_input.scss +0 -0
- package/modules/_AuthVariables.scss +0 -7
- /package/{modules → components}/_modal.scss +0 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<!-- eslint-disable vue/no-mutating-props -->
|
|
2
|
+
<template>
|
|
3
|
+
<h2 class="font-primary">Access Control</h2>
|
|
4
|
+
|
|
5
|
+
<template v-if="readonly">
|
|
6
|
+
<p>Roles</p>
|
|
7
|
+
<div v-if="!overrides" class="my-2">
|
|
8
|
+
<Chip
|
|
9
|
+
class="mr mb inline-block"
|
|
10
|
+
name="inherited"
|
|
11
|
+
label="Inherited"
|
|
12
|
+
/>
|
|
13
|
+
</div>
|
|
14
|
+
<ul v-else class="my-2 pl-0">
|
|
15
|
+
<li
|
|
16
|
+
v-for="role in form.roles"
|
|
17
|
+
:key="roles.find((d) => d.id === role)"
|
|
18
|
+
class="mr mb inline-block"
|
|
19
|
+
>
|
|
20
|
+
<Chip
|
|
21
|
+
:name="roles.find((d) => d.id === role)?.name"
|
|
22
|
+
:label="roles.find((d) => d.id === role)?.label"
|
|
23
|
+
/>
|
|
24
|
+
</li>
|
|
25
|
+
</ul>
|
|
26
|
+
</template>
|
|
27
|
+
<VelSelect
|
|
28
|
+
v-else
|
|
29
|
+
v-model="form.roles"
|
|
30
|
+
class="mt-2"
|
|
31
|
+
placeholder="Select"
|
|
32
|
+
multiple
|
|
33
|
+
name="roles"
|
|
34
|
+
:error="form.errors"
|
|
35
|
+
label="Roles"
|
|
36
|
+
:options="
|
|
37
|
+
roles?.map(({ id, label }) => ({
|
|
38
|
+
label,
|
|
39
|
+
value: id,
|
|
40
|
+
}))
|
|
41
|
+
"
|
|
42
|
+
/>
|
|
43
|
+
|
|
44
|
+
<template v-if="permissions.length && (overrides === null || overrides)">
|
|
45
|
+
<p>Permissions</p>
|
|
46
|
+
<ul class="mt-2 pl-0">
|
|
47
|
+
<li
|
|
48
|
+
v-for="(permission, index) in permissions"
|
|
49
|
+
:key="index"
|
|
50
|
+
class="mr mb inline-block"
|
|
51
|
+
>
|
|
52
|
+
<Chip :name="permission.name" :label="permission.label" />
|
|
53
|
+
</li>
|
|
54
|
+
</ul>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<VRoleLegend class="mt-2" />
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<script>
|
|
61
|
+
import axios from "axios";
|
|
62
|
+
import VelSelect from "../../../components/form/Select.vue";
|
|
63
|
+
|
|
64
|
+
export default {
|
|
65
|
+
components: {
|
|
66
|
+
VRoleLegend: require("./VRoleLegend.vue").default,
|
|
67
|
+
Chip: require("./Chip.vue").default,
|
|
68
|
+
VelSelect,
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
props: {
|
|
72
|
+
form: {
|
|
73
|
+
required: true,
|
|
74
|
+
type: Object,
|
|
75
|
+
},
|
|
76
|
+
readonly: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
default: false,
|
|
79
|
+
},
|
|
80
|
+
overrides: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: null,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
data() {
|
|
87
|
+
return {
|
|
88
|
+
roles: [],
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
computed: {
|
|
93
|
+
permissions() {
|
|
94
|
+
const allPermissions = this.form.roles.reduce((acc, id) => {
|
|
95
|
+
return acc.concat(
|
|
96
|
+
this.roles.find((d) => d.id === id)?.permissions || [],
|
|
97
|
+
);
|
|
98
|
+
}, []);
|
|
99
|
+
|
|
100
|
+
// Remove duplicates based on permission id
|
|
101
|
+
return allPermissions
|
|
102
|
+
.filter((permission, index, self) => {
|
|
103
|
+
return (
|
|
104
|
+
index === self.findIndex((p) => p.id === permission.id)
|
|
105
|
+
);
|
|
106
|
+
})
|
|
107
|
+
.sort();
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
mounted() {
|
|
112
|
+
axios.getAll("/api/roles").then((res) => {
|
|
113
|
+
this.roles = res.data.data;
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
</script>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="py mobile:hidden">
|
|
3
|
+
<div class="container px-6 tablet:px-4 mobile:px-2 mb-8 ml-0 mr-0">
|
|
4
|
+
<div class="grid__1/1">
|
|
5
|
+
<div class="flex items-center">
|
|
6
|
+
<breadcrumbs :crumbs="items" />
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
import Breadcrumbs from "../../../components/navigation/Breadcrumbs.vue";
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
name: "VBreadcrumbs",
|
|
18
|
+
components: {
|
|
19
|
+
Breadcrumbs,
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
props: {
|
|
23
|
+
containerClasses: {
|
|
24
|
+
type: [String, Array, Object],
|
|
25
|
+
default: "",
|
|
26
|
+
},
|
|
27
|
+
items: {
|
|
28
|
+
type: Array,
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
</script>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="grid items-center my-4">
|
|
3
|
+
<slot>
|
|
4
|
+
<VelButton type="primary" native-type="submit" :loading="loading">
|
|
5
|
+
Save changes
|
|
6
|
+
</VelButton>
|
|
7
|
+
|
|
8
|
+
<VelButton tag="a" class="ml-2" @click="$router.go(-1)">
|
|
9
|
+
Discard changes
|
|
10
|
+
</VelButton>
|
|
11
|
+
|
|
12
|
+
<VelButton
|
|
13
|
+
v-if="method === 'patch' && preview"
|
|
14
|
+
class="ml-2"
|
|
15
|
+
tag="a"
|
|
16
|
+
:href="preview"
|
|
17
|
+
target="_blank"
|
|
18
|
+
link
|
|
19
|
+
>
|
|
20
|
+
<span v-text="`Preview`" />
|
|
21
|
+
</VelButton>
|
|
22
|
+
</slot>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
import VelButton from "../../../components/basic/Button.vue";
|
|
28
|
+
|
|
29
|
+
export default {
|
|
30
|
+
name: "VFormFooter",
|
|
31
|
+
|
|
32
|
+
components: {
|
|
33
|
+
VelButton,
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
props: {
|
|
37
|
+
loading: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false,
|
|
40
|
+
},
|
|
41
|
+
method: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: "post",
|
|
44
|
+
},
|
|
45
|
+
preview: {
|
|
46
|
+
type: String,
|
|
47
|
+
required: false,
|
|
48
|
+
default: "",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
</script>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="grid justify-between">
|
|
3
|
+
<div class="grid__4/6 flex justify-start">
|
|
4
|
+
<span v-if="icon">
|
|
5
|
+
<div
|
|
6
|
+
class="p-1.5 mr-2 border-radius border border-solid border-muted flex items-center justify-center"
|
|
7
|
+
>
|
|
8
|
+
<GIcon class="icon--3 fill-1" :name="icon" embed artboard />
|
|
9
|
+
</div>
|
|
10
|
+
</span>
|
|
11
|
+
|
|
12
|
+
<h2 class="m-0 font-500 text-secondary">{{ title }}</h2>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<div class="grid__2/6 flex gap justify-end items-start">
|
|
16
|
+
<div class="flex gap items-center">
|
|
17
|
+
<slot />
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
export default {
|
|
25
|
+
name: "VShowPageHeader",
|
|
26
|
+
|
|
27
|
+
props: {
|
|
28
|
+
icon: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: null,
|
|
31
|
+
},
|
|
32
|
+
title: {
|
|
33
|
+
type: String,
|
|
34
|
+
required: true,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
</script>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="">
|
|
3
|
+
<p class="font-700 AM-mb-0.5">Your password must contain:</p>
|
|
4
|
+
<p class="flex m-0">
|
|
5
|
+
<GSvg
|
|
6
|
+
name="icon-list-tick"
|
|
7
|
+
embed
|
|
8
|
+
artboard
|
|
9
|
+
class="mr-0.5 icon icon--0.4 fill-7"
|
|
10
|
+
v-if="passwordLengthValid"
|
|
11
|
+
/>
|
|
12
|
+
<GSvg
|
|
13
|
+
name="icon-list-tick"
|
|
14
|
+
embed
|
|
15
|
+
artboard
|
|
16
|
+
class="mr-0.5 icon icon--0.4 fill-3"
|
|
17
|
+
v-else
|
|
18
|
+
/>
|
|
19
|
+
At least 8 characters
|
|
20
|
+
</p>
|
|
21
|
+
<p class="flex m-0">
|
|
22
|
+
<GSvg
|
|
23
|
+
name="icon-list-tick"
|
|
24
|
+
embed
|
|
25
|
+
artboard
|
|
26
|
+
class="mr-0.5 icon icon--0.4 fill-7"
|
|
27
|
+
v-if="hasLetter"
|
|
28
|
+
/>
|
|
29
|
+
<GSvg
|
|
30
|
+
name="icon-list-tick"
|
|
31
|
+
embed
|
|
32
|
+
artboard
|
|
33
|
+
class="mr-0.5 icon icon--0.4 fill-3"
|
|
34
|
+
v-else
|
|
35
|
+
/>
|
|
36
|
+
At least one letter
|
|
37
|
+
</p>
|
|
38
|
+
<p class="flex AM-mt-0 ml-0 mr-0 AM-mb-3">
|
|
39
|
+
<GSvg
|
|
40
|
+
name="icon-list-tick"
|
|
41
|
+
embed
|
|
42
|
+
artboard
|
|
43
|
+
class="mr-0.5 icon icon--0.4 fill-7"
|
|
44
|
+
v-if="hasNumberOrSymbol"
|
|
45
|
+
/>
|
|
46
|
+
<GSvg
|
|
47
|
+
name="icon-list-tick"
|
|
48
|
+
embed
|
|
49
|
+
artboard
|
|
50
|
+
class="mr-0.5 icon icon--0.4 fill-3"
|
|
51
|
+
v-else
|
|
52
|
+
/>
|
|
53
|
+
At least one number or symbol
|
|
54
|
+
</p>
|
|
55
|
+
</div>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<script>
|
|
59
|
+
export default {
|
|
60
|
+
props: {
|
|
61
|
+
password: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: "",
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
computed: {
|
|
67
|
+
passwordLengthValid() {
|
|
68
|
+
return this.password?.length >= 8;
|
|
69
|
+
},
|
|
70
|
+
hasLetter() {
|
|
71
|
+
return this.tests.letter.test(this.password);
|
|
72
|
+
},
|
|
73
|
+
hasNumberOrSymbol() {
|
|
74
|
+
return (
|
|
75
|
+
this.tests.number.test(this.password) ||
|
|
76
|
+
this.tests.symbol.test(this.password)
|
|
77
|
+
);
|
|
78
|
+
},
|
|
79
|
+
passwordValid() {
|
|
80
|
+
return (
|
|
81
|
+
this.passwordLengthValid &&
|
|
82
|
+
this.hasLetter &&
|
|
83
|
+
this.hasNumberOrSymbol
|
|
84
|
+
);
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
data() {
|
|
88
|
+
return {
|
|
89
|
+
tests: {
|
|
90
|
+
letter: /[a-zA-Z]+/,
|
|
91
|
+
number: /[0-9]+/,
|
|
92
|
+
symbol: /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]+/,
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
watch: {
|
|
97
|
+
password(newPassword) {
|
|
98
|
+
this.$emit("passwordValid", this.passwordValid);
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
methods: {},
|
|
102
|
+
mounted() {
|
|
103
|
+
this.$emit("passwordValid", this.passwordValid);
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
</script>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="permission-legend">
|
|
3
|
+
<p class="font-700 text-18 mb-1.5">Legend</p>
|
|
4
|
+
<p class="font-700 text-16 mb-1.5">Roles</p>
|
|
5
|
+
|
|
6
|
+
<ul class="permission-legend__list">
|
|
7
|
+
<li v-for="role in roles" :key="role.name">
|
|
8
|
+
<VChip :name="role.name" :label="role.label" />
|
|
9
|
+
<span class="permission-legend__description">{{
|
|
10
|
+
role.description
|
|
11
|
+
}}</span>
|
|
12
|
+
</li>
|
|
13
|
+
</ul>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
import axios from "axios";
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
components: {
|
|
22
|
+
VChip: require("./Chip.vue").default,
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
data() {
|
|
26
|
+
return {
|
|
27
|
+
roles: null,
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
mounted() {
|
|
32
|
+
axios.get("/api/roles").then((res) => {
|
|
33
|
+
this.roles = [
|
|
34
|
+
{
|
|
35
|
+
name: "inherited",
|
|
36
|
+
label: "Inherited",
|
|
37
|
+
description: "Roles are inherited from the parent company.",
|
|
38
|
+
},
|
|
39
|
+
].concat(res.data.data);
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
</script>
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-table
|
|
3
|
+
:data="$props.data"
|
|
4
|
+
:height="fixedHeight ? 762 : undefined"
|
|
5
|
+
style="width: 100%"
|
|
6
|
+
@sort-change="handleSort"
|
|
7
|
+
>
|
|
8
|
+
<slot v-bind="$props">
|
|
9
|
+
<template
|
|
10
|
+
v-for="(item, index) in $props.structure"
|
|
11
|
+
:key="'d' + index"
|
|
12
|
+
>
|
|
13
|
+
<el-table-column
|
|
14
|
+
:width="item.width ?? 'auto'"
|
|
15
|
+
:sortable="!!item.sortable ? 'custom' : false"
|
|
16
|
+
:label="item.label"
|
|
17
|
+
:prop="item.key"
|
|
18
|
+
:show-overflow-tooltip="true"
|
|
19
|
+
>
|
|
20
|
+
<!-- Support a custom render function -->
|
|
21
|
+
<template v-if="item.render" #default="scope">
|
|
22
|
+
{{ item.render(scope.row) }}
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<!-- Support module passed (as a raw component or :is property) -->
|
|
26
|
+
<template v-else-if="item.component" #default="scope">
|
|
27
|
+
<component
|
|
28
|
+
:is="
|
|
29
|
+
item.component.is
|
|
30
|
+
? item.component.is(scope.row)
|
|
31
|
+
: item.component.module(scope.row)
|
|
32
|
+
"
|
|
33
|
+
v-bind="item.component.props(scope.row)"
|
|
34
|
+
/>
|
|
35
|
+
</template>
|
|
36
|
+
</el-table-column>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<el-table-column
|
|
40
|
+
v-if="$props.displayActions"
|
|
41
|
+
label="Action"
|
|
42
|
+
align="center"
|
|
43
|
+
:width="155"
|
|
44
|
+
>
|
|
45
|
+
<template #default="scope">
|
|
46
|
+
<router-link
|
|
47
|
+
v-if="$props.displayShowAction"
|
|
48
|
+
:to="$props.targetAction($props.data[scope.$index])"
|
|
49
|
+
>
|
|
50
|
+
<VelButton size="small" type="primary">
|
|
51
|
+
{{ `View` }}
|
|
52
|
+
</VelButton>
|
|
53
|
+
</router-link>
|
|
54
|
+
<router-link
|
|
55
|
+
v-if="$props.displayEditAction"
|
|
56
|
+
class="ml"
|
|
57
|
+
:to="$props.editAction($props.data[scope.$index])"
|
|
58
|
+
>
|
|
59
|
+
<VelButton size="small">
|
|
60
|
+
{{ `Edit` }}
|
|
61
|
+
</VelButton>
|
|
62
|
+
</router-link>
|
|
63
|
+
</template>
|
|
64
|
+
</el-table-column>
|
|
65
|
+
</slot>
|
|
66
|
+
</el-table>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<script>
|
|
70
|
+
import { ElTable, ElTableColumn } from "element-plus";
|
|
71
|
+
import VelButton from "../../../components/basic/Button.vue";
|
|
72
|
+
|
|
73
|
+
export default {
|
|
74
|
+
name: "VTable",
|
|
75
|
+
|
|
76
|
+
components: {
|
|
77
|
+
ElTable,
|
|
78
|
+
ElTableColumn,
|
|
79
|
+
VelButton,
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
props: {
|
|
83
|
+
data: {
|
|
84
|
+
type: [Array, Object],
|
|
85
|
+
default() {
|
|
86
|
+
return [];
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
structure: {
|
|
90
|
+
type: Array,
|
|
91
|
+
default() {
|
|
92
|
+
return [];
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
label: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: "record",
|
|
98
|
+
},
|
|
99
|
+
targetAction: {
|
|
100
|
+
type: Function,
|
|
101
|
+
default: () => {
|
|
102
|
+
return "";
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
editAction: {
|
|
106
|
+
type: Function,
|
|
107
|
+
default: () => {
|
|
108
|
+
return "";
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
fixedHeight: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
default: true,
|
|
114
|
+
},
|
|
115
|
+
displayActions: {
|
|
116
|
+
type: Boolean,
|
|
117
|
+
default: true,
|
|
118
|
+
},
|
|
119
|
+
displayShowAction: {
|
|
120
|
+
type: Boolean,
|
|
121
|
+
default: true,
|
|
122
|
+
},
|
|
123
|
+
displayEditAction: {
|
|
124
|
+
type: Boolean,
|
|
125
|
+
default: true,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
emits: ["sort"],
|
|
129
|
+
|
|
130
|
+
methods: {
|
|
131
|
+
handleSort(data) {
|
|
132
|
+
this.$emit("sort", data);
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
</script>
|