vue-devui 1.0.0-beta.7 → 1.0.0-pre.0
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 +81 -66
- package/accordion/index.es.js +522 -39
- package/accordion/index.umd.js +1 -1
- package/accordion/style.css +1 -1
- package/alert/index.es.js +7 -8
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/{toast → auto-complete}/index.d.ts +0 -0
- package/auto-complete/index.es.js +976 -0
- package/auto-complete/index.umd.js +1 -0
- package/auto-complete/package.json +7 -0
- package/auto-complete/style.css +1 -0
- package/avatar/index.es.js +1 -1
- package/avatar/index.umd.js +1 -1
- package/back-top/index.es.js +1 -1
- package/back-top/index.umd.js +1 -1
- package/badge/index.es.js +13 -19
- package/badge/index.umd.js +1 -1
- package/button/index.es.js +263 -83
- package/button/index.umd.js +1 -1
- package/button/style.css +1 -1
- package/card/index.es.js +1 -1
- package/card/index.umd.js +1 -1
- package/carousel/index.es.js +7 -6
- package/carousel/index.umd.js +1 -1
- package/cascader/index.es.js +5393 -773
- package/cascader/index.umd.js +27 -1
- package/checkbox/index.es.js +1 -1
- package/checkbox/index.umd.js +1 -1
- package/checkbox/style.css +1 -1
- package/color-picker/index.d.ts +7 -0
- package/color-picker/index.es.js +8187 -0
- package/color-picker/index.umd.js +27 -0
- package/color-picker/package.json +7 -0
- package/color-picker/style.css +1 -0
- package/comment/index.es.js +42 -13
- package/comment/index.umd.js +1 -1
- package/comment/style.css +1 -1
- 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.es.js +11 -12
- package/date-picker/index.umd.js +1 -1
- package/date-picker/style.css +1 -1
- package/dragdrop/index.es.js +135 -10
- package/dragdrop/index.umd.js +1 -1
- package/drawer/index.es.js +173 -203
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +412 -302
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +275 -5610
- package/editable-select/index.umd.js +1 -27
- package/editable-select/style.css +1 -1
- package/form/index.es.js +6129 -461
- package/form/index.umd.js +27 -1
- package/form/style.css +1 -1
- package/fullscreen/index.es.js +111 -119
- package/fullscreen/index.umd.js +1 -1
- package/fullscreen/style.css +1 -1
- package/gantt/index.es.js +6 -18
- package/gantt/index.umd.js +1 -1
- package/gantt/style.css +1 -1
- package/grid/index.es.js +3 -3
- package/grid/index.umd.js +1 -1
- package/grid/style.css +1 -1
- package/icon/index.es.js +3 -2
- package/icon/index.umd.js +1 -1
- package/image-preview/index.es.js +78 -20
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/input/index.es.js +5 -6
- package/input/index.umd.js +1 -1
- package/input/style.css +1 -1
- package/input-icon/index.es.js +6 -6
- package/input-icon/index.umd.js +1 -1
- package/input-icon/style.css +1 -1
- package/input-number/index.es.js +2 -1
- package/input-number/index.umd.js +1 -1
- package/layout/index.es.js +1 -1
- package/layout/index.umd.js +1 -1
- package/list/index.d.ts +7 -0
- package/list/index.es.js +39 -0
- package/list/index.umd.js +1 -0
- package/{toast → list}/package.json +1 -1
- package/list/style.css +1 -0
- package/loading/index.es.js +3 -3
- package/loading/index.umd.js +1 -1
- package/modal/index.es.js +297 -761
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/nav-sprite/index.es.js +1 -675
- package/nav-sprite/index.umd.js +1 -1
- package/notification/index.d.ts +7 -0
- package/notification/index.es.js +286 -0
- package/notification/index.umd.js +1 -0
- package/notification/package.json +7 -0
- package/notification/style.css +1 -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/AutoComplete.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/CarouselItem.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/ColorPicker.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/DrawerService.js +3 -0
- package/nuxt/components/Dropdown.js +3 -0
- package/nuxt/components/DropdownMenu.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/IFileOptions.js +3 -0
- package/nuxt/components/IUploadOptions.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/List.js +3 -0
- package/nuxt/components/ListItem.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/NavSprite.js +2 -0
- package/nuxt/components/Notification.js +3 -0
- package/nuxt/components/NotificationService.js +3 -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/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/UploadStatus.js +3 -0
- package/nuxt/components/badgeProps.js +3 -0
- package/nuxt/components/buttonProps.js +3 -0
- package/nuxt/components/dropdownMenuProps.js +3 -0
- package/nuxt/components/fixedOverlayProps.js +3 -0
- package/nuxt/components/flexibleOverlayProps.js +3 -0
- package/nuxt/components/notificationProps.js +3 -0
- package/nuxt/components/overlayEmits.js +3 -0
- package/nuxt/components/overlayProps.js +3 -0
- package/nuxt/components/popoverProps.js +3 -0
- package/nuxt/components/tooltipProps.js +3 -0
- package/nuxt/components/uploadProps.js +3 -0
- package/nuxt/index.js +13 -0
- package/overlay/index.es.js +146 -200
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +10 -18
- package/pagination/index.es.js +4 -4
- package/pagination/index.umd.js +1 -1
- package/pagination/style.css +1 -1
- package/panel/index.es.js +3 -3
- package/panel/index.umd.js +1 -1
- package/popover/index.es.js +5948 -190
- package/popover/index.umd.js +27 -1
- package/popover/style.css +1 -1
- package/progress/index.es.js +9 -9
- package/progress/index.umd.js +3 -3
- package/quadrant-diagram/index.es.js +5405 -166
- package/quadrant-diagram/index.umd.js +27 -1
- package/radio/index.es.js +6 -6
- package/radio/index.umd.js +1 -1
- package/radio/style.css +1 -1
- package/rate/index.es.js +1 -1
- package/rate/index.umd.js +1 -1
- package/read-tip/index.es.js +21 -7
- package/read-tip/index.umd.js +1 -1
- package/read-tip/style.css +1 -1
- 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.es.js +6 -3
- package/ripple/index.umd.js +1 -1
- package/search/index.es.js +5435 -201
- package/search/index.umd.js +27 -1
- package/search/style.css +1 -1
- package/select/index.es.js +3 -2
- package/select/index.umd.js +1 -1
- package/select/style.css +1 -1
- package/skeleton/index.es.js +1 -1
- package/skeleton/index.umd.js +1 -1
- package/slider/index.es.js +3 -6
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.es.js +5904 -60
- package/splitter/index.umd.js +27 -1
- package/splitter/style.css +1 -1
- package/statistic/index.d.ts +7 -0
- package/statistic/index.es.js +267 -0
- package/statistic/index.umd.js +1 -0
- package/statistic/package.json +7 -0
- package/statistic/style.css +1 -0
- package/status/index.es.js +2 -2
- package/status/index.umd.js +1 -1
- package/status/style.css +1 -1
- package/steps-guide/index.es.js +8 -6
- package/steps-guide/index.umd.js +1 -1
- package/sticky/index.umd.js +1 -1
- package/style.css +1 -1
- package/switch/index.es.js +1 -1
- package/switch/index.umd.js +1 -1
- package/table/index.es.js +701 -359
- package/table/index.umd.js +1 -1
- package/table/style.css +1 -1
- package/tabs/index.es.js +3 -4
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.es.js +37 -11
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/tag-input/index.es.js +1 -13
- package/tag-input/index.umd.js +1 -1
- package/textarea/index.es.js +1 -1
- package/textarea/index.umd.js +1 -1
- package/textarea/style.css +1 -1
- package/{theme → theme/theme.scss} +0 -0
- package/time-axis/index.es.js +5 -2
- package/time-axis/index.umd.js +1 -1
- package/time-picker/index.es.js +269 -84
- package/time-picker/index.umd.js +1 -1
- package/time-picker/style.css +1 -1
- package/tooltip/index.es.js +5798 -141
- package/tooltip/index.umd.js +27 -1
- package/tooltip/style.css +1 -1
- package/transfer/index.es.js +6522 -635
- package/transfer/index.umd.js +27 -1
- package/transfer/style.css +1 -1
- package/tree/index.es.js +5858 -146
- package/tree/index.umd.js +27 -1
- package/tree/style.css +1 -1
- package/tree-select/index.es.js +130 -35
- package/tree-select/index.umd.js +1 -1
- package/tree-select/style.css +1 -1
- package/upload/index.es.js +464 -2681
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +15597 -14569
- package/vue-devui.umd.js +16 -16
- package/toast/index.es.js +0 -2059
- package/toast/index.umd.js +0 -1
- package/toast/style.css +0 -1
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { defineComponent, ref, onMounted, onUnmounted, createVNode } from "vue";
|
|
2
|
+
const countdownProps = {
|
|
3
|
+
value: {
|
|
4
|
+
type: Number,
|
|
5
|
+
required: true
|
|
6
|
+
},
|
|
7
|
+
format: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: "HH:mm:ss"
|
|
10
|
+
},
|
|
11
|
+
prefix: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: ""
|
|
14
|
+
},
|
|
15
|
+
suffix: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: ""
|
|
18
|
+
},
|
|
19
|
+
valueStyle: {
|
|
20
|
+
type: Object,
|
|
21
|
+
default: () => {
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var countdown = "";
|
|
27
|
+
const getFormatTime = (leftTime) => {
|
|
28
|
+
const timeformat = /* @__PURE__ */ new Map([["Y", 0], ["M", 0], ["D", 0], ["H", 0], ["m", 0], ["s", 0], ["S", 0]]);
|
|
29
|
+
const year = Math.floor(leftTime / (365 * 24 * 60 * 60 * 1e3));
|
|
30
|
+
const month = Math.floor(leftTime / (30 * 24 * 60 * 60 * 1e3) % 12);
|
|
31
|
+
const day = Math.floor(leftTime / (24 * 60 * 60 * 1e3) % 30);
|
|
32
|
+
const hour = Math.floor(leftTime / (60 * 60 * 1e3) % 24);
|
|
33
|
+
const minute = Math.floor(leftTime / (60 * 1e3) % 60);
|
|
34
|
+
const second = Math.floor(leftTime / 1e3 % 60);
|
|
35
|
+
const millsecond = leftTime % 1e3;
|
|
36
|
+
timeformat.set("Y", year);
|
|
37
|
+
timeformat.set("M", month);
|
|
38
|
+
timeformat.set("D", day);
|
|
39
|
+
timeformat.set("H", hour);
|
|
40
|
+
timeformat.set("m", minute);
|
|
41
|
+
timeformat.set("s", second);
|
|
42
|
+
timeformat.set("S", millsecond);
|
|
43
|
+
return timeformat;
|
|
44
|
+
};
|
|
45
|
+
const getLegalTime = (s, timeformat) => {
|
|
46
|
+
const dateValue = /* @__PURE__ */ new Map([["Y", 0], ["M", 0], ["D", 0], ["H", 0], ["m", 0], ["s", 0], ["S", 0]]);
|
|
47
|
+
const m = /* @__PURE__ */ new Map([["Y", 12], ["M", 30], ["D", 24], ["H", 60], ["m", 60], ["s", 1e3], ["S", 1]]);
|
|
48
|
+
let storage = 0;
|
|
49
|
+
for (const k of dateValue.keys()) {
|
|
50
|
+
if (s.has(k)) {
|
|
51
|
+
dateValue.set(k, timeformat.get(k) + storage);
|
|
52
|
+
storage = 0;
|
|
53
|
+
} else {
|
|
54
|
+
storage += timeformat.get(k) * m.get(k);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (!s.has("S") && timeformat.get("S") > 500) {
|
|
58
|
+
dateValue.set("s", dateValue.get("s") + 1);
|
|
59
|
+
}
|
|
60
|
+
return dateValue;
|
|
61
|
+
};
|
|
62
|
+
const getTimeSplit = (format) => {
|
|
63
|
+
const fomatMap = /* @__PURE__ */ new Set(["Y", "M", "D", "H", "m", "s", "S"]);
|
|
64
|
+
const m = [];
|
|
65
|
+
for (let i = 0; i < format.length; i++) {
|
|
66
|
+
const k = format[i];
|
|
67
|
+
if (m.length === 0 || m[m.length - 1].k !== k || !fomatMap.has(k)) {
|
|
68
|
+
m.push({ k, n: 1 });
|
|
69
|
+
} else {
|
|
70
|
+
m[m.length - 1].n++;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return m;
|
|
74
|
+
};
|
|
75
|
+
const getDeduplication = (format) => {
|
|
76
|
+
const fomatMap = /* @__PURE__ */ new Set(["Y", "M", "D", "H", "m", "s", "S"]);
|
|
77
|
+
const s = /* @__PURE__ */ new Set();
|
|
78
|
+
for (let i = 0; i < format.length; i++) {
|
|
79
|
+
const k = format[i];
|
|
80
|
+
if (fomatMap.has(k)) {
|
|
81
|
+
s.add(k);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return s;
|
|
85
|
+
};
|
|
86
|
+
const numFormat = (n, len) => {
|
|
87
|
+
const maxNum = 10 ** len - 1;
|
|
88
|
+
if (n >= maxNum) {
|
|
89
|
+
return n;
|
|
90
|
+
} else {
|
|
91
|
+
const carryLen = len - n.toString().length;
|
|
92
|
+
let str = "";
|
|
93
|
+
for (let i = 0; i < carryLen; i++) {
|
|
94
|
+
str += "0";
|
|
95
|
+
}
|
|
96
|
+
return str + n;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
var Countdown = defineComponent({
|
|
100
|
+
name: "DCountdown",
|
|
101
|
+
props: countdownProps,
|
|
102
|
+
emits: ["onChange", "onFinish"],
|
|
103
|
+
setup(props, ctx) {
|
|
104
|
+
const countdown2 = ref();
|
|
105
|
+
const s = getDeduplication(props.format);
|
|
106
|
+
const timeFormat = getTimeSplit(props.format);
|
|
107
|
+
const timeStr = ref("");
|
|
108
|
+
const getTimeStr = (legalTime) => {
|
|
109
|
+
const fomatMap = /* @__PURE__ */ new Set(["Y", "M", "D", "H", "m", "s", "S"]);
|
|
110
|
+
const t = timeFormat.reduce((pre, cur) => {
|
|
111
|
+
if (fomatMap.has(cur.k)) {
|
|
112
|
+
return pre + numFormat(legalTime.get(cur.k), cur.n);
|
|
113
|
+
}
|
|
114
|
+
return pre + cur.k;
|
|
115
|
+
}, "");
|
|
116
|
+
timeStr.value = t;
|
|
117
|
+
};
|
|
118
|
+
const getTime = () => {
|
|
119
|
+
const value = new Date(props.value).getTime();
|
|
120
|
+
const leftTime = value > new Date().getTime() ? value - new Date().getTime() : 0;
|
|
121
|
+
const formatTime = getFormatTime(leftTime);
|
|
122
|
+
const legalTime = getLegalTime(s, formatTime);
|
|
123
|
+
!ctx.slots.default && getTimeStr(legalTime);
|
|
124
|
+
ctx.emit("onChange", {
|
|
125
|
+
leftTime,
|
|
126
|
+
formatTime,
|
|
127
|
+
legalTime
|
|
128
|
+
});
|
|
129
|
+
return leftTime;
|
|
130
|
+
};
|
|
131
|
+
const startTime = () => {
|
|
132
|
+
getTime();
|
|
133
|
+
if (countdown2.value)
|
|
134
|
+
return;
|
|
135
|
+
countdown2.value = setInterval(() => {
|
|
136
|
+
const t = getTime();
|
|
137
|
+
if (t === 0) {
|
|
138
|
+
ctx.emit("onFinish");
|
|
139
|
+
clearInterval(countdown2.value);
|
|
140
|
+
}
|
|
141
|
+
}, s.has("S") ? 100 : 1e3);
|
|
142
|
+
};
|
|
143
|
+
onMounted(() => {
|
|
144
|
+
startTime();
|
|
145
|
+
});
|
|
146
|
+
onUnmounted(() => {
|
|
147
|
+
clearInterval(countdown2.value);
|
|
148
|
+
});
|
|
149
|
+
return () => {
|
|
150
|
+
return createVNode("div", {
|
|
151
|
+
"class": "devui-countdown"
|
|
152
|
+
}, [ctx.slots.default ? ctx.slots.default() : createVNode("div", {
|
|
153
|
+
"class": "countdown-content",
|
|
154
|
+
"style": props.valueStyle
|
|
155
|
+
}, [createVNode("span", {
|
|
156
|
+
"class": "countdown-prefix"
|
|
157
|
+
}, [props.prefix]), createVNode("span", {
|
|
158
|
+
"class": "countdown-value"
|
|
159
|
+
}, [timeStr.value]), createVNode("span", {
|
|
160
|
+
"class": "countdown-suffix"
|
|
161
|
+
}, [props.suffix])])]);
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
Countdown.install = function(app) {
|
|
166
|
+
app.component(Countdown.name, Countdown);
|
|
167
|
+
};
|
|
168
|
+
var index = {
|
|
169
|
+
title: "Countdown \u5012\u8BA1\u65F6",
|
|
170
|
+
category: "\u6570\u636E\u5C55\u793A",
|
|
171
|
+
status: "100%",
|
|
172
|
+
install(app) {
|
|
173
|
+
app.use(Countdown);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
export { Countdown, index as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(r,a){typeof exports=="object"&&typeof module!="undefined"?a(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],a):(r=typeof globalThis!="undefined"?globalThis:r||self,a(r.index={},r.Vue))})(this,function(r,a){"use strict";const w={value:{type:Number,required:!0},format:{type:String,default:"HH:mm:ss"},prefix:{type:String,default:""},suffix:{type:String,default:""},valueStyle:{type:Object,default:()=>({})}};var T="";const M=e=>{const t=new Map([["Y",0],["M",0],["D",0],["H",0],["m",0],["s",0],["S",0]]),n=Math.floor(e/(365*24*60*60*1e3)),s=Math.floor(e/(30*24*60*60*1e3)%12),o=Math.floor(e/(24*60*60*1e3)%30),u=Math.floor(e/(60*60*1e3)%24),h=Math.floor(e/(60*1e3)%60),f=Math.floor(e/1e3%60),S=e%1e3;return t.set("Y",n),t.set("M",s),t.set("D",o),t.set("H",u),t.set("m",h),t.set("s",f),t.set("S",S),t},p=(e,t)=>{const n=new Map([["Y",0],["M",0],["D",0],["H",0],["m",0],["s",0],["S",0]]),s=new Map([["Y",12],["M",30],["D",24],["H",60],["m",60],["s",1e3],["S",1]]);let o=0;for(const u of n.keys())e.has(u)?(n.set(u,t.get(u)+o),o=0):o+=t.get(u)*s.get(u);return!e.has("S")&&t.get("S")>500&&n.set("s",n.get("s")+1),n},y=e=>{const t=new Set(["Y","M","D","H","m","s","S"]),n=[];for(let s=0;s<e.length;s++){const o=e[s];n.length===0||n[n.length-1].k!==o||!t.has(o)?n.push({k:o,n:1}):n[n.length-1].n++}return n},v=e=>{const t=new Set(["Y","M","D","H","m","s","S"]),n=new Set;for(let s=0;s<e.length;s++){const o=e[s];t.has(o)&&n.add(o)}return n},D=(e,t)=>{const n=10**t-1;if(e>=n)return e;{const s=t-e.toString().length;let o="";for(let u=0;u<s;u++)o+="0";return o+e}};var l=a.defineComponent({name:"DCountdown",props:w,emits:["onChange","onFinish"],setup(e,t){const n=a.ref(),s=v(e.format),o=y(e.format),u=a.ref(""),h=c=>{const i=new Set(["Y","M","D","H","m","s","S"]),m=o.reduce((d,g)=>i.has(g.k)?d+D(c.get(g.k),g.n):d+g.k,"");u.value=m},f=()=>{const c=new Date(e.value).getTime(),i=c>new Date().getTime()?c-new Date().getTime():0,m=M(i),d=p(s,m);return!t.slots.default&&h(d),t.emit("onChange",{leftTime:i,formatTime:m,legalTime:d}),i},S=()=>{f(),!n.value&&(n.value=setInterval(()=>{f()===0&&(t.emit("onFinish"),clearInterval(n.value))},s.has("S")?100:1e3))};return a.onMounted(()=>{S()}),a.onUnmounted(()=>{clearInterval(n.value)}),()=>a.createVNode("div",{class:"devui-countdown"},[t.slots.default?t.slots.default():a.createVNode("div",{class:"countdown-content",style:e.valueStyle},[a.createVNode("span",{class:"countdown-prefix"},[e.prefix]),a.createVNode("span",{class:"countdown-value"},[u.value]),a.createVNode("span",{class:"countdown-suffix"},[e.suffix])])])}});l.install=function(e){e.component(l.name,l)};var H={title:"Countdown \u5012\u8BA1\u65F6",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(e){e.use(l)}};r.Countdown=l,r.default=H,Object.defineProperty(r,"__esModule",{value:!0}),r[Symbol.toStringTag]="Module"});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.devui-countdown .countdown-content{font-size:24px;color:var(--devui-text, #252b3a)}.devui-countdown .countdown-content span{display:inline-block}.devui-countdown .countdown-content .countdown-prefix{margin-right:4px}.devui-countdown .countdown-content .countdown-suffix{margin-left:4px}
|
package/date-picker/index.es.js
CHANGED
|
@@ -304,18 +304,17 @@ var Input = defineComponent({
|
|
|
304
304
|
return {
|
|
305
305
|
error: props.error,
|
|
306
306
|
[props.cssClass]: true,
|
|
307
|
+
"devui-input-restore": showPwdIcon.value,
|
|
307
308
|
[sizeCls.value]: props.size !== ""
|
|
308
309
|
};
|
|
309
310
|
});
|
|
310
311
|
const showPreviewIcon = computed(() => inputType.value === "password");
|
|
311
312
|
watch(() => props.showPassword, (flg) => {
|
|
312
313
|
inputType.value = flg ? "password" : "text";
|
|
314
|
+
showPwdIcon.value = props.showPassword;
|
|
313
315
|
}, {
|
|
314
316
|
immediate: true
|
|
315
317
|
});
|
|
316
|
-
watch(() => props.modelValue, (value) => {
|
|
317
|
-
value && value.length > 0 && showPreviewIcon.value ? showPwdIcon.value = true : showPwdIcon.value = false;
|
|
318
|
-
});
|
|
319
318
|
const onInput = ($event) => {
|
|
320
319
|
ctx.emit("update:modelValue", $event.target.value);
|
|
321
320
|
hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.input);
|
|
@@ -383,11 +382,11 @@ var Input = defineComponent({
|
|
|
383
382
|
"class": "devui-input__preview",
|
|
384
383
|
"onClick": onChangeInputType
|
|
385
384
|
}, [showPreviewIcon ? createVNode(resolveComponent("d-icon"), {
|
|
386
|
-
"name": "preview",
|
|
385
|
+
"name": "preview-forbidden",
|
|
387
386
|
"size": "12px",
|
|
388
387
|
"key": 1
|
|
389
388
|
}, null) : createVNode(resolveComponent("d-icon"), {
|
|
390
|
-
"name": "preview
|
|
389
|
+
"name": "preview",
|
|
391
390
|
"size": "12px",
|
|
392
391
|
"key": 2
|
|
393
392
|
}, null)])]);
|
|
@@ -430,7 +429,8 @@ var Icon = defineComponent({
|
|
|
430
429
|
"src": name,
|
|
431
430
|
"alt": name.split("/")[name.split("/").length - 1],
|
|
432
431
|
"style": {
|
|
433
|
-
width: size
|
|
432
|
+
width: size,
|
|
433
|
+
verticalAlign: "text-bottom"
|
|
434
434
|
}
|
|
435
435
|
}, null) : createVNode("i", {
|
|
436
436
|
"class": `${classPrefix} ${classPrefix}-${name}`,
|
|
@@ -615,8 +615,7 @@ const Item = (props) => {
|
|
|
615
615
|
disabled = false,
|
|
616
616
|
rotate = 0,
|
|
617
617
|
date,
|
|
618
|
-
pos
|
|
619
|
-
cb
|
|
618
|
+
pos
|
|
620
619
|
} = props;
|
|
621
620
|
const color = disabled ? "#cfd0d3" : "#585d6b";
|
|
622
621
|
const className = `${disabled ? "disabled" : ""}`;
|
|
@@ -1017,7 +1016,7 @@ var DatePicker = defineComponent({
|
|
|
1017
1016
|
type: String
|
|
1018
1017
|
}
|
|
1019
1018
|
},
|
|
1020
|
-
setup(props
|
|
1019
|
+
setup(props) {
|
|
1021
1020
|
const panel = ref(null);
|
|
1022
1021
|
const input2 = ref(null);
|
|
1023
1022
|
const current = parseDate(props.dateMin) || new Date();
|
|
@@ -1053,7 +1052,7 @@ var DatePicker = defineComponent({
|
|
|
1053
1052
|
}, [createVNode(Input, {
|
|
1054
1053
|
"ref": input2,
|
|
1055
1054
|
"class": "datepicker-input",
|
|
1056
|
-
"
|
|
1055
|
+
"modelValue": state.value,
|
|
1057
1056
|
"placeholder": state.placeholder,
|
|
1058
1057
|
"onFocus": () => state.show = true
|
|
1059
1058
|
}, null), createVNode(Icon, {
|
|
@@ -1077,7 +1076,7 @@ var DatePicker = defineComponent({
|
|
|
1077
1076
|
state.end = state.hover = void 0;
|
|
1078
1077
|
state.start = date;
|
|
1079
1078
|
},
|
|
1080
|
-
"onChange": (
|
|
1079
|
+
"onChange": () => {
|
|
1081
1080
|
state.value = formatValue(state, props);
|
|
1082
1081
|
state.placeholder = formatPlaceholder(props);
|
|
1083
1082
|
invokeFunction(props.selectedDateChange, state.value);
|
|
@@ -1119,7 +1118,7 @@ var index$1 = "";
|
|
|
1119
1118
|
const StickSlider = defineComponent({
|
|
1120
1119
|
name: "DStickSlider",
|
|
1121
1120
|
props: {},
|
|
1122
|
-
setup(
|
|
1121
|
+
setup() {
|
|
1123
1122
|
const state = reactive({
|
|
1124
1123
|
showButtons: false,
|
|
1125
1124
|
selectedIndex: 0
|
package/date-picker/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var Me=Object.defineProperty;var Z=Object.getOwnPropertySymbols;var Ne=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable;var J=(m,a,h)=>a in m?Me(m,a,{enumerable:!0,configurable:!0,writable:!0,value:h}):m[a]=h,Q=(m,a)=>{for(var h in a||(a={}))Ne.call(a,h)&&J(m,h,a[h]);if(Z)for(var h of Z(a))De.call(a,h)&&J(m,h,a[h]);return m};(function(m,a){typeof exports=="object"&&typeof module!="undefined"?a(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],a):(m=typeof globalThis!="undefined"?globalThis:m||self,a(m.index={},m.Vue))})(this,function(m,a){"use strict";const h=e=>{const n=e.getFullYear(),t=e.getMonth()+1,o=e.getDate(),l=e.getDay(),c=e.getHours(),r=e.getMinutes(),i=e.getSeconds(),s=e.getMilliseconds();return[n,t,o,l,c,r,i,s]},b=(e,n,t=2,o="0")=>(e+"").padStart(Math.min(n.length,t),o),k=(e,n)=>{const t=h(n);let o=e;return o=o.replace(/y+/g,l=>{const c=t[0]+"";return l.length===2?c.substring(2):c}),o=o.replace(/M+/g,l=>b(t[1],l)),o=o.replace(/d+/g,l=>b(t[2],l)),o=o.replace(/h+/g,l=>b(t[4],l)),o=o.replace(/m+/g,l=>b(t[5],l)),o=o.replace(/s+/g,l=>b(t[6],l)),o},ee=(e,n,t,o="-")=>{const l=[n,t];return n.getTime()>t.getTime()&&l.reverse(),`${k(e,l[0])} ${o} ${k(e,l[1])}`},O=(e,n)=>{if(!n)return!1;for(;e;){if(e===n)return!0;e=e.parentNode}return!1},j=(e,...n)=>{typeof e=="function"&&e(...n)},te=e=>{const n=e.getFullYear(),t=e.getMonth()+1,o=e.getDate(),l=e.getDay(),c=e.getHours(),r=e.getMinutes(),i=e.getSeconds(),s=e.getMilliseconds();return{year:n,y:n,month:t,M:t,date:o,d:o,day:l,hour:c,H:c,h:c,minute:r,m:r,second:i,s:i,ms:s}},ne=(e,n)=>{const t=new Date(e,n-1,1),o=new Date(e,n,0),l=[];let c=t.getDay();for(;c>0;)c-=1,l.push({date:new Date(e,n-1,-c),current:-1});c=o.getDate()-t.getDate();for(let i=0;i<=c;i++){const s=new Date(t);s.setDate(i+1),l.push({date:s,current:0})}c=o.getDay();let r=o;for(let i=c;i<6;i++)r=new Date(e,n,i-c+1),l.push({date:r,current:1});if(l.length<42){c=r.getDate();for(let i=1;i<=7;i++)r=new Date(e,n,c+i),l.push({date:r,current:1})}return l},ae=(e=new Date)=>{e instanceof Date||(e=new Date);const{year:n,month:t}=te(e),o=ne(n,t),l=[];for(;o.length>0;)l.push(o.splice(0,7));return l},oe=["\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"],x=(e,...n)=>{typeof e=="function"&&e(...n)},re=(e,n)=>{const t=e.getFullYear()*12+e.getMonth(),o=n.getFullYear()*12+n.getMonth();return t-o},U=1e3*60*60*24,E=(e,n)=>{const t=new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),o=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime();return(t-o)/U},y=(e,n,t,o)=>!e||!n?!0:t==="year"?n.getFullYear()-e.getFullYear()>o:re(n,e)>o,v=e=>{if(!e||typeof e!="string")return null;const[n="",t=""]=e.split(/([ ]|T)+/);if(!n)return null;const[o,l,c]=n.split(/[^\d]+/),r=N(o),i=N(l),s=N(c)||1;if(!r||!i)return null;const f=le(t);return new Date(r,i-1,s,...f)},N=(e,n)=>{if(!e||typeof e!="string")return n;const t=parseInt(e);return isNaN(t)?n:t},le=e=>{const[n,t,o,l]=e.split(/[\:\.]+/);return[N(n,0),N(t,0),N(o,0),N(l,0)]},S=(e,n,t="d")=>{const o=X(e,t),l=X(n,t);return o<l?-1:o>l?1:0},X=(e,n)=>{switch(n){case"y":return e.getFullYear();case"m":return e.getFullYear()*12+e.getMonth()}return e.getTime()/U>>0},B=(e,n,t)=>!(n instanceof Date&&S(n,e,"d")>0||t instanceof Date&&S(e,t,"d")>0),ce={placeholder:{type:String,default:void 0},disabled:{type:Boolean,default:!1},autoFocus:{type:Boolean,default:!1},maxLength:{type:Number,default:Number.MAX_SAFE_INTEGER},cssClass:{type:String,default:""},error:{type:Boolean,default:!1},size:{type:String,default:""},showPassword:{type:Boolean,default:!1},modelValue:{type:String,default:""},"update: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 xe="";const se=Symbol("dFormItem"),_={blur:"d.form.blur",change:"d.form.change",input:"d.form.input"};var F=a.defineComponent({name:"DInput",directives:{focus:{mounted:function(e,n){n.value&&e.focus()}}},props:ce,emits:["update:modelValue","focus","blur","change","keydown"],setup(e,n){const t=a.inject(se,{}),o=Object.keys(t).length>0,l=a.computed(()=>`devui-input-${e.size}`),c=a.ref(!1),r=a.ref("text"),i=a.computed(()=>({error:e.error,[e.cssClass]:!0,[l.value]:e.size!==""})),s=a.computed(()=>r.value==="password");return a.watch(()=>e.showPassword,w=>{r.value=w?"password":"text"},{immediate:!0}),a.watch(()=>e.modelValue,w=>{w&&w.length>0&&s.value?c.value=!0:c.value=!1}),{inputCls:i,inputType:r,showPreviewIcon:s,showPwdIcon:c,onInput:w=>{n.emit("update:modelValue",w.target.value),o&&t.formItemMitt.emit(_.input)},onFocus:()=>{n.emit("focus")},onBlur:()=>{n.emit("blur"),o&&t.formItemMitt.emit(_.blur)},onChange:w=>{n.emit("change",w.target.value),o&&t.formItemMitt.emit(_.change)},onKeydown:w=>{n.emit("keydown",w)},onChangeInputType:()=>{r.value=r.value==="password"?"text":"password"}}},render(){const{modelValue:e,showPreviewIcon:n,showPwdIcon:t,inputCls:o,inputType:l,maxLength:c,autoFocus:r,placeholder:i,disabled:s,onInput:f,onFocus:D,onBlur:u,onChange:M,onKeydown:p,onChangeInputType:d}=this;return a.createVNode("div",{class:"devui-input__wrap"},[a.withDirectives(a.createVNode("input",a.mergeProps({dinput:!0},{value:e,disabled:s,type:l,maxlength:c,placeholder:i,class:o,onInput:f,onFocus:D,onBlur:u,onChange:M,onKeydown:p}),null),[[a.resolveDirective("focus"),r]]),t&&a.createVNode("div",{class:"devui-input__preview",onClick:d},[n?a.createVNode(a.resolveComponent("d-icon"),{name:"preview",size:"12px",key:1},null):a.createVNode(a.resolveComponent("d-icon"),{name:"preview-forbidden",size:"12px",key:2},null)])])}});F.install=function(e){e.component(F.name,F)};var $=a.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(e){return Q({},e)},render(){const{name:e,size:n,color:t,classPrefix:o}=this;return/^((https?):)?\/\//.test(e)?a.createVNode("img",{src:e,alt:e.split("/")[e.split("/").length-1],style:{width:n}},null):a.createVNode("i",{class:`${o} ${o}-${e}`,style:{fontSize:n,color:t}},null)}});$.install=function(e){e.component($.name,$)};const P=(e,n,t,o)=>{switch(n){case 0:const l=new Date(o);l.setFullYear(l.getFullYear()-1),t===0?e.current=l:e.next=l;break;case 1:const c=new Date(o);c.setMonth(c.getMonth()-1),t===0?e.current=c:e.next=c;break;case 2:const r=new Date(o);r.setMonth(r.getMonth()+1),t===0?e.current=r:e.next=r;break;case 3:const i=new Date(o);i.setFullYear(i.getFullYear()+1),t===0?e.current=i:e.next=i;break}},z=(e,n)=>{const{format:t="y/MM/dd",range:o,rangeSpliter:l="-"}=n||{};if(o){if(e.start){if(!e.end)return k(t,e.start)}else return"";if(e.end<e.start){const c=e.end;e.end=e.start,e.start=c}return ee(t,e.start,e.end,l)}else return e.start?k(t,e.start):""},T=e=>{if(!e)return"";const n=e.format||"y/MM/dd",t=e.rangeSpliter||"-";return e.range?`${n} ${t} ${n}`:n},V=e=>e.toDateString(),ie=(e,n,t="cell")=>{if(B(n.date,e.dateMin,e.dateMax)){if(n.current!==0)return`${t} not-current`}else return`${t} disabled`;const o=V(n.date);if(e.type==="range"){if(e.dateStart){if(V(e.dateStart)===o)return`${t} selected`;if(e.dateEnd&&V(e.dateEnd)===o)return`${t} selected`;const l=e.dateEnd||e.dateHover;if(l){const c=l>e.dateStart?[e.dateStart,l]:[l,e.dateStart];if(n.date>c[0]&&n.date<c[1])return`${t} innerday`}}return t}else return e.dateStart&&V(e.dateStart)===o?`${t} selected`:t},de=(e,n)=>{!B(n.date,e.dateMin,e.dateMax)||(e.type==="range"?e.dateStart?e.dateEnd?x(e.onReset,n.date):E(e.dateStart,n.date)!==0&&(x(e.onSelectEnd,n.date),typeof e.onChange=="function"&&e.onChange(e.type,e)):x(e.onSelectStart,n.date):(x(e.onSelected,n.date),typeof e.onChange=="function"&&e.onChange(e.type,e)))},ue=(e,n)=>{if(n.current!==0)return;const{dateMin:t,dateMax:o}=e;if(!(t&&E(n.date,t)<0)&&!(o&&E(o,n.date)<0)&&e.type==="range"){const l=V(n.date);if(!e.dateStart||V(e.dateStart)===l||e.dateEnd)return;x(e.onSelecting,n.date)}},q=e=>{const{color:n="#585d6b",rotate:t=0}=e;return a.createVNode("svg",{style:{transform:`rotate(${t}deg)`},width:"10px",height:"10px",viewBox:"0 0 10 10",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},[a.createVNode("g",{fill:n,transform:"translate(-1.000000, -1.000000)"},[a.createVNode("path",{d:"M11,1.83333333 L11,10.1666667 L7,7.38833333 L7,10.1666667 L1,6 L7,1.83333333 L7,4.61033333 L11,1.83333333 Z"},null)])])},W=e=>{const{color:n="#585d6b",rotate:t=0}=e;return a.createVNode("svg",{style:{transform:`rotate(${t}deg)`},width:"6px",height:"10px",viewBox:"0 0 6 10",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},[a.createVNode("g",{fill:n,transform:"translate(-3.000000, -1.000000)"},[a.createVNode("polygon",{points:"6 3 10.1666667 9 1.83333333 9"},null)])])};var Se="";const Y=e=>{const{button:n,disabled:t=!1,rotate:o=0,date:l,pos:c,cb:r}=e,i=t?"#cfd0d3":"#585d6b",s=`${t?"disabled":""}`,f=t?void 0:()=>x(e.cb,l,c);return a.createVNode("a",{class:s,onClick:f},[a.createVNode(n,{color:i,rotate:o},null)])},fe=e=>{const{date:n}=e;return a.createVNode("a",{class:"title"},[`${n.getFullYear()}\u5E74${(n.getMonth()+1+"").padStart(2,"0")}\u6708`])},me=e=>{const{type:n,current:t,compare:o,pos:l,dateMax:c,dateMin:r,onPreviousYear:i,onPreviousMonth:s,onNextMonth:f,onNextYear:D}=e,u=[!1,!1,!1,!1];return n==="range"?l===1?(u[0]=!y(o,t,"year",1),u[1]=!y(o,t,"month",1),u[2]=!y(t,c,"month",0),u[3]=!y(t,c,"year",0)):(u[0]=!y(r,t,"year",0),u[1]=!y(r,t,"month",0),u[2]=!y(t,o,"month",1),u[3]=!y(t,o,"year",1)):(u[0]=!y(r,t,"year",0),u[1]=!y(r,t,"month",0),u[2]=!y(t,c,"month",0),u[3]=!y(t,c,"year",0)),a.createVNode("div",{class:"devui-calendar-toolbar"},[a.createVNode(Y,{disabled:u[0],date:t,pos:l,button:q,cb:i},null),a.createVNode(Y,{disabled:u[1],date:t,pos:l,button:W,rotate:-90,cb:s},null),a.createVNode(fe,{date:t},null),a.createVNode(Y,{disabled:u[2],date:t,pos:l,button:W,rotate:90,cb:f},null),a.createVNode(Y,{disabled:u[3],date:t,pos:l,button:q,rotate:180,cb:D},null)])},ge=e=>{const{onSelected:n=()=>0,disabled:t=!1}=e;return a.createVNode("div",{class:`today-container ${t?"disabled":""}`},[a.createVNode("button",{class:"today-button",disabled:t,onClick:t?void 0:()=>n(new Date)},[a.createTextVNode("\u4ECA\u5929")])])};var Ve="";const L=e=>{const n=new Date;return a.createVNode("div",{class:"devui-calendar-panel"},[a.createVNode(me,{current:e.current,compare:e.compare,pos:e.pos,type:e.type,showTime:e.showTime,onPreviousYear:e.onPreviousYear,onPreviousMonth:e.onPreviousMonth,onNextMonth:e.onNextMonth,onNextYear:e.onNextYear,dateMax:e.dateMax,dateMin:e.dateMin},null),a.createVNode("ol",{class:"head row"},[oe.map(t=>a.createVNode("li",{class:"cell"},[t]))]),a.createVNode("ul",{class:"body"},[ae(e.current).map(t=>a.createVNode("li",{class:"row"},[t.map(o=>a.createVNode("span",{class:ie(e,o),onClick:()=>de(e,o),onMouseenter:()=>ue(e,o)},[o.date.getDate()]))]))]),e.type!=="range"?a.createVNode(ge,{disabled:!B(n,e.dateMin,e.dateMax),onSelected:t=>{typeof e.onToday=="function"&&e.onToday(t,0)}},null):null])};var Ce="";const A=a.defineComponent({props:{size:{type:Number,default:26},items:{type:Array},selectedIndex:{type:Number},className:{type:String},itemClassNormal:{type:String},itemClassSelected:{type:String},onChange:{type:Function}},setup(e){const{items:n=[0,1,2,3,4,5,6,7,8,9],selectedIndex:t=0,size:o=26,className:l="",itemClassNormal:c="",itemClassSelected:r="selected",onChange:i}=e||{};let s=0,f=0;const D=a.ref(),u=a.ref();let M=null,p=null;const d=a.reactive({selectedIndex:t,barOpacity:0,x:0,y:0,transition:"none"}),w=g=>{g.stopPropagation(),g.preventDefault(),M=[g.clientX,g.clientY],d.transition="none"},pe=g=>{g.stopPropagation(),g.preventDefault(),!(!M||!p)&&(d.x=p[0]+g.clientX-M[0],d.y=Math.min(s,Math.max(f,p[1]+g.clientY-M[1])),d.selectedIndex=(s-d.y+o/2)/o>>0)},G=g=>{if(g.stopPropagation(),g.preventDefault(),M=null,d.y=s-d.selectedIndex*o,d.transition="transform 0.1s",p[0]=d.x,p[1]=d.y,typeof i=="function"){const C=d.selectedIndex,R=n[C];i(R,C)}};return a.onMounted(()=>{const{height:g}=D.value.getBoundingClientRect(),{height:C}=u.value.getBoundingClientRect();s=(g-o)/2,f=(g+o)/2-C,p=[0,s-d.selectedIndex*o],d.x=p[0],d.y=p[1],d.barOpacity=1,d.transition="transform 0.1s"}),()=>a.createVNode("div",{ref:D,class:`devui-vertical-slider ${l}`},[a.createVNode("div",{ref:u,class:"movable-bar",style:{opacity:d.barOpacity,transform:`translateY(${d.y}px)`,transition:d.transition}},[n.map((g,C)=>{const R=C===d.selectedIndex?r:c;return a.createVNode("span",{class:`slider-item ${R}`,style:{height:`${o}px`,lineHeight:`${o}px`}},[g])})]),a.createVNode("div",{class:"slider-mask",onMousedown:w,onMousemove:pe,onMouseup:G,onMouseout:G},null)])}});var be="";const H=a.defineComponent({props:{time:{type:Date}},setup(e){const{time:n=new Date}=e||{},t=a.reactive({hour:n.getHours(),minute:n.getMinutes(),second:n.getSeconds()}),o=Array(24).fill(0).map((c,r)=>`${r}`.padStart(2,"0")),l=Array(60).fill(0).map((c,r)=>`${r}`.padStart(2,"0"));return()=>a.createVNode("div",{class:"devui-calendar-timepicker"},[a.createVNode("div",{class:"head"},[a.createVNode("div",{class:"chars"},[a.createVNode("span",null,[t.hour.toString().padStart(2,"0"),a.createTextVNode(":"),t.minute.toString().padStart(2,"0"),a.createTextVNode(":"),t.second.toString().padStart(2,"0")])])]),a.createVNode("div",{class:"select"},[a.createVNode(A,{items:o,selectedIndex:t.hour,onChange:(c,r)=>t.hour=r},null),a.createVNode(A,{items:l,selectedIndex:t.minute,onChange:(c,r)=>t.minute=r},null),a.createVNode(A,{items:l,selectedIndex:t.second,onChange:(c,r)=>t.second=r},null)])])}});var Ie="";const he=e=>{const{showTime:n=!1}=e;let{current:t}=e;if(t instanceof Date||(t=new Date),e.type==="range"){let{next:o}=e;return o instanceof Date||(o=new Date(t.getFullYear(),t.getMonth()+1,1)),a.createVNode("div",{class:"devui-calendar-container"},[a.createVNode(L,a.mergeProps(e,{pos:0,current:t,compare:o}),null),n?a.createVNode(H,{time:t},null):null,a.createVNode(L,a.mergeProps(e,{pos:1,current:o,compare:t}),null),n?a.createVNode(H,{time:o},null):null])}else return a.createVNode("div",{class:"devui-calendar-container"},[a.createVNode(L,a.mergeProps(e,{pos:0,current:t}),null),n?a.createVNode(H,{time:t},null):null])};var ke="";const ye=e=>{const[n,t]=[e.start,e.end].sort((o,l)=>o.getTime()-l.getTime());e.start=n,e.end=t,S(n,t,"m")!==0?(e.current=n,e.next=t):(S(n,e.current)<0&&(e.current=n),S(e.next,t)<0&&(e.next=t))};var I=a.defineComponent({name:"DDatepicker",props:{selectedDateChange:{type:Function},autoClose:{type:Boolean,default:!1},range:{type:Boolean,default:!1},showTime:{type:Boolean,default:!1},format:{type:String,default:"y/MM/dd"},rangeSpliter:{type:String,default:"-"},attachInputDom:{type:String},dateMin:{type:String},dateMax:{type:String}},setup(e,n){const t=a.ref(null),o=a.ref(null),l=v(e.dateMin)||new Date,c=new Date(l.getFullYear(),l.getMonth()+1,1),r=a.reactive({show:!1,value:"",placeholder:T(e),current:l,next:c});r.value=z(r,e),r.placeholder=T(e);const i=s=>{s.stopPropagation(),!(O(s.target,t.value)||O(s.target,o.value))&&(r.show=!1)};return a.onMounted(()=>{document.addEventListener("click",i)}),a.onUnmounted(()=>{document.removeEventListener("click",i)}),()=>a.createVNode("div",{class:"devui-datepicker-container"},[a.createVNode("div",{class:"input-container",ref:o},[a.createVNode(F,{ref:o,class:"datepicker-input",value:r.value,placeholder:r.placeholder,onFocus:()=>r.show=!0},null),a.createVNode($,{size:"small",name:"calendar",class:"datepicker-input-icon"},null)]),a.createVNode("div",{class:"devui-datepicker-panel",ref:t},[r.show?a.createVNode(he,{type:e.range?"range":"select",showTime:e.showTime,current:r.current,next:r.next,dateMin:v(e.dateMin),dateMax:v(e.dateMax),dateStart:r.start,dateEnd:r.end,dateHover:r.hover,onReset:s=>{r.end=r.hover=void 0,r.start=s},onChange:(s,f)=>{r.value=z(r,e),r.placeholder=T(e),j(e.selectedDateChange,r.value),e.autoClose&&(r.show=!1)},onToday:s=>{r.current=s,r.start=s,r.value=z(r,e),r.placeholder=T(e),j(e.selectedDateChange,r.value),e.autoClose&&(r.show=!1)},onSelected:s=>{r.start=s,S(r.current,s)!==0&&(r.current=s)},onSelectStart:s=>r.start=s,onSelectEnd:s=>{r.end=s,ye(r)},onSelecting:s=>r.hover=s,onPreviousYear:(s,f)=>P(r,0,f,s),onPreviousMonth:(s,f)=>P(r,1,f,s),onNextMonth:(s,f)=>P(r,2,f,s),onNextYear:(s,f)=>P(r,3,f,s)},null):null])])}}),Fe="";const K=a.defineComponent({name:"DStickSlider",props:{},setup(e){const n=a.reactive({showButtons:!1,selectedIndex:0}),t=()=>{n.showButtons=!1},o=c=>{c.stopPropagation(),n.showButtons=!0},l=c=>{c.stopPropagation(),t()};return()=>a.createVNode("div",{class:"devui-stick-slider",onMousedown:o,onMouseup:l,onMouseleave:l},[a.createVNode("div",{class:"sub-buttons",style:{display:n.showButtons?"":"none"}},[Array(16).fill(null).map((c,r)=>a.createVNode("div",{class:`button ${r===n.selectedIndex?"selected":""}`,onMouseenter:()=>n.selectedIndex=r},[r]))]),a.createVNode("div",{class:"main-button"},null)])}});I.install=function(e){e.component(I.name,I),e.component(K.name,K)};var we={title:"DatePicker \u65E5\u671F\u9009\u62E9\u5668",category:"\u6570\u636E\u5F55\u5165",status:"50%",install(e){e.use(I)}};m.DatePicker=I,m.StickSlider=K,m.default=we,Object.defineProperty(m,"__esModule",{value:!0}),m[Symbol.toStringTag]="Module"});
|
|
1
|
+
var Me=Object.defineProperty;var G=Object.getOwnPropertySymbols;var Ne=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable;var Z=(f,a,g)=>a in f?Me(f,a,{enumerable:!0,configurable:!0,writable:!0,value:g}):f[a]=g,J=(f,a)=>{for(var g in a||(a={}))Ne.call(a,g)&&Z(f,g,a[g]);if(G)for(var g of G(a))pe.call(a,g)&&Z(f,g,a[g]);return f};(function(f,a){typeof exports=="object"&&typeof module!="undefined"?a(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],a):(f=typeof globalThis!="undefined"?globalThis:f||self,a(f.index={},f.Vue))})(this,function(f,a){"use strict";const g=e=>{const n=e.getFullYear(),t=e.getMonth()+1,o=e.getDate(),l=e.getDay(),r=e.getHours(),c=e.getMinutes(),s=e.getSeconds(),i=e.getMilliseconds();return[n,t,o,l,r,c,s,i]},b=(e,n,t=2,o="0")=>(e+"").padStart(Math.min(n.length,t),o),k=(e,n)=>{const t=g(n);let o=e;return o=o.replace(/y+/g,l=>{const r=t[0]+"";return l.length===2?r.substring(2):r}),o=o.replace(/M+/g,l=>b(t[1],l)),o=o.replace(/d+/g,l=>b(t[2],l)),o=o.replace(/h+/g,l=>b(t[4],l)),o=o.replace(/m+/g,l=>b(t[5],l)),o=o.replace(/s+/g,l=>b(t[6],l)),o},Q=(e,n,t,o="-")=>{const l=[n,t];return n.getTime()>t.getTime()&&l.reverse(),`${k(e,l[0])} ${o} ${k(e,l[1])}`},R=(e,n)=>{if(!n)return!1;for(;e;){if(e===n)return!0;e=e.parentNode}return!1},j=(e,...n)=>{typeof e=="function"&&e(...n)},ee=e=>{const n=e.getFullYear(),t=e.getMonth()+1,o=e.getDate(),l=e.getDay(),r=e.getHours(),c=e.getMinutes(),s=e.getSeconds(),i=e.getMilliseconds();return{year:n,y:n,month:t,M:t,date:o,d:o,day:l,hour:r,H:r,h:r,minute:c,m:c,second:s,s,ms:i}},te=(e,n)=>{const t=new Date(e,n-1,1),o=new Date(e,n,0),l=[];let r=t.getDay();for(;r>0;)r-=1,l.push({date:new Date(e,n-1,-r),current:-1});r=o.getDate()-t.getDate();for(let s=0;s<=r;s++){const i=new Date(t);i.setDate(s+1),l.push({date:i,current:0})}r=o.getDay();let c=o;for(let s=r;s<6;s++)c=new Date(e,n,s-r+1),l.push({date:c,current:1});if(l.length<42){r=c.getDate();for(let s=1;s<=7;s++)c=new Date(e,n,r+s),l.push({date:c,current:1})}return l},ne=(e=new Date)=>{e instanceof Date||(e=new Date);const{year:n,month:t}=ee(e),o=te(n,t),l=[];for(;o.length>0;)l.push(o.splice(0,7));return l},ae=["\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"],x=(e,...n)=>{typeof e=="function"&&e(...n)},oe=(e,n)=>{const t=e.getFullYear()*12+e.getMonth(),o=n.getFullYear()*12+n.getMonth();return t-o},E=(e,n)=>{const t=new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),o=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime();return(t-o)/864e5},h=(e,n,t,o)=>!e||!n?!0:t==="year"?n.getFullYear()-e.getFullYear()>o:oe(n,e)>o,v=e=>{if(!e||typeof e!="string")return null;const[n="",t=""]=e.split(/([ ]|T)+/);if(!n)return null;const[o,l,r]=n.split(/[^\d]+/),c=p(o),s=p(l),i=p(r)||1;if(!c||!s)return null;const w=re(t);return new Date(c,s-1,i,...w)},p=(e,n)=>{if(!e||typeof e!="string")return n;const t=parseInt(e);return isNaN(t)?n:t},re=e=>{const[n,t,o,l]=e.split(/[\:\.]+/);return[p(n,0),p(t,0),p(o,0),p(l,0)]},S=(e,n,t="d")=>{const o=U(e,t),l=U(n,t);return o<l?-1:o>l?1:0},U=(e,n)=>{switch(n){case"y":return e.getFullYear();case"m":return e.getFullYear()*12+e.getMonth()}return e.getTime()/864e5>>0},B=(e,n,t)=>!(n instanceof Date&&S(n,e,"d")>0||t instanceof Date&&S(e,t,"d")>0),le={placeholder:{type:String,default:void 0},disabled:{type:Boolean,default:!1},autoFocus:{type:Boolean,default:!1},maxLength:{type:Number,default:Number.MAX_SAFE_INTEGER},cssClass:{type:String,default:""},error:{type:Boolean,default:!1},size:{type:String,default:""},showPassword:{type:Boolean,default:!1},modelValue:{type:String,default:""},"update: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 xe="";const se=Symbol("dFormItem"),_={blur:"d.form.blur",change:"d.form.change",input:"d.form.input"};var F=a.defineComponent({name:"DInput",directives:{focus:{mounted:function(e,n){n.value&&e.focus()}}},props:le,emits:["update:modelValue","focus","blur","change","keydown"],setup(e,n){const t=a.inject(se,{}),o=Object.keys(t).length>0,l=a.computed(()=>`devui-input-${e.size}`),r=a.ref(!1),c=a.ref("text"),s=a.computed(()=>({error:e.error,[e.cssClass]:!0,"devui-input-restore":r.value,[l.value]:e.size!==""})),i=a.computed(()=>c.value==="password");return a.watch(()=>e.showPassword,M=>{c.value=M?"password":"text",r.value=e.showPassword},{immediate:!0}),{inputCls:s,inputType:c,showPreviewIcon:i,showPwdIcon:r,onInput:M=>{n.emit("update:modelValue",M.target.value),o&&t.formItemMitt.emit(_.input)},onFocus:()=>{n.emit("focus")},onBlur:()=>{n.emit("blur"),o&&t.formItemMitt.emit(_.blur)},onChange:M=>{n.emit("change",M.target.value),o&&t.formItemMitt.emit(_.change)},onKeydown:M=>{n.emit("keydown",M)},onChangeInputType:()=>{c.value=c.value==="password"?"text":"password"}}},render(){const{modelValue:e,showPreviewIcon:n,showPwdIcon:t,inputCls:o,inputType:l,maxLength:r,autoFocus:c,placeholder:s,disabled:i,onInput:w,onFocus:D,onBlur:u,onChange:N,onKeydown:y,onChangeInputType:d}=this;return a.createVNode("div",{class:"devui-input__wrap"},[a.withDirectives(a.createVNode("input",a.mergeProps({dinput:!0},{value:e,disabled:i,type:l,maxlength:r,placeholder:s,class:o,onInput:w,onFocus:D,onBlur:u,onChange:N,onKeydown:y}),null),[[a.resolveDirective("focus"),c]]),t&&a.createVNode("div",{class:"devui-input__preview",onClick:d},[n?a.createVNode(a.resolveComponent("d-icon"),{name:"preview-forbidden",size:"12px",key:1},null):a.createVNode(a.resolveComponent("d-icon"),{name:"preview",size:"12px",key:2},null)])])}});F.install=function(e){e.component(F.name,F)};var $=a.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(e){return J({},e)},render(){const{name:e,size:n,color:t,classPrefix:o}=this;return/^((https?):)?\/\//.test(e)?a.createVNode("img",{src:e,alt:e.split("/")[e.split("/").length-1],style:{width:n,verticalAlign:"text-bottom"}},null):a.createVNode("i",{class:`${o} ${o}-${e}`,style:{fontSize:n,color:t}},null)}});$.install=function(e){e.component($.name,$)};const P=(e,n,t,o)=>{switch(n){case 0:const l=new Date(o);l.setFullYear(l.getFullYear()-1),t===0?e.current=l:e.next=l;break;case 1:const r=new Date(o);r.setMonth(r.getMonth()-1),t===0?e.current=r:e.next=r;break;case 2:const c=new Date(o);c.setMonth(c.getMonth()+1),t===0?e.current=c:e.next=c;break;case 3:const s=new Date(o);s.setFullYear(s.getFullYear()+1),t===0?e.current=s:e.next=s;break}},z=(e,n)=>{const{format:t="y/MM/dd",range:o,rangeSpliter:l="-"}=n||{};if(o){if(e.start){if(!e.end)return k(t,e.start)}else return"";if(e.end<e.start){const r=e.end;e.end=e.start,e.start=r}return Q(t,e.start,e.end,l)}else return e.start?k(t,e.start):""},T=e=>{if(!e)return"";const n=e.format||"y/MM/dd",t=e.rangeSpliter||"-";return e.range?`${n} ${t} ${n}`:n},V=e=>e.toDateString(),ce=(e,n,t="cell")=>{if(B(n.date,e.dateMin,e.dateMax)){if(n.current!==0)return`${t} not-current`}else return`${t} disabled`;const o=V(n.date);if(e.type==="range"){if(e.dateStart){if(V(e.dateStart)===o)return`${t} selected`;if(e.dateEnd&&V(e.dateEnd)===o)return`${t} selected`;const l=e.dateEnd||e.dateHover;if(l){const r=l>e.dateStart?[e.dateStart,l]:[l,e.dateStart];if(n.date>r[0]&&n.date<r[1])return`${t} innerday`}}return t}else return e.dateStart&&V(e.dateStart)===o?`${t} selected`:t},ie=(e,n)=>{!B(n.date,e.dateMin,e.dateMax)||(e.type==="range"?e.dateStart?e.dateEnd?x(e.onReset,n.date):E(e.dateStart,n.date)!==0&&(x(e.onSelectEnd,n.date),typeof e.onChange=="function"&&e.onChange(e.type,e)):x(e.onSelectStart,n.date):(x(e.onSelected,n.date),typeof e.onChange=="function"&&e.onChange(e.type,e)))},de=(e,n)=>{if(n.current!==0)return;const{dateMin:t,dateMax:o}=e;if(!(t&&E(n.date,t)<0)&&!(o&&E(o,n.date)<0)&&e.type==="range"){const l=V(n.date);if(!e.dateStart||V(e.dateStart)===l||e.dateEnd)return;x(e.onSelecting,n.date)}},X=e=>{const{color:n="#585d6b",rotate:t=0}=e;return a.createVNode("svg",{style:{transform:`rotate(${t}deg)`},width:"10px",height:"10px",viewBox:"0 0 10 10",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},[a.createVNode("g",{fill:n,transform:"translate(-1.000000, -1.000000)"},[a.createVNode("path",{d:"M11,1.83333333 L11,10.1666667 L7,7.38833333 L7,10.1666667 L1,6 L7,1.83333333 L7,4.61033333 L11,1.83333333 Z"},null)])])},q=e=>{const{color:n="#585d6b",rotate:t=0}=e;return a.createVNode("svg",{style:{transform:`rotate(${t}deg)`},width:"6px",height:"10px",viewBox:"0 0 6 10",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},[a.createVNode("g",{fill:n,transform:"translate(-3.000000, -1.000000)"},[a.createVNode("polygon",{points:"6 3 10.1666667 9 1.83333333 9"},null)])])};var Se="";const Y=e=>{const{button:n,disabled:t=!1,rotate:o=0,date:l,pos:r}=e,c=t?"#cfd0d3":"#585d6b",s=`${t?"disabled":""}`,i=t?void 0:()=>x(e.cb,l,r);return a.createVNode("a",{class:s,onClick:i},[a.createVNode(n,{color:c,rotate:o},null)])},ue=e=>{const{date:n}=e;return a.createVNode("a",{class:"title"},[`${n.getFullYear()}\u5E74${(n.getMonth()+1+"").padStart(2,"0")}\u6708`])},fe=e=>{const{type:n,current:t,compare:o,pos:l,dateMax:r,dateMin:c,onPreviousYear:s,onPreviousMonth:i,onNextMonth:w,onNextYear:D}=e,u=[!1,!1,!1,!1];return n==="range"?l===1?(u[0]=!h(o,t,"year",1),u[1]=!h(o,t,"month",1),u[2]=!h(t,r,"month",0),u[3]=!h(t,r,"year",0)):(u[0]=!h(c,t,"year",0),u[1]=!h(c,t,"month",0),u[2]=!h(t,o,"month",1),u[3]=!h(t,o,"year",1)):(u[0]=!h(c,t,"year",0),u[1]=!h(c,t,"month",0),u[2]=!h(t,r,"month",0),u[3]=!h(t,r,"year",0)),a.createVNode("div",{class:"devui-calendar-toolbar"},[a.createVNode(Y,{disabled:u[0],date:t,pos:l,button:X,cb:s},null),a.createVNode(Y,{disabled:u[1],date:t,pos:l,button:q,rotate:-90,cb:i},null),a.createVNode(ue,{date:t},null),a.createVNode(Y,{disabled:u[2],date:t,pos:l,button:q,rotate:90,cb:w},null),a.createVNode(Y,{disabled:u[3],date:t,pos:l,button:X,rotate:180,cb:D},null)])},me=e=>{const{onSelected:n=()=>0,disabled:t=!1}=e;return a.createVNode("div",{class:`today-container ${t?"disabled":""}`},[a.createVNode("button",{class:"today-button",disabled:t,onClick:t?void 0:()=>n(new Date)},[a.createTextVNode("\u4ECA\u5929")])])};var Ve="";const A=e=>{const n=new Date;return a.createVNode("div",{class:"devui-calendar-panel"},[a.createVNode(fe,{current:e.current,compare:e.compare,pos:e.pos,type:e.type,showTime:e.showTime,onPreviousYear:e.onPreviousYear,onPreviousMonth:e.onPreviousMonth,onNextMonth:e.onNextMonth,onNextYear:e.onNextYear,dateMax:e.dateMax,dateMin:e.dateMin},null),a.createVNode("ol",{class:"head row"},[ae.map(t=>a.createVNode("li",{class:"cell"},[t]))]),a.createVNode("ul",{class:"body"},[ne(e.current).map(t=>a.createVNode("li",{class:"row"},[t.map(o=>a.createVNode("span",{class:ce(e,o),onClick:()=>ie(e,o),onMouseenter:()=>de(e,o)},[o.date.getDate()]))]))]),e.type!=="range"?a.createVNode(me,{disabled:!B(n,e.dateMin,e.dateMax),onSelected:t=>{typeof e.onToday=="function"&&e.onToday(t,0)}},null):null])};var Ce="";const L=a.defineComponent({props:{size:{type:Number,default:26},items:{type:Array},selectedIndex:{type:Number},className:{type:String},itemClassNormal:{type:String},itemClassSelected:{type:String},onChange:{type:Function}},setup(e){const{items:n=[0,1,2,3,4,5,6,7,8,9],selectedIndex:t=0,size:o=26,className:l="",itemClassNormal:r="",itemClassSelected:c="selected",onChange:s}=e||{};let i=0,w=0;const D=a.ref(),u=a.ref();let N=null,y=null;const d=a.reactive({selectedIndex:t,barOpacity:0,x:0,y:0,transition:"none"}),M=m=>{m.stopPropagation(),m.preventDefault(),N=[m.clientX,m.clientY],d.transition="none"},we=m=>{m.stopPropagation(),m.preventDefault(),!(!N||!y)&&(d.x=y[0]+m.clientX-N[0],d.y=Math.min(i,Math.max(w,y[1]+m.clientY-N[1])),d.selectedIndex=(i-d.y+o/2)/o>>0)},W=m=>{if(m.stopPropagation(),m.preventDefault(),N=null,d.y=i-d.selectedIndex*o,d.transition="transform 0.1s",y[0]=d.x,y[1]=d.y,typeof s=="function"){const C=d.selectedIndex,O=n[C];s(O,C)}};return a.onMounted(()=>{const{height:m}=D.value.getBoundingClientRect(),{height:C}=u.value.getBoundingClientRect();i=(m-o)/2,w=(m+o)/2-C,y=[0,i-d.selectedIndex*o],d.x=y[0],d.y=y[1],d.barOpacity=1,d.transition="transform 0.1s"}),()=>a.createVNode("div",{ref:D,class:`devui-vertical-slider ${l}`},[a.createVNode("div",{ref:u,class:"movable-bar",style:{opacity:d.barOpacity,transform:`translateY(${d.y}px)`,transition:d.transition}},[n.map((m,C)=>{const O=C===d.selectedIndex?c:r;return a.createVNode("span",{class:`slider-item ${O}`,style:{height:`${o}px`,lineHeight:`${o}px`}},[m])})]),a.createVNode("div",{class:"slider-mask",onMousedown:M,onMousemove:we,onMouseup:W,onMouseout:W},null)])}});var be="";const H=a.defineComponent({props:{time:{type:Date}},setup(e){const{time:n=new Date}=e||{},t=a.reactive({hour:n.getHours(),minute:n.getMinutes(),second:n.getSeconds()}),o=Array(24).fill(0).map((r,c)=>`${c}`.padStart(2,"0")),l=Array(60).fill(0).map((r,c)=>`${c}`.padStart(2,"0"));return()=>a.createVNode("div",{class:"devui-calendar-timepicker"},[a.createVNode("div",{class:"head"},[a.createVNode("div",{class:"chars"},[a.createVNode("span",null,[t.hour.toString().padStart(2,"0"),a.createTextVNode(":"),t.minute.toString().padStart(2,"0"),a.createTextVNode(":"),t.second.toString().padStart(2,"0")])])]),a.createVNode("div",{class:"select"},[a.createVNode(L,{items:o,selectedIndex:t.hour,onChange:(r,c)=>t.hour=c},null),a.createVNode(L,{items:l,selectedIndex:t.minute,onChange:(r,c)=>t.minute=c},null),a.createVNode(L,{items:l,selectedIndex:t.second,onChange:(r,c)=>t.second=c},null)])])}});var Ie="";const ge=e=>{const{showTime:n=!1}=e;let{current:t}=e;if(t instanceof Date||(t=new Date),e.type==="range"){let{next:o}=e;return o instanceof Date||(o=new Date(t.getFullYear(),t.getMonth()+1,1)),a.createVNode("div",{class:"devui-calendar-container"},[a.createVNode(A,a.mergeProps(e,{pos:0,current:t,compare:o}),null),n?a.createVNode(H,{time:t},null):null,a.createVNode(A,a.mergeProps(e,{pos:1,current:o,compare:t}),null),n?a.createVNode(H,{time:o},null):null])}else return a.createVNode("div",{class:"devui-calendar-container"},[a.createVNode(A,a.mergeProps(e,{pos:0,current:t}),null),n?a.createVNode(H,{time:t},null):null])};var ke="";const he=e=>{const[n,t]=[e.start,e.end].sort((o,l)=>o.getTime()-l.getTime());e.start=n,e.end=t,S(n,t,"m")!==0?(e.current=n,e.next=t):(S(n,e.current)<0&&(e.current=n),S(e.next,t)<0&&(e.next=t))};var I=a.defineComponent({name:"DDatepicker",props:{selectedDateChange:{type:Function},autoClose:{type:Boolean,default:!1},range:{type:Boolean,default:!1},showTime:{type:Boolean,default:!1},format:{type:String,default:"y/MM/dd"},rangeSpliter:{type:String,default:"-"},attachInputDom:{type:String},dateMin:{type:String},dateMax:{type:String}},setup(e){const n=a.ref(null),t=a.ref(null),o=v(e.dateMin)||new Date,l=new Date(o.getFullYear(),o.getMonth()+1,1),r=a.reactive({show:!1,value:"",placeholder:T(e),current:o,next:l});r.value=z(r,e),r.placeholder=T(e);const c=s=>{s.stopPropagation(),!(R(s.target,n.value)||R(s.target,t.value))&&(r.show=!1)};return a.onMounted(()=>{document.addEventListener("click",c)}),a.onUnmounted(()=>{document.removeEventListener("click",c)}),()=>a.createVNode("div",{class:"devui-datepicker-container"},[a.createVNode("div",{class:"input-container",ref:t},[a.createVNode(F,{ref:t,class:"datepicker-input",modelValue:r.value,placeholder:r.placeholder,onFocus:()=>r.show=!0},null),a.createVNode($,{size:"small",name:"calendar",class:"datepicker-input-icon"},null)]),a.createVNode("div",{class:"devui-datepicker-panel",ref:n},[r.show?a.createVNode(ge,{type:e.range?"range":"select",showTime:e.showTime,current:r.current,next:r.next,dateMin:v(e.dateMin),dateMax:v(e.dateMax),dateStart:r.start,dateEnd:r.end,dateHover:r.hover,onReset:s=>{r.end=r.hover=void 0,r.start=s},onChange:()=>{r.value=z(r,e),r.placeholder=T(e),j(e.selectedDateChange,r.value),e.autoClose&&(r.show=!1)},onToday:s=>{r.current=s,r.start=s,r.value=z(r,e),r.placeholder=T(e),j(e.selectedDateChange,r.value),e.autoClose&&(r.show=!1)},onSelected:s=>{r.start=s,S(r.current,s)!==0&&(r.current=s)},onSelectStart:s=>r.start=s,onSelectEnd:s=>{r.end=s,he(r)},onSelecting:s=>r.hover=s,onPreviousYear:(s,i)=>P(r,0,i,s),onPreviousMonth:(s,i)=>P(r,1,i,s),onNextMonth:(s,i)=>P(r,2,i,s),onNextYear:(s,i)=>P(r,3,i,s)},null):null])])}}),Fe="";const K=a.defineComponent({name:"DStickSlider",props:{},setup(){const e=a.reactive({showButtons:!1,selectedIndex:0}),n=()=>{e.showButtons=!1},t=l=>{l.stopPropagation(),e.showButtons=!0},o=l=>{l.stopPropagation(),n()};return()=>a.createVNode("div",{class:"devui-stick-slider",onMousedown:t,onMouseup:o,onMouseleave:o},[a.createVNode("div",{class:"sub-buttons",style:{display:e.showButtons?"":"none"}},[Array(16).fill(null).map((l,r)=>a.createVNode("div",{class:`button ${r===e.selectedIndex?"selected":""}`,onMouseenter:()=>e.selectedIndex=r},[r]))]),a.createVNode("div",{class:"main-button"},null)])}});I.install=function(e){e.component(I.name,I),e.component(K.name,K)};var ye={title:"DatePicker \u65E5\u671F\u9009\u62E9\u5668",category:"\u6570\u636E\u5F55\u5165",status:"50%",install(e){e.use(I)}};f.DatePicker=I,f.StickSlider=K,f.default=ye,Object.defineProperty(f,"__esModule",{value:!0}),f[Symbol.toStringTag]="Module"});
|