@nmorph/nmorph-ui-kit 2.2.36 → 2.2.38

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 (114) hide show
  1. package/dist/components/basic/nmorph-button/NmorphButton.vue2.js +8 -8
  2. package/dist/components/basic/nmorph-icon/NmorphIcon.vue2.js +3 -3
  3. package/dist/components/basic/nmorph-layout/NmorphLayout.vue2.js +14 -13
  4. package/dist/components/basic/nmorph-link/NmorphLink.vue2.js +1 -1
  5. package/dist/components/basic/nmorph-scroll/NmorphScroll.css +1 -0
  6. package/dist/components/basic/nmorph-scroll/NmorphScroll.vue.js +6 -4
  7. package/dist/components/basic/nmorph-scroll/NmorphScroll.vue2.js +1 -0
  8. package/dist/components/basic/nmorph-space/NmorphSpace.vue2.js +15 -19
  9. package/dist/components/data/nmorph-avatar/NmorphAvatar.css +1 -1
  10. package/dist/components/data/nmorph-avatar/NmorphAvatar.vue2.js +5 -5
  11. package/dist/components/data/nmorph-badge/NmorphBadge.vue2.js +37 -36
  12. package/dist/components/data/nmorph-calendar/NmorphCalendar.vue2.js +41 -40
  13. package/dist/components/data/nmorph-card/NmorphCard.vue2.js +19 -15
  14. package/dist/components/data/nmorph-collapse/components/nmorph-collapse-item/NmorphCollapseItem.vue2.js +5 -9
  15. package/dist/components/data/nmorph-empty/NmorphEmpty.vue.js +3 -3
  16. package/dist/components/data/nmorph-empty/NmorphEmpty.vue2.js +17 -14
  17. package/dist/components/data/nmorph-image/NmorphImage.css +1 -0
  18. package/dist/components/data/nmorph-image/NmorphImage.vue.js +14 -12
  19. package/dist/components/data/nmorph-image/NmorphImage.vue2.js +3 -2
  20. package/dist/components/data/nmorph-image-preview/NmorphImagePreview.vue2.js +36 -35
  21. package/dist/components/data/nmorph-pagination/NmorphPagination.vue2.js +1 -1
  22. package/dist/components/data/nmorph-progress/NmorphProgress.vue2.js +19 -18
  23. package/dist/components/data/nmorph-qr-code/NmorphQRCode.vue2.js +20 -19
  24. package/dist/components/data/nmorph-skeleton/NmorphSkeleton.vue2.js +1 -1
  25. package/dist/components/data/nmorph-table/NmorphTable.vue2.js +39 -43
  26. package/dist/components/data/nmorph-virtual-list/NmorphVirtualList.vue2.js +34 -33
  27. package/dist/components/feedback/nmorph-alert/NmorphAlert.vue2.js +1 -1
  28. package/dist/components/feedback/nmorph-callout/NmorphCallout.vue2.js +7 -6
  29. package/dist/components/feedback/nmorph-dialog/NmorphDialog.css +1 -1
  30. package/dist/components/feedback/nmorph-dialog/NmorphDialog.vue.js +25 -20
  31. package/dist/components/feedback/nmorph-dialog/NmorphDialog.vue2.js +37 -37
  32. package/dist/components/feedback/nmorph-drawer/NmorphDrawer.vue2.js +22 -21
  33. package/dist/components/feedback/nmorph-tooltip/NmorphTooltip.vue2.js +26 -25
  34. package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue2.js +65 -71
  35. package/dist/components/form/nmorph-checkbox/NmorphCheckbox.css +1 -1
  36. package/dist/components/form/nmorph-checkbox/NmorphCheckbox.vue2.js +30 -28
  37. package/dist/components/form/nmorph-checkbox-group/NmorphCheckboxGroup.vue2.js +25 -20
  38. package/dist/components/form/nmorph-color-picker/NmorphColorPicker.vue2.js +43 -42
  39. package/dist/components/form/nmorph-date-picker/NmorphDatePicker.vue2.js +53 -40
  40. package/dist/components/form/nmorph-file-upload/NmorphFileUpload.vue.js +20 -16
  41. package/dist/components/form/nmorph-file-upload/NmorphFileUpload.vue2.js +113 -86
  42. package/dist/components/form/nmorph-form/NmorphForm.vue2.js +9 -9
  43. package/dist/components/form/nmorph-form/components/nmorph-form-item/NmorphFormItem.vue2.js +33 -24
  44. package/dist/components/form/nmorph-form/components/nmorph-form-item/inner-components/nmorph-error-box/NmorphErrorBox.vue2.js +1 -1
  45. package/dist/components/form/nmorph-form/use-form-item-input.js +29 -8
  46. package/dist/components/form/nmorph-number-input/NmorphNumberInput.vue2.js +42 -39
  47. package/dist/components/form/nmorph-otp-input/NmorphOTPInput.vue2.js +66 -62
  48. package/dist/components/form/nmorph-radio/NmorphRadio.css +1 -1
  49. package/dist/components/form/nmorph-radio/NmorphRadio.vue2.js +1 -1
  50. package/dist/components/form/nmorph-radio-group/NmorphRadioGroup.vue2.js +24 -22
  51. package/dist/components/form/nmorph-select/NmorphSelect.css +1 -1
  52. package/dist/components/form/nmorph-select/NmorphSelect.vue2.js +83 -81
  53. package/dist/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue2.js +4 -4
  54. package/dist/components/form/nmorph-select-button/NmorphSelectButton.vue2.js +28 -25
  55. package/dist/components/form/nmorph-select-button/components/nmorph-select-button-item/NmorphSelectButtonItem.vue2.js +1 -1
  56. package/dist/components/form/nmorph-slider/NmorphSlider.vue2.js +51 -49
  57. package/dist/components/form/nmorph-switch/NmorphSwitch.vue2.js +35 -33
  58. package/dist/components/form/nmorph-text-input/NmorphTextInput.css +1 -0
  59. package/dist/components/form/nmorph-text-input/NmorphTextInput.vue.js +5 -3
  60. package/dist/components/form/nmorph-text-input/NmorphTextInput.vue2.js +37 -35
  61. package/dist/components/form/nmorph-textarea/NmorphTextarea.vue.js +1 -1
  62. package/dist/components/form/nmorph-textarea/NmorphTextarea.vue2.js +30 -26
  63. package/dist/components/form/nmorph-time-picker/NmorphTimePicker.vue.js +1 -1
  64. package/dist/components/form/nmorph-time-picker/NmorphTimePicker.vue2.js +68 -66
  65. package/dist/components/navigation/nmorph-backtop/NmorphBacktop.vue2.js +1 -1
  66. package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.vue2.js +32 -31
  67. package/dist/components/navigation/nmorph-tabs/NmorphTabs.vue2.js +1 -1
  68. package/dist/components/others/nmorph-overlay/NmorphOverlay.vue2.js +1 -1
  69. package/dist/hooks/use-common-styles.js +18 -278
  70. package/dist/hooks/use-field-validation.js +71 -42
  71. package/dist/hooks/use-form-validation.js +62 -24
  72. package/dist/hooks/use-virtual-list.js +38 -32
  73. package/dist/index.umd.js +26 -286
  74. package/dist/package.json.js +1 -1
  75. package/dist/src/components/basic/nmorph-button/NmorphButton.vue.d.ts +2 -2
  76. package/dist/src/components/basic/nmorph-link/NmorphLink.vue.d.ts +1 -1
  77. package/dist/src/components/data/nmorph-avatar/NmorphAvatar.vue.d.ts +1 -1
  78. package/dist/src/components/data/nmorph-badge/NmorphBadge.vue.d.ts +1 -1
  79. package/dist/src/components/data/nmorph-collapse/components/nmorph-collapse-item/NmorphCollapseItem.vue.d.ts +1 -1
  80. package/dist/src/components/data/nmorph-empty/NmorphEmpty.vue.d.ts +1 -1
  81. package/dist/src/components/data/nmorph-pagination/NmorphPagination.vue.d.ts +1 -1
  82. package/dist/src/components/data/nmorph-progress/NmorphProgress.vue.d.ts +1 -1
  83. package/dist/src/components/data/nmorph-table/NmorphTable.vue.d.ts +1 -1
  84. package/dist/src/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue.d.ts +1 -1
  85. package/dist/src/components/feedback/nmorph-callout/NmorphCallout.vue.d.ts +1 -1
  86. package/dist/src/components/feedback/nmorph-dialog/NmorphDialog.vue.d.ts +4 -4
  87. package/dist/src/components/form/nmorph-autocomplete/NmorphAutocomplete.vue.d.ts +1 -1
  88. package/dist/src/components/form/nmorph-checkbox-group/NmorphCheckboxGroup.vue.d.ts +3 -3
  89. package/dist/src/components/form/nmorph-color-picker/NmorphColorPicker.vue.d.ts +1 -1
  90. package/dist/src/components/form/nmorph-date-picker/NmorphDatePicker.vue.d.ts +3 -3
  91. package/dist/src/components/form/nmorph-file-upload/NmorphFileUpload.vue.d.ts +6 -3
  92. package/dist/src/components/form/nmorph-file-upload/types.d.ts +4 -0
  93. package/dist/src/components/form/nmorph-form/components/nmorph-form-item/NmorphFormItem.vue.d.ts +1 -1
  94. package/dist/src/components/form/nmorph-form/components/nmorph-form-item/inner-components/nmorph-error-box/NmorphErrorBox.vue.d.ts +1 -1
  95. package/dist/src/components/form/nmorph-form/types.d.ts +15 -5
  96. package/dist/src/components/form/nmorph-form/use-form-item-input.d.ts +10 -0
  97. package/dist/src/components/form/nmorph-number-input/NmorphNumberInput.vue.d.ts +1 -1
  98. package/dist/src/components/form/nmorph-otp-input/NmorphOTPInput.vue.d.ts +1 -1
  99. package/dist/src/components/form/nmorph-radio-group/NmorphRadioGroup.vue.d.ts +3 -3
  100. package/dist/src/components/form/nmorph-select/NmorphSelect.vue.d.ts +1 -1
  101. package/dist/src/components/form/nmorph-select-button/NmorphSelectButton.vue.d.ts +1 -1
  102. package/dist/src/components/form/nmorph-text-input/NmorphTextInput.vue.d.ts +1 -1
  103. package/dist/src/components/form/nmorph-textarea/NmorphTextarea.vue.d.ts +1 -1
  104. package/dist/src/components/form/nmorph-time-picker/NmorphTimePicker.vue.d.ts +1 -1
  105. package/dist/src/hooks/use-field-validation.d.ts +15 -0
  106. package/dist/src/hooks/use-form-validation.d.ts +5 -0
  107. package/dist/src/hooks/use-virtual-list.d.ts +6 -0
  108. package/dist/src/types/index.d.ts +2 -1
  109. package/dist/src/utils/common.d.ts +5 -0
  110. package/dist/src/utils/create-modifiers.d.ts +4 -2
  111. package/dist/style.css +1 -1
  112. package/dist/utils/common.js +9 -3
  113. package/dist/utils/create-modifiers.js +6 -6
  114. package/package.json +1 -1
