qidian-vue-ui 1.2.112 → 1.2.113

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.
@@ -118,6 +118,10 @@ export declare const QdConfigProvider: import("vue").DefineComponent<{
118
118
  uploadFailed?: string;
119
119
  fontFormats?: Record<string, string>;
120
120
  };
121
+ multiFileViewer?: {
122
+ emptyText?: string;
123
+ defaultFileName?: string;
124
+ };
121
125
  }) | undefined;
122
126
  }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
123
127
  [key: string]: any;
@@ -241,6 +245,10 @@ export declare const QdConfigProvider: import("vue").DefineComponent<{
241
245
  uploadFailed?: string;
242
246
  fontFormats?: Record<string, string>;
243
247
  };
248
+ multiFileViewer?: {
249
+ emptyText?: string;
250
+ defaultFileName?: string;
251
+ };
244
252
  }) | undefined;
245
253
  }> & Readonly<{}>, {
246
254
  globalConfig: (Omit<import("tdesign-vue-next").GlobalConfigProvider, "upload" | "chat" | "form" | "table"> & {
@@ -349,6 +357,10 @@ export declare const QdConfigProvider: import("vue").DefineComponent<{
349
357
  uploadFailed?: string;
350
358
  fontFormats?: Record<string, string>;
351
359
  };
360
+ multiFileViewer?: {
361
+ emptyText?: string;
362
+ defaultFileName?: string;
363
+ };
352
364
  }) | undefined;
353
365
  upload: Pick<import("..").QdUploadProps<import("tdesign-vue-next").UploadFile, unknown, string | number | (string | number)[], string | number | (string | number)[], unknown, string | string[], string | string[], unknown, string | number | (string | number)[], string | number | (string | number)[]>, "name" | "del" | "action" | "headers" | "method" | "isBatchUpload" | "requestMethod" | "listOssByIds" | "listOssByUrls"> | undefined;
354
366
  office: {
@@ -133,5 +133,9 @@ export interface QdConfigProviderProps {
133
133
  uploadFailed?: string;
134
134
  fontFormats?: Record<string, string>;
135
135
  };
136
+ multiFileViewer?: {
137
+ emptyText?: string;
138
+ defaultFileName?: string;
139
+ };
136
140
  };
137
141
  }
@@ -106,6 +106,10 @@ export declare function useConfig<T extends keyof NonNullable<QdConfigProviderPr
106
106
  uploadFailed?: string;
107
107
  fontFormats?: Record<string, string>;
108
108
  };
109
+ multiFileViewer?: {
110
+ emptyText?: string;
111
+ defaultFileName?: string;
112
+ };
109
113
  })[T]> = keyof NonNullable<(Omit<import("tdesign-vue-next").GlobalConfigProvider, "upload" | "chat" | "form" | "table"> & {
110
114
  loading?: {
111
115
  text?: string;
@@ -212,6 +216,10 @@ export declare function useConfig<T extends keyof NonNullable<QdConfigProviderPr
212
216
  uploadFailed?: string;
213
217
  fontFormats?: Record<string, string>;
214
218
  };
219
+ multiFileViewer?: {
220
+ emptyText?: string;
221
+ defaultFileName?: string;
222
+ };
215
223
  })[T]>>(path: T_1) => NonNullable<NonNullable<(Omit<import("tdesign-vue-next").GlobalConfigProvider, "upload" | "chat" | "form" | "table"> & {
216
224
  loading?: {
217
225
  text?: string;
@@ -318,6 +326,10 @@ export declare function useConfig<T extends keyof NonNullable<QdConfigProviderPr
318
326
  uploadFailed?: string;
319
327
  fontFormats?: Record<string, string>;
320
328
  };
329
+ multiFileViewer?: {
330
+ emptyText?: string;
331
+ defaultFileName?: string;
332
+ };
321
333
  })[T]>[T_1]>;
322
334
  global: import("vue").ComputedRef<NonNullable<(Omit<import("tdesign-vue-next").GlobalConfigProvider, "upload" | "chat" | "form" | "table"> & {
323
335
  loading?: {
@@ -425,5 +437,9 @@ export declare function useConfig<T extends keyof NonNullable<QdConfigProviderPr
425
437
  uploadFailed?: string;
426
438
  fontFormats?: Record<string, string>;
427
439
  };
440
+ multiFileViewer?: {
441
+ emptyText?: string;
442
+ defaultFileName?: string;
443
+ };
428
444
  })[T]>>;
429
445
  };
@@ -3,6 +3,7 @@ import './index.css'
3
3
  import { defineComponent, computed, createBlock, openBlock, unref } from "vue";
4
4
  import { FileViewer } from "@flyfish-group/file-viewer3";
5
5
  import QdOfficePdf from "../office/pdf/index.vue.mjs";
