ninemoon-ui 0.1.2 → 0.1.4

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.
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, defineAsyncComponent, computed, ref, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, normalizeClass, withKeys, createElementBlock, createCommentVNode, toDisplayString, withDirectives, vShow, TransitionGroup, Fragment, renderList, nextTick } from "vue";
2
- import { g as getNewArray, a as checkinputDate, f as formatDate } from "../index/index.js";
2
+ import { g as getNewArray, e as checkinputDate, f as formatDate } from "../index/index.js";
3
3
  import { g as getMonthDays, C as Calendar, A as Arrow, a as addZero } from "../calendar/calendar.js";
4
4
  import { A as ArrowPlug } from "../dateArrowplus/dateArrowplus.js";
5
5
  const _hoisted_1 = { class: "flex items-center justify-between p-3" };
@@ -32,9 +32,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
32
32
  const Pop = defineAsyncComponent(() => import("../popover/popover.js"));
33
33
  const props = __props;
34
34
  const heightClass = computed(() => ({
35
- "h-8": props.size === "large",
36
- "h-7": props.size === "default",
37
- "h-6": props.size === "small"
35
+ "h-10": props.size === "large",
36
+ "h-9": props.size === "default",
37
+ "h-8": props.size === "small"
38
38
  }));
39
39
  const emit = __emit;
40
40
  const dateChangeHandle = (e) => {
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, defineAsyncComponent, computed, ref, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, normalizeClass, toDisplayString, createTextVNode, createElementBlock, Fragment, renderList, nextTick } from "vue";
2
- import { f as formatDate, g as getNewArray, a as checkinputDate } from "../index/index.js";
2
+ import { f as formatDate, g as getNewArray, e as checkinputDate } from "../index/index.js";
3
3
  import { g as getMonthDays, C as Calendar, A as Arrow, a as addZero } from "../calendar/calendar.js";
4
4
  import { A as ArrowPlug } from "../dateArrowplus/dateArrowplus.js";
5
5
  const _hoisted_1 = { class: "flex justify-between items-center p-3" };
@@ -45,9 +45,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
45
45
  const emit = __emit;
46
46
  const props = __props;
47
47
  const heightClass = computed(() => ({
48
- "h-8": props.size === "large",
49
- "h-7": props.size === "default",
50
- "h-6": props.size === "small"
48
+ "h-10": props.size === "large",
49
+ "h-9": props.size === "default",
50
+ "h-8": props.size === "small"
51
51
  }));
52
52
  const deleteDateHandle = () => {
53
53
  emit("update:modelValue", [null, null]);
@@ -1,5 +1,5 @@
1
1
  import { openBlock, createElementBlock, createElementVNode, defineComponent, ref, watch, Fragment, createVNode, createCommentVNode, renderSlot, createBlock, Teleport, Transition, withCtx, withDirectives, withModifiers, normalizeStyle, normalizeClass, unref } from "vue";
2
- import { _ as _export_sfc, t as throttle } from "../index/index.js";
2
+ import { _ as _export_sfc, b as createDraggableDirective, d as createWheelDirective } from "../index/index.js";
3
3
  import { d as delIcon } from "../delete/delete.js";
4
4
  const _sfc_main$3 = {};
5
5
  const _hoisted_1$3 = {
@@ -48,106 +48,6 @@ function _sfc_render(_ctx, _cache) {
48
48
  ]));
49
49
  }
50
50
  const turnRightIcon = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render]]);
