mochi-island-ui 1.1.0 → 1.2.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.
@@ -1,5 +1,5 @@
1
1
  // src/components/select/MochiSelect.module.css
2
- var e = "_root_i62a6_2", t = "_trigger_i62a6_6", n = "_value_i62a6_31", r = "_chevron_i62a6_42", i = "_list_i62a6_64", a = "_listUp_i62a6_88", o = "_indicator_i62a6_95", s = "_option_i62a6_114", c = "_popEnter_i62a6_135", l = "_popIn_i62a6_1", u = "_popLeave_i62a6_139", d = "_popOut_i62a6_1", f = {
2
+ var e = "_root_19v55_2", t = "_trigger_19v55_6", n = "_value_19v55_31", r = "_chevron_19v55_42", i = "_list_19v55_64", a = "_listUp_19v55_88", o = "_indicator_19v55_95", s = "_option_19v55_114", c = "_popEnter_19v55_135", l = "_popIn_19v55_1", u = "_popLeave_19v55_139", d = "_popOut_19v55_1", f = {
3
3
  root: e,
4
4
  trigger: t,
5
5
  value: n,
@@ -1,4 +1,5 @@
1
1
  import { MochiSelectOption } from './types';
2
+ import { MochiVirtualSetting } from '../../styles/virtual';
2
3
  type __VLS_Props = {
3
4
  options: MochiSelectOption[];
4
5
  label?: string;
@@ -7,6 +8,11 @@ type __VLS_Props = {
7
8
  placeholder?: string;
8
9
  disabled?: boolean;
9
10
  invalid?: boolean;
11
+ /**
12
+ * CSS 虚拟化三态:true 强制开(弹层里屏外选项跳过布局/绘制,DOM 保留);
13
+ * false 强制关;'auto'(默认)按硬件自适应——低端设备自动开。
14
+ */
15
+ virtual?: MochiVirtualSetting;
10
16
  };
11
17
  type __VLS_ModelProps = {
12
18
  modelValue?: string;
@@ -16,6 +22,8 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {},
16
22
  "update:modelValue": (value: string) => any;
17
23
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
18
24
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
19
- }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
25
+ }>, {
26
+ virtual: MochiVirtualSetting;
27
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
20
28
  declare const _default: typeof __VLS_export;
21
29
  export default _default;
@@ -1,75 +1,82 @@
1
1
  import { useMessages as e } from "../../locale.js";
2
2
  import t from "../../internal/FieldShell.js";
3
3
  import n from "./MochiSelect.module.js";
4
- import { Fragment as r, Transition as i, computed as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, defineComponent as u, mergeModels as d, nextTick as f, normalizeClass as p, normalizeStyle as m, onBeforeUnmount as h, openBlock as g, ref as _, renderList as v, toDisplayString as y, unref as b, useId as x, useModel as S, watch as C, withCtx as w } from "vue";
4
+ import r from "../../styles/virtual.module.js";
5
+ import { shouldVirtualize as i } from "../../styles/virtual.js";
6
+ import { Fragment as a, Transition as o, computed as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createVNode as d, defineComponent as f, mergeModels as p, nextTick as m, normalizeClass as h, normalizeStyle as g, onBeforeUnmount as _, openBlock as v, ref as y, renderList as b, toDisplayString as x, unref as S, useId as C, useModel as ee, watch as w, withCtx as T } from "vue";
5
7
  // src/components/select/MochiSelect.vue?vue&type=script&setup=true&lang.ts
6
- var T = [
8
+ var E = [
7
9
  "id",
8
10
  "aria-expanded",
9
11
  "aria-controls",
10
12
  "aria-invalid",
11
13
  "aria-describedby",
12
14
  "disabled"
13
- ], E = ["data-placeholder"], D = ["data-open"], O = ["id"], k = ["data-ready"], A = [
15
+ ], D = ["data-placeholder"], O = ["data-open"], k = ["id"], A = ["data-ready"], j = [
16
+ "data-virtual",
14
17
  "aria-selected",
15
18
  "aria-disabled",
16
19
  "data-active",
17
20
  "data-selected",
18
21
  "onClick",
19
22
  "onMouseenter"
20
- ], j = /*@__PURE__*/ u({
23
+ ], M = /*@__PURE__*/ f({
21
24
  name: "MochiSelect",
22
25
  __name: "MochiSelect",
23
- props: /*@__PURE__*/ d({
26
+ props: /*@__PURE__*/ p({
24
27
  options: {},
25
28
  label: {},
26
29
  hint: {},
27
30
  placeholder: {},
28
31
  disabled: { type: Boolean },
29
- invalid: { type: Boolean }
32
+ invalid: { type: Boolean },
33
+ virtual: {
34
+ type: [Boolean, String],
35
+ default: "auto"
36
+ }
30
37
  }, {
31
38
  modelValue: { default: "" },
32
39
  modelModifiers: {}
33
40
  }),
34
41
  emits: ["update:modelValue"],
35
- setup(u) {
36
- let d = e(), j = u, M = S(u, "modelValue"), N = x(), P = a(() => `${N}-hint`), F = a(() => `${N}-list`), I = _(!1), L = _(!1), R = _(-1), z = _(), B = _(), V = _(), H = _({
42
+ setup(f) {
43
+ let p = e(), M = f, N = ee(f, "modelValue"), P = C(), F = s(() => `${P}-hint`), I = s(() => `${P}-list`), L = y(!1), R = y(!1), z = y(-1), B = y(), V = y(), H = y(), U = y({
37
44
  top: 0,
38
45
  height: 0
39
- }), U = _(!1), W = a(() => j.options.find((e) => e.value === M.value)), G = a(() => j.options.map((e, t) => e.disabled ? -1 : t).filter((e) => e >= 0));
40
- function K() {
41
- if (j.disabled) return;
42
- I.value = !0;
43
- let e = z.value?.getBoundingClientRect(), t = Math.min(240, j.options.length * 40 + 8);
44
- L.value = e ? e.bottom + t + 8 > window.innerHeight : !1;
45
- let n = j.options.findIndex((e) => e.value === M.value);
46
- R.value = n >= 0 ? n : G.value[0] ?? -1;
47
- }
48
- function q(e = !1) {
49
- I.value = !1, R.value = -1, e && z.value?.focus();
50
- }
46
+ }), W = y(!1), G = s(() => M.options.find((e) => e.value === N.value)), K = s(() => M.options.map((e, t) => e.disabled ? -1 : t).filter((e) => e >= 0)), q = s(() => i(M.options.length, M.virtual));
51
47
  function J() {
52
- I.value ? q() : K();
48
+ if (M.disabled) return;
49
+ L.value = !0;
50
+ let e = B.value?.getBoundingClientRect(), t = Math.min(240, M.options.length * 40 + 8);
51
+ R.value = e ? e.bottom + t + 8 > window.innerHeight : !1;
52
+ let n = M.options.findIndex((e) => e.value === N.value);
53
+ z.value = n >= 0 ? n : K.value[0] ?? -1;
53
54
  }
54
- function Y(e) {
55
- e.disabled || (M.value = e.value, q(!0));
55
+ function Y(e = !1) {
56
+ L.value = !1, z.value = -1, e && B.value?.focus();
57
+ }
58
+ function te() {
59
+ L.value ? Y() : J();
56
60
  }
57
61
  function X(e) {
58
- let t = G.value;
62
+ e.disabled || (N.value = e.value, Y(!0));
63
+ }
64
+ function Z(e) {
65
+ let t = K.value;
59
66
  if (!t.length) return;
60
- let n = t[(t.indexOf(R.value) + e + t.length) % t.length];
61
- n !== void 0 && (R.value = n);
67
+ let n = t[(t.indexOf(z.value) + e + t.length) % t.length];
68
+ n !== void 0 && (z.value = n);
62
69
  }
63
- function Z() {
64
- let e = V.value?.querySelector("[data-active=\"true\"]");
65
- e && (H.value = {
70
+ function Q() {
71
+ let e = H.value?.querySelector("[data-active=\"true\"]");
72
+ e && (U.value = {
66
73
  top: e.offsetTop,
67
74
  height: e.offsetHeight
68
75
  });
69
76
  }
70
- C(R, () => f(Z));
71
- function Q(e) {
72
- if (!j.disabled && [
77
+ w(z, () => m(Q));
78
+ function ne(e) {
79
+ if (!M.disabled && [
73
80
  "ArrowDown",
74
81
  "ArrowUp",
75
82
  "Home",
@@ -78,92 +85,93 @@ var T = [
78
85
  " ",
79
86
  "Escape"
80
87
  ].includes(e.key)) {
81
- if (e.preventDefault(), !I.value) e.key !== "Escape" && K();
82
- else if (e.key === "ArrowDown") X(1);
83
- else if (e.key === "ArrowUp") X(-1);
84
- else if (e.key === "Home") R.value = G.value[0] ?? -1;
85
- else if (e.key === "End") R.value = G.value.at(-1) ?? -1;
86
- else if (e.key === "Escape") q(!0);
88
+ if (e.preventDefault(), !L.value) e.key !== "Escape" && J();
89
+ else if (e.key === "ArrowDown") Z(1);
90
+ else if (e.key === "ArrowUp") Z(-1);
91
+ else if (e.key === "Home") z.value = K.value[0] ?? -1;
92
+ else if (e.key === "End") z.value = K.value.at(-1) ?? -1;
93
+ else if (e.key === "Escape") Y(!0);
87
94
  else {
88
- let e = j.options[R.value];
89
- e && Y(e);
95
+ let e = M.options[z.value];
96
+ e && X(e);
90
97
  }
91
98
  }
92
99
  }
93
- C(I, async (e) => {
94
- e ? (await f(), Z(), requestAnimationFrame(() => {
95
- U.value = !0;
96
- }), (B.value?.querySelector("[data-active=\"true\"]"))?.scrollIntoView?.({ block: "nearest" })) : U.value = !1;
100
+ w(L, async (e) => {
101
+ e ? (await m(), Q(), requestAnimationFrame(() => {
102
+ W.value = !0;
103
+ }), (V.value?.querySelector("[data-active=\"true\"]"))?.scrollIntoView?.({ block: "nearest" })) : W.value = !1;
97
104
  });
98
105
  function $(e) {
99
- I.value && B.value && !B.value.contains(e.target) && q();
106
+ L.value && V.value && !V.value.contains(e.target) && Y();
100
107
  }
101
- return C(I, (e) => {
108
+ return w(L, (e) => {
102
109
  e ? document.addEventListener("pointerdown", $) : document.removeEventListener("pointerdown", $);
103
- }), h(() => document.removeEventListener("pointerdown", $)), (e, a) => (g(), s("div", {
110
+ }), _(() => document.removeEventListener("pointerdown", $)), (e, i) => (v(), l("div", {
104
111
  ref_key: "root",
105
- ref: B,
106
- class: p(b(n).root)
107
- }, [l(t, {
108
- label: u.label,
109
- hint: u.hint,
110
- "field-id": b(N),
111
- "hint-id": P.value,
112
- invalid: u.invalid
112
+ ref: V,
113
+ class: h(S(n).root)
114
+ }, [d(t, {
115
+ label: f.label,
116
+ hint: f.hint,
117
+ "field-id": S(P),
118
+ "hint-id": F.value,
119
+ invalid: f.invalid
113
120
  }, {
114
- default: w(() => [c("button", {
115
- id: b(N),
121
+ default: T(() => [u("button", {
122
+ id: S(P),
116
123
  ref_key: "trigger",
117
- ref: z,
118
- class: p(b(n).trigger),
124
+ ref: B,
125
+ class: h(S(n).trigger),
119
126
  type: "button",
120
127
  role: "combobox",
121
128
  "aria-haspopup": "listbox",
122
- "aria-expanded": I.value,
123
- "aria-controls": F.value,
124
- "aria-invalid": u.invalid || void 0,
125
- "aria-describedby": u.hint ? P.value : void 0,
126
- disabled: u.disabled,
127
- onClick: J,
128
- onKeydown: Q
129
- }, [c("span", {
130
- class: p(b(n).value),
131
- "data-placeholder": !W.value || void 0
132
- }, y(W.value?.label ?? u.placeholder ?? b(d).selectPlaceholder), 11, E), (g(), s("svg", {
133
- class: p(b(n).chevron),
134
- "data-open": I.value,
129
+ "aria-expanded": L.value,
130
+ "aria-controls": I.value,
131
+ "aria-invalid": f.invalid || void 0,
132
+ "aria-describedby": f.hint ? F.value : void 0,
133
+ disabled: f.disabled,
134
+ onClick: te,
135
+ onKeydown: ne
136
+ }, [u("span", {
137
+ class: h(S(n).value),
138
+ "data-placeholder": !G.value || void 0
139
+ }, x(G.value?.label ?? f.placeholder ?? S(p).selectPlaceholder), 11, D), (v(), l("svg", {
140
+ class: h(S(n).chevron),
141
+ "data-open": L.value,
135
142
  viewBox: "0 0 12 12",
136
143
  "aria-hidden": "true"
137
- }, [...a[0] ||= [c("path", { d: "M2 4.5 L6 8.5 L10 4.5" }, null, -1)]], 10, D))], 42, T), l(i, {
138
- "enter-active-class": b(n).popEnter,
139
- "leave-active-class": b(n).popLeave
144
+ }, [...i[0] ||= [u("path", { d: "M2 4.5 L6 8.5 L10 4.5" }, null, -1)]], 10, O))], 42, E), d(o, {
145
+ "enter-active-class": S(n).popEnter,
146
+ "leave-active-class": S(n).popLeave
140
147
  }, {
141
- default: w(() => [I.value ? (g(), s("ul", {
148
+ default: T(() => [L.value ? (v(), l("ul", {
142
149
  key: 0,
143
- id: F.value,
150
+ id: I.value,
144
151
  ref_key: "listEl",
145
- ref: V,
146
- class: p(b(n).list),
152
+ ref: H,
153
+ class: h(S(n).list),
147
154
  role: "listbox"
148
- }, [c("span", {
149
- class: p(b(n).indicator),
150
- "data-ready": U.value || void 0,
151
- style: m({
152
- transform: `translateY(${H.value.top}px)`,
153
- height: `${H.value.height}px`
155
+ }, [u("span", {
156
+ class: h(S(n).indicator),
157
+ "data-ready": W.value || void 0,
158
+ style: g({
159
+ transform: `translateY(${U.value.top}px)`,
160
+ height: `${U.value.height}px`
154
161
  }),
155
162
  "aria-hidden": "true"
156
- }, null, 14, k), (g(!0), s(r, null, v(u.options, (e, t) => (g(), s("li", {
163
+ }, null, 14, A), (v(!0), l(a, null, b(f.options, (e, t) => (v(), l("li", {
157
164
  key: e.value,
158
- class: p(b(n).option),
165
+ class: h([S(n).option, q.value && S(r).row]),
159
166
  role: "option",
160
- "aria-selected": e.value === M.value,
167
+ "data-virtual": q.value || void 0,
168
+ "aria-selected": e.value === N.value,
161
169
  "aria-disabled": e.disabled || void 0,
162
- "data-active": t === R.value || void 0,
163
- "data-selected": e.value === M.value || void 0,
164
- onClick: (t) => Y(e),
165
- onMouseenter: (n) => !e.disabled && (R.value = t)
166
- }, y(e.label), 43, A))), 128))], 10, O)) : o("", !0)]),
170
+ "data-active": t === z.value || void 0,
171
+ "data-selected": e.value === N.value || void 0,
172
+ onClick: (t) => X(e),
173
+ onMouseenter: (n) => !e.disabled && (z.value = t)
174
+ }, x(e.label), 43, j))), 128))], 10, k)) : c("", !0)]),
167
175
  _: 1
168
176
  }, 8, ["enter-active-class", "leave-active-class"])]),
169
177
  _: 1
@@ -176,4 +184,4 @@ var T = [
176
184
  ])], 2));
177
185
  }
178
186
  });
179
- export { j as default };
187
+ export { M as default };
@@ -1,5 +1,5 @@
1
1
  // src/components/table/MochiTable.module.css
2
- var e = "_wrap_1i9ki_7", t = "_root_1i9ki_14", n = "_th_1i9ki_25", r = "_sorter_1i9ki_37", i = "_arrow_1i9ki_60", a = "_tr_1i9ki_95", o = "_rowIn_1i9ki_1", s = "_rowMove_1i9ki_106", c = "_td_1i9ki_129", l = "_empty_1i9ki_140", u = {
2
+ var e = "_wrap_1py51_7", t = "_root_1py51_14", n = "_th_1py51_25", r = "_sorter_1py51_37", i = "_arrow_1py51_60", a = "_tr_1py51_95", o = "_rowIn_1py51_1", s = "_rowMove_1py51_106", c = "_td_1py51_129", l = "_empty_1py51_140", u = {
3
3
  wrap: e,
4
4
  root: t,
5
5
  th: n,
@@ -1,4 +1,5 @@
1
1
  import { MochiTableColumn, MochiTableSort } from './types';
2
+ import { MochiVirtualSetting } from '../../styles/virtual';
2
3
  type __VLS_Props = {
3
4
  columns: MochiTableColumn[];
4
5
  rows: Record<string, unknown>[];
@@ -6,6 +7,18 @@ type __VLS_Props = {
6
7
  rowKey?: string;
7
8
  striped?: boolean;
8
9
  emptyText?: string;
10
+ /**
11
+ * CSS 虚拟化三态:true 强制开(屏外行跳过布局/绘制,DOM 保留);
12
+ * false 强制关;'auto'(默认)按硬件自适应——低端设备自动开。
13
+ */
14
+ virtual?: MochiVirtualSetting;
15
+ /**
16
+ * 渐进分片渲染:行数超阈值时先渲染首块(200 行)尽快出屏,其余行在
17
+ * idle 期补齐,DOM 最终全量保留(可 Ctrl+F)。补块大小按上一块的实际
18
+ * patch 耗时 AIMD 调节(预算内翻倍、超时减半),慢硬件自动缩小、快硬件
19
+ * 自动放大。排序/换数据会重置分片。
20
+ */
21
+ progressive?: boolean;
9
22
  };
10
23
  declare var __VLS_11: `cell-${string}`, __VLS_12: {
11
24
  row: Record<string, unknown>;
@@ -22,7 +35,9 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {},
22
35
  }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
23
36
  "onSort-change"?: ((args_0: MochiTableSort | null) => any) | undefined;
24
37
  }>, {
38
+ virtual: MochiVirtualSetting;
25
39
  rowKey: string;
40
+ progressive: boolean;
26
41
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
27
42
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
28
43
  declare const _default: typeof __VLS_export;
@@ -1,8 +1,10 @@
1
1
  import { useMessages as e } from "../../locale.js";
2
- import t from "./MochiTable.module.js";
3
- import { Fragment as n, TransitionGroup as r, computed as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, defineComponent as u, normalizeClass as d, normalizeStyle as f, openBlock as p, ref as m, renderList as h, renderSlot as g, toDisplayString as _, unref as v, withCtx as y } from "vue";
2
+ import t from "../../styles/virtual.module.js";
3
+ import { shouldVirtualize as n } from "../../styles/virtual.js";
4
+ import r from "./MochiTable.module.js";
5
+ import { Fragment as i, TransitionGroup as a, computed as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, nextTick as p, normalizeClass as m, normalizeStyle as h, onBeforeUnmount as g, openBlock as _, ref as v, renderList as y, renderSlot as b, toDisplayString as x, unref as S, watch as C, withCtx as w } from "vue";
4
6
  // src/components/table/MochiTable.vue?vue&type=script&setup=true&lang.ts
5
- var b = ["data-striped"], x = ["aria-sort"], S = ["onClick"], C = ["data-order"], w = { key: 0 }, T = ["colspan"], E = /*@__PURE__*/ u({
7
+ var T = ["data-striped"], E = ["aria-sort"], D = ["onClick"], O = ["data-order"], k = ["data-virtual"], A = { key: 0 }, j = ["colspan"], M = 200, N = 3200, P = 96, F = /*@__PURE__*/ f({
6
8
  name: "MochiTable",
7
9
  __name: "MochiTable",
8
10
  props: {
@@ -10,80 +12,103 @@ var b = ["data-striped"], x = ["aria-sort"], S = ["onClick"], C = ["data-order"]
10
12
  rows: {},
11
13
  rowKey: { default: "id" },
12
14
  striped: { type: Boolean },
13
- emptyText: {}
15
+ emptyText: {},
16
+ virtual: {
17
+ type: [Boolean, String],
18
+ default: "auto"
19
+ },
20
+ progressive: {
21
+ type: Boolean,
22
+ default: !0
23
+ }
14
24
  },
15
25
  emits: ["sort-change"],
16
- setup(u, { emit: E }) {
17
- let D = e(), O = u, k = E, A = m(null), j = i(() => {
18
- let e = A.value;
19
- if (!e) return O.rows;
26
+ setup(f, { emit: F }) {
27
+ let I = e(), L = f, R = F, z = v(null), B = o(() => {
28
+ let e = z.value;
29
+ if (!e) return L.rows;
20
30
  let t = e.order === "asc" ? 1 : -1;
21
- return [...O.rows].sort((n, r) => {
31
+ return [...L.rows].sort((n, r) => {
22
32
  let i = n[e.key], a = r[e.key];
23
33
  return i === a ? 0 : typeof i == "number" && typeof a == "number" ? (i - a) * t : String(i).localeCompare(String(a), "zh-CN") * t;
24
34
  });
25
35
  });
26
- function M(e) {
27
- e.sortable && (A.value?.key === e.key ? A.value.order === "asc" ? A.value = {
36
+ function V(e) {
37
+ e.sortable && (z.value?.key === e.key ? z.value.order === "asc" ? z.value = {
28
38
  key: e.key,
29
39
  order: "desc"
30
- } : A.value = null : A.value = {
40
+ } : z.value = null : z.value = {
31
41
  key: e.key,
32
42
  order: "asc"
33
- }, k("sort-change", A.value));
43
+ }, R("sort-change", z.value));
44
+ }
45
+ function H(e) {
46
+ return z.value?.key === e.key ? z.value.order === "asc" ? "ascending" : "descending" : "none";
34
47
  }
35
- function N(e) {
36
- return A.value?.key === e.key ? A.value.order === "asc" ? "ascending" : "descending" : "none";
48
+ let U = o(() => n(B.value.length, L.virtual)), W = typeof requestIdleCallback == "function" ? (e) => requestIdleCallback(e, { timeout: 200 }) : (e) => window.setTimeout(e, 16), G = typeof cancelIdleCallback == "function" ? cancelIdleCallback : window.clearTimeout, K = o(() => n(B.value.length, L.progressive !== !1)), q = v(Infinity), J = o(() => B.value.slice(0, q.value)), Y = null, X = M, Z = !1;
49
+ function Q() {
50
+ Y = null;
51
+ let e = B.value.length, t = X;
52
+ q.value = Math.min(q.value + t, e);
53
+ let n = performance.now();
54
+ p(() => {
55
+ Z || (X = performance.now() - n <= P ? Math.min(t * 2, N) : Math.max(Math.round(t / 2), M), q.value < e && (Y = W(Q)));
56
+ });
37
57
  }
38
- return (e, i) => (p(), o("div", { class: d(v(t).wrap) }, [s("table", {
39
- class: d(v(t).root),
40
- "data-striped": u.striped || void 0
58
+ return C(B, (e) => {
59
+ Y !== null && G(Y), Y = null, X = M, K.value ? (q.value = Math.min(M, e.length), q.value < e.length && (Y = W(Q))) : q.value = Infinity;
60
+ }, { immediate: !0 }), g(() => {
61
+ Z = !0, Y !== null && G(Y);
62
+ }), (e, n) => (_(), c("div", { class: m(S(r).wrap) }, [l("table", {
63
+ class: m(S(r).root),
64
+ "data-striped": f.striped || void 0
41
65
  }, [
42
- s("thead", null, [s("tr", null, [(p(!0), o(n, null, h(u.columns, (e) => (p(), o("th", {
66
+ l("thead", null, [l("tr", null, [(_(!0), c(i, null, y(f.columns, (e) => (_(), c("th", {
43
67
  key: e.key,
44
- class: d(v(t).th),
45
- style: f({
68
+ class: m(S(r).th),
69
+ style: h({
46
70
  width: e.width,
47
71
  textAlign: e.align ?? "left"
48
72
  }),
49
73
  scope: "col",
50
- "aria-sort": e.sortable ? N(e) : void 0
51
- }, [e.sortable ? (p(), o("button", {
74
+ "aria-sort": e.sortable ? H(e) : void 0
75
+ }, [e.sortable ? (_(), c("button", {
52
76
  key: 0,
53
- class: d(v(t).sorter),
77
+ class: m(S(r).sorter),
54
78
  type: "button",
55
- onClick: (t) => M(e)
56
- }, [c(_(e.title) + " ", 1), (p(), o("svg", {
57
- class: d(v(t).arrow),
58
- "data-order": A.value?.key === e.key ? A.value.order : "none",
79
+ onClick: (t) => V(e)
80
+ }, [u(x(e.title) + " ", 1), (_(), c("svg", {
81
+ class: m(S(r).arrow),
82
+ "data-order": z.value?.key === e.key ? z.value.order : "none",
59
83
  viewBox: "0 0 10 12",
60
84
  "aria-hidden": "true"
61
- }, [...i[0] ||= [s("path", { d: "M5 1 L8.5 5 L1.5 5 Z" }, null, -1), s("path", { d: "M5 11 L1.5 7 L8.5 7 Z" }, null, -1)]], 10, C))], 10, S)) : (p(), o(n, { key: 1 }, [c(_(e.title), 1)], 64))], 14, x))), 128))])]),
62
- l(r, {
85
+ }, [...n[0] ||= [l("path", { d: "M5 1 L8.5 5 L1.5 5 Z" }, null, -1), l("path", { d: "M5 11 L1.5 7 L8.5 7 Z" }, null, -1)]], 10, O))], 10, D)) : (_(), c(i, { key: 1 }, [u(x(e.title), 1)], 64))], 14, E))), 128))])]),
86
+ d(a, {
63
87
  tag: "tbody",
64
- class: d(v(t).tbody),
65
- "move-class": v(t).rowMove
88
+ class: m(S(r).tbody),
89
+ "move-class": S(r).rowMove
66
90
  }, {
67
- default: y(() => [(p(!0), o(n, null, h(j.value, (r, i) => (p(), o("tr", {
68
- key: String(r[u.rowKey] ?? i),
69
- class: d(v(t).tr),
70
- style: f({ "--_i": i })
71
- }, [(p(!0), o(n, null, h(u.columns, (n) => (p(), o("td", {
72
- key: n.key,
73
- class: d(v(t).td),
74
- style: f({ textAlign: n.align ?? "left" })
75
- }, [g(e.$slots, `cell-${n.key}`, {
76
- row: r,
77
- value: r[n.key],
78
- index: i
79
- }, () => [c(_(r[n.key]), 1)])], 6))), 128))], 6))), 128))]),
91
+ default: w(() => [(_(!0), c(i, null, y(J.value, (n, a) => (_(), c("tr", {
92
+ key: String(n[f.rowKey] ?? a),
93
+ class: m([S(r).tr, U.value && S(t).row]),
94
+ "data-virtual": U.value || void 0,
95
+ style: h({ "--_i": a })
96
+ }, [(_(!0), c(i, null, y(f.columns, (t) => (_(), c("td", {
97
+ key: t.key,
98
+ class: m(S(r).td),
99
+ style: h({ textAlign: t.align ?? "left" })
100
+ }, [b(e.$slots, `cell-${t.key}`, {
101
+ row: n,
102
+ value: n[t.key],
103
+ index: a
104
+ }, () => [u(x(n[t.key]), 1)])], 6))), 128))], 14, k))), 128))]),
80
105
  _: 3
81
106
  }, 8, ["class", "move-class"]),
82
- j.value.length ? a("", !0) : (p(), o("tbody", w, [s("tr", null, [s("td", {
83
- class: d(v(t).empty),
84
- colspan: u.columns.length
85
- }, [g(e.$slots, "empty", {}, () => [c(_(u.emptyText ?? v(D).tableEmpty), 1)])], 10, T)])]))
86
- ], 10, b)], 2));
107
+ B.value.length ? s("", !0) : (_(), c("tbody", A, [l("tr", null, [l("td", {
108
+ class: m(S(r).empty),
109
+ colspan: f.columns.length
110
+ }, [b(e.$slots, "empty", {}, () => [u(x(f.emptyText ?? S(I).tableEmpty), 1)])], 10, j)])]))
111
+ ], 10, T)], 2));
87
112
  }
88
113
  });
89
- export { E as default };
114
+ export { F as default };
@@ -1,5 +1,5 @@
1
1
  // src/components/tree/MochiTree.module.css
2
- var e = "_root_8of0m_7", t = "_item_8of0m_17", n = "_row_8of0m_21", r = "_branch_8of0m_58", i = "_label_8of0m_89", a = "_group_8of0m_96", o = "_children_8of0m_106", s = {
2
+ var e = "_root_1d8sg_7", t = "_item_1d8sg_17", n = "_row_1d8sg_21", r = "_branch_1d8sg_58", i = "_label_1d8sg_89", a = "_group_1d8sg_96", o = "_children_1d8sg_106", s = {
3
3
  root: e,
4
4
  item: t,
5
5
  row: n,
@@ -1,8 +1,14 @@
1
1
  import { MochiTreeNode } from './types';
2
+ import { MochiVirtualSetting } from '../../styles/virtual';
2
3
  type __VLS_Props = {
3
4
  data: MochiTreeNode[];
4
5
  defaultExpandAll?: boolean;
5
6
  label?: string;
7
+ /**
8
+ * CSS 虚拟化三态:true 强制开(屏外行跳过布局/绘制,DOM 保留);
9
+ * false 强制关;'auto'(默认)按硬件自适应——低端设备自动开。
10
+ */
11
+ virtual?: MochiVirtualSetting;
6
12
  };
7
13
  type __VLS_ModelProps = {
8
14
  'selected'?: string;
@@ -13,6 +19,7 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {},
13
19
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
14
20
  "onUpdate:selected"?: ((value: string) => any) | undefined;
15
21
  }>, {
22
+ virtual: MochiVirtualSetting;
16
23
  defaultExpandAll: boolean;
17
24
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
18
25
  declare const _default: typeof __VLS_export;