ninemoon-ui 0.0.26 → 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.
Files changed (141) hide show
  1. package/dist/assets/dialog-a1b585e9.css +9 -0
  2. package/dist/assets/index-6d2c28a9.css +1210 -0
  3. package/dist/{tabs.css → assets/tabs-d2c8965f.css} +13 -13
  4. package/dist/components/alert/alert.d.ts +3 -11
  5. package/dist/components/alert/alertcomponent.vue.d.ts +22 -11
  6. package/dist/components/badge/badge.vue.d.ts +40 -31
  7. package/dist/components/carousel/carousel.vue.d.ts +47 -8
  8. package/dist/components/carousel/carouselitem.vue.d.ts +4 -2
  9. package/dist/components/carousel/clickbutton.vue.d.ts +29 -0
  10. package/dist/components/check/checkbox.vue.d.ts +39 -22
  11. package/dist/components/check/checkgroup.vue.d.ts +45 -21
  12. package/dist/components/date/datepicker.vue.d.ts +48 -18
  13. package/dist/components/date/datepickerRange.vue.d.ts +35 -12
  14. package/dist/components/dialog/dialog.vue.d.ts +56 -67
  15. package/dist/components/form/form.vue.d.ts +38 -44
  16. package/dist/components/form/formlabel.vue.d.ts +40 -35
  17. package/dist/components/form/type.d.ts +11 -0
  18. package/dist/components/icon/add.vue.d.ts +2 -0
  19. package/dist/components/icon/alertTip.vue.d.ts +2 -0
  20. package/dist/components/icon/arrow.vue.d.ts +2 -0
  21. package/dist/components/icon/calendar.vue.d.ts +2 -0
  22. package/dist/components/icon/close.vue.d.ts +2 -0
  23. package/dist/components/icon/dateArrow.vue.d.ts +2 -0
  24. package/dist/components/icon/dateArrowplus.vue.d.ts +2 -0
  25. package/dist/components/icon/delete.vue.d.ts +2 -0
  26. package/dist/components/icon/ellipsis.vue.d.ts +2 -0
  27. package/dist/components/icon/errTip.vue.d.ts +2 -0
  28. package/dist/components/icon/eye.vue.d.ts +2 -0
  29. package/dist/components/icon/infoTip.vue.d.ts +2 -0
  30. package/dist/components/icon/minus.vue.d.ts +2 -0
  31. package/dist/components/icon/successTip.vue.d.ts +2 -0
  32. package/dist/components/icon/turnleft.vue.d.ts +2 -0
  33. package/dist/components/icon/turnright.vue.d.ts +2 -0
  34. package/dist/components/icon/warnTip.vue.d.ts +2 -0
  35. package/dist/components/image/image.vue.d.ts +39 -29
  36. package/dist/components/input/input.vue.d.ts +59 -50
  37. package/dist/components/loadding/loadcomponent.vue.d.ts +24 -4
  38. package/dist/components/loadding/loadding.d.ts +13 -19
  39. package/dist/components/menu/menu.vue.d.ts +35 -12
  40. package/dist/components/message/message.d.ts +69 -14
  41. package/dist/components/message/messagecomponent.vue.d.ts +8 -15
  42. package/dist/components/numberInput/numberinput.vue.d.ts +51 -59
  43. package/dist/components/pagination/pagination.vue.d.ts +59 -27
  44. package/dist/components/popover/poparrow.d.ts +55 -0
  45. package/dist/components/popover/popover.vue.d.ts +63 -66
  46. package/dist/components/radio/radiobox.vue.d.ts +39 -22
  47. package/dist/components/radio/radiogroup.vue.d.ts +45 -21
  48. package/dist/components/scrollBar/movebar.vue.d.ts +33 -36
  49. package/dist/components/scrollBar/scrollBar.vue.d.ts +41 -40
  50. package/dist/components/scrollloading/scrolllead.d.ts +18 -11
  51. package/dist/components/select/select.vue.d.ts +55 -37
  52. package/dist/components/select/selectoption.vue.d.ts +39 -18
  53. package/dist/components/switch/switch.vue.d.ts +45 -45
  54. package/dist/components/table/table.vue.d.ts +61 -54
  55. package/dist/components/table/tableItem.vue.d.ts +49 -56
  56. package/dist/components/tabs/tabs.vue.d.ts +45 -19
  57. package/dist/components/tabs/tabsPane.vue.d.ts +25 -12
  58. package/dist/components/upload/upload.vue.d.ts +53 -53
  59. package/dist/directives/arrowKeys.d.ts +10 -0
  60. package/dist/directives/drag.d.ts +20 -0
  61. package/dist/directives/escape.d.ts +7 -0
  62. package/dist/directives/outsideclick.d.ts +14 -0
  63. package/dist/directives/watchwindow.d.ts +13 -0
  64. package/dist/directives/wheel.d.ts +12 -0
  65. package/dist/directives/whitespaceclick.d.ts +12 -0
  66. package/dist/index.d.ts +1524 -2210
  67. package/dist/js/arrow-ebe47bd0.js +17 -0
  68. package/dist/js/{badge/badge.js → badge-496028b6.js} +9 -16
  69. package/dist/js/calendar-5c242731.js +87 -0
  70. package/dist/js/carousel-10621aeb.js +155 -0
  71. package/dist/js/{carousel/carouselitem.js → carouselitem-89116745.js} +1 -7
  72. package/dist/js/checkbox-530025c4.js +50 -0
  73. package/dist/js/checkgroup-e4e6adbc.js +58 -0
  74. package/dist/js/dateArrowplus-8181993f.js +25 -0
  75. package/dist/js/datepicker-ef8b7019.js +362 -0
  76. package/dist/js/datepickerRange-4c400f88.js +500 -0
  77. package/dist/js/delete-e898f83c.js +19 -0
  78. package/dist/js/dialog-0127ca01.js +122 -0
  79. package/dist/js/form-6ae96387.js +79 -0
  80. package/dist/js/formlabel-9339bd1c.js +136 -0
  81. package/dist/js/image-76711716.js +300 -0
  82. package/dist/js/index-283810a0.js +6261 -0
  83. package/dist/js/index-b4e420ce.js +958 -0
  84. package/dist/js/index-e12c8d65.js +36 -0
  85. package/dist/js/input-11fe67a5.js +107 -0
  86. package/dist/js/menu-fb9b4a4f.js +86 -0
  87. package/dist/js/numberinput-00fa4429.js +119 -0
  88. package/dist/js/pagination-3bcaa109.js +203 -0
  89. package/dist/js/popover-45f75f86.js +345 -0
  90. package/dist/js/radiobox-8f11e726.js +49 -0
  91. package/dist/js/radiogroup-727923c7.js +33 -0
  92. package/dist/js/scrollBar-07906042.js +252 -0
  93. package/dist/js/select-b5bbb138.js +203 -0
  94. package/dist/js/selectoption-00c8f06d.js +57 -0
  95. package/dist/js/shapeFlag-8cf4bcf1.js +17 -0
  96. package/dist/js/switch-06ae74cc.js +50 -0
  97. package/dist/js/table-9bb52630.js +270 -0
  98. package/dist/js/{table/tableItem.js → tableItem-7d8bf2db.js} +1 -1
  99. package/dist/js/{tabs/tabs.js → tabs-9d7be734.js} +59 -60
  100. package/dist/js/{upload/upload.js → upload-16dbef22.js} +10 -26
  101. package/dist/types/shapeFlag.d.ts +13 -0
  102. package/dist/{components/utils → utils}/tool.d.ts +12 -5
  103. package/package.json +1 -1
  104. package/dist/badge.css +0 -27
  105. package/dist/carousel.css +0 -13
  106. package/dist/checkgroup.css +0 -41
  107. package/dist/components/tree/tree.vue.d.ts +0 -47
  108. package/dist/datepickerRange.css +0 -79
  109. package/dist/image.css +0 -8
  110. package/dist/index.css +0 -917
  111. package/dist/index.es.js +0 -37
  112. package/dist/index.umd.js +0 -6080
  113. package/dist/js/carousel/carousel.js +0 -175
  114. package/dist/js/check/checkbox.js +0 -16
  115. package/dist/js/check/checkgroup.js +0 -68
  116. package/dist/js/date/datepicker.js +0 -373
  117. package/dist/js/date/datepickerRange.js +0 -597
  118. package/dist/js/dialog/dialog.js +0 -140
  119. package/dist/js/form/form.js +0 -87
  120. package/dist/js/form/formlabel.js +0 -167
  121. package/dist/js/getcalendar/getcalendar.js +0 -48
  122. package/dist/js/image/image.js +0 -259
  123. package/dist/js/index/index.js +0 -873
  124. package/dist/js/input/input.js +0 -91
  125. package/dist/js/menu/menu.js +0 -58
  126. package/dist/js/numberInput/numberinput.js +0 -130
  127. package/dist/js/pagination/pagination.js +0 -245
  128. package/dist/js/popover/popover.js +0 -241
  129. package/dist/js/radio/radiobox.js +0 -16
  130. package/dist/js/radio/radiogroup.js +0 -68
  131. package/dist/js/scrollBar/scrollBar.js +0 -208
  132. package/dist/js/select/select.js +0 -117
  133. package/dist/js/select/selectoption.js +0 -16
  134. package/dist/js/switch/switch.js +0 -49
  135. package/dist/js/table/table.js +0 -215
  136. package/dist/js/tree/tree.js +0 -72
  137. package/dist/js/tree/treeleaf.js +0 -118
  138. package/dist/radiogroup.css +0 -44
  139. package/dist/scrollBar.css +0 -37
  140. package/dist/select.css +0 -20
  141. /package/dist/js/{tabs/tabsPane.js → tabsPane-f024a6bf.js} +0 -0