51
- const DEFAULT_THROTTLE_WAIT = 60;
52
- const createDraggableDirective = (options) => {
53
- const config = {
54
- throttleWait: DEFAULT_THROTTLE_WAIT,
55
- resetOnEnd: false,
56
- onDrag: () => {
57
- },
58
- // default implementation
59
- ...options
60
- };
61
- const bindEvents = (el, binding) => {
62
- if (el.__draggable_handlers__)
63
- return;
64
- let startX = 0;
65
- let startY = 0;
66
- let initialX = 0;
67
- let initialY = 0;
68
- const handleMove = throttle((e) => {
69
- e.preventDefault();
70
- const deltaX = e.pageX - startX;
71
- const deltaY = e.pageY - startY;
72
- config.onDrag({
73
- x: deltaX + initialX,
74
- y: deltaY + initialY
75
- });
76
- }, config.throttleWait);
77
- const handleDown = (e) => {
78
- var _a;
79
- e.preventDefault();
80
- const rect = el.getBoundingClientRect();
81
- initialX = rect.left + window.scrollX;
82
- initialY = rect.top + window.scrollY;
83
- startX = e.pageX;
84
- startY = e.pageY;
85
- (_a = config.onDragStart) == null ? void 0 : _a.call(config, { x: initialX, y: initialY });
86
- window.addEventListener("mousemove", handleMove);
87
- window.addEventListener("mouseup", handleUp);
88
- };
89
- const handleUp = () => {
90
- var _a;
91
- window.removeEventListener("mousemove", handleMove);
92
- window.removeEventListener("mouseup", handleUp);
93
- if (config.resetOnEnd) {
94
- config.onDrag({ x: initialX, y: initialY });
95
- }
96
- (_a = config.onDragEnd) == null ? void 0 : _a.call(config, { x: initialX, y: initialY });
97
- };
98
- el.__draggable_handlers__ = {
99
- move: handleMove,
100
- up: handleUp
101
- };
102
- el.addEventListener("mousedown", handleDown);
103
- };
104
- const unbindEvents = (el) => {
105
- if (el.__draggable_handlers__) {
106
- window.removeEventListener("mousemove", el.__draggable_handlers__.move);
107
- window.removeEventListener("mouseup", el.__draggable_handlers__.up);
108
- delete el.__draggable_handlers__;
109
- }
110
- };
111
- return {
112
- mounted(el, binding) {
113
- bindEvents(el);
114
- },
115
- beforeUnmount(el) {
116
- unbindEvents(el);
117
- }
118
- };
119
- };
120
- const createWheelDirective = (options) => {
121
- const config = {
122
- onWheel: () => {
123
- },
124
- ...options
125
- };
126
- const bindEvents = (el, binding) => {
127
- const wheelHandler = (e) => {
128
- e.preventDefault();
129
- config.onWheel(e);
130
- };
131
- el._wheel_handlers_ = {
132
- wheel: wheelHandler
133
- };
134
- el.addEventListener("wheel", wheelHandler);
135
- };
136
- const unbindEvents = (el) => {
137
- if (el._wheel_handlers_) {
138
- el.removeEventListener("wheel", el._wheel_handlers_.wheel);
139
- delete el._wheel_handlers_;
140
- }
141
- };
142
- return {
143
- mounted(el, binding) {
144
- bindEvents(el);
145
- },
146
- beforeUnmount(el) {
147
- unbindEvents(el);
148
- }
149
- };
150
- };
151
51
  const _hoisted_1 = { class: "relative inline-block h-full w-full" };
152
52
  const _hoisted_2 = ["src"];
153
53
  const _hoisted_3 = { key: 0 };
@@ -516,10 +516,12 @@ const LibLoad = {
516
516
  handleLoadingState(el, binding, binding.value);
517
517
  }
518
518
  },
