@smartos-lib/components 2.0.1 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc-auto-import.json +1 -0
- package/dist/smart-docx-editor/index.js +21 -21
- package/dist/smart-file-preview/index.js +7 -7
- package/dist/smart-upload/index.js +1 -1
- package/package.json +4 -5
- package/scripts/components.vite.config.ts +1 -1
- package/src/composables/useElementStyle.ts +1 -3
- package/src/composables/useSmart.ts +1 -3
- package/src/pages/frame/index.vue +1 -1
- package/src/pages/index/type.ts +4 -4
- package/src/pages/index/utils/index.ts +2 -2
- package/src/shared/components.ts +5 -5
- package/src/shared/env.ts +1 -1
- package/src/shared/unocss.theme.ts +1 -1
- package/src/types.ts +3 -3
- package/src/utils/deepCloneESModule.ts +1 -1
- package/src/utils/formatComponentsGlob.ts +1 -1
- package/src/web-components/smart-docx-drive-page/apis/doc.ts +5 -5
- package/src/web-components/smart-docx-drive-page/apis/file.ts +24 -24
- package/src/web-components/smart-docx-drive-page/apis/folder.ts +7 -7
- package/src/web-components/smart-docx-drive-page/components/DocxDir.vue +7 -7
- package/src/web-components/smart-docx-drive-page/components/DocxDoc.vue +2 -2
- package/src/web-components/smart-docx-drive-page/components/DocxFileList.vue +11 -1
- package/src/web-components/smart-docx-drive-page/components-private/Header.vue +5 -5
- package/src/web-components/smart-docx-drive-page/components-private/Menu.vue +4 -3
- package/src/web-components/smart-docx-drive-page/types.ts +16 -16
- package/src/web-components/smart-docx-drive-page/utils/file-actions.ts +1 -2
- package/src/web-components/smart-docx-editor/App.vue +1 -1
- package/src/web-components/smart-docx-editor/MarkdownShortcuts/components/Markdown.vue +4 -4
- package/src/web-components/smart-docx-editor/MarkdownShortcuts/components/types.ts +1 -1
- package/src/web-components/smart-docx-editor/MarkdownShortcuts/components-react/Markdown.tsx +6 -5
- package/src/web-components/smart-docx-editor/MarkdownShortcuts/components-react/types/custom-types.d.ts +42 -42
- package/src/web-components/smart-docx-editor/MarkdownShortcuts/shared/const.ts +1 -1
- package/src/web-components/smart-docx-editor/demo.vue +1 -1
- package/src/web-components/smart-docx-editor/index.md +1 -1
- package/src/web-components/smart-file-preview/category/Code.vue +2 -2
- package/src/web-components/smart-file-preview/index.md +1 -1
- package/src/web-components/smart-file-preview/index.ts +1 -1
- package/src/web-components/smart-file-preview/index.vue +1 -1
- package/src/web-components/smart-file-preview/types.ts +1 -1
- package/src/web-components/smart-upload/index.ts +4 -4
- package/src/web-components/smart-upload/types.ts +27 -27
- package/types/auto-imports.d.ts +3 -0
- package/types/components.d.ts +1 -1
- package/types/env.d.ts +2 -2
- package/types/shims.d.ts +1 -0
- package/vite.config.ts +1 -0
@@ -2,7 +2,7 @@
|
|
2
2
|
<div flex="~ col gap-1">
|
3
3
|
<!-- 主页 -->
|
4
4
|
<DocxDir
|
5
|
-
:class="{ active: activeMenu === 'home' }" :
|
5
|
+
:class="{ active: activeMenu === 'home' }" :show-open="false" name="主页" hidden-actions
|
6
6
|
@click="activeMenu = 'home'"
|
7
7
|
>
|
8
8
|
<template #icon>
|
@@ -12,7 +12,7 @@
|
|
12
12
|
<!-- 我的空间 -->
|
13
13
|
<DocxDir
|
14
14
|
:class="{ active: activeMenu === 'me' && (dirTree.isLoading || meActiveMenu === dirTree.data?.data.id) }"
|
15
|
-
:info="dirTree.data?.data" name="我的空间"
|
15
|
+
:info="dirTree.data?.data" name="我的空间" hidden-actions
|
16
16
|
@click="activeMenu = 'me'"
|
17
17
|
>
|
18
18
|
<template #icon="{ isActive }">
|
@@ -28,7 +28,8 @@
|
|
28
28
|
import DocxDir from '../components/DocxDir.vue';
|
29
29
|
|
30
30
|
const {
|
31
|
-
activeMenu,
|
31
|
+
activeMenu,
|
32
|
+
meActiveMenu,
|
32
33
|
dirTree,
|
33
34
|
} = menuStore();
|
34
35
|
</script>
|
@@ -5,13 +5,13 @@ export interface SmartDocxDrivePageProps {
|
|
5
5
|
/**
|
6
6
|
* Logo 图标地址
|
7
7
|
* @default <i-system-uicons-document-stack />
|
8
|
-
|
9
|
-
icon?: string
|
8
|
+
*/
|
9
|
+
icon?: string;
|
10
10
|
/**
|
11
11
|
* 标题
|
12
12
|
* @default 'SmartOS 云文档'
|
13
|
-
|
14
|
-
title?: string
|
13
|
+
*/
|
14
|
+
title?: string;
|
15
15
|
|
16
16
|
/**
|
17
17
|
* 当前激活的菜单项
|
@@ -19,33 +19,33 @@ export interface SmartDocxDrivePageProps {
|
|
19
19
|
* - me: 我的空间
|
20
20
|
* @default 'home'
|
21
21
|
*/
|
22
|
-
activeMenu?: 'home' | 'me'
|
22
|
+
activeMenu?: 'home' | 'me';
|
23
23
|
}
|
24
24
|
|
25
25
|
/** 上传文件信息 */
|
26
26
|
export interface FileItem {
|
27
|
-
id: string
|
27
|
+
id: string;
|
28
28
|
|
29
|
-
ref?: Element | ComponentPublicInstance | HTMLDivElement | null
|
29
|
+
ref?: Element | ComponentPublicInstance | HTMLDivElement | null;
|
30
30
|
|
31
31
|
/** 文件 */
|
32
|
-
file: File
|
32
|
+
file: File;
|
33
33
|
/** 文件名 */
|
34
|
-
fileName: string
|
34
|
+
fileName: string;
|
35
35
|
/** 文件名后缀 */
|
36
|
-
fileExt: string
|
36
|
+
fileExt: string;
|
37
37
|
|
38
38
|
/** 读取文件中 */
|
39
|
-
isReading?: boolean
|
39
|
+
isReading?: boolean;
|
40
40
|
|
41
41
|
/** 上传进度 */
|
42
|
-
progress?: number
|
42
|
+
progress?: number;
|
43
43
|
/** 上传中 */
|
44
|
-
isUploading?: boolean
|
44
|
+
isUploading?: boolean;
|
45
45
|
/** 上传成功 */
|
46
|
-
isUploadSuccess?: boolean
|
46
|
+
isUploadSuccess?: boolean;
|
47
47
|
/** 上传失败 */
|
48
|
-
isUploadError?: boolean
|
48
|
+
isUploadError?: boolean;
|
49
49
|
/** 是否是极速上传 */
|
50
|
-
isQuickUpload?: boolean
|
50
|
+
isQuickUpload?: boolean;
|
51
51
|
}
|
@@ -2,9 +2,8 @@ import { deleteFile, renameFile } from '../apis/file';
|
|
2
2
|
import type { FileInfo } from '../apis/file';
|
3
3
|
import { type DirInfo, getFolderList } from '../apis/folder';
|
4
4
|
import { useConfirm, usePrompt } from '../composables/usePrompt';
|
5
|
-
import { menuStore } from '../stores/menu';
|
6
5
|
|
7
|
-
const { flatDirTree } = menuStore();
|
6
|
+
// const { flatDirTree } = menuStore();
|
8
7
|
|
9
8
|
/** 重命名文件 */
|
10
9
|
export function toRenameFile(file: FileInfo) {
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<template>
|
4
4
|
<MarkdownShortcuts
|
5
5
|
v-bind="props"
|
6
|
-
:
|
6
|
+
:with-override="withOverride"
|
7
7
|
/>
|
8
8
|
</template>
|
9
9
|
|
@@ -29,9 +29,9 @@
|
|
29
29
|
};
|
30
30
|
}
|
31
31
|
/** 匹配当前焦点所在的节点 */
|
32
|
-
const matchElement = {
|
33
|
-
|
34
|
-
};
|
32
|
+
// const matchElement = {
|
33
|
+
// match: (n: Node) => Element.isElement(n),
|
34
|
+
// };
|
35
35
|
|
36
36
|
/** 编辑器功能重写 */
|
37
37
|
const withOverride: MarkdownShortcutsProps['withOverride'] = (editor) => {
|
package/src/web-components/smart-docx-editor/MarkdownShortcuts/components-react/Markdown.tsx
CHANGED
@@ -9,17 +9,18 @@ import { RenderElement, RenderLeaf } from './MarkdownElement';
|
|
9
9
|
|
10
10
|
export interface MarkdownShortcutsProps {
|
11
11
|
/** 初始值 */
|
12
|
-
initialValue?: Descendant[]
|
12
|
+
initialValue?: Descendant[];
|
13
13
|
/** 编辑器功能重写 */
|
14
|
-
withOverride?: (editor: Editor) => Editor
|
14
|
+
withOverride?: (editor: Editor) => Editor;
|
15
15
|
/** 用户输入前的事件回调 */
|
16
|
-
onBeforeInput?: (event: InputEvent) => void
|
16
|
+
onBeforeInput?: (event: InputEvent) => void;
|
17
17
|
}
|
18
18
|
|
19
19
|
export default function MarkdownShortcuts(props: MarkdownShortcutsProps) {
|
20
20
|
const {
|
21
21
|
initialValue = [{
|
22
|
-
type: 'paragraph',
|
22
|
+
type: 'paragraph',
|
23
|
+
children: [{ text: '' }],
|
23
24
|
}],
|
24
25
|
onBeforeInput,
|
25
26
|
withOverride = (editor: Editor) => editor,
|
@@ -61,7 +62,7 @@ export default function MarkdownShortcuts(props: MarkdownShortcutsProps) {
|
|
61
62
|
onValueChange={onValueChange}
|
62
63
|
>
|
63
64
|
<Editable
|
64
|
-
className=
|
65
|
+
className="smart-docx-editor"
|
65
66
|
renderElement={renderElement}
|
66
67
|
renderLeaf={renderLeaf}
|
67
68
|
onDOMBeforeInput={handleDOMBeforeInput}
|
@@ -1,39 +1,39 @@
|
|
1
|
-
import { BaseEditor, BaseRange, Descendant } from
|
2
|
-
import { ReactEditor } from
|
3
|
-
import { HistoryEditor } from 'slate-history'
|
1
|
+
import type { BaseEditor, BaseRange, Descendant } from 'slate';
|
2
|
+
import type { ReactEditor } from 'slate-react';
|
3
|
+
import type { HistoryEditor } from 'slate-history';
|
4
4
|
|
5
5
|
/** 段落节点 */
|
6
|
-
export
|
7
|
-
type: 'paragraph'
|
8
|
-
align?: string
|
9
|
-
children: Descendant[]
|
10
|
-
}
|
6
|
+
export interface ParagraphElement {
|
7
|
+
type: 'paragraph';
|
8
|
+
align?: string;
|
9
|
+
children: Descendant[];
|
10
|
+
};
|
11
11
|
|
12
12
|
/** 标题节点 - H1 ~ H6 */
|
13
|
-
export
|
14
|
-
type: 'heading'
|
15
|
-
level: string
|
16
|
-
children: Descendant[]
|
17
|
-
}
|
13
|
+
export interface HeadingElement {
|
14
|
+
type: 'heading';
|
15
|
+
level: string;
|
16
|
+
children: Descendant[];
|
17
|
+
};
|
18
18
|
|
19
19
|
/** 引用节点 */
|
20
|
-
export
|
21
|
-
type: 'blockquote'
|
22
|
-
children: Descendant[]
|
23
|
-
}
|
20
|
+
export interface BlockquoteElement {
|
21
|
+
type: 'blockquote';
|
22
|
+
children: Descendant[];
|
23
|
+
};
|
24
24
|
|
25
25
|
/** 列表节点 */
|
26
|
-
export
|
27
|
-
type: 'list'
|
26
|
+
export interface ListElement {
|
27
|
+
type: 'list';
|
28
28
|
/** 是否为有序列表 */
|
29
|
-
ordered?: boolean
|
30
|
-
children: Descendant[]
|
31
|
-
}
|
29
|
+
ordered?: boolean;
|
30
|
+
children: Descendant[];
|
31
|
+
};
|
32
32
|
/** 列表项节点 */
|
33
|
-
export
|
34
|
-
type: 'list-item'
|
35
|
-
children: Descendant[]
|
36
|
-
}
|
33
|
+
export interface ListItemElement {
|
34
|
+
type: 'list-item';
|
35
|
+
children: Descendant[];
|
36
|
+
};
|
37
37
|
|
38
38
|
/** 所有自定义节点 */
|
39
39
|
type CustomElement = ParagraphElement |
|
@@ -43,27 +43,27 @@ type CustomElement = ParagraphElement |
|
|
43
43
|
ListItemElement;
|
44
44
|
|
45
45
|
/** 文本节点 */
|
46
|
-
|
47
|
-
bold?: boolean
|
48
|
-
italic?: boolean
|
49
|
-
del?: boolean
|
50
|
-
underline?: boolean
|
51
|
-
code?: boolean
|
52
|
-
text: string
|
53
|
-
}
|
46
|
+
interface CustomText {
|
47
|
+
bold?: boolean;
|
48
|
+
italic?: boolean;
|
49
|
+
del?: boolean;
|
50
|
+
underline?: boolean;
|
51
|
+
code?: boolean;
|
52
|
+
text: string;
|
53
|
+
};
|
54
54
|
|
55
55
|
/** 扩展的编辑器类型 */
|
56
56
|
type CustomEditor = BaseEditor & ReactEditor & HistoryEditor & {
|
57
|
-
nodeToDecorations?: Map<Element, Range[]
|
58
|
-
}
|
57
|
+
nodeToDecorations?: Map<Element, Range[]>;
|
58
|
+
};
|
59
59
|
|
60
60
|
declare module 'slate' {
|
61
61
|
interface CustomTypes {
|
62
|
-
Editor: CustomEditor
|
63
|
-
Element: CustomElement
|
64
|
-
Text: CustomText
|
62
|
+
Editor: CustomEditor;
|
63
|
+
Element: CustomElement;
|
64
|
+
Text: CustomText;
|
65
65
|
Range: BaseRange & {
|
66
|
-
[key: string]: unknown
|
67
|
-
}
|
66
|
+
[key: string]: unknown;
|
67
|
+
};
|
68
68
|
}
|
69
|
-
}
|
69
|
+
}
|
@@ -60,12 +60,12 @@
|
|
60
60
|
await until(() => fastestCDN.isSuccess).toBeTruthy();
|
61
61
|
|
62
62
|
loader.config({
|
63
|
-
|
63
|
+
'vs/nls': {
|
64
64
|
availableLanguages: {
|
65
65
|
'*': 'zh-cn',
|
66
66
|
},
|
67
67
|
},
|
68
|
-
|
68
|
+
'paths': {
|
69
69
|
vs: `${fastestCDN.response}/min/vs`,
|
70
70
|
},
|
71
71
|
});
|
@@ -31,8 +31,8 @@ defineCustomElements(tag, VueCustomElement);
|
|
31
31
|
|
32
32
|
// 暴露组件类型
|
33
33
|
export type SmartUploadElement = typeof VueCustomElement & {
|
34
|
-
getUploadRef: () => UploadRef
|
35
|
-
getFileList: () => UploadFileInfo[]
|
36
|
-
submit: UploadRef['submit']
|
37
|
-
clear: UploadRef['clear']
|
34
|
+
getUploadRef: () => UploadRef;
|
35
|
+
getFileList: () => UploadFileInfo[];
|
36
|
+
submit: UploadRef['submit'];
|
37
|
+
clear: UploadRef['clear'];
|
38
38
|
};
|
@@ -3,34 +3,34 @@ import type { UploadProps } from 'naive-ui';
|
|
3
3
|
|
4
4
|
export interface Props {
|
5
5
|
/** 发起请求前的钩子, 用于修改请求配置 */
|
6
|
-
beforeUpload?: <T extends AxiosRequestConfig>(config: T) => T
|
6
|
+
beforeUpload?: <T extends AxiosRequestConfig>(config: T) => T;
|
7
7
|
|
8
8
|
/* ------------------ 以下为 NaiveUI 上传组件原有 Props ------------------ */
|
9
9
|
|
10
|
-
accept?: UploadProps['accept']
|
11
|
-
defaultFileList?: UploadProps['defaultFileList']
|
12
|
-
defaultUpload?: UploadProps['defaultUpload']
|
13
|
-
disabled?: UploadProps['disabled']
|
14
|
-
directory?: UploadProps['directory']
|
15
|
-
directoryDnd: UploadProps['directoryDnd']
|
16
|
-
fileListClass?: UploadProps['fileListClass']
|
17
|
-
fileListStyle?: UploadProps['fileListStyle']
|
18
|
-
imageGroupProps?: UploadProps['imageGroupProps']
|
19
|
-
inputProps?: UploadProps['inputProps']
|
20
|
-
listType?: UploadProps['listType']
|
21
|
-
max?: UploadProps['max']
|
22
|
-
multiple?: UploadProps['multiple']
|
23
|
-
renderIcon?: UploadProps['renderIcon']
|
24
|
-
shouldUseThumbnailUrl?: UploadProps['shouldUseThumbnailUrl']
|
25
|
-
showCancelButton?: UploadProps['showCancelButton']
|
26
|
-
showDownloadButton?: UploadProps['showDownloadButton']
|
27
|
-
showRemoveButton?: UploadProps['showRemoveButton']
|
28
|
-
showRetryButton?: UploadProps['showRetryButton']
|
29
|
-
showFileList?: UploadProps['showFileList']
|
30
|
-
showPreviewButton?: UploadProps['showPreviewButton']
|
31
|
-
showTrigger?: UploadProps['showTrigger']
|
32
|
-
triggerClass?: UploadProps['triggerClass']
|
33
|
-
triggerStyle?: UploadProps['triggerStyle']
|
34
|
-
onError?: UploadProps['onError']
|
35
|
-
onFinish?: UploadProps['onFinish']
|
10
|
+
accept?: UploadProps['accept'];
|
11
|
+
defaultFileList?: UploadProps['defaultFileList'];
|
12
|
+
defaultUpload?: UploadProps['defaultUpload'];
|
13
|
+
disabled?: UploadProps['disabled'];
|
14
|
+
directory?: UploadProps['directory'];
|
15
|
+
directoryDnd: UploadProps['directoryDnd'];
|
16
|
+
fileListClass?: UploadProps['fileListClass'];
|
17
|
+
fileListStyle?: UploadProps['fileListStyle'];
|
18
|
+
imageGroupProps?: UploadProps['imageGroupProps'];
|
19
|
+
inputProps?: UploadProps['inputProps'];
|
20
|
+
listType?: UploadProps['listType'];
|
21
|
+
max?: UploadProps['max'];
|
22
|
+
multiple?: UploadProps['multiple'];
|
23
|
+
renderIcon?: UploadProps['renderIcon'];
|
24
|
+
shouldUseThumbnailUrl?: UploadProps['shouldUseThumbnailUrl'];
|
25
|
+
showCancelButton?: UploadProps['showCancelButton'];
|
26
|
+
showDownloadButton?: UploadProps['showDownloadButton'];
|
27
|
+
showRemoveButton?: UploadProps['showRemoveButton'];
|
28
|
+
showRetryButton?: UploadProps['showRetryButton'];
|
29
|
+
showFileList?: UploadProps['showFileList'];
|
30
|
+
showPreviewButton?: UploadProps['showPreviewButton'];
|
31
|
+
showTrigger?: UploadProps['showTrigger'];
|
32
|
+
triggerClass?: UploadProps['triggerClass'];
|
33
|
+
triggerStyle?: UploadProps['triggerStyle'];
|
34
|
+
onError?: UploadProps['onError'];
|
35
|
+
onFinish?: UploadProps['onFinish'];
|
36
36
|
};
|
package/types/auto-imports.d.ts
CHANGED
@@ -180,6 +180,7 @@ declare global {
|
|
180
180
|
const useFavicon: typeof import('@vueuse/core')['useFavicon']
|
181
181
|
const useFetch: typeof import('@vueuse/core')['useFetch']
|
182
182
|
const useFileDialog: typeof import('@vueuse/core')['useFileDialog']
|
183
|
+
const useFileReader: typeof import('@mixte/use')['useFileReader']
|
183
184
|
const useFileSystemAccess: typeof import('@vueuse/core')['useFileSystemAccess']
|
184
185
|
const useFloor: typeof import('@vueuse/math')['useFloor']
|
185
186
|
const useFocus: typeof import('@vueuse/core')['useFocus']
|
@@ -507,6 +508,7 @@ declare module 'vue' {
|
|
507
508
|
readonly useFavicon: UnwrapRef<typeof import('@vueuse/core')['useFavicon']>
|
508
509
|
readonly useFetch: UnwrapRef<typeof import('@vueuse/core')['useFetch']>
|
509
510
|
readonly useFileDialog: UnwrapRef<typeof import('@vueuse/core')['useFileDialog']>
|
511
|
+
readonly useFileReader: UnwrapRef<typeof import('@mixte/use')['useFileReader']>
|
510
512
|
readonly useFileSystemAccess: UnwrapRef<typeof import('@vueuse/core')['useFileSystemAccess']>
|
511
513
|
readonly useFloor: UnwrapRef<typeof import('@vueuse/math')['useFloor']>
|
512
514
|
readonly useFocus: UnwrapRef<typeof import('@vueuse/core')['useFocus']>
|
@@ -827,6 +829,7 @@ declare module '@vue/runtime-core' {
|
|
827
829
|
readonly useFavicon: UnwrapRef<typeof import('@vueuse/core')['useFavicon']>
|
828
830
|
readonly useFetch: UnwrapRef<typeof import('@vueuse/core')['useFetch']>
|
829
831
|
readonly useFileDialog: UnwrapRef<typeof import('@vueuse/core')['useFileDialog']>
|
832
|
+
readonly useFileReader: UnwrapRef<typeof import('@mixte/use')['useFileReader']>
|
830
833
|
readonly useFileSystemAccess: UnwrapRef<typeof import('@vueuse/core')['useFileSystemAccess']>
|
831
834
|
readonly useFloor: UnwrapRef<typeof import('@vueuse/math')['useFloor']>
|
832
835
|
readonly useFocus: UnwrapRef<typeof import('@vueuse/core')['useFocus']>
|
package/types/components.d.ts
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
/* eslint-disable */
|
2
|
-
/* prettier-ignore */
|
3
2
|
// @ts-nocheck
|
4
3
|
// Generated by unplugin-vue-components
|
5
4
|
// Read more: https://github.com/vuejs/core/pull/3399
|
6
5
|
export {}
|
7
6
|
|
7
|
+
/* prettier-ignore */
|
8
8
|
declare module 'vue' {
|
9
9
|
export interface GlobalComponents {
|
10
10
|
Logo: typeof import('./../src/components/Logo/index.vue')['default']
|
package/types/env.d.ts
CHANGED
package/types/shims.d.ts
CHANGED
package/vite.config.ts
CHANGED