ninemoon-ui 0.0.27 → 0.1.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/dist/components/alert/alert.d.ts +3 -11
- package/dist/components/alert/alertcomponent.vue.d.ts +22 -11
- package/dist/components/badge/badge.vue.d.ts +2 -0
- package/dist/components/carousel/carousel.vue.d.ts +29 -3
- package/dist/components/{tree/tree.vue.d.ts → carousel/clickbutton.vue.d.ts} +6 -19
- package/dist/components/check/checkbox.vue.d.ts +24 -16
- package/dist/components/check/checkgroup.vue.d.ts +15 -3
- package/dist/components/date/datepicker.vue.d.ts +28 -6
- package/dist/components/date/datepickerRange.vue.d.ts +15 -4
- package/dist/components/form/form.vue.d.ts +7 -20
- package/dist/components/form/formlabel.vue.d.ts +3 -3
- package/dist/components/form/type.d.ts +11 -0
- package/dist/components/icon/add.vue.d.ts +2 -0
- package/dist/components/icon/alertTip.vue.d.ts +2 -0
- package/dist/components/icon/arrow.vue.d.ts +2 -0
- package/dist/components/icon/calendar.vue.d.ts +2 -0
- package/dist/components/icon/close.vue.d.ts +2 -0
- package/dist/components/icon/dateArrow.vue.d.ts +2 -0
- package/dist/components/icon/dateArrowplus.vue.d.ts +2 -0
- package/dist/components/icon/delete.vue.d.ts +2 -0
- package/dist/components/icon/ellipsis.vue.d.ts +2 -0
- package/dist/components/icon/errTip.vue.d.ts +2 -0
- package/dist/components/icon/eye.vue.d.ts +2 -0
- package/dist/components/icon/infoTip.vue.d.ts +2 -0
- package/dist/components/icon/minus.vue.d.ts +2 -0
- package/dist/components/icon/successTip.vue.d.ts +2 -0
- package/dist/components/icon/turnleft.vue.d.ts +2 -0
- package/dist/components/icon/turnright.vue.d.ts +2 -0
- package/dist/components/icon/warnTip.vue.d.ts +2 -0
- package/dist/components/input/input.vue.d.ts +13 -8
- package/dist/components/loadding/loadcomponent.vue.d.ts +24 -4
- package/dist/components/loadding/loadding.d.ts +12 -19
- package/dist/components/menu/menu.vue.d.ts +13 -3
- package/dist/components/message/message.d.ts +68 -14
- package/dist/components/message/messagecomponent.vue.d.ts +5 -13
- package/dist/components/numberInput/numberinput.vue.d.ts +3 -3
- package/dist/components/pagination/pagination.vue.d.ts +24 -0
- package/dist/components/popover/poparrow.d.ts +55 -0
- package/dist/components/popover/popover.vue.d.ts +10 -4
- package/dist/components/radio/radiobox.vue.d.ts +24 -16
- package/dist/components/radio/radiogroup.vue.d.ts +15 -3
- package/dist/components/scrollBar/movebar.vue.d.ts +2 -2
- package/dist/components/scrollBar/scrollBar.vue.d.ts +12 -16
- package/dist/components/scrollloading/scrolllead.d.ts +18 -11
- package/dist/components/select/select.vue.d.ts +15 -1
- package/dist/components/select/selectoption.vue.d.ts +18 -6
- package/dist/components/switch/switch.vue.d.ts +14 -14
- package/dist/components/table/table.vue.d.ts +20 -9
- package/dist/components/table/tableItem.vue.d.ts +10 -4
- package/dist/components/tabs/tabs.vue.d.ts +14 -1
- package/dist/dialog.css +9 -0
- package/dist/directives/arrowKeys.d.ts +10 -0
- package/dist/directives/drag.d.ts +20 -0
- package/dist/directives/escape.d.ts +7 -0
- package/dist/directives/outsideclick.d.ts +14 -0
- package/dist/directives/watchwindow.d.ts +13 -0
- package/dist/directives/wheel.d.ts +12 -0
- package/dist/directives/whitespaceclick.d.ts +12 -0
- package/dist/index.css +1186 -873
- package/dist/index.d.ts +831 -401
- package/dist/index.es.js +22 -23
- package/dist/index.umd.js +4019 -3764
- package/dist/js/arrow/arrow.js +17 -0
- package/dist/js/badge/badge.js +9 -16
- package/dist/js/calendar/calendar.js +87 -0
- package/dist/js/carousel/carousel.js +101 -117
- package/dist/js/carousel/carouselitem.js +1 -7
- package/dist/js/check/checkbox.js +38 -4
- package/dist/js/check/checkgroup.js +40 -51
- package/dist/js/date/datepicker.js +146 -150
- package/dist/js/date/datepickerRange.js +265 -354
- package/dist/js/dateArrowplus/dateArrowplus.js +25 -0
- package/dist/js/delete/delete.js +19 -0
- package/dist/js/dialog/dialog.js +41 -57
- package/dist/js/form/form.js +30 -38
- package/dist/js/form/formlabel.js +99 -130
- package/dist/js/image/image.js +199 -149
- package/dist/js/index/index.js +605 -507
- package/dist/js/input/input.js +60 -43
- package/dist/js/menu/menu.js +47 -20
- package/dist/js/numberInput/numberinput.js +52 -60
- package/dist/js/pagination/pagination.js +125 -156
- package/dist/js/popover/popover.js +238 -134
- package/dist/js/radio/radiobox.js +37 -4
- package/dist/js/radio/radiogroup.js +15 -51
- package/dist/js/scrollBar/scrollBar.js +100 -56
- package/dist/js/select/select.js +155 -70
- package/dist/js/select/selectoption.js +45 -4
- package/dist/js/shapeFlag/shapeFlag.js +17 -0
- package/dist/js/switch/switch.js +14 -14
- package/dist/js/table/table.js +165 -111
- package/dist/js/table/tableItem.js +1 -1
- package/dist/js/tabs/tabs.js +57 -59
- package/dist/js/upload/upload.js +8 -23
- package/dist/tabs.css +3 -3
- package/dist/types/shapeFlag.d.ts +13 -0
- package/dist/{components/utils → utils}/tool.d.ts +11 -4
- package/package.json +1 -1
- package/dist/badge.css +0 -27
- package/dist/carousel.css +0 -13
- package/dist/checkgroup.css +0 -41
- package/dist/datepickerRange.css +0 -79
- package/dist/image.css +0 -8
- package/dist/js/getcalendar/getcalendar.js +0 -48
- package/dist/js/tree/tree.js +0 -72
- package/dist/js/tree/treeleaf.js +0 -116
- package/dist/radiogroup.css +0 -44
- package/dist/scrollBar.css +0 -37
- package/dist/select.css +0 -20
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, onMounted,
|
|
2
|
-
import { o as on,
|
|
1
|
+
import { defineComponent, ref, computed, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, onMounted, onUnmounted, renderSlot, createBlock, createCommentVNode } from "vue";
|
|
2
|
+
import { o as on, b as off, e as useResizeObserver } from "../index/index.js";
|
|
3
3
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
4
4
|
__name: "movebar",
|
|
5
5
|
props: {
|
|
@@ -47,8 +47,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
47
47
|
e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]
|
|
48
48
|
);
|
|
49
49
|
const thumbHalf = thumb.value[bar.value.offset] / 2;
|
|
50
|
-
const thumbPositionPercentage = (
|
|
51
|
-
|
|
50
|
+
const thumbPositionPercentage = (
|
|
51
|
+
// @ts-ignore
|
|
52
|
+
(offset - thumbHalf) * 100 / el.value[bar.value.offset]
|
|
53
|
+
);
|
|
54
|
+
wrap.value[bar.value.scroll] = // @ts-ignore
|
|
55
|
+
thumbPositionPercentage * wrap.value[bar.value.scrollSize] / 100;
|
|
52
56
|
};
|
|
53
57
|
const clickThumbHandler = (e) => {
|
|
54
58
|
if (e.ctrlKey || e.button === 2) {
|
|
@@ -59,7 +63,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
59
63
|
// 滑块的高度
|
|
60
64
|
e.currentTarget[bar.value.offset] - // 点击滑块距离顶部的位置 减去 滑块元素距离顶部的位置
|
|
61
65
|
// @ts-ignore
|
|
62
|
-
(e[bar.value.client] -
|
|
66
|
+
(e[bar.value.client] - // @ts-ignore
|
|
67
|
+
e.currentTarget.getBoundingClientRect()[bar.value.direction]);
|
|
63
68
|
};
|
|
64
69
|
const cursorDown = ref(false);
|
|
65
70
|
const startDrag = (e) => {
|
|
@@ -75,10 +80,18 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
75
80
|
const prevPage = baraxis;
|
|
76
81
|
if (!prevPage)
|
|
77
82
|
return;
|
|
78
|
-
const offset = (
|
|
83
|
+
const offset = (
|
|
84
|
+
// @ts-ignore
|
|
85
|
+
(el.value.getBoundingClientRect()[bar.value.direction] - // @ts-ignore
|
|
86
|
+
e[bar.value.client]) * -1
|
|
87
|
+
);
|
|
79
88
|
const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
|
|
80
|
-
const thumbPositionPercentage = (
|
|
81
|
-
|
|
89
|
+
const thumbPositionPercentage = (
|
|
90
|
+
// @ts-ignore
|
|
91
|
+
(offset - thumbClickPosition) * 100 / el.value[bar.value.offset]
|
|
92
|
+
);
|
|
93
|
+
wrap.value[bar.value.scroll] = // @ts-ignore
|
|
94
|
+
thumbPositionPercentage * wrap.value[bar.value.scrollSize] / 100;
|
|
82
95
|
};
|
|
83
96
|
const mouseUpDocumentHandler = () => {
|
|
84
97
|
cursorDown.value = false;
|
|
@@ -100,109 +113,140 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
100
113
|
onMousedown: clickTrackHandler,
|
|
101
114
|
ref_key: "el",
|
|
102
115
|
ref: el,
|
|
103
|
-
class: normalizeClass(["
|
|
104
|
-
_ctx.vertical ? "isver" : "ishor"
|
|
105
|
-
]])
|
|
116
|
+
class: normalizeClass(["absolute right-0.5 bottom-0.5 rounded transition-transform", [_ctx.vertical ? "top-0.5 w-1.5" : "left-0.5 h-1.5"]])
|
|
106
117
|
}, [
|
|
107
118
|
createElementVNode("div", {
|
|
108
119
|
onMousedown: clickThumbHandler,
|
|
109
120
|
ref_key: "thumb",
|
|
110
121
|
ref: thumb,
|
|
111
|
-
class: "
|
|
122
|
+
class: normalizeClass([_ctx.vertical ? "w-full" : "h-full", "bg-[#9092984d] cursor-pointer rounded"]),
|
|
112
123
|
style: normalizeStyle(renderThumbstyle())
|
|
113
|
-
}, null,
|
|
124
|
+
}, null, 38)
|
|
114
125
|
], 34);
|
|
115
126
|
};
|
|
116
127
|
}
|
|
117
128
|
});
|
|
118
129
|
const _hoisted_1 = {
|
|
119
|
-
key:
|
|
120
|
-
class: "
|
|
130
|
+
key: 0,
|
|
131
|
+
class: "group/scroll relative h-full overflow-hidden"
|
|
121
132
|
};
|
|
122
133
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
123
134
|
__name: "scrollBar",
|
|
124
135
|
props: {
|
|
125
136
|
native: { type: Boolean, default: false },
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
isSelectdom: { type: Boolean, default: false }
|
|
137
|
+
height: {},
|
|
138
|
+
maxHeight: {}
|
|
129
139
|
},
|
|
130
|
-
setup(__props) {
|
|
140
|
+
setup(__props, { expose: __expose }) {
|
|
131
141
|
const props = __props;
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
142
|
+
const warpStyle = computed(() => {
|
|
143
|
+
return {
|
|
144
|
+
maxHeight: props.maxHeight,
|
|
145
|
+
height: props.height
|
|
146
|
+
};
|
|
137
147
|
});
|
|
138
148
|
const wrap = ref();
|
|
139
|
-
const
|
|
149
|
+
const contentBox = ref();
|
|
140
150
|
const moveX = ref(0);
|
|
141
151
|
const moveY = ref(0);
|
|
142
|
-
const
|
|
143
|
-
const
|
|
152
|
+
const isTouching = ref(false);
|
|
153
|
+
const heightPercentage = ref(100);
|
|
154
|
+
const widthPercentage = ref(100);
|
|
155
|
+
const hasHor = computed(() => {
|
|
156
|
+
return widthPercentage.value !== 100;
|
|
157
|
+
});
|
|
158
|
+
const hasVer = computed(() => {
|
|
159
|
+
return heightPercentage.value !== 100;
|
|
160
|
+
});
|
|
161
|
+
const sizeHeight = computed(() => {
|
|
162
|
+
return `${heightPercentage.value}%`;
|
|
163
|
+
});
|
|
164
|
+
const sizeWidth = computed(() => {
|
|
165
|
+
return `${widthPercentage.value}%`;
|
|
166
|
+
});
|
|
144
167
|
const handleScroll = () => {
|
|
145
168
|
moveY.value = wrap.value.scrollTop / wrap.value.clientHeight * 100;
|
|
146
169
|
moveX.value = wrap.value.scrollLeft / wrap.value.clientWidth * 100;
|
|
147
170
|
};
|
|
148
171
|
const update = () => {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
sizeHeight.value = heightPercentage < 100 ? heightPercentage + "%" : "";
|
|
155
|
-
sizeWidth.value = widthPercentage < 100 ? widthPercentage + "%" : "";
|
|
172
|
+
if (wrap.value) {
|
|
173
|
+
const { clientWidth, clientHeight, scrollWidth, scrollHeight } = wrap.value;
|
|
174
|
+
heightPercentage.value = scrollHeight > 0 ? Math.min(clientHeight / scrollHeight * 100, 100) : 100;
|
|
175
|
+
widthPercentage.value = scrollWidth > 0 ? Math.min(clientWidth / scrollWidth * 100, 100) : 100;
|
|
176
|
+
}
|
|
156
177
|
};
|
|
178
|
+
const { observe, unobserve } = useResizeObserver(update);
|
|
157
179
|
onMounted(() => {
|
|
158
180
|
if (props.native)
|
|
159
181
|
return;
|
|
160
|
-
|
|
161
|
-
!props.noresize && addResizeListener(resize.value, update);
|
|
182
|
+
contentBox.value && observe(contentBox.value);
|
|
162
183
|
});
|
|
163
184
|
onUnmounted(() => {
|
|
164
185
|
if (props.native)
|
|
165
186
|
return;
|
|
166
|
-
|
|
187
|
+
contentBox.value && unobserve(contentBox.value);
|
|
188
|
+
});
|
|
189
|
+
const setScrollTop = (percentage, options = { behavior: "auto" }) => {
|
|
190
|
+
if (!wrap.value)
|
|
191
|
+
return;
|
|
192
|
+
const validPercentage = Math.max(0, Math.min(percentage, 100));
|
|
193
|
+
const maxScroll = wrap.value.scrollHeight - wrap.value.clientHeight;
|
|
194
|
+
wrap.value.scrollTo({
|
|
195
|
+
top: maxScroll * validPercentage / 100,
|
|
196
|
+
behavior: options.behavior
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
const setScrollLeft = (percentage, options = { behavior: "auto" }) => {
|
|
200
|
+
if (!wrap.value)
|
|
201
|
+
return;
|
|
202
|
+
const validPercentage = Math.max(0, Math.min(percentage, 100));
|
|
203
|
+
const maxScroll = wrap.value.scrollWidth - wrap.value.clientWidth;
|
|
204
|
+
wrap.value.scrollTo({
|
|
205
|
+
left: maxScroll * validPercentage / 100,
|
|
206
|
+
behavior: options.behavior
|
|
207
|
+
});
|
|
208
|
+
};
|
|
209
|
+
__expose({
|
|
210
|
+
setScrollTop,
|
|
211
|
+
setScrollLeft
|
|
167
212
|
});
|
|
168
213
|
return (_ctx, _cache) => {
|
|
169
|
-
return _ctx.native ?
|
|
214
|
+
return !_ctx.native ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
170
215
|
createElementVNode("div", {
|
|
171
216
|
ref_key: "wrap",
|
|
172
217
|
ref: wrap,
|
|
173
|
-
|
|
174
|
-
class:
|
|
175
|
-
style: normalizeStyle(
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
})
|
|
218
|
+
onScrollPassive: handleScroll,
|
|
219
|
+
class: "overscroll-contain overflow-auto h-full scrollbar-none uiscroll",
|
|
220
|
+
style: normalizeStyle(warpStyle.value),
|
|
221
|
+
onTouchstart: _cache[0] || (_cache[0] = ($event) => isTouching.value = true),
|
|
222
|
+
onTouchend: _cache[1] || (_cache[1] = ($event) => isTouching.value = false)
|
|
179
223
|
}, [
|
|
180
224
|
createElementVNode("div", {
|
|
181
|
-
ref_key: "
|
|
182
|
-
ref:
|
|
183
|
-
class: "block"
|
|
225
|
+
ref_key: "contentBox",
|
|
226
|
+
ref: contentBox
|
|
184
227
|
}, [
|
|
185
228
|
renderSlot(_ctx.$slots, "default")
|
|
186
229
|
], 512)
|
|
187
|
-
],
|
|
188
|
-
|
|
230
|
+
], 36),
|
|
231
|
+
hasHor.value ? (openBlock(), createBlock(_sfc_main$1, {
|
|
232
|
+
key: 0,
|
|
189
233
|
move: moveX.value,
|
|
190
234
|
size: sizeWidth.value,
|
|
191
235
|
parent: wrap.value,
|
|
192
|
-
class: "
|
|
193
|
-
}, null, 8, ["move", "size", "parent"]),
|
|
194
|
-
|
|
236
|
+
class: normalizeClass(["opacity-0 group-hover/scroll:opacity-100 max-sm:opacity-100 sm:group-hover/scroll:opacity-100 transition-opacity duration-300", { "opacity-100": isTouching.value }])
|
|
237
|
+
}, null, 8, ["move", "size", "parent", "class"])) : createCommentVNode("", true),
|
|
238
|
+
hasVer.value ? (openBlock(), createBlock(_sfc_main$1, {
|
|
239
|
+
key: 1,
|
|
195
240
|
vertical: "",
|
|
196
241
|
move: moveY.value,
|
|
197
242
|
size: sizeHeight.value,
|
|
198
243
|
parent: wrap.value,
|
|
199
|
-
class: "
|
|
200
|
-
}, null, 8, ["move", "size", "parent"])
|
|
201
|
-
]));
|
|
244
|
+
class: normalizeClass(["opacity-0 group-hover/scroll:opacity-100 max-sm:opacity-100 sm:group-hover/scroll:opacity-100 transition-opacity duration-300", { "opacity-100": isTouching.value }])
|
|
245
|
+
}, null, 8, ["move", "size", "parent", "class"])) : createCommentVNode("", true)
|
|
246
|
+
])) : renderSlot(_ctx.$slots, "default", { key: 1 });
|
|
202
247
|
};
|
|
203
248
|
}
|
|
204
249
|
});
|
|
205
|
-
const scrollBar_vue_vue_type_style_index_0_lang = "";
|
|
206
250
|
export {
|
|
207
251
|
_sfc_main as default
|
|
208
252
|
};
|
package/dist/js/select/select.js
CHANGED
|
@@ -1,4 +1,64 @@
|
|
|
1
|
-
import { defineComponent, defineAsyncComponent,
|
|
1
|
+
import { defineComponent, defineAsyncComponent, computed, inject, ref, watch, provide, toRef, openBlock, createBlock, unref, withCtx, createElementVNode, normalizeClass, createVNode, withDirectives, createElementBlock, renderSlot } from "vue";
|
|
2
|
+
import { A as ArrowIcon } from "../arrow/arrow.js";
|
|
3
|
+
import "../index/index.js";
|
|
4
|
+
const directionMap = {
|
|
5
|
+
ArrowUp: "up",
|
|
6
|
+
Up: "up",
|
|
7
|
+
// IE/Edge 兼容
|
|
8
|
+
ArrowDown: "down",
|
|
9
|
+
Down: "down",
|
|
10
|
+
// IE/Edge 兼容
|
|
11
|
+
ArrowLeft: "left",
|
|
12
|
+
Left: "left",
|
|
13
|
+
// IE/Edge 兼容
|
|
14
|
+
ArrowRight: "right",
|
|
15
|
+
Right: "right"
|
|
16
|
+
// IE/Edge 兼容
|
|
17
|
+
};
|
|
18
|
+
const createArrowKeysDirective = (options) => {
|
|
19
|
+
const config = {
|
|
20
|
+
// 默认配置
|
|
21
|
+
up: () => {
|
|
22
|
+
},
|
|
23
|
+
down: () => {
|
|
24
|
+
},
|
|
25
|
+
left: () => {
|
|
26
|
+
},
|
|
27
|
+
right: () => {
|
|
28
|
+
},
|
|
29
|
+
...options
|
|
30
|
+
};
|
|
31
|
+
const bindEvents = (el, binding) => {
|
|
32
|
+
const handler = (e) => {
|
|
33
|
+
var _a;
|
|
34
|
+
const direction = directionMap[e.key];
|
|
35
|
+
if (direction && config[direction]) {
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
(_a = config[direction]) == null ? void 0 : _a.call(config, e);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
el._arrowKeysHandler = handler;
|
|
41
|
+
document.addEventListener("keydown", handler);
|
|
42
|
+
};
|
|
43
|
+
const unbindEvents = (el) => {
|
|
44
|
+
if (el._arrowKeysHandler) {
|
|
45
|
+
document.removeEventListener("keydown", el._arrowKeysHandler);
|
|
46
|
+
}
|
|
47
|
+
delete el._arrowKeysHandler;
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
mounted(el, binding) {
|
|
51
|
+
bindEvents(el);
|
|
52
|
+
},
|
|
53
|
+
updated(el, binding) {
|
|
54
|
+
unbindEvents(el);
|
|
55
|
+
bindEvents(el);
|
|
56
|
+
},
|
|
57
|
+
unmounted(el) {
|
|
58
|
+
unbindEvents(el);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
};
|
|
2
62
|
const _hoisted_1 = ["value", "disabled", "readonly", "placeholder"];
|
|
3
63
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4
64
|
__name: "select",
|
|
@@ -6,87 +66,102 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
6
66
|
modelValue: {},
|
|
7
67
|
filter: { type: Boolean, default: false },
|
|
8
68
|
placeHolder: { default: "点击选择" },
|
|
9
|
-
disabled: { type: Boolean, default: false }
|
|
69
|
+
disabled: { type: Boolean, default: false },
|
|
70
|
+
size: { default: "default" }
|
|
10
71
|
},
|
|
11
72
|
emits: ["update:modelValue", "change"],
|
|
12
73
|
setup(__props, { emit: __emit }) {
|
|
13
|
-
const LibScrollBar = defineAsyncComponent(() => import("../scrollBar/scrollBar.js"));
|
|
14
74
|
const Pop = defineAsyncComponent(() => import("../popover/popover.js"));
|
|
75
|
+
const LibScrollBar = defineAsyncComponent(() => import("../scrollBar/scrollBar.js"));
|
|
15
76
|
const props = __props;
|
|
16
|
-
const
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
);
|
|
77
|
+
const heightClass = computed(() => ({
|
|
78
|
+
"h-8": props.size === "large",
|
|
79
|
+
"h-7": props.size === "default",
|
|
80
|
+
"h-6": props.size === "small"
|
|
81
|
+
}));
|
|
82
|
+
const ParentGetChangeHandle = inject("changHandle", (_params) => null);
|
|
83
|
+
const inputbox = ref();
|
|
84
|
+
const popwidth = computed(() => {
|
|
85
|
+
var _a;
|
|
86
|
+
return ((_a = inputbox.value) == null ? void 0 : _a.clientWidth) || 200;
|
|
87
|
+
});
|
|
88
|
+
const scrollRef = ref();
|
|
89
|
+
const vArrowKeys = createArrowKeysDirective({
|
|
90
|
+
up: () => {
|
|
91
|
+
if (showOption.value) {
|
|
92
|
+
const newIndex = (inputLabelIndex.value - 1 + totalNum.value) % totalNum.value;
|
|
93
|
+
updateModelvalue(selectDataArr.value[newIndex].value);
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
down: () => {
|
|
97
|
+
if (showOption.value) {
|
|
98
|
+
const newIndex = (inputLabelIndex.value + 1 + totalNum.value) % totalNum.value;
|
|
99
|
+
updateModelvalue(selectDataArr.value[newIndex].value);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
21
103
|
const emit = __emit;
|
|
22
|
-
const slots = useSlots();
|
|
23
104
|
const showOption = ref(false);
|
|
24
105
|
const showHandle = () => {
|
|
25
106
|
if (props.disabled === true)
|
|
26
107
|
return;
|
|
27
108
|
showOption.value = !showOption.value;
|
|
28
109
|
};
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return null;
|
|
110
|
+
const selectDataArr = ref([]);
|
|
111
|
+
const insertData = (data) => {
|
|
112
|
+
selectDataArr.value.push(data);
|
|
113
|
+
};
|
|
114
|
+
watch(showOption, (newval) => {
|
|
115
|
+
if (newval === false) {
|
|
116
|
+
LastChildSelect(props.modelValue);
|
|
37
117
|
}
|
|
38
118
|
});
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
});
|
|
45
|
-
return h(
|
|
46
|
-
"div",
|
|
47
|
-
{
|
|
48
|
-
class: normalizeClass(["label", [props.modelValue === it.props.value ? "labelselect" : ""]]),
|
|
49
|
-
key: it.props.key,
|
|
50
|
-
onClick: () => {
|
|
51
|
-
emit("update:modelValue", it.props.value);
|
|
52
|
-
ParentGetChangeHandle && ParentGetChangeHandle(it.props.value);
|
|
53
|
-
emit("change", it.props.value);
|
|
54
|
-
showOption.value = false;
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
it.children || it.props.label
|
|
58
|
-
);
|
|
119
|
+
const updateModelvalue = (value) => {
|
|
120
|
+
emit("update:modelValue", value);
|
|
121
|
+
emit("change", value);
|
|
122
|
+
LastChildSelect(value);
|
|
123
|
+
ParentGetChangeHandle && ParentGetChangeHandle(value);
|
|
59
124
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (Array.isArray(i.children)) {
|
|
70
|
-
return i.children.map((it) => {
|
|
71
|
-
return optionHandle(it);
|
|
72
|
-
});
|
|
73
|
-
} else {
|
|
74
|
-
return optionHandle(i);
|
|
75
|
-
}
|
|
76
|
-
})
|
|
77
|
-
);
|
|
125
|
+
provide("_SelectItemPush_", insertData);
|
|
126
|
+
provide("_UpdateSelectData_", (value) => {
|
|
127
|
+
updateModelvalue(value);
|
|
128
|
+
showOption.value = false;
|
|
129
|
+
});
|
|
130
|
+
provide("_SelectModelValue_", toRef(props, "modelValue"));
|
|
131
|
+
const lastMouseEnterValue = toRef(props.modelValue);
|
|
132
|
+
const LastChildSelect = (value) => {
|
|
133
|
+
lastMouseEnterValue.value = value;
|
|
78
134
|
};
|
|
135
|
+
provide("_LastSelectValue_", lastMouseEnterValue);
|
|
136
|
+
provide("_LastChildSelect_", LastChildSelect);
|
|
137
|
+
const inputLabel = computed(() => {
|
|
138
|
+
const isThis = selectDataArr.value.find((v) => v.value === props.modelValue);
|
|
139
|
+
return isThis ? isThis.label : props.modelValue;
|
|
140
|
+
});
|
|
141
|
+
const inputLabelIndex = computed(() => {
|
|
142
|
+
return selectDataArr.value.findIndex((v) => v.value === props.modelValue);
|
|
143
|
+
});
|
|
144
|
+
const totalNum = computed(() => {
|
|
145
|
+
return selectDataArr.value.length;
|
|
146
|
+
});
|
|
79
147
|
return (_ctx, _cache) => {
|
|
80
148
|
return openBlock(), createBlock(unref(Pop), {
|
|
149
|
+
isselectMode: "",
|
|
81
150
|
trigger: "native",
|
|
82
151
|
modelValue: showOption.value,
|
|
83
152
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => showOption.value = $event),
|
|
84
|
-
|
|
85
|
-
|
|
153
|
+
width: popwidth.value,
|
|
154
|
+
insertClass: "z-2000 text-sm py-0.5 px-0",
|
|
155
|
+
placement: "bottommiddle"
|
|
86
156
|
}, {
|
|
87
157
|
reference: withCtx(() => [
|
|
88
158
|
createElementVNode("div", {
|
|
89
|
-
|
|
159
|
+
ref_key: "inputbox",
|
|
160
|
+
ref: inputbox,
|
|
161
|
+
class: normalizeClass([{
|
|
162
|
+
"bg-gray-100 cursor-default": _ctx.disabled,
|
|
163
|
+
"cursor-pointer": !_ctx.disabled
|
|
164
|
+
}, "relative flex h-full w-full items-center overflow-hidden rounded border border-solid"]),
|
|
90
165
|
onClick: showHandle
|
|
91
166
|
}, [
|
|
92
167
|
createElementVNode("input", {
|
|
@@ -94,25 +169,35 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
94
169
|
type: "text",
|
|
95
170
|
disabled: _ctx.disabled,
|
|
96
171
|
readonly: !_ctx.filter,
|
|
97
|
-
class: "
|
|
172
|
+
class: normalizeClass(["w-full cursor-pointer appearance-none px-2 text-sm outline-none disabled:cursor-default text-word3", heightClass.value]),
|
|
98
173
|
placeholder: _ctx.placeHolder
|
|
99
|
-
}, null,
|
|
100
|
-
|
|
174
|
+
}, null, 10, _hoisted_1),
|
|
175
|
+
createVNode(ArrowIcon, {
|
|
176
|
+
class: normalizeClass(["w-3 h-3 fill-gray-300 inline-block transform transition-all mx-1", { "-rotate-90": showOption.value, "rotate-90": !showOption.value }])
|
|
177
|
+
}, null, 8, ["class"])
|
|
178
|
+
], 2)
|
|
101
179
|
]),
|
|
102
180
|
default: withCtx(() => [
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
181
|
+
withDirectives((openBlock(), createElementBlock("div", null, [
|
|
182
|
+
createVNode(unref(LibScrollBar), {
|
|
183
|
+
ref_key: "scrollRef",
|
|
184
|
+
ref: scrollRef,
|
|
185
|
+
maxHeight: "274px"
|
|
186
|
+
}, {
|
|
187
|
+
default: withCtx(() => [
|
|
188
|
+
renderSlot(_ctx.$slots, "default")
|
|
189
|
+
]),
|
|
190
|
+
_: 3
|
|
191
|
+
}, 512)
|
|
192
|
+
])), [
|
|
193
|
+
[unref(vArrowKeys)]
|
|
194
|
+
])
|
|
109
195
|
]),
|
|
110
|
-
_:
|
|
111
|
-
}, 8, ["modelValue"]);
|
|
196
|
+
_: 3
|
|
197
|
+
}, 8, ["modelValue", "width"]);
|
|
112
198
|
};
|
|
113
199
|
}
|
|
114
200
|
});
|
|
115
|
-
const select_vue_vue_type_style_index_0_lang = "";
|
|
116
201
|
export {
|
|
117
202
|
_sfc_main as default
|
|
118
203
|
};
|
|
@@ -1,13 +1,54 @@
|
|
|
1
|
-
import { defineComponent, renderSlot } from "vue";
|
|
1
|
+
import { defineComponent, ref, inject, computed, useSlots, openBlock, createElementBlock, normalizeClass, toDisplayString, renderSlot } from "vue";
|
|
2
|
+
const _hoisted_1 = { key: 0 };
|
|
2
3
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3
4
|
__name: "selectoption",
|
|
4
5
|
props: {
|
|
5
6
|
value: {},
|
|
6
|
-
label: {}
|
|
7
|
+
label: {},
|
|
8
|
+
disabled: { type: Boolean, default: false }
|
|
7
9
|
},
|
|
8
|
-
setup(__props) {
|
|
10
|
+
setup(__props, { expose: __expose }) {
|
|
11
|
+
const props = __props;
|
|
12
|
+
const elRef = ref();
|
|
13
|
+
const modelValue = inject("_SelectModelValue_");
|
|
14
|
+
const isSelected = computed(() => modelValue.value === props.value);
|
|
15
|
+
const slots = useSlots();
|
|
16
|
+
const pushData = inject("_SelectItemPush_", (_params) => {
|
|
17
|
+
});
|
|
18
|
+
const selectHandle = inject("_UpdateSelectData_", (_params) => {
|
|
19
|
+
});
|
|
20
|
+
const hoverValue = inject("_LastSelectValue_");
|
|
21
|
+
const hoverHandle = inject("_LastChildSelect_", (_params) => {
|
|
22
|
+
});
|
|
23
|
+
const clickMeHandle = () => {
|
|
24
|
+
if (props.disabled)
|
|
25
|
+
return;
|
|
26
|
+
selectHandle(props.value);
|
|
27
|
+
};
|
|
28
|
+
pushData({ ...props });
|
|
29
|
+
const hasSlot = computed(() => !!slots.default);
|
|
30
|
+
const isHovered = computed(() => hoverValue.value === props.value);
|
|
31
|
+
const moveIn = () => {
|
|
32
|
+
hoverHandle(props.value);
|
|
33
|
+
};
|
|
34
|
+
__expose({
|
|
35
|
+
el: elRef
|
|
36
|
+
});
|
|
9
37
|
return (_ctx, _cache) => {
|
|
10
|
-
return
|
|
38
|
+
return openBlock(), createElementBlock("div", {
|
|
39
|
+
ref_key: "elRef",
|
|
40
|
+
ref: elRef,
|
|
41
|
+
onClick: clickMeHandle,
|
|
42
|
+
onMouseenter: moveIn,
|
|
43
|
+
class: normalizeClass(["px-1 py-2 cursor-pointer", {
|
|
44
|
+
"text-blue-light": isSelected.value,
|
|
45
|
+
"opacity-50 cursor-not-allowed": _ctx.disabled,
|
|
46
|
+
"bg-gray-100": !_ctx.disabled && isHovered.value,
|
|
47
|
+
"bg-inherit": !isHovered.value
|
|
48
|
+
}])
|
|
49
|
+
}, [
|
|
50
|
+
!hasSlot.value ? (openBlock(), createElementBlock("div", _hoisted_1, toDisplayString(_ctx.label || _ctx.value), 1)) : renderSlot(_ctx.$slots, "default", { key: 1 })
|
|
51
|
+
], 34);
|
|
11
52
|
};
|
|
12
53
|
}
|
|
13
54
|
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var ShapeFlags = /* @__PURE__ */ ((ShapeFlags2) => {
|
|
2
|
+
ShapeFlags2[ShapeFlags2["ELEMENT"] = 1] = "ELEMENT";
|
|
3
|
+
ShapeFlags2[ShapeFlags2["FUNCTIONAL_COMPONENT"] = 2] = "FUNCTIONAL_COMPONENT";
|
|
4
|
+
ShapeFlags2[ShapeFlags2["STATEFUL_COMPONENT"] = 4] = "STATEFUL_COMPONENT";
|
|
5
|
+
ShapeFlags2[ShapeFlags2["TEXT_CHILDREN"] = 8] = "TEXT_CHILDREN";
|
|
6
|
+
ShapeFlags2[ShapeFlags2["ARRAY_CHILDREN"] = 16] = "ARRAY_CHILDREN";
|
|
7
|
+
ShapeFlags2[ShapeFlags2["SLOTS_CHILDREN"] = 32] = "SLOTS_CHILDREN";
|
|
8
|
+
ShapeFlags2[ShapeFlags2["TELEPORT"] = 64] = "TELEPORT";
|
|
9
|
+
ShapeFlags2[ShapeFlags2["SUSPENSE"] = 128] = "SUSPENSE";
|
|
10
|
+
ShapeFlags2[ShapeFlags2["COMPONENT_SHOULD_KEEP_ALIVE"] = 256] = "COMPONENT_SHOULD_KEEP_ALIVE";
|
|
11
|
+
ShapeFlags2[ShapeFlags2["COMPONENT_KEPT_ALIVE"] = 512] = "COMPONENT_KEPT_ALIVE";
|
|
12
|
+
ShapeFlags2[ShapeFlags2["COMPONENT"] = 6] = "COMPONENT";
|
|
13
|
+
return ShapeFlags2;
|
|
14
|
+
})(ShapeFlags || {});
|
|
15
|
+
export {
|
|
16
|
+
ShapeFlags as S
|
|
17
|
+
};
|
package/dist/js/switch/switch.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { defineComponent, openBlock, createElementBlock, createElementVNode, normalizeStyle, normalizeClass, toDisplayString } from "vue";
|
|
2
|
-
const _hoisted_1 = { class: "
|
|
2
|
+
const _hoisted_1 = { class: "inline-block cursor-pointer select-none text-xs relative" };
|
|
3
3
|
const _hoisted_2 = {
|
|
4
4
|
key: 0,
|
|
5
|
-
class: "
|
|
5
|
+
class: "z-10 font-semibold text-white leading-5 mr-6 pl-1"
|
|
6
6
|
};
|
|
7
7
|
const _hoisted_3 = {
|
|
8
8
|
key: 1,
|
|
9
|
-
class: "
|
|
9
|
+
class: "z-10 font-semibold text-white leading-5 ml-6 pr-1"
|
|
10
10
|
};
|
|
11
11
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
12
12
|
__name: "switch",
|
|
13
13
|
props: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
checkedLabel: {},
|
|
15
|
+
uncheckedLabel: {},
|
|
16
|
+
checkedColor: { default: "#25b9e9" },
|
|
17
|
+
uncheckedColor: { default: "#666666" },
|
|
18
18
|
modelValue: { type: Boolean, default: false }
|
|
19
19
|
},
|
|
20
20
|
emits: ["update:modelValue", "switchChange"],
|
|
@@ -29,18 +29,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
29
29
|
return openBlock(), createElementBlock("label", _hoisted_1, [
|
|
30
30
|
createElementVNode("input", {
|
|
31
31
|
type: "checkbox",
|
|
32
|
-
class: "
|
|
32
|
+
class: "hidden",
|
|
33
33
|
onChange: togglehandle
|
|
34
34
|
}, null, 32),
|
|
35
35
|
createElementVNode("div", {
|
|
36
|
-
class: "
|
|
37
|
-
style: normalizeStyle({ backgroundColor: _ctx.modelValue ? _ctx.
|
|
36
|
+
class: "relative box-border block h-5 min-w-10 select-none overflow-hidden rounded-xl outline-0 ring-2 ring-gray-300",
|
|
37
|
+
style: normalizeStyle({ backgroundColor: _ctx.modelValue ? _ctx.checkedColor : _ctx.uncheckedColor })
|
|
38
38
|
}, [
|
|
39
39
|
createElementVNode("div", {
|
|
40
|
-
class: normalizeClass(["
|
|
41
|
-
}, null, 2)
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
class: normalizeClass(["absolute top-0 z-10 block h-5 w-5 transform rounded-full bg-slate-50 transition-all", [_ctx.modelValue ? "left-[calc(100%-20px)]" : "left-0"]])
|
|
41
|
+
}, null, 2),
|
|
42
|
+
_ctx.modelValue ? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString(_ctx.checkedLabel), 1)) : (openBlock(), createElementBlock("div", _hoisted_3, toDisplayString(_ctx.uncheckedLabel), 1))
|
|
43
|
+
], 4)
|
|
44
44
|
]);
|
|
45
45
|
};
|
|
46
46
|
}
|