@dazhicheng/ui 1.6.8 → 1.6.9

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,4 +1,4 @@
1
- import { defineComponent as ze, mergeModels as K, useModel as je, computed as s, watch as S, ref as h, useTemplateRef as V, unref as r, onMounted as qe, createElementBlock as U, openBlock as w, normalizeClass as z, createVNode as j, mergeProps as He, withCtx as Je, withDirectives as Qe, normalizeStyle as Xe, createBlock as q, createCommentVNode as H, nextTick as O } from "vue";
1
+ import { defineComponent as ze, mergeModels as K, useModel as je, computed as s, watch as S, ref as h, useTemplateRef as V, unref as r, onMounted as qe, createElementBlock as U, openBlock as k, normalizeClass as z, createVNode as j, mergeProps as He, withCtx as Je, withDirectives as Qe, normalizeStyle as Xe, createBlock as q, createCommentVNode as H, nextTick as O } from "vue";
2
2
  import "../../../node_modules/.pnpm/vue-types@5.1.3_vue@3.5.21_typescript@5.9.3_/node_modules/vue-types/shim/index.modern.js";
3
3
  import { useDesign as Ye } from "../../../packages/hooks/src/useDesign.js";
4
4
  import "axios";
@@ -48,7 +48,7 @@ const p = 4, El = /* @__PURE__ */ ze({
48
48
  beforeFetch: { type: Function, default: void 0 },
49
49
  afterFetch: { type: Function, default: void 0 },
50
50
  separator: { default: "," },
51
- pasteSearch: { type: Boolean, default: !1 },
51
+ pasteSearch: { type: Boolean, default: !0 },
52
52
  alwaysLoad: { type: Boolean, default: !1 },
53
53
  showAll: { type: Boolean, default: !0 },
54
54
  showAllField: { default: al },
@@ -78,7 +78,7 @@ const p = 4, El = /* @__PURE__ */ ze({
78
78
  const e = /* @__PURE__ */ new Map();
79
79
  return f.value.forEach((l) => e.set(l.value, l.label)), e;
80
80
  });
81
- function g(e) {
81
+ function A(e) {
82
82
  return e === t.showAllField ? { label: "全部", value: t.showAllField } : { label: oe.value.get(e) ?? String(e), value: e };
83
83
  }
84
84
  function N(e) {
@@ -100,12 +100,12 @@ const p = 4, El = /* @__PURE__ */ ze({
100
100
  }
101
101
  Array.isArray(l) && (a.value = l.at(-1));
102
102
  });
103
- const k = h(), A = h(""), C = h(""), b = h(), L = V("middleRef"), v = V("selectWrapRef"), E = V("selectRef"), x = h(0);
103
+ const C = h(), v = h(""), y = h(""), b = h(), L = V("middleRef"), w = V("selectWrapRef"), E = V("selectRef"), x = h(0);
104
104
  function G() {
105
- const e = v.value;
105
+ const e = w.value;
106
106
  e && (x.value = e.offsetWidth);
107
107
  }
108
- ll(v, () => G());
108
+ ll(w, () => G());
109
109
  const ne = s(() => ({
110
110
  componentProps: {
111
111
  multiple: t.multiple,
@@ -114,10 +114,10 @@ const p = 4, El = /* @__PURE__ */ ze({
114
114
  }
115
115
  },
116
116
  component: "TtPanelSelect",
117
- selectWrapRef: v,
117
+ selectWrapRef: w,
118
118
  selectRef: E
119
119
  })), { selectComponentProps: re } = tl(ne), T = s(() => {
120
- const e = A.value.trim().toLowerCase();
120
+ const e = v.value.trim().toLowerCase();
121
121
  if (!e) return F.value;
122
122
  const l = (o) => {
123
123
  const i = [];
@@ -136,7 +136,7 @@ const p = 4, El = /* @__PURE__ */ ze({
136
136
  });
137
137
  };
138
138
  return l(T.value), e;
139
- }), y = s(() => ae(f.value, C.value)), se = s(() => {
139
+ }), g = s(() => ae(f.value, y.value)), se = s(() => {
140
140
  const e = "minmax(var(--tt-panel-select-middle-width, 450px), 1fr)";
141
141
  return t.showNav && !t.multiple ? `200px ${e}` : !t.showNav && t.multiple ? `${e} 180px` : !t.showNav && !t.multiple ? e : `200px ${e} 180px`;
142
142
  }), ue = s(() => {
@@ -144,7 +144,7 @@ const p = 4, El = /* @__PURE__ */ ze({
144
144
  return t.showNav && !t.multiple ? `max(calc(200px + ${e}), 800px)` : !t.showNav && t.multiple ? `max(calc(${e} + 180px), 800px)` : !t.showNav && !t.multiple ? `max(${e}, 800px)` : `max(calc(200px + ${e} + 180px), 800px)`;
145
145
  }), de = s(() => {
146
146
  const e = [];
147
- return y.value.forEach((l) => {
147
+ return g.value.forEach((l) => {
148
148
  !(t.showOriginMode && l.value === "__origin__") && e.push({ key: `group-${String(l.value)}`, type: "group", group: l });
149
149
  const i = Math.ceil(l.options.length / p);
150
150
  for (let n = 0; n < l.options.length; n += p) {
@@ -182,12 +182,12 @@ const p = 4, El = /* @__PURE__ */ ze({
182
182
  }), _ = s({
183
183
  get() {
184
184
  if (t.multiple)
185
- return (Array.isArray(a.value) ? a.value : a.value === void 0 ? [] : [a.value]).map((l) => g(l));
185
+ return (Array.isArray(a.value) ? a.value : a.value === void 0 ? [] : [a.value]).map((l) => A(l));
186
186
  if (Array.isArray(a.value)) {
187
187
  const e = a.value.at(-1);
188
- return e === void 0 ? void 0 : g(e);
188
+ return e === void 0 ? void 0 : A(e);
189
189
  }
190
- return a.value === void 0 ? void 0 : g(a.value);
190
+ return a.value === void 0 ? void 0 : A(a.value);
191
191
  },
192
192
  set(e) {
193
193
  const l = r(a);
@@ -198,10 +198,10 @@ const p = 4, El = /* @__PURE__ */ ze({
198
198
  }
199
199
  a.value = N(e);
200
200
  }
201
- }), Se = s(() => y.value.reduce(
201
+ }), Se = s(() => g.value.reduce(
202
202
  (e, l) => (e[String(l.value)] = he(l), e),
203
203
  {}
204
- )), Ve = s(() => y.value.reduce(
204
+ )), Ve = s(() => g.value.reduce(
205
205
  (e, l) => (e[String(l.value)] = ve(l), e),
206
206
  {}
207
207
  )), Oe = s(() => pe.value.has(t.showAllField)), W = s(() => [...t.showAll ? [{ label: "全部", value: t.showAllField }] : [], ...f.value.map((l) => ({ ...l }))]);
@@ -224,7 +224,7 @@ const p = 4, El = /* @__PURE__ */ ze({
224
224
  return (i = l == null ? void 0 : l.path.at(-2)) == null ? void 0 : i.value;
225
225
  }
226
226
  function Fe(e) {
227
- k.value = e.value;
227
+ C.value = e.value;
228
228
  const l = $e(e);
229
229
  b.value = void 0, O(() => {
230
230
  var o;
@@ -232,17 +232,17 @@ const p = 4, El = /* @__PURE__ */ ze({
232
232
  });
233
233
  }
234
234
  function Re(e) {
235
- A.value = e;
235
+ v.value = e;
236
236
  }
237
237
  function Be(e) {
238
- C.value = e;
238
+ y.value = e;
239
239
  }
240
240
  function Ne(e, l) {
241
- const o = y.value.find((i) => i.value === e);
241
+ const o = g.value.find((i) => i.value === e);
242
242
  o && ye(o, l);
243
243
  }
244
244
  async function Pe(e) {
245
- $("visible-change", e), e && (await O(), G(), t.alwaysLoad ? await m() : !t.immediate && !r(te) && await m());
245
+ $("visible-change", e), e && (y.value = "", v.value = "", await O(), G(), t.alwaysLoad ? await m() : !t.immediate && !r(te) && await m());
246
246
  }
247
247
  function Le() {
248
248
  D(R);
@@ -308,7 +308,7 @@ const p = 4, El = /* @__PURE__ */ ze({
308
308
  le,
309
309
  (e) => {
310
310
  var l;
311
- k.value !== void 0 || !e.length || (k.value = (l = e[0]) == null ? void 0 : l.value);
311
+ C.value !== void 0 || !e.length || (C.value = (l = e[0]) == null ? void 0 : l.value);
312
312
  },
313
313
  { immediate: !0 }
314
314
  ), qe(() => {
@@ -320,9 +320,9 @@ const p = 4, El = /* @__PURE__ */ ze({
320
320
  getOptions: () => r(ee),
321
321
  /** 获取当前v-model值 */
322
322
  getValue: () => r(a)
323
- }), (e, l) => (w(), U("div", {
323
+ }), (e, l) => (k(), U("div", {
324
324
  ref_key: "selectWrapRef",
325
- ref: v,
325
+ ref: w,
326
326
  class: z(r(c))
327
327
  }, [
328
328
  j(r(Y), He({
@@ -342,7 +342,7 @@ const p = 4, El = /* @__PURE__ */ ze({
342
342
  onChange: Le
343
343
  }), {
344
344
  empty: Je(() => [
345
- Qe((w(), U("div", {
345
+ Qe((k(), U("div", {
346
346
  "element-loading-text": "加载中",
347
347
  class: z(`${r(c)}__panel`),
348
348
  style: Xe({
@@ -351,10 +351,10 @@ const p = 4, El = /* @__PURE__ */ ze({
351
351
  "--panel-width": x.value ? `${x.value}px` : "100%"
352
352
  })
353
353
  }, [
354
- t.showNav ? (w(), q(ol, {
354
+ t.showNav ? (k(), q(ol, {
355
355
  key: 0,
356
356
  "prefix-cls": r(c),
357
- keyword: A.value,
357
+ keyword: v.value,
358
358
  "tree-data": T.value,
359
359
  "expanded-keys": ie.value,
360
360
  "left-placeholder": e.leftPlaceholder,
@@ -366,7 +366,7 @@ const p = 4, El = /* @__PURE__ */ ze({
366
366
  ref: L,
367
367
  "prefix-cls": r(c),
368
368
  multiple: e.multiple,
369
- keyword: C.value,
369
+ keyword: y.value,
370
370
  rows: de.value,
371
371
  disabled: B.value,
372
372
  "show-all": t.showAll,
@@ -389,7 +389,7 @@ const p = 4, El = /* @__PURE__ */ ze({
389
389
  onOptionCheck: De,
390
390
  onOptionsCheck: Ie
391
391
  }, null, 8, ["prefix-cls", "multiple", "keyword", "rows", "disabled", "show-all", "selected-values", "is-all-checked", "is-indeterminate", "all-checked", "scroll-to-group-value", "group-checked-map", "group-indeterminate-map", "paste-search", "separator", "middle-placeholder"]),
392
- t.multiple ? (w(), q(rl, {
392
+ t.multiple ? (k(), q(rl, {
393
393
  key: 1,
394
394
  "prefix-cls": r(c),
395
395
  multiple: e.multiple,
@@ -1,35 +1,4 @@
1
- import { TtVTableColumn } from '../../public/table-column';
2
- /** 封装层支持持久化的冻结列位置。 */
3
- export type VTableColumnFrozen = NonNullable<TtVTableColumn["frozen"]>;
4
- /** 一个语义列主键的持久化偏好。 */
5
- export interface VTableColumnPreference {
6
- /** 稳定语义列主键。 */
7
- key: string;
8
- /** 列是否可见。 */
9
- visible: boolean;
10
- /** 在同级列中从 0 开始的顺序。 */
11
- order: number;
12
- /** 可选数字列宽。 */
13
- width?: number;
14
- /** 可选冻结位置。 */
15
- frozen?: VTableColumnFrozen;
16
- }
17
- /** 带版本的列偏好载荷。 */
18
- export interface VTableColumnPreferenceSnapshot {
19
- /** 用于后续迁移的 schema 版本。 */
20
- schemaVersion: number;
21
- /** 按语义列主键索引的偏好。 */
22
- columns: readonly VTableColumnPreference[];
23
- }
24
- /** 本地或服务端列偏好的异步持久化边界。 */
25
- export interface VTableColumnPreferenceStorage {
26
- /** 读取已保存快照。 */
27
- read: (key: string) => Promise<VTableColumnPreferenceSnapshot | undefined>;
28
- /** 写入完整快照。 */
29
- write: (key: string, snapshot: VTableColumnPreferenceSnapshot) => Promise<void>;
30
- /** 删除已保存快照。 */
31
- remove: (key: string) => Promise<void>;
32
- }
1
+ import { VTableColumnPreferenceSnapshot, VTableColumnPreferenceStorage } from '../../public';
33
2
  /** 判断未知值是否为有效的带版本偏好快照。 */
34
3
  export declare function isColumnPreferenceSnapshot(value: unknown): value is VTableColumnPreferenceSnapshot;
35
4
  /** 创建 SSR 安全的默认 localStorage 偏好适配器。 */
@@ -1,5 +1,5 @@
1
1
  import { ComputedRef, MaybeRefOrGetter, Ref } from 'vue';
2
- import { VTableColumnFrozen, VTableColumnPreference, VTableColumnPreferenceSnapshot, VTableColumnPreferenceStorage } from './column-preference-storage';
2
+ import { VTableColumnFrozen, VTableColumnPreference, VTableColumnPreferenceSnapshot, VTableColumnPreferenceStorage } from '../../public';
3
3
  /** 列偏好 feature 所需的结构化列字段。 */
4
4
  export interface VTablePreferenceColumn<Column> {
5
5
  /** 稳定语义列主键。 */
@@ -0,0 +1,32 @@
1
+ import { TtVTableColumn } from './table-column';
2
+ /** 封装层支持持久化的冻结列位置。 */
3
+ export type VTableColumnFrozen = NonNullable<TtVTableColumn["frozen"]>;
4
+ /** 一个语义列主键的持久化偏好。 */
5
+ export interface VTableColumnPreference {
6
+ /** 稳定语义列主键。 */
7
+ key: string;
8
+ /** 列是否可见。 */
9
+ visible: boolean;
10
+ /** 在同级列中从 0 开始的顺序。 */
11
+ order: number;
12
+ /** 可选数字列宽。 */
13
+ width?: number;
14
+ /** 可选冻结位置。 */
15
+ frozen?: VTableColumnFrozen;
16
+ }
17
+ /** 带版本的列偏好载荷。 */
18
+ export interface VTableColumnPreferenceSnapshot {
19
+ /** 用于后续迁移的 schema 版本。 */
20
+ schemaVersion: number;
21
+ /** 按语义列主键索引的偏好。 */
22
+ columns: readonly VTableColumnPreference[];
23
+ }
24
+ /** 本地或服务端列偏好的异步持久化边界。 */
25
+ export interface VTableColumnPreferenceStorage {
26
+ /** 读取已保存快照。 */
27
+ read: (key: string) => Promise<VTableColumnPreferenceSnapshot | undefined>;
28
+ /** 写入完整快照。 */
29
+ write: (key: string, snapshot: VTableColumnPreferenceSnapshot) => Promise<void>;
30
+ /** 删除已保存快照。 */
31
+ remove: (key: string) => Promise<void>;
32
+ }
@@ -1,4 +1,5 @@
1
1
  /** TtVTable 公共 API、列、事件、props、slots 与错误类型。 */
2
+ export * from './column-preferences';
2
3
  export * from './table-api';
3
4
  export * from './table-column';
4
5
  export * from './table-errors';
@@ -1,7 +1,7 @@
1
1
  import { ListTableConstructorOptions, TYPES } from '@visactor/vtable';
2
2
  import { TtVTableFieldPath, TtVTableMutationMode, TtVTableRowKey, TtVTableSortDescriptor } from './table-api';
3
3
  import { TtVTableColumn } from './table-column';
4
- import { VTableColumnPreferenceStorage } from '../features/column-preferences/column-preference-storage';
4
+ import { VTableColumnPreferenceStorage } from './column-preferences';
5
5
  /** 由封装层固定控制的原生 options 字段。 */
6
6
  export type TtVTableReservedNativeOptionKey = "columns" | "pagination" | "records";
7
7
  /** 由封装层固定控制的 customConfig 字段。 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dazhicheng/ui",
3
- "version": "1.6.8",
3
+ "version": "1.6.9",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",