@dazhicheng/ui 1.6.10 → 1.6.11
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.
- package/dist/components/tt-area/TtArea.vue.js +1 -1
- package/dist/components/tt-drawer/src/components/DrawerHeader.vue.js +2 -2
- package/dist/components/tt-form/src/useFormContext.js +1 -1
- package/dist/components/tt-icon/index.vue.js +2 -2
- package/dist/components/tt-loading/src/loading.vue.js +2 -2
- package/dist/components/tt-table/index.js +4 -5
- package/dist/components/tt-table/src/TableForm.vue.js +2 -3
- package/dist/hooks/useBasicDataOptions.js +110 -91
- package/dist/index.d.ts +0 -1
- package/dist/index.js +115 -129
- package/dist/packages/utils/src/is.js +37 -46
- package/dist/style.css +1 -1
- package/package.json +1 -3
- package/dist/components/tt-vtable/index.js +0 -54
- package/dist/components/tt-vtable/src/components/TtVTable.vue.d.ts +0 -188
- package/dist/components/tt-vtable/src/components/TtVTable.vue.js +0 -227
- package/dist/components/tt-vtable/src/components/TtVTable.vue2.js +0 -4
- package/dist/components/tt-vtable/src/components/TtVTableForm.vue.d.ts +0 -32
- package/dist/components/tt-vtable/src/components/TtVTableForm.vue.js +0 -121
- package/dist/components/tt-vtable/src/components/TtVTableForm.vue2.js +0 -4
- package/dist/components/tt-vtable/src/components/VTableEmpty.vue.d.ts +0 -64
- package/dist/components/tt-vtable/src/components/VTableEmpty.vue.js +0 -97
- package/dist/components/tt-vtable/src/components/VTableEmpty.vue2.js +0 -4
- package/dist/components/tt-vtable/src/components/VTablePagination.vue.d.ts +0 -53
- package/dist/components/tt-vtable/src/components/VTablePagination.vue.js +0 -52
- package/dist/components/tt-vtable/src/components/VTablePagination.vue2.js +0 -4
- package/dist/components/tt-vtable/src/components/VTableSelectionAlert.vue.d.ts +0 -35
- package/dist/components/tt-vtable/src/components/VTableSelectionAlert.vue.js +0 -50
- package/dist/components/tt-vtable/src/components/VTableSelectionAlert.vue2.js +0 -4
- package/dist/components/tt-vtable/src/components/VTableToolbar.vue.d.ts +0 -63
- package/dist/components/tt-vtable/src/components/VTableToolbar.vue.js +0 -126
- package/dist/components/tt-vtable/src/components/VTableToolbar.vue2.js +0 -4
- package/dist/components/tt-vtable/src/components/VTableViewport.vue.js +0 -133
- package/dist/components/tt-vtable/src/components/VTableViewport.vue2.js +0 -4
- package/dist/components/tt-vtable/src/composables/useVTable.d.ts +0 -41
- package/dist/components/tt-vtable/src/composables/useVTable.js +0 -25
- package/dist/components/tt-vtable/src/composables/useVTableFormRender.d.ts +0 -13
- package/dist/components/tt-vtable/src/composables/useVTableFormRender.js +0 -92
- package/dist/components/tt-vtable/src/composables/useVTableRender.d.ts +0 -13
- package/dist/components/tt-vtable/src/composables/useVTableRender.js +0 -13
- package/dist/components/tt-vtable/src/engine/visactor/createListTable.d.ts +0 -10
- package/dist/components/tt-vtable/src/engine/visactor/createListTable.js +0 -63
- package/dist/components/tt-vtable/src/engine/visactor/createVueCellLayout.d.ts +0 -37
- package/dist/components/tt-vtable/src/engine/visactor/createVueCellLayout.js +0 -133
- package/dist/components/tt-vtable/src/engine/visactor/index.d.ts +0 -8
- package/dist/components/tt-vtable/src/engine/visactor/native-boundaries.d.ts +0 -23
- package/dist/components/tt-vtable/src/engine/visactor/native-boundaries.js +0 -70
- package/dist/components/tt-vtable/src/engine/visactor/record-adapter.d.ts +0 -38
- package/dist/components/tt-vtable/src/engine/visactor/record-adapter.js +0 -41
- package/dist/components/tt-vtable/src/engine/visactor/toColumnDefinitions.d.ts +0 -45
- package/dist/components/tt-vtable/src/engine/visactor/toColumnDefinitions.js +0 -73
- package/dist/components/tt-vtable/src/engine/visactor/toListTableOptions.d.ts +0 -25
- package/dist/components/tt-vtable/src/engine/visactor/toListTableOptions.js +0 -25
- package/dist/components/tt-vtable/src/engine/visactor/types.d.ts +0 -29
- package/dist/components/tt-vtable/src/features/column-preferences/column-preference-storage.d.ts +0 -5
- package/dist/components/tt-vtable/src/features/column-preferences/column-preference-storage.js +0 -52
- package/dist/components/tt-vtable/src/features/column-preferences/useColumnPreferences.d.ts +0 -74
- package/dist/components/tt-vtable/src/features/column-preferences/useColumnPreferences.js +0 -232
- package/dist/components/tt-vtable/src/features/editing/useCellEditing.d.ts +0 -48
- package/dist/components/tt-vtable/src/features/editing/useCellEditing.js +0 -102
- package/dist/components/tt-vtable/src/features/form-integration/useVTableForm.d.ts +0 -51
- package/dist/components/tt-vtable/src/features/pagination/useTablePagination.d.ts +0 -40
- package/dist/components/tt-vtable/src/features/pagination/useTablePagination.js +0 -51
- package/dist/components/tt-vtable/src/features/querying/useRecordQuery.d.ts +0 -38
- package/dist/components/tt-vtable/src/features/querying/useRecordQuery.js +0 -57
- package/dist/components/tt-vtable/src/features/records/index.d.ts +0 -3
- package/dist/components/tt-vtable/src/features/records/record-index.d.ts +0 -122
- package/dist/components/tt-vtable/src/features/records/record-index.js +0 -209
- package/dist/components/tt-vtable/src/features/records/useRecordSource.d.ts +0 -41
- package/dist/components/tt-vtable/src/features/records/useRecordSource.js +0 -249
- package/dist/components/tt-vtable/src/features/selection/useRowSelection.d.ts +0 -65
- package/dist/components/tt-vtable/src/features/selection/useRowSelection.js +0 -129
- package/dist/components/tt-vtable/src/features/tree/useTreeRecords.d.ts +0 -60
- package/dist/components/tt-vtable/src/features/tree/useTreeRecords.js +0 -125
- package/dist/components/tt-vtable/src/public/column-preferences.d.ts +0 -32
- package/dist/components/tt-vtable/src/public/index.d.ts +0 -8
- package/dist/components/tt-vtable/src/public/table-api.d.ts +0 -215
- package/dist/components/tt-vtable/src/public/table-column.d.ts +0 -123
- package/dist/components/tt-vtable/src/public/table-errors.d.ts +0 -26
- package/dist/components/tt-vtable/src/public/table-errors.js +0 -26
- package/dist/components/tt-vtable/src/public/table-events.d.ts +0 -69
- package/dist/components/tt-vtable/src/public/table-props.d.ts +0 -216
- package/dist/components/tt-vtable/src/public/table-slots.d.ts +0 -37
- package/dist/components/tt-vtable/src/runtime/createVTableController.d.ts +0 -12
- package/dist/components/tt-vtable/src/runtime/createVTableController.js +0 -238
- package/dist/components/tt-vtable/src/runtime/createVTableRuntime.d.ts +0 -79
- package/dist/components/tt-vtable/src/runtime/createVTableRuntime.js +0 -380
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { ColumnDefine } from '@visactor/vtable';
|
|
2
|
-
import { TtVTableApi, TtVTableColumn, TtVTableRendererSlots, TtVTableRowKey } from '../../public';
|
|
3
|
-
/** 列转换所需的稳定运行时依赖。 */
|
|
4
|
-
export interface ToColumnDefinitionsOptions<Row extends Record<string, unknown>, Key extends TtVTableRowKey = TtVTableRowKey> {
|
|
5
|
-
/** 当前稳定公共 API。 */
|
|
6
|
-
tableApi: TtVTableApi<Row, Key>;
|
|
7
|
-
/** 当前组件可用的 Vue renderer 插槽。 */
|
|
8
|
-
rendererSlots: TtVTableRendererSlots<Row, Key>;
|
|
9
|
-
/** 从记录读取业务主键。 */
|
|
10
|
-
getRowKey: (record: Row) => Key;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* 按左冻结、普通、右冻结顺序规范顶层列。
|
|
14
|
-
* @param columns 业务语义列
|
|
15
|
-
* @returns 保持各分组相对顺序的顶层列
|
|
16
|
-
*/
|
|
17
|
-
export declare function toFrozenColumnOrder<Row extends Record<string, unknown>, Key extends TtVTableRowKey>(columns: readonly TtVTableColumn<Row, Key>[]): TtVTableColumn<Row, Key>[];
|
|
18
|
-
/**
|
|
19
|
-
* 校验整棵列树的 column.key 唯一且非空。
|
|
20
|
-
* @param columns 业务语义列
|
|
21
|
-
*/
|
|
22
|
-
export declare function validateColumnKeys<Row extends Record<string, unknown>, Key extends TtVTableRowKey>(columns: readonly TtVTableColumn<Row, Key>[]): void;
|
|
23
|
-
/**
|
|
24
|
-
* 把语义列树转换为原生 VTable 列。
|
|
25
|
-
* @param columns 业务语义列
|
|
26
|
-
* @param options 稳定运行时依赖
|
|
27
|
-
* @param shouldValidate 是否校验整棵列树
|
|
28
|
-
* @returns 原生列集合
|
|
29
|
-
*/
|
|
30
|
-
export declare function toColumnDefinitions<Row extends Record<string, unknown>, Key extends TtVTableRowKey>(columns: readonly TtVTableColumn<Row, Key>[], options: ToColumnDefinitionsOptions<Row, Key>, shouldValidate?: boolean): ColumnDefine[];
|
|
31
|
-
/**
|
|
32
|
-
* 计算当前顶层左、右冻结列数量。
|
|
33
|
-
* @param columns 已按冻结位置排序的顶层列
|
|
34
|
-
* @returns 左、右冻结列数量
|
|
35
|
-
*/
|
|
36
|
-
export declare function getFrozenColumnCounts<Row extends Record<string, unknown>, Key extends TtVTableRowKey>(columns: readonly TtVTableColumn<Row, Key>[]): {
|
|
37
|
-
frozenColCount: number;
|
|
38
|
-
rightFrozenColCount: number;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* 汇总列级 Vue DOM 缓存建议值。
|
|
42
|
-
* @param columns 业务语义列
|
|
43
|
-
* @returns 所有有效列级缓存上限之和
|
|
44
|
-
*/
|
|
45
|
-
export declare function getColumnDomCacheCount<Row extends Record<string, unknown>, Key extends TtVTableRowKey>(columns: readonly TtVTableColumn<Row, Key>[]): number | undefined;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { createTtVTableError as C } from "../../public/table-errors.js";
|
|
2
|
-
import { createVueHeaderLayout as d, createVueCellLayout as h } from "./createVueCellLayout.js";
|
|
3
|
-
function y(e) {
|
|
4
|
-
const r = e.filter((o) => o.frozen === !0 || o.frozen === "left"), t = e.filter((o) => !o.frozen), n = e.filter((o) => o.frozen === "right");
|
|
5
|
-
return [...r, ...t, ...n];
|
|
6
|
-
}
|
|
7
|
-
function c(e) {
|
|
8
|
-
const r = /* @__PURE__ */ new Set();
|
|
9
|
-
function t(n) {
|
|
10
|
-
n.forEach((o) => {
|
|
11
|
-
var i;
|
|
12
|
-
if (!o.key || r.has(o.key))
|
|
13
|
-
throw C(
|
|
14
|
-
"TT_VTABLE_DUPLICATE_COLUMN_KEY",
|
|
15
|
-
`column.key ${o.key || "<empty>"} 无效或重复。`,
|
|
16
|
-
{
|
|
17
|
-
columnKey: o.key
|
|
18
|
-
}
|
|
19
|
-
);
|
|
20
|
-
r.add(o.key), (i = o.columns) != null && i.length && t(o.columns);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
t(e);
|
|
24
|
-
}
|
|
25
|
-
function m(e, r) {
|
|
26
|
-
var a;
|
|
27
|
-
const t = e.native ?? {}, n = (a = e.columns) != null && a.length ? g(y(e.columns), r, !1) : void 0, o = "customLayout" in t ? t.customLayout : void 0, i = "headerCustomLayout" in t ? t.headerCustomLayout : void 0;
|
|
28
|
-
return {
|
|
29
|
-
...t,
|
|
30
|
-
key: e.key,
|
|
31
|
-
field: e.field,
|
|
32
|
-
title: e.title,
|
|
33
|
-
width: e.width,
|
|
34
|
-
minWidth: e.minWidth,
|
|
35
|
-
maxWidth: e.maxWidth,
|
|
36
|
-
style: e.align ? { textAlign: e.align, ...t.style ?? {} } : t.style,
|
|
37
|
-
hide: e.visible === !1,
|
|
38
|
-
tree: e.tree,
|
|
39
|
-
columns: n,
|
|
40
|
-
customLayout: e.renderer ? h({
|
|
41
|
-
column: e,
|
|
42
|
-
tableApi: r.tableApi,
|
|
43
|
-
rendererSlots: r.rendererSlots,
|
|
44
|
-
getRowKey: r.getRowKey
|
|
45
|
-
}) : o,
|
|
46
|
-
headerCustomLayout: e.headerRenderer ? d({ column: e, tableApi: r.tableApi, rendererSlots: r.rendererSlots }) : i
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
function g(e, r, t = !0) {
|
|
50
|
-
return t && c(e), e.map((n) => m(n, r));
|
|
51
|
-
}
|
|
52
|
-
function z(e) {
|
|
53
|
-
const r = e.filter((n) => n.frozen === !0 || n.frozen === "left").length, t = e.filter((n) => n.frozen === "right").length;
|
|
54
|
-
return { frozenColCount: r, rightFrozenColCount: t };
|
|
55
|
-
}
|
|
56
|
-
function b(e) {
|
|
57
|
-
let r = 0, t = !1;
|
|
58
|
-
function n(o) {
|
|
59
|
-
o.forEach((i) => {
|
|
60
|
-
var u, f, l;
|
|
61
|
-
const s = (u = i.renderer) == null ? void 0 : u.maxCacheCount, a = (f = i.headerRenderer) == null ? void 0 : f.maxCacheCount;
|
|
62
|
-
Number.isFinite(s) && s > 0 && (r += Math.floor(s), t = !0), Number.isFinite(a) && a > 0 && (r += Math.floor(a), t = !0), (l = i.columns) != null && l.length && n(i.columns);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
return n(e), t ? r : void 0;
|
|
66
|
-
}
|
|
67
|
-
export {
|
|
68
|
-
b as getColumnDomCacheCount,
|
|
69
|
-
z as getFrozenColumnCounts,
|
|
70
|
-
g as toColumnDefinitions,
|
|
71
|
-
y as toFrozenColumnOrder,
|
|
72
|
-
c as validateColumnKeys
|
|
73
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ListTableConstructorOptions } from '@visactor/vtable';
|
|
2
|
-
import { TtVTableApi, TtVTableColumn, TtVTableNativeOptions, TtVTableRendererSlots, TtVTableRenderingOptions, TtVTableRowKey } from '../../public';
|
|
3
|
-
/** 创建 ListTable options 所需的受控输入。 */
|
|
4
|
-
export interface ToListTableOptionsInput<Row extends Record<string, unknown>, Key extends TtVTableRowKey = TtVTableRowKey> {
|
|
5
|
-
/** 当前语义列。 */
|
|
6
|
-
columns: readonly TtVTableColumn<Row, Key>[];
|
|
7
|
-
/** 当前稳定公共 API。 */
|
|
8
|
-
tableApi: TtVTableApi<Row, Key>;
|
|
9
|
-
/** 当前组件可用的 Vue renderer 插槽。 */
|
|
10
|
-
rendererSlots: TtVTableRendererSlots<Row, Key>;
|
|
11
|
-
/** 从记录读取业务主键。 */
|
|
12
|
-
getRowKey: (record: Row) => Key;
|
|
13
|
-
/** 安全原生 options。 */
|
|
14
|
-
nativeOptions?: TtVTableNativeOptions;
|
|
15
|
-
/** Vue DOM 渲染配置。 */
|
|
16
|
-
rendering?: TtVTableRenderingOptions;
|
|
17
|
-
/** 当前 Vue appContext 读取函数。 */
|
|
18
|
-
getVueUserAppContext?: () => unknown;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* 创建不携带业务 records 的稳定 ListTable options。
|
|
22
|
-
* @param input 语义列、API、插槽与安全原生配置
|
|
23
|
-
* @returns 可交给官方 Vue ListTable 的 options
|
|
24
|
-
*/
|
|
25
|
-
export declare function toListTableOptions<Row extends Record<string, unknown>, Key extends TtVTableRowKey>(input: ToListTableOptionsInput<Row, Key>): ListTableConstructorOptions;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { validateNativeOptions as a } from "./native-boundaries.js";
|
|
2
|
-
import { toFrozenColumnOrder as i, getFrozenColumnCounts as c, getColumnDomCacheCount as l, toColumnDefinitions as u } from "./toColumnDefinitions.js";
|
|
3
|
-
function v(o) {
|
|
4
|
-
var t, n;
|
|
5
|
-
a(o.nativeOptions);
|
|
6
|
-
const e = i(o.columns), r = c(e), s = ((t = o.rendering) == null ? void 0 : t.maxDomCacheCount) ?? l(e) ?? 100, C = {
|
|
7
|
-
...((n = o.nativeOptions) == null ? void 0 : n.customConfig) ?? {},
|
|
8
|
-
createReactContainer: !0,
|
|
9
|
-
maxDomCacheCount: s,
|
|
10
|
-
getVueUserAppContext: o.getVueUserAppContext
|
|
11
|
-
}, m = u(e, {
|
|
12
|
-
tableApi: o.tableApi,
|
|
13
|
-
rendererSlots: o.rendererSlots,
|
|
14
|
-
getRowKey: o.getRowKey
|
|
15
|
-
});
|
|
16
|
-
return {
|
|
17
|
-
...o.nativeOptions,
|
|
18
|
-
...r,
|
|
19
|
-
columns: m,
|
|
20
|
-
customConfig: C
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export {
|
|
24
|
-
v as toListTableOptions
|
|
25
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ColumnDefine, ListTable, ListTableConstructorOptions, TYPES } from '@visactor/vtable';
|
|
2
|
-
import { TtVTableFieldPath } from '../../public';
|
|
3
|
-
/** VTable 用于定位根记录或树节点的源索引。 */
|
|
4
|
-
export type VisactorRecordIndex = number | number[];
|
|
5
|
-
/** VisActor 实例与封装层之间的受控适配器。 */
|
|
6
|
-
export interface VisactorTableEngine<Row extends Record<string, unknown>> {
|
|
7
|
-
/** 返回当前原生实例。 */
|
|
8
|
-
getInstance: () => ListTable | undefined;
|
|
9
|
-
/** 使用新的运行时根列表全量替换记录。 */
|
|
10
|
-
setRecords: (records: Row[]) => void;
|
|
11
|
-
/** 在指定源索引前追加或插入记录。 */
|
|
12
|
-
addRecords: (records: Row[], recordIndex?: VisactorRecordIndex) => void;
|
|
13
|
-
/** 一次更新多条根记录或树节点。 */
|
|
14
|
-
updateRecords: (records: Row[], recordIndexes: VisactorRecordIndex[]) => void;
|
|
15
|
-
/** 按源索引删除多条根记录或树节点。 */
|
|
16
|
-
deleteRecords: (recordIndexes: VisactorRecordIndex[]) => void;
|
|
17
|
-
/** 精确刷新一个单元格,无法映射到可见坐标时返回 false。 */
|
|
18
|
-
changeCellValue: (recordIndex: VisactorRecordIndex, field: TtVTableFieldPath, value: unknown) => boolean;
|
|
19
|
-
/** 使用结构配置更新原生实例。 */
|
|
20
|
-
updateOptions: (options: ListTableConstructorOptions) => Promise<unknown>;
|
|
21
|
-
/** 使用原生增量接口替换列。 */
|
|
22
|
-
updateColumns: (columns: ColumnDefine[]) => void;
|
|
23
|
-
/** 使用原生分页接口更新本地分页。 */
|
|
24
|
-
updatePagination: (pagination: TYPES.IPagination) => void;
|
|
25
|
-
/** 重新计算当前布局。 */
|
|
26
|
-
recalculate: () => void;
|
|
27
|
-
/** 幂等释放适配器持有的引用。 */
|
|
28
|
-
release: () => void;
|
|
29
|
-
}
|
package/dist/components/tt-vtable/src/features/column-preferences/column-preference-storage.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { VTableColumnPreferenceSnapshot, VTableColumnPreferenceStorage } from '../../public';
|
|
2
|
-
/** 判断未知值是否为有效的带版本偏好快照。 */
|
|
3
|
-
export declare function isColumnPreferenceSnapshot(value: unknown): value is VTableColumnPreferenceSnapshot;
|
|
4
|
-
/** 创建 SSR 安全的默认 localStorage 偏好适配器。 */
|
|
5
|
-
export declare function createLocalColumnPreferenceStorage(): VTableColumnPreferenceStorage;
|
package/dist/components/tt-vtable/src/features/column-preferences/column-preference-storage.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import "axios";
|
|
2
|
-
import "element-plus";
|
|
3
|
-
import { isClient as n, isObject as m, isNumber as i, isArray as a, isString as p, isBoolean as c, isDef as l } from "../../../../../packages/utils/src/is.js";
|
|
4
|
-
import "vue";
|
|
5
|
-
import "dayjs";
|
|
6
|
-
import "numeral";
|
|
7
|
-
import "xe-utils";
|
|
8
|
-
import "dayjs/plugin/utc";
|
|
9
|
-
import "dayjs/plugin/timezone";
|
|
10
|
-
import "../../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
11
|
-
import "../../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
|
|
12
|
-
import "../../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
13
|
-
import "../../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
14
|
-
import "../../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
15
|
-
import "lodash-es";
|
|
16
|
-
const d = "tt-vtable:columns:";
|
|
17
|
-
function S(e) {
|
|
18
|
-
return c(e) || e === "left" || e === "right";
|
|
19
|
-
}
|
|
20
|
-
function g(e) {
|
|
21
|
-
if (!m(e)) return !1;
|
|
22
|
-
const r = e;
|
|
23
|
-
return p(r.key) && !!r.key && c(r.visible) && i(r.order) && Number.isInteger(r.order) && r.order >= 0 && (!l(r.width) || i(r.width) && r.width > 0) && (!r.frozen || S(r.frozen));
|
|
24
|
-
}
|
|
25
|
-
function h(e) {
|
|
26
|
-
if (!m(e)) return !1;
|
|
27
|
-
const r = e;
|
|
28
|
-
return i(r.schemaVersion) && Number.isInteger(r.schemaVersion) && r.schemaVersion > 0 && a(r.columns) && r.columns.every(g);
|
|
29
|
-
}
|
|
30
|
-
function A() {
|
|
31
|
-
function e(t) {
|
|
32
|
-
return `${d}${t}`;
|
|
33
|
-
}
|
|
34
|
-
async function r(t) {
|
|
35
|
-
if (!n || !t) return;
|
|
36
|
-
const o = window.localStorage.getItem(e(t));
|
|
37
|
-
if (!o) return;
|
|
38
|
-
const s = JSON.parse(o);
|
|
39
|
-
return h(s) ? s : void 0;
|
|
40
|
-
}
|
|
41
|
-
async function f(t, o) {
|
|
42
|
-
!n || !t || window.localStorage.setItem(e(t), JSON.stringify(o));
|
|
43
|
-
}
|
|
44
|
-
async function u(t) {
|
|
45
|
-
!n || !t || window.localStorage.removeItem(e(t));
|
|
46
|
-
}
|
|
47
|
-
return { read: r, write: f, remove: u };
|
|
48
|
-
}
|
|
49
|
-
export {
|
|
50
|
-
A as createLocalColumnPreferenceStorage,
|
|
51
|
-
h as isColumnPreferenceSnapshot
|
|
52
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { ComputedRef, MaybeRefOrGetter, Ref } from 'vue';
|
|
2
|
-
import { VTableColumnFrozen, VTableColumnPreference, VTableColumnPreferenceSnapshot, VTableColumnPreferenceStorage } from '../../public';
|
|
3
|
-
/** 列偏好 feature 所需的结构化列字段。 */
|
|
4
|
-
export interface VTablePreferenceColumn<Column> {
|
|
5
|
-
/** 稳定语义列主键。 */
|
|
6
|
-
key: string;
|
|
7
|
-
/** 可选嵌套分组列。 */
|
|
8
|
-
columns?: readonly Column[];
|
|
9
|
-
/** 初始可见性。 */
|
|
10
|
-
visible?: boolean;
|
|
11
|
-
/** 初始宽度。 */
|
|
12
|
-
width?: number | string;
|
|
13
|
-
/** 初始冻结位置。 */
|
|
14
|
-
frozen?: VTableColumnFrozen;
|
|
15
|
-
}
|
|
16
|
-
/** 面向工具栏的列偏好视图。 */
|
|
17
|
-
export interface VTableColumnPreferenceEntry<Column> extends VTableColumnPreference {
|
|
18
|
-
/** 当前源列。 */
|
|
19
|
-
column: Column;
|
|
20
|
-
/** 在语义列树中的嵌套深度。 */
|
|
21
|
-
depth: number;
|
|
22
|
-
}
|
|
23
|
-
/** 暴露给 runtime 的列偏好状态与动作。 */
|
|
24
|
-
export interface VTableColumnPreferences<Column> {
|
|
25
|
-
/** 应用偏好前的源列。 */
|
|
26
|
-
sourceColumns: Readonly<Ref<readonly Column[]>>;
|
|
27
|
-
/** 应用偏好后的可见有序列。 */
|
|
28
|
-
columns: ComputedRef<readonly Column[]>;
|
|
29
|
-
/** 面向工具栏的全部源列扁平设置。 */
|
|
30
|
-
entries: ComputedRef<readonly VTableColumnPreferenceEntry<Column>[]>;
|
|
31
|
-
/** 异步偏好读取是否进行中。 */
|
|
32
|
-
isLoading: Readonly<Ref<boolean>>;
|
|
33
|
-
/** 最近一次持久化错误。 */
|
|
34
|
-
error: Readonly<Ref<Error | undefined>>;
|
|
35
|
-
/** 替换源列根引用并校正已保存主键。 */
|
|
36
|
-
replaceAll: (columns: readonly Column[]) => void;
|
|
37
|
-
/** 显示一个语义列。 */
|
|
38
|
-
show: (key: string) => void;
|
|
39
|
-
/** 隐藏一个语义列。 */
|
|
40
|
-
hide: (key: string) => void;
|
|
41
|
-
/** 在同级列集合中移动一列。 */
|
|
42
|
-
move: (key: string, targetIndex: number) => void;
|
|
43
|
-
/** 保存一个数字列宽。 */
|
|
44
|
-
setWidth: (key: string, width: number) => void;
|
|
45
|
-
/** 保存一个冻结位置。 */
|
|
46
|
-
setFrozen: (key: string, frozen: VTableColumnFrozen | undefined) => void;
|
|
47
|
-
/** 从配置的 storage 加载偏好。 */
|
|
48
|
-
load: () => Promise<void>;
|
|
49
|
-
/** 恢复源列默认值并删除持久化内容。 */
|
|
50
|
-
resetPreferences: () => Promise<void>;
|
|
51
|
-
}
|
|
52
|
-
/** 列偏好 feature 所需依赖。 */
|
|
53
|
-
export interface UseColumnPreferencesOptions<Column extends VTablePreferenceColumn<Column>> {
|
|
54
|
-
/** 仅按引用监听的 maybe-reactive 源列根。 */
|
|
55
|
-
columns: MaybeRefOrGetter<readonly Column[]>;
|
|
56
|
-
/** 开启持久化时必需的命名空间。 */
|
|
57
|
-
columnsKey?: MaybeRefOrGetter<string | undefined>;
|
|
58
|
-
/** 是否开启偏好持久化。 */
|
|
59
|
-
persistent?: MaybeRefOrGetter<boolean>;
|
|
60
|
-
/** 随每份偏好快照写入的版本。 */
|
|
61
|
-
schemaVersion?: number;
|
|
62
|
-
/** 可选的本地或服务端 storage 实现。 */
|
|
63
|
-
storage?: VTableColumnPreferenceStorage;
|
|
64
|
-
/** 列宽和拖拽持久化的防抖时长。 */
|
|
65
|
-
writeDelay?: number;
|
|
66
|
-
/** 有效列变化时调用。 */
|
|
67
|
-
onColumnsChange?: (columns: readonly Column[]) => void;
|
|
68
|
-
/** 一次本地偏好操作完成后调用。 */
|
|
69
|
-
onPreferencesChange?: (snapshot: VTableColumnPreferenceSnapshot) => void;
|
|
70
|
-
/** 读取、写入或删除偏好失败时调用。 */
|
|
71
|
-
onError?: (error: Error) => void;
|
|
72
|
-
}
|
|
73
|
-
/** 创建可扩展且可防持久化竞态的列偏好 feature。 */
|
|
74
|
-
export declare function useColumnPreferences<Column extends VTablePreferenceColumn<Column>>(options: UseColumnPreferencesOptions<Column>): VTableColumnPreferences<Column>;
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import "axios";
|
|
2
|
-
import "element-plus";
|
|
3
|
-
import { isDef as X, isError as Y, isNumber as Z, isClient as S } from "../../../../../packages/utils/src/is.js";
|
|
4
|
-
import { shallowRef as p, computed as O, watch as V, toValue as h, onScopeDispose as _ } from "vue";
|
|
5
|
-
import "dayjs";
|
|
6
|
-
import "numeral";
|
|
7
|
-
import "xe-utils";
|
|
8
|
-
import "dayjs/plugin/utc";
|
|
9
|
-
import "dayjs/plugin/timezone";
|
|
10
|
-
import "../../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
11
|
-
import "../../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
|
|
12
|
-
import "../../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
13
|
-
import "../../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
14
|
-
import "../../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
15
|
-
import "lodash-es";
|
|
16
|
-
import { createLocalColumnPreferenceStorage as $ } from "./column-preference-storage.js";
|
|
17
|
-
function ee(r) {
|
|
18
|
-
return new Error(Y(r) ? String(r).replace(/^Error:\s*/, "") : String(r));
|
|
19
|
-
}
|
|
20
|
-
function N(r) {
|
|
21
|
-
const o = /* @__PURE__ */ new Map();
|
|
22
|
-
function n(i) {
|
|
23
|
-
i.forEach((s, a) => {
|
|
24
|
-
var v;
|
|
25
|
-
const f = {
|
|
26
|
-
key: s.key,
|
|
27
|
-
visible: s.visible !== !1,
|
|
28
|
-
order: a
|
|
29
|
-
};
|
|
30
|
-
Z(s.width) && s.width > 0 && (f.width = s.width), s.frozen && (f.frozen = s.frozen), o.set(s.key, f), (v = s.columns) != null && v.length && n(s.columns);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
return n(r), o;
|
|
34
|
-
}
|
|
35
|
-
function F(r, o) {
|
|
36
|
-
const n = N(r);
|
|
37
|
-
return n.forEach((i, s) => {
|
|
38
|
-
const a = o.get(s);
|
|
39
|
-
a && n.set(s, { ...i, ...a, key: s });
|
|
40
|
-
}), n;
|
|
41
|
-
}
|
|
42
|
-
function re(r, o) {
|
|
43
|
-
return { schemaVersion: o, columns: [...r.values()].map((n) => ({ ...n })) };
|
|
44
|
-
}
|
|
45
|
-
function ne(r) {
|
|
46
|
-
return new Map(r.columns.map((o) => [o.key, { ...o }]));
|
|
47
|
-
}
|
|
48
|
-
function q(r, o) {
|
|
49
|
-
var n;
|
|
50
|
-
if (r.some((i) => i.key === o)) return r.map((i) => i.key);
|
|
51
|
-
for (const i of r) {
|
|
52
|
-
if (!((n = i.columns) != null && n.length)) continue;
|
|
53
|
-
const s = q(i.columns, o);
|
|
54
|
-
if (s) return s;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function L(r, o) {
|
|
58
|
-
return [...r].sort((n, i) => {
|
|
59
|
-
var f, v;
|
|
60
|
-
const s = ((f = o.get(n.key)) == null ? void 0 : f.order) ?? 0, a = ((v = o.get(i.key)) == null ? void 0 : v.order) ?? 0;
|
|
61
|
-
return s - a;
|
|
62
|
-
}).filter((n) => {
|
|
63
|
-
var i;
|
|
64
|
-
return ((i = o.get(n.key)) == null ? void 0 : i.visible) !== !1;
|
|
65
|
-
}).map((n) => {
|
|
66
|
-
var f;
|
|
67
|
-
const i = o.get(n.key), s = (f = n.columns) != null && f.length ? L(n.columns, o) : void 0;
|
|
68
|
-
return {
|
|
69
|
-
...n,
|
|
70
|
-
visible: !0,
|
|
71
|
-
...i != null && i.width ? { width: i.width } : {},
|
|
72
|
-
...X(i == null ? void 0 : i.frozen) ? { frozen: i.frozen } : {},
|
|
73
|
-
...s ? { columns: s } : {}
|
|
74
|
-
};
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
function Pe(r) {
|
|
78
|
-
const o = p([]), n = p(/* @__PURE__ */ new Map()), i = p(!1), s = p(), a = r.storage ?? $(), f = r.schemaVersion ?? 1, v = Math.max(0, r.writeDelay ?? 180);
|
|
79
|
-
let d = 0, w = 0, l;
|
|
80
|
-
const M = O(() => L(o.value, n.value)), W = O(() => {
|
|
81
|
-
const e = [];
|
|
82
|
-
function t(c, u) {
|
|
83
|
-
c.forEach((m) => {
|
|
84
|
-
var g;
|
|
85
|
-
const y = n.value.get(m.key) ?? {
|
|
86
|
-
key: m.key,
|
|
87
|
-
visible: m.visible !== !1,
|
|
88
|
-
order: 0
|
|
89
|
-
};
|
|
90
|
-
e.push({ ...y, column: m, depth: u }), (g = m.columns) != null && g.length && t(m.columns, u + 1);
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
return t(o.value, 0), e;
|
|
94
|
-
});
|
|
95
|
-
function b() {
|
|
96
|
-
return h(r.columnsKey) || void 0;
|
|
97
|
-
}
|
|
98
|
-
function E(e) {
|
|
99
|
-
var c;
|
|
100
|
-
const t = ee(e);
|
|
101
|
-
s.value = t, (c = r.onError) == null || c.call(r, t);
|
|
102
|
-
}
|
|
103
|
-
function P() {
|
|
104
|
-
var e;
|
|
105
|
-
(e = r.onColumnsChange) == null || e.call(r, M.value);
|
|
106
|
-
}
|
|
107
|
-
function K() {
|
|
108
|
-
return re(n.value, f);
|
|
109
|
-
}
|
|
110
|
-
async function z() {
|
|
111
|
-
if (!h(r.persistent ?? !1)) return;
|
|
112
|
-
const e = b();
|
|
113
|
-
if (e)
|
|
114
|
-
try {
|
|
115
|
-
await a.write(e, K());
|
|
116
|
-
} catch (t) {
|
|
117
|
-
E(t);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
function A() {
|
|
121
|
-
if (!S) {
|
|
122
|
-
z();
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
l && window.clearTimeout(l), l = window.setTimeout(() => {
|
|
126
|
-
l = void 0, z();
|
|
127
|
-
}, v);
|
|
128
|
-
}
|
|
129
|
-
function x(e) {
|
|
130
|
-
var c;
|
|
131
|
-
w += 1, n.value = e;
|
|
132
|
-
const t = K();
|
|
133
|
-
P(), (c = r.onPreferencesChange) == null || c.call(r, t), A();
|
|
134
|
-
}
|
|
135
|
-
function k(e, t) {
|
|
136
|
-
o.value = [...e], n.value = F(o.value, n.value), t && (w += 1), P();
|
|
137
|
-
}
|
|
138
|
-
function I(e) {
|
|
139
|
-
k(e, !0);
|
|
140
|
-
}
|
|
141
|
-
function C(e, t) {
|
|
142
|
-
const c = n.value.get(e);
|
|
143
|
-
if (!c) return;
|
|
144
|
-
const u = new Map(n.value);
|
|
145
|
-
u.set(e, { ...c, ...t, key: e }), x(u);
|
|
146
|
-
}
|
|
147
|
-
function j(e) {
|
|
148
|
-
C(e, { visible: !0 });
|
|
149
|
-
}
|
|
150
|
-
function B(e) {
|
|
151
|
-
C(e, { visible: !1 });
|
|
152
|
-
}
|
|
153
|
-
function G(e, t) {
|
|
154
|
-
const c = q(o.value, e);
|
|
155
|
-
if (!c) return;
|
|
156
|
-
const u = c.indexOf(e);
|
|
157
|
-
if (u < 0) return;
|
|
158
|
-
const m = Number.isFinite(t) ? Math.max(0, Math.min(Math.floor(t), c.length - 1)) : u;
|
|
159
|
-
if (u === m) return;
|
|
160
|
-
const y = [...c];
|
|
161
|
-
y.splice(u, 1), y.splice(m, 0, e);
|
|
162
|
-
const g = new Map(n.value);
|
|
163
|
-
y.forEach((D, U) => {
|
|
164
|
-
const R = g.get(D);
|
|
165
|
-
R && g.set(D, { ...R, order: U });
|
|
166
|
-
}), x(g);
|
|
167
|
-
}
|
|
168
|
-
function H(e, t) {
|
|
169
|
-
!Number.isFinite(t) || t <= 0 || C(e, { width: t });
|
|
170
|
-
}
|
|
171
|
-
function J(e, t) {
|
|
172
|
-
C(e, { frozen: t ?? !1 });
|
|
173
|
-
}
|
|
174
|
-
async function T() {
|
|
175
|
-
if (!h(r.persistent ?? !1)) return;
|
|
176
|
-
const e = b();
|
|
177
|
-
if (!e) return;
|
|
178
|
-
d += 1;
|
|
179
|
-
const t = d, c = w;
|
|
180
|
-
i.value = !0, s.value = void 0;
|
|
181
|
-
try {
|
|
182
|
-
const u = await a.read(e);
|
|
183
|
-
if (t !== d || c !== w || !u || u.schemaVersion !== f) return;
|
|
184
|
-
n.value = F(o.value, ne(u)), P();
|
|
185
|
-
} catch (u) {
|
|
186
|
-
t === d && E(u);
|
|
187
|
-
} finally {
|
|
188
|
-
t === d && (i.value = !1);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
async function Q() {
|
|
192
|
-
var t;
|
|
193
|
-
w += 1, d += 1, l && S && window.clearTimeout(l), l = void 0, n.value = N(o.value), s.value = void 0, P(), (t = r.onPreferencesChange) == null || t.call(r, K());
|
|
194
|
-
const e = b();
|
|
195
|
-
if (!(!e || !h(r.persistent ?? !1)))
|
|
196
|
-
try {
|
|
197
|
-
await a.remove(e);
|
|
198
|
-
} catch (c) {
|
|
199
|
-
E(c);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
return V(
|
|
203
|
-
() => h(r.columns),
|
|
204
|
-
(e) => k(e, !1),
|
|
205
|
-
{ immediate: !0 }
|
|
206
|
-
), V(
|
|
207
|
-
[() => h(r.persistent ?? !1), () => h(r.columnsKey)],
|
|
208
|
-
([e]) => {
|
|
209
|
-
e && T();
|
|
210
|
-
},
|
|
211
|
-
{ immediate: !0 }
|
|
212
|
-
), _(() => {
|
|
213
|
-
d += 1, l && S && window.clearTimeout(l);
|
|
214
|
-
}), {
|
|
215
|
-
sourceColumns: o,
|
|
216
|
-
columns: M,
|
|
217
|
-
entries: W,
|
|
218
|
-
isLoading: i,
|
|
219
|
-
error: s,
|
|
220
|
-
replaceAll: I,
|
|
221
|
-
show: j,
|
|
222
|
-
hide: B,
|
|
223
|
-
move: G,
|
|
224
|
-
setWidth: H,
|
|
225
|
-
setFrozen: J,
|
|
226
|
-
load: T,
|
|
227
|
-
resetPreferences: Q
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
export {
|
|
231
|
-
Pe as useColumnPreferences
|
|
232
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { ComputedRef, Ref } from 'vue';
|
|
2
|
-
import { TtVTableEditingCell, TtVTableFieldPath, TtVTableRowKey } from '../../public/table-api';
|
|
3
|
-
import { TtVTableEditCommit } from '../../public/table-events';
|
|
4
|
-
import { TtVTableEditValidator } from '../../public/table-props';
|
|
5
|
-
/** 暴露给 runtime 的编辑状态与动作。 */
|
|
6
|
-
export interface VTableCellEditing<Key extends TtVTableRowKey> {
|
|
7
|
-
/** 当前单元格;未编辑时为 undefined。 */
|
|
8
|
-
activeCell: Readonly<Ref<Readonly<TtVTableEditingCell<Key>> | undefined>>;
|
|
9
|
-
/** 当前单元格是否正在校验。 */
|
|
10
|
-
isValidating: Readonly<Ref<boolean>>;
|
|
11
|
-
/** 当前校验错误。 */
|
|
12
|
-
validationError: Readonly<Ref<Error | undefined>>;
|
|
13
|
-
/** 是否存在活动编辑器。 */
|
|
14
|
-
isEditing: ComputedRef<boolean>;
|
|
15
|
-
/** 开始编辑单元格。 */
|
|
16
|
-
start: (rowKey: Key, field: TtVTableFieldPath) => Promise<void>;
|
|
17
|
-
/** 更新草稿且不修改 runtime 记录。 */
|
|
18
|
-
setValue: (value: unknown) => void;
|
|
19
|
-
/** 校验并提交当前草稿。 */
|
|
20
|
-
commit: (value?: unknown) => Promise<boolean>;
|
|
21
|
-
/** 取消当前编辑。 */
|
|
22
|
-
cancel: () => void;
|
|
23
|
-
/** 仅校验当前草稿且不提交。 */
|
|
24
|
-
validate: (value?: unknown) => Promise<boolean>;
|
|
25
|
-
/** 组件销毁时释放编辑器状态。 */
|
|
26
|
-
release: () => void;
|
|
27
|
-
}
|
|
28
|
-
/** 单元格编辑 feature 所需依赖。 */
|
|
29
|
-
export interface UseCellEditingOptions<Row extends Record<string, unknown>, Key extends TtVTableRowKey> {
|
|
30
|
-
/** 按主键读取一条 runtime 记录。 */
|
|
31
|
-
getRecordByKey: (key: Key) => Row | undefined;
|
|
32
|
-
/** 从 runtime 记录读取字段值。 */
|
|
33
|
-
getFieldValue: (record: Row, field: TtVTableFieldPath) => unknown;
|
|
34
|
-
/** 通过 records feature 提交一个单元格。 */
|
|
35
|
-
setCellValue: (key: Key, field: TtVTableFieldPath, value: unknown, source: "editing") => Promise<void> | void;
|
|
36
|
-
/** 读取字段配置的校验函数。 */
|
|
37
|
-
getValidator?: (field: TtVTableFieldPath) => TtVTableEditValidator<Row, Key> | undefined;
|
|
38
|
-
/** 捕获状态后打开原生或 Vue 编辑器。 */
|
|
39
|
-
startNativeEditing?: (key: Key, field: TtVTableFieldPath) => Promise<void> | void;
|
|
40
|
-
/** 关闭原生或 Vue 编辑器。 */
|
|
41
|
-
cancelNativeEditing?: () => void;
|
|
42
|
-
/** 编辑提交成功后调用一次。 */
|
|
43
|
-
onCommit?: (change: TtVTableEditCommit<Key>) => void;
|
|
44
|
-
/** 校验或提交失败时调用。 */
|
|
45
|
-
onError?: (error: Error) => void;
|
|
46
|
-
}
|
|
47
|
-
/** 创建草稿隔离且可防异步校验竞态的编辑 feature。 */
|
|
48
|
-
export declare function useCellEditing<Row extends Record<string, unknown>, Key extends TtVTableRowKey = TtVTableRowKey>(options: UseCellEditingOptions<Row, Key>): VTableCellEditing<Key>;
|