hys-ui 0.7.0 → 0.8.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 (32) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/components/HysDatePicker/HysDatePicker.vue.js +102 -48
  3. package/dist/components/HysDatePicker/HysDatePickerControl.vue.js +2 -2
  4. package/dist/components/HysDatePicker/HysDatePickerControl2.vue.js +874 -532
  5. package/dist/components/HysDatePicker/HysDatePickerPanel.vue.js +2 -2
  6. package/dist/components/HysDatePicker/HysDatePickerPanel2.vue.js +209 -168
  7. package/dist/components/HysDateRangePicker/HysDateRangePicker.vue.js +102 -48
  8. package/dist/composables/datePicker.js +153 -94
  9. package/dist/composables/datePickerModel.js +156 -0
  10. package/dist/composables/datePickerPanels.js +78 -0
  11. package/dist/composables/datePickerRules.js +166 -0
  12. package/dist/composables/floatingPosition.js +32 -13
  13. package/dist/composables/useDatePicker.js +274 -381
  14. package/dist/composables/useFloating.js +21 -20
  15. package/dist/style.css +1 -1
  16. package/dist/types/components/HysDatePicker/HysDatePicker.vue.d.ts +6 -9
  17. package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +12 -0
  18. package/dist/types/components/HysDatePicker/HysDatePickerPanel.vue.d.ts +6 -0
  19. package/dist/types/components/HysDateRangePicker/HysDateRangePicker.vue.d.ts +6 -9
  20. package/dist/types/components/HysIcon/HysIcon.vue.d.ts +1 -1
  21. package/dist/types/composables/datePicker.d.ts +14 -214
  22. package/dist/types/composables/datePickerModel.d.ts +63 -0
  23. package/dist/types/composables/datePickerPanels.d.ts +23 -0
  24. package/dist/types/composables/datePickerRules.d.ts +31 -0
  25. package/dist/types/composables/datePickerTypes.d.ts +277 -0
  26. package/dist/types/composables/floatingPosition.d.ts +1 -1
  27. package/dist/types/composables/useColorPicker.d.ts +1 -3
  28. package/dist/types/composables/useContextMenu.d.ts +1 -3
  29. package/dist/types/composables/useDatePicker.d.ts +20 -11
  30. package/dist/types/composables/useFloating.d.ts +2 -3
  31. package/dist/types/index.d.ts +1 -1
  32. package/package.json +1 -1
@@ -4,7 +4,7 @@ import { popupSize as Q } from "../motion/popup.js";
4
4
  import { positionFloating as Z } from "./floatingPosition.js";
5
5
  import { overlayOwnerKey as _, registerOverlay as ee } from "./overlayManager.js";