519
- beforeUnmount(el) {
519
+ beforeUnmount(el, binding) {
520
520
  var _a;
521
521
  if (el.__loading_instance__) {
522
- cleanupLoadingState(el, document.body);
522
+ const modifiers = binding.modifiers;
523
+ const target = modifiers.fullScreen ? document.body : el;
524
+ cleanupLoadingState(el, target);
523
525
  (_a = el.__loading_instance__) == null ? void 0 : _a.$el.remove();
524
526
  delete el.__loading_instance__;
525
527
  }
@@ -575,6 +577,64 @@ function cleanupLoadingState(el, container, modifiers) {
575
577
  }
576
578
  delete el.__loading_instance__;
577
579
  }
580
+ const directionMap = {
581
+ ArrowUp: "up",
582
+ Up: "up",
583
+ // IE/Edge 兼容
584
+ ArrowDown: "down",
585
+ Down: "down",
586
+ // IE/Edge 兼容
587
+ ArrowLeft: "left",
588
+ Left: "left",
589
+ // IE/Edge 兼容
590
+ ArrowRight: "right",
591
+ Right: "right"
592
+ // IE/Edge 兼容
593
+ };
594
+ const createArrowKeysDirective = (options) => {
595
+ const config = {
596
+ // 默认配置
597
+ up: () => {
598
+ },
599
+ down: () => {
600
+ },
601
+ left: () => {
602
+ },
603
+ right: () => {
604
+ },
605
+ ...options
606
+ };
607
+ const bindEvents = (el, binding) => {
608
+ const handler = (e) => {
609
+ var _a;
610
+ const direction = directionMap[e.key];
611
+ if (direction && config[direction]) {
612
+ e.preventDefault();
613
+ (_a = config[direction]) == null ? void 0 : _a.call(config, e);
614
+ }
615
+ };
616
+ el._arrowKeysHandler = handler;
617
+ document.addEventListener("keydown", handler);
618
+ };
619
+ const unbindEvents = (el) => {
620
+ if (el._arrowKeysHandler) {
621
+ document.removeEventListener("keydown", el._arrowKeysHandler);
622
+ }
623
+ delete el._arrowKeysHandler;
624
+ };
625
+ return {
626
+ mounted(el, binding) {
627
+ bindEvents(el);
628
+ },
629
+ updated(el, binding) {
630
+ unbindEvents(el);
631
+ bindEvents(el);
632
+ },
633
+ unmounted(el) {
634
+ unbindEvents(el);
635
+ }
636
+ };
637
+ };
578
638
  function debounce(func, wait) {
579
639
  let timeout;
580
640
  return function() {
@@ -783,11 +843,131 @@ const useResizeObserver = (callback) => {
783
843
  };
784
844
  return { observe, unobserve };
785
845
  };
786
- const DEFAULT_DEBOUNCE_WAIT = 100;
846
+ const DEFAULT_THROTTLE_WAIT = 60;
847
+ const createDraggableDirective = (options) => {
848
+ const config = {
849
+ throttleWait: DEFAULT_THROTTLE_WAIT,
850
+ resetOnEnd: false,
851
+ onDrag: () => {
852
+ },
853
+ // default implementation
854
+ ...options
855
+ };
856
+ const bindEvents = (el, binding) => {
857
+ if (el.__draggable_handlers__)
858
+ return;
859
+ let startX = 0;
860
+ let startY = 0;
861
+ let initialX = 0;
862
+ let initialY = 0;
863
+ const handleMove = throttle((e) => {
864
+ e.preventDefault();
865
+ const deltaX = e.pageX - startX;
866
+ const deltaY = e.pageY - startY;
867
+ config.onDrag({
868
+ x: deltaX + initialX,
869
+ y: deltaY + initialY
870
+ });
871
+ }, config.throttleWait);
872
+ const handleDown = (e) => {
873
+ var _a;
874
+ e.preventDefault();
875
+ const rect = el.getBoundingClientRect();
876
+ initialX = rect.left + window.scrollX;
877
+ initialY = rect.top + window.scrollY;
878
+ startX = e.pageX;
879
+ startY = e.pageY;
880
+ (_a = config.onDragStart) == null ? void 0 : _a.call(config, { x: initialX, y: initialY });
881
+ window.addEventListener("mousemove", handleMove);
882
+ window.addEventListener("mouseup", handleUp);
883
+ };
884
+ const handleUp = () => {
885
+ var _a;
886
+ window.removeEventListener("mousemove", handleMove);
887
+ window.removeEventListener("mouseup", handleUp);
888
+ if (config.resetOnEnd) {
889
+ config.onDrag({ x: initialX, y: initialY });
890
+ }
891
+ (_a = config.onDragEnd) == null ? void 0 : _a.call(config, { x: initialX, y: initialY });
892
+ };
893
+ el.__draggable_handlers__ = {
894
+ move: handleMove,
895
+ up: handleUp
896
+ };
897
+ el.addEventListener("mousedown", handleDown);
898
+ };
899
+ const unbindEvents = (el) => {
900
+ if (el.__draggable_handlers__) {
901
+ window.removeEventListener("mousemove", el.__draggable_handlers__.move);
902
+ window.removeEventListener("mouseup", el.__draggable_handlers__.up);
903
+ delete el.__draggable_handlers__;
904
+ }
905
+ };
906
+ return {
907
+ mounted(el, binding) {
908
+ bindEvents(el);
909
+ },
910
+ beforeUnmount(el) {
911
+ unbindEvents(el);
912
+ }
913
+ };
914
+ };
915
+ const DEFAULT_DEBOUNCE_WAIT$2 = 100;
916
+ const createBgClickDirective = (options) => {
917
+ const config = {
918
+ debounceWait: DEFAULT_DEBOUNCE_WAIT$2,
919
+ moveModel: false,
920
+ onCheckOut: () => {
921
+ },
922
+ ...options
923
+ };
924
+ const bindEvents = (el, binding) => {
925
+ if (el._checkout_handlers_)
926
+ return;
927
+ const clickDom = debounce((e) => {
928
+ e.preventDefault();
929
+ config.onCheckOut(e, el);
930
+ }, config.debounceWait);
931
+ el._checkout_handlers_ = {
932
+ click: clickDom
933
+ };
934
+ if (config.moveModel) {
935
+ document.addEventListener("mousemove", clickDom);
936
+ } else {
937
+ document.addEventListener("click", clickDom);
938
+ }
939
+ };
940
+ const unbindEvents = (el) => {
941
+ if (el._checkout_handlers_) {
942
+ if (config.moveModel) {
943
+ document.removeEventListener("mousemove", el._checkout_handlers_.click);
944
+ } else {
945
+ document.removeEventListener("click", el._checkout_handlers_.click);
946
+ }
947
+ delete el._checkout_handlers_;
948
+ }
949
+ };
950
+ return {
951
+ mounted(el, binding) {
952
+ bindEvents(el);
953
+ },
954
+ beforeUnmount(el) {
955
+ unbindEvents(el);
956
+ },
957
+ // 添加 updated 钩子处理配置变化
958
+ updated(el, binding) {
959
+ if (binding.value !== binding.oldValue) {
960
+ unbindEvents(el);
961
+ bindEvents(el);
962
+ }
963
+ }
964
+ };
965
+ };
966
+ const DEFAULT_DEBOUNCE_WAIT$1 = 100;
787
967
  const DEFAULT_HOLD = 0;
788
- const createScrollDirective = (options) => {
968
+ const createLoadingDirective = (options) => {
789
969
  const config = {
790
- throttleTime: DEFAULT_DEBOUNCE_WAIT,
970
+ throttleTime: DEFAULT_DEBOUNCE_WAIT$1,
791
971
  threshold: DEFAULT_HOLD,
792
972
  edge: "bottom",
793
973
  onWheel: () => {
@@ -851,6 +1031,115 @@ const createScrollDirective = (options) => {
851
1031
  }
852
1032
  };
853
1033
  };
1034
+ const DEFAULT_DEBOUNCE_WAIT = 50;
1035
+ const createScrollDirective = (options) => {
1036
+ const config = {
1037
+ debounceWait: DEFAULT_DEBOUNCE_WAIT,
1038
+ onMove: () => {
1039
+ },
1040
+ ...options
1041
+ };
1042
+ const bindEvents = (el, binding) => {
1043
+ if (el._watchwindow_handlers_) {
1044
+ return;
1045
+ }
1046
+ const moveDom = debounce((e) => {
1047
+ e.preventDefault();
1048
+ config.onMove();
1049
+ }, config.debounceWait);
1050
+ el._watchwindow_handlers_ = {
1051
+ move: moveDom
1052
+ };
1053
+ window.addEventListener("resize", el._watchwindow_handlers_.move);
1054
+ const scrollContainer = typeof config.scrollContainerId === "string" ? document.querySelector(config.scrollContainerId) || window : window;
1055
+ scrollContainer.addEventListener("scroll", el._watchwindow_handlers_.move);
1056
+ };
1057
+ const unbindEvents = (el) => {
1058
+ if (el._watchwindow_handlers_) {
1059
+ window.removeEventListener("resize", el._watchwindow_handlers_.move);
1060
+ const scrollContainer = typeof config.scrollContainerId === "string" ? document.querySelector(config.scrollContainerId) || window : window;
1061
+ scrollContainer.removeEventListener("scroll", el._watchwindow_handlers_.move);
1062
+ delete el._watchwindow_handlers_;
1063
+ }
1064
+ };
1065
+ return {
1066
+ mounted(el, binding) {
1067
+ bindEvents(el);
1068
+ },
1069
+ beforeUnmount(el) {
1070
+ unbindEvents(el);
1071
+ },
1072
+ // 添加 updated 钩子处理配置变化
1073
+ updated(el, binding) {
1074
+ if (binding.value !== binding.oldValue) {
1075
+ unbindEvents(el);
1076
+ bindEvents(el);
1077
+ }
1078
+ }
1079
+ };
1080
+ };
1081
+ const createWheelDirective = (options) => {
1082
+ const config = {
1083
+ onWheel: () => {
1084
+ },
1085
+ ...options
1086
+ };
1087
+ const bindEvents = (el, binding) => {
1088
+ const wheelHandler = (e) => {
1089
+ e.preventDefault();
1090
+ config.onWheel(e);
1091
+ };
1092
+ el._wheel_handlers_ = {
1093
+ wheel: wheelHandler
1094
+ };
1095
+ el.addEventListener("wheel", wheelHandler);
1096
+ };
1097
+ const unbindEvents = (el) => {
1098
+ if (el._wheel_handlers_) {
1099
+ el.removeEventListener("wheel", el._wheel_handlers_.wheel);
1100
+ delete el._wheel_handlers_;
1101
+ }
1102
+ };
1103
+ return {
1104
+ mounted(el, binding) {
1105
+ bindEvents(el);
1106
+ },
1107
+ beforeUnmount(el) {
1108
+ unbindEvents(el);
1109
+ }
1110
+ };
1111
+ };
1112
+ const createBgClickeDirective = (options) => {
1113
+ const config = {
1114
+ onBgPicture: () => {
1115
+ },
1116
+ ...options
1117
+ };
1118
+ const bindEvents = (el, binding) => {
1119
+ const bgPictureHandler = (e) => {
1120
+ e.preventDefault();
1121
+ config.onBgPicture(e);
1122
+ };
1123
+ el._bgPicture_handlers_ = {
1124
+ bgPicture: bgPictureHandler
1125
+ };
1126
+ el.addEventListener("click", bgPictureHandler);
1127
+ };
1128
+ const unbindEvents = (el) => {
1129
+ if (el._bgPicture_handlers_) {
1130
+ el.removeEventListener("click", el._bgPicture_handlers_.bgPicture);
1131
+ delete el._bgPicture_handlers_;
1132
+ }
1133
+ };
1134
+ return {
1135
+ mounted(el, binding) {
1136
+ bindEvents(el);
1137
+ },
1138
+ beforeUnmount(el) {
1139
+ unbindEvents(el);
1140
+ }
1141
+ };
1142
+ };
854
1143
  const tailwind = "";
855
1144
  const LibDialog = defineAsyncComponent(() => import("../dialog/dialog.js"));
856
1145
  const LibForm = defineAsyncComponent(() => import("../form/form.js"));
@@ -911,48 +1200,52 @@ const index = {
911
1200
  }
912
1201
  };
913
1202
  export {
914
- LibRadioBox as A,
915
- LibRadioGroup as B,
1203
+ LibBadge as A,
1204
+ LibPopover as B,
916
1205
  CloseIcon as C,
917
- LibCheckGroup as D,
918
- LibCheckBox as E,
919
- LibUpload as F,
920
- LibTabs as G,
921
- LibTabsPane as H,
922
- LibScrollBar as I,
923
- AlertFunction as J,
924
- LibLoad as K,
1206
+ LibNumberInput as D,
1207
+ LibRadioBox as E,
1208
+ LibRadioGroup as F,
1209
+ LibCheckGroup as G,
1210
+ LibCheckBox as H,
1211
+ LibUpload as I,
1212
+ LibTabs as J,
1213
+ LibTabsPane as K,
925
1214
  LibDialog as L,
926
- MessageClass as M,
927
- createScrollDirective as N,
928
- LibCarousel as O,
929
- LibCarouselItem as P,
930
- LibSwitch as Q,
1215
+ LibScrollBar as M,
1216
+ MessageClass as N,
1217
+ AlertFunction as O,
1218
+ LibLoad as P,
1219
+ LibCarousel as Q,
1220
+ LibCarouselItem as R,
1221
+ LibSwitch as S,
1222
+ createLoadingDirective as T,
1223
+ createBgClickeDirective as U,
931
1224
  _export_sfc as _,
932
- checkinputDate as a,
933
- off as b,
1225
+ createArrowKeysDirective as a,
1226
+ createDraggableDirective as b,
934
1227
  createEscapeDirective as c,
935
- debounce as d,
936
- useResizeObserver as e,
1228
+ createWheelDirective as d,
1229
+ checkinputDate as e,
937
1230
  formatDate as f,
938
1231
  getNewArray as g,
939
- LibForm as h,
940
- index as i,
941
- LibFormLabel as j,
942
- LibInput as k,
943
- LibSelect as l,
944
- LibSelectOption as m,
945
- LibTable as n,
1232
+ createScrollDirective as h,
1233
+ createBgClickDirective as i,
1234
+ off as j,
1235
+ useResizeObserver as k,
1236
+ index as l,
1237
+ LibForm as m,
1238
+ LibFormLabel as n,
946
1239
  on as o,
947
- LibTableItem as p,
948
- LibImage as q,
949
- LibDatePicker as r,
950
- LibDatePickerRange as s,
951
- throttle as t,
1240
+ LibInput as p,
1241
+ LibSelect as q,
1242
+ LibSelectOption as r,
1243
+ LibTable as s,
1244
+ LibTableItem as t,
952
1245
  usePotion as u,
953
- LibMenu as v,
954
- LibPagination as w,
955
- LibBadge as x,
956
- LibPopover as y,
957
- LibNumberInput as z
1246
+ LibImage as v,
1247
+ LibDatePicker as w,
1248
+ LibDatePickerRange as x,
1249
+ LibMenu as y,
1250
+ LibPagination as z
958
1251
  };
@@ -17,9 +17,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
17
17
  setup(__props, { emit: __emit }) {
18
18
  const props = __props;
19
19
  const heightClass = computed(() => ({
20
- "h-8": props.size === "large",
21
- "h-7": props.size === "default",
22
- "h-6": props.size === "small"
20
+ "h-10": props.size === "large",
21
+ "h-9": props.size === "default",
22
+ "h-8": props.size === "small"
23
23
  }));
24
24
  const inputValue = computed({
25
25
  get() {
@@ -42,9 +42,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
42
42
  setup(__props, { emit: __emit }) {
43
43
  const props = __props;
44
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"
45
+ "h-10 w-10": props.size === "large",
46
+ "h-9 w-9": props.size === "default",
47
+ "h-8 w-8": props.size === "small"
48
48
  }));
49
49
  const bounds = computed(() => ({
50
50
  min: props.min ?? -Infinity,