6
+ import { useTheme } from "../../hooks/useTheme.mjs";
6
7
  const _sfc_main = /* @__PURE__ */ defineComponent({
7
8
  ...{ name: "QdFileViewer" },
8
9
  __name: "index",
@@ -13,6 +14,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
13
14
  },
14
15
  setup(__props) {
15
16
  const props = __props;
17
+ const tdTheme = useTheme();
16
18
  const isPdf = computed(() => {
17
19
  const { file, src } = props;
18
20
  if (file) {
@@ -37,6 +39,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
37
39
  file: __props.file,
38
40
  url: __props.src,
39
41
  options: {
42
+ theme: unref(tdTheme),
40
43
  toolbar: false,
41
44
  ...__props.options,
42
45
  pdf: {
@@ -0,0 +1,22 @@
1
+ .qd-multi-file-viewer .t-dialog {
2
+ border: none !important;
3
+ }
4
+ .qd-multi-file-viewer .t-dialog__header {
5
+ border-bottom: 1px solid var(--td-component-stroke);
6
+ }
7
+ .qd-multi-file-viewer .t-dialog__body {
8
+ padding: 0 !important;
9
+ }
10
+ .qd-multi-file-viewer__body {
11
+ display: flex;
12
+ width: 100%;
13
+ height: 100%;
14
+ }
15
+ .qd-multi-file-viewer__menu {
16
+ height: 100%;
17
+ border-right: 1px solid var(--td-component-stroke);
18
+ }
19
+ .qd-multi-file-viewer__content {
20
+ flex: 1 1 0;
21
+ overflow: hidden;
22
+ }
@@ -0,0 +1,2 @@
1
+ export { default as QdMultiFileViewer } from './index.vue';
2
+ export type { QdMultiFileViewerInstanceFunctions, QdMultiFileViewerItem, QdMultiFileViewerProps } from './types';
@@ -0,0 +1,11 @@
1
+ import type { QdDialogProps } from '../dialog';
2
+ import type { QdMultiFileViewerProps } from './types';
3
+ declare function show(override?: Partial<QdMultiFileViewerProps>): void;
4
+ declare function hide(): void;
5
+ declare const _default: import("vue").DefineComponent<QdMultiFileViewerProps, {
6
+ show: typeof show;
7
+ hide: typeof hide;
8
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<QdMultiFileViewerProps> & Readonly<{}>, {
9
+ wrapper: QdDialogProps | false;
10
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ export default _default;
@@ -0,0 +1,144 @@
1
+ import './index.css'
2
+ import { defineComponent, mergeDefaults, ref, computed, watch, createBlock, openBlock, resolveDynamicComponent, mergeProps, withCtx, createElementBlock, createVNode, createElementVNode, unref, Fragment, renderList, createTextVNode, toDisplayString, createCommentVNode, nextTick } from "vue";
3
+ import { Menu, MenuItem, Empty } from "tdesign-vue-next";
4
+ import { useConfig } from "../config-provider/useConfig.mjs";
5
+ import _sfc_main$1 from "../dialog/index.vue.mjs";
6
+ /* empty css */
7
+ import _sfc_main$2 from "../file-viewer/index.vue.mjs";
8
+ /* empty css */
9
+ /* empty css */
10
+ import { qdMultiFileViewerWrapperProps, qdMultiFileViewerProps } from "./props.mjs";
11
+ const _hoisted_1 = {
12
+ key: 0,
13
+ class: "qd-multi-file-viewer__body"
14
+ };
15
+ const _hoisted_2 = { class: "qd-multi-file-viewer__content" };
16
+ const _sfc_main = /* @__PURE__ */ defineComponent({
17
+ ...{ name: "QdMultiFileViewer" },
18
+ __name: "index",
19
+ props: /* @__PURE__ */ mergeDefaults({
20
+ index: {},
21
+ options: {},
22
+ files: {},
23
+ wrapper: { type: [Object, Boolean] }
24
+ }, qdMultiFileViewerProps),
25
+ setup(__props, { expose: __expose }) {
26
+ const props = __props;
27
+ const runtimeOverrides = ref({});
28
+ const dialogRef = ref();
29
+ const { t } = useConfig("multiFileViewer");
30
+ const mergedProps = computed(() => ({
31
+ ...props,
32
+ ...runtimeOverrides.value
33
+ }));
34
+ const activeIndex = ref(normalizeIndex(props.index, props.files));
35
+ const activeFileName = computed(() => {
36
+ const item = mergedProps.value.files?.[activeIndex.value];
37
+ if (!item) return;
38
+ return deriveName(item, activeIndex.value);
39
+ });
40
+ const activeViewerProps = computed(() => {
41
+ const item = mergedProps.value.files?.[activeIndex.value];
42
+ if (!item) return null;
43
+ return {
44
+ src: item.src,
45
+ file: item.file,
46
+ options: { ...mergedProps.value.options, ...item.options }
47
+ };
48
+ });
49
+ const isDialog = computed(() => mergedProps.value.wrapper !== false);
50
+ const dialogProps = computed(() => {
51
+ const wrapper = mergedProps.value.wrapper === false ? void 0 : mergedProps.value.wrapper;
52
+ return {
53
+ ...qdMultiFileViewerWrapperProps,
54
+ ...wrapper,
55
+ header: wrapper?.header ?? activeFileName.value
56
+ };
57
+ });
58
+ const wrapperTag = computed(() => isDialog.value ? _sfc_main$1 : "div");
59
+ const wrapperBindings = computed(() => isDialog.value ? dialogProps.value : {});
60
+ function normalizeIndex(index, files) {
61
+ if (!files?.length) return 0;
62
+ if (index === void 0 || index < 0 || index >= files.length) return 0;
63
+ return index;
64
+ }
65
+ function deriveName(item, index) {
66
+ if (item.name) return item.name;
67
+ const file = item.file;
68
+ if (file && "name" in file && file.name) return file.name;
69
+ if (item.src) return basenameFromUrl(item.src) ?? `${t("defaultFileName")} ${index + 1}`;
70
+ return `${t("defaultFileName")} ${index + 1}`;
71
+ }
72
+ function basenameFromUrl(src) {
73
+ try {
74
+ const pathname = new URL(src, "https://x").pathname;
75
+ const last = pathname.split("/").filter(Boolean).pop();
76
+ return last ? decodeURIComponent(last) : void 0;
77
+ } catch {
78
+ return void 0;
79
+ }
80
+ }
81
+ function handleMenuChange(value) {
82
+ if (typeof value === "number") activeIndex.value = value;
83
+ }
84
+ function show(override) {
85
+ runtimeOverrides.value = override ?? {};
86
+ activeIndex.value = normalizeIndex(mergedProps.value.index, mergedProps.value.files);
87
+ if (!isDialog.value) return;
88
+ nextTick(() => dialogRef.value?.show());
89
+ }
90
+ function hide() {
91
+ if (!isDialog.value) return;
92
+ dialogRef.value?.hide();
93
+ }
94
+ watch(
95
+ () => mergedProps.value.files,
96
+ (files) => {
97
+ activeIndex.value = normalizeIndex(activeIndex.value, files);
98
+ }
99
+ );
100
+ __expose({ show, hide });
101
+ return (_ctx, _cache) => {
102
+ return openBlock(), createBlock(resolveDynamicComponent(wrapperTag.value), mergeProps(wrapperBindings.value, {
103
+ class: "qd-multi-file-viewer",
104
+ ref_key: "dialogRef",
105
+ ref: dialogRef
106
+ }), {
107
+ default: withCtx(() => [
108
+ mergedProps.value.files?.length ? (openBlock(), createElementBlock("div", _hoisted_1, [
109
+ createVNode(unref(Menu), {
110
+ value: activeIndex.value,
111
+ class: "qd-multi-file-viewer__menu",
112
+ onChange: handleMenuChange
113
+ }, {
114
+ default: withCtx(() => [
115
+ (openBlock(true), createElementBlock(Fragment, null, renderList(mergedProps.value.files, (item, index) => {
116
+ return openBlock(), createBlock(unref(MenuItem), {
117
+ key: index,
118
+ value: index
119
+ }, {
120
+ default: withCtx(() => [
121
+ createTextVNode(toDisplayString(deriveName(item, index)), 1)
122
+ ]),
123
+ _: 2
124
+ }, 1032, ["value"]);
125
+ }), 128))
126
+ ]),
127
+ _: 1
128
+ }, 8, ["value"]),
129
+ createElementVNode("div", _hoisted_2, [
130
+ activeViewerProps.value ? (openBlock(), createBlock(_sfc_main$2, mergeProps({ key: activeIndex.value }, activeViewerProps.value), null, 16)) : createCommentVNode("", true)
131
+ ])
132
+ ])) : (openBlock(), createBlock(unref(Empty), {
133
+ key: 1,
134
+ title: unref(t)("emptyText")
135
+ }, null, 8, ["title"]))
136
+ ]),
137
+ _: 1
138
+ }, 16);
139
+ };
140
+ }
141
+ });
142
+ export {
143
+ _sfc_main as default
144
+ };
@@ -0,0 +1,6 @@
1
+ import './index.css'
2
+ import _sfc_main from "./index.vue.mjs";
3
+ /* empty css */
4
+ export {
5
+ _sfc_main as default
6
+ };
@@ -0,0 +1,12 @@
1
+ export declare const qdMultiFileViewerWrapperProps: {
2
+ readonly mode: "full-screen";
3
+ readonly fullscreenBtn: false;
4
+ readonly footer: false;
5
+ };
6
+ export declare const qdMultiFileViewerProps: {
7
+ readonly wrapper: () => {
8
+ readonly mode: "full-screen";
9
+ readonly fullscreenBtn: false;
10
+ readonly footer: false;
11
+ };
12
+ };
@@ -0,0 +1,12 @@
1
+ const qdMultiFileViewerWrapperProps = {
2
+ mode: "full-screen",
3
+ fullscreenBtn: false,
4
+ footer: false
5
+ };
6
+ const qdMultiFileViewerProps = {
7
+ wrapper: () => qdMultiFileViewerWrapperProps
8
+ };
9
+ export {
10
+ qdMultiFileViewerProps,
11
+ qdMultiFileViewerWrapperProps
12
+ };
@@ -0,0 +1,19 @@
1
+ import type { FileViewerOptions } from '@flyfish-group/file-viewer3';
2
+ import type { QdDialogProps } from '../dialog';
3
+ import type { QdFileViewerFile } from '../file-viewer';
4
+ export interface QdMultiFileViewerItem {
5
+ file?: QdFileViewerFile;
6
+ src?: string;
7
+ name?: string;
8
+ options?: FileViewerOptions;
9
+ }
10
+ export interface QdMultiFileViewerProps {
11
+ index?: number;
12
+ options?: FileViewerOptions;
13
+ files?: QdMultiFileViewerItem[];
14
+ wrapper?: QdDialogProps | false;
15
+ }
16
+ export interface QdMultiFileViewerInstanceFunctions {
17
+ show: (props?: Partial<QdMultiFileViewerProps>) => void;
18
+ hide: () => void;
19
+ }
@@ -100,6 +100,7 @@ declare const _default: import("vue").DefineComponent<QdStreamMarkdownProps, {
100
100
  postprocess?: (data: import("vue-stream-markdown").SyntaxTree) => import("vue-stream-markdown").SyntaxTree;
101
101
  caret?: "circle" | "block";
102
102
  locale?: string | import("vue-stream-markdown").LocaleConfig;
103
+ beforeDownload?: (event: import("vue-stream-markdown").DownloadEvent) => import("vue-stream-markdown").MaybePromise<boolean>;
103
104
  imageOptions?: import("vue-stream-markdown").ImageOptions;
104
105
  themeElement?: () => HTMLElement | undefined;
105
106
  shikiOptions?: import("vue-stream-markdown").ShikiOptions;
@@ -110,7 +111,6 @@ declare const _default: import("vue").DefineComponent<QdStreamMarkdownProps, {
110
111
  linkOptions?: import("vue-stream-markdown").LinkOptions;
111
112
  uiOptions?: import("vue-stream-markdown").UIOptions;
112
113
  cdnOptions?: import("vue-stream-markdown").CdnOptions;
113
- beforeDownload?: (event: import("vue-stream-markdown").DownloadEvent) => import("vue-stream-markdown").MaybePromise<boolean>;
114
114
  mdastOptions?: import("vue-stream-markdown").MdastOptions;
115
115
  postNormalize?: (data: import("vue-stream-markdown").SyntaxTree) => import("vue-stream-markdown").SyntaxTree;
116
116
  parseMarkdownIntoBlocks?: (content: string) => string[];
@@ -1 +1,2 @@
1
1
  export * from './components/file-viewer';
2
+ export * from './components/multi-file-viewer';
@@ -1,6 +1,9 @@
1
1
  import { default as default2 } from "./components/file-viewer/index.vue.mjs";
2
2
  /* empty css */
3
3
  /* empty css */
4
+ import { default as default3 } from "./components/multi-file-viewer/index.vue.mjs";
5
+ /* empty css */
4
6
  export {
5
- default2 as QdFileViewer
7
+ default2 as QdFileViewer,
8
+ default3 as QdMultiFileViewer
6
9
  };
@@ -370,5 +370,9 @@ declare const _default: {
370
370
  bookAntiqua: string;
371
371
  };
372
372
  };
373
+ multiFileViewer: {
374
+ emptyText: string;
375
+ defaultFileName: string;
376
+ };
373
377
  };
374
378
  export default _default;
@@ -111,6 +111,10 @@ const enUS = merge(enUS$1, {
111
111
  arialBlack: "Arial Black",
112
112
  bookAntiqua: "Book Antiqua"
113
113
  }
114
+ },
115
+ multiFileViewer: {
116
+ emptyText: "No files",
117
+ defaultFileName: "File"
114
118
  }
115
119
  });
116
120
  export {
@@ -370,5 +370,9 @@ declare const _default: {
370
370
  bookAntiqua: string;
371
371
  };
372
372
  };
373
+ multiFileViewer: {
374
+ emptyText: string;
375
+ defaultFileName: string;
376
+ };
373
377
  };
374
378
  export default _default;
@@ -108,6 +108,10 @@ const zhCN = merge(zhCN$1, {
108
108
  arialBlack: "Arial Black",
109
109
  bookAntiqua: "Book Antiqua"
110
110
  }
111
+ },
112
+ multiFileViewer: {
113
+ emptyText: "暂无文件",
114
+ defaultFileName: "文件"
111
115
  }
112
116
  });
113
117
  export {
@@ -370,5 +370,9 @@ declare const _default: {
370
370
  bookAntiqua: string;
371
371
  };
372
372
  };
373
+ multiFileViewer: {
374
+ emptyText: string;
375
+ defaultFileName: string;
376
+ };
373
377
  };
374
378
  export default _default;
@@ -108,6 +108,10 @@ const zhTW = merge(zhTW$1, {
108
108
  arialBlack: "Arial Black",
109
109
  bookAntiqua: "Book Antiqua"
110
110
  }
111
+ },
112
+ multiFileViewer: {
113
+ emptyText: "暫無文件",
114
+ defaultFileName: "文件"
111
115
  }
112
116
  });
113
117
  export {
@@ -18,7 +18,8 @@ function QdResolver() {
18
18
  QdCodemirrorLanguages: "qidian-vue-ui/codemirror",
19
19
  QdTinymce: "qidian-vue-ui/tinymce",
20
20
  QdTinymcePreview: "qidian-vue-ui/tinymce",
21
- QdFileViewer: "qidian-vue-ui/file-viewer"
21
+ QdFileViewer: "qidian-vue-ui/file-viewer",
22
+ QdMultiFileViewer: "qidian-vue-ui/file-viewer"
22
23
  };
23
24
  return {
24
25
  type: "component",
@@ -1 +1 @@
1
- {"version":3,"file":"qidian-vite-auto-import-resolver.cjs.js","sources":["../../src/utils/autoImportResolver.ts"],"sourcesContent":["import { readdirSync, statSync } from 'node:fs'\nimport { dirname, join, resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport type { ComponentResolver } from 'unplugin-vue-components/types'\n\nexport function QdResolver(): ComponentResolver {\n const __dirname = dirname(fileURLToPath(import.meta.url))\n const compPath = resolve(__dirname, '../components/')\n const cssMap = getCompCssMap(compPath)\n\n // 子路径导出的组件映射\n const subPathComponents: Record<string, string> = {\n QdConfigProvider: 'qidian-vue-ui/config-provider',\n QdIcon: 'qidian-vue-ui/icon',\n QdOfficePdf: 'qidian-vue-ui/office',\n QdStreamMarkdown: 'qidian-vue-ui/stream-markdown',\n QdMdEditor: 'qidian-vue-ui/md-editor',\n QdCodemirror: 'qidian-vue-ui/codemirror',\n QdCodemirrorLanguages: 'qidian-vue-ui/codemirror',\n QdTinymce: 'qidian-vue-ui/tinymce',\n QdTinymcePreview: 'qidian-vue-ui/tinymce',\n QdFileViewer: 'qidian-vue-ui/file-viewer'\n }\n\n return {\n type: 'component',\n resolve: (name: string) => {\n if (!name.startsWith('Qd')) return\n const compName = kebabCase(name).replace(/^qd-/, '')\n const css = cssMap[compName]\n\n const from = subPathComponents[name] || 'qidian-vue-ui'\n\n return {\n name,\n from,\n ...(css?.length ? { sideEffects: css } : {})\n }\n }\n }\n\n function getCompCssMap(\n dir: string,\n fileMap: Record<string, string[]> = {}\n ): Record<string, string[]> {\n const files = readdirSync(dir)\n\n files.forEach((file) => {\n const filePath = join(dir, file)\n const stat = statSync(filePath)\n\n if (stat.isDirectory()) {\n getCompCssMap(filePath, fileMap)\n } else if (file.endsWith('.css')) {\n const normalizedFilePath = filePath.replace(/\\\\/g, '/')\n const path = normalizedFilePath.split('/components/')[1]\n const pathSplit = path.split('/')\n let key = pathSplit[0]\n const filename = pathSplit[pathSplit.length - 1].replace('.css', '')\n if (pathSplit.length > 2) key = pathSplit.slice(0, -1).join('-')\n if (!/^index\\d*$/.test(filename)) key += `-${filename}`\n\n if (!fileMap[key]) fileMap[key] = []\n fileMap[key].push(`qidian-vue-ui/components/${path}`)\n }\n })\n\n return fileMap\n }\n\n function kebabCase(str: string, separator = '-') {\n return str\n .replace(/([A-Z])/g, `${separator}$1`)\n .toLowerCase()\n .replace(new RegExp(`^\\\\${separator}`), '')\n }\n}\n"],"names":["dirname","fileURLToPath","resolve","readdirSync","join","statSync"],"mappings":";;;;;;AAKO,SAAS,aAAgC;AAC9C,QAAM,YAAYA,UAAAA,QAAQC,SAAAA,cAAc,OAAA,aAAA,cAAA,QAAA,KAAA,EAAA,cAAA,UAAA,EAAA,OAAA,0BAAA,uBAAA,QAAA,YAAA,MAAA,YAAA,uBAAA,OAAA,IAAA,IAAA,2CAAA,SAAA,OAAA,EAAA,IAAe,CAAC;AACxD,QAAM,WAAWC,UAAAA,QAAQ,WAAW,gBAAgB;AACpD,QAAM,SAAS,cAAc,QAAQ;AAGrC,QAAM,oBAA4C;AAAA,IAChD,kBAAkB;AAAA,IAClB,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,kBAAkB;AAAA,IAClB,YAAY;AAAA,IACZ,cAAc;AA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AAA,IACF,CAAC;AAED,WAAO;AAAA,EACT;AAEA,WAAS,UAAU,KAAa,YAAY,KAAK;AAC/C,WAAO,IACJ,QAAQ,YAAY,GAAG,SAAS,IAAI,EACpC,YAAA,EACA,QAAQ,IAAI,OAAO,MAAM,SAAS,EAAE,GAAG,EAAE;AAAA,EAC9C;AACF;;"}
1
+ {"version":3,"file":"qidian-vite-auto-import-resolver.cjs.js","sources":["../../src/utils/autoImportResolver.ts"],"sourcesContent":["import { readdirSync, statSync } from 'node:fs'\nimport { dirname, join, resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport type { ComponentResolver } from 'unplugin-vue-components/types'\n\nexport function QdResolver(): ComponentResolver {\n const __dirname = dirname(fileURLToPath(import.meta.url))\n const compPath = resolve(__dirname, '../components/')\n const cssMap = getCompCssMap(compPath)\n\n // 子路径导出的组件映射\n const subPathComponents: Record<string, string> = {\n QdConfigProvider: 'qidian-vue-ui/config-provider',\n QdIcon: 'qidian-vue-ui/icon',\n QdOfficePdf: 'qidian-vue-ui/office',\n QdStreamMarkdown: 'qidian-vue-ui/stream-markdown',\n QdMdEditor: 'qidian-vue-ui/md-editor',\n QdCodemirror: 'qidian-vue-ui/codemirror',\n QdCodemirrorLanguages: 'qidian-vue-ui/codemirror',\n QdTinymce: 'qidian-vue-ui/tinymce',\n QdTinymcePreview: 'qidian-vue-ui/tinymce',\n QdFileViewer: 'qidian-vue-ui/file-viewer',\n QdMultiFileViewer: 'qidian-vue-ui/file-viewer'\n }\n\n return {\n type: 'component',\n resolve: (name: string) => {\n if (!name.startsWith('Qd')) return\n const compName = kebabCase(name).replace(/^qd-/, '')\n const css = cssMap[compName]\n\n const from = subPathComponents[name] || 'qidian-vue-ui'\n\n return {\n name,\n from,\n ...(css?.length ? { sideEffects: css } : {})\n }\n }\n }\n\n function getCompCssMap(\n dir: string,\n fileMap: Record<string, string[]> = {}\n ): Record<string, string[]> {\n const files = readdirSync(dir)\n\n files.forEach((file) => {\n const filePath = join(dir, file)\n const stat = statSync(filePath)\n\n if (stat.isDirectory()) {\n getCompCssMap(filePath, fileMap)\n } else if (file.endsWith('.css')) {\n const normalizedFilePath = filePath.replace(/\\\\/g, '/')\n const path = normalizedFilePath.split('/components/')[1]\n const pathSplit = path.split('/')\n let key = pathSplit[0]\n const filename = pathSplit[pathSplit.length - 1].replace('.css', '')\n if (pathSplit.length > 2) key = pathSplit.slice(0, -1).join('-')\n if (!/^index\\d*$/.test(filename)) key += `-${filename}`\n\n if (!fileMap[key]) fileMap[key] = []\n fileMap[key].push(`qidian-vue-ui/components/${path}`)\n }\n })\n\n return fileMap\n }\n\n function kebabCase(str: string, separator = '-') {\n return str\n .replace(/([A-Z])/g, `${separator}$1`)\n .toLowerCase()\n .replace(new RegExp(`^\\\\${separator}`), '')\n }\n}\n"],"names":["dirname","fileURLToPath","resolve","readdirSync","join","statSync"],"mappings":";;;;;;AAKO,SAAS,aAAgC;AAC9C,QAAM,YAAYA,UAAAA,QAAQC,SAAAA,cAAc,OAAA,aAAA,cAAA,QAAA,KAAA,EAAA,cAAA,UAAA,EAAA,OAAA,0BAAA,uBAAA,QAAA,YAAA,MAAA,YAAA,uBAAA,OAAA,IAAA,IAAA,2CAAA,SAAA,OAAA,EAAA,IAAe,CAAC;AACxD,QAAM,WAAWC,UAAAA,QAAQ,WAAW,gBAAgB;AACpD,QAAM,SAAS,cAAc,QAAQ;AAGrC,QAAM,oBAA4C;AAAA,IAChD,kBAAkB;AAAA,IAClB,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,kBAAkB;AAAA,IAClB,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,uBAAuB;AAAA,IACvB,WAAW;AAAA,IACX,kBAAkB;AAAA,IAClB,cAAc;AAAA,IACd,mBAAmB;AAAA,EAAA;AAGrB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS,CAAC,SAAiB;AACzB,UAAI,CAAC,KAAK,WAAW,IAAI,EAAG;AAC5B,YAAM,WAAW,UAAU,IAAI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-15,7 +15,8 @@ function QdResolver() {
15
15
  QdCodemirrorLanguages: "qidian-vue-ui/codemirror",
16
16
  QdTinymce: "qidian-vue-ui/tinymce",
17
17
  QdTinymcePreview: "qidian-vue-ui/tinymce",
18
- QdFileViewer: "qidian-vue-ui/file-viewer"
18
+ QdFileViewer: "qidian-vue-ui/file-viewer",
19
+ QdMultiFileViewer: "qidian-vue-ui/file-viewer"
19
20
  };
20
21
  return {
21
22
  type: "component",
@@ -1 +1 @@
1
- {"version":3,"file":"qidian-vite-auto-import-resolver.es.js","sources":["../../src/utils/autoImportResolver.ts"],"sourcesContent":["import { readdirSync, statSync } from 'node:fs'\nimport { dirname, join, resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport type { ComponentResolver } from 'unplugin-vue-components/types'\n\nexport function QdResolver(): ComponentResolver {\n const __dirname = dirname(fileURLToPath(import.meta.url))\n const compPath = resolve(__dirname, '../components/')\n const cssMap = getCompCssMap(compPath)\n\n // 子路径导出的组件映射\n const subPathComponents: Record<string, string> = {\n QdConfigProvider: 'qidian-vue-ui/config-provider',\n QdIcon: 'qidian-vue-ui/icon',\n QdOfficePdf: 'qidian-vue-ui/office',\n QdStreamMarkdown: 'qidian-vue-ui/stream-markdown',\n QdMdEditor: 'qidian-vue-ui/md-editor',\n QdCodemirror: 'qidian-vue-ui/codemirror',\n QdCodemirrorLanguages: 'qidian-vue-ui/codemirror',\n QdTinymce: 'qidian-vue-ui/tinymce',\n QdTinymcePreview: 'qidian-vue-ui/tinymce',\n QdFileViewer: 'qidian-vue-ui/file-viewer'\n }\n\n return {\n type: 'component',\n resolve: (name: string) => {\n if (!name.startsWith('Qd')) return\n const compName = kebabCase(name).replace(/^qd-/, '')\n const css = cssMap[compName]\n\n const from = subPathComponents[name] || 'qidian-vue-ui'\n\n return {\n name,\n from,\n ...(css?.length ? { sideEffects: css } : {})\n }\n }\n }\n\n function getCompCssMap(\n dir: string,\n fileMap: Record<string, string[]> = {}\n ): Record<string, string[]> {\n const files = readdirSync(dir)\n\n files.forEach((file) => {\n const filePath = join(dir, file)\n const stat = statSync(filePath)\n\n if (stat.isDirectory()) {\n getCompCssMap(filePath, fileMap)\n } else if (file.endsWith('.css')) {\n const normalizedFilePath = filePath.replace(/\\\\/g, '/')\n const path = normalizedFilePath.split('/components/')[1]\n const pathSplit = path.split('/')\n let key = pathSplit[0]\n const filename = pathSplit[pathSplit.length - 1].replace('.css', '')\n if (pathSplit.length > 2) key = pathSplit.slice(0, -1).join('-')\n if (!/^index\\d*$/.test(filename)) key += `-${filename}`\n\n if (!fileMap[key]) fileMap[key] = []\n fileMap[key].push(`qidian-vue-ui/components/${path}`)\n }\n })\n\n return fileMap\n }\n\n function kebabCase(str: string, separator = '-') {\n return str\n .replace(/([A-Z])/g, `${separator}$1`)\n .toLowerCase()\n .replace(new RegExp(`^\\\\${separator}`), '')\n }\n}\n"],"names":[],"mappings":";;;AAKO,SAAS,aAAgC;AAC9C,QAAM,YAAY,QAAQ,cAAc,YAAY,GAAG,CAAC;AACxD,QAAM,WAAW,QAAQ,WAAW,gBAAgB;AACpD,QAAM,SAAS,cAAc,QAAQ;AAGrC,QAAM,oBAA4C;AAAA,IAChD,kBAAkB;AAAA,IAClB,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,kBAAkB;AAAA,IAClB,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,uBAAuB;AAAA,IACvB,WAAW;AAAA,IACX,kBAAkB;AAAA,IAClB,cAAc;AAAA,EAAA;AAGhB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS,CAAC,SAAiB;AACzB,UAAI,CAAC,KAAK,WAAW,IAAI,EAAG;AAC5B,YAAM,WAAW,UAAU,IAAI,EAAE,QAAQ,QAAQ,EAAE;AACnD,YAAM,MAAM,OAAO,QAAQ;AAE3B,YAAM,OAAO,kBAAkB,IAAI,KAAK;AAExC,aAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA,GAAI,KAAK,SAAS,EAAE,aAAa,IAAA,IAAQ,CAAA;AAAA,MAAC;AAAA,IAE9C;AAAA,EAAA;AAGF,WAAS,cACP,KACA,UAAoC,IACV;AAC1B,UAAM,QAAQ,YAAY,GAAG;AAE7B,UAAM,QAAQ,CAAC,SAAS;AACtB,YAAM,WAAW,KAAK,KAAK,IAAI;AAC/B,YAAM,OAAO,SAAS,QAAQ;AAE9B,UAAI,KAAK,eAAe;AACtB,sBAAc,UAAU,OAAO;AAAA,MACjC,WAAW,KAAK,SAAS,MAAM,GAAG;AAChC,cAAM,qBAAqB,SAAS,QAAQ,OAAO,GAAG;AACtD,cAAM,OAAO,mBAAmB,MAAM,cAAc,EAAE,CAAC;AACvD,cAAM,YAAY,KAAK,MAAM,GAAG;AAChC,YAAI,MAAM,UAAU,CAAC;AACrB,cAAM,WAAW,UAAU,UAAU,SAAS,CAAC,EAAE,QAAQ,QAAQ,EAAE;AACnE,YAAI,UAAU,SAAS,EAAG,OAAM,UAAU,MAAM,GAAG,EAAE,EAAE,KAAK,GAAG;AAC/D,YAAI,CAAC,aAAa,KAAK,QAAQ,EAAG,QAAO,IAAI,QAAQ;AAErD,YAAI,CAAC,QAAQ,GAAG,EAAG,SAAQ,GAAG,IAAI,CAAA;AAClC,gBAAQ,GAAG,EAAE,KAAK,4BAA4B,IAAI,EAAE;AAAA,MACtD;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT;AAEA,WAAS,UAAU,KAAa,YAAY,KAAK;AAC/C,WAAO,IACJ,QAAQ,YAAY,GAAG,SAAS,IAAI,EACpC,YAAA,EACA,QAAQ,IAAI,OAAO,MAAM,SAAS,EAAE,GAAG,EAAE;AAAA,EAC9C;AACF;"}
1
+ {"version":3,"file":"qidian-vite-auto-import-resolver.es.js","sources":["../../src/utils/autoImportResolver.ts"],"sourcesContent":["import { readdirSync, statSync } from 'node:fs'\nimport { dirname, join, resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport type { ComponentResolver } from 'unplugin-vue-components/types'\n\nexport function QdResolver(): ComponentResolver {\n const __dirname = dirname(fileURLToPath(import.meta.url))\n const compPath = resolve(__dirname, '../components/')\n const cssMap = getCompCssMap(compPath)\n\n // 子路径导出的组件映射\n const subPathComponents: Record<string, string> = {\n QdConfigProvider: 'qidian-vue-ui/config-provider',\n QdIcon: 'qidian-vue-ui/icon',\n QdOfficePdf: 'qidian-vue-ui/office',\n QdStreamMarkdown: 'qidian-vue-ui/stream-markdown',\n QdMdEditor: 'qidian-vue-ui/md-editor',\n QdCodemirror: 'qidian-vue-ui/codemirror',\n QdCodemirrorLanguages: 'qidian-vue-ui/codemirror',\n QdTinymce: 'qidian-vue-ui/tinymce',\n QdTinymcePreview: 'qidian-vue-ui/tinymce',\n QdFileViewer: 'qidian-vue-ui/file-viewer',\n QdMultiFileViewer: 'qidian-vue-ui/file-viewer'\n }\n\n return {\n type: 'component',\n resolve: (name: string) => {\n if (!name.startsWith('Qd')) return\n const compName = kebabCase(name).replace(/^qd-/, '')\n const css = cssMap[compName]\n\n const from = subPathComponents[name] || 'qidian-vue-ui'\n\n return {\n name,\n from,\n ...(css?.length ? { sideEffects: css } : {})\n }\n }\n }\n\n function getCompCssMap(\n dir: string,\n fileMap: Record<string, string[]> = {}\n ): Record<string, string[]> {\n const files = readdirSync(dir)\n\n files.forEach((file) => {\n const filePath = join(dir, file)\n const stat = statSync(filePath)\n\n if (stat.isDirectory()) {\n getCompCssMap(filePath, fileMap)\n } else if (file.endsWith('.css')) {\n const normalizedFilePath = filePath.replace(/\\\\/g, '/')\n const path = normalizedFilePath.split('/components/')[1]\n const pathSplit = path.split('/')\n let key = pathSplit[0]\n const filename = pathSplit[pathSplit.length - 1].replace('.css', '')\n if (pathSplit.length > 2) key = pathSplit.slice(0, -1).join('-')\n if (!/^index\\d*$/.test(filename)) key += `-${filename}`\n\n if (!fileMap[key]) fileMap[key] = []\n fileMap[key].push(`qidian-vue-ui/components/${path}`)\n }\n })\n\n return fileMap\n }\n\n function kebabCase(str: string, separator = '-') {\n return str\n .replace(/([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YAAI,MAAM,UAAU,CAAC;AACrB,cAAM,WAAW,UAAU,UAAU,SAAS,CAAC,EAAE,QAAQ,QAAQ,EAAE;AACnE,YAAI,UAAU,SAAS,EAAG,OAAM,UAAU,MAAM,GAAG,EAAE,EAAE,KAAK,GAAG;AAC/D,YAAI,CAAC,aAAa,KAAK,QAAQ,EAAG,QAAO,IAAI,QAAQ;AAErD,YAAI,CAAC,QAAQ,GAAG,EAAG,SAAQ,GAAG,IAAI,CAAA;AAClC,gBAAQ,GAAG,EAAE,KAAK,4BAA4B,IAAI,EAAE;AAAA,MACtD;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT;AAEA,WAAS,UAAU,KAAa,YAAY,KAAK;AAC/C,WAAO,IACJ,QAAQ,YAAY,GAAG,SAAS,IAAI,EACpC,YAAA,EACA,QAAQ,IAAI,OAAO,MAAM,SAAS,EAAE,GAAG,EAAE;AAAA,EAC9C;AACF;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qidian-vue-ui",
3
- "version": "1.2.112",
3
+ "version": "1.2.113",
4
4
  "description": "基于 TDesign 的 QiDian Vue UI 组件库",
5
5
  "author": "qidian",
6
6
  "license": "MIT",