ninemoon-ui 0.0.27 → 0.1.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.
Files changed (109) hide show
  1. package/dist/components/alert/alert.d.ts +3 -11
  2. package/dist/components/alert/alertcomponent.vue.d.ts +22 -11
  3. package/dist/components/badge/badge.vue.d.ts +2 -0
  4. package/dist/components/carousel/carousel.vue.d.ts +29 -3
  5. package/dist/components/{tree/tree.vue.d.ts → carousel/clickbutton.vue.d.ts} +6 -19
  6. package/dist/components/check/checkbox.vue.d.ts +24 -16
  7. package/dist/components/check/checkgroup.vue.d.ts +15 -3
  8. package/dist/components/date/datepicker.vue.d.ts +28 -6
  9. package/dist/components/date/datepickerRange.vue.d.ts +15 -4
  10. package/dist/components/form/form.vue.d.ts +7 -20
  11. package/dist/components/form/formlabel.vue.d.ts +3 -3
  12. package/dist/components/form/type.d.ts +11 -0
  13. package/dist/components/icon/add.vue.d.ts +2 -0
  14. package/dist/components/icon/alertTip.vue.d.ts +2 -0
  15. package/dist/components/icon/arrow.vue.d.ts +2 -0
  16. package/dist/components/icon/calendar.vue.d.ts +2 -0
  17. package/dist/components/icon/close.vue.d.ts +2 -0
  18. package/dist/components/icon/dateArrow.vue.d.ts +2 -0
  19. package/dist/components/icon/dateArrowplus.vue.d.ts +2 -0
  20. package/dist/components/icon/delete.vue.d.ts +2 -0
  21. package/dist/components/icon/ellipsis.vue.d.ts +2 -0
  22. package/dist/components/icon/errTip.vue.d.ts +2 -0
  23. package/dist/components/icon/eye.vue.d.ts +2 -0
  24. package/dist/components/icon/infoTip.vue.d.ts +2 -0
  25. package/dist/components/icon/minus.vue.d.ts +2 -0
  26. package/dist/components/icon/successTip.vue.d.ts +2 -0
  27. package/dist/components/icon/turnleft.vue.d.ts +2 -0
  28. package/dist/components/icon/turnright.vue.d.ts +2 -0
  29. package/dist/components/icon/warnTip.vue.d.ts +2 -0
  30. package/dist/components/input/input.vue.d.ts +13 -8
  31. package/dist/components/loadding/loadcomponent.vue.d.ts +24 -4
  32. package/dist/components/loadding/loadding.d.ts +12 -19
  33. package/dist/components/menu/menu.vue.d.ts +13 -3
  34. package/dist/components/message/message.d.ts +68 -14
  35. package/dist/components/message/messagecomponent.vue.d.ts +5 -13
  36. package/dist/components/numberInput/numberinput.vue.d.ts +3 -3
  37. package/dist/components/pagination/pagination.vue.d.ts +24 -0
  38. package/dist/components/popover/poparrow.d.ts +55 -0
  39. package/dist/components/popover/popover.vue.d.ts +10 -4
  40. package/dist/components/radio/radiobox.vue.d.ts +24 -16
  41. package/dist/components/radio/radiogroup.vue.d.ts +15 -3
  42. package/dist/components/scrollBar/movebar.vue.d.ts +2 -2
  43. package/dist/components/scrollBar/scrollBar.vue.d.ts +12 -16
  44. package/dist/components/scrollloading/scrolllead.d.ts +18 -11
  45. package/dist/components/select/select.vue.d.ts +15 -1
  46. package/dist/components/select/selectoption.vue.d.ts +18 -6
  47. package/dist/components/switch/switch.vue.d.ts +14 -14
  48. package/dist/components/table/table.vue.d.ts +20 -9
  49. package/dist/components/table/tableItem.vue.d.ts +10 -4
  50. package/dist/components/tabs/tabs.vue.d.ts +14 -1
  51. package/dist/dialog.css +9 -0
  52. package/dist/directives/arrowKeys.d.ts +10 -0
  53. package/dist/directives/drag.d.ts +20 -0
  54. package/dist/directives/escape.d.ts +7 -0
  55. package/dist/directives/outsideclick.d.ts +14 -0
  56. package/dist/directives/watchwindow.d.ts +13 -0
  57. package/dist/directives/wheel.d.ts +12 -0
  58. package/dist/directives/whitespaceclick.d.ts +12 -0
  59. package/dist/index.css +1186 -873
  60. package/dist/index.d.ts +831 -401
  61. package/dist/index.es.js +22 -23
  62. package/dist/index.umd.js +4019 -3764
  63. package/dist/js/arrow/arrow.js +17 -0
  64. package/dist/js/badge/badge.js +9 -16
  65. package/dist/js/calendar/calendar.js +87 -0
  66. package/dist/js/carousel/carousel.js +101 -117
  67. package/dist/js/carousel/carouselitem.js +1 -7
  68. package/dist/js/check/checkbox.js +38 -4
  69. package/dist/js/check/checkgroup.js +40 -51
  70. package/dist/js/date/datepicker.js +146 -150
  71. package/dist/js/date/datepickerRange.js +265 -354
  72. package/dist/js/dateArrowplus/dateArrowplus.js +25 -0
  73. package/dist/js/delete/delete.js +19 -0
  74. package/dist/js/dialog/dialog.js +41 -57
  75. package/dist/js/form/form.js +30 -38
  76. package/dist/js/form/formlabel.js +99 -130
  77. package/dist/js/image/image.js +199 -149
  78. package/dist/js/index/index.js +605 -507
  79. package/dist/js/input/input.js +60 -43
  80. package/dist/js/menu/menu.js +47 -20
  81. package/dist/js/numberInput/numberinput.js +52 -60
  82. package/dist/js/pagination/pagination.js +125 -156
  83. package/dist/js/popover/popover.js +238 -134
  84. package/dist/js/radio/radiobox.js +37 -4
  85. package/dist/js/radio/radiogroup.js +15 -51
  86. package/dist/js/scrollBar/scrollBar.js +100 -56
  87. package/dist/js/select/select.js +155 -70
  88. package/dist/js/select/selectoption.js +45 -4
  89. package/dist/js/shapeFlag/shapeFlag.js +17 -0
  90. package/dist/js/switch/switch.js +14 -14
  91. package/dist/js/table/table.js +165 -111
  92. package/dist/js/table/tableItem.js +1 -1
  93. package/dist/js/tabs/tabs.js +57 -59
  94. package/dist/js/upload/upload.js +8 -23
  95. package/dist/tabs.css +3 -3
  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/js/getcalendar/getcalendar.js +0 -48
  105. package/dist/js/tree/tree.js +0 -72
  106. package/dist/js/tree/treeleaf.js +0 -116
  107. package/dist/radiogroup.css +0 -44
  108. package/dist/scrollBar.css +0 -37
  109. package/dist/select.css +0 -20