6
6
  function re(v, n, e = {}) {
7
- const { disabled: k } = J({}), m = T(_, void 0), s = E(!1), W = Y(), p = E(!1), L = E({
7
+ const { disabled: M } = J({}), m = T(_, void 0), s = E(!1), W = Y(), p = E(!1), L = E({
8
8
  position: "fixed",
9
9
  top: "0px",
10
10
  left: "0px",
@@ -23,8 +23,8 @@ function re(v, n, e = {}) {
23
23
  u(!1, !1, "anchor");
24
24
  return;
25
25
  }
26
- const a = Number.isFinite(e.gap) ? e.gap : 8, i = Number.isFinite(e.padding) ? Math.max(0, e.padding) : 10, l = document.documentElement.clientWidth, d = document.documentElement.clientHeight, c = Math.min(t.width, Math.max(0, l - 2 * i)), g = typeof e.matchWidth == "function" ? e.matchWidth() : e.matchWidth, h = (R = e.maxWidth) == null ? void 0 : R.call(e), P = h !== void 0 && (typeof h != "number" || Number.isFinite(h)) ? `min(${typeof h == "number" ? Math.max(0, h) + "px" : h},calc(100vw - ${i * 2}px))` : `calc(100vw - ${i * 2}px)`, b = (S = e.width) == null ? void 0 : S.call(e), x = typeof b == "number" ? Number.isFinite(b) ? Math.max(0, b) + "px" : void 0 : b;
27
- x !== void 0 ? (n.value.style.width = x, n.value.style.minWidth = "0", n.value.style.maxWidth = P) : g === !0 && (n.value.style.width = `${c}px`, n.value.style.minWidth = "0", n.value.style.maxWidth = `${c}px`), x === void 0 && g === "min" && (n.value.style.width = "max-content", n.value.style.minWidth = `${c}px`, n.value.style.maxWidth = `calc(100vw - ${i * 2}px)`);
26
+ const a = Number.isFinite(e.gap) ? e.gap : 8, i = Number.isFinite(e.padding) ? Math.max(0, e.padding) : 10, l = document.documentElement.clientWidth, d = document.documentElement.clientHeight, c = Math.min(t.width, Math.max(0, l - 2 * i)), g = typeof e.matchWidth == "function" ? e.matchWidth() : e.matchWidth, h = (R = e.maxWidth) == null ? void 0 : R.call(e), N = h !== void 0 && (typeof h != "number" || Number.isFinite(h)) ? `min(${typeof h == "number" ? Math.max(0, h) + "px" : h},calc(100vw - ${i * 2}px))` : `calc(100vw - ${i * 2}px)`, b = (S = e.width) == null ? void 0 : S.call(e), x = typeof b == "number" ? Number.isFinite(b) ? Math.max(0, b) + "px" : void 0 : b;
27
+ x !== void 0 ? (n.value.style.width = x, n.value.style.minWidth = "0", n.value.style.maxWidth = N) : g === !0 && (n.value.style.width = `${c}px`, n.value.style.minWidth = "0", n.value.style.maxWidth = `${c}px`), x === void 0 && g === "min" && (n.value.style.width = "max-content", n.value.style.minWidth = `${c}px`, n.value.style.maxWidth = `calc(100vw - ${i * 2}px)`);
28
28
  const z = Z(
29
29
  t,
30
30
  Q(n.value),
@@ -32,26 +32,27 @@ function re(v, n, e = {}) {
32
32
  A(),
33
33
  a,
34
34
  i,
35
- e.autoAdjustOverflow !== !1
35
+ e.autoAdjustOverflow !== !1,
36
+ e.fallbackPlacements
36
37
  );
37
- let { x: O, y: M } = z;
38
+ let { x: O, y: k } = z;
38
39
  if (C.value = z.placement, (H = e.onPosition) == null || H.call(e, { anchor: t, ...z }), e.strategy === "absolute") {
39
40
  n.value.style.position = "absolute";
40
41
  const f = n.value.offsetParent;
41
42
  if (f && f !== document.body && f !== document.documentElement) {
42
43
  const j = f.getBoundingClientRect();
43
- O += f.scrollLeft - j.left - f.clientLeft, M += f.scrollTop - j.top - f.clientTop;
44
+ O += f.scrollLeft - j.left - f.clientLeft, k += f.scrollTop - j.top - f.clientTop;
44
45
  } else
45
- O += window.scrollX, M += window.scrollY;
46
+ O += window.scrollX, k += window.scrollY;
46
47
  }
47
48
  L.value = {
48
49
  ...x !== void 0 ? { width: x, minWidth: "0" } : g === !0 ? { width: `${c}px`, minWidth: "0" } : g === "min" ? { width: "max-content", minWidth: `${c}px` } : {},
49
50
  position: e.strategy ?? "fixed",
50
51
  left: `${Math.round(O)}px`,
51
- top: `${Math.round(M)}px`,
52
+ top: `${Math.round(k)}px`,
52
53
  visibility: "visible",
53
54
  zIndex: "1200",
54
- maxWidth: P,
55
+ maxWidth: N,
55
56
  maxHeight: `calc(100vh - ${i * 2}px)`,
56
57
  overflowY: "auto",
57
58
  overscrollBehavior: "contain"
@@ -64,7 +65,7 @@ function re(v, n, e = {}) {
64
65
  var a, i;
65
66
  !(r != null && r()) || e.closeOnOutside === !1 || !((a = v.value) != null && a.contains(t.target)) && !((i = n.value) != null && i.contains(t.target)) && u(!1, !1, "outside");
66
67
  }
67
- function q(t) {
68
+ function P(t) {
68
69
  var a, i;
69
70
  if (!(!s.value || !(r != null && r()))) {
70
71
  if (t.key === "Escape" && e.closeOnEscape !== !1)
@@ -88,13 +89,13 @@ function re(v, n, e = {}) {
88
89
  }
89
90
  }
90
91
  }
91
- function B() {
92
+ function q() {
92
93
  var t, a;
93
- document.removeEventListener("pointerdown", I, !0), document.removeEventListener("keydown", q, !0), window.removeEventListener("resize", o), window.removeEventListener("scroll", o, !0), (t = window.visualViewport) == null || t.removeEventListener("resize", o), (a = window.visualViewport) == null || a.removeEventListener("scroll", o), cancelAnimationFrame($), w == null || w(), w = void 0, W.value = void 0, r = void 0;
94
+ document.removeEventListener("pointerdown", I, !0), document.removeEventListener("keydown", P, !0), window.removeEventListener("resize", o), window.removeEventListener("scroll", o, !0), (t = window.visualViewport) == null || t.removeEventListener("resize", o), (a = window.visualViewport) == null || a.removeEventListener("scroll", o), cancelAnimationFrame($), w == null || w(), w = void 0, W.value = void 0, r = void 0;
94
95
  }
95
96
  function u(t = !1, a = !1, i) {
96
97
  var l, d;
97
- if (!(!a && s.value && ((l = e.requestOpen) == null ? void 0 : l.call(e, !1, t, i)) === !1) && (y++, !!s.value && (s.value = !1, B(), t && ((d = v.value) != null && d.isConnected)))) {
98
+ if (!(!a && s.value && ((l = e.requestOpen) == null ? void 0 : l.call(e, !1, t, i)) === !1) && (y++, !!s.value && (s.value = !1, q(), t && ((d = v.value) != null && d.isConnected)))) {
98
99
  p.value = !0;
99
100
  try {
100
101
  v.value.focus();
@@ -103,9 +104,9 @@ function re(v, n, e = {}) {
103
104
  }
104
105
  }
105
106
  }
106
- async function N(t = !1) {
107
+ async function B(t = !1) {
107
108
  var l, d, c;
108
- if (k.value || (m == null ? void 0 : m.value) === !1) return;
109
+ if (M.value || (m == null ? void 0 : m.value) === !1) return;
109
110
  if (s.value) {
110
111
  o();
111
112
  return;
@@ -123,13 +124,13 @@ function re(v, n, e = {}) {
123
124
  () => u(!0, !1, "escape"),
124
125
  e.zIndex
125
126
  );
126
- W.value = i, w = i.unregister, r = i.isTop, F(), document.addEventListener("pointerdown", I, !0), document.addEventListener("keydown", q, !0), window.addEventListener("resize", o), window.addEventListener("scroll", o, !0), (d = window.visualViewport) == null || d.addEventListener("resize", o), (c = window.visualViewport) == null || c.addEventListener("scroll", o);
127
+ W.value = i, w = i.unregister, r = i.isTop, F(), document.addEventListener("pointerdown", I, !0), document.addEventListener("keydown", P, !0), window.addEventListener("resize", o), window.addEventListener("scroll", o, !0), (d = window.visualViewport) == null || d.addEventListener("resize", o), (c = window.visualViewport) == null || c.addEventListener("scroll", o);
127
128
  }
128
129
  function K() {
129
- return s.value ? u() : N();
130
+ return s.value ? u() : B();
130
131
  }
131
132
  return D(
132
- k,
133
+ M,
133
134
  (t) => {
134
135
  t && u(!1, !0);
135
136
  },
@@ -141,7 +142,7 @@ function re(v, n, e = {}) {
141
142
  },
142
143
  { flush: "sync" }
143
144
  ), V(() => {
144
- y++, B();
145
+ y++, q();
145
146
  }), {
146
147
  open: s,
147
148
  style: X(() => {
@@ -153,7 +154,7 @@ function re(v, n, e = {}) {
153
154
  }),
154
155
  placement: C,
155
156
  update: F,
156
- show: N,
157
+ show: B,
157
158
  close: u,
158
159
  toggle: K,
159
160
  restoringFocus: p,