@web-utils/component 2.0.10 → 2.0.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/dist/chunks/3d28cc08.js +57 -0
- package/dist/chunks/{41a066be.js → 44b78389.js} +8 -8
- package/dist/chunks/5d33812d.js +147 -0
- package/dist/chunks/{61ad06b2.js → 822300f3.js} +3 -3
- package/dist/chunks/9d848bf6.js +99 -0
- package/dist/chunks/a0bb327b.js +96 -0
- package/dist/chunks/a8891d2c.js +30 -0
- package/dist/chunks/c69d5628.js +248 -0
- package/dist/chunks/de9fe802.js +24 -0
- package/dist/chunks/{5a78e0db.js → e1939731.js} +6 -5
- package/dist/components/address-input/index.js +56 -43
- package/dist/components/address-input/style.css +15 -1
- package/dist/components/aside-menu/index.js +36 -30
- package/dist/components/aside-menu/style.css +9 -1
- package/dist/components/awesome-button/index.js +35 -32
- package/dist/components/base.css +66 -1
- package/dist/components/capsule-tab/index.js +33 -27
- package/dist/components/capsule-tab/style.css +32 -1
- package/dist/components/chunk-file-uploader/index.js +88 -54
- package/dist/components/chunk-file-uploader/style.css +4 -1
- package/dist/components/chunk-file-uploader-button/index.js +31 -25
- package/dist/components/chunk-file-uploader-button/style.css +17 -1
- package/dist/components/chunk-file-uploader-drop/index.js +42 -28
- package/dist/components/chunk-file-uploader-drop/style.css +12 -1
- package/dist/components/chunk-file-uploader-file/index.js +212 -134
- package/dist/components/chunk-file-uploader-file/style.css +125 -1
- package/dist/components/chunk-file-uploader-files/index.js +34 -28
- package/dist/components/chunk-file-uploader-files/style.css +9 -1
- package/dist/components/chunk-file-uploader-list/index.js +35 -29
- package/dist/components/chunk-file-uploader-list/style.css +9 -1
- package/dist/components/chunk-file-uploader-un-support/index.js +38 -30
- package/dist/components/chunk-file-uploader-un-support/style.css +6 -1
- package/dist/components/code-mirror-editor/index.js +181 -153
- package/dist/components/code-mirror-editor/style.css +17 -1
- package/dist/components/color-picker/index.js +68 -49
- package/dist/components/confirm-button/index.js +21 -19
- package/dist/components/confirmable/index.js +19 -18
- package/dist/components/context-menu/index.js +130 -108
- package/dist/components/context-menu/style.css +88 -1
- package/dist/components/custom-scrollbar/index.js +67 -49
- package/dist/components/data-table-picker/index.js +81 -62
- package/dist/components/dynamic-table/index.js +113 -89
- package/dist/components/dynamic-table/style.css +30 -1
- package/dist/components/e-charts/index.js +201 -120
- package/dist/components/e-charts/style.css +10 -1
- package/dist/components/editable-progress/index.js +93 -60
- package/dist/components/editable-progress/style.css +37 -1
- package/dist/components/editable-tree/index.js +638 -423
- package/dist/components/editable-tree/style.css +82 -1
- package/dist/components/egd-collapse/index.js +46 -33
- package/dist/components/egd-collapse-item/index.js +76 -60
- package/dist/components/element-dialog/index.js +147 -95
- package/dist/components/element-dialog/style.css +102 -1
- package/dist/components/empty-view/index.js +34 -28
- package/dist/components/empty-view/style.css +17 -1
- package/dist/components/error-view/index.js +32 -26
- package/dist/components/error-view/style.css +17 -1
- package/dist/components/flex-column/index.js +40 -25
- package/dist/components/flex-item/index.js +57 -29
- package/dist/components/flex-row/index.js +40 -25
- package/dist/components/flex-scroller/index.js +32 -26
- package/dist/components/flex-scroller/style.css +20 -1
- package/dist/components/form-button/index.js +38 -34
- package/dist/components/form-cascader/index.js +81 -71
- package/dist/components/form-checkbox-group/index.js +113 -88
- package/dist/components/form-checkbox-group/style.css +51 -1
- package/dist/components/form-date-picker/index.js +132 -70
- package/dist/components/form-holder/index.js +39 -32
- package/dist/components/form-input/index.js +62 -56
- package/dist/components/form-input-email/index.js +60 -48
- package/dist/components/form-input-id-card/index.js +59 -53
- package/dist/components/form-input-number/index.js +68 -61
- package/dist/components/form-input-number/style.css +12 -1
- package/dist/components/form-input-phone-number/index.js +55 -49
- package/dist/components/form-input-time/index.js +59 -53
- package/dist/components/form-item/index.js +123 -80
- package/dist/components/form-item/style.css +11 -1
- package/dist/components/form-item-config-provider/index.js +26 -25
- package/dist/components/form-item-group/index.js +111 -85
- package/dist/components/form-item-group/style.css +30 -1
- package/dist/components/form-radio-group/index.js +104 -85
- package/dist/components/form-radio-group/style.css +53 -1
- package/dist/components/form-select/index.js +91 -76
- package/dist/components/form-switch/index.js +57 -51
- package/dist/components/form-textarea/index.js +57 -51
- package/dist/components/form-view/index.js +232 -165
- package/dist/components/form-view/style.css +158 -1
- package/dist/components/guide-steps/index.js +58 -44
- package/dist/components/guide-steps/style.css +34 -1
- package/dist/components/icon-card/index.js +35 -29
- package/dist/components/icon-card/style.css +56 -1
- package/dist/components/iframe-window/index.js +35 -29
- package/dist/components/iframe-window/style.css +20 -1
- package/dist/components/image-viewer/index.js +66 -48
- package/dist/components/image-viewer/style.css +21 -1
- package/dist/components/input-number/index.js +193 -127
- package/dist/components/input-number/style.css +15 -1
- package/dist/components/input-number-range/index.js +57 -45
- package/dist/components/input-number-range/style.css +12 -1
- package/dist/components/j-s-x-component/index.js +4 -4
- package/dist/components/keep-view-alive/index.js +120 -73
- package/dist/components/loading-view/index.js +32 -26
- package/dist/components/loading-view/style.css +17 -1
- package/dist/components/nav-bar/index.js +37 -27
- package/dist/components/nav-bar/style.css +17 -1
- package/dist/components/not-implement/index.js +31 -23
- package/dist/components/not-implement/style.css +15 -1
- package/dist/components/page/index.js +28 -22
- package/dist/components/page/style.css +12 -1
- package/dist/components/page-header/index.js +36 -30
- package/dist/components/page-header/style.css +14 -1
- package/dist/components/page-index/index.js +83 -62
- package/dist/components/page-index/style.css +23 -1
- package/dist/components/page-index-top/index.js +68 -53
- package/dist/components/page-skeleton/index.js +37 -31
- package/dist/components/page-skeleton/style.css +23 -1
- package/dist/components/page-skeleton-new/index.js +48 -42
- package/dist/components/page-skeleton-new/style.css +42 -1
- package/dist/components/pageable-table/index.js +253 -186
- package/dist/components/pageable-table/style.css +72 -1
- package/dist/components/pageable-view/index.js +199 -129
- package/dist/components/pageable-view/style.css +69 -1
- package/dist/components/photo-swipe/index.js +151 -110
- package/dist/components/photo-swipe/style.css +20 -1
- package/dist/components/resize-observer/index.js +68 -34
- package/dist/components/resize-observer/style.css +31 -1
- package/dist/components/search-popover/index.js +211 -153
- package/dist/components/search-popover/style.css +93 -1
- package/dist/components/sign-panel/index.js +142 -92
- package/dist/components/sign-panel/style.css +97 -1
- package/dist/components/split-pane/index.js +162 -101
- package/dist/components/split-pane/style.css +100 -1
- package/dist/components/stateful/index.js +34 -31
- package/dist/components/stateful/style.css +33 -1
- package/dist/components/static-pageable-table/index.js +44 -37
- package/dist/components/static-pageable-table/style.css +9 -1
- package/dist/components/swiper/index.js +150 -85
- package/dist/components/swiper/style.css +43 -1
- package/dist/components/tab/index.js +72 -54
- package/dist/components/tab/style.css +122 -1
- package/dist/components/tab-item/index.js +35 -30
- package/dist/components/table-column/index.js +32 -30
- package/dist/components/table-view/index.js +227 -156
- package/dist/components/table-view/style.css +95 -1
- package/dist/components/tag-render/index.js +58 -44
- package/dist/components/tag-render/style.css +33 -1
- package/dist/components/tinymce-editor/index.js +95 -79
- package/dist/components/tinymce-editor/style.css +43 -1
- package/dist/components/tinymce-wrapper/index.js +121 -92
- package/dist/components/tinymce-wrapper/style.css +36 -1
- package/dist/components/toolbar/index.js +84 -63
- package/dist/components/toolbar/style.css +39 -1
- package/dist/components/toolbar-button/index.js +48 -41
- package/dist/components/toolbar-button/style.css +21 -1
- package/dist/components/trigger/index.js +36 -29
- package/dist/components/vue-tags-input/index.js +308 -188
- package/dist/components/vue-tags-input/style.css +682 -1
- package/dist/components/watermark/index.js +37 -25
- package/dist/components/watermark/style.css +11 -1
- package/dist/components/x-dialog/index.js +93 -67
- package/dist/components/x-dialog/style.css +15 -1
- package/dist/index.css +1105 -193
- package/dist/index.es.js +7242 -4789
- package/package.json +1 -1
- package/web-types.json +1 -1
- package/dist/chunks/3a79781b.js +0 -75
- package/dist/chunks/5d4282fb.js +0 -30
- package/dist/chunks/76680a03.js +0 -24
- package/dist/chunks/8c0142e0.js +0 -81
- package/dist/chunks/97652d86.js +0 -26
- package/dist/chunks/b4acd3a6.js +0 -126
- package/dist/chunks/f71045fc.js +0 -184
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
2
|
+
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
3
|
+
if (render) {
|
|
4
|
+
options.render = render;
|
|
5
|
+
options.staticRenderFns = staticRenderFns;
|
|
6
|
+
options._compiled = true;
|
|
7
|
+
}
|
|
8
|
+
if (functionalTemplate) {
|
|
9
|
+
options.functional = true;
|
|
10
|
+
}
|
|
11
|
+
if (scopeId) {
|
|
12
|
+
options._scopeId = "data-v-" + scopeId;
|
|
13
|
+
}
|
|
14
|
+
var hook;
|
|
15
|
+
if (moduleIdentifier) {
|
|
16
|
+
hook = function(context) {
|
|
17
|
+
context = context || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
|
|
18
|
+
if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") {
|
|
19
|
+
context = __VUE_SSR_CONTEXT__;
|
|
20
|
+
}
|
|
21
|
+
if (injectStyles) {
|
|
22
|
+
injectStyles.call(this, context);
|
|
23
|
+
}
|
|
24
|
+
if (context && context._registeredComponents) {
|
|
25
|
+
context._registeredComponents.add(moduleIdentifier);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
options._ssrRegister = hook;
|
|
29
|
+
} else if (injectStyles) {
|
|
30
|
+
hook = shadowMode ? function() {
|
|
31
|
+
injectStyles.call(
|
|
32
|
+
this,
|
|
33
|
+
(options.functional ? this.parent : this).$root.$options.shadowRoot
|
|
34
|
+
);
|
|
35
|
+
} : injectStyles;
|
|
36
|
+
}
|
|
37
|
+
if (hook) {
|
|
38
|
+
if (options.functional) {
|
|
39
|
+
options._injectStyles = hook;
|
|
40
|
+
var originalRender = options.render;
|
|
41
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
42
|
+
hook.call(context);
|
|
43
|
+
return originalRender(h, context);
|
|
44
|
+
};
|
|
45
|
+
} else {
|
|
46
|
+
var existing = options.beforeCreate;
|
|
47
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
exports: scriptExports,
|
|
52
|
+
options
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
normalizeComponent as n
|
|
57
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const inputNumberMixin = {
|
|
2
2
|
props: {
|
|
3
3
|
suffixIcon: {
|
|
4
4
|
type: String
|
|
@@ -12,15 +12,15 @@ const t = {
|
|
|
12
12
|
},
|
|
13
13
|
stepStrictly: {
|
|
14
14
|
type: Boolean,
|
|
15
|
-
default:
|
|
15
|
+
default: false
|
|
16
16
|
},
|
|
17
17
|
max: {
|
|
18
18
|
type: Number,
|
|
19
|
-
default:
|
|
19
|
+
default: Infinity
|
|
20
20
|
},
|
|
21
21
|
min: {
|
|
22
22
|
type: Number,
|
|
23
|
-
default: -
|
|
23
|
+
default: -Infinity
|
|
24
24
|
},
|
|
25
25
|
value: {
|
|
26
26
|
type: [Number, String]
|
|
@@ -31,7 +31,7 @@ const t = {
|
|
|
31
31
|
},
|
|
32
32
|
controls: {
|
|
33
33
|
type: Boolean,
|
|
34
|
-
default:
|
|
34
|
+
default: true
|
|
35
35
|
},
|
|
36
36
|
controlsPosition: {
|
|
37
37
|
type: String,
|
|
@@ -49,12 +49,12 @@ const t = {
|
|
|
49
49
|
precision: {
|
|
50
50
|
type: Number,
|
|
51
51
|
default: void 0,
|
|
52
|
-
validator(
|
|
53
|
-
return
|
|
52
|
+
validator(val) {
|
|
53
|
+
return val >= 0 && val === parseInt(val, 10);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
58
|
export {
|
|
59
|
-
|
|
59
|
+
inputNumberMixin as i
|
|
60
60
|
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { i as filterProperties } from "./c69d5628.js";
|
|
2
|
+
import { Col, FormItem } from "element-ui";
|
|
3
|
+
const elColManualBindKeys = ["span"];
|
|
4
|
+
const elColKeys = [...Object.keys(Col.props)];
|
|
5
|
+
const elColAutoBindKeys = elColKeys.filter((key) => !elColManualBindKeys.includes(key));
|
|
6
|
+
const elFormItemManualBindKeys = ["label", "prop", "rules", "labelWidth", "required"];
|
|
7
|
+
const elFormItemKeys = [...Object.keys(FormItem.props)];
|
|
8
|
+
const elFormItemAutoBindKeys = elFormItemKeys.filter((key) => !elFormItemManualBindKeys.includes(key));
|
|
9
|
+
const formItemAutoBindKeys = [
|
|
10
|
+
"wrapCol",
|
|
11
|
+
"wrapFormItem",
|
|
12
|
+
"unwrap",
|
|
13
|
+
"prefixConfig",
|
|
14
|
+
"block",
|
|
15
|
+
"placeholder",
|
|
16
|
+
"prefixPick",
|
|
17
|
+
"half",
|
|
18
|
+
...elColKeys,
|
|
19
|
+
...elFormItemKeys
|
|
20
|
+
];
|
|
21
|
+
const formItemMixin = {
|
|
22
|
+
inject: {
|
|
23
|
+
elForm: {
|
|
24
|
+
default: {}
|
|
25
|
+
},
|
|
26
|
+
formItemGroup: {
|
|
27
|
+
default: {}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
props: {
|
|
31
|
+
disabled: Boolean,
|
|
32
|
+
wrapCol: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: true
|
|
35
|
+
},
|
|
36
|
+
wrapFormItem: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: true
|
|
39
|
+
},
|
|
40
|
+
unwrap: Boolean,
|
|
41
|
+
half: Boolean,
|
|
42
|
+
prefixConfig: Boolean,
|
|
43
|
+
block: Boolean,
|
|
44
|
+
placeholder: {
|
|
45
|
+
type: [Boolean, String],
|
|
46
|
+
default: true
|
|
47
|
+
},
|
|
48
|
+
formItemClass: String,
|
|
49
|
+
prefixPick: Boolean,
|
|
50
|
+
label: String,
|
|
51
|
+
labelWidth: String,
|
|
52
|
+
prop: String,
|
|
53
|
+
required: Boolean,
|
|
54
|
+
rules: [Object, Array],
|
|
55
|
+
error: String,
|
|
56
|
+
validateStatus: String,
|
|
57
|
+
for: String,
|
|
58
|
+
inlineMessage: {
|
|
59
|
+
type: [String, Boolean],
|
|
60
|
+
default: ""
|
|
61
|
+
},
|
|
62
|
+
showMessage: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: true
|
|
65
|
+
},
|
|
66
|
+
size: String,
|
|
67
|
+
span: {
|
|
68
|
+
type: Number,
|
|
69
|
+
default: 12
|
|
70
|
+
},
|
|
71
|
+
tag: {
|
|
72
|
+
type: String,
|
|
73
|
+
default: "div"
|
|
74
|
+
},
|
|
75
|
+
offset: Number,
|
|
76
|
+
pull: Number,
|
|
77
|
+
push: Number,
|
|
78
|
+
xs: [Number, Object],
|
|
79
|
+
sm: [Number, Object],
|
|
80
|
+
md: [Number, Object],
|
|
81
|
+
lg: [Number, Object],
|
|
82
|
+
xl: [Number, Object]
|
|
83
|
+
},
|
|
84
|
+
computed: {
|
|
85
|
+
prefix() {
|
|
86
|
+
if (this.prefixConfig) {
|
|
87
|
+
return "请配置";
|
|
88
|
+
} else if (this.prefixPick) {
|
|
89
|
+
return "请选择";
|
|
90
|
+
} else {
|
|
91
|
+
return "请输入";
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
message() {
|
|
95
|
+
var _a;
|
|
96
|
+
return `${this.prefix}${((_a = this.label) == null ? void 0 : _a.replace(":", "")) || ""}`;
|
|
97
|
+
},
|
|
98
|
+
computeRules() {
|
|
99
|
+
const rules = [...this.rules || []];
|
|
100
|
+
if (this.required) {
|
|
101
|
+
const requireRule = rules.find((value) => value.required);
|
|
102
|
+
if (requireRule) {
|
|
103
|
+
if (!requireRule.ref) {
|
|
104
|
+
requireRule.message = rules.message || this.message;
|
|
105
|
+
} else {
|
|
106
|
+
requireRule.label = requireRule.label || this.label;
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
rules.unshift(this.getRequireRule());
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return rules.concat(this.getRules());
|
|
113
|
+
},
|
|
114
|
+
computeSpan() {
|
|
115
|
+
return this.block ? 24 : this.span;
|
|
116
|
+
},
|
|
117
|
+
formItemProps() {
|
|
118
|
+
return filterProperties({ ...this.$props, ...this.$attrs }, formItemAutoBindKeys);
|
|
119
|
+
},
|
|
120
|
+
elFormItemProps() {
|
|
121
|
+
return filterProperties({ ...this.$props, ...this.$attrs }, elFormItemAutoBindKeys);
|
|
122
|
+
},
|
|
123
|
+
elColProps() {
|
|
124
|
+
return filterProperties({ ...this.$props, ...this.$attrs }, elColAutoBindKeys);
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
watch: {
|
|
128
|
+
computeRules() {
|
|
129
|
+
var _a, _b;
|
|
130
|
+
(_b = (_a = this.elForm) == null ? void 0 : _a.clearValidate) == null ? void 0 : _b.call(_a, this.prop);
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
methods: {
|
|
134
|
+
getRules() {
|
|
135
|
+
return [];
|
|
136
|
+
},
|
|
137
|
+
getRequireRule() {
|
|
138
|
+
return {
|
|
139
|
+
required: true,
|
|
140
|
+
message: this.message
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
export {
|
|
146
|
+
formItemMixin as f
|
|
147
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
const parentMixin = {
|
|
2
|
+
mounted() {
|
|
3
|
+
if (this.value >= 0) {
|
|
4
|
+
this.currentIndex = this.value;
|
|
5
|
+
}
|
|
6
|
+
this.updateIndex();
|
|
7
|
+
},
|
|
8
|
+
methods: {
|
|
9
|
+
updateIndex() {
|
|
10
|
+
if (!this.$children || !this.$children.length) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
this.number = this.$children.length;
|
|
14
|
+
const children = this.$children;
|
|
15
|
+
for (let i = 0; i < children.length; i++) {
|
|
16
|
+
children[i].currentIndex = i;
|
|
17
|
+
if (children[i].currentSelected) {
|
|
18
|
+
this.index = i;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
props: {
|
|
24
|
+
value: Number
|
|
25
|
+
},
|
|
26
|
+
watch: {
|
|
27
|
+
currentIndex(val, oldVal) {
|
|
28
|
+
oldVal > -1 && this.$children[oldVal] && (this.$children[oldVal].currentSelected = false);
|
|
29
|
+
val > -1 && this.$children[val] && (this.$children[val].currentSelected = true);
|
|
30
|
+
this.$emit("input", val);
|
|
31
|
+
this.$emit("on-index-change", val, oldVal);
|
|
32
|
+
},
|
|
33
|
+
index(val) {
|
|
34
|
+
this.currentIndex = val;
|
|
35
|
+
},
|
|
36
|
+
value(val) {
|
|
37
|
+
this.index = val;
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
data() {
|
|
41
|
+
return {
|
|
42
|
+
index: -1,
|
|
43
|
+
currentIndex: this.index,
|
|
44
|
+
number: this.$children.length
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const childMixin = {
|
|
49
|
+
props: {
|
|
50
|
+
selected: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
mounted() {
|
|
56
|
+
this.$parent.updateIndex();
|
|
57
|
+
},
|
|
58
|
+
beforeDestroy() {
|
|
59
|
+
const $parent = this.$parent;
|
|
60
|
+
this.$nextTick(() => {
|
|
61
|
+
$parent.updateIndex();
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
methods: {
|
|
65
|
+
onItemClick(hasLink) {
|
|
66
|
+
if (this.$parent.preventDefault) {
|
|
67
|
+
this.$parent.$emit("on-before-index-change", this.currentIndex);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (typeof this.disabled === "undefined" || this.disabled === false) {
|
|
71
|
+
this.currentSelected = true;
|
|
72
|
+
this.$parent.currentIndex = this.currentIndex;
|
|
73
|
+
this.$nextTick(() => {
|
|
74
|
+
this.$emit("on-item-click", this.currentIndex);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
watch: {
|
|
80
|
+
currentSelected(val) {
|
|
81
|
+
if (val) {
|
|
82
|
+
this.$parent.index = this.currentIndex;
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
selected(val) {
|
|
86
|
+
this.currentSelected = val;
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
data() {
|
|
90
|
+
return {
|
|
91
|
+
currentIndex: -1,
|
|
92
|
+
currentSelected: this.selected
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
export {
|
|
97
|
+
childMixin as c,
|
|
98
|
+
parentMixin as p
|
|
99
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { MessageBox, Loading } from "element-ui";
|
|
2
|
+
import { isFunction } from "@web-utils/core";
|
|
3
|
+
async function onClick(e, props, listeners) {
|
|
4
|
+
const { stop, prevent, message, loadable, loadingText, confirmable, confirmType, confirmText } = props;
|
|
5
|
+
if (stop) {
|
|
6
|
+
e.stopPropagation();
|
|
7
|
+
}
|
|
8
|
+
if (prevent) {
|
|
9
|
+
e.preventDefault();
|
|
10
|
+
}
|
|
11
|
+
const { before, click, cancel, after } = listeners;
|
|
12
|
+
if (isFunction(click)) {
|
|
13
|
+
try {
|
|
14
|
+
let pass = true;
|
|
15
|
+
if (isFunction(before)) {
|
|
16
|
+
pass = await before(e);
|
|
17
|
+
}
|
|
18
|
+
if (pass === false) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (confirmable) {
|
|
22
|
+
await MessageBox.confirm(message || confirmText, { type: confirmType });
|
|
23
|
+
}
|
|
24
|
+
let loadingInstance;
|
|
25
|
+
if (loadable) {
|
|
26
|
+
loadingInstance = Loading.service({ background: "rgba(0,0,0,0.3)", text: loadingText });
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
await click(e);
|
|
30
|
+
} catch (e2) {
|
|
31
|
+
}
|
|
32
|
+
if (loadable) {
|
|
33
|
+
loadingInstance.close();
|
|
34
|
+
}
|
|
35
|
+
if (isFunction(after)) {
|
|
36
|
+
await after(e);
|
|
37
|
+
}
|
|
38
|
+
} catch (e2) {
|
|
39
|
+
if (isFunction(cancel)) {
|
|
40
|
+
await cancel(e2);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const confirmableMixin = {
|
|
46
|
+
functional: true,
|
|
47
|
+
props: {
|
|
48
|
+
stop: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: true
|
|
51
|
+
},
|
|
52
|
+
prevent: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: true
|
|
55
|
+
},
|
|
56
|
+
text: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: ""
|
|
59
|
+
},
|
|
60
|
+
message: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: "你确定要删除该记录吗?"
|
|
63
|
+
},
|
|
64
|
+
confirmable: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: true
|
|
67
|
+
},
|
|
68
|
+
confirmText: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: "你确定要删除该记录吗?"
|
|
71
|
+
},
|
|
72
|
+
confirmType: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: "warning"
|
|
75
|
+
},
|
|
76
|
+
loadable: Boolean,
|
|
77
|
+
loadingText: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: "正在处理中请稍候..."
|
|
80
|
+
},
|
|
81
|
+
tag: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: "i"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
render(createElement, { props, data, children, listeners }) {
|
|
87
|
+
return createElement(props.tag, {
|
|
88
|
+
...data,
|
|
89
|
+
on: { click: (e) => onClick(e, props, listeners) },
|
|
90
|
+
props
|
|
91
|
+
}, children || props.text);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
export {
|
|
95
|
+
confirmableMixin as c
|
|
96
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
function secondsToStr(temp) {
|
|
2
|
+
const years = Math.floor(temp / 31536e3);
|
|
3
|
+
if (years) {
|
|
4
|
+
return `${years} 年${numberEnding(years)}`;
|
|
5
|
+
}
|
|
6
|
+
const days = Math.floor((temp %= 31536e3) / 86400);
|
|
7
|
+
if (days) {
|
|
8
|
+
return `${days} 天${numberEnding(days)}`;
|
|
9
|
+
}
|
|
10
|
+
const hours = Math.floor((temp %= 86400) / 3600);
|
|
11
|
+
if (hours) {
|
|
12
|
+
return `${hours} 时${numberEnding(hours)}`;
|
|
13
|
+
}
|
|
14
|
+
const minutes = Math.floor((temp %= 3600) / 60);
|
|
15
|
+
if (minutes) {
|
|
16
|
+
return `${minutes} 分${numberEnding(minutes)}`;
|
|
17
|
+
}
|
|
18
|
+
const seconds = temp % 60;
|
|
19
|
+
return `${seconds} 秒${numberEnding(seconds)}`;
|
|
20
|
+
function numberEnding(number) {
|
|
21
|
+
return number > 1 ? "" : "";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function kebabCase(s) {
|
|
25
|
+
return s.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
kebabCase as k,
|
|
29
|
+
secondsToStr as s
|
|
30
|
+
};
|