ninemoon-ui 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/dist/badge.css +27 -0
- package/dist/carousel.css +13 -0
- package/dist/checkgroup.css +41 -0
- package/dist/components/alert/alert.d.ts +11 -0
- package/dist/components/alert/alertcomponent.vue.d.ts +12 -0
- package/dist/components/badge/badge.vue.d.ts +38 -0
- package/dist/components/carousel/carousel.vue.d.ts +10 -0
- package/dist/components/carousel/carouselitem.vue.d.ts +9 -0
- package/dist/components/check/checkbox.vue.d.ts +25 -0
- package/dist/components/check/checkgroup.vue.d.ts +25 -0
- package/dist/components/date/datepicker.vue.d.ts +21 -0
- package/dist/components/date/datepickerRange.vue.d.ts +14 -0
- package/dist/components/date/getcalendar.d.ts +11 -0
- package/dist/components/dialog/dialog.vue.d.ts +79 -0
- package/dist/components/form/form.vue.d.ts +54 -0
- package/dist/components/form/formlabel.vue.d.ts +44 -0
- package/dist/components/image/image.vue.d.ts +38 -0
- package/dist/components/input/input.vue.d.ts +65 -0
- package/dist/components/loadding/loadcomponent.vue.d.ts +5 -0
- package/dist/components/loadding/loadding.d.ts +22 -0
- package/dist/components/menu/menu.vue.d.ts +14 -0
- package/dist/components/message/message.d.ts +18 -0
- package/dist/components/message/messagecomponent.vue.d.ts +17 -0
- package/dist/components/numberInput/numberinput.vue.d.ts +64 -0
- package/dist/components/pagination/pagination.vue.d.ts +31 -0
- package/dist/components/popover/popover.vue.d.ts +59 -0
- package/dist/components/radio/radiobox.vue.d.ts +25 -0
- package/dist/components/radio/radiogroup.vue.d.ts +25 -0
- package/dist/components/scrollBar/movebar.vue.d.ts +38 -0
- package/dist/components/scrollBar/scrollBar.vue.d.ts +48 -0
- package/dist/components/scrollloading/scrolllead.d.ts +20 -0
- package/dist/components/select/select.vue.d.ts +43 -0
- package/dist/components/select/selectoption.vue.d.ts +25 -0
- package/dist/components/switch/switch.vue.d.ts +49 -0
- package/dist/components/table/table.vue.d.ts +61 -0
- package/dist/components/table/tableItem.vue.d.ts +66 -0
- package/dist/components/tabs/tabs.vue.d.ts +30 -0
- package/dist/components/tabs/tabsPane.vue.d.ts +19 -0
- package/dist/components/tree/tree.vue.d.ts +47 -0
- package/dist/components/upload/upload.vue.d.ts +65 -0
- package/dist/components/utils/tool.d.ts +44 -0
- package/dist/datepickerRange.css +79 -0
- package/dist/image.css +8 -0
- package/dist/index.css +816 -0
- package/dist/index.d.ts +2787 -0
- package/dist/index.es.js +37 -0
- package/dist/index.umd.js +5930 -0
- package/dist/js/badge/badge.js +46 -0
- package/dist/js/carousel/carousel.js +196 -0
- package/dist/js/carousel/carouselitem.js +16 -0
- package/dist/js/check/checkbox.js +16 -0
- package/dist/js/check/checkgroup.js +91 -0
- package/dist/js/date/datepicker.js +373 -0
- package/dist/js/date/datepickerRange.js +579 -0
- package/dist/js/dialog/dialog.js +140 -0
- package/dist/js/form/form.js +85 -0
- package/dist/js/form/formlabel.js +167 -0
- package/dist/js/getcalendar/getcalendar.js +48 -0
- package/dist/js/image/image.js +259 -0
- package/dist/js/index/index.js +801 -0
- package/dist/js/input/input.js +91 -0
- package/dist/js/menu/menu.js +58 -0
- package/dist/js/numberInput/numberinput.js +145 -0
- package/dist/js/pagination/pagination.js +259 -0
- package/dist/js/popover/popover.js +193 -0
- package/dist/js/radio/radiobox.js +16 -0
- package/dist/js/radio/radiogroup.js +99 -0
- package/dist/js/scrollBar/scrollBar.js +208 -0
- package/dist/js/select/select.js +133 -0
- package/dist/js/select/selectoption.js +16 -0
- package/dist/js/switch/switch.js +49 -0
- package/dist/js/table/table.js +203 -0
- package/dist/js/table/tableItem.js +25 -0
- package/dist/js/tabs/tabs.js +164 -0
- package/dist/js/tabs/tabsPane.js +17 -0
- package/dist/js/tree/tree.js +72 -0
- package/dist/js/tree/treeleaf.js +118 -0
- package/dist/js/upload/upload.js +108 -0
- package/dist/radiogroup.css +44 -0
- package/dist/scrollBar.css +37 -0
- package/dist/select.css +20 -0
- package/dist/tabs.css +77 -0
- package/package.json +37 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, watch, nextTick, openBlock, createElementBlock, withModifiers, renderSlot, createBlock, Teleport, createVNode, Transition, withCtx, withDirectives, normalizeClass, normalizeStyle, createCommentVNode } from "vue";
|
|
2
|
+
import { u as usePotion, t as throttle } from "../index/index.js";
|
|
3
|
+
const _hoisted_1 = ["onMouseenter"];
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
__name: "popover",
|
|
6
|
+
props: {
|
|
7
|
+
trigger: { default: "click" },
|
|
8
|
+
width: {},
|
|
9
|
+
placement: { default: "topleft" },
|
|
10
|
+
insertClass: {},
|
|
11
|
+
beforeHidden: {},
|
|
12
|
+
modelValue: { type: Boolean }
|
|
13
|
+
},
|
|
14
|
+
emits: ["update:modelValue"],
|
|
15
|
+
setup(__props, { expose: __expose, emit: emitAct }) {
|
|
16
|
+
const props = __props;
|
|
17
|
+
const base = ref();
|
|
18
|
+
const pop = ref();
|
|
19
|
+
const showPop = ref(false);
|
|
20
|
+
const showPopFlag = computed(() => {
|
|
21
|
+
if (props.trigger === "native") {
|
|
22
|
+
return props.modelValue;
|
|
23
|
+
} else {
|
|
24
|
+
return showPop.value;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const marginClass = computed(() => {
|
|
28
|
+
let margin = "";
|
|
29
|
+
switch (props.placement) {
|
|
30
|
+
case "topleft":
|
|
31
|
+
case "topmiddle":
|
|
32
|
+
case "topright":
|
|
33
|
+
margin = "-mt-3";
|
|
34
|
+
break;
|
|
35
|
+
case "bottomleft":
|
|
36
|
+
case "bottommiddle":
|
|
37
|
+
case "bottomright":
|
|
38
|
+
margin = "mt-3";
|
|
39
|
+
break;
|
|
40
|
+
case "centerleft":
|
|
41
|
+
margin = "-ml-3";
|
|
42
|
+
break;
|
|
43
|
+
case "centerright":
|
|
44
|
+
margin = "ml-3";
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
return margin;
|
|
48
|
+
});
|
|
49
|
+
const showHandle = () => {
|
|
50
|
+
showPop.value = true;
|
|
51
|
+
};
|
|
52
|
+
const hovershowHandle = () => {
|
|
53
|
+
if (props.trigger === "hover") {
|
|
54
|
+
showPop.value = true;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const Left = ref(0);
|
|
58
|
+
const Top = ref(0);
|
|
59
|
+
watch(showPopFlag, (n) => {
|
|
60
|
+
if (n === true) {
|
|
61
|
+
nextTick(() => {
|
|
62
|
+
setPosition();
|
|
63
|
+
nextTick(() => {
|
|
64
|
+
if (props.trigger === "hover")
|
|
65
|
+
return;
|
|
66
|
+
window.addEventListener("resize", setPosition);
|
|
67
|
+
window.addEventListener("scroll", setPosition, true);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
} else {
|
|
71
|
+
window.removeEventListener("resize", setPosition);
|
|
72
|
+
window.removeEventListener("scroll", setPosition, true);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
const setPosition = () => {
|
|
76
|
+
let { top, bottom } = base.value.getBoundingClientRect();
|
|
77
|
+
if (top < 0 || bottom > window.innerHeight) {
|
|
78
|
+
if (props.trigger === "native") {
|
|
79
|
+
emitAct("update:modelValue", false);
|
|
80
|
+
} else {
|
|
81
|
+
showPop.value = false;
|
|
82
|
+
}
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const position = usePotion(base.value, pop.value, {
|
|
86
|
+
position: props.placement
|
|
87
|
+
});
|
|
88
|
+
Top.value = position.Top;
|
|
89
|
+
Left.value = position.Left;
|
|
90
|
+
};
|
|
91
|
+
const vClickoutside = {
|
|
92
|
+
mounted(el, binding) {
|
|
93
|
+
function documentHandler(e) {
|
|
94
|
+
if ((el == null ? void 0 : el.contains) && (el == null ? void 0 : el.contains(e.target))) {
|
|
95
|
+
return false;
|
|
96
|
+
} else if (base.value.contains(e.target)) {
|
|
97
|
+
return false;
|
|
98
|
+
} else {
|
|
99
|
+
binding.value && binding.value(e);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
el._vueClickOutside_ = throttle(documentHandler, 100);
|
|
103
|
+
document.addEventListener("click", el._vueClickOutside_);
|
|
104
|
+
switch (props.trigger) {
|
|
105
|
+
case "hover":
|
|
106
|
+
document.addEventListener("mousemove", el._vueClickOutside_);
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
beforeUnmount(el) {
|
|
111
|
+
document.removeEventListener("click", el._vueClickOutside_);
|
|
112
|
+
switch (props.trigger) {
|
|
113
|
+
case "hover":
|
|
114
|
+
document.removeEventListener("mousemove", el._vueClickOutside_);
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
delete el._vueClickOutside_;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const closeCenter = () => {
|
|
121
|
+
if (props.beforeHidden) {
|
|
122
|
+
props.beforeHidden(hideHandle);
|
|
123
|
+
} else {
|
|
124
|
+
hideHandle();
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const hideHandle = (disablecancelflag) => {
|
|
128
|
+
if (disablecancelflag === true) {
|
|
129
|
+
return;
|
|
130
|
+
} else {
|
|
131
|
+
if (props.trigger === "native") {
|
|
132
|
+
emitAct("update:modelValue", false);
|
|
133
|
+
} else {
|
|
134
|
+
showPop.value = false;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
const widthNum = computed(() => {
|
|
139
|
+
if (typeof props.width === "number") {
|
|
140
|
+
return `${props.width}px`;
|
|
141
|
+
} else if (typeof props.width === "string") {
|
|
142
|
+
const defaultCheckArr = ["em", "px", "rem", "%"];
|
|
143
|
+
if (defaultCheckArr.some((i) => props.width.includes(i))) {
|
|
144
|
+
return props.width;
|
|
145
|
+
} else if (isNaN(Number(props.width))) {
|
|
146
|
+
return "200px";
|
|
147
|
+
} else {
|
|
148
|
+
return `${Number(props.width)}px`;
|
|
149
|
+
}
|
|
150
|
+
} else {
|
|
151
|
+
return "200px";
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
__expose({
|
|
155
|
+
hideHandle
|
|
156
|
+
});
|
|
157
|
+
return (_ctx, _cache) => {
|
|
158
|
+
return openBlock(), createElementBlock("div", {
|
|
159
|
+
class: "tdd-inline-block",
|
|
160
|
+
ref_key: "base",
|
|
161
|
+
ref: base,
|
|
162
|
+
onClick: showHandle,
|
|
163
|
+
onMouseenter: withModifiers(hovershowHandle, ["prevent"])
|
|
164
|
+
}, [
|
|
165
|
+
renderSlot(_ctx.$slots, "reference"),
|
|
166
|
+
(openBlock(), createBlock(Teleport, {
|
|
167
|
+
to: "body",
|
|
168
|
+
disabled: !showPopFlag.value
|
|
169
|
+
}, [
|
|
170
|
+
createVNode(Transition, { name: "opecity" }, {
|
|
171
|
+
default: withCtx(() => [
|
|
172
|
+
showPopFlag.value ? withDirectives((openBlock(), createElementBlock("div", {
|
|
173
|
+
key: 0,
|
|
174
|
+
ref_key: "pop",
|
|
175
|
+
ref: pop,
|
|
176
|
+
class: normalizeClass(["tdd-absolute tdd-z-1000 tdd-rounded tdd-bg-white tdd-p-4 tdd-drop-shadow", [marginClass.value, _ctx.insertClass]]),
|
|
177
|
+
style: normalizeStyle({ width: widthNum.value, top: `${Top.value}px`, left: `${Left.value}px` })
|
|
178
|
+
}, [
|
|
179
|
+
renderSlot(_ctx.$slots, "default")
|
|
180
|
+
], 6)), [
|
|
181
|
+
[vClickoutside, closeCenter]
|
|
182
|
+
]) : createCommentVNode("", true)
|
|
183
|
+
]),
|
|
184
|
+
_: 3
|
|
185
|
+
})
|
|
186
|
+
], 8, ["disabled"]))
|
|
187
|
+
], 40, _hoisted_1);
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
export {
|
|
192
|
+
_sfc_main as default
|
|
193
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineComponent, renderSlot } from "vue";
|
|
2
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3
|
+
__name: "radiobox",
|
|
4
|
+
props: {
|
|
5
|
+
label: {},
|
|
6
|
+
class: {}
|
|
7
|
+
},
|
|
8
|
+
setup(__props) {
|
|
9
|
+
return (_ctx, _cache) => {
|
|
10
|
+
return renderSlot(_ctx.$slots, "default");
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
export {
|
|
15
|
+
_sfc_main as default
|
|
16
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { defineComponent, inject, useSlots, openBlock, createBlock, h, withDirectives, vModelRadio } from "vue";
|
|
2
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3
|
+
__name: "radiogroup",
|
|
4
|
+
props: {
|
|
5
|
+
modelValue: {},
|
|
6
|
+
showinput: { type: Boolean, default: false }
|
|
7
|
+
},
|
|
8
|
+
emits: ["update:modelValue", "change"],
|
|
9
|
+
setup(__props, { emit }) {
|
|
10
|
+
const props = __props;
|
|
11
|
+
const ParentGetChangeHandle = inject("changHandle", () => null);
|
|
12
|
+
const slots = useSlots();
|
|
13
|
+
const renderBoxs = () => {
|
|
14
|
+
return h(
|
|
15
|
+
"div",
|
|
16
|
+
{},
|
|
17
|
+
slots.default().map((MySlot) => {
|
|
18
|
+
var _a, _b;
|
|
19
|
+
if (MySlot.type.toString().includes("Symbol")) {
|
|
20
|
+
if (MySlot.children && MySlot.children instanceof Array) {
|
|
21
|
+
return MySlot.children.map((trueSlot) => {
|
|
22
|
+
var _a2;
|
|
23
|
+
return h(
|
|
24
|
+
"label",
|
|
25
|
+
{
|
|
26
|
+
class: "radioGroup " + // @ts-ignore
|
|
27
|
+
(trueSlot.props.class || "") + // @ts-ignore
|
|
28
|
+
(props.modelValue == trueSlot.props.label ? " tdd-bg-wordblue" : "")
|
|
29
|
+
},
|
|
30
|
+
[
|
|
31
|
+
withDirectives(
|
|
32
|
+
h("input", {
|
|
33
|
+
type: "radio",
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
value: trueSlot.props.label,
|
|
36
|
+
"onUpdate:modelValue": (value) => {
|
|
37
|
+
ParentGetChangeHandle(value);
|
|
38
|
+
emit("update:modelValue", value);
|
|
39
|
+
},
|
|
40
|
+
class: "hiddeninput form-tick" + // @ts-ignore
|
|
41
|
+
(props.showinput ? "" : " tdd-hidden")
|
|
42
|
+
}),
|
|
43
|
+
[[vModelRadio, props.modelValue]]
|
|
44
|
+
),
|
|
45
|
+
h(
|
|
46
|
+
"span",
|
|
47
|
+
{
|
|
48
|
+
class: "tdd-text-sm " + // @ts-ignore
|
|
49
|
+
(props.modelValue == trueSlot.props.label ? " tdd-text-white" : " tdd-text-word6")
|
|
50
|
+
},
|
|
51
|
+
// @ts-ignore
|
|
52
|
+
((_a2 = trueSlot.children) == null ? void 0 : _a2.default()) || trueSlot.props.label
|
|
53
|
+
)
|
|
54
|
+
]
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
return h(
|
|
60
|
+
"label",
|
|
61
|
+
{
|
|
62
|
+
class: "radioGroup " + (((_a = MySlot.props) == null ? void 0 : _a.class) || "") + (props.modelValue == MySlot.props.label ? " tdd-bg-wordblue" : "")
|
|
63
|
+
},
|
|
64
|
+
[
|
|
65
|
+
withDirectives(
|
|
66
|
+
h("input", {
|
|
67
|
+
type: "radio",
|
|
68
|
+
value: MySlot.props.label,
|
|
69
|
+
"onUpdate:modelValue": (value) => {
|
|
70
|
+
ParentGetChangeHandle(value);
|
|
71
|
+
emit("update:modelValue", value);
|
|
72
|
+
},
|
|
73
|
+
class: "hiddeninput form-tick" + (props.showinput ? "" : " tdd-hidden")
|
|
74
|
+
}),
|
|
75
|
+
[[vModelRadio, props.modelValue]]
|
|
76
|
+
),
|
|
77
|
+
h(
|
|
78
|
+
"span",
|
|
79
|
+
{
|
|
80
|
+
class: "tdd-text-sm " + (props.modelValue == MySlot.props.label ? " tdd-text-white" : " tdd-text-word6")
|
|
81
|
+
},
|
|
82
|
+
// @ts-ignore
|
|
83
|
+
((_b = MySlot.children) == null ? void 0 : _b.default()) || MySlot.props.label
|
|
84
|
+
)
|
|
85
|
+
]
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
return (_ctx, _cache) => {
|
|
92
|
+
return openBlock(), createBlock(renderBoxs);
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
const radiogroup_vue_vue_type_style_index_0_lang = "";
|
|
97
|
+
export {
|
|
98
|
+
_sfc_main as default
|
|
99
|
+
};
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, onMounted, nextTick, onUnmounted, renderSlot, createVNode } from "vue";
|
|
2
|
+
import { o as on, a as off, b as getScrollWidth, c as addResizeListener, r as removeResizeListener } from "../index/index.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 = (offset - thumbHalf) * 100 / el.value[bar.value.offset];
|
|
51
|
+
wrap.value[bar.value.scroll] = thumbPositionPercentage * wrap.value[bar.value.scrollSize] / 100;
|
|
52
|
+
};
|
|
53
|
+
const clickThumbHandler = (e) => {
|
|
54
|
+
if (e.ctrlKey || e.button === 2) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
startDrag(e);
|
|
58
|
+
baraxis = // @ts-ignore
|
|
59
|
+
// 滑块的高度
|
|
60
|
+
e.currentTarget[bar.value.offset] - // 点击滑块距离顶部的位置 减去 滑块元素距离顶部的位置
|
|
61
|
+
// @ts-ignore
|
|
62
|
+
(e[bar.value.client] - e.currentTarget.getBoundingClientRect()[bar.value.direction]);
|
|
63
|
+
};
|
|
64
|
+
const cursorDown = ref(false);
|
|
65
|
+
const startDrag = (e) => {
|
|
66
|
+
e.stopImmediatePropagation();
|
|
67
|
+
cursorDown.value = true;
|
|
68
|
+
on(document, "mousemove", mouseMoveDocumentHandler);
|
|
69
|
+
on(document, "mouseup", mouseUpDocumentHandler);
|
|
70
|
+
document.onselectstart = () => false;
|
|
71
|
+
};
|
|
72
|
+
const mouseMoveDocumentHandler = (e) => {
|
|
73
|
+
if (cursorDown.value === false)
|
|
74
|
+
return;
|
|
75
|
+
const prevPage = baraxis;
|
|
76
|
+
if (!prevPage)
|
|
77
|
+
return;
|
|
78
|
+
const offset = (el.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
|
|
79
|
+
const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
|
|
80
|
+
const thumbPositionPercentage = (offset - thumbClickPosition) * 100 / el.value[bar.value.offset];
|
|
81
|
+
wrap.value[bar.value.scroll] = thumbPositionPercentage * wrap.value[bar.value.scrollSize] / 100;
|
|
82
|
+
};
|
|
83
|
+
const mouseUpDocumentHandler = () => {
|
|
84
|
+
cursorDown.value = false;
|
|
85
|
+
baraxis = 0;
|
|
86
|
+
off(document, "mousemove", mouseMoveDocumentHandler);
|
|
87
|
+
document.onselectstart = null;
|
|
88
|
+
};
|
|
89
|
+
const renderThumbstyle = () => {
|
|
90
|
+
const style = {};
|
|
91
|
+
const translate = `translate${bar.value.axis}(${props.move}%)`;
|
|
92
|
+
style[bar.value.size] = props.size;
|
|
93
|
+
style.transform = translate;
|
|
94
|
+
style.msTransform = translate;
|
|
95
|
+
style.webkitTransform = translate;
|
|
96
|
+
return style;
|
|
97
|
+
};
|
|
98
|
+
return (_ctx, _cache) => {
|
|
99
|
+
return openBlock(), createElementBlock("div", {
|
|
100
|
+
onMousedown: clickTrackHandler,
|
|
101
|
+
ref_key: "el",
|
|
102
|
+
ref: el,
|
|
103
|
+
class: normalizeClass(["tdd-absolute tdd-right-0.5 tdd-bottom-0.5 tdd-rounded tdd-transition-transform", [
|
|
104
|
+
_ctx.vertical ? "isver" : "ishor"
|
|
105
|
+
]])
|
|
106
|
+
}, [
|
|
107
|
+
createElementVNode("div", {
|
|
108
|
+
onMousedown: clickThumbHandler,
|
|
109
|
+
ref_key: "thumb",
|
|
110
|
+
ref: thumb,
|
|
111
|
+
class: "thumb",
|
|
112
|
+
style: normalizeStyle(renderThumbstyle())
|
|
113
|
+
}, null, 36)
|
|
114
|
+
], 34);
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
const _hoisted_1 = {
|
|
119
|
+
key: 1,
|
|
120
|
+
class: "tdd-group/scroll tdd-relative tdd-h-full tdd-w-full tdd-overflow-hidden pageScroll"
|
|
121
|
+
};
|
|
122
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
123
|
+
__name: "scrollBar",
|
|
124
|
+
props: {
|
|
125
|
+
native: { type: Boolean, default: false },
|
|
126
|
+
noresize: { type: Boolean, default: false },
|
|
127
|
+
vertical: { type: Boolean, default: false },
|
|
128
|
+
isSelectdom: { type: Boolean, default: false }
|
|
129
|
+
},
|
|
130
|
+
setup(__props) {
|
|
131
|
+
const props = __props;
|
|
132
|
+
const marginnum = ref(0);
|
|
133
|
+
onMounted(() => {
|
|
134
|
+
if (props.native)
|
|
135
|
+
return;
|
|
136
|
+
marginnum.value = getScrollWidth();
|
|
137
|
+
});
|
|
138
|
+
const wrap = ref();
|
|
139
|
+
const resize = ref();
|
|
140
|
+
const moveX = ref(0);
|
|
141
|
+
const moveY = ref(0);
|
|
142
|
+
const sizeHeight = ref("");
|
|
143
|
+
const sizeWidth = ref("");
|
|
144
|
+
const handleScroll = () => {
|
|
145
|
+
moveY.value = wrap.value.scrollTop / wrap.value.clientHeight * 100;
|
|
146
|
+
moveX.value = wrap.value.scrollLeft / wrap.value.clientWidth * 100;
|
|
147
|
+
};
|
|
148
|
+
const update = () => {
|
|
149
|
+
let heightPercentage, widthPercentage;
|
|
150
|
+
if (!wrap.value)
|
|
151
|
+
return;
|
|
152
|
+
heightPercentage = wrap.value.clientHeight * 100 / wrap.value.scrollHeight;
|
|
153
|
+
widthPercentage = wrap.value.clientWidth * 100 / wrap.value.scrollWidth;
|
|
154
|
+
sizeHeight.value = heightPercentage < 100 ? heightPercentage + "%" : "";
|
|
155
|
+
sizeWidth.value = widthPercentage < 100 ? widthPercentage + "%" : "";
|
|
156
|
+
};
|
|
157
|
+
onMounted(() => {
|
|
158
|
+
if (props.native)
|
|
159
|
+
return;
|
|
160
|
+
nextTick(() => update);
|
|
161
|
+
!props.noresize && addResizeListener(resize.value, update);
|
|
162
|
+
});
|
|
163
|
+
onUnmounted(() => {
|
|
164
|
+
if (props.native)
|
|
165
|
+
return;
|
|
166
|
+
!props.noresize && removeResizeListener(resize.value, update);
|
|
167
|
+
});
|
|
168
|
+
return (_ctx, _cache) => {
|
|
169
|
+
return _ctx.native ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
170
|
+
createElementVNode("div", {
|
|
171
|
+
ref_key: "wrap",
|
|
172
|
+
ref: wrap,
|
|
173
|
+
onScroll: handleScroll,
|
|
174
|
+
class: normalizeClass([{ "tdd-max-h-[300px]": _ctx.isSelectdom }, "tddScroll tdd-h-full tdd-overscroll-contain tdd-overflow-scroll"]),
|
|
175
|
+
style: normalizeStyle({
|
|
176
|
+
marginRight: `-${marginnum.value}px`,
|
|
177
|
+
marginBottom: `-${marginnum.value}px`
|
|
178
|
+
})
|
|
179
|
+
}, [
|
|
180
|
+
createElementVNode("div", {
|
|
181
|
+
ref_key: "resize",
|
|
182
|
+
ref: resize,
|
|
183
|
+
class: "block"
|
|
184
|
+
}, [
|
|
185
|
+
renderSlot(_ctx.$slots, "default")
|
|
186
|
+
], 512)
|
|
187
|
+
], 38),
|
|
188
|
+
createVNode(_sfc_main$1, {
|
|
189
|
+
move: moveX.value,
|
|
190
|
+
size: sizeWidth.value,
|
|
191
|
+
parent: wrap.value,
|
|
192
|
+
class: "tdd-opacity-0 group-hover/scroll:tdd-opacity-100"
|
|
193
|
+
}, null, 8, ["move", "size", "parent"]),
|
|
194
|
+
createVNode(_sfc_main$1, {
|
|
195
|
+
vertical: "",
|
|
196
|
+
move: moveY.value,
|
|
197
|
+
size: sizeHeight.value,
|
|
198
|
+
parent: wrap.value,
|
|
199
|
+
class: "tdd-opacity-0 group-hover/scroll:tdd-opacity-100"
|
|
200
|
+
}, null, 8, ["move", "size", "parent"])
|
|
201
|
+
]));
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
const scrollBar_vue_vue_type_style_index_0_lang = "";
|
|
206
|
+
export {
|
|
207
|
+
_sfc_main as default
|
|
208
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { defineComponent, defineAsyncComponent, inject, useSlots, ref, computed, watch, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, h } from "vue";
|
|
2
|
+
const _hoisted_1 = { class: "tdd-absolute tdd-z-2000 tdd-rounded-sm tdd-bg-white tdd-text-sm tdd-drop-shadow tdd-mt-1" };
|
|
3
|
+
const _hoisted_2 = ["value", "disabled", "readonly", "placeholder"];
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
__name: "select",
|
|
6
|
+
props: {
|
|
7
|
+
modelValue: {},
|
|
8
|
+
filter: { type: Boolean, default: false },
|
|
9
|
+
placeHolder: { default: "点击选择" },
|
|
10
|
+
disabled: { type: Boolean, default: false }
|
|
11
|
+
},
|
|
12
|
+
emits: ["update:modelValue", "change"],
|
|
13
|
+
setup(__props, { emit }) {
|
|
14
|
+
const props = __props;
|
|
15
|
+
const LibScrollBar = defineAsyncComponent(() => import("../scrollBar/scrollBar.js"));
|
|
16
|
+
const Pop = defineAsyncComponent(() => import("../popover/popover.js"));
|
|
17
|
+
const ParentGetChangeHandle = inject(
|
|
18
|
+
"changHandle",
|
|
19
|
+
(_params) => null
|
|
20
|
+
// false
|
|
21
|
+
);
|
|
22
|
+
const slots = useSlots();
|
|
23
|
+
const showOption = ref(false);
|
|
24
|
+
const showHandle = () => {
|
|
25
|
+
if (props.disabled === true)
|
|
26
|
+
return;
|
|
27
|
+
showOption.value = !showOption.value;
|
|
28
|
+
};
|
|
29
|
+
const inputLabel = computed(() => {
|
|
30
|
+
const isThis = optionList.value.filter((v) => v.value === props.modelValue);
|
|
31
|
+
if (isThis.length > 0) {
|
|
32
|
+
return isThis[0].label;
|
|
33
|
+
} else {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const optionList = ref([]);
|
|
38
|
+
const renderOption = () => {
|
|
39
|
+
return h(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
class: "selectOption"
|
|
43
|
+
},
|
|
44
|
+
slots.default().map((i, j) => {
|
|
45
|
+
if (i.type.toString().includes("Symbol")) {
|
|
46
|
+
return i.children.map((it, k) => {
|
|
47
|
+
optionList.value.push({
|
|
48
|
+
value: it.props.value,
|
|
49
|
+
label: it.props.label
|
|
50
|
+
});
|
|
51
|
+
return h(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
class: `label ${props.modelValue === it.props.value ? "labelselect" : ""}`,
|
|
55
|
+
key: `${j}-${k}`,
|
|
56
|
+
onClick: () => {
|
|
57
|
+
emit("update:modelValue", it.props.value);
|
|
58
|
+
showOption.value = false;
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
it.children || it.props.label
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
} else {
|
|
65
|
+
optionList.value.push({
|
|
66
|
+
value: i.props.value,
|
|
67
|
+
label: i.props.label
|
|
68
|
+
});
|
|
69
|
+
return h(
|
|
70
|
+
"div",
|
|
71
|
+
{
|
|
72
|
+
class: `label ${props.modelValue === i.props.value ? "labelselect" : ""}`,
|
|
73
|
+
key: j,
|
|
74
|
+
onClick: () => {
|
|
75
|
+
emit("update:modelValue", i.props.value);
|
|
76
|
+
showOption.value = false;
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
i.children || i.props.label
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
watch(
|
|
86
|
+
() => props.modelValue,
|
|
87
|
+
(n) => {
|
|
88
|
+
ParentGetChangeHandle && ParentGetChangeHandle(n);
|
|
89
|
+
emit("change", n);
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
return (_ctx, _cache) => {
|
|
93
|
+
return openBlock(), createBlock(unref(Pop), {
|
|
94
|
+
trigger: "native",
|
|
95
|
+
modelValue: showOption.value,
|
|
96
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => showOption.value = $event),
|
|
97
|
+
insertClass: "tdd-min-w-[200px]",
|
|
98
|
+
placement: "bottomleft"
|
|
99
|
+
}, {
|
|
100
|
+
reference: withCtx(() => [
|
|
101
|
+
createElementVNode("div", {
|
|
102
|
+
class: "tdd-relative tdd-flex tdd-h-full tdd-w-full tdd-items-center tdd-overflow-hidden tdd-rounded tdd-border tdd-border-solid",
|
|
103
|
+
onClick: showHandle
|
|
104
|
+
}, [
|
|
105
|
+
createElementVNode("input", {
|
|
106
|
+
value: inputLabel.value,
|
|
107
|
+
type: "text",
|
|
108
|
+
disabled: _ctx.disabled,
|
|
109
|
+
readonly: !_ctx.filter,
|
|
110
|
+
class: "tdd-h-full tdd-w-full tdd-cursor-pointer tdd-appearance-none tdd-p-2 tdd-text-sm tdd-outline-none",
|
|
111
|
+
placeholder: _ctx.placeHolder
|
|
112
|
+
}, null, 8, _hoisted_2)
|
|
113
|
+
])
|
|
114
|
+
]),
|
|
115
|
+
default: withCtx(() => [
|
|
116
|
+
createElementVNode("div", _hoisted_1, [
|
|
117
|
+
createVNode(unref(LibScrollBar), { isSelectdom: true }, {
|
|
118
|
+
default: withCtx(() => [
|
|
119
|
+
createVNode(renderOption)
|
|
120
|
+
]),
|
|
121
|
+
_: 1
|
|
122
|
+
})
|
|
123
|
+
])
|
|
124
|
+
]),
|
|
125
|
+
_: 1
|
|
126
|
+
}, 8, ["modelValue"]);
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
const select_vue_vue_type_style_index_0_lang = "";
|
|
131
|
+
export {
|
|
132
|
+
_sfc_main as default
|
|
133
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineComponent, renderSlot } from "vue";
|
|
2
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3
|
+
__name: "selectoption",
|
|
4
|
+
props: {
|
|
5
|
+
value: {},
|
|
6
|
+
label: {}
|
|
7
|
+
},
|
|
8
|
+
setup(__props) {
|
|
9
|
+
return (_ctx, _cache) => {
|
|
10
|
+
return renderSlot(_ctx.$slots, "default");
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
export {
|
|
15
|
+
_sfc_main as default
|
|
16
|
+
};
|