@@ -0,0 +1,17 @@
1
+ import { openBlock, createElementBlock, createElementVNode } from "vue";
2
+ import { _ as _export_sfc } from "../index/index.js";
3
+ const _sfc_main = {};
4
+ const _hoisted_1 = {
5
+ viewBox: "0 0 1024 1024",
6
+ version: "1.1",
7
+ xmlns: "http://www.w3.org/2000/svg"
8
+ };
9
+ function _sfc_render(_ctx, _cache) {
10
+ return openBlock(), createElementBlock("svg", _hoisted_1, _cache[0] || (_cache[0] = [
11
+ createElementVNode("path", { d: "M320 885.333333c-8.533333 0-17.066667-4.266667-23.466667-10.666666-12.8-12.8-10.666667-34.133333 2.133334-44.8L654.933333 512 298.666667 194.133333c-12.8-10.666667-14.933333-32-2.133334-44.8 10.666667-12.8 32-14.933333 44.8-2.133333l384 341.333333c6.4 6.4 10.666667 14.933333 10.666667 23.466667 0 8.533333-4.266667 17.066667-10.666667 23.466667l-384 341.333333c-6.4 6.4-12.8 8.533333-21.333333 8.533333z" }, null, -1)
12
+ ]));
13
+ }
14
+ const ArrowIcon = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
15
+ export {
16
+ ArrowIcon as A
17
+ };
@@ -1,25 +1,19 @@
1
- import { defineComponent, ref, computed, openBlock, createElementBlock, renderSlot, withDirectives, createElementVNode, normalizeClass, toDisplayString, vShow } from "vue";
2
- const _hoisted_1 = { class: "tdd-relative" };
1
+ import { defineComponent, readonly, computed, openBlock, createElementBlock, renderSlot, withDirectives, createElementVNode, normalizeClass, unref, toDisplayString, vShow } from "vue";
2
+ const _hoisted_1 = { class: "relative" };
3
3
  const _sfc_main = /* @__PURE__ */ defineComponent({
4
4
  __name: "badge",
5
5
  props: {
6
6
  value: {},
7
7
  max: { default: 9 },
8
- placement: { default: "rightTop" }
8
+ placement: { default: "rightTop" },
9
+ customClass: {}
9
10
  },
10
11
  setup(__props) {
11
12
  const props = __props;
12
- const ClassArr = ref([]);
13
- const addClass = computed(() => ClassArr.value.join(" "));
14
- switch (props.placement) {
15
- case "right":
16
- ClassArr.value.push("EBage_right");
17
- break;
18
- case "rightTop":
19
- default:
20
- ClassArr.value.push("EBage_default");
21
- break;
22
- }
13
+ const classSet = readonly({
14
+ rightTop: "-top-1/2",
15
+ right: "top-0"
16
+ });
23
17
  const showMark = computed(() => Number(props.value) > 0);
24
18
  const mark = computed(() => {
25
19
  if (Number(props.max) < Number(props.value)) {
@@ -32,7 +26,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
32
26
  return openBlock(), createElementBlock("span", _hoisted_1, [
33
27
  renderSlot(_ctx.$slots, "default"),
34
28
  withDirectives(createElementVNode("sup", {
35
- class: normalizeClass(["EBage", addClass.value])
29
+ class: normalizeClass(["absolute inline-block -right-3 -translate-y-1/2 translate-x-full transform rounded-lg bg-red-500 px-1.5 py-px text-xs text-white", [unref(classSet)[_ctx.placement], _ctx.customClass]])
36
30
  }, toDisplayString(mark.value), 3), [
37
31
  [vShow, showMark.value]
38
32
  ])
@@ -40,7 +34,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
40
34
  };
41
35
  }
42
36
  });
43
- const badge_vue_vue_type_style_index_0_lang = "";
44
37
  export {
45
38
  _sfc_main as default
46
39
  };
@@ -0,0 +1,87 @@
1
+ import { openBlock, createElementBlock, createElementVNode } from "vue";
2
+ import { _ as _export_sfc } from "../index/index.js";
3
+ const getMonthDays = (year, month, flag) => {
4
+ let stratDate = new Date(year, month - 1, 1).getTime(), endData = new Date(year, month, 1).getTime();
5
+ let days = (endData - stratDate) / (1e3 * 60 * 60 * 24);
6
+ let list = [];
7
+ for (let i = 1; i <= days; i++) {
8
+ const d = i;
9
+ const week = (/* @__PURE__ */ new Date(month + "/" + i + "/" + year)).getDay() == 0 ? "日" : (/* @__PURE__ */ new Date(month + "/" + i + "/" + year)).getDay() == 1 ? "一" : (/* @__PURE__ */ new Date(month + "/" + i + "/" + year)).getDay() == 2 ? "二" : (/* @__PURE__ */ new Date(month + "/" + i + "/" + year)).getDay() == 3 ? "三" : (/* @__PURE__ */ new Date(month + "/" + i + "/" + year)).getDay() == 4 ? "四" : (/* @__PURE__ */ new Date(month + "/" + i + "/" + year)).getDay() == 5 ? "五" : (/* @__PURE__ */ new Date(month + "/" + i + "/" + year)).getDay() == 6 ? "六" : "";
10
+ let obj = {
11
+ week,
12
+ d,
13
+ m: month,
14
+ y: year,
15
+ isChoosed1Day: false,
16
+ isChoosed2Day: false
17
+ };
18
+ if (flag === 1) {
19
+ Object.assign(obj, {
20
+ pred: true
21
+ });
22
+ } else if (flag === 2) {
23
+ Object.assign(obj, {
24
+ nextd: true
25
+ });
26
+ } else {
27
+ Object.assign(obj, {
28
+ newd: true
29
+ });
30
+ }
31
+ list.push(obj);
32
+ }
33
+ return list;
34
+ };
35
+ const addZero = (data) => {
36
+ let t = Number(data);
37
+ if (isNaN(t)) {
38
+ throw new Error("日期格式不正确");
39
+ } else {
40
+ if (t < 10) {
41
+ return `0${t}`;
42
+ } else {
43
+ return `${t}`;
44
+ }
45
+ }
46
+ };
47
+ const _sfc_main$1 = {};
48
+ const _hoisted_1$1 = {
49
+ viewBox: "0 0 1024 1024",
50
+ version: "1.1",
51
+ xmlns: "http://www.w3.org/2000/svg"
52
+ };
53
+ function _sfc_render$1(_ctx, _cache) {
54
+ return openBlock(), createElementBlock("svg", _hoisted_1$1, _cache[0] || (_cache[0] = [
55
+ createElementVNode("path", {
56
+ d: "M320 885.333333c-8.533333 0-17.066667-4.266667-23.466667-10.666666-12.8-12.8-10.666667-34.133333 2.133334-44.8L654.933333 512 298.666667 194.133333c-12.8-10.666667-14.933333-32-2.133334-44.8 10.666667-12.8 32-14.933333 44.8-2.133333l384 341.333333c6.4 6.4 10.666667 14.933333 10.666667 23.466667 0 8.533333-4.266667 17.066667-10.666667 23.466667l-384 341.333333c-6.4 6.4-12.8 8.533333-21.333333 8.533333z",
57
+ fill: "#666666"
58
+ }, null, -1)
59
+ ]));
60
+ }
61
+ const Arrow = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
62
+ const _sfc_main = {};
63
+ const _hoisted_1 = {
64
+ style: { "width": "1em", "height": "1em", "vertical-align": "middle", "fill": "currentColor", "overflow": "hidden" },
65
+ viewBox: "0 0 1024 1024",
66
+ version: "1.1",
67
+ xmlns: "http://www.w3.org/2000/svg"
68
+ };
69
+ function _sfc_render(_ctx, _cache) {
70
+ return openBlock(), createElementBlock("svg", _hoisted_1, _cache[0] || (_cache[0] = [
71
+ createElementVNode("path", {
72
+ d: "M853.333333 149.333333h-138.666666V106.666667c0-17.066667-14.933333-32-32-32s-32 14.933333-32 32v42.666666h-277.333334V106.666667c0-17.066667-14.933333-32-32-32s-32 14.933333-32 32v42.666666H170.666667c-40.533333 0-74.666667 34.133333-74.666667 74.666667v618.666667C96 883.2 130.133333 917.333333 170.666667 917.333333h682.666666c40.533333 0 74.666667-34.133333 74.666667-74.666666v-618.666667C928 183.466667 893.866667 149.333333 853.333333 149.333333zM170.666667 213.333333h138.666666v64c0 17.066667 14.933333 32 32 32s32-14.933333 32-32v-64h277.333334v64c0 17.066667 14.933333 32 32 32s32-14.933333 32-32v-64H853.333333c6.4 0 10.666667 4.266667 10.666667 10.666667v194.133333c-4.266667-2.133333-6.4-2.133333-10.666667-2.133333H170.666667c-4.266667 0-6.4 0-10.666667 2.133333v-194.133333c0-6.4 4.266667-10.666667 10.666667-10.666667z m682.666666 640H170.666667c-6.4 0-10.666667-4.266667-10.666667-10.666666V477.866667c4.266667 2.133333 6.4 2.133333 10.666667 2.133333h682.666666c4.266667 0 6.4 0 10.666667-2.133333v364.8c0 6.4-4.266667 10.666667-10.666667 10.666666z",
73
+ fill: "#666666"
74
+ }, null, -1),
75
+ createElementVNode("path", {
76
+ d: "M384 608h-85.333333c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h85.333333c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM725.333333 608h-192c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h192c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32z",
77
+ fill: "#666666"
78
+ }, null, -1)
79
+ ]));
80
+ }
81
+ const Calendar = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
82
+ export {
83
+ Arrow as A,
84
+ Calendar as C,
85
+ addZero as a,
86
+ getMonthDays as g
87
+ };
@@ -1,171 +1,155 @@
1
- import { defineComponent, useSlots, ref, computed, onMounted, watch, onUnmounted, openBlock, createElementBlock, normalizeStyle, createElementVNode, createVNode, h, normalizeClass } from "vue";
1
+ import { defineComponent, readonly, openBlock, createElementBlock, normalizeClass, unref, createVNode, useSlots, ref, onMounted, computed, watch, onUnmounted, normalizeStyle, h } from "vue";
2
+ import { A as ArrowIcon } from "../arrow/arrow.js";
3
+ import { S as ShapeFlags } from "../shapeFlag/shapeFlag.js";
4
+ import "../index/index.js";
5
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
6
+ __name: "clickbutton",
7
+ props: {
8
+ position: { default: "left" }
9
+ },
10
+ setup(__props) {
11
+ const props = __props;
12
+ const classSet = readonly({
13
+ left: "left-1 rotate-180",
14
+ right: "right-1"
15
+ });
16
+ return (_ctx, _cache) => {
17
+ return openBlock(), createElementBlock("button", {
18
+ type: "button",
19
+ class: normalizeClass(["z-20 text-center group-hover:visible flex invisible items-center justify-center absolute top-1/2 -translate-y-1/2 w-8 h-8 rounded-full bg-slate-300 appearance-none transform outline-none", unref(classSet)[props.position]])
20
+ }, [
21
+ createVNode(ArrowIcon, { class: "w-3 h-3 fill-white inline-block" })
22
+ ], 2);
23
+ };
24
+ }
25
+ });
2
26
  const _sfc_main = /* @__PURE__ */ defineComponent({
3
27
  __name: "carousel",
4
28
  props: {
5
- height: {}
29
+ height: {},
30
+ holdstop: { type: Boolean, default: true },
31
+ startindex: { default: 0 }
6
32
  },
7
33
  setup(__props) {
8
34
  const props = __props;
9
35
  const slots = useSlots();
10
- const activeIndex = ref(0);
11
- const totalLen = computed(() => {
36
+ const body = ref();
37
+ const translatexNum = ref(0);
38
+ onMounted(() => {
39
+ translatexNum.value = body.value.offsetWidth;
40
+ });
41
+ const activeIndex = ref(props.startindex);
42
+ const validSlots = computed(() => {
12
43
  return slots.default().reduce((pre, cur) => {
13
- if (typeof cur.children === "string") {
14
- return pre;
44
+ if (cur.shapeFlag & ShapeFlags.ARRAY_CHILDREN) {
45
+ pre = pre.concat(cur.children);
46
+ } else if (cur.shapeFlag & ShapeFlags.SLOTS_CHILDREN) {
47
+ pre.push(cur);
15
48
  }
16
- if (Array.isArray(cur.children)) {
17
- return pre += cur.children.length;
18
- } else {
19
- return pre += 1;
20
- }
21
- }, 0);
49
+ return pre;
50
+ }, []);
22
51
  });
23
- const bodyHandle = (MySlot, d) => {
24
- let between = d - activeIndex.value;
25
- let transformNum = 0;
26
- if (totalLen.value <= 2) {
27
- transformNum = Math.abs(between * translatexNum.value);
28
- } else {
29
- if (activeIndex.value === 0 && d == totalLen.value - 1) {
30
- transformNum = -translatexNum.value;
31
- } else if (between < -1) {
32
- transformNum = (totalLen.value + between) * translatexNum.value;
33
- } else {
34
- transformNum = between * translatexNum.value;
35
- }
52
+ const totalLen = computed(() => {
53
+ return validSlots.value.length;
54
+ });
55
+ const calculateCarouselTransform = (currentIndex, activeIndex2, totalItems, itemWidth) => {
56
+ if (totalItems <= 2) {
57
+ return Math.abs((currentIndex - activeIndex2) * itemWidth);
36
58
  }
59
+ const circularIndexDiff = (currentIndex - activeIndex2 + totalItems) % totalItems;
60
+ const effectiveIndex = circularIndexDiff > totalItems / 2 ? circularIndexDiff - totalItems : circularIndexDiff;
61
+ return effectiveIndex * itemWidth;
62
+ };
63
+ const bodyHandle = (MySlot, currentIndex) => {
37
64
  return h(
38
65
  "div",
39
66
  {
40
- class: normalizeClass(["carouselBody", [activeIndex.value === d ? "" : "tdd-opacity-0"]]),
67
+ key: currentIndex,
68
+ class: normalizeClass([
69
+ "inline-block transition-all duration-700 w-full h-full absolute top-0 left-0 overflow-hidden",
70
+ [activeIndex.value === currentIndex ? "" : "opacity-0"]
71
+ ]),
41
72
  style: {
42
- transform: `translateX(${transformNum}px)`
73
+ transform: `translateX(${calculateCarouselTransform(
74
+ currentIndex,
75
+ activeIndex.value,
76
+ totalLen.value,
77
+ translatexNum.value
78
+ )}px)`
43
79
  }
44
80
  },
45
- h(MySlot)
81
+ MySlot
46
82
  );
47
83
  };
48
- const renderBody = () => {
49
- let indexflag = -1;
50
- return slots.default().map((MySlot, _) => {
51
- if (typeof MySlot.children == "string")
52
- return null;
53
- if (Array.isArray(MySlot.children)) {
54
- return MySlot.children.map((slot, _2) => {
55
- indexflag += 1;
56
- return bodyHandle(slot, indexflag);
57
- });
58
- } else {
59
- indexflag += 1;
60
- return bodyHandle(MySlot, indexflag);
61
- }
84
+ const renderCarouselItem = () => {
85
+ return validSlots.value.map((MySlot, _) => {
86
+ return bodyHandle(MySlot, _);
62
87
  });
63
88
  };
64
- const body = ref();
65
- const translatexNum = ref(0);
66
- onMounted(() => {
67
- translatexNum.value = body.value.offsetWidth;
68
- });
69
89
  const preHandle = () => {
70
- if (activeIndex.value === 0) {
71
- activeIndex.value = totalLen.value - 1;
72
- } else {
73
- activeIndex.value -= 1;
74
- }
75
- animationFrame && cancelAnimationFrame(animationFrame);
90
+ activeIndex.value = (totalLen.value + activeIndex.value - 1) % totalLen.value;
91
+ animationFrame.value && cancelAnimationFrame(animationFrame.value);
76
92
  };
77
93
  const nextHandle = () => {
78
- if (activeIndex.value === totalLen.value - 1) {
79
- activeIndex.value = 0;
80
- } else {
81
- activeIndex.value += 1;
82
- }
83
- animationFrame && cancelAnimationFrame(animationFrame);
94
+ activeIndex.value = (activeIndex.value + 1) % totalLen.value;
95
+ animationFrame.value && cancelAnimationFrame(animationFrame.value);
84
96
  };
85
- let flagTime;
86
- let animationFrame;
87
- const autoAddHandle = () => {
97
+ const flagTime = ref(null);
98
+ const animationFrame = ref(null);
99
+ const startAutoplay = () => {
88
100
  if (totalLen.value === 1 || totalLen.value === 0) {
89
- animationFrame && cancelAnimationFrame(animationFrame);
101
+ animationFrame.value && cancelAnimationFrame(animationFrame.value);
90
102
  return;
91
103
  }
92
104
  let newtime = (/* @__PURE__ */ new Date()).getTime();
93
- if (flagTime == null)
94
- flagTime = newtime;
95
- if (newtime - flagTime >= 2e3) {
96
- if (activeIndex.value + 1 == totalLen.value) {
97
- activeIndex.value = 0;
98
- } else {
99
- activeIndex.value += 1;
100
- }
101
- flagTime = newtime;
105
+ if (flagTime.value == null)
106
+ flagTime.value = newtime;
107
+ if (newtime - flagTime.value >= 2e3) {
108
+ activeIndex.value = (activeIndex.value + 1) % totalLen.value;
109
+ flagTime.value = newtime;
102
110
  }
103
- animationFrame = requestAnimationFrame(autoAddHandle);
111
+ animationFrame.value = requestAnimationFrame(startAutoplay);
104
112
  };
105
- const mouseEnterHandle = () => {
106
- flagTime = null;
107
- animationFrame && cancelAnimationFrame(animationFrame);
113
+ const stopAutoAddHandle = () => {
114
+ flagTime.value = null;
115
+ animationFrame.value && cancelAnimationFrame(animationFrame.value);
108
116
  };
109
117
  const mouseLeaveHandle = () => {
110
- flagTime = null;
111
- animationFrame && cancelAnimationFrame(animationFrame);
112
- autoAddHandle();
118
+ stopAutoAddHandle();
119
+ startAutoplay();
113
120
  };
114
121
  onMounted(() => {
115
- autoAddHandle();
122
+ startAutoplay();
116
123
  });
117
- watch(totalLen, () => {
118
- flagTime = null;
119
- animationFrame && cancelAnimationFrame(animationFrame);
120
- autoAddHandle();
124
+ watch(totalLen, (newVal, oldVal) => {
125
+ if (newVal !== oldVal) {
126
+ activeIndex.value = Math.min(activeIndex.value, newVal - 1);
127
+ stopAutoAddHandle();
128
+ startAutoplay();
129
+ }
121
130
  });
122
131
  onUnmounted(() => {
123
- flagTime = null;
124
- animationFrame && cancelAnimationFrame(animationFrame);
132
+ stopAutoAddHandle();
125
133
  });
126
134
  return (_ctx, _cache) => {
127
135
  return openBlock(), createElementBlock("div", {
128
136
  onMouseleave: mouseLeaveHandle,
129
- onMouseenter: mouseEnterHandle,
130
- class: "tdd-relative tdd-w-full tdd-group tdd-text-center tdd-overflow-x-hidden",
137
+ onMouseenter: stopAutoAddHandle,
138
+ class: "relative w-full group text-center overflow-x-hidden",
131
139
  ref_key: "body",
132
140
  ref: body,
133
141
  style: normalizeStyle({ height: `${props.height || 200}px` })
134
142
  }, [
135
- createElementVNode("button", {
136
- onClick: preHandle,
137
- type: "button",
138
- class: "tdd-z-20 tdd-text-center group-hover:tdd-flex tdd-hidden tdd-items-center tdd-justify-center tdd-absolute tdd-top-1/2 tdd--translate-y-1/2 tdd-left-1 tdd-w-6 tdd-h-6 tdd-rounded-full tdd-bg-slate-300 tdd-appearance-none tdd-transform tdd-rotate-180"
139
- }, _cache[0] || (_cache[0] = [
140
- createElementVNode("svg", {
141
- class: "tdd-w-4 tdd-h-4 tdd-fill-white tdd-inline-block",
142
- viewBox: "0 0 1024 1024",
143
- version: "1.1",
144
- xmlns: "http://www.w3.org/2000/svg"
145
- }, [
146
- createElementVNode("path", { d: "M320 885.333333c-8.533333 0-17.066667-4.266667-23.466667-10.666666-12.8-12.8-10.666667-34.133333 2.133334-44.8L654.933333 512 298.666667 194.133333c-12.8-10.666667-14.933333-32-2.133334-44.8 10.666667-12.8 32-14.933333 44.8-2.133333l384 341.333333c6.4 6.4 10.666667 14.933333 10.666667 23.466667 0 8.533333-4.266667 17.066667-10.666667 23.466667l-384 341.333333c-6.4 6.4-12.8 8.533333-21.333333 8.533333z" })
147
- ], -1)
148
- ])),
149
- createElementVNode("button", {
143
+ createVNode(_sfc_main$1, { onClick: preHandle }),
144
+ createVNode(_sfc_main$1, {
150
145
  onClick: nextHandle,
151
- type: "button",
152
- class: "tdd-z-20 tdd-text-center group-hover:tdd-flex tdd-hidden tdd-items-center tdd-justify-center tdd-absolute tdd-top-1/2 tdd--translate-y-1/2 tdd-right-1 tdd-w-6 tdd-h-6 tdd-rounded-full tdd-bg-slate-300 tdd-appearance-none"
153
- }, _cache[1] || (_cache[1] = [
154
- createElementVNode("svg", {
155
- class: "tdd-w-4 tdd-h-4 tdd-fill-white tdd-inline-block",
156
- viewBox: "0 0 1024 1024",
157
- version: "1.1",
158
- xmlns: "http://www.w3.org/2000/svg"
159
- }, [
160
- createElementVNode("path", { d: "M320 885.333333c-8.533333 0-17.066667-4.266667-23.466667-10.666666-12.8-12.8-10.666667-34.133333 2.133334-44.8L654.933333 512 298.666667 194.133333c-12.8-10.666667-14.933333-32-2.133334-44.8 10.666667-12.8 32-14.933333 44.8-2.133333l384 341.333333c6.4 6.4 10.666667 14.933333 10.666667 23.466667 0 8.533333-4.266667 17.066667-10.666667 23.466667l-384 341.333333c-6.4 6.4-12.8 8.533333-21.333333 8.533333z" })
161
- ], -1)
162
- ])),
163
- createVNode(renderBody)
146
+ position: "right"
147
+ }),
148
+ createVNode(renderCarouselItem)
164
149
  ], 36);
165
150
  };
166
151
  }
167
152
  });
168
- const carousel_vue_vue_type_style_index_0_lang = "";
169
153
  export {
170
154
  _sfc_main as default
171
155
  };
@@ -1,11 +1,5 @@
1
1
  import { renderSlot } from "vue";
2
- const _export_sfc = (sfc, props) => {
3
- const target = sfc.__vccOpts || sfc;
4
- for (const [key, val] of props) {
5
- target[key] = val;
6
- }
7
- return target;
8
- };
2
+ import { _ as _export_sfc } from "../index/index.js";
9
3
  const _sfc_main = {};
10
4
  function _sfc_render(_ctx, _cache) {
11
5
  return renderSlot(_ctx.$slots, "default");
@@ -1,13 +1,47 @@
1
- import { defineComponent, renderSlot } from "vue";
1
+ import { defineComponent, inject, computed, openBlock, createElementBlock, normalizeClass, withDirectives, createElementVNode, vModelCheckbox, toDisplayString } from "vue";
2
+ const _hoisted_1 = ["value", "disabled"];
3
+ const _hoisted_2 = { class: "pl-2 peer-disabled:text-word9" };
2
4
  const _sfc_main = /* @__PURE__ */ defineComponent({
3
5
  __name: "checkbox",
4
6
  props: {
5
7
  label: {},
6
- class: {}
8
+ value: {},
9
+ modelValue: { type: Boolean },
10
+ disabled: { type: Boolean, default: false },
11
+ button: { type: Boolean }
7
12
  },
8
- setup(__props) {
13
+ emits: ["update:modelValue"],
14
+ setup(__props, { emit: __emit }) {
15
+ const props = __props;
16
+ const addItem = inject("_addItem_", (_) => {
17
+ });
18
+ const deleteItem = inject("_deleteItem_", (_) => {
19
+ });
20
+ const checkedValues = inject("_checkedValues_", /* @__PURE__ */ new Set());
21
+ const isChecked = computed(() => checkedValues.has(props.value));
22
+ const checkedState = computed({
23
+ get: () => props.modelValue || isChecked.value,
24
+ set: (val) => {
25
+ emit("update:modelValue", val);
26
+ val ? addItem(props.value) : deleteItem(props.value);
27
+ }
28
+ });
29
+ const emit = __emit;
9
30
  return (_ctx, _cache) => {
10
- return renderSlot(_ctx.$slots, "default");
31
+ return openBlock(), createElementBlock("label", {
32
+ class: normalizeClass(["select-none inline-flex items-center", { "cursor-not-allowed": _ctx.disabled }])
33
+ }, [
34
+ withDirectives(createElementVNode("input", {
35
+ type: "checkbox",
36
+ value: _ctx.value,
37
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => checkedState.value = $event),
38
+ disabled: _ctx.disabled,
39
+ class: "peer disabled:cursor-not-allowed form-tick appearance-none h-4 w-4 border border-gray-300 rounded checked:border-transparent checked:bg-blue-600 focus:outline-none"
40
+ }, null, 8, _hoisted_1), [
41
+ [vModelCheckbox, checkedState.value]
42
+ ]),
43
+ createElementVNode("span", _hoisted_2, toDisplayString(_ctx.label), 1)
44
+ ], 2);
11
45
  };
12
46
  }
13
47
  });
@@ -1,69 +1,58 @@
1
- import { defineComponent, inject, useSlots, openBlock, createBlock, h, normalizeClass, withDirectives, vModelCheckbox } from "vue";
1
+ import { defineComponent, inject, reactive, watch, provide, openBlock, createElementBlock, renderSlot } from "vue";
2
2
  const _sfc_main = /* @__PURE__ */ defineComponent({
3
3
  __name: "checkgroup",
4
4
  props: {
5
5
  modelValue: {},
6
- showinput: { type: Boolean, default: false }
6
+ showinput: { type: Boolean, default: false },
7
+ disabled: { type: Boolean }
7
8
  },
8
9
  emits: ["update:modelValue", "change"],
9
10
  setup(__props, { emit: __emit }) {
10
11
  const props = __props;
11
- const ParentGetChangeHandle = inject("changHandle", () => null);
12
12
  const emit = __emit;
13
- const slots = useSlots();
14
- const BoxHandle = (MySlot) => {
15
- var _a;
16
- return h(
17
- "label",
18
- {
19
- class: normalizeClass(["checkGroup", [MySlot.props.class, props.modelValue.includes(MySlot.props.label) ? "tdd-bg-wordblue" : ""]])
20
- },
21
- [
22
- withDirectives(
23
- h("input", {
24
- type: "checkbox",
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
- [[vModelCheckbox, props.modelValue]]
33
- ),
34
- h(
35
- "span",
36
- {
37
- class: normalizeClass(["tdd-text-sm", [props.modelValue.includes(MySlot.props.label) ? "tdd-text-white" : "tdd-text-word6"]])
38
- },
39
- ((_a = MySlot.children) == null ? void 0 : _a.default()) || MySlot.props.label
40
- )
41
- ]
42
- );
13
+ const ParentGetChangeHandle = inject("changHandle", () => null);
14
+ const checkedSet = reactive(/* @__PURE__ */ new Set());
15
+ const syncSetToModel = () => {
16
+ const newValues = Array.from(checkedSet);
17
+ emit("update:modelValue", newValues);
18
+ emit("change", newValues);
19
+ ParentGetChangeHandle(newValues);
43
20
  };
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
- );
21
+ const addItem = (value) => {
22
+ if (!checkedSet.has(value)) {
23
+ checkedSet.add(value);
24
+ syncSetToModel();
25
+ }
60
26
  };
27
+ const deleteItem = (value) => {
28
+ if (checkedSet.has(value)) {
29
+ checkedSet.delete(value);
30
+ syncSetToModel();
31
+ }
32
+ };
33
+ watch(
34
+ () => props.modelValue,
35
+ (newValues) => {
36
+ const newSet = new Set(newValues);
37
+ checkedSet.forEach((value) => {
38
+ if (!newSet.has(value)) {
39
+ checkedSet.delete(value);
40
+ }
41
+ });
42
+ newValues.forEach((value) => checkedSet.add(value));
43
+ },
44
+ { immediate: true }
45
+ );
46
+ provide("_addItem_", addItem);
47
+ provide("_deleteItem_", deleteItem);
48
+ provide("_checkedValues_", checkedSet);
61
49
  return (_ctx, _cache) => {
62
- return openBlock(), createBlock(renderBoxs);
50
+ return openBlock(), createElementBlock("div", null, [
51
+ renderSlot(_ctx.$slots, "default")
52
+ ]);
63
53
  };
64
54
  }
65
55
  });
66
- const checkgroup_vue_vue_type_style_index_0_lang = "";
67
56
  export {
68
57
  _sfc_main as default
69
58
  };