@@ -1,241 +0,0 @@
1
- import { defineComponent, ref, computed, nextTick, onUnmounted, openBlock, createElementBlock, withModifiers, renderSlot, createBlock, Teleport, createVNode, Transition, withCtx, withDirectives, normalizeClass, normalizeStyle, createCommentVNode, vShow, h } from "vue";
2
- import { c as createAndAppendElementWithId, u as usePotion, d as debounce } 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
- beforebgcolor: {},
14
- arrowshow: { type: Boolean, default: true }
15
- },
16
- emits: ["update:modelValue"],
17
- setup(__props, { expose: __expose, emit: emitAct }) {
18
- const props = __props;
19
- const bindName = ref("body");
20
- const base = ref();
21
- const pop = ref();
22
- const showPop = ref(false);
23
- createAndAppendElementWithId("tdd-pop");
24
- bindName.value = "#tdd-pop";
25
- const trueFlag = computed(() => {
26
- if (showPop.value || props.trigger === "native" && props.modelValue) {
27
- nextTick(() => {
28
- setPosition();
29
- });
30
- } else {
31
- window.removeEventListener("resize", setPosition);
32
- window.removeEventListener("scroll", setPosition, true);
33
- }
34
- if (props.trigger === "native") {
35
- return props.modelValue;
36
- } else {
37
- return showPop.value;
38
- }
39
- });
40
- const marginClass = computed(() => {
41
- let margin = "";
42
- switch (props.placement) {
43
- case "topleft":
44
- case "topmiddle":
45
- case "topright":
46
- margin = "-tdd-mt-3";
47
- break;
48
- case "bottomleft":
49
- case "bottommiddle":
50
- case "bottomright":
51
- margin = "tdd-mt-3";
52
- break;
53
- case "centerleft":
54
- margin = "-tdd-ml-3";
55
- break;
56
- case "centerright":
57
- margin = "tdd-ml-3";
58
- break;
59
- }
60
- return margin;
61
- });
62
- const styleConditions = {
63
- left: (placement) => ["topleft", "topmiddle", "topright", "bottomleft", "bottommiddle", "bottomright"].includes(placement) ? `${arrowLeft.value}px` : "centerright" == placement ? "-5px" : null,
64
- right: (placement) => "centerleft" == placement ? "-5px" : null,
65
- top: (placement, exChange2) => ["bottomleft", "bottommiddle", "bottomright"].includes(placement) && !exChange2 ? "-5px" : ["topleft", "topmiddle", "topright"].includes(placement) && exChange2 ? "-5px" : ["centerright", "centerleft"].includes(placement) ? `${arrowTop.value}px` : null,
66
- bottom: (placement, exChange2) => ["topleft", "topmiddle", "topright"].includes(placement) && !exChange2 ? "-5px" : ["bottomleft", "bottommiddle", "bottomright"].includes(placement) && exChange2 ? "-5px" : null
67
- };
68
- const arrowHandle = () => {
69
- const resultStyles = {};
70
- for (const styleName in styleConditions) {
71
- const condition = styleConditions[styleName];
72
- if (typeof condition === "function") {
73
- resultStyles[styleName] = condition(props.placement, exChange.value);
74
- } else if (condition) {
75
- resultStyles[styleName] = condition;
76
- }
77
- }
78
- const publicClass = "tdd-absolute tdd-z-1000 tdd-w-2.5 tdd-h-2.5 before:tdd-z-[-1] before:tdd-border before:tdd-border-gray-300 before:tdd-bg-white before:tdd-content-border before:tdd-rotate-45 before:tdd-content-[' '] before:tdd-w-2.5 before:tdd-h-2.5 before:tdd-absolute";
79
- return h(
80
- "span",
81
- {
82
- class: normalizeClass(
83
- [
84
- publicClass,
85
- ["topleft", "topmiddle", "topright"].includes(props.placement) && !exChange.value ? "before:tdd-border-t-transparent before:tdd-border-l-transparent before:tdd-rounded-br" : "",
86
- ["topleft", "topmiddle", "topright"].includes(props.placement) && exChange.value ? "before:tdd-border-b-transparent before:tdd-border-r-transparent before:tdd-rounded-tl" : "",
87
- ["bottomleft", "bottommiddle", "bottomright"].includes(props.placement) && !exChange.value ? "before:tdd-border-b-transparent before:tdd-border-r-transparent before:tdd-rounded-tl" : "",
88
- ["bottomleft", "bottommiddle", "bottomright"].includes(props.placement) && exChange.value ? "before:tdd-border-t-transparent before:tdd-border-l-transparent before:tdd-rounded-br" : "",
89
- "centerright" == props.placement ? "before:tdd-border-r-transparent before:tdd-border-t-transparent before:tdd-rounded-bl" : "",
90
- "centerleft" == props.placement ? "before:tdd-border-l-transparent before:tdd-border-b-transparent before:tdd-rounded-tr" : "",
91
- props.beforebgcolor
92
- ]
93
- ),
94
- style: normalizeStyle(
95
- resultStyles
96
- )
97
- }
98
- );
99
- };
100
- const showHandle = () => {
101
- showPop.value = true;
102
- };
103
- const hovershowHandle = () => {
104
- if (props.trigger === "hover") {
105
- showPop.value = true;
106
- }
107
- };
108
- const Left = ref(0);
109
- const Top = ref(0);
110
- const arrowLeft = ref(0);
111
- const arrowTop = ref(0);
112
- const exChange = ref(false);
113
- const setPosition = () => {
114
- const { top, bottom } = base.value.getBoundingClientRect();
115
- if (top < 0 || bottom > window.innerHeight) {
116
- if (props.trigger === "native") {
117
- emitAct("update:modelValue", false);
118
- } else {
119
- showPop.value = false;
120
- }
121
- return;
122
- }
123
- const position = usePotion(base.value, pop.value, {
124
- position: props.placement
125
- });
126
- Top.value = position.Top;
127
- Left.value = position.Left;
128
- arrowTop.value = position.arrowTop;
129
- arrowLeft.value = position.arrowLeft;
130
- exChange.value = position.exChange;
131
- window.addEventListener("resize", setPosition);
132
- window.addEventListener("scroll", setPosition, true);
133
- };
134
- const vClickoutside = {
135
- mounted(el, binding) {
136
- function documentHandler(e) {
137
- var _a;
138
- if (trueFlag.value == false)
139
- return;
140
- if (el.contains(e.target)) {
141
- return false;
142
- } else if ((_a = base.value) == null ? void 0 : _a.contains(e.target)) {
143
- return false;
144
- } else {
145
- binding.value && binding.value(e);
146
- }
147
- }
148
- el._vueClickOutside_ = debounce(documentHandler, 80);
149
- document.addEventListener("click", el._vueClickOutside_);
150
- switch (props.trigger) {
151
- case "hover":
152
- document.addEventListener("mousemove", el._vueClickOutside_);
153
- break;
154
- }
155
- },
156
- beforeUnmount(el) {
157
- document.removeEventListener("click", el._vueClickOutside_);
158
- switch (props.trigger) {
159
- case "hover":
160
- document.removeEventListener("mousemove", el._vueClickOutside_);
161
- break;
162
- }
163
- delete el._vueClickOutside_;
164
- }
165
- };
166
- const closeCenter = () => {
167
- if (props.beforeHidden) {
168
- props.beforeHidden(hideHandle);
169
- } else {
170
- hideHandle();
171
- }
172
- };
173
- const hideHandle = (disablecancelflag) => {
174
- if (disablecancelflag === true) {
175
- return;
176
- } else {
177
- if (props.trigger === "native") {
178
- emitAct("update:modelValue", false);
179
- } else {
180
- showPop.value = false;
181
- }
182
- }
183
- };
184
- const widthNum = computed(() => {
185
- if (typeof props.width === "number") {
186
- return `${props.width}px`;
187
- } else if (typeof props.width === "string") {
188
- const defaultCheckArr = ["em", "px", "rem", "%"];
189
- if (defaultCheckArr.some((i) => props.width.includes(i))) {
190
- return props.width;
191
- } else if (isNaN(Number(props.width))) {
192
- return "200px";
193
- } else {
194
- return `${Number(props.width)}px`;
195
- }
196
- } else {
197
- return "200px";
198
- }
199
- });
200
- onUnmounted(() => {
201
- window.removeEventListener("resize", setPosition);
202
- window.removeEventListener("scroll", setPosition, true);
203
- });
204
- __expose({
205
- hideHandle
206
- });
207
- return (_ctx, _cache) => {
208
- return openBlock(), createElementBlock("div", {
209
- class: "tdd-inline-block",
210
- ref_key: "base",
211
- ref: base,
212
- onClick: showHandle,
213
- onMouseenter: withModifiers(hovershowHandle, ["prevent"])
214
- }, [
215
- renderSlot(_ctx.$slots, "reference"),
216
- (openBlock(), createBlock(Teleport, { to: bindName.value }, [
217
- createVNode(Transition, { name: "opecity" }, {
218
- default: withCtx(() => [
219
- withDirectives((openBlock(), createElementBlock("div", {
220
- ref_key: "pop",
221
- ref: pop,
222
- class: normalizeClass(["tdd-absolute tdd-z-1000 tdd-rounded tdd-bg-white tdd-p-4 tdd-drop-shadow tdd-border tdd-border-gray-300 tdd-box-border", [marginClass.value, _ctx.insertClass]]),
223
- style: normalizeStyle({ width: widthNum.value, top: `${Top.value}px`, left: `${Left.value}px` })
224
- }, [
225
- renderSlot(_ctx.$slots, "default"),
226
- _ctx.arrowshow ? (openBlock(), createBlock(arrowHandle, { key: 0 })) : createCommentVNode("", true)
227
- ], 6)), [
228
- [vShow, trueFlag.value],
229
- [vClickoutside, closeCenter]
230
- ])
231
- ]),
232
- _: 3
233
- })
234
- ], 8, ["to"]))
235
- ], 40, _hoisted_1);
236
- };
237
- }
238
- });
239
- export {
240
- _sfc_main as default
241
- };
@@ -1,16 +0,0 @@
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
- };
@@ -1,68 +0,0 @@
1
- import { defineComponent, inject, useSlots, openBlock, createBlock, h, normalizeClass, 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 BoxHandle = (MySlot) => {
14
- var _a, _b;
15
- return h(
16
- "label",
17
- {
18
- class: normalizeClass(["radioGroup", [(_a = MySlot.props) == null ? void 0 : _a.class, props.modelValue == MySlot.props.label ? "tdd-bg-wordblue" : ""]])
19
- },
20
- [
21
- withDirectives(
22
- h("input", {
23
- type: "radio",
24
- value: MySlot.props.label,
25
- "onUpdate:modelValue": (value) => {
26
- ParentGetChangeHandle(value);
27
- emit("update:modelValue", value);
28
- },
29
- class: normalizeClass(["hiddeninput form-tick", [props.showinput ? "" : "tdd-hidden"]])
30
- }),
31
- [[vModelRadio, props.modelValue]]
32
- ),
33
- h(
34
- "span",
35
- {
36
- class: normalizeClass(["tdd-text-sm", [props.modelValue == MySlot.props.label ? "tdd-text-white" : "tdd-text-word6"]])
37
- },
38
- ((_b = MySlot.children) == null ? void 0 : _b.default()) || MySlot.props.label
39
- )
40
- ]
41
- );
42
- };
43
- const renderBoxs = () => {
44
- return h(
45
- "div",
46
- {},
47
- slots.default().map((MySlot) => {
48
- if (typeof MySlot.children === "string")
49
- return null;
50
- if (Array.isArray(MySlot.children)) {
51
- return MySlot.children.map((slot) => {
52
- return BoxHandle(slot);
53
- });
54
- } else {
55
- return BoxHandle(MySlot);
56
- }
57
- })
58
- );
59
- };
60
- return (_ctx, _cache) => {
61
- return openBlock(), createBlock(renderBoxs);
62
- };
63
- }
64
- });
65
- const radiogroup_vue_vue_type_style_index_0_lang = "";
66
- export {
67
- _sfc_main as default
68
- };
@@ -1,208 +0,0 @@
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, e 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-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
- };
@@ -1,117 +0,0 @@
1
- import { defineComponent, defineAsyncComponent, inject, useSlots, ref, computed, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, h, normalizeClass } from "vue";
2
- const _hoisted_1 = ["value", "disabled", "readonly", "placeholder"];
3
- const _sfc_main = /* @__PURE__ */ defineComponent({
4
- __name: "select",
5
- props: {
6
- modelValue: {},
7
- filter: { type: Boolean, default: false },
8
- placeHolder: { default: "点击选择" },
9
- disabled: { type: Boolean, default: false }
10
- },
11
- emits: ["update:modelValue", "change"],
12
- setup(__props, { emit }) {
13
- const props = __props;
14
- const LibScrollBar = defineAsyncComponent(() => import("../scrollBar/scrollBar.js"));
15
- const Pop = defineAsyncComponent(() => import("../popover/popover.js"));
16
- const ParentGetChangeHandle = inject(
17
- "changHandle",
18
- (_params) => null
19
- // false
20
- );
21
- const slots = useSlots();
22
- const showOption = ref(false);
23
- const showHandle = () => {
24
- if (props.disabled === true)
25
- return;
26
- showOption.value = !showOption.value;
27
- };
28
- const inputLabel = computed(() => {
29
- const isThis = optionList.value.filter((v) => v.value === props.modelValue);
30
- if (isThis.length > 0) {
31
- return isThis[0].label;
32
- } else if (props.modelValue) {
33
- return;
34
- } else {
35
- return null;
36
- }
37
- });
38
- const optionList = ref([]);
39
- const optionHandle = (it) => {
40
- optionList.value.push({
41
- value: it.props.value,
42
- label: it.props.label
43
- });
44
- return h(
45
- "div",
46
- {
47
- class: normalizeClass(["label", [props.modelValue === it.props.value ? "labelselect" : ""]]),
48
- key: it.props.key,
49
- onClick: () => {
50
- emit("update:modelValue", it.props.value);
51
- ParentGetChangeHandle && ParentGetChangeHandle(it.props.value);
52
- emit("change", it.props.value);
53
- showOption.value = false;
54
- }
55
- },
56
- it.children || it.props.label
57
- );
58
- };
59
- const renderOption = () => {
60
- return h(
61
- "div",
62
- {
63
- class: "selectOption"
64
- },
65
- slots.default().map((i, _j) => {
66
- if (typeof i.children == "string")
67
- return null;
68
- if (Array.isArray(i.children)) {
69
- return i.children.map((it) => {
70
- return optionHandle(it);
71
- });
72
- } else {
73
- return optionHandle(i);
74
- }
75
- })
76
- );
77
- };
78
- return (_ctx, _cache) => {
79
- return openBlock(), createBlock(unref(Pop), {
80
- trigger: "native",
81
- modelValue: showOption.value,
82
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => showOption.value = $event),
83
- insertClass: "tdd-min-w-[200px] tdd-z-2000 tdd-text-sm !tdd-p-1",
84
- placement: "bottomleft"
85
- }, {
86
- reference: withCtx(() => [
87
- createElementVNode("div", {
88
- class: "tdd-relative tdd-flex tdd-h-full tdd-w-full tdd-items-center tdd-overflow-hidden tdd-rounded tdd-border tdd-border-solid",
89
- onClick: showHandle
90
- }, [
91
- createElementVNode("input", {
92
- value: inputLabel.value,
93
- type: "text",
94
- disabled: _ctx.disabled,
95
- readonly: !_ctx.filter,
96
- class: "tdd-h-full tdd-w-full tdd-cursor-pointer tdd-appearance-none tdd-p-2 tdd-text-sm tdd-outline-none",
97
- placeholder: _ctx.placeHolder
98
- }, null, 8, _hoisted_1)
99
- ])
100
- ]),
101
- default: withCtx(() => [
102
- createVNode(unref(LibScrollBar), { isSelectdom: true }, {
103
- default: withCtx(() => [
104
- createVNode(renderOption)
105
- ]),
106
- _: 1
107
- })
108
- ]),
109
- _: 1
110
- }, 8, ["modelValue"]);
111
- };
112
- }
113
- });
114
- const select_vue_vue_type_style_index_0_lang = "";
115
- export {
116
- _sfc_main as default
117
- };
@@ -1,16 +0,0 @@
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
- };