vue-devui 1.0.0-alpha.4 → 1.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/accordion/index.d.ts +7 -0
- package/accordion/index.es.js +237 -1
- package/accordion/index.umd.js +1 -1
- package/accordion/style.css +1 -1
- package/alert/index.d.ts +7 -0
- package/alert/index.es.js +175 -1
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/anchor/index.d.ts +7 -0
- package/anchor/index.es.js +263 -1
- package/anchor/index.umd.js +1 -1
- package/avatar/index.d.ts +7 -0
- package/avatar/index.es.js +301 -1
- package/avatar/index.umd.js +1 -1
- package/back-top/index.d.ts +7 -0
- package/back-top/index.es.js +128 -0
- package/back-top/index.umd.js +1 -0
- package/back-top/package.json +7 -0
- package/back-top/style.css +1 -0
- package/badge/index.d.ts +7 -0
- package/badge/index.es.js +95 -1
- package/badge/index.umd.js +1 -1
- package/breadcrumb/index.d.ts +7 -0
- package/breadcrumb/index.es.js +127 -1
- package/breadcrumb/index.umd.js +1 -1
- package/breadcrumb/style.css +1 -1
- package/button/index.d.ts +7 -0
- package/button/index.es.js +190 -1
- package/button/index.umd.js +1 -1
- package/card/index.d.ts +7 -0
- package/card/index.es.js +61 -1
- package/card/index.umd.js +1 -1
- package/carousel/index.d.ts +7 -0
- package/carousel/index.es.js +329 -1
- package/carousel/index.umd.js +1 -1
- package/cascader/index.d.ts +7 -0
- package/cascader/index.es.js +1343 -1
- package/cascader/index.umd.js +1 -1
- package/cascader/style.css +1 -1
- package/checkbox/index.d.ts +7 -0
- package/checkbox/index.es.js +377 -1
- package/checkbox/index.umd.js +1 -1
- package/comment/index.d.ts +7 -0
- package/comment/index.es.js +85 -0
- package/comment/index.umd.js +1 -0
- package/comment/package.json +7 -0
- package/comment/style.css +1 -0
- package/countdown/index.d.ts +7 -0
- package/countdown/index.es.js +176 -0
- package/countdown/index.umd.js +1 -0
- package/countdown/package.json +7 -0
- package/countdown/style.css +1 -0
- package/date-picker/index.d.ts +7 -0
- package/date-picker/index.es.js +1172 -1
- package/date-picker/index.umd.js +1 -1
- package/date-picker/style.css +1 -1
- package/dragdrop/index.d.ts +7 -0
- package/dragdrop/index.es.js +32 -0
- package/dragdrop/index.umd.js +1 -0
- package/dragdrop/package.json +7 -0
- package/drawer/index.d.ts +7 -0
- package/drawer/index.es.js +288 -0
- package/drawer/index.umd.js +1 -0
- package/drawer/package.json +7 -0
- package/drawer/style.css +1 -0
- package/dropdown/index.d.ts +7 -0
- package/dropdown/index.es.js +527 -0
- package/dropdown/index.umd.js +1 -0
- package/dropdown/package.json +7 -0
- package/dropdown/style.css +1 -0
- package/editable-select/index.d.ts +7 -0
- package/editable-select/index.es.js +5793 -1
- package/editable-select/index.umd.js +27 -1
- package/editable-select/style.css +1 -1
- package/form/index.d.ts +7 -0
- package/form/index.es.js +2244 -0
- package/form/index.umd.js +1 -0
- package/form/package.json +7 -0
- package/form/style.css +1 -0
- package/fullscreen/index.d.ts +7 -0
- package/fullscreen/index.es.js +163 -1
- package/fullscreen/index.umd.js +1 -1
- package/gantt/index.d.ts +7 -0
- package/gantt/index.es.js +535 -0
- package/gantt/index.umd.js +1 -0
- package/gantt/package.json +7 -0
- package/gantt/style.css +1 -0
- package/grid/index.d.ts +7 -0
- package/grid/index.es.js +269 -0
- package/grid/index.umd.js +1 -0
- package/grid/package.json +7 -0
- package/grid/style.css +1 -0
- package/icon/index.d.ts +7 -0
- package/icon/index.es.js +75 -1
- package/icon/index.umd.js +1 -1
- package/image-preview/index.d.ts +7 -0
- package/image-preview/index.es.js +480 -1
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/index.d.ts +7 -0
- package/input/index.d.ts +7 -0
- package/input/index.es.js +190 -1
- package/input/index.umd.js +1 -1
- package/input-icon/index.d.ts +7 -0
- package/input-icon/index.es.js +332 -0
- package/input-icon/index.umd.js +1 -0
- package/input-icon/package.json +7 -0
- package/input-icon/style.css +1 -0
- package/input-number/index.d.ts +7 -0
- package/input-number/index.es.js +240 -1
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.d.ts +7 -0
- package/layout/index.es.js +100 -0
- package/layout/index.umd.js +1 -0
- package/layout/package.json +7 -0
- package/layout/style.css +1 -0
- package/loading/index.d.ts +7 -0
- package/loading/index.es.js +256 -1
- package/loading/index.umd.js +1 -1
- package/modal/index.d.ts +7 -0
- package/modal/index.es.js +1027 -1
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/nav-sprite/index.d.ts +7 -0
- package/nav-sprite/index.es.js +742 -0
- package/nav-sprite/index.umd.js +1 -0
- package/nav-sprite/package.json +7 -0
- package/nuxt/components/Accordion.js +3 -0
- package/nuxt/components/Alert.js +3 -0
- package/nuxt/components/Anchor.js +3 -0
- package/nuxt/components/Aside.js +3 -0
- package/nuxt/components/Avatar.js +3 -0
- package/nuxt/components/BackTop.js +3 -0
- package/nuxt/components/Badge.js +3 -0
- package/nuxt/components/Breadcrumb.js +3 -0
- package/nuxt/components/Button.js +3 -0
- package/nuxt/components/Card.js +3 -0
- package/nuxt/components/Carousel.js +3 -0
- package/nuxt/components/Cascader.js +3 -0
- package/nuxt/components/Checkbox.js +3 -0
- package/nuxt/components/Col.js +3 -0
- package/nuxt/components/Column.js +3 -0
- package/nuxt/components/Comment.js +3 -0
- package/nuxt/components/Content.js +3 -0
- package/nuxt/components/Countdown.js +3 -0
- package/nuxt/components/DatePicker.js +3 -0
- package/nuxt/components/Drawer.js +3 -0
- package/nuxt/components/Dropdown.js +3 -0
- package/nuxt/components/EditableSelect.js +3 -0
- package/nuxt/components/FixedOverlay.js +3 -0
- package/nuxt/components/FlexibleOverlay.js +3 -0
- package/nuxt/components/Footer.js +3 -0
- package/nuxt/components/Form.js +3 -0
- package/nuxt/components/FormControl.js +3 -0
- package/nuxt/components/FormItem.js +3 -0
- package/nuxt/components/FormLabel.js +3 -0
- package/nuxt/components/FormOperation.js +3 -0
- package/nuxt/components/Fullscreen.js +3 -0
- package/nuxt/components/Gantt.js +3 -0
- package/nuxt/components/Header.js +3 -0
- package/nuxt/components/Icon.js +2 -0
- package/nuxt/components/ImagePreviewService.js +3 -0
- package/nuxt/components/Input.js +3 -0
- package/nuxt/components/InputIcon.js +3 -0
- package/nuxt/components/InputNumber.js +3 -0
- package/nuxt/components/Layout.js +3 -0
- package/nuxt/components/Loading.js +3 -0
- package/nuxt/components/LoadingService.js +3 -0
- package/nuxt/components/Modal.js +3 -0
- package/nuxt/components/MultiUpload.js +3 -0
- package/nuxt/components/NavSprite.js +2 -0
- package/nuxt/components/Pagination.js +3 -0
- package/nuxt/components/Panel.js +3 -0
- package/nuxt/components/Popover.js +3 -0
- package/nuxt/components/Progress.js +3 -0
- package/nuxt/components/QuadrantDiagram.js +3 -0
- package/nuxt/components/Radio.js +3 -0
- package/nuxt/components/RadioGroup.js +3 -0
- package/nuxt/components/Rate.js +3 -0
- package/nuxt/components/ReadTip.js +3 -0
- package/nuxt/components/Result.js +3 -0
- package/nuxt/components/Row.js +3 -0
- package/nuxt/components/Search.js +3 -0
- package/nuxt/components/Select.js +3 -0
- package/nuxt/components/Skeleton.js +3 -0
- package/nuxt/components/SkeletonItem.js +3 -0
- package/nuxt/components/Slider.js +3 -0
- package/nuxt/components/Splitter.js +3 -0
- package/nuxt/components/Statistic.js +3 -0
- package/nuxt/components/Status.js +3 -0
- package/nuxt/components/StepsGuide.js +3 -0
- package/nuxt/components/StickSlider.js +3 -0
- package/nuxt/components/Sticky.js +2 -0
- package/nuxt/components/Switch.js +3 -0
- package/nuxt/components/Table.js +3 -0
- package/nuxt/components/Tabs.js +3 -0
- package/nuxt/components/Tag.js +3 -0
- package/nuxt/components/TagInput.js +3 -0
- package/nuxt/components/Textarea.js +3 -0
- package/nuxt/components/TimeAxis.js +3 -0
- package/nuxt/components/TimeAxisItem.js +3 -0
- package/nuxt/components/TimePicker.js +3 -0
- package/nuxt/components/Toast.js +3 -0
- package/nuxt/components/ToastService.js +3 -0
- package/nuxt/components/Tooltip.js +3 -0
- package/nuxt/components/Transfer.js +3 -0
- package/nuxt/components/Tree.js +3 -0
- package/nuxt/components/TreeSelect.js +3 -0
- package/nuxt/components/Upload.js +3 -0
- package/nuxt/components/buttonProps.js +3 -0
- package/nuxt/index.js +13 -0
- package/overlay/index.d.ts +7 -0
- package/overlay/index.es.js +368 -1
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +8 -33
- package/pagination/index.d.ts +7 -0
- package/pagination/index.es.js +642 -1
- package/pagination/index.umd.js +1 -1
- package/panel/index.d.ts +7 -0
- package/panel/index.es.js +205 -1
- package/panel/index.umd.js +1 -1
- package/panel/style.css +1 -1
- package/popover/index.d.ts +7 -0
- package/popover/index.es.js +236 -1
- package/popover/index.umd.js +1 -1
- package/popover/style.css +1 -1
- package/progress/index.d.ts +7 -0
- package/progress/index.es.js +153 -1
- package/progress/index.umd.js +3 -1
- package/quadrant-diagram/index.d.ts +7 -0
- package/quadrant-diagram/index.es.js +489 -1
- package/quadrant-diagram/index.umd.js +1 -1
- package/radio/index.d.ts +7 -0
- package/radio/index.es.js +225 -1
- package/radio/index.umd.js +1 -1
- package/rate/index.d.ts +7 -0
- package/rate/index.es.js +220 -1
- package/rate/index.umd.js +1 -1
- package/read-tip/index.d.ts +7 -0
- package/read-tip/index.es.js +258 -0
- package/read-tip/index.umd.js +1 -0
- package/read-tip/package.json +7 -0
- package/read-tip/style.css +1 -0
- package/result/index.d.ts +7 -0
- package/result/index.es.js +119 -0
- package/result/index.umd.js +1 -0
- package/result/package.json +7 -0
- package/result/style.css +1 -0
- package/ripple/index.d.ts +7 -0
- package/ripple/index.es.js +181 -1
- package/ripple/index.umd.js +1 -1
- package/search/index.d.ts +7 -0
- package/search/index.es.js +543 -1
- package/search/index.umd.js +1 -1
- package/select/index.d.ts +7 -0
- package/select/index.es.js +706 -1
- package/select/index.umd.js +1 -1
- package/skeleton/index.d.ts +7 -0
- package/skeleton/index.es.js +297 -1
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.d.ts +7 -0
- package/slider/index.es.js +199 -1
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.d.ts +7 -0
- package/splitter/index.es.js +636 -1
- package/splitter/index.umd.js +1 -1
- package/statistic/index.d.ts +7 -0
- package/statistic/index.es.js +280 -0
- package/statistic/index.umd.js +1 -0
- package/statistic/package.json +7 -0
- package/statistic/style.css +1 -0
- package/status/index.d.ts +7 -0
- package/status/index.es.js +42 -1
- package/status/index.umd.js +1 -1
- package/steps-guide/index.d.ts +7 -0
- package/steps-guide/index.es.js +239 -1
- package/steps-guide/index.umd.js +1 -1
- package/steps-guide/style.css +1 -1
- package/sticky/index.d.ts +7 -0
- package/sticky/index.es.js +197 -1
- package/sticky/index.umd.js +1 -1
- package/style.css +1 -1
- package/switch/index.d.ts +7 -0
- package/switch/index.es.js +100 -1
- package/switch/index.umd.js +1 -1
- package/switch/style.css +1 -1
- package/table/index.d.ts +7 -0
- package/table/index.es.js +1626 -1
- package/table/index.umd.js +1 -1
- package/table/style.css +1 -1
- package/tabs/index.d.ts +7 -0
- package/tabs/index.es.js +195 -1
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.d.ts +7 -0
- package/tag/index.es.js +131 -0
- package/tag/index.umd.js +1 -0
- package/tag/package.json +7 -0
- package/tag/style.css +1 -0
- package/tag-input/index.d.ts +7 -0
- package/tag-input/index.es.js +329 -1
- package/tag-input/index.umd.js +1 -1
- package/textarea/index.d.ts +7 -0
- package/textarea/index.es.js +132 -0
- package/textarea/index.umd.js +1 -0
- package/textarea/package.json +7 -0
- package/textarea/style.css +1 -0
- package/time-axis/index.d.ts +7 -0
- package/time-axis/index.es.js +299 -0
- package/time-axis/index.umd.js +1 -0
- package/time-axis/package.json +7 -0
- package/time-axis/style.css +1 -0
- package/time-picker/index.d.ts +7 -0
- package/time-picker/index.es.js +1053 -1
- package/time-picker/index.umd.js +1 -1
- package/time-picker/style.css +1 -1
- package/toast/index.d.ts +7 -0
- package/toast/index.es.js +2060 -1
- package/toast/index.umd.js +1 -1
- package/toast/style.css +1 -1
- package/tooltip/index.d.ts +7 -0
- package/tooltip/index.es.js +171 -1
- package/tooltip/index.umd.js +1 -1
- package/transfer/index.d.ts +7 -0
- package/transfer/index.es.js +1725 -1
- package/transfer/index.umd.js +1 -1
- package/transfer/style.css +1 -1
- package/tree/index.d.ts +7 -0
- package/tree/index.es.js +907 -1
- package/tree/index.umd.js +1 -1
- package/tree/style.css +1 -1
- package/tree-select/index.d.ts +7 -0
- package/tree-select/index.es.js +528 -0
- package/tree-select/index.umd.js +1 -0
- package/tree-select/package.json +7 -0
- package/tree-select/style.css +1 -0
- package/upload/index.d.ts +7 -0
- package/upload/index.es.js +3179 -1
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +27755 -1
- package/vue-devui.umd.js +29 -1
package/input-number/index.es.js
CHANGED
|
@@ -1 +1,240 @@
|
|
|
1
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
import { defineComponent, createVNode, ref, computed } from "vue";
|
|
18
|
+
const inputNumberProps = {
|
|
19
|
+
placeholder: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: void 0
|
|
22
|
+
},
|
|
23
|
+
disabled: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false
|
|
26
|
+
},
|
|
27
|
+
step: {
|
|
28
|
+
type: Number,
|
|
29
|
+
default: 0
|
|
30
|
+
},
|
|
31
|
+
max: {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: Infinity
|
|
34
|
+
},
|
|
35
|
+
min: {
|
|
36
|
+
type: Number,
|
|
37
|
+
default: -Infinity
|
|
38
|
+
},
|
|
39
|
+
size: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: ""
|
|
42
|
+
},
|
|
43
|
+
modelValue: {
|
|
44
|
+
type: Number,
|
|
45
|
+
default: 0
|
|
46
|
+
},
|
|
47
|
+
"onUpdate:modelValue": {
|
|
48
|
+
type: Function,
|
|
49
|
+
default: void 0
|
|
50
|
+
},
|
|
51
|
+
"onChange": {
|
|
52
|
+
type: Function,
|
|
53
|
+
default: void 0
|
|
54
|
+
},
|
|
55
|
+
"onKeydown": {
|
|
56
|
+
type: Function,
|
|
57
|
+
default: void 0
|
|
58
|
+
},
|
|
59
|
+
"onFocus": {
|
|
60
|
+
type: Function,
|
|
61
|
+
default: void 0
|
|
62
|
+
},
|
|
63
|
+
"onBlur": {
|
|
64
|
+
type: Function,
|
|
65
|
+
default: void 0
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
var inputNumber = "";
|
|
69
|
+
var Icon = defineComponent({
|
|
70
|
+
name: "DIcon",
|
|
71
|
+
props: {
|
|
72
|
+
name: {
|
|
73
|
+
type: String,
|
|
74
|
+
required: true
|
|
75
|
+
},
|
|
76
|
+
size: {
|
|
77
|
+
type: String,
|
|
78
|
+
default: "inherit"
|
|
79
|
+
},
|
|
80
|
+
color: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: "inherit"
|
|
83
|
+
},
|
|
84
|
+
classPrefix: {
|
|
85
|
+
type: String,
|
|
86
|
+
default: "icon"
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
setup(props) {
|
|
90
|
+
return __spreadValues({}, props);
|
|
91
|
+
},
|
|
92
|
+
render() {
|
|
93
|
+
const {
|
|
94
|
+
name,
|
|
95
|
+
size,
|
|
96
|
+
color,
|
|
97
|
+
classPrefix
|
|
98
|
+
} = this;
|
|
99
|
+
return /^((https?):)?\/\//.test(name) ? createVNode("img", {
|
|
100
|
+
"src": name,
|
|
101
|
+
"alt": name.split("/")[name.split("/").length - 1],
|
|
102
|
+
"style": {
|
|
103
|
+
width: size,
|
|
104
|
+
verticalAlign: "text-bottom"
|
|
105
|
+
}
|
|
106
|
+
}, null) : createVNode("i", {
|
|
107
|
+
"class": `${classPrefix} ${classPrefix}-${name}`,
|
|
108
|
+
"style": {
|
|
109
|
+
fontSize: size,
|
|
110
|
+
color
|
|
111
|
+
}
|
|
112
|
+
}, null);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
var InputNumber = defineComponent({
|
|
116
|
+
name: "DInputNumber",
|
|
117
|
+
props: inputNumberProps,
|
|
118
|
+
emits: ["update:modelValue", "change", "input", "focus", "blur", "keydown"],
|
|
119
|
+
setup(props, ctx) {
|
|
120
|
+
const inputVal = ref(props.modelValue);
|
|
121
|
+
const focusVal = ref("");
|
|
122
|
+
const isSize = computed(() => {
|
|
123
|
+
return `devui-input-number-${props.size}`;
|
|
124
|
+
});
|
|
125
|
+
const isDisabled = computed(() => {
|
|
126
|
+
return props.disabled;
|
|
127
|
+
});
|
|
128
|
+
const add = () => {
|
|
129
|
+
if (props.disabled)
|
|
130
|
+
return;
|
|
131
|
+
if (inputVal.value >= props.max)
|
|
132
|
+
return;
|
|
133
|
+
inputVal.value += props.step != 0 ? props.step : 1;
|
|
134
|
+
focusVal.value = "active";
|
|
135
|
+
ctx.emit("change", inputVal.value);
|
|
136
|
+
ctx.emit("update:modelValue", inputVal.value);
|
|
137
|
+
};
|
|
138
|
+
const subtract = () => {
|
|
139
|
+
if (props.disabled)
|
|
140
|
+
return;
|
|
141
|
+
if (inputVal.value <= props.min)
|
|
142
|
+
return;
|
|
143
|
+
inputVal.value -= props.step != 0 ? props.step : 1;
|
|
144
|
+
focusVal.value = "active";
|
|
145
|
+
ctx.emit("change", inputVal.value);
|
|
146
|
+
ctx.emit("update:modelValue", inputVal.value);
|
|
147
|
+
};
|
|
148
|
+
const onInput = (val) => {
|
|
149
|
+
inputVal.value = parseInt(val.data);
|
|
150
|
+
ctx.emit("input", val.data);
|
|
151
|
+
ctx.emit("update:modelValue", val.data);
|
|
152
|
+
};
|
|
153
|
+
const onFocus = ($event) => {
|
|
154
|
+
focusVal.value = "active";
|
|
155
|
+
ctx.emit("focus", $event);
|
|
156
|
+
};
|
|
157
|
+
const onBlur = ($event) => {
|
|
158
|
+
focusVal.value = "";
|
|
159
|
+
ctx.emit("blur", $event);
|
|
160
|
+
};
|
|
161
|
+
const onChange = ($event) => {
|
|
162
|
+
ctx.emit("change", $event.target.value);
|
|
163
|
+
};
|
|
164
|
+
const onKeydown = ($event) => {
|
|
165
|
+
ctx.emit("keydown", $event);
|
|
166
|
+
};
|
|
167
|
+
return {
|
|
168
|
+
inputVal,
|
|
169
|
+
focusVal,
|
|
170
|
+
isDisabled,
|
|
171
|
+
isSize,
|
|
172
|
+
add,
|
|
173
|
+
subtract,
|
|
174
|
+
onInput,
|
|
175
|
+
onChange,
|
|
176
|
+
onKeydown,
|
|
177
|
+
onBlur,
|
|
178
|
+
onFocus
|
|
179
|
+
};
|
|
180
|
+
},
|
|
181
|
+
render() {
|
|
182
|
+
const {
|
|
183
|
+
focusVal,
|
|
184
|
+
placeholder,
|
|
185
|
+
add,
|
|
186
|
+
inputVal,
|
|
187
|
+
isDisabled,
|
|
188
|
+
isSize,
|
|
189
|
+
subtract,
|
|
190
|
+
onInput,
|
|
191
|
+
onChange,
|
|
192
|
+
onKeydown,
|
|
193
|
+
onBlur,
|
|
194
|
+
onFocus
|
|
195
|
+
} = this;
|
|
196
|
+
const dInputNum = ["devui-input-number", isDisabled ? "devui-input-disabled" : "", isSize];
|
|
197
|
+
return createVNode("div", {
|
|
198
|
+
"class": dInputNum
|
|
199
|
+
}, [createVNode("div", {
|
|
200
|
+
"onBlur": onBlur,
|
|
201
|
+
"tabindex": "1",
|
|
202
|
+
"class": ["devui-control-buttons", focusVal.value]
|
|
203
|
+
}, [createVNode("span", {
|
|
204
|
+
"onClick": add
|
|
205
|
+
}, [createVNode(Icon, {
|
|
206
|
+
"size": "12px",
|
|
207
|
+
"name": "chevron-up"
|
|
208
|
+
}, null)]), createVNode("span", {
|
|
209
|
+
"onClick": subtract
|
|
210
|
+
}, [createVNode(Icon, {
|
|
211
|
+
"size": "12px",
|
|
212
|
+
"name": "chevron-down"
|
|
213
|
+
}, null)])]), createVNode("div", {
|
|
214
|
+
"class": "devui-input-item"
|
|
215
|
+
}, [createVNode("input", {
|
|
216
|
+
"type": "number",
|
|
217
|
+
"value": inputVal,
|
|
218
|
+
"placeholder": placeholder,
|
|
219
|
+
"disabled": isDisabled,
|
|
220
|
+
"class": ["devui-input-style devui-input-box", focusVal.value],
|
|
221
|
+
"onInput": onInput,
|
|
222
|
+
"onChange": onChange,
|
|
223
|
+
"onFocus": onFocus,
|
|
224
|
+
"onBlur": onBlur,
|
|
225
|
+
"onKeydown": onKeydown
|
|
226
|
+
}, null)])]);
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
InputNumber.install = function(app) {
|
|
230
|
+
app.component(InputNumber.name, InputNumber);
|
|
231
|
+
};
|
|
232
|
+
var index = {
|
|
233
|
+
title: "InputNumber \u6570\u5B57\u8F93\u5165\u6846",
|
|
234
|
+
category: "\u6570\u636E\u5F55\u5165",
|
|
235
|
+
status: "50%",
|
|
236
|
+
install(app) {
|
|
237
|
+
app.use(InputNumber);
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
export { InputNumber, index as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var F=Object.defineProperty;var V=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var g=(n,e,a)=>e in n?F(n,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[e]=a,N=(n,e)=>{for(var a in e||(e={}))S.call(e,a)&&g(n,a,e[a]);if(V)for(var a of V(e))w.call(e,a)&&g(n,a,e[a]);return n};(function(n,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(n=typeof globalThis!="undefined"?globalThis:n||self,e(n.index={},n.Vue))})(this,function(n,e){"use strict";const a={placeholder:{type:String,default:void 0},disabled:{type:Boolean,default:!1},step:{type:Number,default:0},max:{type:Number,default:1/0},min:{type:Number,default:-1/0},size:{type:String,default:""},modelValue:{type:Number,default:0},"onUpdate:modelValue":{type:Function,default:void 0},onChange:{type:Function,default:void 0},onKeydown:{type:Function,default:void 0},onFocus:{type:Function,default:void 0},onBlur:{type:Function,default:void 0}};var z="",p=e.defineComponent({name:"DIcon",props:{name:{type:String,required:!0},size:{type:String,default:"inherit"},color:{type:String,default:"inherit"},classPrefix:{type:String,default:"icon"}},setup(t){return N({},t)},render(){const{name:t,size:u,color:i,classPrefix:l}=this;return/^((https?):)?\/\//.test(t)?e.createVNode("img",{src:t,alt:t.split("/")[t.split("/").length-1],style:{width:u,verticalAlign:"text-bottom"}},null):e.createVNode("i",{class:`${l} ${l}-${t}`,style:{fontSize:u,color:i}},null)}}),d=e.defineComponent({name:"DInputNumber",props:a,emits:["update:modelValue","change","input","focus","blur","keydown"],setup(t,u){const i=e.ref(t.modelValue),l=e.ref(""),r=e.computed(()=>`devui-input-number-${t.size}`),s=e.computed(()=>t.disabled);return{inputVal:i,focusVal:l,isDisabled:s,isSize:r,add:()=>{t.disabled||i.value>=t.max||(i.value+=t.step!=0?t.step:1,l.value="active",u.emit("change",i.value),u.emit("update:modelValue",i.value))},subtract:()=>{t.disabled||i.value<=t.min||(i.value-=t.step!=0?t.step:1,l.value="active",u.emit("change",i.value),u.emit("update:modelValue",i.value))},onInput:o=>{i.value=parseInt(o.data),u.emit("input",o.data),u.emit("update:modelValue",o.data)},onChange:o=>{u.emit("change",o.target.value)},onKeydown:o=>{u.emit("keydown",o)},onBlur:o=>{l.value="",u.emit("blur",o)},onFocus:o=>{l.value="active",u.emit("focus",o)}}},render(){const{focusVal:t,placeholder:u,add:i,inputVal:l,isDisabled:r,isSize:s,subtract:m,onInput:f,onChange:y,onKeydown:b,onBlur:c,onFocus:v}=this,h=["devui-input-number",r?"devui-input-disabled":"",s];return e.createVNode("div",{class:h},[e.createVNode("div",{onBlur:c,tabindex:"1",class:["devui-control-buttons",t.value]},[e.createVNode("span",{onClick:i},[e.createVNode(p,{size:"12px",name:"chevron-up"},null)]),e.createVNode("span",{onClick:m},[e.createVNode(p,{size:"12px",name:"chevron-down"},null)])]),e.createVNode("div",{class:"devui-input-item"},[e.createVNode("input",{type:"number",value:l,placeholder:u,disabled:r,class:["devui-input-style devui-input-box",t.value],onInput:f,onChange:y,onFocus:v,onBlur:c,onKeydown:b},null)])])}});d.install=function(t){t.component(d.name,d)};var I={title:"InputNumber \u6570\u5B57\u8F93\u5165\u6846",category:"\u6570\u636E\u5F55\u5165",status:"50%",install(t){t.use(d)}};n.InputNumber=d,n.default=I,Object.defineProperty(n,"__esModule",{value:!0}),n[Symbol.toStringTag]="Module"});
|
package/input-number/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.devui-input-number{position:relative;display:block;width:
|
|
1
|
+
.devui-input-number{position:relative;display:inline-block;width:80px;line-height:38px;margin-right:12px}.devui-input-number:hover:not(.devui-input-disabled) .devui-input-box{border-color:var(--devui-form-control-line-hover)}.devui-input-number:hover:not(.devui-input-disabled) .devui-control-buttons:not(.disabled){display:flex;border-color:var(--devui-form-control-line-hover)}.devui-input-number:focus-within .devui-control-buttons{display:flex}.devui-input-number .active{border:1px solid var(--devui-form-control-line-active)!important;display:flex!important}.devui-input-number.devui-input-disabled .devui-subtract,.devui-input-number.devui-input-disabled .devui-add,.devui-input-number.devui-input-disabled .devui-input-style{cursor:not-allowed;border-color:#e4e7ed;color:#e4e7ed}.devui-input-number.devui-input-disabled .devui-input-style{border-color:var(--devui-disabled-line)!important;color:var(--devui-disabled-text)!important;background-color:var(--devui-disabled-bg)!important}.devui-input-number.devui-input-number-sm .devui-subtract,.devui-input-number.devui-input-number-sm .devui-add{width:40px;height:34px;line-height:34px}.devui-input-number.devui-input-number-sm .devui-input-style{height:34px;line-height:34px}.devui-input-number.devui-input-number-lg .devui-subtract,.devui-input-number.devui-input-number-lg .devui-add{width:60px}.devui-input-number .devui-input-item{line-height:100%}.devui-input-number .devui-input-style::-webkit-outer-spin-button,.devui-input-number .devui-input-style::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.devui-input-number .devui-add,.devui-input-number .devui-subtract{display:inline-block;width:50px;height:38px;line-height:38px;text-align:center;font-size:16px;color:#333;background:#f5f7fa;cursor:pointer;border:1px solid #dcdfe6}.devui-input-number .devui-add{float:right;margin-left:-1px;border-radius:0 4px 4px 0}.devui-input-number .devui-subtract{float:left;margin-right:-1px;border-radius:4px 0 0 4px}.devui-input-number .devui-input-style{display:block;-moz-appearance:textfield}.devui-input-number .devui-input-style{outline:none;background-color:var(--devui-base-bg);border:1px solid var(--devui-form-control-line);border-radius:var(--devui-border-radius);padding:4px 8px;line-height:18px;font-size:var(--devui-font-size);color:var(--devui-text);width:100%;display:block;cursor:text;height:28px;transition:border-color .3s var(--devui-animation-ease-in-out-smooth)}.devui-input-number .devui-input-box{box-sizing:border-box;padding:4px 8px;font-size:var(--devui-font-size);vertical-align:middle;border-radius:var(--devui-border-radius);outline:none;width:100%;line-height:20px;height:28px;border-width:1px;border-style:solid}.devui-input-number .devui-input-box:not(.disabled){background-color:var(--devui-base-bg);border-color:var(--devui-line);color:var(--devui-text)}.devui-input-number .disabled{cursor:not-allowed}.devui-input-number .devui-control-buttons{display:none;position:absolute;right:0;width:22px;height:100%;flex-direction:column;justify-content:center;align-items:center;border-left:1px solid var(--devui-line);box-sizing:border-box;line-height:100%;border-radius:0 var(--devui-border-radius) var(--devui-border-radius) 0}.devui-input-number .devui-control-buttons:not(.disabled){cursor:pointer}.devui-input-number .devui-control-buttons>span{display:flex}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { defineComponent, createVNode } from "vue";
|
|
2
|
+
var layout = "";
|
|
3
|
+
var Layout = defineComponent({
|
|
4
|
+
name: "DLayout",
|
|
5
|
+
emits: [],
|
|
6
|
+
setup(props, {
|
|
7
|
+
slots
|
|
8
|
+
}) {
|
|
9
|
+
return () => {
|
|
10
|
+
var _a;
|
|
11
|
+
const slotDefault = (_a = slots.default) == null ? void 0 : _a.call(slots);
|
|
12
|
+
const isAside = slotDefault.some((item) => item.type.name === "DAside");
|
|
13
|
+
const classNames = `${isAside ? "devui-layout-aside " : ""}devui-layout`;
|
|
14
|
+
return createVNode("div", {
|
|
15
|
+
"class": classNames
|
|
16
|
+
}, [slotDefault]);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
var content = "";
|
|
21
|
+
var Content = defineComponent({
|
|
22
|
+
name: "DContent",
|
|
23
|
+
setup(props, {
|
|
24
|
+
slots
|
|
25
|
+
}) {
|
|
26
|
+
return () => {
|
|
27
|
+
var _a;
|
|
28
|
+
return createVNode("div", {
|
|
29
|
+
"class": "devui-content"
|
|
30
|
+
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
var header = "";
|
|
35
|
+
var Header = defineComponent({
|
|
36
|
+
name: "DHeader",
|
|
37
|
+
setup(props, {
|
|
38
|
+
slots
|
|
39
|
+
}) {
|
|
40
|
+
return () => {
|
|
41
|
+
var _a;
|
|
42
|
+
return createVNode("div", {
|
|
43
|
+
"class": "devui-header"
|
|
44
|
+
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
var footer = "";
|
|
49
|
+
var Footer = defineComponent({
|
|
50
|
+
name: "DFooter",
|
|
51
|
+
setup(props, {
|
|
52
|
+
slots
|
|
53
|
+
}) {
|
|
54
|
+
return () => {
|
|
55
|
+
var _a;
|
|
56
|
+
return createVNode("div", {
|
|
57
|
+
"class": "devui-footer"
|
|
58
|
+
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
var Aside = defineComponent({
|
|
63
|
+
name: "DAside",
|
|
64
|
+
setup(props, {
|
|
65
|
+
slots
|
|
66
|
+
}) {
|
|
67
|
+
return () => {
|
|
68
|
+
var _a;
|
|
69
|
+
return createVNode("div", null, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
Layout.install = function(app) {
|
|
74
|
+
app.component(Layout.name, Layout);
|
|
75
|
+
};
|
|
76
|
+
Content.install = function(app) {
|
|
77
|
+
app.component(Content.name, Content);
|
|
78
|
+
};
|
|
79
|
+
Header.install = function(app) {
|
|
80
|
+
app.component(Header.name, Header);
|
|
81
|
+
};
|
|
82
|
+
Footer.install = function(app) {
|
|
83
|
+
app.component(Footer.name, Footer);
|
|
84
|
+
};
|
|
85
|
+
Aside.install = function(app) {
|
|
86
|
+
app.component(Aside.name, Aside);
|
|
87
|
+
};
|
|
88
|
+
var index = {
|
|
89
|
+
title: "Layout \u5E03\u5C40",
|
|
90
|
+
category: "\u5E03\u5C40",
|
|
91
|
+
status: "100%",
|
|
92
|
+
install(app) {
|
|
93
|
+
app.use(Layout);
|
|
94
|
+
app.use(Content);
|
|
95
|
+
app.use(Header);
|
|
96
|
+
app.use(Footer);
|
|
97
|
+
app.use(Aside);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
export { Aside, Content, Footer, Header, Layout, index as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(i,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(i=typeof globalThis!="undefined"?globalThis:i||self,t(i.index={},i.Vue))})(this,function(i,t){"use strict";var v="",d=t.defineComponent({name:"DLayout",emits:[],setup(e,{slots:n}){return()=>{var c;const a=(c=n.default)==null?void 0:c.call(n),p=`${a.some(l=>l.type.name==="DAside")?"devui-layout-aside ":""}devui-layout`;return t.createVNode("div",{class:p},[a])}}}),y="",u=t.defineComponent({name:"DContent",setup(e,{slots:n}){return()=>{var a;return t.createVNode("div",{class:"devui-content"},[(a=n.default)==null?void 0:a.call(n)])}}}),s="",o=t.defineComponent({name:"DHeader",setup(e,{slots:n}){return()=>{var a;return t.createVNode("div",{class:"devui-header"},[(a=n.default)==null?void 0:a.call(n)])}}}),C="",r=t.defineComponent({name:"DFooter",setup(e,{slots:n}){return()=>{var a;return t.createVNode("div",{class:"devui-footer"},[(a=n.default)==null?void 0:a.call(n)])}}}),f=t.defineComponent({name:"DAside",setup(e,{slots:n}){return()=>{var a;return t.createVNode("div",null,[(a=n.default)==null?void 0:a.call(n)])}}});d.install=function(e){e.component(d.name,d)},u.install=function(e){e.component(u.name,u)},o.install=function(e){e.component(o.name,o)},r.install=function(e){e.component(r.name,r)},f.install=function(e){e.component(f.name,f)};var m={title:"Layout \u5E03\u5C40",category:"\u5E03\u5C40",status:"100%",install(e){e.use(d),e.use(u),e.use(o),e.use(r),e.use(f)}};i.Aside=f,i.Content=u,i.Footer=r,i.Header=o,i.Layout=d,i.default=m,Object.defineProperty(i,"__esModule",{value:!0}),i[Symbol.toStringTag]="Module"});
|
package/layout/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.devui-layout{display:flex;flex-direction:column;flex:auto}.devui-layout-aside{flex-direction:row}.devui-content{flex:auto;min-height:0}.devui-header{min-height:40px;flex:auto}.devui-footer{text-align:center;line-height:1.5}
|
package/loading/index.es.js
CHANGED
|
@@ -1 +1,256 @@
|
|
|
1
|
-
var
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __publicField = (obj, key, value) => {
|
|
21
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
22
|
+
return value;
|
|
23
|
+
};
|
|
24
|
+
import { defineComponent, ref, createVNode, h, render } from "vue";
|
|
25
|
+
class View {
|
|
26
|
+
constructor() {
|
|
27
|
+
__publicField(this, "top", "50%");
|
|
28
|
+
__publicField(this, "left", "50%");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const componentProps = {
|
|
32
|
+
message: String,
|
|
33
|
+
backdrop: Boolean,
|
|
34
|
+
view: {
|
|
35
|
+
type: Object,
|
|
36
|
+
default: () => new View()
|
|
37
|
+
},
|
|
38
|
+
zIndex: Number,
|
|
39
|
+
isFull: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
class LoadingProps {
|
|
45
|
+
constructor() {
|
|
46
|
+
__publicField(this, "target");
|
|
47
|
+
__publicField(this, "message");
|
|
48
|
+
__publicField(this, "loadingTemplateRef");
|
|
49
|
+
__publicField(this, "backdrop", true);
|
|
50
|
+
__publicField(this, "positionType", "relative");
|
|
51
|
+
__publicField(this, "view", new View());
|
|
52
|
+
__publicField(this, "zIndex");
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
var loading$1 = "";
|
|
56
|
+
var Loading = defineComponent({
|
|
57
|
+
name: "DLoading",
|
|
58
|
+
inheritAttrs: false,
|
|
59
|
+
props: componentProps,
|
|
60
|
+
setup(props) {
|
|
61
|
+
const style = {
|
|
62
|
+
top: props.view.top,
|
|
63
|
+
left: props.view.left,
|
|
64
|
+
zIndex: props.zIndex
|
|
65
|
+
};
|
|
66
|
+
if (!props.message) {
|
|
67
|
+
style.background = "none";
|
|
68
|
+
}
|
|
69
|
+
const isShow = ref(false);
|
|
70
|
+
const open = () => {
|
|
71
|
+
isShow.value = true;
|
|
72
|
+
};
|
|
73
|
+
const close = () => {
|
|
74
|
+
isShow.value = false;
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
style,
|
|
78
|
+
isShow,
|
|
79
|
+
open,
|
|
80
|
+
close
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
render() {
|
|
84
|
+
var _a;
|
|
85
|
+
const {
|
|
86
|
+
isShow,
|
|
87
|
+
isFull,
|
|
88
|
+
backdrop,
|
|
89
|
+
style,
|
|
90
|
+
message,
|
|
91
|
+
$slots
|
|
92
|
+
} = this;
|
|
93
|
+
return isShow && createVNode("div", {
|
|
94
|
+
"class": ["devui-loading-contanier", isFull ? "devui-loading--full" : ""]
|
|
95
|
+
}, [((_a = $slots.default) == null ? void 0 : _a.call($slots)) || createVNode("div", {
|
|
96
|
+
"class": "devui-loading-wrapper"
|
|
97
|
+
}, [backdrop ? createVNode("div", {
|
|
98
|
+
"class": "devui-loading-mask"
|
|
99
|
+
}, null) : null, createVNode("div", {
|
|
100
|
+
"style": style,
|
|
101
|
+
"class": "devui-loading-area"
|
|
102
|
+
}, [createVNode("div", {
|
|
103
|
+
"class": "devui-busy-default-spinner"
|
|
104
|
+
}, [createVNode("div", {
|
|
105
|
+
"class": "devui-loading-bar1"
|
|
106
|
+
}, null), createVNode("div", {
|
|
107
|
+
"class": "devui-loading-bar2"
|
|
108
|
+
}, null), createVNode("div", {
|
|
109
|
+
"class": "devui-loading-bar3"
|
|
110
|
+
}, null), createVNode("div", {
|
|
111
|
+
"class": "devui-loading-bar4"
|
|
112
|
+
}, null)]), message ? createVNode("span", {
|
|
113
|
+
"class": "devui-loading-text"
|
|
114
|
+
}, [message]) : null])])]);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
const COMPONENT_CONTAINER_SYMBOL = Symbol("dev_component_container");
|
|
118
|
+
function createComponent(Component, props, children = null) {
|
|
119
|
+
const vnode = h(Component, __spreadValues({}, props), children);
|
|
120
|
+
const container = document.createElement("div");
|
|
121
|
+
vnode[COMPONENT_CONTAINER_SYMBOL] = container;
|
|
122
|
+
render(vnode, container);
|
|
123
|
+
return vnode.component;
|
|
124
|
+
}
|
|
125
|
+
function unmountComponent(ComponnetInstance) {
|
|
126
|
+
render(null, ComponnetInstance == null ? void 0 : ComponnetInstance.vnode[COMPONENT_CONTAINER_SYMBOL]);
|
|
127
|
+
}
|
|
128
|
+
const loadingConstructor$1 = defineComponent(Loading);
|
|
129
|
+
const cacheInstance = new WeakSet();
|
|
130
|
+
const isEmpty = (val) => {
|
|
131
|
+
if (!val)
|
|
132
|
+
return true;
|
|
133
|
+
if (Array.isArray(val))
|
|
134
|
+
return val.length === 0;
|
|
135
|
+
if (val instanceof Set || val instanceof Map)
|
|
136
|
+
return val.size === 0;
|
|
137
|
+
if (val instanceof Promise)
|
|
138
|
+
return false;
|
|
139
|
+
if (typeof val === "object") {
|
|
140
|
+
try {
|
|
141
|
+
return Object.keys(val).length === 0;
|
|
142
|
+
} catch (e) {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return false;
|
|
147
|
+
};
|
|
148
|
+
const getType = (vari) => {
|
|
149
|
+
return Object.prototype.toString.call(vari).slice(8, -1).toLowerCase();
|
|
150
|
+
};
|
|
151
|
+
const isPromise = (value) => {
|
|
152
|
+
const type = getType(value);
|
|
153
|
+
switch (type) {
|
|
154
|
+
case "promise":
|
|
155
|
+
return [value];
|
|
156
|
+
case "array":
|
|
157
|
+
if (value.some((val) => getType(val) !== "promise")) {
|
|
158
|
+
console.error(new TypeError("Binding values should all be of type Promise"));
|
|
159
|
+
return "error";
|
|
160
|
+
}
|
|
161
|
+
return value;
|
|
162
|
+
default:
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
const unmount = (el) => {
|
|
167
|
+
cacheInstance.delete(el);
|
|
168
|
+
el.instance.proxy.close();
|
|
169
|
+
unmountComponent(el.instance);
|
|
170
|
+
};
|
|
171
|
+
const toggleLoading = (el, binding) => {
|
|
172
|
+
if (binding.value) {
|
|
173
|
+
const vals = isPromise(binding.value);
|
|
174
|
+
if (vals === "error")
|
|
175
|
+
return;
|
|
176
|
+
el.instance.proxy.open();
|
|
177
|
+
el.appendChild(el.mask);
|
|
178
|
+
cacheInstance.add(el);
|
|
179
|
+
if (vals) {
|
|
180
|
+
Promise.all(vals).catch((err) => {
|
|
181
|
+
console.error(new Error("Promise handling errors"), err);
|
|
182
|
+
}).finally(() => {
|
|
183
|
+
unmount(el);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
} else {
|
|
187
|
+
unmount(el);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
const removeAttribute = (el) => {
|
|
191
|
+
el.removeAttribute("zindex");
|
|
192
|
+
el.removeAttribute("positiontype");
|
|
193
|
+
el.removeAttribute("backdrop");
|
|
194
|
+
el.removeAttribute("message");
|
|
195
|
+
el.removeAttribute("view");
|
|
196
|
+
el.removeAttribute("loadingtemplateref");
|
|
197
|
+
};
|
|
198
|
+
const handleProps = (el, vprops) => {
|
|
199
|
+
const props = __spreadValues(__spreadValues({}, new LoadingProps()), vprops);
|
|
200
|
+
const loadingTemplateRef = props.loadingTemplateRef;
|
|
201
|
+
const loadingInstance = createComponent(loadingConstructor$1, __spreadValues({}, props), loadingTemplateRef ? () => loadingTemplateRef : null);
|
|
202
|
+
el.style.position = props.positionType;
|
|
203
|
+
el.options = props;
|
|
204
|
+
el.instance = loadingInstance;
|
|
205
|
+
el.mask = loadingInstance.proxy.$el;
|
|
206
|
+
};
|
|
207
|
+
const loadingDirective = {
|
|
208
|
+
mounted: function(el, binding, vnode) {
|
|
209
|
+
handleProps(el, vnode.props);
|
|
210
|
+
removeAttribute(el);
|
|
211
|
+
!isEmpty(binding.value) && toggleLoading(el, binding);
|
|
212
|
+
},
|
|
213
|
+
updated: function(el, binding, vnode) {
|
|
214
|
+
if (!isEmpty(binding.value) && cacheInstance.has(el) || isEmpty(binding.value) && !cacheInstance.has(el))
|
|
215
|
+
return;
|
|
216
|
+
!cacheInstance.has(el) && handleProps(el, vnode.props);
|
|
217
|
+
removeAttribute(el);
|
|
218
|
+
toggleLoading(el, binding);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
const loadingConstructor = defineComponent(Loading);
|
|
222
|
+
const cacheTarget = new WeakMap();
|
|
223
|
+
const loading = {
|
|
224
|
+
open(options = {}) {
|
|
225
|
+
const parent = options.target || document.body;
|
|
226
|
+
if (cacheTarget.has(parent)) {
|
|
227
|
+
return cacheTarget.get(parent);
|
|
228
|
+
}
|
|
229
|
+
parent.style.position = options.positionType;
|
|
230
|
+
const isFull = document.body === parent;
|
|
231
|
+
options = __spreadValues(__spreadValues({}, new LoadingProps()), options);
|
|
232
|
+
const instance = createComponent(loadingConstructor, __spreadProps(__spreadValues({}, options), {
|
|
233
|
+
isFull
|
|
234
|
+
}), options.loadingTemplateRef ? () => options.loadingTemplateRef : null);
|
|
235
|
+
cacheTarget.set(parent, instance);
|
|
236
|
+
instance.proxy.open();
|
|
237
|
+
parent.appendChild(instance.proxy.$el);
|
|
238
|
+
const close = instance.proxy.close;
|
|
239
|
+
instance.loadingInstance = instance.proxy;
|
|
240
|
+
instance.loadingInstance.close = (...args) => {
|
|
241
|
+
cacheTarget.delete(parent);
|
|
242
|
+
close(...args);
|
|
243
|
+
};
|
|
244
|
+
return instance;
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
var index = {
|
|
248
|
+
title: "Loading \u52A0\u8F7D\u63D0\u793A",
|
|
249
|
+
category: "\u53CD\u9988",
|
|
250
|
+
status: "100%",
|
|
251
|
+
install(app) {
|
|
252
|
+
app.directive("dLoading", loadingDirective);
|
|
253
|
+
app.config.globalProperties.$loadingService = loading;
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
export { loadingDirective as Loading, loading as LoadingService, index as default };
|