@@ -1,74 +1,103 @@
1
- import { ref as p } from "vue";
2
- const I = (b) => {
3
- const { inputValue: h, rules: a } = b, c = p([]), f = p(!1), d = p(!1);
1
+ import { resolution as L } from "../components/form/nmorph-file-upload/types.js";
2
+ import { ref as h } from "vue";
3
+ const S = Object.entries(L), z = (t) => t.split("/")[1]?.toLowerCase() || "", B = (t) => {
4
+ const o = t.split(".").pop()?.toLowerCase();
5
+ return o && o !== t.toLowerCase() ? o : "";
6
+ }, I = (t) => S.find(([, o]) => o.toLowerCase() === t.toLowerCase())?.[0] || "", M = (t) => Array.from(
7
+ new Set(
8
+ [
9
+ t.type.toLowerCase(),
10
+ I(t.type),
11
+ B(t.name),
12
+ z(t.type)
13
+ ].filter(Boolean).map((o) => o.toLowerCase())
14
+ )
15
+ ), w = (t) => typeof File < "u" && t instanceof File, q = (t) => !!t && typeof t == "object" && "data" in t && w(t.data), E = (t) => {
16
+ if (w(t)) return [t];
17
+ if (!Array.isArray(t)) return null;
18
+ const o = t;
19
+ return o.length === 0 ? [] : o.every(w) ? o : o.every(q) ? o.map((s) => s.data) : null;
20
+ }, j = (t, o) => {
21
+ if (o.length === 0) return !0;
22
+ const s = M(t);
23
+ return o.some((c) => s.includes(String(c).toLowerCase()));
24
+ }, P = (t) => {
25
+ const { inputValue: o, rules: s } = t, c = h([]), y = h(!1), m = h(!1);
4
26
  return {
5
- touched: d,
6
- valid: f,
27
+ touched: m,
28
+ valid: y,
7
29
  errors: c,
8
30
  validate: () => {
9
- const y = a?.length > 0;
10
- if (!y) {
11
- f.value = !0;
31
+ const g = s?.length > 0;
32
+ if (c.value = [], !g) {
33
+ y.value = !0;
12
34
  return;
13
35
  }
14
- if (h === null) return;
15
- const t = h, u = (n) => y && n in a[0], m = typeof t == "string" && u("pattern"), v = typeof t == "number" && u("numberCompareType"), g = (typeof t == "string" || typeof t == "boolean") && u("booleanCompareType"), T = Array.isArray(t) && u("arrayCompareType");
16
- if (!v && !m && !g && !T) {
36
+ if (o === null) return;
37
+ const i = o, u = (a) => g && s.some((r) => a in r), C = typeof i == "string" && u("pattern"), F = typeof i == "number" && u("numberCompareType"), T = (typeof i == "string" || typeof i == "boolean") && u("booleanCompareType"), v = Array.isArray(i) && u("arrayCompareType"), x = u("fileMaxSize") || u("maxFileSize") || u("fileAllowedTypes") || u("allowedTypes") || u("fileMaxCount") || u("maxFiles"), b = x ? E(i) : null, A = x && b !== null;
38
+ if (!F && !C && !T && !v && !A) {
17
39
  console.warn("The input value and the provided rules do not match");
18
40
  return;
19
41
  }
20
- if (d.value || (d.value = !0), m) {
21
- const n = a;
22
- c.value = n.reduce((o, r) => (t.match(r.pattern) || o.push(r.error), o), []);
42
+ if (m.value || (m.value = !0), C) {
43
+ const a = s;
44
+ c.value = a.reduce((r, n) => (i.match(n.pattern) || r.push(n.error), r), []);
23
45
  }
24
- if (v) {
25
- const n = (r, e, s) => {
26
- switch (s) {
46
+ if (F) {
47
+ const a = (n, e, l) => {
48
+ switch (l) {
27
49
  case "eq":
28
- return r === e;
50
+ return n === e;
29
51
  case "gt":
30
- return r > e;
52
+ return n > e;
31
53
  case "lt":
32
- return r < e;
54
+ return n < e;
33
55
  case "lte":
34
- return r <= e;
56
+ return n <= e;
35
57
  case "gte":
36
- return r >= e;
58
+ return n >= e;
37
59
  }
38
- }, o = a;
39
- c.value = o.reduce((r, e) => (n(t, e.compareValue, e.numberCompareType) && r.push(e.error), r), []);
60
+ }, r = s;
61
+ c.value = r.reduce((n, e) => (a(i, e.compareValue, e.numberCompareType) && n.push(e.error), n), []);
40
62
  }
41
- if (g) {
42
- const n = a;
43
- c.value = n.reduce((o, r) => {
63
+ if (T) {
64
+ const a = s;
65
+ c.value = a.reduce((r, n) => {
44
66
  let e = !1;
45
- const { compareValue: s, booleanCompareType: i } = r;
46
- return i === "not-eq" && (e = t === s), i === "eq" && (e = t !== s), e || o.push(r.error), o;
67
+ const { compareValue: l, booleanCompareType: f } = n;
68
+ return f === "not-eq" && (e = i === l), f === "eq" && (e = i !== l), e || r.push(n.error), r;
47
69
  }, []);
48
70
  }
49
- if (T) {
50
- const n = a, o = (r, e, s) => {
51
- switch (s) {
71
+ if (v) {
72
+ const a = s, r = (n, e, l) => {
73
+ switch (l) {
52
74
  case "contains-one":
53
- return r.some((l) => e.includes(l));
75
+ return n.some((p) => e.includes(p));
54
76
  case "full-eq":
55
- if (r.length !== e.length) return !1;
56
- const i = [...r].sort(), C = [...e].sort();
57
- return i.every((l, w) => l === C[w]);
77
+ if (n.length !== e.length) return !1;
78
+ const f = [...n].sort(), d = [...e].sort();
79
+ return f.every((p, R) => p === d[R]);
58
80
  case "not-contains":
59
- return !r.some((l) => e.includes(l));
81
+ return !n.some((p) => e.includes(p));
60
82
  }
61
83
  };
62
- c.value = n.reduce((r, e) => (o(
63
- t.map((i) => String(i)),
84
+ c.value = a.reduce((n, e) => (r(
85
+ i.map((f) => String(f)),
64
86
  e.compareValue,
65
87
  e.arrayCompareType
66
- ) || r.push(e.error), r), []);
88
+ ) || n.push(e.error), n), []);
89
+ }
90
+ if (A) {
91
+ const a = s, r = b || [];
92
+ c.value = a.reduce((n, e) => {
93
+ const l = e.fileMaxSize ?? e.maxFileSize, f = e.fileAllowedTypes ?? e.allowedTypes, d = e.fileMaxCount ?? e.maxFiles;
94
+ return typeof l == "number" && r.some((p) => p.size > l) && n.push(e.error), f && r.some((p) => !j(p, f)) && n.push(e.error), typeof d == "number" && r.length > d && n.push(e.error), n;
95
+ }, []);
67
96
  }
68
- f.value = c.value.length === 0;
97
+ y.value = c.value.length === 0;
69
98
  }
70
99
  };
71
100
  };
72
101
  export {
73
- I as useFieldValidation
102
+ P as useFieldValidation
74
103
  };
@@ -1,30 +1,68 @@
1
- import { reactive as i, ref as p, watch as b, readonly as v } from "vue";
2
- import { deepClone as F } from "../utils/common.js";
1
+ import { reactive as f, ref as h, watch as w, readonly as b } from "vue";
3
2
  import { useFieldValidation as c } from "./use-field-validation.js";
4
- const T = (n, f = !1) => {
5
- const t = i({}), o = i({}), u = i(F(n)), a = p(!1), d = p(!1), h = () => {
6
- Object.entries(n).forEach(([e, s]) => {
7
- o[e] = c({ inputValue: s.value, rules: s.rules }), o[e].validate();
8
- }), a.value = Object.values(o).every((e) => e.valid);
9
- }, V = () => {
10
- Object.entries(n).forEach(([e, s]) => {
11
- t[e] = c({ inputValue: s.value, rules: s.rules }), t[e].validate();
3
+ const z = (e) => typeof File < "u" && e instanceof File, p = (e) => z(e) ? {
4
+ name: e.name,
5
+ size: e.size,
6
+ type: e.type,
7
+ lastModified: e.lastModified
8
+ } : e instanceof Date ? e.toISOString() : e instanceof RegExp ? e.toString() : typeof e == "function" ? String(e) : Array.isArray(e) ? e.map(p) : e && typeof e == "object" ? Object.fromEntries(
9
+ Object.entries(e).map(([s, i]) => [
10
+ s,
11
+ p(i)
12
+ ])
13
+ ) : e, m = (e) => Object.fromEntries(
14
+ Object.entries(e).map(([s, i]) => [
15
+ s,
16
+ JSON.stringify(p(i))
17
+ ])
18
+ ), O = (e) => {
19
+ const s = e.valid;
20
+ return typeof s == "boolean" ? s : s.value;
21
+ }, H = (e, s = !1) => {
22
+ const i = f({}), a = f({}), F = f(m(e)), V = h(!1), d = h(!1), j = () => {
23
+ const t = Object.values(a).every(O), n = Object.values(i).every(O);
24
+ V.value = t && n;
25
+ }, u = () => {
26
+ Object.entries(e).forEach(([t, n]) => {
27
+ a[t] = c({ inputValue: n.value, rules: n.rules }), a[t].validate();
28
+ }), j();
29
+ }, g = () => {
30
+ Object.entries(e).forEach(([t, n]) => {
31
+ i[t] = c({ inputValue: n.value, rules: n.rules }), i[t].validate();
32
+ }), u();
33
+ }, y = (t, n) => {
34
+ const r = e[t];
35
+ if (!r) return;
36
+ const o = c({
37
+ inputValue: n ?? r.value,
38
+ rules: r.rules
12
39
  });
13
- }, m = (e, s) => Object.keys(s).filter((l) => {
14
- const g = e[l] ? JSON.stringify(e[l]) : null, O = JSON.stringify(s[l]);
15
- return g !== O;
16
- });
17
- return b(n, (e) => {
18
- m(u, e).forEach((r) => {
19
- const l = e[r];
20
- t[r] = c({ inputValue: l.value, rules: l.rules }), t[r].validate();
21
- }), Object.assign(u, F(e)), h(), d.value = !0;
22
- }, { deep: !0 }), f && V(), {
23
- fields: t,
24
- isFormValid: v(a),
25
- isAnyTouched: v(d)
40
+ return o.validate(), i[t] = o, u(), d.value = !0, o;
41
+ }, S = (t, n) => {
42
+ const r = e[t];
43
+ r && (r.value = n, y(t, n));
44
+ }, v = (t, n) => {
45
+ const r = m(n);
46
+ return { changedFields: Object.keys(n).filter((l) => {
47
+ const E = t[l] ?? null, A = r[l];
48
+ return E !== A;
49
+ }), newSnapshot: r };
50
+ };
51
+ return w(e, (t) => {
52
+ const { changedFields: n, newSnapshot: r } = v(F, t);
53
+ n.forEach((o) => {
54
+ const l = t[o];
55
+ i[o] = c({ inputValue: l.value, rules: l.rules }), i[o].validate();
56
+ }), Object.assign(F, r), u(), d.value = !0;
57
+ }, { deep: !0 }), s && g(), {
58
+ formValue: e,
59
+ fields: i,
60
+ updateFieldValue: S,
61
+ validateField: y,
62
+ isFormValid: b(V),
63
+ isAnyTouched: b(d)
26
64
  };
27
65
  };
28
66
  export {
29
- T as useFormValidation
67
+ H as useFormValidation
30
68
  };
@@ -1,72 +1,78 @@
1
- import { ref as m, computed as n, onMounted as R, nextTick as M, onUnmounted as V, watch as k } from "vue";
2
- const C = (a, h) => {
3
- const x = m(null), c = m(0), d = m(0), s = n(() => h.enabled?.value ?? !0), i = n(() => Math.max(h.overscan?.value ?? 0, 0)), u = n(() => h.dynamic?.value ?? !1), o = n(() => Math.max(h.itemHeight.value, 1)), g = m({}), p = (e) => u.value && g.value[e] || o.value, f = n(() => {
1
+ import { ref as m, computed as a, onMounted as V, nextTick as M, onUnmounted as $, watch as k } from "vue";
2
+ const C = (n, h) => {
3
+ const x = m(null), c = m(0), d = m(0), s = a(() => h.enabled?.value ?? !0), i = a(() => Math.max(h.overscan?.value ?? 0, 0)), u = a(() => h.dynamic?.value ?? !1), o = a(() => Math.max(h.itemHeight.value, 1)), g = m({}), w = (e) => u.value && g.value[e] || o.value, f = a(() => {
4
4
  const e = [];
5
5
  let t = 0;
6
- for (let l = 0; l < a.value.length; l++)
7
- e[l] = t, t += p(l);
6
+ for (let l = 0; l < n.value.length; l++)
7
+ e[l] = t, t += w(l);
8
8
  return { offsets: e, total: t };
9
- }), w = n(() => s.value ? u.value ? f.value.total : a.value.length * o.value : 0), r = () => {
9
+ }), p = a(() => s.value ? u.value ? f.value.total : n.value.length * o.value : 0), r = () => {
10
10
  const e = x.value;
11
11
  if (!e) return;
12
- const t = Math.max(w.value - e.clientHeight, 0);
12
+ const t = Math.max(p.value - e.clientHeight, 0);
13
13
  e.scrollTop > t && (e.scrollTop = t), c.value = e.scrollTop, d.value = e.clientHeight;
14
- }, I = () => {
14
+ }, y = () => {
15
15
  r();
16
- }, v = n(() => {
16
+ }, v = a(() => {
17
17
  if (!s.value) return 0;
18
18
  if (u.value) {
19
- const e = f.value.offsets.findIndex((t, l) => t + p(l) >= c.value);
19
+ const e = f.value.offsets.findIndex((t, l) => t + w(l) >= c.value);
20
20
  return Math.max(e === -1 ? 0 : e - i.value, 0);
21
21
  }
22
22
  return Math.max(Math.floor(c.value / o.value) - i.value, 0);
23
- }), H = n(() => {
24
- if (!s.value) return a.value.length;
23
+ }), H = a(() => {
24
+ if (!s.value) return n.value.length;
25
25
  if (u.value) {
26
26
  const t = c.value + d.value;
27
27
  let l = v.value;
28
- for (; l < a.value.length && f.value.offsets[l] <= t; )
28
+ for (; l < n.value.length && f.value.offsets[l] <= t; )
29
29
  l++;
30
- return Math.min(l + i.value, a.value.length);
30
+ return Math.min(l + i.value, n.value.length);
31
31
  }
32
32
  const e = Math.ceil((c.value + d.value) / o.value) + i.value;
33
- return Math.min(Math.max(e, v.value + i.value), a.value.length);
34
- }), y = n(
33
+ return Math.min(Math.max(e, v.value + i.value), n.value.length);
34
+ }), T = a(
35
35
  () => u.value ? f.value.offsets[v.value] || 0 : v.value * o.value
36
- ), z = n(() => s.value ? a.value.slice(v.value, H.value).map((e, t) => ({
36
+ ), z = a(() => s.value ? n.value.slice(v.value, H.value).map((e, t) => ({
37
37
  item: e,
38
38
  index: v.value + t
39
- })) : a.value.map((e, t) => ({ item: e, index: t }))), E = (e) => {
39
+ })) : n.value.map((e, t) => ({ item: e, index: t }))), E = a(() => ({
40
+ height: `${p.value}px`
41
+ })), L = a(() => ({
42
+ transform: `translateY(${T.value}px)`
43
+ })), S = (e) => {
40
44
  const t = x.value;
41
45
  if (!t || !s.value) return;
42
- const l = Math.min(Math.max(e, 0), Math.max(a.value.length - 1, 0)), b = u.value ? f.value.offsets[l] || 0 : l * o.value;
43
- t.scrollTop = b, r();
44
- }, L = (e, t) => {
46
+ const l = Math.min(Math.max(e, 0), Math.max(n.value.length - 1, 0)), R = u.value ? f.value.offsets[l] || 0 : l * o.value;
47
+ t.scrollTop = R, r();
48
+ }, b = (e, t) => {
45
49
  if (!u.value || !t) return;
46
50
  const l = Math.ceil(t.getBoundingClientRect().height || t.offsetHeight);
47
51
  !l || g.value[e] === l || (g.value = { ...g.value, [e]: l }, M(r));
48
- }, T = () => {
52
+ }, I = () => {
49
53
  r();
50
54
  };
51
- return R(() => {
52
- M(r), typeof window < "u" && window.addEventListener("resize", T);
53
- }), V(() => {
54
- typeof window < "u" && window.removeEventListener("resize", T);
55
+ return V(() => {
56
+ M(r), typeof window < "u" && window.addEventListener("resize", I);
57
+ }), $(() => {
58
+ typeof window < "u" && window.removeEventListener("resize", I);
55
59
  }), k(
56
- () => [a.value.length, s.value, o.value, u.value],
60
+ () => [n.value.length, s.value, o.value, u.value],
57
61
  () => {
58
62
  M(r);
59
63
  }
60
64
  ), {
61
65
  containerRef: x,
66
+ contentStyle: L,
62
67
  endIndex: H,
63
- offsetTop: y,
68
+ offsetTop: T,
64
69
  refresh: r,
65
- measureElement: L,
66
- scrollHandler: I,
67
- scrollToIndex: E,
70
+ measureElement: b,
71
+ scrollHandler: y,
72
+ scrollToIndex: S,
73
+ spacerStyle: E,
68
74
  startIndex: v,
69
- totalHeight: w,
75
+ totalHeight: p,
70
76
  viewportHeight: d,
71
77
  virtualItems: z
72
78
  };