vue-devui 1.0.0-rc.8 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +188 -149
- package/alert/index.es.js +14 -9
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/auto-complete/index.es.js +8392 -418
- package/auto-complete/index.umd.js +29 -5
- package/auto-complete/style.css +1 -1
- package/avatar/index.es.js +59 -74
- package/avatar/index.umd.js +1 -1
- package/badge/index.es.js +10 -4
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.es.js +191 -53
- package/button/index.umd.js +17 -17
- package/button/style.css +1 -1
- package/card/index.es.js +7 -3
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.es.js +8050 -241
- package/checkbox/index.umd.js +27 -1
- package/checkbox/style.css +1 -1
- package/{date-picker → collapse}/index.d.ts +0 -0
- package/collapse/index.es.js +213 -0
- package/collapse/index.umd.js +1 -0
- package/{date-picker → collapse}/package.json +1 -1
- package/collapse/style.css +1 -0
- package/countdown/index.es.js +56 -13
- package/countdown/index.umd.js +1 -1
- package/date-picker-pro/index.d.ts +7 -0
- package/date-picker-pro/index.es.js +12022 -0
- package/date-picker-pro/index.umd.js +27 -0
- package/date-picker-pro/package.json +7 -0
- package/date-picker-pro/style.css +1 -0
- package/drawer/index.es.js +24 -7
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +190 -165
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +785 -145
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.es.js +399 -300
- package/form/index.umd.js +16 -16
- package/form/style.css +1 -1
- package/fullscreen/index.es.js +2 -2
- package/fullscreen/index.umd.js +1 -1
- package/grid/index.es.js +8 -6
- package/grid/index.umd.js +1 -1
- package/icon/index.es.js +185 -23
- package/icon/index.umd.js +1 -1
- package/icon/style.css +1 -0
- package/image-preview/index.es.js +2 -2
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/input/index.es.js +8220 -45
- package/input/index.umd.js +27 -1
- package/input/style.css +1 -1
- package/input-number/index.es.js +279 -204
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.es.js +3 -3
- package/layout/index.umd.js +1 -1
- package/loading/index.es.js +53 -53
- package/loading/index.umd.js +1 -1
- package/loading/style.css +1 -1
- package/mention/index.d.ts +7 -0
- package/mention/index.es.js +8319 -0
- package/mention/index.umd.js +36 -0
- package/mention/package.json +7 -0
- package/mention/style.css +1 -0
- package/menu/index.d.ts +7 -0
- package/menu/index.es.js +921 -0
- package/menu/index.umd.js +1 -0
- package/menu/package.json +7 -0
- package/menu/style.css +1 -0
- package/message/index.d.ts +7 -0
- package/message/index.es.js +539 -0
- package/message/index.umd.js +1 -0
- package/message/package.json +7 -0
- package/message/style.css +1 -0
- package/modal/index.es.js +451 -173
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +212 -70
- package/notification/index.umd.js +1 -1
- package/notification/style.css +1 -1
- package/nuxt/components/CheckboxButton.js +3 -0
- package/nuxt/components/Collapse.js +3 -0
- package/nuxt/components/CollapseItem.js +3 -0
- package/nuxt/components/DRangeDatePickerPro.js +3 -0
- package/nuxt/components/DatePickerPro.js +3 -0
- package/nuxt/components/Icon.js +1 -0
- package/nuxt/components/IconGroup.js +3 -0
- package/nuxt/components/LABEL_DATA.js +3 -0
- package/nuxt/components/Mention.js +3 -0
- package/nuxt/components/Menu.js +3 -0
- package/nuxt/components/MenuItem.js +3 -0
- package/nuxt/components/Message.js +3 -0
- package/nuxt/components/Option.js +3 -0
- package/nuxt/components/OptionGroup.js +3 -0
- package/nuxt/components/RadioButton.js +3 -0
- package/nuxt/components/Step.js +3 -0
- package/nuxt/components/Steps.js +3 -0
- package/nuxt/components/SubMenu.js +3 -0
- package/nuxt/components/TABLE_TOKEN.js +3 -0
- package/nuxt/components/TimePicker.js +3 -0
- package/nuxt/components/TimeSelect.js +3 -0
- package/nuxt/components/animationInjectionKey.js +3 -0
- package/nuxt/components/collapseItemProps.js +3 -0
- package/nuxt/components/collapseProps.js +3 -0
- package/nuxt/components/datePickerProCommonProps.js +3 -0
- package/nuxt/components/datePickerProPanelProps.js +3 -0
- package/nuxt/components/datePickerProProps.js +3 -0
- package/nuxt/components/iconProps.js +1 -0
- package/nuxt/components/mentionProps.js +3 -0
- package/nuxt/components/messageProps.js +3 -0
- package/nuxt/components/paginationInjectionKey.js +3 -0
- package/nuxt/components/roundInjectionKey.js +3 -0
- package/nuxt/components/skeletonItemProps.js +3 -0
- package/nuxt/components/stepProps.js +3 -0
- package/nuxt/components/stepsProps.js +3 -0
- package/nuxt/components/svgIconProps.js +3 -0
- package/nuxt/components/tableProps.js +3 -0
- package/nuxt/components/timerPickerPanelProps.js +3 -0
- package/nuxt/components/treeNodeProps.js +3 -0
- package/overlay/index.es.js +89 -142
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +8 -4
- package/pagination/index.es.js +10180 -129
- package/pagination/index.umd.js +27 -1
- package/pagination/style.css +1 -1
- package/panel/index.es.js +4 -0
- package/panel/index.umd.js +1 -1
- package/panel/style.css +1 -1
- package/popover/index.es.js +262 -229
- package/popover/index.umd.js +15 -15
- package/popover/style.css +1 -1
- package/progress/index.es.js +2 -2
- package/progress/index.umd.js +2 -2
- package/progress/style.css +1 -1
- package/radio/index.es.js +7954 -156
- package/radio/index.umd.js +27 -1
- package/radio/style.css +1 -1
- package/rate/index.es.js +16 -8
- package/rate/index.umd.js +1 -1
- package/rate/style.css +1 -1
- package/result/index.es.js +170 -22
- package/result/index.umd.js +1 -1
- package/result/style.css +1 -1
- package/search/index.es.js +3829 -1042
- package/search/index.umd.js +18 -18
- package/search/style.css +1 -1
- package/select/index.es.js +9202 -495
- package/select/index.umd.js +27 -1
- package/select/style.css +1 -1
- package/skeleton/index.es.js +89 -263
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.es.js +118 -145
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.es.js +454 -233
- package/splitter/index.umd.js +13 -13
- package/splitter/style.css +1 -1
- package/statistic/index.es.js +34 -16
- package/statistic/index.umd.js +1 -1
- package/statistic/style.css +1 -1
- package/status/index.es.js +6 -2
- package/status/index.umd.js +1 -1
- package/status/style.css +1 -1
- package/steps/index.d.ts +7 -0
- package/steps/index.es.js +387 -0
- package/steps/index.umd.js +1 -0
- package/steps/package.json +7 -0
- package/steps/style.css +1 -0
- package/style.css +1 -1
- package/switch/index.es.js +7787 -62
- package/switch/index.umd.js +27 -1
- package/switch/style.css +1 -1
- package/table/index.es.js +5225 -1726
- package/table/index.umd.js +18 -18
- package/table/style.css +1 -1
- package/tabs/index.es.js +303 -102
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.es.js +11 -8
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/textarea/index.es.js +7876 -41
- package/textarea/index.umd.js +35 -1
- package/textarea/style.css +1 -1
- package/time-picker/index.d.ts +7 -0
- package/time-picker/index.es.js +9549 -0
- package/time-picker/index.umd.js +27 -0
- package/time-picker/package.json +7 -0
- package/time-picker/style.css +1 -0
- package/time-select/index.d.ts +7 -0
- package/time-select/index.es.js +9607 -0
- package/time-select/index.umd.js +27 -0
- package/time-select/package.json +7 -0
- package/time-select/style.css +1 -0
- package/timeline/index.es.js +170 -22
- package/timeline/index.umd.js +1 -1
- package/timeline/style.css +1 -1
- package/tooltip/index.es.js +286 -238
- package/tooltip/index.umd.js +14 -14
- package/tooltip/style.css +1 -1
- package/tree/index.es.js +11342 -793
- package/tree/index.umd.js +27 -1
- package/tree/style.css +1 -1
- package/upload/index.es.js +458 -102
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +20475 -11072
- package/vue-devui.umd.js +31 -24
- package/date-picker/index.es.js +0 -1097
- package/date-picker/index.umd.js +0 -1
- package/date-picker/style.css +0 -1
- package/nuxt/components/DatePicker.js +0 -3
- package/nuxt/components/FormControl.js +0 -3
- package/nuxt/components/FormLabel.js +0 -3
- package/nuxt/components/Loading.js +0 -3
- package/nuxt/components/StickSlider.js +0 -3
- package/nuxt/components/formControlProps.js +0 -3
- package/nuxt/components/overlayEmits.js +0 -3
- package/nuxt/components/overlayProps.js +0 -3
|
@@ -0,0 +1,213 @@
|
|
|
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
|
+
import { defineComponent, provide, reactive, toRefs, createVNode, shallowRef, inject, computed, onMounted, Transition } from "vue";
|
|
21
|
+
const SELECT_TOKEN = Symbol("dCollapse");
|
|
22
|
+
const collapseProps = {
|
|
23
|
+
modelValue: {
|
|
24
|
+
type: [String, Number, Array],
|
|
25
|
+
default: "",
|
|
26
|
+
required: true
|
|
27
|
+
},
|
|
28
|
+
accordion: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const collapseItemProps = {
|
|
34
|
+
name: {
|
|
35
|
+
type: [String, Number],
|
|
36
|
+
default: "",
|
|
37
|
+
required: true
|
|
38
|
+
},
|
|
39
|
+
title: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: ""
|
|
42
|
+
},
|
|
43
|
+
disabled: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: false
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
function createBem(namespace, element, modifier) {
|
|
49
|
+
let cls = namespace;
|
|
50
|
+
if (element) {
|
|
51
|
+
cls += `__${element}`;
|
|
52
|
+
}
|
|
53
|
+
if (modifier) {
|
|
54
|
+
cls += `--${modifier}`;
|
|
55
|
+
}
|
|
56
|
+
return cls;
|
|
57
|
+
}
|
|
58
|
+
function useNamespace(block, needDot = false) {
|
|
59
|
+
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
60
|
+
const b = () => createBem(namespace);
|
|
61
|
+
const e = (element) => element ? createBem(namespace, element) : "";
|
|
62
|
+
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
63
|
+
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
64
|
+
return {
|
|
65
|
+
b,
|
|
66
|
+
e,
|
|
67
|
+
m,
|
|
68
|
+
em
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
var collapse = "";
|
|
72
|
+
var Collapse = defineComponent({
|
|
73
|
+
name: "DCollapse",
|
|
74
|
+
props: collapseProps,
|
|
75
|
+
emits: ["change", "update:modelValue"],
|
|
76
|
+
setup(props, ctx) {
|
|
77
|
+
const ns = useNamespace("collapse");
|
|
78
|
+
const scrollbarNs = useNamespace("scrollbar");
|
|
79
|
+
const getLists = (data) => {
|
|
80
|
+
if (!data && data !== 0) {
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
return Array.isArray(data) ? data : [data];
|
|
84
|
+
};
|
|
85
|
+
const collapseItemClick = (name) => {
|
|
86
|
+
const activeLists = [...getLists(props.modelValue)];
|
|
87
|
+
const itemIndex = activeLists.indexOf(name);
|
|
88
|
+
if (props.accordion) {
|
|
89
|
+
let activeName = name;
|
|
90
|
+
if ((activeLists[0] || activeLists[0] === 0) && activeLists[0] === name) {
|
|
91
|
+
activeName = "";
|
|
92
|
+
}
|
|
93
|
+
ctx.emit("update:modelValue", activeName);
|
|
94
|
+
ctx.emit("change", activeName);
|
|
95
|
+
} else {
|
|
96
|
+
if (itemIndex > -1) {
|
|
97
|
+
activeLists.splice(itemIndex, 1);
|
|
98
|
+
} else {
|
|
99
|
+
activeLists.push(name);
|
|
100
|
+
}
|
|
101
|
+
ctx.emit("update:modelValue", activeLists);
|
|
102
|
+
ctx.emit("change", activeLists);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
provide(SELECT_TOKEN, reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
|
|
106
|
+
collapseItemClick
|
|
107
|
+
})));
|
|
108
|
+
return () => {
|
|
109
|
+
var _a, _b;
|
|
110
|
+
return createVNode("div", {
|
|
111
|
+
"class": [ns.b(), scrollbarNs.b()]
|
|
112
|
+
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
const OpenIcon = () => {
|
|
117
|
+
const svgProps = {
|
|
118
|
+
width: "1em",
|
|
119
|
+
height: "1em",
|
|
120
|
+
viewBox: "0 0 16 16",
|
|
121
|
+
version: "1.1",
|
|
122
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
123
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
124
|
+
};
|
|
125
|
+
return createVNode("svg", svgProps, [createVNode("g", {
|
|
126
|
+
"stroke": "none",
|
|
127
|
+
"stroke-width": "1",
|
|
128
|
+
"fill": "none",
|
|
129
|
+
"fill-rule": "evenodd"
|
|
130
|
+
}, [createVNode("path", {
|
|
131
|
+
"d": "M12.1464466,6.85355339 L8.35355339,10.6464466 C8.15829124,10.8417088 7.84170876,10.8417088 7.64644661,10.6464466 L3.85355339,6.85355339 C3.65829124,6.65829124 3.65829124,6.34170876 3.85355339,6.14644661 C3.94732158,6.05267842 4.07449854,6 4.20710678,6 L11.7928932,6 C12.0690356,6 12.2928932,6.22385763 12.2928932,6.5 C12.2928932,6.63260824 12.2402148,6.7597852 12.1464466,6.85355339 Z",
|
|
132
|
+
"fill-rule": "nonzero"
|
|
133
|
+
}, null)])]);
|
|
134
|
+
};
|
|
135
|
+
var CollapseItem = defineComponent({
|
|
136
|
+
name: "DCollapseItem",
|
|
137
|
+
props: collapseItemProps,
|
|
138
|
+
setup(props, ctx) {
|
|
139
|
+
const ns = useNamespace("collapse");
|
|
140
|
+
const transitionNs = useNamespace("collapse-transition");
|
|
141
|
+
const collapseContent = shallowRef();
|
|
142
|
+
const collapse2 = inject(SELECT_TOKEN, null);
|
|
143
|
+
const isOpen = computed(() => {
|
|
144
|
+
if (props.disabled) {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
if (Array.isArray(collapse2 == null ? void 0 : collapse2.modelValue)) {
|
|
148
|
+
return Boolean(collapse2 == null ? void 0 : collapse2.modelValue.length) && (collapse2 == null ? void 0 : collapse2.modelValue.includes(props.name));
|
|
149
|
+
} else {
|
|
150
|
+
return Boolean(collapse2 == null ? void 0 : collapse2.modelValue) && (collapse2 == null ? void 0 : collapse2.modelValue) === props.name;
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
const handlerTitleClick = (e) => {
|
|
154
|
+
e.preventDefault();
|
|
155
|
+
e.stopPropagation();
|
|
156
|
+
if (!props.disabled) {
|
|
157
|
+
collapse2 == null ? void 0 : collapse2.collapseItemClick(props.name);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
onMounted(() => {
|
|
161
|
+
if (collapseContent.value) {
|
|
162
|
+
const dom = collapseContent.value;
|
|
163
|
+
if (isOpen.value) {
|
|
164
|
+
dom.style.height = `${dom.offsetHeight}px`;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
const enter = (element) => {
|
|
169
|
+
const el = element;
|
|
170
|
+
el.style.height = "";
|
|
171
|
+
const height = el.offsetHeight;
|
|
172
|
+
el.style.height = "0px";
|
|
173
|
+
el.offsetHeight;
|
|
174
|
+
el.style.height = `${height}px`;
|
|
175
|
+
};
|
|
176
|
+
const leave = (element) => {
|
|
177
|
+
const el = element;
|
|
178
|
+
el.style.height = "0px";
|
|
179
|
+
};
|
|
180
|
+
return () => {
|
|
181
|
+
return createVNode("div", {
|
|
182
|
+
"class": ns.e("item")
|
|
183
|
+
}, [createVNode("div", {
|
|
184
|
+
"class": [ns.e("item-title"), ns.m("overflow-ellipsis"), isOpen.value && ns.m("open"), props.disabled && ns.em("item", "disabled")],
|
|
185
|
+
"onClick": handlerTitleClick
|
|
186
|
+
}, [ctx.slots.title ? ctx.slots.title() : props.title, createVNode("span", {
|
|
187
|
+
"class": ns.e("open-icon")
|
|
188
|
+
}, [createVNode(OpenIcon, null, null)])]), createVNode(Transition, {
|
|
189
|
+
"name": transitionNs.b(),
|
|
190
|
+
"onEnter": enter,
|
|
191
|
+
"onLeave": leave
|
|
192
|
+
}, {
|
|
193
|
+
default: () => {
|
|
194
|
+
var _a, _b;
|
|
195
|
+
return [isOpen.value && createVNode("div", {
|
|
196
|
+
"ref": collapseContent,
|
|
197
|
+
"class": ns.e("item-content")
|
|
198
|
+
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])];
|
|
199
|
+
}
|
|
200
|
+
})]);
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
var index = {
|
|
205
|
+
title: "Collapse \u6298\u53E0\u9762\u677F",
|
|
206
|
+
category: "\u6570\u636E\u5C55\u793A",
|
|
207
|
+
status: "100%",
|
|
208
|
+
install(app) {
|
|
209
|
+
app.component(Collapse.name, Collapse);
|
|
210
|
+
app.component(CollapseItem.name, CollapseItem);
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
export { Collapse, CollapseItem, collapseItemProps, collapseProps, index as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var S=Object.defineProperty,T=Object.defineProperties;var A=Object.getOwnPropertyDescriptors;var b=Object.getOwnPropertySymbols;var B=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var v=(t,e,r)=>e in t?S(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,w=(t,e)=>{for(var r in e||(e={}))B.call(e,r)&&v(t,r,e[r]);if(b)for(var r of b(e))E.call(e,r)&&v(t,r,e[r]);return t},I=(t,e)=>T(t,A(e));(function(t,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(t=typeof globalThis!="undefined"?globalThis:t||self,e(t.index={},t.Vue))})(this,function(t,e){"use strict";const r=Symbol("dCollapse"),V={modelValue:{type:[String,Number,Array],default:"",required:!0},accordion:{type:Boolean,default:!1}},N={name:{type:[String,Number],default:"",required:!0},title:{type:String,default:""},disabled:{type:Boolean,default:!1}};function h(l,a,i){let u=l;return a&&(u+=`__${a}`),i&&(u+=`--${i}`),u}function g(l,a=!1){const i=a?`.devui-${l}`:`devui-${l}`;return{b:()=>h(i),e:n=>n?h(i,n):"",m:n=>n?h(i,"",n):"",em:(n,m)=>n&&m?h(i,n,m):""}}var $="",C=e.defineComponent({name:"DCollapse",props:V,emits:["change","update:modelValue"],setup(l,a){const i=g("collapse"),u=g("scrollbar"),f=s=>!s&&s!==0?[]:Array.isArray(s)?s:[s],o=s=>{const n=[...f(l.modelValue)],m=n.indexOf(s);if(l.accordion){let p=s;(n[0]||n[0]===0)&&n[0]===s&&(p=""),a.emit("update:modelValue",p),a.emit("change",p)}else m>-1?n.splice(m,1):n.push(s),a.emit("update:modelValue",n),a.emit("change",n)};return e.provide(r,e.reactive(I(w({},e.toRefs(l)),{collapseItemClick:o}))),()=>{var s,n;return e.createVNode("div",{class:[i.b(),u.b()]},[(n=(s=a.slots).default)==null?void 0:n.call(s)])}}});const k=()=>{const l={width:"1em",height:"1em",viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"};return e.createVNode("svg",l,[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("path",{d:"M12.1464466,6.85355339 L8.35355339,10.6464466 C8.15829124,10.8417088 7.84170876,10.8417088 7.64644661,10.6464466 L3.85355339,6.85355339 C3.65829124,6.65829124 3.65829124,6.34170876 3.85355339,6.14644661 C3.94732158,6.05267842 4.07449854,6 4.20710678,6 L11.7928932,6 C12.0690356,6 12.2928932,6.22385763 12.2928932,6.5 C12.2928932,6.63260824 12.2402148,6.7597852 12.1464466,6.85355339 Z","fill-rule":"nonzero"},null)])])};var y=e.defineComponent({name:"DCollapseItem",props:N,setup(l,a){const i=g("collapse"),u=g("collapse-transition"),f=e.shallowRef(),o=e.inject(r,null),s=e.computed(()=>l.disabled?!1:Array.isArray(o==null?void 0:o.modelValue)?Boolean(o==null?void 0:o.modelValue.length)&&(o==null?void 0:o.modelValue.includes(l.name)):Boolean(o==null?void 0:o.modelValue)&&(o==null?void 0:o.modelValue)===l.name),n=d=>{d.preventDefault(),d.stopPropagation(),l.disabled||o==null||o.collapseItemClick(l.name)};e.onMounted(()=>{if(f.value){const d=f.value;s.value&&(d.style.height=`${d.offsetHeight}px`)}});const m=d=>{const c=d;c.style.height="";const P=c.offsetHeight;c.style.height="0px",c.offsetHeight,c.style.height=`${P}px`},p=d=>{const c=d;c.style.height="0px"};return()=>e.createVNode("div",{class:i.e("item")},[e.createVNode("div",{class:[i.e("item-title"),i.m("overflow-ellipsis"),s.value&&i.m("open"),l.disabled&&i.em("item","disabled")],onClick:n},[a.slots.title?a.slots.title():l.title,e.createVNode("span",{class:i.e("open-icon")},[e.createVNode(k,null,null)])]),e.createVNode(e.Transition,{name:u.b(),onEnter:m,onLeave:p},{default:()=>{var d,c;return[s.value&&e.createVNode("div",{ref:f,class:i.e("item-content")},[(c=(d=a.slots).default)==null?void 0:c.call(d)])]}})])}}),L={title:"Collapse \u6298\u53E0\u9762\u677F",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(l){l.component(C.name,C),l.component(y.name,y)}};t.Collapse=C,t.CollapseItem=y,t.collapseItemProps=N,t.collapseProps=V,t.default=L,Object.defineProperty(t,"__esModule",{value:!0}),t[Symbol.toStringTag]="Module"});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@charset "UTF-8";.devui-collapse{font-size:var(--devui-font-size, 14px);background:var(--devui-base-bg, #ffffff);width:100%;overflow-y:auto;box-shadow:var(--devui-shadow-length-base, 0 1px 4px 0) var(--devui-shadow, rgba(37, 43, 58, .2))}:host{display:block}.devui-collapse__item .devui-collapse--overflow-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.devui-collapse__item-title{display:block;height:45px;width:100%;padding:0 28px 0 20px;font-weight:400;line-height:45px;color:var(--devui-text, #252b3a);background-color:var(--devui-base-bg, #ffffff);cursor:pointer}.devui-collapse__item-title.devui-collapse__item--disabled{color:var(--devui-disabled-text, #adb0b8);cursor:not-allowed}.devui-collapse__item-title:not(.devui-collapse__item--disabled):hover{background:var(--devui-list-item-hover-bg, #f2f2f3);color:var(--devui-list-item-hover-text, #252b3a)}.devui-collapse__item>.devui-collapse__item-title{position:relative}.devui-collapse__item>.devui-collapse__item-title>.devui-collapse__open-icon{display:inline-block;text-indent:0;pointer-events:none;position:absolute;right:10px;top:14px;width:16px;height:16px;line-height:16px;transition:transform ease-out .4s}.devui-collapse__item>.devui-collapse__item-title>.devui-collapse__open-icon svg{width:16px;height:16px}.devui-collapse__item>.devui-collapse__item-title>.devui-collapse__open-icon svg path{fill:var(--devui-text-weak, #575d6c)}.devui-collapse__item>.devui-collapse__item-title.devui-collapse--open>.devui-collapse__open-icon{transform:rotate(180deg);transform-origin:center}.devui-collapse__item-content{padding:0 12px 0 20px;line-height:1.5;color:var(--devui-text-weak, #575d6c)}.devui-collapse-transition-leave-active{transition:all .4s ease-in-out;animation:panelUpOut .4s ease-in-out;animation-fill-mode:both}.devui-collapse-transition-enter-active{transition:all .4s ease-in-out;animation:panelUpIn .4s ease-in-out;animation-fill-mode:both}@keyframes panelUpOut{0%{transform:scaleY(1);transform-origin:0% 0%;opacity:1}to{transform:scaleY(0);transform-origin:0% 0%;opacity:0}}@keyframes panelUpIn{0%{transform:scaleY(0);transform-origin:0% 0%;opacity:0}to{transform:scaleY(1);transform-origin:0% 0%;opacity:1}}
|
package/countdown/index.es.js
CHANGED
|
@@ -24,7 +24,15 @@ const countdownProps = {
|
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
const getFormatTime = (leftTime) => {
|
|
27
|
-
const timeformat = /* @__PURE__ */ new Map([
|
|
27
|
+
const timeformat = /* @__PURE__ */ new Map([
|
|
28
|
+
["Y", 0],
|
|
29
|
+
["M", 0],
|
|
30
|
+
["D", 0],
|
|
31
|
+
["H", 0],
|
|
32
|
+
["m", 0],
|
|
33
|
+
["s", 0],
|
|
34
|
+
["S", 0]
|
|
35
|
+
]);
|
|
28
36
|
const year = Math.floor(leftTime / (365 * 24 * 60 * 60 * 1e3));
|
|
29
37
|
const month = Math.floor(leftTime / (30 * 24 * 60 * 60 * 1e3) % 12);
|
|
30
38
|
const day = Math.floor(leftTime / (24 * 60 * 60 * 1e3) % 30);
|
|
@@ -42,19 +50,35 @@ const getFormatTime = (leftTime) => {
|
|
|
42
50
|
return timeformat;
|
|
43
51
|
};
|
|
44
52
|
const getLegalTime = (s, timeformat) => {
|
|
45
|
-
const dateValue = /* @__PURE__ */ new Map([
|
|
46
|
-
|
|
53
|
+
const dateValue = /* @__PURE__ */ new Map([
|
|
54
|
+
["Y", 0],
|
|
55
|
+
["M", 0],
|
|
56
|
+
["D", 0],
|
|
57
|
+
["H", 0],
|
|
58
|
+
["m", 0],
|
|
59
|
+
["s", 0],
|
|
60
|
+
["S", 0]
|
|
61
|
+
]);
|
|
62
|
+
const m = /* @__PURE__ */ new Map([
|
|
63
|
+
["Y", 12],
|
|
64
|
+
["M", 30],
|
|
65
|
+
["D", 24],
|
|
66
|
+
["H", 60],
|
|
67
|
+
["m", 60],
|
|
68
|
+
["s", 1e3],
|
|
69
|
+
["S", 1]
|
|
70
|
+
]);
|
|
47
71
|
let storage = 0;
|
|
48
72
|
for (const k of dateValue.keys()) {
|
|
49
73
|
if (s.has(k)) {
|
|
50
|
-
dateValue.set(k, timeformat.get(k) + storage);
|
|
74
|
+
dateValue.set(k, (timeformat.get(k) || 0) + storage);
|
|
51
75
|
storage = 0;
|
|
52
76
|
} else {
|
|
53
|
-
storage += timeformat.get(k) * m.get(k);
|
|
77
|
+
storage += (timeformat.get(k) || 0) * (m.get(k) || 0);
|
|
54
78
|
}
|
|
55
79
|
}
|
|
56
|
-
if (!s.has("S") && timeformat.get("S") > 500) {
|
|
57
|
-
dateValue.set("s", dateValue.get("s") + 1);
|
|
80
|
+
if (!s.has("S") && (timeformat.get("S") || 0) > 500) {
|
|
81
|
+
dateValue.set("s", (dateValue.get("s") || 0) + 1);
|
|
58
82
|
}
|
|
59
83
|
return dateValue;
|
|
60
84
|
};
|
|
@@ -95,13 +119,29 @@ const numFormat = (n, len) => {
|
|
|
95
119
|
return str + n;
|
|
96
120
|
}
|
|
97
121
|
};
|
|
122
|
+
const intervalTimer = (callback, interval = 0) => {
|
|
123
|
+
let counter = 1;
|
|
124
|
+
let timeoutId;
|
|
125
|
+
const startTime = Date.now();
|
|
126
|
+
function main() {
|
|
127
|
+
const nowTime = Date.now();
|
|
128
|
+
const nextTime = startTime + counter * interval;
|
|
129
|
+
timeoutId = setTimeout(main, interval - (nowTime - nextTime));
|
|
130
|
+
counter += 1;
|
|
131
|
+
callback();
|
|
132
|
+
}
|
|
133
|
+
timeoutId = setTimeout(main, interval);
|
|
134
|
+
return () => {
|
|
135
|
+
clearTimeout(timeoutId);
|
|
136
|
+
};
|
|
137
|
+
};
|
|
98
138
|
var countdown = "";
|
|
99
139
|
var Countdown = defineComponent({
|
|
100
140
|
name: "DCountdown",
|
|
101
141
|
props: countdownProps,
|
|
102
142
|
emits: ["onChange", "onFinish"],
|
|
103
143
|
setup(props, ctx) {
|
|
104
|
-
const
|
|
144
|
+
const timerCleaner = ref();
|
|
105
145
|
const s = getDeduplication(props.format);
|
|
106
146
|
const timeFormat = getTimeSplit(props.format);
|
|
107
147
|
const timeStr = ref("");
|
|
@@ -109,7 +149,7 @@ var Countdown = defineComponent({
|
|
|
109
149
|
const fomatMap = /* @__PURE__ */ new Set(["Y", "M", "D", "H", "m", "s", "S"]);
|
|
110
150
|
const t = timeFormat.reduce((pre, cur) => {
|
|
111
151
|
if (fomatMap.has(cur.k)) {
|
|
112
|
-
return pre + numFormat(legalTime.get(cur.k), cur.n);
|
|
152
|
+
return pre + numFormat(legalTime.get(cur.k) || 0, cur.n);
|
|
113
153
|
}
|
|
114
154
|
return pre + cur.k;
|
|
115
155
|
}, "");
|
|
@@ -130,14 +170,16 @@ var Countdown = defineComponent({
|
|
|
130
170
|
};
|
|
131
171
|
const startTime = () => {
|
|
132
172
|
getTime();
|
|
133
|
-
if (
|
|
173
|
+
if (timerCleaner.value) {
|
|
134
174
|
return;
|
|
135
175
|
}
|
|
136
|
-
|
|
176
|
+
timerCleaner.value = intervalTimer(() => {
|
|
177
|
+
var _a;
|
|
137
178
|
const t = getTime();
|
|
138
179
|
if (t === 0) {
|
|
139
180
|
ctx.emit("onFinish");
|
|
140
|
-
|
|
181
|
+
(_a = timerCleaner.value) == null ? void 0 : _a.call(timerCleaner);
|
|
182
|
+
timerCleaner.value = null;
|
|
141
183
|
}
|
|
142
184
|
}, s.has("S") ? 100 : 1e3);
|
|
143
185
|
};
|
|
@@ -145,7 +187,8 @@ var Countdown = defineComponent({
|
|
|
145
187
|
startTime();
|
|
146
188
|
});
|
|
147
189
|
onUnmounted(() => {
|
|
148
|
-
|
|
190
|
+
var _a;
|
|
191
|
+
(_a = timerCleaner.value) == null ? void 0 : _a.call(timerCleaner);
|
|
149
192
|
});
|
|
150
193
|
return () => {
|
|
151
194
|
return createVNode("div", {
|
package/countdown/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(u
|
|
1
|
+
(function(c,u){typeof exports=="object"&&typeof module!="undefined"?u(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],u):(c=typeof globalThis!="undefined"?globalThis:c||self,u(c.index={},c.Vue))})(this,function(c,u){"use strict";const S={value:{type:Number,required:!0},format:{type:String,default:"HH:mm:ss"},prefix:{type:String,default:""},suffix:{type:String,default:""},valueStyle:{type:Object,default:()=>({})}},M=e=>{const n=new Map([["Y",0],["M",0],["D",0],["H",0],["m",0],["s",0],["S",0]]),t=Math.floor(e/(365*24*60*60*1e3)),o=Math.floor(e/(30*24*60*60*1e3)%12),s=Math.floor(e/(24*60*60*1e3)%30),a=Math.floor(e/(60*60*1e3)%24),d=Math.floor(e/(60*1e3)%60),l=Math.floor(e/1e3%60),w=e%1e3;return n.set("Y",t),n.set("M",o),n.set("D",s),n.set("H",a),n.set("m",d),n.set("s",l),n.set("S",w),n},p=(e,n)=>{const t=new Map([["Y",0],["M",0],["D",0],["H",0],["m",0],["s",0],["S",0]]),o=new Map([["Y",12],["M",30],["D",24],["H",60],["m",60],["s",1e3],["S",1]]);let s=0;for(const a of t.keys())e.has(a)?(t.set(a,(n.get(a)||0)+s),s=0):s+=(n.get(a)||0)*(o.get(a)||0);return!e.has("S")&&(n.get("S")||0)>500&&t.set("s",(t.get("s")||0)+1),t},y=e=>{const n=new Set(["Y","M","D","H","m","s","S"]),t=[];for(let o=0;o<e.length;o++){const s=e[o];t.length===0||t[t.length-1].k!==s||!n.has(s)?t.push({k:s,n:1}):t[t.length-1].n++}return t},T=e=>{const n=new Set(["Y","M","D","H","m","s","S"]),t=new Set;for(let o=0;o<e.length;o++){const s=e[o];n.has(s)&&t.add(s)}return t},D=(e,n)=>{const t=10**n-1;if(e>=t)return e;{const o=n-e.toString().length;let s="";for(let a=0;a<o;a++)s+="0";return s+e}},v=(e,n=0)=>{let t=1,o;const s=Date.now();function a(){const d=Date.now(),l=s+t*n;o=setTimeout(a,n-(d-l)),t+=1,e()}return o=setTimeout(a,n),()=>{clearTimeout(o)}};var k="",h=u.defineComponent({name:"DCountdown",props:S,emits:["onChange","onFinish"],setup(e,n){const t=u.ref(),o=T(e.format),s=y(e.format),a=u.ref(""),d=i=>{const r=new Set(["Y","M","D","H","m","s","S"]),m=s.reduce((f,g)=>r.has(g.k)?f+D(i.get(g.k)||0,g.n):f+g.k,"");a.value=m},l=()=>{const i=new Date(e.value).getTime(),r=i>new Date().getTime()?i-new Date().getTime():0,m=M(r),f=p(o,m);return!n.slots.default&&d(f),n.emit("onChange",{leftTime:r,formatTime:m,legalTime:f}),r},w=()=>{l(),!t.value&&(t.value=v(()=>{var r;l()===0&&(n.emit("onFinish"),(r=t.value)==null||r.call(t),t.value=null)},o.has("S")?100:1e3))};return u.onMounted(()=>{w()}),u.onUnmounted(()=>{var i;(i=t.value)==null||i.call(t)}),()=>u.createVNode("div",{class:"devui-countdown"},[n.slots.default?n.slots.default():u.createVNode("div",{class:"countdown-content",style:e.valueStyle},[u.createVNode("span",{class:"countdown-prefix"},[e.prefix]),u.createVNode("span",{class:"countdown-value"},[a.value]),u.createVNode("span",{class:"countdown-suffix"},[e.suffix])])])}}),H={title:"Countdown \u5012\u8BA1\u65F6",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(e){e.component(h.name,h)}};c.Countdown=h,c.countdownProps=S,c.default=H,Object.defineProperty(c,"__esModule",{value:!0}),c[Symbol.toStringTag]="Module"});
|