@veltra/desktop 1.1.30 → 1.1.32
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/action/action-group.vue.d.ts +2 -2
- package/dist/components/action/action.vue.d.ts +1 -1
- package/dist/components/auto-complete/auto-complete.vue.d.ts +1 -1
- package/dist/components/batch-edit/batch-edit.vue.d.ts +1 -1
- package/dist/components/cascade/cascade.vue.d.ts +1 -1
- package/dist/components/checkbox/checkbox-button.vue.d.ts +1 -1
- package/dist/components/checkbox-group/checkbox-group.vue.d.ts +1 -1
- package/dist/components/contextmenu/api.d.ts +8 -0
- package/dist/components/{context-menu → contextmenu}/api.js +2 -2
- package/dist/components/contextmenu/api.js.map +1 -0
- package/dist/components/contextmenu/contextmenu-item.js +64 -0
- package/dist/components/contextmenu/contextmenu-item.js.map +1 -0
- package/dist/components/contextmenu/contextmenu-panel.js +33 -0
- package/dist/components/contextmenu/contextmenu-panel.js.map +1 -0
- package/dist/components/contextmenu/contextmenu-sub.js +83 -0
- package/dist/components/contextmenu/contextmenu-sub.js.map +1 -0
- package/dist/components/contextmenu/contextmenu.js +79 -0
- package/dist/components/contextmenu/contextmenu.js.map +1 -0
- package/dist/components/{context-menu/context-menu.vue.d.ts → contextmenu/contextmenu.vue.d.ts} +5 -5
- package/dist/components/contextmenu/di.js +7 -0
- package/dist/components/contextmenu/di.js.map +1 -0
- package/dist/components/contextmenu/helper.js +8 -0
- package/dist/components/contextmenu/helper.js.map +1 -0
- package/dist/components/contextmenu/index.d.ts +2 -0
- package/dist/components/contextmenu/style2.css +154 -0
- package/dist/components/date-picker/date-picker.vue.d.ts +2 -2
- package/dist/components/date-range-picker/date-range-picker.vue.d.ts +2 -2
- package/dist/components/drawer/drawer.vue.d.ts +2 -2
- package/dist/components/empty/empty.vue.d.ts +1 -1
- package/dist/components/file-viewer/file-viewer.vue.d.ts +1 -1
- package/dist/components/file-viewer/previewers/sheet-previewer.js +33 -93
- package/dist/components/file-viewer/previewers/sheet-previewer.js.map +1 -1
- package/dist/components/file-viewer/sheet-parser.js +46 -0
- package/dist/components/file-viewer/sheet-parser.js.map +1 -0
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +3 -3
- package/dist/components/index.js.map +1 -1
- package/dist/components/input/input.vue.d.ts +1 -1
- package/dist/components/multi-select/multi-select.vue.d.ts +2 -2
- package/dist/components/multi-tree-select/multi-tree-select.vue.d.ts +2 -2
- package/dist/components/number-input/number-input.vue.d.ts +1 -1
- package/dist/components/number-range-input/number-range-input.vue.d.ts +2 -2
- package/dist/components/password-input/password-input.vue.d.ts +1 -1
- package/dist/components/progress-nodes/progress-nodes.vue.d.ts +2 -2
- package/dist/components/radio-group/radio-group.vue.d.ts +1 -1
- package/dist/components/rich-text-editor/rich-text-editor.vue.d.ts +1 -1
- package/dist/components/select/select.vue.d.ts +1 -1
- package/dist/components/steps/steps.vue.d.ts +1 -1
- package/dist/components/tabs/tabs-horizontal.vue.d.ts +2 -2
- package/dist/components/tabs/tabs-vertical.vue.d.ts +2 -2
- package/dist/components/tabs/tabs.vue.d.ts +2 -2
- package/dist/components/textarea/textarea.vue.d.ts +2 -2
- package/dist/components/tree-select/tree-select.vue.d.ts +2 -2
- package/dist/index.d.ts +5 -5
- package/dist/index.js +3 -3
- package/dist/style.js +1 -1
- package/dist/types/{context-menu.d.ts → contextmenu.d.ts} +12 -10
- package/dist/types/index.d.ts +2 -2
- package/package.json +6 -6
- package/src/components/{context-menu → contextmenu}/api.ts +4 -4
- package/src/components/contextmenu/contextmenu-item.vue +63 -0
- package/src/components/contextmenu/contextmenu-panel.vue +28 -0
- package/src/components/contextmenu/contextmenu-sub.vue +88 -0
- package/src/components/contextmenu/contextmenu.vue +77 -0
- package/src/components/contextmenu/di.ts +13 -0
- package/src/components/contextmenu/helper.ts +5 -0
- package/src/components/contextmenu/index.ts +3 -0
- package/src/components/contextmenu/style.scss +135 -0
- package/src/components/file-viewer/previewers/sheet-previewer.vue +35 -131
- package/src/components/file-viewer/sheet-parser.ts +52 -0
- package/src/components/index.ts +1 -1
- package/src/style.ts +1 -1
- package/src/types/{context-menu.ts → contextmenu.ts} +9 -7
- package/src/types/index.ts +1 -1
- package/dist/components/context-menu/api.d.ts +0 -8
- package/dist/components/context-menu/api.js.map +0 -1
- package/dist/components/context-menu/context-menu-item.js +0 -60
- package/dist/components/context-menu/context-menu-item.js.map +0 -1
- package/dist/components/context-menu/context-menu.js +0 -95
- package/dist/components/context-menu/context-menu.js.map +0 -1
- package/dist/components/context-menu/di.js +0 -6
- package/dist/components/context-menu/di.js.map +0 -1
- package/dist/components/context-menu/index.d.ts +0 -2
- package/dist/components/context-menu/style2.css +0 -52
- package/src/components/context-menu/context-menu-item.vue +0 -67
- package/src/components/context-menu/context-menu.vue +0 -117
- package/src/components/context-menu/di.ts +0 -5
- package/src/components/context-menu/index.ts +0 -3
- package/src/components/context-menu/style.scss +0 -51
- /package/dist/components/{context-menu → contextmenu}/style.d.ts +0 -0
- /package/dist/components/{context-menu → contextmenu}/style.js +0 -0
- /package/src/components/{context-menu → contextmenu}/style.ts +0 -0
|
@@ -5,11 +5,11 @@ declare const __VLS_export: import("vue").DefineComponent<DateRangePickerProps,
|
|
|
5
5
|
}, string, import("vue").PublicProps, Readonly<DateRangePickerProps> & Readonly<{
|
|
6
6
|
"onUpdate:modelValue"?: ((value?: [string, string] | undefined) => any) | undefined;
|
|
7
7
|
}>, {
|
|
8
|
-
type: "date" | "month" | "year";
|
|
9
8
|
disabled: boolean;
|
|
10
|
-
|
|
9
|
+
type: "date" | "month" | "year";
|
|
11
10
|
placeholder: [string, string];
|
|
12
11
|
clearable: boolean;
|
|
12
|
+
readonly: boolean;
|
|
13
13
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
14
|
declare const _default: typeof __VLS_export;
|
|
15
15
|
//#endregion
|
|
@@ -12,12 +12,12 @@ type __VLS_Slots = {} & {
|
|
|
12
12
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
13
|
"update:modelValue": (value: boolean) => any;
|
|
14
14
|
} & {
|
|
15
|
-
"update:modelValue": (value: boolean) => any;
|
|
16
15
|
close: () => any;
|
|
16
|
+
"update:modelValue": (value: boolean) => any;
|
|
17
17
|
closed: () => any;
|
|
18
18
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
19
|
-
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
20
19
|
onClose?: (() => any) | undefined;
|
|
20
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
21
21
|
onClosed?: (() => any) | undefined;
|
|
22
22
|
}>, {
|
|
23
23
|
direction: DrawerDirection;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EmptyProps } from "../../types/empty.js";
|
|
2
2
|
//#region src/components/empty/empty.vue.d.ts
|
|
3
3
|
declare const __VLS_export: import("vue").DefineComponent<EmptyProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<EmptyProps> & Readonly<{}>, {
|
|
4
|
-
size: number;
|
|
5
4
|
text: string;
|
|
5
|
+
size: number;
|
|
6
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
//#endregion
|
|
@@ -27,8 +27,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, _Fi
|
|
|
27
27
|
error: unknown;
|
|
28
28
|
}) => any) | undefined;
|
|
29
29
|
}>, {
|
|
30
|
-
modelValue: string;
|
|
31
30
|
open: boolean;
|
|
31
|
+
modelValue: string;
|
|
32
32
|
sidebarWidth: string | number | false;
|
|
33
33
|
sheetMaxRows: number;
|
|
34
34
|
downloadable: boolean;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { parseSheetFile } from "../sheet-parser.js";
|
|
1
2
|
import { Fragment, createCommentVNode, createElementBlock, createElementVNode, defineComponent, normalizeClass, onBeforeUnmount, openBlock, ref, renderList, shallowRef, toDisplayString, unref, useTemplateRef, watch } from "vue";
|
|
2
3
|
import { bem } from "@veltra/utils";
|
|
4
|
+
import { ListTable } from "@visactor/vtable";
|
|
3
5
|
//#region src/components/file-viewer/previewers/sheet-previewer.vue
|
|
4
6
|
const _hoisted_1 = ["onClick"];
|
|
5
7
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
@@ -22,48 +24,41 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
22
24
|
const sheets = shallowRef([]);
|
|
23
25
|
const activeSheetIndex = ref(0);
|
|
24
26
|
let controller;
|
|
25
|
-
let
|
|
27
|
+
let table;
|
|
26
28
|
let resizeObserver;
|
|
29
|
+
function releaseTable() {
|
|
30
|
+
table?.release();
|
|
31
|
+
table = void 0;
|
|
32
|
+
}
|
|
33
|
+
function renderActive() {
|
|
34
|
+
const sheet = sheets.value[activeSheetIndex.value];
|
|
35
|
+
const el = container.value;
|
|
36
|
+
if (!sheet || !el) return;
|
|
37
|
+
releaseTable();
|
|
38
|
+
const limit = props.maxRows > 0 ? Math.min(props.maxRows, sheet.rows.length) : sheet.rows.length;
|
|
39
|
+
totalRows.value = sheet.rows.length;
|
|
40
|
+
renderedRows.value = limit;
|
|
41
|
+
truncated.value = props.maxRows > 0 && sheet.rows.length > props.maxRows;
|
|
42
|
+
table = new ListTable(el, {
|
|
43
|
+
records: sheet.rows.slice(0, limit),
|
|
44
|
+
columns: sheet.headers.map((title, i) => ({
|
|
45
|
+
field: String(i),
|
|
46
|
+
title,
|
|
47
|
+
width: "auto"
|
|
48
|
+
})),
|
|
49
|
+
widthMode: "standard"
|
|
50
|
+
});
|
|
51
|
+
}
|
|
27
52
|
async function load() {
|
|
28
53
|
controller?.abort();
|
|
29
54
|
controller = new AbortController();
|
|
30
|
-
const signal = controller.signal;
|
|
31
55
|
loading.value = true;
|
|
32
56
|
sheets.value = [];
|
|
33
57
|
activeSheetIndex.value = 0;
|
|
34
58
|
try {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (signal.aborted) return;
|
|
39
|
-
if (ext === "csv") {
|
|
40
|
-
const parsed = parseCsv(new TextDecoder("utf-8", { fatal: false }).decode(buf)).filter((row) => row.some((c) => c.length > 0));
|
|
41
|
-
const headers = parsed[0] ?? [];
|
|
42
|
-
const rows = parsed.slice(1);
|
|
43
|
-
sheets.value = [{
|
|
44
|
-
name: props.file.name,
|
|
45
|
-
headers: headers.map((h, i) => String(h) || `Column ${i + 1}`),
|
|
46
|
-
rows,
|
|
47
|
-
totalCount: rows.length
|
|
48
|
-
}];
|
|
49
|
-
} else {
|
|
50
|
-
const { readWorkbook } = await import("@cat-kit/excel");
|
|
51
|
-
const workbook = await readWorkbook(new Uint8Array(buf));
|
|
52
|
-
if (signal.aborted) return;
|
|
53
|
-
sheets.value = workbook.worksheets.map((ws) => {
|
|
54
|
-
const wsRows = ws.getRows();
|
|
55
|
-
const firstRow = wsRows[0];
|
|
56
|
-
const headers = firstRow ? firstRow.toValues().map((v) => cellToString(v)) : [];
|
|
57
|
-
const rows = wsRows.slice(1).map((r) => r.toValues().map(cellToString));
|
|
58
|
-
return {
|
|
59
|
-
name: ws.name,
|
|
60
|
-
headers: headers.map((h, i) => h || `Column ${i + 1}`),
|
|
61
|
-
rows,
|
|
62
|
-
totalCount: rows.length
|
|
63
|
-
};
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
await renderActive();
|
|
59
|
+
sheets.value = await parseSheetFile(props.file, controller.signal);
|
|
60
|
+
if (controller.signal.aborted) return;
|
|
61
|
+
renderActive();
|
|
67
62
|
} catch (err) {
|
|
68
63
|
if (err?.name === "AbortError") return;
|
|
69
64
|
emit("error", err);
|
|
@@ -71,73 +66,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
71
66
|
loading.value = false;
|
|
72
67
|
}
|
|
73
68
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (typeof v === "string") return v;
|
|
77
|
-
if (typeof v === "number" || typeof v === "boolean") return String(v);
|
|
78
|
-
if (v instanceof Date) return v.toLocaleString();
|
|
79
|
-
if (typeof v === "object" && v !== null && "formula" in v) {
|
|
80
|
-
const f = v;
|
|
81
|
-
if (f.result !== void 0 && f.result !== null) return cellToString(f.result);
|
|
82
|
-
return `=${f.formula}`;
|
|
83
|
-
}
|
|
84
|
-
return String(v);
|
|
85
|
-
}
|
|
86
|
-
async function renderActive() {
|
|
87
|
-
const sheet = sheets.value[activeSheetIndex.value];
|
|
88
|
-
if (!sheet || !container.value) return;
|
|
89
|
-
releaseInstance();
|
|
90
|
-
const limit = props.maxRows > 0 ? Math.min(props.maxRows, sheet.rows.length) : sheet.rows.length;
|
|
91
|
-
totalRows.value = sheet.totalCount;
|
|
92
|
-
renderedRows.value = limit;
|
|
93
|
-
truncated.value = props.maxRows > 0 && sheet.rows.length > props.maxRows;
|
|
94
|
-
const columns = sheet.headers.map((h, i) => ({
|
|
95
|
-
field: "c" + i,
|
|
96
|
-
title: h,
|
|
97
|
-
width: "auto"
|
|
98
|
-
}));
|
|
99
|
-
const records = [];
|
|
100
|
-
for (let i = 0; i < limit; i++) {
|
|
101
|
-
const row = sheet.rows[i];
|
|
102
|
-
if (!row) continue;
|
|
103
|
-
const record = {};
|
|
104
|
-
for (let j = 0; j < columns.length; j++) record["c" + j] = row[j] ?? "";
|
|
105
|
-
records.push(record);
|
|
106
|
-
}
|
|
107
|
-
const VTable = await import("@visactor/vtable");
|
|
108
|
-
if (!container.value) return;
|
|
109
|
-
instance = new VTable.ListTable(container.value, {
|
|
110
|
-
records,
|
|
111
|
-
columns,
|
|
112
|
-
widthMode: "standard",
|
|
113
|
-
heightMode: "standard",
|
|
114
|
-
defaultRowHeight: 32,
|
|
115
|
-
defaultHeaderRowHeight: 36,
|
|
116
|
-
autoFillWidth: true,
|
|
117
|
-
frozenColCount: 0,
|
|
118
|
-
theme: (VTable.themes.ARCO ?? VTable.themes.DEFAULT).extends({ defaultStyle: { borderLineWidth: 1 } })
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
function releaseInstance() {
|
|
122
|
-
if (instance && typeof instance.release === "function") try {
|
|
123
|
-
instance.release();
|
|
124
|
-
} catch {}
|
|
125
|
-
instance = void 0;
|
|
126
|
-
}
|
|
127
|
-
watch(() => props.file, () => load(), { immediate: true });
|
|
128
|
-
watch(activeSheetIndex, () => renderActive());
|
|
69
|
+
watch(() => props.file, load, { immediate: true });
|
|
70
|
+
watch(activeSheetIndex, renderActive);
|
|
129
71
|
watch(container, (el) => {
|
|
130
72
|
resizeObserver?.disconnect();
|
|
131
73
|
if (!el) return;
|
|
132
|
-
resizeObserver = new ResizeObserver(() =>
|
|
133
|
-
instance?.resize?.();
|
|
134
|
-
});
|
|
74
|
+
resizeObserver = new ResizeObserver(() => table?.resize?.());
|
|
135
75
|
resizeObserver.observe(el);
|
|
136
76
|
});
|
|
137
77
|
onBeforeUnmount(() => {
|
|
138
78
|
controller?.abort();
|
|
139
79
|
resizeObserver?.disconnect();
|
|
140
|
-
|
|
80
|
+
releaseTable();
|
|
141
81
|
sheets.value = [];
|
|
142
82
|
});
|
|
143
83
|
return (_ctx, _cache) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sheet-previewer.js","names":[],"sources":["../../../../src/components/file-viewer/previewers/sheet-previewer.vue"],"sourcesContent":["<template>\n <div :class=\"cls.e('sheet')\">\n <div v-if=\"truncated\" :class=\"cls.e('sheet-note')\">\n 仅展示前 {{ renderedRows.toLocaleString() }} 行(共 {{ totalRows.toLocaleString() }} 行)\n </div>\n <div v-if=\"sheets.length > 1\" :class=\"cls.e('sheet-tabs')\">\n <button\n v-for=\"(s, i) in sheets\"\n :key=\"s.name\"\n :class=\"[cls.e('sheet-tab'), bem.is('active', i === activeSheetIndex)]\"\n @click=\"activeSheetIndex = i\"\n >\n {{ s.name }}\n </button>\n </div>\n <div ref=\"container\" :class=\"cls.e('sheet-stage')\" />\n <div v-if=\"loading\" :class=\"cls.e('loading')\">加载中…</div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { bem } from '@veltra/utils'\nimport { onBeforeUnmount, ref, shallowRef, useTemplateRef, watch } from 'vue'\n\nimport type { FileViewerItem } from '../../../types/file-viewer'\n\ndefineOptions({ name: 'FileViewerSheetPreviewer' })\n\nconst props = withDefaults(defineProps<{ file: FileViewerItem; maxRows?: number }>(), {\n maxRows: 50_000\n})\n\nconst emit = defineEmits<{ (e: 'error', err: unknown): void }>()\n\nconst cls = bem('file-viewer')\n\nconst container = useTemplateRef<HTMLDivElement>('container')\nconst loading = ref(true)\nconst truncated = ref(false)\nconst totalRows = ref(0)\nconst renderedRows = ref(0)\n\ninterface SheetData {\n name: string\n headers: string[]\n rows: string[][]\n totalCount: number\n}\n\nconst sheets = shallowRef<SheetData[]>([])\nconst activeSheetIndex = ref(0)\n\nlet controller: AbortController | undefined\nlet instance: { release?: () => void; resize?: () => void } | undefined\nlet resizeObserver: ResizeObserver | undefined\n\nasync function load() {\n controller?.abort()\n controller = new AbortController()\n const signal = controller.signal\n loading.value = true\n sheets.value = []\n activeSheetIndex.value = 0\n\n try {\n const ext = props.file.name.slice(props.file.name.lastIndexOf('.') + 1).toLowerCase()\n const { toArrayBuffer, parseCsv } = await import('../helper')\n const buf = await toArrayBuffer(props.file.src, signal)\n if (signal.aborted) return\n\n if (ext === 'csv') {\n const text = new TextDecoder('utf-8', { fatal: false }).decode(buf)\n const parsed = parseCsv(text).filter((row) => row.some((c) => c.length > 0))\n const headers = parsed[0] ?? []\n const rows = parsed.slice(1)\n sheets.value = [\n {\n name: props.file.name,\n headers: headers.map((h, i) => String(h) || `Column ${i + 1}`),\n rows,\n totalCount: rows.length\n }\n ]\n } else {\n const { readWorkbook } = await import('@cat-kit/excel')\n const workbook = await readWorkbook(new Uint8Array(buf))\n if (signal.aborted) return\n sheets.value = workbook.worksheets.map((ws) => {\n const wsRows = ws.getRows()\n const firstRow = wsRows[0]\n const headers = firstRow ? firstRow.toValues().map((v) => cellToString(v)) : []\n const rows = wsRows.slice(1).map((r) => r.toValues().map(cellToString))\n return {\n name: ws.name,\n headers: headers.map((h, i) => h || `Column ${i + 1}`),\n rows,\n totalCount: rows.length\n }\n })\n }\n\n await renderActive()\n } catch (err) {\n if ((err as { name?: string })?.name === 'AbortError') return\n emit('error', err)\n } finally {\n loading.value = false\n }\n}\n\nfunction cellToString(v: unknown): string {\n if (v === null || v === undefined) return ''\n if (typeof v === 'string') return v\n if (typeof v === 'number' || typeof v === 'boolean') return String(v)\n if (v instanceof Date) return v.toLocaleString()\n if (typeof v === 'object' && v !== null && 'formula' in v) {\n const f = v as { formula: string; result?: unknown }\n if (f.result !== undefined && f.result !== null) return cellToString(f.result)\n return `=${f.formula}`\n }\n return String(v)\n}\n\nasync function renderActive() {\n const sheet = sheets.value[activeSheetIndex.value]\n if (!sheet || !container.value) return\n\n releaseInstance()\n\n const limit = props.maxRows > 0 ? Math.min(props.maxRows, sheet.rows.length) : sheet.rows.length\n totalRows.value = sheet.totalCount\n renderedRows.value = limit\n truncated.value = props.maxRows > 0 && sheet.rows.length > props.maxRows\n\n const columns = sheet.headers.map((h, i) => ({\n field: 'c' + i,\n title: h,\n width: 'auto' as const\n }))\n\n const records: Record<string, string>[] = []\n for (let i = 0; i < limit; i++) {\n const row = sheet.rows[i]\n if (!row) continue\n const record: Record<string, string> = {}\n for (let j = 0; j < columns.length; j++) {\n record['c' + j] = row[j] ?? ''\n }\n records.push(record)\n }\n\n const VTable = await import('@visactor/vtable')\n if (!container.value) return\n\n instance = new VTable.ListTable(container.value, {\n records,\n columns,\n widthMode: 'standard',\n heightMode: 'standard',\n defaultRowHeight: 32,\n defaultHeaderRowHeight: 36,\n autoFillWidth: true,\n frozenColCount: 0,\n theme: (VTable.themes.ARCO ?? VTable.themes.DEFAULT).extends({\n defaultStyle: { borderLineWidth: 1 }\n })\n })\n}\n\nfunction releaseInstance() {\n if (instance && typeof instance.release === 'function') {\n try {\n instance.release()\n } catch {\n /* noop */\n }\n }\n instance = undefined\n}\n\nwatch(\n () => props.file,\n () => load(),\n { immediate: true }\n)\n\nwatch(activeSheetIndex, () => renderActive())\n\nwatch(container, (el) => {\n resizeObserver?.disconnect()\n if (!el) return\n resizeObserver = new ResizeObserver(() => {\n instance?.resize?.()\n })\n resizeObserver.observe(el)\n})\n\nonBeforeUnmount(() => {\n controller?.abort()\n resizeObserver?.disconnect()\n releaseInstance()\n sheets.value = []\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;EA4BA,MAAM,QAAQ;EAId,MAAM,OAAO;EAEb,MAAM,MAAM,IAAI,aAAa;EAE7B,MAAM,YAAY,eAA+B,WAAW;EAC5D,MAAM,UAAU,IAAI,IAAI;EACxB,MAAM,YAAY,IAAI,KAAK;EAC3B,MAAM,YAAY,IAAI,CAAC;EACvB,MAAM,eAAe,IAAI,CAAC;EAS1B,MAAM,SAAS,WAAwB,CAAC,CAAC;EACzC,MAAM,mBAAmB,IAAI,CAAC;EAE9B,IAAI;EACJ,IAAI;EACJ,IAAI;EAEJ,eAAe,OAAO;GACpB,YAAY,MAAM;GAClB,aAAa,IAAI,gBAAgB;GACjC,MAAM,SAAS,WAAW;GAC1B,QAAQ,QAAQ;GAChB,OAAO,QAAQ,CAAC;GAChB,iBAAiB,QAAQ;GAEzB,IAAI;IACF,MAAM,MAAM,MAAM,KAAK,KAAK,MAAM,MAAM,KAAK,KAAK,YAAY,GAAG,IAAI,CAAC,EAAE,YAAY;IACpF,MAAM,EAAE,eAAe,aAAa,MAAM,OAAO;IACjD,MAAM,MAAM,MAAM,cAAc,MAAM,KAAK,KAAK,MAAM;IACtD,IAAI,OAAO,SAAS;IAEpB,IAAI,QAAQ,OAAO;KAEjB,MAAM,SAAS,SADF,IAAI,YAAY,SAAS,EAAE,OAAO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OAAK,eAAE,MAAA,GAAA,EAAI,EAAC,aAAA,CAAA;;IACvB,QAAA,SAAA,UAAA,GAAX,mBAAwD,OAAA;;KAAnC,OAAK,eAAE,MAAA,GAAA,EAAI,EAAC,SAAA,CAAA;OAAa,QAAI,CAAA,KAAA,mBAAA,QAAA,IAAA"}
|
|
1
|
+
{"version":3,"file":"sheet-previewer.js","names":[],"sources":["../../../../src/components/file-viewer/previewers/sheet-previewer.vue"],"sourcesContent":["<template>\n <div :class=\"cls.e('sheet')\">\n <div v-if=\"truncated\" :class=\"cls.e('sheet-note')\">\n 仅展示前 {{ renderedRows.toLocaleString() }} 行(共 {{ totalRows.toLocaleString() }} 行)\n </div>\n <div v-if=\"sheets.length > 1\" :class=\"cls.e('sheet-tabs')\">\n <button\n v-for=\"(s, i) in sheets\"\n :key=\"s.name\"\n :class=\"[cls.e('sheet-tab'), bem.is('active', i === activeSheetIndex)]\"\n @click=\"activeSheetIndex = i\"\n >\n {{ s.name }}\n </button>\n </div>\n <div ref=\"container\" :class=\"cls.e('sheet-stage')\" />\n <div v-if=\"loading\" :class=\"cls.e('loading')\">加载中…</div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { bem } from '@veltra/utils'\nimport { ListTable } from '@visactor/vtable'\nimport { onBeforeUnmount, ref, shallowRef, useTemplateRef, watch } from 'vue'\n\nimport type { FileViewerItem } from '../../../types/file-viewer'\nimport { parseSheetFile, type SheetPreview } from '../sheet-parser'\n\ndefineOptions({ name: 'FileViewerSheetPreviewer' })\n\nconst props = withDefaults(defineProps<{ file: FileViewerItem; maxRows?: number }>(), {\n maxRows: 50_000\n})\n\nconst emit = defineEmits<{ (e: 'error', err: unknown): void }>()\n\nconst cls = bem('file-viewer')\nconst container = useTemplateRef<HTMLDivElement>('container')\nconst loading = ref(true)\nconst truncated = ref(false)\nconst totalRows = ref(0)\nconst renderedRows = ref(0)\nconst sheets = shallowRef<SheetPreview[]>([])\nconst activeSheetIndex = ref(0)\n\nlet controller: AbortController | undefined\nlet table: ListTable | undefined\nlet resizeObserver: ResizeObserver | undefined\n\nfunction releaseTable() {\n table?.release()\n table = undefined\n}\n\nfunction renderActive() {\n const sheet = sheets.value[activeSheetIndex.value]\n const el = container.value\n if (!sheet || !el) return\n\n releaseTable()\n\n const limit = props.maxRows > 0 ? Math.min(props.maxRows, sheet.rows.length) : sheet.rows.length\n totalRows.value = sheet.rows.length\n renderedRows.value = limit\n truncated.value = props.maxRows > 0 && sheet.rows.length > props.maxRows\n\n table = new ListTable(el, {\n records: sheet.rows.slice(0, limit),\n columns: sheet.headers.map((title, i) => ({ field: String(i), title, width: 'auto' })),\n widthMode: 'standard'\n })\n}\n\nasync function load() {\n controller?.abort()\n controller = new AbortController()\n loading.value = true\n sheets.value = []\n activeSheetIndex.value = 0\n\n try {\n sheets.value = await parseSheetFile(props.file, controller.signal)\n if (controller.signal.aborted) return\n renderActive()\n } catch (err) {\n if ((err as { name?: string })?.name === 'AbortError') return\n emit('error', err)\n } finally {\n loading.value = false\n }\n}\n\nwatch(() => props.file, load, { immediate: true })\nwatch(activeSheetIndex, renderActive)\nwatch(container, (el) => {\n resizeObserver?.disconnect()\n if (!el) return\n resizeObserver = new ResizeObserver(() => table?.resize?.())\n resizeObserver.observe(el)\n})\n\nonBeforeUnmount(() => {\n controller?.abort()\n resizeObserver?.disconnect()\n releaseTable()\n sheets.value = []\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;EA8BA,MAAM,QAAQ;EAId,MAAM,OAAO;EAEb,MAAM,MAAM,IAAI,aAAa;EAC7B,MAAM,YAAY,eAA+B,WAAW;EAC5D,MAAM,UAAU,IAAI,IAAI;EACxB,MAAM,YAAY,IAAI,KAAK;EAC3B,MAAM,YAAY,IAAI,CAAC;EACvB,MAAM,eAAe,IAAI,CAAC;EAC1B,MAAM,SAAS,WAA2B,CAAC,CAAC;EAC5C,MAAM,mBAAmB,IAAI,CAAC;EAE9B,IAAI;EACJ,IAAI;EACJ,IAAI;EAEJ,SAAS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AW;GAC3B,aAAa;GACb,OAAO,QAAQ,CAAC;EAClB,CAAC;;uBAzGC,mBAgBM,OAAA,EAhBA,OAAK,eAAE,MAAA,GAAA,EAAI,EAAC,OAAA,CAAA,EAAA,GAAA;IACL,UAAA,SAAA,UAAA,GAAX,mBAEM,OAAA;;KAFiB,OAAK,eAAE,MAAA,GAAA,EAAI,EAAC,YAAA,CAAA;OAAgB,WAC5C,gBAAG,aAAA,MAAa,eAAc,CAAA,IAAK,UAAK,gBAAG,UAAA,MAAU,eAAc,CAAA,IAAK,QAC/E,CAAA,KAAA,mBAAA,QAAA,IAAA;IACW,OAAA,MAAO,SAAM,KAAA,UAAA,GAAxB,mBASM,OAAA;;KATyB,OAAK,eAAE,MAAA,GAAA,EAAI,EAAC,YAAA,CAAA;0BACzC,mBAOS,UAAA,MAAA,WANU,OAAA,QAAT,GAAG,MAAC;yBADd,mBAOS,UAAA;MALN,KAAK,EAAE;MACP,OAAK,eAAA,CAAG,MAAA,GAAA,EAAI,EAAC,WAAA,GAAe,MAAA,GAAA,EAAI,GAAE,UAAW,MAAM,iBAAA,KAAgB,CAAA,CAAA;MACnE,UAAK,WAAE,iBAAA,QAAmB;wBAExB,EAAE,IAAI,GAAA,IAAA,UAAA;;IAGb,mBAAqD,OAAA;cAA5C;KAAJ,KAAI;KAAa,OAAK,eAAE,MAAA,GAAA,EAAI,EAAC,aAAA,CAAA;;IACvB,QAAA,SAAA,UAAA,GAAX,mBAAwD,OAAA;;KAAnC,OAAK,eAAE,MAAA,GAAA,EAAI,EAAC,SAAA,CAAA;OAAa,QAAI,CAAA,KAAA,mBAAA,QAAA,IAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { getExtension, parseCsv, toArrayBuffer } from "./helper.js";
|
|
2
|
+
import { readWorkbook } from "@cat-kit/excel";
|
|
3
|
+
//#region src/components/file-viewer/sheet-parser.ts
|
|
4
|
+
function cellToString(v) {
|
|
5
|
+
if (v == null) return "";
|
|
6
|
+
if (typeof v === "string") return v;
|
|
7
|
+
if (typeof v === "number" || typeof v === "boolean") return String(v);
|
|
8
|
+
if (v instanceof Date) return v.toLocaleString();
|
|
9
|
+
if (typeof v === "object" && "formula" in v) {
|
|
10
|
+
const f = v;
|
|
11
|
+
return f.result != null ? cellToString(f.result) : `=${f.formula}`;
|
|
12
|
+
}
|
|
13
|
+
return JSON.stringify(v);
|
|
14
|
+
}
|
|
15
|
+
/** 解析 CSV / Excel 为表格预览数据 */
|
|
16
|
+
async function parseSheetFile(file, signal) {
|
|
17
|
+
const ext = getExtension(file.name);
|
|
18
|
+
const buf = await toArrayBuffer(file.src, signal);
|
|
19
|
+
if (signal?.aborted) return [];
|
|
20
|
+
if (ext === "csv") {
|
|
21
|
+
const parsed = parseCsv(new TextDecoder("utf-8", { fatal: false }).decode(buf)).filter((row) => row.some((c) => c.length > 0));
|
|
22
|
+
const headers = (parsed[0] ?? []).map((h, i) => String(h) || `Column ${i + 1}`);
|
|
23
|
+
return [{
|
|
24
|
+
name: file.name,
|
|
25
|
+
headers,
|
|
26
|
+
rows: parsed.slice(1)
|
|
27
|
+
}];
|
|
28
|
+
}
|
|
29
|
+
const workbook = await readWorkbook(new Uint8Array(buf));
|
|
30
|
+
if (signal?.aborted) return [];
|
|
31
|
+
return workbook.worksheets.map((ws) => {
|
|
32
|
+
const wsRows = ws.getRows();
|
|
33
|
+
const firstRow = wsRows[0];
|
|
34
|
+
const headers = (firstRow ? firstRow.toValues().map(cellToString) : []).map((h, i) => h || `Column ${i + 1}`);
|
|
35
|
+
const rows = wsRows.slice(1).map((r) => r.toValues().map(cellToString));
|
|
36
|
+
return {
|
|
37
|
+
name: ws.name,
|
|
38
|
+
headers,
|
|
39
|
+
rows
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { parseSheetFile };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=sheet-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheet-parser.js","names":[],"sources":["../../../src/components/file-viewer/sheet-parser.ts"],"sourcesContent":["import { readWorkbook } from '@cat-kit/excel'\n\nimport type { FileViewerItem } from '../../types/file-viewer'\nimport { getExtension, parseCsv, toArrayBuffer } from './helper'\n\nexport interface SheetPreview {\n name: string\n headers: string[]\n rows: string[][]\n}\n\nfunction cellToString(v: unknown): string {\n if (v == null) return ''\n if (typeof v === 'string') return v\n if (typeof v === 'number' || typeof v === 'boolean') return String(v)\n if (v instanceof Date) return v.toLocaleString()\n if (typeof v === 'object' && 'formula' in v) {\n const f = v as { formula: string; result?: unknown }\n return f.result != null ? cellToString(f.result) : `=${f.formula}`\n }\n return JSON.stringify(v)\n}\n\n/** 解析 CSV / Excel 为表格预览数据 */\nexport async function parseSheetFile(\n file: FileViewerItem,\n signal?: AbortSignal\n): Promise<SheetPreview[]> {\n const ext = getExtension(file.name)\n const buf = await toArrayBuffer(file.src, signal)\n if (signal?.aborted) return []\n\n if (ext === 'csv') {\n const text = new TextDecoder('utf-8', { fatal: false }).decode(buf)\n const parsed = parseCsv(text).filter((row) => row.some((c) => c.length > 0))\n const headers = (parsed[0] ?? []).map((h, i) => String(h) || `Column ${i + 1}`)\n return [{ name: file.name, headers, rows: parsed.slice(1) }]\n }\n\n const workbook = await readWorkbook(new Uint8Array(buf))\n if (signal?.aborted) return []\n\n return workbook.worksheets.map((ws) => {\n const wsRows = ws.getRows()\n const firstRow = wsRows[0]\n const headers = (firstRow ? firstRow.toValues().map(cellToString) : []).map(\n (h, i) => h || `Column ${i + 1}`\n )\n const rows = wsRows.slice(1).map((r) => r.toValues().map(cellToString))\n return { name: ws.name, headers, rows }\n })\n}\n"],"mappings":";;;AAWA,SAAS,aAAa,GAAoB;CACxC,IAAI,KAAK,MAAM,OAAO;CACtB,IAAI,OAAO,MAAM,UAAU,OAAO;CAClC,IAAI,OAAO,MAAM,YAAY,OAAO,MAAM,WAAW,OAAO,OAAO,CAAC;CACpE,IAAI,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vue.js";
|
|
|
48
48
|
import { _default as _default$40 } from "./date-panel/date-panel.vue.js";
|
|
49
49
|
import { _default as _default$41 } from "./table-editor/table-editor.vue.js";
|
|
50
50
|
import { _default as _default$42 } from "./check-tag/check-tag.vue.js";
|
|
51
|
-
import { _default as _default$43 } from "./
|
|
52
|
-
import { contextmenu } from "./
|
|
51
|
+
import { _default as _default$43 } from "./contextmenu/contextmenu.vue.js";
|
|
52
|
+
import { contextmenu } from "./contextmenu/api.js";
|
|
53
53
|
import { _default as _default$44 } from "./password-input/password-input.vue.js";
|
|
54
54
|
import { _default as _default$45 } from "./number/number.vue.js";
|
|
55
55
|
import { _default as _default$46 } from "./dialog/dialog.vue.js";
|
package/dist/components/index.js
CHANGED
|
@@ -61,8 +61,8 @@ import { defineTableColumns } from "./table/use-columns.js";
|
|
|
61
61
|
import _sfc_main$46 from "./table/table.js";
|
|
62
62
|
import _sfc_main$47 from "./table-editor/table-editor.js";
|
|
63
63
|
import _sfc_main$48 from "./check-tag/check-tag.js";
|
|
64
|
-
import _sfc_main$49 from "./
|
|
65
|
-
import { contextmenu } from "./
|
|
64
|
+
import _sfc_main$49 from "./contextmenu/contextmenu.js";
|
|
65
|
+
import { contextmenu } from "./contextmenu/api.js";
|
|
66
66
|
import _sfc_main$50 from "./password-input/password-input.js";
|
|
67
67
|
import _sfc_main$51 from "./number/number.js";
|
|
68
68
|
import _sfc_main$52 from "./dialog/dialog.js";
|
|
@@ -127,7 +127,7 @@ var components_exports = /* @__PURE__ */ __exportAll({
|
|
|
127
127
|
UCollapse: () => _sfc_main$44,
|
|
128
128
|
UCollapseItem: () => _sfc_main$45,
|
|
129
129
|
UConditionEditor: () => _sfc_main$6,
|
|
130
|
-
|
|
130
|
+
UContextmenu: () => _sfc_main$49,
|
|
131
131
|
UDatePanel: () => _sfc_main$27,
|
|
132
132
|
UDatePicker: () => _sfc_main$62,
|
|
133
133
|
UDateRangePicker: () => _sfc_main$28,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/components/index.ts"],"sourcesContent":["export * from './condition-editor'\n\nexport * from './tabs'\n\nexport * from './tree'\n\nexport * from './tree-select'\n\nexport * from './code-editor'\n\nexport * from './dropdown'\n\nexport * from './drawer'\n\nexport * from './form'\n\nexport * from './message-confirm'\n\nexport * from './calendar'\n\nexport * from './radio'\n\nexport * from './card'\n\nexport * from './date-range-picker'\n\nexport * from './loading'\n\nexport * from './scroll'\n\nexport * from './progress-nodes'\n\nexport * from './empty'\n\nexport * from './auto-complete'\n\nexport * from './progress'\n\nexport * from './input'\n\nexport * from './notification'\n\nexport * from './layout'\n\nexport * from './multi-select'\n\nexport * from './checkbox'\n\nexport * from './slider'\n\nexport * from './gantt-chart'\n\nexport * from './message'\n\nexport * from './file-picker'\n\nexport * from './number-range-input'\n\nexport * from './number-input'\n\nexport * from './collapse'\n\nexport * from './date-panel'\n\nexport * from './table-editor'\n\nexport * from './check-tag'\n\nexport * from './
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/components/index.ts"],"sourcesContent":["export * from './condition-editor'\n\nexport * from './tabs'\n\nexport * from './tree'\n\nexport * from './tree-select'\n\nexport * from './code-editor'\n\nexport * from './dropdown'\n\nexport * from './drawer'\n\nexport * from './form'\n\nexport * from './message-confirm'\n\nexport * from './calendar'\n\nexport * from './radio'\n\nexport * from './card'\n\nexport * from './date-range-picker'\n\nexport * from './loading'\n\nexport * from './scroll'\n\nexport * from './progress-nodes'\n\nexport * from './empty'\n\nexport * from './auto-complete'\n\nexport * from './progress'\n\nexport * from './input'\n\nexport * from './notification'\n\nexport * from './layout'\n\nexport * from './multi-select'\n\nexport * from './checkbox'\n\nexport * from './slider'\n\nexport * from './gantt-chart'\n\nexport * from './message'\n\nexport * from './file-picker'\n\nexport * from './number-range-input'\n\nexport * from './number-input'\n\nexport * from './collapse'\n\nexport * from './date-panel'\n\nexport * from './table-editor'\n\nexport * from './check-tag'\n\nexport * from './contextmenu'\n\nexport * from './password-input'\n\nexport * from './number'\n\nexport * from './dialog'\n\nexport * from './node-render'\n\nexport * from './expression-editor'\n\nexport * from './watermark'\n\nexport * from './batch-edit'\n\nexport * from './action'\n\nexport * from './tip'\n\nexport * from './textarea'\n\nexport * from './button'\n\nexport * from './cascade'\n\nexport * from './steps'\n\nexport * from './date-picker'\n\nexport * from './theme'\n\nexport * from './table'\n\nexport * from './multi-tree-select'\n\nexport * from './group-input'\n\nexport * from './list'\n\nexport * from './rich-text-editor'\n\nexport * from './menu'\n\nexport * from './grid-input'\n\nexport * from './switch'\n\nexport * from './form-item'\n\nexport * from './radio-group'\n\nexport * from './checkbox-group'\n\nexport * from './file-viewer'\n\nexport * from './text'\n\nexport * from './select'\n\nexport * from './breadcrumb'\n\nexport * from './icon'\n\nexport * from './kbd'\n\nexport * from './pop-confirm'\n\nexport * from './paginator'\n\nexport * from './tag'\n\nexport * from './float-button'\n\nexport * from './palette'\n\nexport * from './grid'\n\nexport * from './badge'\n"],"mappings":""}
|
|
@@ -33,9 +33,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, _Inpu
|
|
|
33
33
|
"onNative:input"?: ((ev: Event) => any) | undefined;
|
|
34
34
|
}>, {
|
|
35
35
|
disabled: boolean;
|
|
36
|
-
readonly: boolean;
|
|
37
36
|
placeholder: string;
|
|
38
37
|
clearable: boolean;
|
|
38
|
+
readonly: boolean;
|
|
39
39
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
40
40
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
41
41
|
declare const _default: typeof __VLS_export;
|
|
@@ -26,13 +26,13 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
26
26
|
"onUpdate:modelValue"?: ((value: any[]) => any) | undefined;
|
|
27
27
|
onChange?: ((options: Record<string, any>[]) => any) | undefined;
|
|
28
28
|
}>, {
|
|
29
|
+
minWidth: string;
|
|
29
30
|
disabled: boolean;
|
|
30
|
-
readonly: boolean;
|
|
31
31
|
labelKey: string;
|
|
32
32
|
valueKey: string;
|
|
33
33
|
placeholder: string;
|
|
34
34
|
clearable: boolean;
|
|
35
|
-
|
|
35
|
+
readonly: boolean;
|
|
36
36
|
visibilityLimit: number;
|
|
37
37
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
38
38
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -21,15 +21,15 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
21
21
|
onClear?: (() => any) | undefined;
|
|
22
22
|
onChange?: ((checked: Record<string, any>[]) => any) | undefined;
|
|
23
23
|
}>, {
|
|
24
|
+
minWidth: string;
|
|
24
25
|
disabled: boolean;
|
|
25
|
-
readonly: boolean;
|
|
26
26
|
expandAll: boolean;
|
|
27
27
|
labelKey: string;
|
|
28
28
|
valueKey: string;
|
|
29
29
|
placeholder: string;
|
|
30
30
|
clearable: boolean;
|
|
31
31
|
filterable: boolean;
|
|
32
|
-
|
|
32
|
+
readonly: boolean;
|
|
33
33
|
visibilityLimit: number;
|
|
34
34
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
35
35
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -21,9 +21,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
21
21
|
onChange?: ((value?: number | undefined) => any) | undefined;
|
|
22
22
|
}>, {
|
|
23
23
|
disabled: boolean;
|
|
24
|
-
readonly: boolean;
|
|
25
24
|
placeholder: string;
|
|
26
25
|
clearable: boolean;
|
|
26
|
+
readonly: boolean;
|
|
27
27
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
28
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
29
29
|
declare const _default: typeof __VLS_export;
|
|
@@ -23,11 +23,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
23
23
|
"onUpdate:end"?: ((value: number | undefined) => any) | undefined;
|
|
24
24
|
}>, {
|
|
25
25
|
disabled: boolean;
|
|
26
|
-
readonly: boolean;
|
|
27
26
|
clearable: boolean;
|
|
28
|
-
|
|
27
|
+
readonly: boolean;
|
|
29
28
|
startPlaceholder: string;
|
|
30
29
|
endPlaceholder: string;
|
|
30
|
+
separator: string;
|
|
31
31
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
32
32
|
declare const _default: typeof __VLS_export;
|
|
33
33
|
//#endregion
|
|
@@ -14,8 +14,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
14
14
|
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
15
15
|
}>, {
|
|
16
16
|
disabled: boolean;
|
|
17
|
-
readonly: boolean;
|
|
18
17
|
clearable: boolean;
|
|
18
|
+
readonly: boolean;
|
|
19
19
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
20
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
21
21
|
declare const _default: typeof __VLS_export;
|
|
@@ -13,11 +13,11 @@ type __VLS_Slots = {} & {
|
|
|
13
13
|
default?: (props: typeof __VLS_3) => any;
|
|
14
14
|
};
|
|
15
15
|
declare const __VLS_base: import("vue").DefineComponent<ProgressNodesProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
16
|
-
"update:modelValue": (value: string | number) => any;
|
|
17
16
|
click: (node: Record<string, any>, index: number) => any;
|
|
17
|
+
"update:modelValue": (value: string | number) => any;
|
|
18
18
|
}, string, import("vue").PublicProps, Readonly<ProgressNodesProps> & Readonly<{
|
|
19
|
-
"onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
|
|
20
19
|
onClick?: ((node: Record<string, any>, index: number) => any) | undefined;
|
|
20
|
+
"onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
|
|
21
21
|
}>, {
|
|
22
22
|
labelKey: string;
|
|
23
23
|
valueKey: string;
|
|
@@ -15,9 +15,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
15
15
|
onChange?: ((item: Record<string, any>) => any) | undefined;
|
|
16
16
|
}>, {
|
|
17
17
|
disabled: boolean;
|
|
18
|
-
readonly: boolean;
|
|
19
18
|
labelKey: string;
|
|
20
19
|
valueKey: string;
|
|
20
|
+
readonly: boolean;
|
|
21
21
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
22
|
declare const _default: typeof __VLS_export;
|
|
23
23
|
//#endregion
|
|
@@ -11,8 +11,8 @@ declare const __VLS_export: import("vue").DefineComponent<RichTextEditorProps &
|
|
|
11
11
|
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
12
12
|
}>, {
|
|
13
13
|
disabled: boolean;
|
|
14
|
-
readonly: boolean;
|
|
15
14
|
placeholder: string;
|
|
15
|
+
readonly: boolean;
|
|
16
16
|
format: RichTextFormat;
|
|
17
17
|
toolbar: ToolbarItem[];
|
|
18
18
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -25,11 +25,11 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
25
25
|
"onUpdate:label"?: ((label?: string | undefined) => any) | undefined;
|
|
26
26
|
}>, {
|
|
27
27
|
disabled: boolean;
|
|
28
|
-
readonly: boolean;
|
|
29
28
|
labelKey: string;
|
|
30
29
|
valueKey: string;
|
|
31
30
|
placeholder: string;
|
|
32
31
|
clearable: boolean;
|
|
32
|
+
readonly: boolean;
|
|
33
33
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
34
34
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
35
35
|
declare const _default: typeof __VLS_export;
|
|
@@ -12,8 +12,8 @@ declare const __VLS_base: import("vue").DefineComponent<StepsProps, {}, {}, {},
|
|
|
12
12
|
"onUpdate:current"?: ((value?: string | number | undefined) => any) | undefined;
|
|
13
13
|
"onItem-click"?: ((item: Record<string, any>, index: number) => any) | undefined;
|
|
14
14
|
}>, {
|
|
15
|
-
labelKey: string;
|
|
16
15
|
direction: "horizontal" | "vertical";
|
|
16
|
+
labelKey: string;
|
|
17
17
|
finishedStepType: import("@veltra/utils").ColorType;
|
|
18
18
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
19
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -14,13 +14,13 @@ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
|
14
14
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
15
|
"update:modelValue": (value: string | undefined) => any;
|
|
16
16
|
} & {
|
|
17
|
-
"update:modelValue": (value: string) => any;
|
|
18
17
|
close: (item: TabItem, index: number) => any;
|
|
19
18
|
click: (item: TabItem, index: number) => any;
|
|
19
|
+
"update:modelValue": (value: string) => any;
|
|
20
20
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
21
|
-
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
22
21
|
onClose?: ((item: TabItem, index: number) => any) | undefined;
|
|
23
22
|
onClick?: ((item: TabItem, index: number) => any) | undefined;
|
|
23
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
24
24
|
}>, {
|
|
25
25
|
closable: boolean;
|
|
26
26
|
position: "top" | "bottom";
|
|
@@ -14,13 +14,13 @@ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
|
14
14
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
15
|
"update:modelValue": (value: string | undefined) => any;
|
|
16
16
|
} & {
|
|
17
|
-
"update:modelValue": (value: string) => any;
|
|
18
17
|
close: (item: TabItem, index: number) => any;
|
|
19
18
|
click: (item: TabItem, index: number) => any;
|
|
19
|
+
"update:modelValue": (value: string) => any;
|
|
20
20
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
21
|
-
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
22
21
|
onClose?: ((item: TabItem, index: number) => any) | undefined;
|
|
23
22
|
onClick?: ((item: TabItem, index: number) => any) | undefined;
|
|
23
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
24
24
|
}>, {
|
|
25
25
|
closable: boolean;
|
|
26
26
|
position: "left" | "right";
|
|
@@ -9,13 +9,13 @@ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
|
9
9
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
10
|
"update:modelValue": (value: string | undefined) => any;
|
|
11
11
|
} & {
|
|
12
|
-
"update:modelValue": (value: string) => any;
|
|
13
12
|
close: (item: TabItem, index: number) => any;
|
|
14
13
|
click: (item: TabItem, index: number) => any;
|
|
14
|
+
"update:modelValue": (value: string) => any;
|
|
15
15
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
16
|
-
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
17
16
|
onClose?: ((item: TabItem, index: number) => any) | undefined;
|
|
18
17
|
onClick?: ((item: TabItem, index: number) => any) | undefined;
|
|
18
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
19
19
|
}>, {
|
|
20
20
|
closable: boolean;
|
|
21
21
|
position: "left" | "right" | "top" | "bottom";
|
|
@@ -20,11 +20,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
20
20
|
onFocus?: (() => any) | undefined;
|
|
21
21
|
onBlur?: (() => any) | undefined;
|
|
22
22
|
}>, {
|
|
23
|
-
resize: boolean;
|
|
24
23
|
disabled: boolean;
|
|
25
|
-
readonly: boolean;
|
|
26
24
|
placeholder: string;
|
|
27
25
|
clearable: boolean;
|
|
26
|
+
readonly: boolean;
|
|
27
|
+
resize: boolean;
|
|
28
28
|
autosize: boolean;
|
|
29
29
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
30
30
|
declare const _default: typeof __VLS_export;
|
|
@@ -23,15 +23,15 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
23
23
|
onChange?: ((value?: string | number | undefined, selectedData?: Record<string, any> | undefined) => any) | undefined;
|
|
24
24
|
"onUpdate:text"?: ((text?: string | undefined) => any) | undefined;
|
|
25
25
|
}>, {
|
|
26
|
+
minWidth: string;
|
|
26
27
|
disabled: boolean;
|
|
27
|
-
readonly: boolean;
|
|
28
28
|
expandAll: boolean;
|
|
29
29
|
labelKey: string;
|
|
30
30
|
valueKey: string;
|
|
31
31
|
placeholder: string;
|
|
32
32
|
clearable: boolean;
|
|
33
33
|
filterable: boolean;
|
|
34
|
-
|
|
34
|
+
readonly: boolean;
|
|
35
35
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
36
36
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
37
37
|
declare const _default: typeof __VLS_export;
|