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.
Files changed (135) 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} +3 -3
  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 +2 -0
  7. package/dist/components/carousel/carousel.vue.d.ts +29 -3
  8. package/dist/components/{tree/tree.vue.d.ts → carousel/clickbutton.vue.d.ts} +6 -19
  9. package/dist/components/check/checkbox.vue.d.ts +24 -16
  10. package/dist/components/check/checkgroup.vue.d.ts +15 -3
  11. package/dist/components/date/datepicker.vue.d.ts +28 -6
  12. package/dist/components/date/datepickerRange.vue.d.ts +15 -4
  13. package/dist/components/form/form.vue.d.ts +7 -20
  14. package/dist/components/form/formlabel.vue.d.ts +3 -3
  15. package/dist/components/form/type.d.ts +11 -0
  16. package/dist/components/icon/add.vue.d.ts +2 -0
  17. package/dist/components/icon/alertTip.vue.d.ts +2 -0
  18. package/dist/components/icon/arrow.vue.d.ts +2 -0
  19. package/dist/components/icon/calendar.vue.d.ts +2 -0
  20. package/dist/components/icon/close.vue.d.ts +2 -0
  21. package/dist/components/icon/dateArrow.vue.d.ts +2 -0
  22. package/dist/components/icon/dateArrowplus.vue.d.ts +2 -0
  23. package/dist/components/icon/delete.vue.d.ts +2 -0
  24. package/dist/components/icon/ellipsis.vue.d.ts +2 -0
  25. package/dist/components/icon/errTip.vue.d.ts +2 -0
  26. package/dist/components/icon/eye.vue.d.ts +2 -0
  27. package/dist/components/icon/infoTip.vue.d.ts +2 -0
  28. package/dist/components/icon/minus.vue.d.ts +2 -0
  29. package/dist/components/icon/successTip.vue.d.ts +2 -0
  30. package/dist/components/icon/turnleft.vue.d.ts +2 -0
  31. package/dist/components/icon/turnright.vue.d.ts +2 -0
  32. package/dist/components/icon/warnTip.vue.d.ts +2 -0
  33. package/dist/components/input/input.vue.d.ts +13 -8
  34. package/dist/components/loadding/loadcomponent.vue.d.ts +24 -4
  35. package/dist/components/loadding/loadding.d.ts +12 -19
  36. package/dist/components/menu/menu.vue.d.ts +13 -3
  37. package/dist/components/message/message.d.ts +68 -14
  38. package/dist/components/message/messagecomponent.vue.d.ts +5 -13
  39. package/dist/components/numberInput/numberinput.vue.d.ts +3 -3
  40. package/dist/components/pagination/pagination.vue.d.ts +24 -0
  41. package/dist/components/popover/poparrow.d.ts +55 -0
  42. package/dist/components/popover/popover.vue.d.ts +10 -4
  43. package/dist/components/radio/radiobox.vue.d.ts +24 -16
  44. package/dist/components/radio/radiogroup.vue.d.ts +15 -3
  45. package/dist/components/scrollBar/movebar.vue.d.ts +2 -2
  46. package/dist/components/scrollBar/scrollBar.vue.d.ts +12 -16
  47. package/dist/components/scrollloading/scrolllead.d.ts +18 -11
  48. package/dist/components/select/select.vue.d.ts +15 -1
  49. package/dist/components/select/selectoption.vue.d.ts +18 -6
  50. package/dist/components/switch/switch.vue.d.ts +14 -14
  51. package/dist/components/table/table.vue.d.ts +20 -9
  52. package/dist/components/table/tableItem.vue.d.ts +10 -4
  53. package/dist/components/tabs/tabs.vue.d.ts +14 -1
  54. package/dist/directives/arrowKeys.d.ts +10 -0
  55. package/dist/directives/drag.d.ts +20 -0
  56. package/dist/directives/escape.d.ts +7 -0
  57. package/dist/directives/outsideclick.d.ts +14 -0
  58. package/dist/directives/watchwindow.d.ts +13 -0
  59. package/dist/directives/wheel.d.ts +12 -0
  60. package/dist/directives/whitespaceclick.d.ts +12 -0
  61. package/dist/index.d.ts +831 -401
  62. package/dist/js/arrow-ebe47bd0.js +17 -0
  63. package/dist/js/{badge/badge.js → badge-496028b6.js} +9 -16
  64. package/dist/js/calendar-5c242731.js +87 -0
  65. package/dist/js/carousel-10621aeb.js +155 -0
  66. package/dist/js/{carousel/carouselitem.js → carouselitem-89116745.js} +1 -7
  67. package/dist/js/checkbox-530025c4.js +50 -0
  68. package/dist/js/checkgroup-e4e6adbc.js +58 -0
  69. package/dist/js/dateArrowplus-8181993f.js +25 -0
  70. package/dist/js/datepicker-ef8b7019.js +362 -0
  71. package/dist/js/datepickerRange-4c400f88.js +500 -0
  72. package/dist/js/delete-e898f83c.js +19 -0
  73. package/dist/js/dialog-0127ca01.js +122 -0
  74. package/dist/js/form-6ae96387.js +79 -0
  75. package/dist/js/formlabel-9339bd1c.js +136 -0
  76. package/dist/js/image-76711716.js +300 -0
  77. package/dist/js/index-283810a0.js +6261 -0
  78. package/dist/js/index-b4e420ce.js +958 -0
  79. package/dist/js/index-e12c8d65.js +36 -0
  80. package/dist/js/input-11fe67a5.js +107 -0
  81. package/dist/js/menu-fb9b4a4f.js +86 -0
  82. package/dist/js/numberinput-00fa4429.js +119 -0
  83. package/dist/js/pagination-3bcaa109.js +203 -0
  84. package/dist/js/popover-45f75f86.js +345 -0
  85. package/dist/js/radiobox-8f11e726.js +49 -0
  86. package/dist/js/radiogroup-727923c7.js +33 -0
  87. package/dist/js/scrollBar-07906042.js +252 -0
  88. package/dist/js/select-b5bbb138.js +203 -0
  89. package/dist/js/selectoption-00c8f06d.js +57 -0
  90. package/dist/js/shapeFlag-8cf4bcf1.js +17 -0
  91. package/dist/js/switch-06ae74cc.js +50 -0
  92. package/dist/js/table-9bb52630.js +270 -0
  93. package/dist/js/{table/tableItem.js → tableItem-7d8bf2db.js} +1 -1
  94. package/dist/js/{tabs/tabs.js → tabs-9d7be734.js} +57 -59
  95. package/dist/js/{upload/upload.js → upload-16dbef22.js} +8 -23
  96. package/dist/types/shapeFlag.d.ts +13 -0
  97. package/dist/{components/utils → utils}/tool.d.ts +11 -4
  98. package/package.json +1 -1
  99. package/dist/badge.css +0 -27
  100. package/dist/carousel.css +0 -13
  101. package/dist/checkgroup.css +0 -41
  102. package/dist/datepickerRange.css +0 -79
  103. package/dist/image.css +0 -8
  104. package/dist/index.css +0 -897
  105. package/dist/index.es.js +0 -37
  106. package/dist/index.umd.js +0 -6006
  107. package/dist/js/carousel/carousel.js +0 -171
  108. package/dist/js/check/checkbox.js +0 -16
  109. package/dist/js/check/checkgroup.js +0 -69
  110. package/dist/js/date/datepicker.js +0 -366
  111. package/dist/js/date/datepickerRange.js +0 -589
  112. package/dist/js/dialog/dialog.js +0 -138
  113. package/dist/js/form/form.js +0 -87
  114. package/dist/js/form/formlabel.js +0 -167
  115. package/dist/js/getcalendar/getcalendar.js +0 -48
  116. package/dist/js/image/image.js +0 -250
  117. package/dist/js/index/index.js +0 -860
  118. package/dist/js/input/input.js +0 -90
  119. package/dist/js/menu/menu.js +0 -59
  120. package/dist/js/numberInput/numberinput.js +0 -127
  121. package/dist/js/pagination/pagination.js +0 -234
  122. package/dist/js/popover/popover.js +0 -241
  123. package/dist/js/radio/radiobox.js +0 -16
  124. package/dist/js/radio/radiogroup.js +0 -69
  125. package/dist/js/scrollBar/scrollBar.js +0 -208
  126. package/dist/js/select/select.js +0 -118
  127. package/dist/js/select/selectoption.js +0 -16
  128. package/dist/js/switch/switch.js +0 -50
  129. package/dist/js/table/table.js +0 -216
  130. package/dist/js/tree/tree.js +0 -72
  131. package/dist/js/tree/treeleaf.js +0 -116
  132. package/dist/radiogroup.css +0 -44
  133. package/dist/scrollBar.css +0 -37
  134. package/dist/select.css +0 -20
  135. /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 _sfc_main = /* @__PURE__ */ defineComponent({
4
- __name: "popover",
5
- props: {
6
- trigger: { default: "click" },
7
- width: {},
8
- placement: { default: "topleft" },
9
- insertClass: {},
10
- beforeHidden: {},
11
- modelValue: { type: Boolean },
12
- beforebgcolor: {},
13
- arrowshow: { type: Boolean, default: true }
14
- },
15
- emits: ["update:modelValue"],
16
- setup(__props, { expose: __expose, emit: __emit }) {
17
- const props = __props;
18
- const bindName = ref("body");
19
- const base = ref();
20
- const pop = ref();
21
- const showPop = ref(false);
22
- createAndAppendElementWithId("tdd-pop");
23
- bindName.value = "#tdd-pop";
24
- const trueFlag = computed(() => {
25
- if (showPop.value || props.trigger === "native" && props.modelValue) {
26
- nextTick(() => {
27
- setPosition();
28
- });
29
- } else {
30
- window.removeEventListener("resize", setPosition);
31
- window.removeEventListener("scroll", setPosition, true);
32
- }
33
- if (props.trigger === "native") {
34
- return props.modelValue;
35
- } else {
36
- return showPop.value;
37
- }
38
- });
39
- const emitAct = __emit;
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
- ], 544);
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,69 +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: __emit }) {
10
- const props = __props;
11
- const ParentGetChangeHandle = inject("changHandle", () => null);
12
- const emit = __emit;
13
- const slots = useSlots();
14
- const BoxHandle = (MySlot) => {
15
- var _a, _b;
16
- return h(
17
- "label",
18
- {
19
- class: normalizeClass(["radioGroup", [(_a = MySlot.props) == null ? void 0 : _a.class, props.modelValue == MySlot.props.label ? "tdd-bg-wordblue" : ""]])
20
- },
21
- [
22
- withDirectives(
23
- h("input", {
24
- type: "radio",
25
- value: MySlot.props.label,
26
- "onUpdate:modelValue": (value) => {
27
- ParentGetChangeHandle(value);
28
- emit("update:modelValue", value);
29
- },
30
- class: normalizeClass(["hiddeninput form-tick", [props.showinput ? "" : "tdd-hidden"]])
31
- }),
32
- [[vModelRadio, props.modelValue]]
33
- ),
34
- h(
35
- "span",
36
- {
37
- class: normalizeClass(["tdd-text-sm", [props.modelValue == MySlot.props.label ? "tdd-text-white" : "tdd-text-word6"]])
38
- },
39
- ((_b = MySlot.children) == null ? void 0 : _b.default()) || MySlot.props.label
40
- )
41
- ]
42
- );
43
- };
44
- const renderBoxs = () => {
45
- return h(
46
- "div",
47
- {},
48
- slots.default().map((MySlot) => {
49
- if (typeof MySlot.children === "string")
50
- return null;
51
- if (Array.isArray(MySlot.children)) {
52
- return MySlot.children.map((slot) => {
53
- return BoxHandle(slot);
54
- });
55
- } else {
56
- return BoxHandle(MySlot);
57
- }
58
- })
59
- );
60
- };
61
- return (_ctx, _cache) => {
62
- return openBlock(), createBlock(renderBoxs);
63
- };
64
- }
65
- });
66
- const radiogroup_vue_vue_type_style_index_0_lang = "";
67
- export {
68
- _sfc_main as default
69
- };
@@ -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,118 +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: __emit }) {
13
- const LibScrollBar = defineAsyncComponent(() => import("../scrollBar/scrollBar.js"));
14
- const Pop = defineAsyncComponent(() => import("../popover/popover.js"));
15
- const props = __props;
16
- const ParentGetChangeHandle = inject(
17
- "changHandle",
18
- (_params) => null
19
- // false
20
- );
21
- const emit = __emit;
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 if (props.modelValue) {
34
- return;
35
- } else {
36
- return null;
37
- }
38
- });
39
- const optionList = ref([]);
40
- const optionHandle = (it) => {
41
- optionList.value.push({
42
- value: it.props.value,
43
- label: it.props.label
44
- });
45
- return h(
46
- "div",
47
- {
48
- class: normalizeClass(["label", [props.modelValue === it.props.value ? "labelselect" : ""]]),
49
- key: it.props.key,
50
- onClick: () => {
51
- emit("update:modelValue", it.props.value);
52
- ParentGetChangeHandle && ParentGetChangeHandle(it.props.value);
53
- emit("change", it.props.value);
54
- showOption.value = false;
55
- }
56
- },
57
- it.children || it.props.label
58
- );
59
- };
60
- const renderOption = () => {
61
- return h(
62
- "div",
63
- {
64
- class: "selectOption"
65
- },
66
- slots.default().map((i, _j) => {
67
- if (typeof i.children == "string")
68
- return null;
69
- if (Array.isArray(i.children)) {
70
- return i.children.map((it) => {
71
- return optionHandle(it);
72
- });
73
- } else {
74
- return optionHandle(i);
75
- }
76
- })
77
- );
78
- };
79
- return (_ctx, _cache) => {
80
- return openBlock(), createBlock(unref(Pop), {
81
- trigger: "native",
82
- modelValue: showOption.value,
83
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => showOption.value = $event),
84
- insertClass: "tdd-min-w-[200px] tdd-z-2000 tdd-text-sm !tdd-p-1",
85
- placement: "bottomleft"
86
- }, {
87
- reference: withCtx(() => [
88
- createElementVNode("div", {
89
- class: "tdd-relative tdd-flex tdd-h-full tdd-w-full tdd-items-center tdd-overflow-hidden tdd-rounded tdd-border tdd-border-solid",
90
- onClick: showHandle
91
- }, [
92
- createElementVNode("input", {
93
- value: inputLabel.value,
94
- type: "text",
95
- disabled: _ctx.disabled,
96
- readonly: !_ctx.filter,
97
- class: "tdd-h-full tdd-w-full tdd-cursor-pointer tdd-appearance-none tdd-p-2 tdd-text-sm tdd-outline-none",
98
- placeholder: _ctx.placeHolder
99
- }, null, 8, _hoisted_1)
100
- ])
101
- ]),
102
- default: withCtx(() => [
103
- createVNode(unref(LibScrollBar), { isSelectdom: true }, {
104
- default: withCtx(() => [
105
- createVNode(renderOption)
106
- ]),
107
- _: 1
108
- })
109
- ]),
110
- _: 1
111
- }, 8, ["modelValue"]);
112
- };
113
- }
114
- });
115
- const select_vue_vue_type_style_index_0_lang = "";
116
- export {
117
- _sfc_main as default
118
- };
@@ -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
- };