ninemoon-ui 0.0.27 → 0.1.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/dist/assets/dialog-a1b585e9.css +9 -0
- package/dist/assets/index-6d2c28a9.css +1210 -0
- package/dist/{tabs.css → assets/tabs-d2c8965f.css} +3 -3
- 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/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.d.ts +831 -401
- package/dist/js/arrow-ebe47bd0.js +17 -0
- package/dist/js/{badge/badge.js → badge-496028b6.js} +9 -16
- package/dist/js/calendar-5c242731.js +87 -0
- package/dist/js/carousel-10621aeb.js +155 -0
- package/dist/js/{carousel/carouselitem.js → carouselitem-89116745.js} +1 -7
- package/dist/js/checkbox-530025c4.js +50 -0
- package/dist/js/checkgroup-e4e6adbc.js +58 -0
- package/dist/js/dateArrowplus-8181993f.js +25 -0
- package/dist/js/datepicker-ef8b7019.js +362 -0
- package/dist/js/datepickerRange-4c400f88.js +500 -0
- package/dist/js/delete-e898f83c.js +19 -0
- package/dist/js/dialog-0127ca01.js +122 -0
- package/dist/js/form-6ae96387.js +79 -0
- package/dist/js/formlabel-9339bd1c.js +136 -0
- package/dist/js/image-76711716.js +300 -0
- package/dist/js/index-283810a0.js +6261 -0
- package/dist/js/index-b4e420ce.js +958 -0
- package/dist/js/index-e12c8d65.js +36 -0
- package/dist/js/input-11fe67a5.js +107 -0
- package/dist/js/menu-fb9b4a4f.js +86 -0
- package/dist/js/numberinput-00fa4429.js +119 -0
- package/dist/js/pagination-3bcaa109.js +203 -0
- package/dist/js/popover-45f75f86.js +345 -0
- package/dist/js/radiobox-8f11e726.js +49 -0
- package/dist/js/radiogroup-727923c7.js +33 -0
- package/dist/js/scrollBar-07906042.js +252 -0
- package/dist/js/select-b5bbb138.js +203 -0
- package/dist/js/selectoption-00c8f06d.js +57 -0
- package/dist/js/shapeFlag-8cf4bcf1.js +17 -0
- package/dist/js/switch-06ae74cc.js +50 -0
- package/dist/js/table-9bb52630.js +270 -0
- package/dist/js/{table/tableItem.js → tableItem-7d8bf2db.js} +1 -1
- package/dist/js/{tabs/tabs.js → tabs-9d7be734.js} +57 -59
- package/dist/js/{upload/upload.js → upload-16dbef22.js} +8 -23
- 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/index.css +0 -897
- package/dist/index.es.js +0 -37
- package/dist/index.umd.js +0 -6006
- package/dist/js/carousel/carousel.js +0 -171
- package/dist/js/check/checkbox.js +0 -16
- package/dist/js/check/checkgroup.js +0 -69
- package/dist/js/date/datepicker.js +0 -366
- package/dist/js/date/datepickerRange.js +0 -589
- package/dist/js/dialog/dialog.js +0 -138
- package/dist/js/form/form.js +0 -87
- package/dist/js/form/formlabel.js +0 -167
- package/dist/js/getcalendar/getcalendar.js +0 -48
- package/dist/js/image/image.js +0 -250
- package/dist/js/index/index.js +0 -860
- package/dist/js/input/input.js +0 -90
- package/dist/js/menu/menu.js +0 -59
- package/dist/js/numberInput/numberinput.js +0 -127
- package/dist/js/pagination/pagination.js +0 -234
- package/dist/js/popover/popover.js +0 -241
- package/dist/js/radio/radiobox.js +0 -16
- package/dist/js/radio/radiogroup.js +0 -69
- package/dist/js/scrollBar/scrollBar.js +0 -208
- package/dist/js/select/select.js +0 -118
- package/dist/js/select/selectoption.js +0 -16
- package/dist/js/switch/switch.js +0 -50
- package/dist/js/table/table.js +0 -216
- 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
- /package/dist/js/{tabs/tabsPane.js → tabsPane-f024a6bf.js} +0 -0
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import { defineComponent, h, normalizeClass, normalizeStyle, ref, computed, nextTick, openBlock, createElementBlock, withModifiers, renderSlot, createBlock, Teleport, createVNode, Transition, withCtx, withDirectives, unref, vShow } from "vue";
|
|
2
|
+
import { d as debounce, u as usePotion, c as createEscapeDirective } from "./index-b4e420ce.js";
|
|
3
|
+
const DEFAULT_DEBOUNCE_WAIT$1 = 100;
|
|
4
|
+
const createBgClickDirective = (options) => {
|
|
5
|
+
const config = {
|
|
6
|
+
debounceWait: DEFAULT_DEBOUNCE_WAIT$1,
|
|
7
|
+
moveModel: false,
|
|
8
|
+
onCheckOut: () => {
|
|
9
|
+
},
|
|
10
|
+
...options
|
|
11
|
+
};
|
|
12
|
+
const bindEvents = (el, binding) => {
|
|
13
|
+
if (el._checkout_handlers_)
|
|
14
|
+
return;
|
|
15
|
+
const clickDom = debounce((e) => {
|
|
16
|
+
e.preventDefault();
|
|
17
|
+
config.onCheckOut(e, el);
|
|
18
|
+
}, config.debounceWait);
|
|
19
|
+
el._checkout_handlers_ = {
|
|
20
|
+
click: clickDom
|
|
21
|
+
};
|
|
22
|
+
if (config.moveModel) {
|
|
23
|
+
document.addEventListener("mousemove", clickDom);
|
|
24
|
+
} else {
|
|
25
|
+
document.addEventListener("click", clickDom);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const unbindEvents = (el) => {
|
|
29
|
+
if (el._checkout_handlers_) {
|
|
30
|
+
if (config.moveModel) {
|
|
31
|
+
document.removeEventListener("mousemove", el._checkout_handlers_.click);
|
|
32
|
+
} else {
|
|
33
|
+
document.removeEventListener("click", el._checkout_handlers_.click);
|
|
34
|
+
}
|
|
35
|
+
delete el._checkout_handlers_;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
mounted(el, binding) {
|
|
40
|
+
bindEvents(el);
|
|
41
|
+
},
|
|
42
|
+
beforeUnmount(el) {
|
|
43
|
+
unbindEvents(el);
|
|
44
|
+
},
|
|
45
|
+
// 添加 updated 钩子处理配置变化
|
|
46
|
+
updated(el, binding) {
|
|
47
|
+
if (binding.value !== binding.oldValue) {
|
|
48
|
+
unbindEvents(el);
|
|
49
|
+
bindEvents(el);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
const DEFAULT_DEBOUNCE_WAIT = 100;
|
|
55
|
+
const createScrollDirective = (options) => {
|
|
56
|
+
const config = {
|
|
57
|
+
debounceWait: DEFAULT_DEBOUNCE_WAIT,
|
|
58
|
+
onMove: () => {
|
|
59
|
+
},
|
|
60
|
+
...options
|
|
61
|
+
};
|
|
62
|
+
const bindEvents = (el, binding) => {
|
|
63
|
+
if (el._watchwindow_handlers_) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const moveDom = debounce((e) => {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
config.onMove();
|
|
69
|
+
}, config.debounceWait);
|
|
70
|
+
el._watchwindow_handlers_ = {
|
|
71
|
+
move: moveDom
|
|
72
|
+
};
|
|
73
|
+
window.addEventListener("resize", el._watchwindow_handlers_.move);
|
|
74
|
+
window.addEventListener("scroll", el._watchwindow_handlers_.move);
|
|
75
|
+
};
|
|
76
|
+
const unbindEvents = (el) => {
|
|
77
|
+
if (el._watchwindow_handlers_) {
|
|
78
|
+
window.removeEventListener("resize", el._watchwindow_handlers_.move);
|
|
79
|
+
window.removeEventListener("scroll", el._watchwindow_handlers_.move);
|
|
80
|
+
delete el._watchwindow_handlers_;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
return {
|
|
84
|
+
mounted(el, binding) {
|
|
85
|
+
bindEvents(el);
|
|
86
|
+
},
|
|
87
|
+
beforeUnmount(el) {
|
|
88
|
+
unbindEvents(el);
|
|
89
|
+
},
|
|
90
|
+
// 添加 updated 钩子处理配置变化
|
|
91
|
+
updated(el, binding) {
|
|
92
|
+
if (binding.value !== binding.oldValue) {
|
|
93
|
+
unbindEvents(el);
|
|
94
|
+
bindEvents(el);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
const PLACEMENT_GROUPS = {
|
|
100
|
+
top: ["topleft", "topmiddle", "topright"],
|
|
101
|
+
bottom: ["bottomleft", "bottommiddle", "bottomright"],
|
|
102
|
+
center: ["centerleft", "centerright"]
|
|
103
|
+
};
|
|
104
|
+
const ARROW_CLASSES = {
|
|
105
|
+
base: 'absolute w-2.5 h-2.5 before:z-[-1] before:border before:border-gray-300 before:bg-white before:content-border before:rotate-45 before:content-[" "] before:w-2.5 before:h-2.5 before:absolute',
|
|
106
|
+
top: {
|
|
107
|
+
normal: "before:border-t-transparent before:border-l-transparent before:rounded-br",
|
|
108
|
+
exchange: "before:border-b-transparent before:border-r-transparent before:rounded-tl"
|
|
109
|
+
},
|
|
110
|
+
bottom: {
|
|
111
|
+
normal: "before:border-b-transparent before:border-r-transparent before:rounded-tl",
|
|
112
|
+
exchange: "before:border-t-transparent before:border-l-transparent before:rounded-br"
|
|
113
|
+
},
|
|
114
|
+
center: {
|
|
115
|
+
right: "before:border-r-transparent before:border-t-transparent before:rounded-bl",
|
|
116
|
+
left: "before:border-l-transparent before:border-b-transparent before:rounded-tr"
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
const arrowComponent = defineComponent({
|
|
120
|
+
name: "PopArrow",
|
|
121
|
+
props: {
|
|
122
|
+
arrowLeft: { type: Number, required: true },
|
|
123
|
+
arrowTop: { type: Number, required: true },
|
|
124
|
+
placement: { type: String, required: true },
|
|
125
|
+
arrowshow: { type: Boolean, required: true },
|
|
126
|
+
exChange: { type: Boolean, required: true },
|
|
127
|
+
beforebgcolor: { type: String }
|
|
128
|
+
},
|
|
129
|
+
setup(props) {
|
|
130
|
+
const getArrowStyles = () => {
|
|
131
|
+
const { placement, exChange, arrowLeft, arrowTop } = props;
|
|
132
|
+
const isTopGroup = PLACEMENT_GROUPS.top.includes(placement);
|
|
133
|
+
const isBottomGroup = PLACEMENT_GROUPS.bottom.includes(placement);
|
|
134
|
+
const isCenterGroup = PLACEMENT_GROUPS.center.includes(placement);
|
|
135
|
+
return {
|
|
136
|
+
left: isTopGroup || isBottomGroup ? `${arrowLeft}px` : placement === "centerright" ? "-5px" : null,
|
|
137
|
+
right: placement === "centerleft" ? "-5px" : null,
|
|
138
|
+
top: isCenterGroup ? `${arrowTop}px` : isBottomGroup && !exChange || isTopGroup && exChange ? "-5px" : null,
|
|
139
|
+
bottom: isTopGroup && !exChange || isBottomGroup && exChange ? "-5px" : null
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
const getArrowClasses = () => {
|
|
143
|
+
const { placement, exChange, beforebgcolor } = props;
|
|
144
|
+
const classes = [ARROW_CLASSES.base, beforebgcolor];
|
|
145
|
+
if (PLACEMENT_GROUPS.top.includes(placement)) {
|
|
146
|
+
classes.push(exChange ? ARROW_CLASSES.top.exchange : ARROW_CLASSES.top.normal);
|
|
147
|
+
}
|
|
148
|
+
if (PLACEMENT_GROUPS.bottom.includes(placement)) {
|
|
149
|
+
classes.push(exChange ? ARROW_CLASSES.bottom.exchange : ARROW_CLASSES.bottom.normal);
|
|
150
|
+
}
|
|
151
|
+
if (placement === "centerright") {
|
|
152
|
+
classes.push(ARROW_CLASSES.center.right);
|
|
153
|
+
}
|
|
154
|
+
if (placement === "centerleft") {
|
|
155
|
+
classes.push(ARROW_CLASSES.center.left);
|
|
156
|
+
}
|
|
157
|
+
return classes;
|
|
158
|
+
};
|
|
159
|
+
if (!props.arrowshow)
|
|
160
|
+
return;
|
|
161
|
+
return () => h("span", {
|
|
162
|
+
class: normalizeClass(getArrowClasses()),
|
|
163
|
+
style: normalizeStyle(getArrowStyles())
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
const defaultWidth = "200px";
|
|
168
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
169
|
+
__name: "popover",
|
|
170
|
+
props: {
|
|
171
|
+
trigger: { default: "click" },
|
|
172
|
+
width: {},
|
|
173
|
+
placement: { default: "topleft" },
|
|
174
|
+
insertClass: {},
|
|
175
|
+
beforeHidden: {},
|
|
176
|
+
modelValue: { type: Boolean },
|
|
177
|
+
beforebgcolor: {},
|
|
178
|
+
arrowshow: { type: Boolean, default: true },
|
|
179
|
+
isselectMode: { type: Boolean, default: false }
|
|
180
|
+
},
|
|
181
|
+
emits: ["update:modelValue"],
|
|
182
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
183
|
+
const props = __props;
|
|
184
|
+
const base = ref();
|
|
185
|
+
const pop = ref();
|
|
186
|
+
const isLocalOpen = ref(false);
|
|
187
|
+
const shouldShow = computed(() => {
|
|
188
|
+
if (isLocalOpen.value || props.trigger === "native" && props.modelValue) {
|
|
189
|
+
nextTick(setPosition);
|
|
190
|
+
}
|
|
191
|
+
if (props.trigger === "native") {
|
|
192
|
+
return props.modelValue;
|
|
193
|
+
} else {
|
|
194
|
+
return isLocalOpen.value;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
const emitAct = __emit;
|
|
198
|
+
const marginClass = computed(() => {
|
|
199
|
+
const marginMap = {
|
|
200
|
+
topleft: "-mt-3",
|
|
201
|
+
topmiddle: "-mt-3",
|
|
202
|
+
topright: "-mt-3",
|
|
203
|
+
bottomleft: "mt-3",
|
|
204
|
+
bottommiddle: "mt-3",
|
|
205
|
+
bottomright: "mt-3",
|
|
206
|
+
centerleft: "-ml-3",
|
|
207
|
+
centerright: "ml-3"
|
|
208
|
+
};
|
|
209
|
+
return marginMap[props.placement];
|
|
210
|
+
});
|
|
211
|
+
const showHandle = () => {
|
|
212
|
+
isLocalOpen.value = true;
|
|
213
|
+
};
|
|
214
|
+
const hovershowHandle = () => {
|
|
215
|
+
if (props.trigger === "hover") {
|
|
216
|
+
isLocalOpen.value = true;
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
const Left = ref(0);
|
|
220
|
+
const Top = ref(0);
|
|
221
|
+
const arrowLeft = ref(0);
|
|
222
|
+
const arrowTop = ref(0);
|
|
223
|
+
const exChange = ref(false);
|
|
224
|
+
const setPosition = () => {
|
|
225
|
+
const { top, bottom } = base.value.getBoundingClientRect();
|
|
226
|
+
if (top < 0 || bottom > window.innerHeight) {
|
|
227
|
+
hideHandle();
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
const position = usePotion(base.value, pop.value, {
|
|
231
|
+
position: props.placement
|
|
232
|
+
});
|
|
233
|
+
Top.value = position.Top;
|
|
234
|
+
Left.value = position.Left;
|
|
235
|
+
arrowTop.value = position.arrowTop;
|
|
236
|
+
arrowLeft.value = position.arrowLeft;
|
|
237
|
+
exChange.value = position.exChange;
|
|
238
|
+
};
|
|
239
|
+
const vScroll = createScrollDirective({
|
|
240
|
+
onMove: () => {
|
|
241
|
+
if (shouldShow.value == false)
|
|
242
|
+
return;
|
|
243
|
+
setPosition();
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
const vClickoutside = createBgClickDirective({
|
|
247
|
+
onCheckOut: (event, el) => {
|
|
248
|
+
if (shouldShow.value == false)
|
|
249
|
+
return;
|
|
250
|
+
if (el.contains(event.target)) {
|
|
251
|
+
return;
|
|
252
|
+
} else if (base.value.contains(event.target)) {
|
|
253
|
+
return;
|
|
254
|
+
} else {
|
|
255
|
+
closeCenter();
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
moveModel: props.trigger === "hover"
|
|
259
|
+
});
|
|
260
|
+
const vEsc = createEscapeDirective({
|
|
261
|
+
onEscape: () => {
|
|
262
|
+
if (shouldShow.value == false)
|
|
263
|
+
return;
|
|
264
|
+
console.log("work");
|
|
265
|
+
hideHandle();
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
const closeCenter = () => {
|
|
269
|
+
if (props.beforeHidden) {
|
|
270
|
+
props.beforeHidden(hideHandle);
|
|
271
|
+
} else {
|
|
272
|
+
hideHandle();
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
const hideHandle = (disablecancelflag) => {
|
|
276
|
+
if (disablecancelflag === true) {
|
|
277
|
+
return;
|
|
278
|
+
} else {
|
|
279
|
+
if (props.trigger === "native") {
|
|
280
|
+
emitAct("update:modelValue", false);
|
|
281
|
+
} else {
|
|
282
|
+
isLocalOpen.value = false;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
const widthNum = computed(() => {
|
|
287
|
+
if (!props.width)
|
|
288
|
+
return defaultWidth;
|
|
289
|
+
if (typeof props.width === "number") {
|
|
290
|
+
return `${props.width}px`;
|
|
291
|
+
} else if (typeof props.width === "string") {
|
|
292
|
+
const validUnit = /^(?:\d+(?:\.\d+)?)(?:px|%|em|rem|vw|vh)$/.test(
|
|
293
|
+
props.width
|
|
294
|
+
);
|
|
295
|
+
return validUnit ? props.width : `${props.width}px`;
|
|
296
|
+
}
|
|
297
|
+
return defaultWidth;
|
|
298
|
+
});
|
|
299
|
+
__expose({
|
|
300
|
+
hideHandle
|
|
301
|
+
});
|
|
302
|
+
return (_ctx, _cache) => {
|
|
303
|
+
return openBlock(), createElementBlock("div", {
|
|
304
|
+
class: "inline-block w-full h-full",
|
|
305
|
+
ref_key: "base",
|
|
306
|
+
ref: base,
|
|
307
|
+
onClick: showHandle,
|
|
308
|
+
onMouseenter: withModifiers(hovershowHandle, ["prevent"])
|
|
309
|
+
}, [
|
|
310
|
+
renderSlot(_ctx.$slots, "reference"),
|
|
311
|
+
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
312
|
+
createVNode(Transition, { name: "opecity" }, {
|
|
313
|
+
default: withCtx(() => [
|
|
314
|
+
withDirectives((openBlock(), createElementBlock("div", {
|
|
315
|
+
ref_key: "pop",
|
|
316
|
+
ref: pop,
|
|
317
|
+
class: normalizeClass(["absolute z-1000 rounded bg-white p-4 drop-shadow border border-gray-300 box-border", [marginClass.value, _ctx.insertClass]]),
|
|
318
|
+
style: normalizeStyle({ width: widthNum.value, top: `${Top.value}px`, left: `${Left.value}px` })
|
|
319
|
+
}, [
|
|
320
|
+
renderSlot(_ctx.$slots, "default"),
|
|
321
|
+
createVNode(unref(arrowComponent), {
|
|
322
|
+
arrowLeft: arrowLeft.value,
|
|
323
|
+
arrowTop: arrowTop.value,
|
|
324
|
+
exChange: exChange.value,
|
|
325
|
+
beforebgcolor: _ctx.beforebgcolor,
|
|
326
|
+
placement: _ctx.placement,
|
|
327
|
+
arrowshow: _ctx.arrowshow
|
|
328
|
+
}, null, 8, ["arrowLeft", "arrowTop", "exChange", "beforebgcolor", "placement", "arrowshow"])
|
|
329
|
+
], 6)), [
|
|
330
|
+
[vShow, shouldShow.value],
|
|
331
|
+
[unref(vClickoutside)],
|
|
332
|
+
[unref(vEsc)],
|
|
333
|
+
[unref(vScroll)]
|
|
334
|
+
])
|
|
335
|
+
]),
|
|
336
|
+
_: 3
|
|
337
|
+
})
|
|
338
|
+
]))
|
|
339
|
+
], 544);
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
export {
|
|
344
|
+
_sfc_main as default
|
|
345
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { defineComponent, inject, ref, computed, openBlock, createElementBlock, normalizeClass, withDirectives, createElementVNode, vModelRadio, toDisplayString } from "vue";
|
|
2
|
+
const _hoisted_1 = ["value", "disabled"];
|
|
3
|
+
const _hoisted_2 = { class: "pl-2 peer-disabled:text-word9" };
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
__name: "radiobox",
|
|
6
|
+
props: {
|
|
7
|
+
label: {},
|
|
8
|
+
value: {},
|
|
9
|
+
modelValue: {},
|
|
10
|
+
disabled: { type: Boolean, default: false },
|
|
11
|
+
button: { type: Boolean }
|
|
12
|
+
},
|
|
13
|
+
emits: ["update:modelValue"],
|
|
14
|
+
setup(__props, { emit: __emit }) {
|
|
15
|
+
const props = __props;
|
|
16
|
+
const changeHandle = inject("_changeHandle_", (_) => {
|
|
17
|
+
});
|
|
18
|
+
const checkedValues = inject("_checkedValues_", ref());
|
|
19
|
+
const checkedState = computed({
|
|
20
|
+
get: () => {
|
|
21
|
+
return props.modelValue || (checkedValues == null ? void 0 : checkedValues.value);
|
|
22
|
+
},
|
|
23
|
+
set: (val) => {
|
|
24
|
+
emit("update:modelValue", val);
|
|
25
|
+
changeHandle(val);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const emit = __emit;
|
|
29
|
+
return (_ctx, _cache) => {
|
|
30
|
+
return openBlock(), createElementBlock("label", {
|
|
31
|
+
class: normalizeClass(["select-none inline-flex items-center", { "cursor-not-allowed": _ctx.disabled }])
|
|
32
|
+
}, [
|
|
33
|
+
withDirectives(createElementVNode("input", {
|
|
34
|
+
type: "radio",
|
|
35
|
+
value: _ctx.value,
|
|
36
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => checkedState.value = $event),
|
|
37
|
+
disabled: _ctx.disabled,
|
|
38
|
+
class: "peer disabled:cursor-not-allowed form-tick appearance-none h-4 w-4 rounded-full border border-gray-300 checked:border-transparent checked:bg-blue-600 focus:outline-none"
|
|
39
|
+
}, null, 8, _hoisted_1), [
|
|
40
|
+
[vModelRadio, checkedState.value]
|
|
41
|
+
]),
|
|
42
|
+
createElementVNode("span", _hoisted_2, toDisplayString(_ctx.label), 1)
|
|
43
|
+
], 2);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
export {
|
|
48
|
+
_sfc_main as default
|
|
49
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { defineComponent, inject, provide, computed, openBlock, createElementBlock, renderSlot } from "vue";
|
|
2
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3
|
+
__name: "radiogroup",
|
|
4
|
+
props: {
|
|
5
|
+
modelValue: {},
|
|
6
|
+
showinput: { type: Boolean, default: false },
|
|
7
|
+
disabled: { type: Boolean }
|
|
8
|
+
},
|
|
9
|
+
emits: ["update:modelValue", "change"],
|
|
10
|
+
setup(__props, { emit: __emit }) {
|
|
11
|
+
const props = __props;
|
|
12
|
+
const ParentGetChangeHandle = inject("changHandle", () => null);
|
|
13
|
+
const emit = __emit;
|
|
14
|
+
const changeHandle = (newVal) => {
|
|
15
|
+
emit("update:modelValue", newVal);
|
|
16
|
+
emit("change", newVal);
|
|
17
|
+
ParentGetChangeHandle(newVal);
|
|
18
|
+
};
|
|
19
|
+
provide("_changeHandle_", changeHandle);
|
|
20
|
+
provide(
|
|
21
|
+
"_checkedValues_",
|
|
22
|
+
computed(() => props.modelValue)
|
|
23
|
+
);
|
|
24
|
+
return (_ctx, _cache) => {
|
|
25
|
+
return openBlock(), createElementBlock("div", null, [
|
|
26
|
+
renderSlot(_ctx.$slots, "default")
|
|
27
|
+
]);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
export {
|
|
32
|
+
_sfc_main as default
|
|
33
|
+
};
|
|
@@ -0,0 +1,252 @@
|
|
|
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-b4e420ce.js";
|
|
3
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
4
|
+
__name: "movebar",
|
|
5
|
+
props: {
|
|
6
|
+
vertical: { type: Boolean, default: false },
|
|
7
|
+
move: {},
|
|
8
|
+
size: {},
|
|
9
|
+
parent: {}
|
|
10
|
+
},
|
|
11
|
+
setup(__props) {
|
|
12
|
+
const props = __props;
|
|
13
|
+
const BAR_MAP = {
|
|
14
|
+
// 垂直滚动块的属性
|
|
15
|
+
vertical: {
|
|
16
|
+
offset: "offsetHeight",
|
|
17
|
+
scroll: "scrollTop",
|
|
18
|
+
scrollSize: "scrollHeight",
|
|
19
|
+
size: "height",
|
|
20
|
+
key: "vertical",
|
|
21
|
+
axis: "Y",
|
|
22
|
+
client: "clientY",
|
|
23
|
+
direction: "top"
|
|
24
|
+
},
|
|
25
|
+
// 水平滚动块的属性
|
|
26
|
+
horizontal: {
|
|
27
|
+
offset: "offsetWidth",
|
|
28
|
+
scroll: "scrollLeft",
|
|
29
|
+
scrollSize: "scrollWidth",
|
|
30
|
+
size: "width",
|
|
31
|
+
key: "horizontal",
|
|
32
|
+
axis: "X",
|
|
33
|
+
client: "clientX",
|
|
34
|
+
direction: "left"
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const el = ref();
|
|
38
|
+
const thumb = ref();
|
|
39
|
+
const bar = computed(() => {
|
|
40
|
+
return BAR_MAP[props.vertical ? "vertical" : "horizontal"];
|
|
41
|
+
});
|
|
42
|
+
const wrap = computed(() => props.parent);
|
|
43
|
+
let baraxis = 0;
|
|
44
|
+
const clickTrackHandler = (e) => {
|
|
45
|
+
const offset = Math.abs(
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]
|
|
48
|
+
);
|
|
49
|
+
const thumbHalf = thumb.value[bar.value.offset] / 2;
|
|
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;
|
|
56
|
+
};
|
|
57
|
+
const clickThumbHandler = (e) => {
|
|
58
|
+
if (e.ctrlKey || e.button === 2) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
startDrag(e);
|
|
62
|
+
baraxis = // @ts-ignore
|
|
63
|
+
// 滑块的高度
|
|
64
|
+
e.currentTarget[bar.value.offset] - // 点击滑块距离顶部的位置 减去 滑块元素距离顶部的位置
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
(e[bar.value.client] - // @ts-ignore
|
|
67
|
+
e.currentTarget.getBoundingClientRect()[bar.value.direction]);
|
|
68
|
+
};
|
|
69
|
+
const cursorDown = ref(false);
|
|
70
|
+
const startDrag = (e) => {
|
|
71
|
+
e.stopImmediatePropagation();
|
|
72
|
+
cursorDown.value = true;
|
|
73
|
+
on(document, "mousemove", mouseMoveDocumentHandler);
|
|
74
|
+
on(document, "mouseup", mouseUpDocumentHandler);
|
|
75
|
+
document.onselectstart = () => false;
|
|
76
|
+
};
|
|
77
|
+
const mouseMoveDocumentHandler = (e) => {
|
|
78
|
+
if (cursorDown.value === false)
|
|
79
|
+
return;
|
|
80
|
+
const prevPage = baraxis;
|
|
81
|
+
if (!prevPage)
|
|
82
|
+
return;
|
|
83
|
+
const offset = (
|
|
84
|
+
// @ts-ignore
|
|
85
|
+
(el.value.getBoundingClientRect()[bar.value.direction] - // @ts-ignore
|
|
86
|
+
e[bar.value.client]) * -1
|
|
87
|
+
);
|
|
88
|
+
const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
|
|
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;
|
|
95
|
+
};
|
|
96
|
+
const mouseUpDocumentHandler = () => {
|
|
97
|
+
cursorDown.value = false;
|
|
98
|
+
baraxis = 0;
|
|
99
|
+
off(document, "mousemove", mouseMoveDocumentHandler);
|
|
100
|
+
document.onselectstart = null;
|
|
101
|
+
};
|
|
102
|
+
const renderThumbstyle = () => {
|
|
103
|
+
const style = {};
|
|
104
|
+
const translate = `translate${bar.value.axis}(${props.move}%)`;
|
|
105
|
+
style[bar.value.size] = props.size;
|
|
106
|
+
style.transform = translate;
|
|
107
|
+
style.msTransform = translate;
|
|
108
|
+
style.webkitTransform = translate;
|
|
109
|
+
return style;
|
|
110
|
+
};
|
|
111
|
+
return (_ctx, _cache) => {
|
|
112
|
+
return openBlock(), createElementBlock("div", {
|
|
113
|
+
onMousedown: clickTrackHandler,
|
|
114
|
+
ref_key: "el",
|
|
115
|
+
ref: el,
|
|
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"]])
|
|
117
|
+
}, [
|
|
118
|
+
createElementVNode("div", {
|
|
119
|
+
onMousedown: clickThumbHandler,
|
|
120
|
+
ref_key: "thumb",
|
|
121
|
+
ref: thumb,
|
|
122
|
+
class: normalizeClass([_ctx.vertical ? "w-full" : "h-full", "bg-[#9092984d] cursor-pointer rounded"]),
|
|
123
|
+
style: normalizeStyle(renderThumbstyle())
|
|
124
|
+
}, null, 38)
|
|
125
|
+
], 34);
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
const _hoisted_1 = {
|
|
130
|
+
key: 0,
|
|
131
|
+
class: "group/scroll relative h-full overflow-hidden"
|
|
132
|
+
};
|
|
133
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
134
|
+
__name: "scrollBar",
|
|
135
|
+
props: {
|
|
136
|
+
native: { type: Boolean, default: false },
|
|
137
|
+
height: {},
|
|
138
|
+
maxHeight: {}
|
|
139
|
+
},
|
|
140
|
+
setup(__props, { expose: __expose }) {
|
|
141
|
+
const props = __props;
|
|
142
|
+
const warpStyle = computed(() => {
|
|
143
|
+
return {
|
|
144
|
+
maxHeight: props.maxHeight,
|
|
145
|
+
height: props.height
|
|
146
|
+
};
|
|
147
|
+
});
|
|
148
|
+
const wrap = ref();
|
|
149
|
+
const contentBox = ref();
|
|
150
|
+
const moveX = ref(0);
|
|
151
|
+
const moveY = ref(0);
|
|
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
|
+
});
|
|
167
|
+
const handleScroll = () => {
|
|
168
|
+
moveY.value = wrap.value.scrollTop / wrap.value.clientHeight * 100;
|
|
169
|
+
moveX.value = wrap.value.scrollLeft / wrap.value.clientWidth * 100;
|
|
170
|
+
};
|
|
171
|
+
const update = () => {
|
|
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
|
+
}
|
|
177
|
+
};
|
|
178
|
+
const { observe, unobserve } = useResizeObserver(update);
|
|
179
|
+
onMounted(() => {
|
|
180
|
+
if (props.native)
|
|
181
|
+
return;
|
|
182
|
+
contentBox.value && observe(contentBox.value);
|
|
183
|
+
});
|
|
184
|
+
onUnmounted(() => {
|
|
185
|
+
if (props.native)
|
|
186
|
+
return;
|
|
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
|
|
212
|
+
});
|
|
213
|
+
return (_ctx, _cache) => {
|
|
214
|
+
return !_ctx.native ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
215
|
+
createElementVNode("div", {
|
|
216
|
+
ref_key: "wrap",
|
|
217
|
+
ref: wrap,
|
|
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)
|
|
223
|
+
}, [
|
|
224
|
+
createElementVNode("div", {
|
|
225
|
+
ref_key: "contentBox",
|
|
226
|
+
ref: contentBox
|
|
227
|
+
}, [
|
|
228
|
+
renderSlot(_ctx.$slots, "default")
|
|
229
|
+
], 512)
|
|
230
|
+
], 36),
|
|
231
|
+
hasHor.value ? (openBlock(), createBlock(_sfc_main$1, {
|
|
232
|
+
key: 0,
|
|
233
|
+
move: moveX.value,
|
|
234
|
+
size: sizeWidth.value,
|
|
235
|
+
parent: wrap.value,
|
|
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,
|
|
240
|
+
vertical: "",
|
|
241
|
+
move: moveY.value,
|
|
242
|
+
size: sizeHeight.value,
|
|
243
|
+
parent: wrap.value,
|
|
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 });
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
export {
|
|
251
|
+
_sfc_main as default
|
|
252
|
+
};
|