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
@@ -0,0 +1,36 @@
1
+ import "vue";
2
+ import { J, x, O, P, E, D, r, s, L, h, j, q, k, K, v, M, z, w, y, A, B, I, l, m, Q, n, p, G, H, F, N, i } from "./index-b4e420ce.js";
3
+ export {
4
+ J as LibAlert,
5
+ x as LibBadge,
6
+ O as LibCarousel,
7
+ P as LibCarouselItem,
8
+ E as LibCheckBox,
9
+ D as LibCheckGroup,
10
+ r as LibDatePicker,
11
+ s as LibDatePickerRange,
12
+ L as LibDialog,
13
+ h as LibForm,
14
+ j as LibFormLabel,
15
+ q as LibImage,
16
+ k as LibInput,
17
+ K as LibLoad,
18
+ v as LibMenu,
19
+ M as LibMessage,
20
+ z as LibNumberInput,
21
+ w as LibPagination,
22
+ y as LibPopover,
23
+ A as LibRadioBox,
24
+ B as LibRadioGroup,
25
+ I as LibScrollBar,
26
+ l as LibSelect,
27
+ m as LibSelectOption,
28
+ Q as LibSwitch,
29
+ n as LibTable,
30
+ p as LibTableItem,
31
+ G as LibTabs,
32
+ H as LibTabsPane,
33
+ F as LibUpload,
34
+ N as createScrollDirective,
35
+ i as default
36
+ };
@@ -0,0 +1,107 @@
1
+ import { defineComponent, computed, inject, openBlock, createElementBlock, renderSlot, withDirectives, createElementVNode, normalizeClass, vModelDynamic, createVNode, vShow } from "vue";
2
+ import { d as delIcon } from "./delete-e898f83c.js";
3
+ import "./index-b4e420ce.js";
4
+ const _hoisted_1 = { class: "relative flex h-full w-full items-center overflow-hidden rounded border border-solid" };
5
+ const _hoisted_2 = ["placeholder", "type"];
6
+ const _sfc_main = /* @__PURE__ */ defineComponent({
7
+ __name: "input",
8
+ props: {
9
+ modelValue: { default: null },
10
+ modelModifiers: {},
11
+ type: { default: "text" },
12
+ placeHolder: {},
13
+ clearable: { type: Boolean, default: false },
14
+ size: { default: "default" }
15
+ },
16
+ emits: ["update:modelValue", "blur", "input", "change"],
17
+ setup(__props, { emit: __emit }) {
18
+ const props = __props;
19
+ const heightClass = computed(() => ({
20
+ "h-8": props.size === "large",
21
+ "h-7": props.size === "default",
22
+ "h-6": props.size === "small"
23
+ }));
24
+ const inputValue = computed({
25
+ get() {
26
+ return props.modelValue;
27
+ },
28
+ set(value) {
29
+ var _a, _b;
30
+ let processedValue = value;
31
+ if ((_a = props.modelModifiers) == null ? void 0 : _a.trim) {
32
+ if (typeof processedValue === "string") {
33
+ processedValue = processedValue.trim();
34
+ }
35
+ }
36
+ if ((_b = props.modelModifiers) == null ? void 0 : _b.number) {
37
+ processedValue = processedValue ? Number(processedValue) : null;
38
+ }
39
+ emit("update:modelValue", processedValue);
40
+ }
41
+ });
42
+ const emit = __emit;
43
+ const ParentGetInputHandle = inject("inputHandle", () => null);
44
+ const ParentGetBlurHandle = inject("blurHandle", () => null);
45
+ const clearHandle = () => {
46
+ emit("update:modelValue", null);
47
+ emit("change", null);
48
+ };
49
+ const showcloseico = computed(() => {
50
+ return props.clearable && props.modelValue !== null && props.modelValue !== "";
51
+ });
52
+ const processValue = (rawValue, methodStr) => {
53
+ var _a, _b;
54
+ let value = ((_a = props.modelModifiers) == null ? void 0 : _a.trim) ? rawValue.trim() : rawValue;
55
+ if ((_b = props.modelModifiers) == null ? void 0 : _b.number) {
56
+ return value ? Number(value) : null;
57
+ }
58
+ if (methodStr === "blur") {
59
+ ParentGetBlurHandle(value || null);
60
+ } else {
61
+ ParentGetInputHandle(value || null);
62
+ }
63
+ return value || null;
64
+ };
65
+ const handleBlur = (event) => {
66
+ const target = event.target;
67
+ emit("blur", processValue(target.value, "blur"));
68
+ };
69
+ const handleInput = (event) => {
70
+ const target = event.target;
71
+ emit("input", processValue(target.value, "input"));
72
+ };
73
+ const handleChange = (event) => {
74
+ const target = event.target;
75
+ emit("change", processValue(target.value, "change"));
76
+ };
77
+ return (_ctx, _cache) => {
78
+ return openBlock(), createElementBlock("div", _hoisted_1, [
79
+ renderSlot(_ctx.$slots, "prepend"),
80
+ withDirectives(createElementVNode("input", {
81
+ class: normalizeClass(["w-full px-2 outline-none appearance-none", heightClass.value]),
82
+ placeholder: _ctx.placeHolder,
83
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event),
84
+ type: _ctx.type,
85
+ onBlur: handleBlur,
86
+ onInput: handleInput,
87
+ onChange: handleChange
88
+ }, null, 42, _hoisted_2), [
89
+ [vModelDynamic, inputValue.value]
90
+ ]),
91
+ withDirectives(createElementVNode("button", {
92
+ type: "button",
93
+ onClick: clearHandle,
94
+ class: "mr-2 flex-grow-0"
95
+ }, [
96
+ createVNode(delIcon, { class: "w-3 h-3" })
97
+ ], 512), [
98
+ [vShow, showcloseico.value]
99
+ ]),
100
+ renderSlot(_ctx.$slots, "append")
101
+ ]);
102
+ };
103
+ }
104
+ });
105
+ export {
106
+ _sfc_main as default
107
+ };
@@ -0,0 +1,86 @@
1
+ import { defineComponent, computed, ref, openBlock, createElementBlock, createElementVNode, Fragment, renderList, withDirectives, vModelRadio, normalizeClass, toDisplayString, normalizeStyle } from "vue";
2
+ const _hoisted_1 = ["value"];
3
+ const _hoisted_2 = { class: "w-full border-t-2 border-gray-200 border-solid mt-2 relative" };
4
+ const _sfc_main = /* @__PURE__ */ defineComponent({
5
+ __name: "menu",
6
+ props: {
7
+ menulist: {},
8
+ activeIndex: { default: 1 }
9
+ },
10
+ emits: ["updatemenu", "update:activeIndex"],
11
+ setup(__props, { emit: __emit }) {
12
+ const props = __props;
13
+ const bigIndex = computed({
14
+ set(val) {
15
+ emit("update:activeIndex", val);
16
+ emit("updatemenu", val);
17
+ },
18
+ get() {
19
+ updateIndicatorPosition();
20
+ if (props.menulist.length === 0)
21
+ return 0;
22
+ if (props.menulist.length <= props.activeIndex)
23
+ return props.menulist.length - 1;
24
+ return props.activeIndex;
25
+ }
26
+ });
27
+ const emit = __emit;
28
+ const menuListRef = ref();
29
+ const indicatorPosition = ref(0);
30
+ const indicatorStyle = computed(() => ({
31
+ transform: `translateX(${indicatorPosition.value}px)`,
32
+ width: `${currentItemWidth.value}px`
33
+ }));
34
+ const currentItemWidth = computed(() => {
35
+ var _a;
36
+ if (!menuListRef.value)
37
+ return 0;
38
+ return ((_a = menuListRef.value.children[props.activeIndex]) == null ? void 0 : _a.clientWidth) || 0;
39
+ });
40
+ const updateIndicatorPosition = () => {
41
+ if (!menuListRef.value)
42
+ return;
43
+ const currentItem = menuListRef.value.children[props.activeIndex];
44
+ if (currentItem) {
45
+ const containerRect = menuListRef.value.getBoundingClientRect();
46
+ const itemRect = currentItem.getBoundingClientRect();
47
+ indicatorPosition.value = itemRect.left - containerRect.left;
48
+ }
49
+ };
50
+ return (_ctx, _cache) => {
51
+ return openBlock(), createElementBlock("div", null, [
52
+ createElementVNode("div", {
53
+ class: "w-full flex text-word6 space-x-4",
54
+ ref_key: "menuListRef",
55
+ ref: menuListRef
56
+ }, [
57
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menulist, (item, i) => {
58
+ return openBlock(), createElementBlock("label", { key: item }, [
59
+ withDirectives(createElementVNode("input", {
60
+ class: "hidden",
61
+ name: "classone",
62
+ type: "radio",
63
+ value: i,
64
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => bigIndex.value = $event)
65
+ }, null, 8, _hoisted_1), [
66
+ [vModelRadio, bigIndex.value]
67
+ ]),
68
+ createElementVNode("span", {
69
+ class: normalizeClass(["hover:text-blue-brand text-sm cursor-pointer inline-block text-center px-2", { "text-blue-brand": bigIndex.value == i }])
70
+ }, toDisplayString(item), 3)
71
+ ]);
72
+ }), 128))
73
+ ], 512),
74
+ createElementVNode("div", _hoisted_2, [
75
+ createElementVNode("div", {
76
+ class: "absolute w-14 border-t-2 border-solid border-blue-brand bottom-0 transition",
77
+ style: normalizeStyle(indicatorStyle.value)
78
+ }, null, 4)
79
+ ])
80
+ ]);
81
+ };
82
+ }
83
+ });
84
+ export {
85
+ _sfc_main as default
86
+ };
@@ -0,0 +1,119 @@
1
+ import { openBlock, createElementBlock, createElementVNode, defineComponent, computed, normalizeClass, createVNode, withDirectives, vModelText } from "vue";
2
+ import { _ as _export_sfc } from "./index-b4e420ce.js";
3
+ const _sfc_main$2 = {};
4
+ const _hoisted_1$2 = {
5
+ viewBox: "0 0 1024 1024",
6
+ version: "1.1",
7
+ xmlns: "http://www.w3.org/2000/svg"
8
+ };
9
+ function _sfc_render$1(_ctx, _cache) {
10
+ return openBlock(), createElementBlock("svg", _hoisted_1$2, _cache[0] || (_cache[0] = [
11
+ createElementVNode("path", { d: "M853.333333 544H170.666667c-17.066667 0-32-14.933333-32-32s14.933333-32 32-32h682.666666c17.066667 0 32 14.933333 32 32s-14.933333 32-32 32z" }, null, -1)
12
+ ]));
13
+ }
14
+ const minusIcon = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1]]);
15
+ const _sfc_main$1 = {};
16
+ const _hoisted_1$1 = {
17
+ viewBox: "0 0 1024 1024",
18
+ version: "1.1",
19
+ xmlns: "http://www.w3.org/2000/svg"
20
+ };
21
+ function _sfc_render(_ctx, _cache) {
22
+ return openBlock(), createElementBlock("svg", _hoisted_1$1, _cache[0] || (_cache[0] = [
23
+ createElementVNode("path", { d: "M853.333333 480H544V170.666667c0-17.066667-14.933333-32-32-32s-32 14.933333-32 32v309.333333H170.666667c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h309.333333V853.333333c0 17.066667 14.933333 32 32 32s32-14.933333 32-32V544H853.333333c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32z" }, null, -1)
24
+ ]));
25
+ }
26
+ const addIcon = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render]]);
27
+ const _hoisted_1 = { class: "inline-flex w-full rounded-sm border border-solid" };
28
+ const _hoisted_2 = ["disabled"];
29
+ const _hoisted_3 = ["disabled"];
30
+ const _sfc_main = /* @__PURE__ */ defineComponent({
31
+ __name: "numberinput",
32
+ props: {
33
+ modelValue: {},
34
+ size: { default: "default" },
35
+ min: {},
36
+ max: {},
37
+ strict: { type: Boolean, default: false },
38
+ step: { default: 1 },
39
+ integer: { type: Boolean, default: false }
40
+ },
41
+ emits: ["update:modelValue", "NumChange"],
42
+ setup(__props, { emit: __emit }) {
43
+ const props = __props;
44
+ const sizeClass = computed(() => ({
45
+ "h-8 w-8": props.size === "large",
46
+ "h-7 w-7": props.size === "default",
47
+ "h-6 w-6": props.size === "small"
48
+ }));
49
+ const bounds = computed(() => ({
50
+ min: props.min ?? -Infinity,
51
+ max: props.max ?? Infinity
52
+ }));
53
+ const isMinReached = computed(() => props.modelValue <= bounds.value.min);
54
+ const isMaxReached = computed(() => props.modelValue >= bounds.value.max);
55
+ function updateModelValueAndEmit(value) {
56
+ const formattedValue = value.toFixed(lastLen.value);
57
+ emitAct("update:modelValue", Number(formattedValue));
58
+ emitAct("NumChange", Number(formattedValue));
59
+ }
60
+ const emitAct = __emit;
61
+ const lastLen = computed(() => {
62
+ const stepString = props.step.toString();
63
+ return stepString.includes(".") ? stepString.split(".")[1].length : 0;
64
+ });
65
+ const addHandle = () => {
66
+ let result = props.modelValue + props.step;
67
+ updateModelValueAndEmit(result);
68
+ };
69
+ const reduceHandle = () => {
70
+ let result = props.modelValue - props.step;
71
+ updateModelValueAndEmit(result);
72
+ };
73
+ const inputValue = computed({
74
+ get() {
75
+ return props.modelValue;
76
+ },
77
+ set(value) {
78
+ if (isNaN(Number(value))) {
79
+ emitAct("update:modelValue", Number(props.modelValue));
80
+ } else if (props.integer && /[.]/.test(value.toString())) {
81
+ emitAct("update:modelValue", Number(props.modelValue));
82
+ } else {
83
+ emitAct("update:modelValue", Number(value));
84
+ emitAct("NumChange", Number(value));
85
+ }
86
+ }
87
+ });
88
+ return (_ctx, _cache) => {
89
+ return openBlock(), createElementBlock("div", _hoisted_1, [
90
+ createElementVNode("button", {
91
+ type: "button",
92
+ disabled: isMinReached.value,
93
+ onClick: reduceHandle,
94
+ class: normalizeClass(["disabled:cursor-not-allowed flex-none bg-gray-200 text-xs", sizeClass.value])
95
+ }, [
96
+ createVNode(minusIcon, { class: "h-4 w-4 fill-word6 inline-block" })
97
+ ], 10, _hoisted_2),
98
+ withDirectives(createElementVNode("input", {
99
+ class: "w-full px-1 text-center outline-none text-word3",
100
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event),
101
+ type: "text"
102
+ }, null, 512), [
103
+ [vModelText, inputValue.value]
104
+ ]),
105
+ createElementVNode("button", {
106
+ type: "button",
107
+ disabled: isMaxReached.value,
108
+ onClick: addHandle,
109
+ class: normalizeClass(["disabled:cursor-not-allowed flex-none bg-gray-200 text-xs", sizeClass.value])
110
+ }, [
111
+ createVNode(addIcon, { class: "h-4 w-4 fill-word6 inline-block" })
112
+ ], 10, _hoisted_3)
113
+ ]);
114
+ };
115
+ }
116
+ });
117
+ export {
118
+ _sfc_main as default
119
+ };
@@ -0,0 +1,203 @@
1
+ import { openBlock, createElementBlock, createElementVNode, defineComponent, defineAsyncComponent, computed, withDirectives, createVNode, unref, withCtx, Fragment, renderList, createBlock, toDisplayString, createCommentVNode, normalizeClass, vShow } from "vue";
2
+ import { A as ArrowPlug } from "./dateArrowplus-8181993f.js";
3
+ import { _ as _export_sfc } from "./index-b4e420ce.js";
4
+ const _sfc_main$1 = {};
5
+ const _hoisted_1$1 = {
6
+ style: { "width": "1em", "height": "1em", "vertical-align": "middle", "fill": "currentColor", "overflow": "hidden" },
7
+ viewBox: "0 0 1024 1024",
8
+ version: "1.1",
9
+ xmlns: "http://www.w3.org/2000/svg"
10
+ };
11
+ function _sfc_render(_ctx, _cache) {
12
+ return openBlock(), createElementBlock("svg", _hoisted_1$1, _cache[0] || (_cache[0] = [
13
+ createElementVNode("path", {
14
+ d: "M192 512m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z",
15
+ fill: "currentColor"
16
+ }, null, -1),
17
+ createElementVNode("path", {
18
+ d: "M512 512m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z",
19
+ fill: "currentColor"
20
+ }, null, -1),
21
+ createElementVNode("path", {
22
+ d: "M832 512m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z",
23
+ fill: "currentColor"
24
+ }, null, -1)
25
+ ]));
26
+ }
27
+ const ellipsisIcon = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render]]);
28
+ const _hoisted_1 = { class: "flex items-center w-full h-7 text-sm text-center select-none" };
29
+ const _hoisted_2 = {
30
+ key: 0,
31
+ class: "w-24 h-7 flex-none px-1"
32
+ };
33
+ const _hoisted_3 = { class: "text-center" };
34
+ const _hoisted_4 = ["disabled"];
35
+ const _hoisted_5 = { class: "flex items-center" };
36
+ const _hoisted_6 = ["onClick"];
37
+ const _hoisted_7 = ["disabled"];
38
+ const _sfc_main = /* @__PURE__ */ defineComponent({
39
+ __name: "pagination",
40
+ props: {
41
+ sizeArr: {},
42
+ total: {},
43
+ hideOnSinglePage: { type: Boolean, default: false },
44
+ currentPage: { default: 1 },
45
+ activeSize: { default: 20 },
46
+ visibleRange: { default: 3 },
47
+ edgeVisibleCount: { default: 7 }
48
+ },
49
+ emits: [
50
+ "size-change",
51
+ "current-change",
52
+ "update:currentPage",
53
+ "update:activeSize"
54
+ ],
55
+ setup(__props, { emit: __emit }) {
56
+ const LibSelect = defineAsyncComponent(() => import("./select-b5bbb138.js"));
57
+ const LibSelectOption = defineAsyncComponent(
58
+ () => import("./selectoption-00c8f06d.js")
59
+ );
60
+ const props = __props;
61
+ const showSizeSelector = computed(() => {
62
+ var _a;
63
+ return props.sizeArr && ((_a = props.sizeArr) == null ? void 0 : _a.length) > 0;
64
+ });
65
+ const emit = __emit;
66
+ const size = computed({
67
+ set(num) {
68
+ emit("size-change", num);
69
+ emit("update:activeSize", num);
70
+ },
71
+ get() {
72
+ return props.activeSize;
73
+ }
74
+ });
75
+ const maxPage = computed(() => {
76
+ return Math.ceil(props.total / size.value);
77
+ });
78
+ const numberArr = computed(() => {
79
+ if (maxPage.value <= props.edgeVisibleCount) {
80
+ return range(2, maxPage.value - 1);
81
+ }
82
+ const start = Math.max(2, currentPage.value - props.visibleRange);
83
+ const end = Math.min(
84
+ maxPage.value - 1,
85
+ currentPage.value + props.visibleRange
86
+ );
87
+ return range(start, end);
88
+ });
89
+ const showComponent = computed(() => {
90
+ if (props.hideOnSinglePage === true) {
91
+ return maxPage.value > 1;
92
+ } else {
93
+ return true;
94
+ }
95
+ });
96
+ const currentPage = computed({
97
+ set(num) {
98
+ emit("current-change", num);
99
+ emit("update:currentPage", num);
100
+ },
101
+ get() {
102
+ return props.currentPage;
103
+ }
104
+ });
105
+ const firstBtnDisable = computed(() => {
106
+ return currentPage.value === 1;
107
+ });
108
+ const lastBtnDisable = computed(() => {
109
+ return currentPage.value >= maxPage.value;
110
+ });
111
+ const showFirst = computed(() => {
112
+ return currentPage.value - 5 > 0 && maxPage.value > 7;
113
+ });
114
+ const showLast = computed(() => {
115
+ return maxPage.value - currentPage.value > 4 && maxPage.value > 7;
116
+ });
117
+ const activeChange = (num) => {
118
+ currentPage.value += num;
119
+ };
120
+ const indexHandle = (k) => {
121
+ currentPage.value = k;
122
+ };
123
+ const range = (start, end) => {
124
+ const length = end - start + 1;
125
+ return Array.from({ length }, (_, i) => start + i);
126
+ };
127
+ return (_ctx, _cache) => {
128
+ return withDirectives((openBlock(), createElementBlock("div", _hoisted_1, [
129
+ showSizeSelector.value ? (openBlock(), createElementBlock("div", _hoisted_2, [
130
+ createVNode(unref(LibSelect), {
131
+ modelValue: size.value,
132
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => size.value = $event)
133
+ }, {
134
+ default: withCtx(() => [
135
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.sizeArr, (i) => {
136
+ return openBlock(), createBlock(unref(LibSelectOption), {
137
+ value: i,
138
+ label: `${i}条/页`
139
+ }, {
140
+ default: withCtx(() => [
141
+ createElementVNode("div", _hoisted_3, [
142
+ createElementVNode("span", null, toDisplayString(i) + "条", 1),
143
+ _cache[5] || (_cache[5] = createElementVNode("span", null, "/页", -1))
144
+ ])
145
+ ]),
146
+ _: 2
147
+ }, 1032, ["value", "label"]);
148
+ }), 256))
149
+ ]),
150
+ _: 1
151
+ }, 8, ["modelValue"])
152
+ ])) : createCommentVNode("", true),
153
+ createElementVNode("button", {
154
+ onClick: _cache[1] || (_cache[1] = ($event) => activeChange(-1)),
155
+ type: "button",
156
+ class: normalizeClass(["w-5 h-5", { "cursor-not-allowed": firstBtnDisable.value }]),
157
+ disabled: firstBtnDisable.value
158
+ }, [
159
+ createVNode(ArrowPlug, { class: "h-4 w-4" })
160
+ ], 10, _hoisted_4),
161
+ createElementVNode("ul", _hoisted_5, [
162
+ createElementVNode("li", {
163
+ onClick: _cache[2] || (_cache[2] = ($event) => indexHandle(1)),
164
+ class: normalizeClass(["px-2 h-5 leading-5 cursor-pointer font-bold", { "text-blue-500": 1 === currentPage.value }])
165
+ }, " 1 ", 2),
166
+ showFirst.value ? (openBlock(), createBlock(ellipsisIcon, {
167
+ key: 0,
168
+ class: "fill-word6 w-4 h-4 block"
169
+ })) : createCommentVNode("", true),
170
+ (openBlock(true), createElementBlock(Fragment, null, renderList(numberArr.value, (i) => {
171
+ return openBlock(), createElementBlock("li", {
172
+ onClick: ($event) => indexHandle(i),
173
+ class: normalizeClass([{ "text-blue-500": i === currentPage.value }, "px-2 h-5 leading-5 cursor-pointer font-bold"]),
174
+ key: i
175
+ }, toDisplayString(i), 11, _hoisted_6);
176
+ }), 128)),
177
+ showLast.value ? (openBlock(), createBlock(ellipsisIcon, {
178
+ key: 1,
179
+ class: "fill-word6 w-4 h-4 block"
180
+ })) : createCommentVNode("", true),
181
+ maxPage.value > 1 ? (openBlock(), createElementBlock("li", {
182
+ key: 2,
183
+ onClick: _cache[3] || (_cache[3] = ($event) => indexHandle(maxPage.value)),
184
+ class: normalizeClass(["px-2 h-5 leading-5 cursor-pointer font-bold", { "text-blue-500": maxPage.value === currentPage.value }])
185
+ }, toDisplayString(maxPage.value), 3)) : createCommentVNode("", true)
186
+ ]),
187
+ createElementVNode("button", {
188
+ onClick: _cache[4] || (_cache[4] = ($event) => activeChange(1)),
189
+ type: "button",
190
+ class: normalizeClass(["w-5 h-5", { "cursor-not-allowed": lastBtnDisable.value }]),
191
+ disabled: lastBtnDisable.value
192
+ }, [
193
+ createVNode(ArrowPlug, { class: "h-4 w-4 rotate-180 transform" })
194
+ ], 10, _hoisted_7)
195
+ ], 512)), [
196
+ [vShow, showComponent.value]
197
+ ]);
198
+ };
199
+ }
200
+ });
201
+ export {
202
+ _sfc_main as default
203
+ };