@fishawack/lab-velocity 2.0.0-beta.1 → 2.0.0-beta.11
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,116 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<XInput v-bind="$props">
|
|
3
|
+
<template #label>
|
|
4
|
+
<slot name="label" />
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<el-date-picker
|
|
8
|
+
v-bind="$attrs.props"
|
|
9
|
+
:type="type"
|
|
10
|
+
:disabled="disabled"
|
|
11
|
+
:disabled-date="disabledDate"
|
|
12
|
+
-
|
|
13
|
+
:placeholder="placeholder"
|
|
14
|
+
:shortcuts="shortcuts"
|
|
15
|
+
:size="size"
|
|
16
|
+
class="w-100 vel-datepicker"
|
|
17
|
+
v-model="content"
|
|
18
|
+
@change="handleInput"
|
|
19
|
+
:value-format="valueFormat"
|
|
20
|
+
:date-format="dateFormat"
|
|
21
|
+
:time-format="timeFormat"
|
|
22
|
+
:format="format"
|
|
23
|
+
:popper-class="popperClass"
|
|
24
|
+
:prefix-icon="prefixIcon"
|
|
25
|
+
/>
|
|
26
|
+
</XInput>
|
|
27
|
+
</template>
|
|
28
|
+
<script>
|
|
29
|
+
import dayjs from "dayjs";
|
|
30
|
+
import { ElDatePicker } from "element-plus";
|
|
31
|
+
|
|
32
|
+
import input from "./input.js";
|
|
33
|
+
import XInput from "./input.vue";
|
|
34
|
+
|
|
35
|
+
export default {
|
|
36
|
+
mixins: [input],
|
|
37
|
+
props: {
|
|
38
|
+
...input.props,
|
|
39
|
+
type: {
|
|
40
|
+
type: String,
|
|
41
|
+
validator: (value) =>
|
|
42
|
+
[
|
|
43
|
+
"date",
|
|
44
|
+
"year",
|
|
45
|
+
"years",
|
|
46
|
+
"month",
|
|
47
|
+
"months",
|
|
48
|
+
"date",
|
|
49
|
+
"dates",
|
|
50
|
+
"datetime",
|
|
51
|
+
"week",
|
|
52
|
+
"datetimerange",
|
|
53
|
+
"daterange",
|
|
54
|
+
"monthrange",
|
|
55
|
+
"yearrange",
|
|
56
|
+
].includes(value),
|
|
57
|
+
default: "date",
|
|
58
|
+
},
|
|
59
|
+
format: {
|
|
60
|
+
type: String,
|
|
61
|
+
},
|
|
62
|
+
valueFormat: {
|
|
63
|
+
type: String,
|
|
64
|
+
},
|
|
65
|
+
dateFormat: {
|
|
66
|
+
type: String,
|
|
67
|
+
},
|
|
68
|
+
timeFormat: {
|
|
69
|
+
type: String,
|
|
70
|
+
},
|
|
71
|
+
baseClass: {
|
|
72
|
+
type: String,
|
|
73
|
+
default: "vel-datepicker",
|
|
74
|
+
},
|
|
75
|
+
minDate: {
|
|
76
|
+
type: [Date, String],
|
|
77
|
+
},
|
|
78
|
+
maxDate: {
|
|
79
|
+
type: [Date, String],
|
|
80
|
+
},
|
|
81
|
+
shortcuts: {
|
|
82
|
+
type: Array,
|
|
83
|
+
default: [],
|
|
84
|
+
},
|
|
85
|
+
size: {
|
|
86
|
+
type: String,
|
|
87
|
+
default: "default",
|
|
88
|
+
},
|
|
89
|
+
popperClass: {
|
|
90
|
+
type: String,
|
|
91
|
+
default: "vel-popper",
|
|
92
|
+
},
|
|
93
|
+
prefixIcon: {
|
|
94
|
+
type: String,
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
components: {
|
|
98
|
+
XInput,
|
|
99
|
+
ElDatePicker,
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
methods: {
|
|
103
|
+
disabledDate(date) {
|
|
104
|
+
if (this.minDate && dayjs(date).isBefore(this.minDate)) {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (this.maxDate && dayjs(date).isAfter(this.maxDate)) {
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return false;
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
</script>
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<XInput v-bind="$props">
|
|
3
|
+
<template #label>
|
|
4
|
+
<slot name="label" />
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<el-input-number
|
|
8
|
+
v-bind="{ ...$attrs, class: undefined }"
|
|
9
|
+
:class="[`${baseClass}`]"
|
|
10
|
+
:name="name"
|
|
11
|
+
:id="name"
|
|
12
|
+
:disabled="disabled"
|
|
13
|
+
:min="min"
|
|
14
|
+
:max="max"
|
|
15
|
+
:size="size"
|
|
16
|
+
:precision="precision"
|
|
17
|
+
:step="step"
|
|
18
|
+
:controls="controls"
|
|
19
|
+
:step-strictly="stepStrictly"
|
|
20
|
+
:placeholder="placeholder"
|
|
21
|
+
v-model="content"
|
|
22
|
+
:required="required"
|
|
23
|
+
@input="handleInput"
|
|
24
|
+
>
|
|
25
|
+
<template #prefix>
|
|
26
|
+
<slot name="prefix" />
|
|
27
|
+
</template>
|
|
28
|
+
<template #suffix>
|
|
29
|
+
<slot name="suffix" />
|
|
30
|
+
</template>
|
|
31
|
+
<template #decrease-icon>
|
|
32
|
+
<slot name="decrease-icon" />
|
|
33
|
+
</template>
|
|
34
|
+
<template #increase-icon>
|
|
35
|
+
<slot name="increase-icon" />
|
|
36
|
+
</template>
|
|
37
|
+
</el-input-number>
|
|
38
|
+
</XInput>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script>
|
|
42
|
+
import { ElInputNumber } from "element-plus";
|
|
43
|
+
import input from "./input.js";
|
|
44
|
+
import XInput from "./input.vue";
|
|
45
|
+
|
|
46
|
+
export default {
|
|
47
|
+
mixins: [input],
|
|
48
|
+
props: {
|
|
49
|
+
...input.props,
|
|
50
|
+
baseClass: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: "vel-input-number",
|
|
53
|
+
},
|
|
54
|
+
min: {
|
|
55
|
+
type: Number,
|
|
56
|
+
default: -Infinity,
|
|
57
|
+
},
|
|
58
|
+
max: {
|
|
59
|
+
type: Number,
|
|
60
|
+
default: Infinity,
|
|
61
|
+
},
|
|
62
|
+
precision: {
|
|
63
|
+
type: Number,
|
|
64
|
+
default: null,
|
|
65
|
+
},
|
|
66
|
+
step: {
|
|
67
|
+
type: Number,
|
|
68
|
+
default: 1,
|
|
69
|
+
},
|
|
70
|
+
stepStrictly: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: true,
|
|
73
|
+
},
|
|
74
|
+
size: {
|
|
75
|
+
type: String,
|
|
76
|
+
default: "default",
|
|
77
|
+
},
|
|
78
|
+
controls: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: true,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
components: {
|
|
85
|
+
XInput,
|
|
86
|
+
ElInputNumber,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
</script>
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<XInput v-bind="$props">
|
|
3
|
+
<template #label>
|
|
4
|
+
<slot name="label" />
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<el-select
|
|
8
|
+
v-model="content"
|
|
9
|
+
:class="baseClass"
|
|
10
|
+
:multiple="multiple"
|
|
11
|
+
:placeholder="placeholder"
|
|
12
|
+
:disabled="disabled"
|
|
13
|
+
:clearable="clearable"
|
|
14
|
+
:collapse-tags="collapseTags"
|
|
15
|
+
:filterable="filterable"
|
|
16
|
+
:value-on-clear="null"
|
|
17
|
+
@change="handleInput"
|
|
18
|
+
@clear="this.$emit('clear')"
|
|
19
|
+
@blur="this.$emit('blur')"
|
|
20
|
+
:empty-values="[null, undefined]"
|
|
21
|
+
>
|
|
22
|
+
<template #default>
|
|
23
|
+
<slot name="default">
|
|
24
|
+
<el-option
|
|
25
|
+
v-if="!options[0]?.label"
|
|
26
|
+
v-for="(label, value) in options"
|
|
27
|
+
:key="value"
|
|
28
|
+
:label="label"
|
|
29
|
+
:value="castValue(value)"
|
|
30
|
+
>
|
|
31
|
+
</el-option>
|
|
32
|
+
<el-option
|
|
33
|
+
v-else
|
|
34
|
+
v-for="option in options"
|
|
35
|
+
:key="option.value"
|
|
36
|
+
:label="option.label"
|
|
37
|
+
:disabled="option.disabled"
|
|
38
|
+
:value="castValue(option.value)"
|
|
39
|
+
>
|
|
40
|
+
</el-option>
|
|
41
|
+
</slot>
|
|
42
|
+
</template>
|
|
43
|
+
</el-select>
|
|
44
|
+
</XInput>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script>
|
|
48
|
+
import { ElSelect } from "element-plus";
|
|
49
|
+
import { ElOption } from "element-plus";
|
|
50
|
+
import input from "./input.js";
|
|
51
|
+
import XInput from "./input.vue";
|
|
52
|
+
import _ from "lodash";
|
|
53
|
+
|
|
54
|
+
export default {
|
|
55
|
+
mixins: [input],
|
|
56
|
+
props: {
|
|
57
|
+
...input.props,
|
|
58
|
+
modelValue: {
|
|
59
|
+
type: [Array, Number],
|
|
60
|
+
default: () => [],
|
|
61
|
+
},
|
|
62
|
+
baseClass: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: "vel-select",
|
|
65
|
+
},
|
|
66
|
+
clearable: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: false,
|
|
69
|
+
},
|
|
70
|
+
collapseTags: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: false,
|
|
73
|
+
},
|
|
74
|
+
filterable: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: false,
|
|
77
|
+
},
|
|
78
|
+
options: {
|
|
79
|
+
type: Array,
|
|
80
|
+
default: [],
|
|
81
|
+
},
|
|
82
|
+
multiple: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: false,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
components: {
|
|
89
|
+
XInput,
|
|
90
|
+
ElOption,
|
|
91
|
+
ElSelect,
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
emits: ["change", "clear", "blur"],
|
|
95
|
+
methods: {
|
|
96
|
+
castValue(value) {
|
|
97
|
+
if (
|
|
98
|
+
!_.isNull(value) &&
|
|
99
|
+
typeof value === "string" &&
|
|
100
|
+
value !== "" &&
|
|
101
|
+
!isNaN(Number(value))
|
|
102
|
+
) {
|
|
103
|
+
return parseInt(value);
|
|
104
|
+
}
|
|
105
|
+
return value;
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
</script>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<XInput v-bind="$props">
|
|
3
|
+
<template #label v-if="label">
|
|
4
|
+
<slot name="label" />
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<el-switch
|
|
8
|
+
:class="[`${baseClass}__control`]"
|
|
9
|
+
:name="name"
|
|
10
|
+
:id="id ? id : name"
|
|
11
|
+
:size="size"
|
|
12
|
+
:disabled="disabled"
|
|
13
|
+
:inline-prompt="inlinePrompt"
|
|
14
|
+
:active-icon="activeIcon"
|
|
15
|
+
:inactive-icon="inactiveIcon"
|
|
16
|
+
v-model="content"
|
|
17
|
+
:required="required"
|
|
18
|
+
@input="handleInput"
|
|
19
|
+
/>
|
|
20
|
+
</XInput>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
import { ElSwitch } from "element-plus";
|
|
25
|
+
import input from "./input.js";
|
|
26
|
+
import XInput from "./input.vue";
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
mixins: [input],
|
|
30
|
+
props: {
|
|
31
|
+
...input.props,
|
|
32
|
+
modelValue: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: null,
|
|
35
|
+
},
|
|
36
|
+
baseClass: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: "vel-switch",
|
|
39
|
+
},
|
|
40
|
+
size: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: "default",
|
|
43
|
+
},
|
|
44
|
+
inlinePrompt: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false,
|
|
47
|
+
},
|
|
48
|
+
activeIcon: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: "",
|
|
51
|
+
},
|
|
52
|
+
inactiveIcon: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: "",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
components: {
|
|
59
|
+
XInput,
|
|
60
|
+
ElSwitch,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
</script>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<XInput v-bind="$props">
|
|
3
|
+
<template #label>
|
|
4
|
+
<slot name="label" />
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<el-upload
|
|
8
|
+
ref="upload"
|
|
9
|
+
v-bind="$attrs.props"
|
|
10
|
+
:class="[`${baseClass}`]"
|
|
11
|
+
:name="name"
|
|
12
|
+
:id="name"
|
|
13
|
+
:disabled="disabled"
|
|
14
|
+
:limit="limit"
|
|
15
|
+
:action="action"
|
|
16
|
+
:on-exceed="onExceed"
|
|
17
|
+
v-model:file-list="content"
|
|
18
|
+
:auto-upload="autoUpload"
|
|
19
|
+
:required="required"
|
|
20
|
+
:list-type="listType"
|
|
21
|
+
:accept="accept"
|
|
22
|
+
>
|
|
23
|
+
<template #trigger>
|
|
24
|
+
<slot name="trigger">
|
|
25
|
+
<el-button type="primary">Select file</el-button>
|
|
26
|
+
</slot>
|
|
27
|
+
</template>
|
|
28
|
+
<template #tip>
|
|
29
|
+
<slot name="tip" />
|
|
30
|
+
</template>
|
|
31
|
+
<slot name="default"> </slot>
|
|
32
|
+
</el-upload>
|
|
33
|
+
</XInput>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script>
|
|
37
|
+
import { ElUpload } from "element-plus";
|
|
38
|
+
import input from "./input.js";
|
|
39
|
+
import ElButton from "../basic/Button.vue";
|
|
40
|
+
import XInput from "./input.vue";
|
|
41
|
+
|
|
42
|
+
export default {
|
|
43
|
+
mixins: [input],
|
|
44
|
+
props: {
|
|
45
|
+
...input.props,
|
|
46
|
+
baseClass: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: "vel-upload",
|
|
49
|
+
},
|
|
50
|
+
limit: {
|
|
51
|
+
type: Number,
|
|
52
|
+
default: 1,
|
|
53
|
+
},
|
|
54
|
+
action: {
|
|
55
|
+
type: Function,
|
|
56
|
+
default: null,
|
|
57
|
+
},
|
|
58
|
+
autoUpload: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: false,
|
|
61
|
+
},
|
|
62
|
+
onExceed: {
|
|
63
|
+
type: Function,
|
|
64
|
+
default: null,
|
|
65
|
+
},
|
|
66
|
+
listType: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: "text",
|
|
69
|
+
},
|
|
70
|
+
accept: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: "",
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
components: {
|
|
77
|
+
XInput,
|
|
78
|
+
ElUpload,
|
|
79
|
+
ElButton,
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
emits: ["upload"],
|
|
83
|
+
|
|
84
|
+
watch: {
|
|
85
|
+
content: {
|
|
86
|
+
immediate: true,
|
|
87
|
+
handler(val) {
|
|
88
|
+
this.handleInput();
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
methods: {
|
|
93
|
+
clearFiles() {
|
|
94
|
+
this.$refs.upload.clearFiles();
|
|
95
|
+
},
|
|
96
|
+
handleStart(file) {
|
|
97
|
+
this.$refs.upload.handleStart(file);
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
</script>
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<XInput v-bind="$props">
|
|
3
|
+
<template #label>
|
|
4
|
+
<slot name="label" />
|
|
5
|
+
</template>
|
|
6
|
+
<div class="el-input__inner px-0" ref="input" />
|
|
7
|
+
</XInput>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
import Quill from "quill";
|
|
12
|
+
import input from "./input.js";
|
|
13
|
+
import XInput from "./input.vue";
|
|
14
|
+
import sanitizeHtml from "sanitize-html";
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
mixins: [input],
|
|
18
|
+
|
|
19
|
+
components: {
|
|
20
|
+
XInput,
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
props: {
|
|
24
|
+
simple: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false,
|
|
27
|
+
},
|
|
28
|
+
baseClass: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "vel-wysiwyg",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
data: () => ({
|
|
35
|
+
editor: null,
|
|
36
|
+
hold: null,
|
|
37
|
+
}),
|
|
38
|
+
|
|
39
|
+
watch: {
|
|
40
|
+
modelValue: {
|
|
41
|
+
handler(val) {
|
|
42
|
+
if (val !== this.hold) {
|
|
43
|
+
this.setValue();
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
methods: {
|
|
50
|
+
getValue() {
|
|
51
|
+
return this.editor.getText().trim() === "" // Quill leaves <p></br></p> on empty input so ignore
|
|
52
|
+
? ""
|
|
53
|
+
: this.simple // Simple editor removes outer tags and only allows inner phrasing tags
|
|
54
|
+
? [...this.editor.root.children]
|
|
55
|
+
.map((d) => d.innerHTML)
|
|
56
|
+
.join("\n")
|
|
57
|
+
: this.editor.root.innerHTML;
|
|
58
|
+
},
|
|
59
|
+
setValue() {
|
|
60
|
+
const temp =
|
|
61
|
+
this.simple && this.modelValue // Surround text in p tags to keep it grouped correctly on simple strings. Ignore if modelValue empty otherwise you'll end up with <p>null</p>
|
|
62
|
+
? `<p>${this.modelValue}</p>`
|
|
63
|
+
: this.modelValue;
|
|
64
|
+
this.editor.root.innerHTML = this.formatCleaner(temp);
|
|
65
|
+
},
|
|
66
|
+
// Function to remove p tags from inside li tags, breaks the wysiwyg
|
|
67
|
+
formatCleaner(unformmatted) {
|
|
68
|
+
if (!unformmatted) {
|
|
69
|
+
return "";
|
|
70
|
+
}
|
|
71
|
+
let parser = document.createElement("div");
|
|
72
|
+
parser.innerHTML = unformmatted.replace(/(\r\n|\n|\r|\t)/gm, "");
|
|
73
|
+
const lists = parser.getElementsByTagName("ul");
|
|
74
|
+
for (var x = 0; x < lists.length; x++) {
|
|
75
|
+
lists[x].innerHTML = sanitizeHtml(lists[x].innerHTML, {
|
|
76
|
+
allowedTags: ["b", "i", "em", "strong", "a", "li"],
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return parser.innerHTML;
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
mounted() {
|
|
84
|
+
this.editor = new Quill(this.$refs.input, {
|
|
85
|
+
modules: {
|
|
86
|
+
clipboard: {
|
|
87
|
+
matchVisual: false,
|
|
88
|
+
},
|
|
89
|
+
toolbar: [
|
|
90
|
+
[
|
|
91
|
+
this.simple
|
|
92
|
+
? undefined
|
|
93
|
+
: { header: [1, 2, 3, 4, 5, 6, false] },
|
|
94
|
+
"bold",
|
|
95
|
+
"italic",
|
|
96
|
+
"underline",
|
|
97
|
+
"strike",
|
|
98
|
+
{ script: "sub" },
|
|
99
|
+
{ script: "super" },
|
|
100
|
+
this.simple ? undefined : { list: "ordered" },
|
|
101
|
+
this.simple ? undefined : { list: "bullet" },
|
|
102
|
+
"clean",
|
|
103
|
+
"link",
|
|
104
|
+
],
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
placeholder: this.placeholder,
|
|
108
|
+
theme: "snow",
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
this.setValue();
|
|
112
|
+
|
|
113
|
+
this.editor.on("text-change", (delta, oldDelta, source) => {
|
|
114
|
+
this.hold = this.getValue();
|
|
115
|
+
this.$emit("update:modelValue", this.hold);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Disable tab
|
|
119
|
+
// delete this.editor.getModule("keyboard").bindings["9"];
|
|
120
|
+
|
|
121
|
+
// Disable tab index on toolbar buttons
|
|
122
|
+
[...this.$el.querySelectorAll(".ql-toolbar button")].forEach((d) =>
|
|
123
|
+
d.setAttribute("tabindex", -1),
|
|
124
|
+
);
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
</script>
|