adtec-core-package 3.2.2 → 3.2.4
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/package.json +1 -1
- package/src/api/workflow/workflowInstApi.ts +2 -2
- package/src/components/RichTextEditor/RichTextEditor.vue +33 -2
- package/src/components/editor-main/src/components/toolbar/index.vue +13 -8
- package/src/components/upload/OfficePreview.vue +11 -1
- package/src/components/upload/OfficePreviewHeaderBar.vue +12 -2
- package/src/components/workflow/components/SelectReturnActivityDialog.vue +5 -2
- package/src/config/VxeTableConfig.ts +18 -6
- package/src/interface/workflow/IWfTaskAskVo.ts +2 -0
- package/vite/umoCjsVirtual.ts +32 -13
- package/vite/umoIntegration.js +51 -16
- package/vite/umoIntegration.ts +20 -1
package/package.json
CHANGED
|
@@ -34,8 +34,8 @@ export default {
|
|
|
34
34
|
return request.post<IWfTaskVo>(baseUrl + '/taskReject', task)
|
|
35
35
|
},
|
|
36
36
|
//查询可回退环节
|
|
37
|
-
findReturnTaskList(taskId: string) {
|
|
38
|
-
return request.post<IWfReturnNodeVo[]>(baseUrl + '/findReturnTaskList', { taskId })
|
|
37
|
+
findReturnTaskList(taskId: string, ignoreBackNodes = false) {
|
|
38
|
+
return request.post<IWfReturnNodeVo[]>(baseUrl + '/findReturnTaskList', { taskId, ignoreBackNodes })
|
|
39
39
|
},
|
|
40
40
|
//回退任务
|
|
41
41
|
taskReturn(activity: IWfTaskAskVo) {
|
|
@@ -644,10 +644,41 @@ onUnmounted(() => {
|
|
|
644
644
|
min-width: 0;
|
|
645
645
|
}
|
|
646
646
|
|
|
647
|
+
/* classic 模式:切换工具栏固定右上角(与 ribbon 图二一致) */
|
|
648
|
+
:deep(.umo-toolbar-actions-classic) {
|
|
649
|
+
position: absolute;
|
|
650
|
+
right: 5px;
|
|
651
|
+
top: 6px;
|
|
652
|
+
z-index: 10;
|
|
653
|
+
border-radius: 6px;
|
|
654
|
+
background-color: var(--umo-color-white, #fff);
|
|
655
|
+
box-shadow:
|
|
656
|
+
0 0 0 1px hsla(0, 0%, 5%, 0.04),
|
|
657
|
+
0 2px 5px hsla(0, 0%, 5%, 0.06);
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
:deep(.toolbar-classic .umo-scrollable-container) {
|
|
661
|
+
padding-right: 108px;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
:deep(.umo-scrollable-content) {
|
|
665
|
+
overflow-x: hidden;
|
|
666
|
+
overflow-y: hidden;
|
|
667
|
+
scrollbar-width: none;
|
|
668
|
+
-ms-overflow-style: none;
|
|
669
|
+
|
|
670
|
+
&::-webkit-scrollbar {
|
|
671
|
+
display: none;
|
|
672
|
+
width: 0;
|
|
673
|
+
height: 0;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
|
|
647
677
|
:deep(.umo-classic-menu),
|
|
648
678
|
:deep(.umo-virtual-group) {
|
|
649
|
-
flex-wrap:
|
|
650
|
-
|
|
679
|
+
flex-wrap: wrap;
|
|
680
|
+
row-gap: 4px;
|
|
681
|
+
white-space: normal;
|
|
651
682
|
}
|
|
652
683
|
|
|
653
684
|
:deep(.umo-button__text),
|
|
@@ -250,10 +250,12 @@ const setContentFromCache = () => {
|
|
|
250
250
|
padding: 6px 10px;
|
|
251
251
|
display: flex;
|
|
252
252
|
align-items: center;
|
|
253
|
-
&-ribbon
|
|
253
|
+
&-ribbon,
|
|
254
|
+
&-classic {
|
|
254
255
|
position: absolute;
|
|
255
256
|
right: 0;
|
|
256
257
|
top: 1px;
|
|
258
|
+
z-index: 10;
|
|
257
259
|
}
|
|
258
260
|
&-button {
|
|
259
261
|
&.active {
|
|
@@ -337,9 +339,18 @@ const setContentFromCache = () => {
|
|
|
337
339
|
|
|
338
340
|
<style lang="less">
|
|
339
341
|
.umo-skin-modern {
|
|
342
|
+
&.toolbar-classic,
|
|
343
|
+
&.toolbar-ribbon {
|
|
344
|
+
.umo-toolbar-actions {
|
|
345
|
+
right: 5px !important;
|
|
346
|
+
top: 6px !important;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
340
349
|
&.toolbar-classic {
|
|
350
|
+
.umo-scrollable-container {
|
|
351
|
+
padding-right: 108px;
|
|
352
|
+
}
|
|
341
353
|
.umo-toolbar-actions {
|
|
342
|
-
margin: 15px 15px 2px 0;
|
|
343
354
|
border-radius: 6px;
|
|
344
355
|
background-color: var(--umo-color-white);
|
|
345
356
|
box-shadow:
|
|
@@ -352,12 +363,6 @@ const setContentFromCache = () => {
|
|
|
352
363
|
}
|
|
353
364
|
}
|
|
354
365
|
}
|
|
355
|
-
&.toolbar-ribbon {
|
|
356
|
-
.umo-toolbar-actions {
|
|
357
|
-
right: 5px !important;
|
|
358
|
-
top: 6px !important;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
366
|
}
|
|
362
367
|
[theme-mode='dark'] .umo-skin-modern {
|
|
363
368
|
&.toolbar-classic {
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
:show-close="showClose"
|
|
20
20
|
:fullscreen="fullscreen"
|
|
21
21
|
:download-loading="downloadLoading"
|
|
22
|
+
:refresh-loading="refreshLoading"
|
|
22
23
|
:min-zoom="MIN_OFFICE_ZOOM"
|
|
23
24
|
:max-zoom="MAX_RICH_PREVIEW_ZOOM"
|
|
24
25
|
@zoom-in="zoomIn"
|
|
@@ -71,7 +72,14 @@
|
|
|
71
72
|
@error="handleError"
|
|
72
73
|
@page-change="previewCurrentPage = $event"
|
|
73
74
|
/>
|
|
74
|
-
<div v-if="
|
|
75
|
+
<div v-if="refreshLoading" class="office-rich-loading">
|
|
76
|
+
<div class="loading-card">
|
|
77
|
+
<span class="loading-spinner" />
|
|
78
|
+
<p class="loading-title">正在重新生成附件,请稍候…</p>
|
|
79
|
+
<p v-if="headerTitle" class="loading-sub">{{ headerTitle }}</p>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
<div v-else-if="isPreviewLoading && !fileSrc" class="office-rich-loading">
|
|
75
83
|
<div class="loading-card">
|
|
76
84
|
<span class="loading-spinner" />
|
|
77
85
|
<p class="loading-title">{{ loadingMessage }}</p>
|
|
@@ -128,6 +136,7 @@ const props = withDefaults(
|
|
|
128
136
|
showClose?: boolean
|
|
129
137
|
fullscreen?: boolean
|
|
130
138
|
downloadLoading?: boolean
|
|
139
|
+
refreshLoading?: boolean
|
|
131
140
|
}>(),
|
|
132
141
|
{
|
|
133
142
|
showHeader: true,
|
|
@@ -140,6 +149,7 @@ const props = withDefaults(
|
|
|
140
149
|
showClose: false,
|
|
141
150
|
fullscreen: false,
|
|
142
151
|
downloadLoading: false,
|
|
152
|
+
refreshLoading: false,
|
|
143
153
|
},
|
|
144
154
|
)
|
|
145
155
|
|
|
@@ -80,8 +80,16 @@
|
|
|
80
80
|
<el-icon v-else><Download /></el-icon>
|
|
81
81
|
</button>
|
|
82
82
|
|
|
83
|
-
<button
|
|
84
|
-
|
|
83
|
+
<button
|
|
84
|
+
v-if="showRefresh"
|
|
85
|
+
class="toolbar-btn"
|
|
86
|
+
type="button"
|
|
87
|
+
title="刷新附件"
|
|
88
|
+
:disabled="refreshLoading"
|
|
89
|
+
@click="emit('refresh')"
|
|
90
|
+
>
|
|
91
|
+
<el-icon v-if="refreshLoading" class="is-loading"><Loading /></el-icon>
|
|
92
|
+
<el-icon v-else><Refresh /></el-icon>
|
|
85
93
|
</button>
|
|
86
94
|
|
|
87
95
|
<button
|
|
@@ -145,6 +153,7 @@ const props = withDefaults(
|
|
|
145
153
|
showClose?: boolean
|
|
146
154
|
fullscreen?: boolean
|
|
147
155
|
downloadLoading?: boolean
|
|
156
|
+
refreshLoading?: boolean
|
|
148
157
|
minZoom?: number
|
|
149
158
|
maxZoom?: number
|
|
150
159
|
}>(),
|
|
@@ -165,6 +174,7 @@ const props = withDefaults(
|
|
|
165
174
|
showClose: false,
|
|
166
175
|
fullscreen: false,
|
|
167
176
|
downloadLoading: false,
|
|
177
|
+
refreshLoading: false,
|
|
168
178
|
minZoom: MIN_OFFICE_ZOOM,
|
|
169
179
|
maxZoom: MAX_PDF_ZOOM,
|
|
170
180
|
},
|
|
@@ -49,14 +49,16 @@ const loading = ref(false)
|
|
|
49
49
|
const selectActivity = ref<string>('')
|
|
50
50
|
const taskId = ref<string>('')
|
|
51
51
|
const comment = ref<string>('')
|
|
52
|
-
const
|
|
52
|
+
const ignoreBackNodes = ref(false)
|
|
53
|
+
const open = async (tId: string, c: string, ignoreBackNodesFlag = false) => {
|
|
53
54
|
try {
|
|
54
55
|
selectActivity.value = ''
|
|
55
56
|
taskId.value = tId ?? ''
|
|
56
57
|
comment.value = c ?? ''
|
|
58
|
+
ignoreBackNodes.value = ignoreBackNodesFlag
|
|
57
59
|
dialogVisible.value = true
|
|
58
60
|
loading.value = true
|
|
59
|
-
data.value = await workflowInstApi.findReturnTaskList(tId)
|
|
61
|
+
data.value = await workflowInstApi.findReturnTaskList(tId, ignoreBackNodesFlag)
|
|
60
62
|
} catch (err: any) {
|
|
61
63
|
data.value = []
|
|
62
64
|
frameworkUtils.messageError(err)
|
|
@@ -76,6 +78,7 @@ const save = async () => {
|
|
|
76
78
|
userId: userInfoStore().getUserInfo.id,
|
|
77
79
|
comment: comment.value,
|
|
78
80
|
targetKey: selectActivity.value,
|
|
81
|
+
ignoreBackNodes: ignoreBackNodes.value,
|
|
79
82
|
})
|
|
80
83
|
ElMessage.success('回退成功')
|
|
81
84
|
emit('success')
|
|
@@ -6,12 +6,10 @@ import {
|
|
|
6
6
|
|
|
7
7
|
import VxeUIPluginRenderElement from '@vxe-ui/plugin-render-element'
|
|
8
8
|
import '@vxe-ui/plugin-render-element/dist/style.css'
|
|
9
|
-
import VxeUIPluginExportXLSX from '@vxe-ui/plugin-export-xlsx'
|
|
10
9
|
import 'vxe-pc-ui/lib/style.css'
|
|
11
10
|
import '../css/vxeTableUI/all.scss'
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import zhCN from 'vxe-table/lib/locale/lang/zh-CN'
|
|
11
|
+
// 导入默认的语言(使用 es 构建,避免 lib CJS 在 Vite 下无 default 导出)
|
|
12
|
+
import zhCN from 'vxe-table/es/locale/lang/zh-CN'
|
|
15
13
|
|
|
16
14
|
/**
|
|
17
15
|
* 局部初始化 vxe-table 插件与配置
|
|
@@ -28,12 +26,26 @@ export function initVxeTableInPage(
|
|
|
28
26
|
// 局部注册插件
|
|
29
27
|
enableElementPlus && VxeUI.use(VxeUIPluginRenderElement)
|
|
30
28
|
if (enableExcel) {
|
|
31
|
-
void
|
|
29
|
+
void Promise.all([
|
|
30
|
+
import('exceljs'),
|
|
31
|
+
import('@vxe-ui/plugin-export-xlsx'),
|
|
32
|
+
]).then(([{ default: ExcelJS }, xlsxModule]) => {
|
|
33
|
+
const VxeUIPluginExportXLSX =
|
|
34
|
+
xlsxModule.default ??
|
|
35
|
+
(xlsxModule as { VxeUIPluginExportXLSX?: typeof xlsxModule.default }).VxeUIPluginExportXLSX ??
|
|
36
|
+
xlsxModule
|
|
32
37
|
VxeUI.use(VxeUIPluginExportXLSX, { ExcelJS })
|
|
33
38
|
})
|
|
34
39
|
}
|
|
35
40
|
if (enablePdf) {
|
|
36
|
-
void
|
|
41
|
+
void Promise.all([
|
|
42
|
+
import('jspdf'),
|
|
43
|
+
import('@vxe-ui/plugin-export-pdf'),
|
|
44
|
+
]).then(([{ jsPDF }, pdfModule]) => {
|
|
45
|
+
const VxeUIPluginExportPDF =
|
|
46
|
+
pdfModule.default ??
|
|
47
|
+
(pdfModule as { VxeUIPluginExportPDF?: typeof pdfModule.default }).VxeUIPluginExportPDF ??
|
|
48
|
+
pdfModule
|
|
37
49
|
VxeUI.use(VxeUIPluginExportPDF, { jsPDF })
|
|
38
50
|
})
|
|
39
51
|
}
|
package/vite/umoCjsVirtual.ts
CHANGED
|
@@ -23,15 +23,36 @@ const UMO_CJS_SPECS = [
|
|
|
23
23
|
'nzh/cn',
|
|
24
24
|
'jszip',
|
|
25
25
|
'exceljs',
|
|
26
|
+
'@vxe-ui/plugin-render-element',
|
|
27
|
+
'@vxe-ui/plugin-export-xlsx',
|
|
28
|
+
'@vxe-ui/plugin-export-pdf',
|
|
26
29
|
] as const
|
|
27
30
|
|
|
28
31
|
const UMO_CJS_NAMED_EXPORTS: Record<string, string[]> = {
|
|
29
32
|
'file-saver': ['saveAs'],
|
|
30
33
|
'pure-svg-code': ['qrcode', 'barcode', 'svg2url'],
|
|
34
|
+
'@vxe-ui/plugin-render-element': ['VxeUIPluginRenderElement'],
|
|
35
|
+
'@vxe-ui/plugin-export-xlsx': ['VxeUIPluginExportXLSX'],
|
|
36
|
+
'@vxe-ui/plugin-export-pdf': ['VxeUIPluginExportPDF'],
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
const VIRTUAL_UMO_CJS_PREFIX = '\0virtual:umo-cjs:'
|
|
34
40
|
|
|
41
|
+
function parseNpmSpec(spec: string): { pkgName: string; subPath: string | null } {
|
|
42
|
+
if (spec.startsWith('@')) {
|
|
43
|
+
const parts = spec.split('/')
|
|
44
|
+
if (parts.length >= 2) {
|
|
45
|
+
return {
|
|
46
|
+
pkgName: `${parts[0]}/${parts[1]}`,
|
|
47
|
+
subPath: parts.length > 2 ? parts.slice(2).join('/') : null,
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const slashIndex = spec.indexOf('/')
|
|
52
|
+
if (slashIndex === -1) return { pkgName: spec, subPath: null }
|
|
53
|
+
return { pkgName: spec.slice(0, slashIndex), subPath: spec.slice(slashIndex + 1) }
|
|
54
|
+
}
|
|
55
|
+
|
|
35
56
|
function requireFromProjectRoot() {
|
|
36
57
|
return createRequire(path.join(getProjectRoot(), 'package.json'))
|
|
37
58
|
}
|
|
@@ -58,7 +79,7 @@ function resolvePackageMain(pkgDir: string): string | null {
|
|
|
58
79
|
|
|
59
80
|
function findUmoPackageDir(pkgName: string): string | null {
|
|
60
81
|
const projectRoot = getProjectRoot()
|
|
61
|
-
const hoisted = path.join(projectRoot, 'node_modules', pkgName)
|
|
82
|
+
const hoisted = path.join(projectRoot, 'node_modules', ...pkgName.split('/'))
|
|
62
83
|
if (fs.existsSync(path.join(hoisted, 'package.json'))) return hoisted
|
|
63
84
|
|
|
64
85
|
const pnpmDir = path.join(projectRoot, 'node_modules/.pnpm')
|
|
@@ -68,16 +89,16 @@ function findUmoPackageDir(pkgName: string): string | null {
|
|
|
68
89
|
const pkgDir = fs.readdirSync(pnpmDir).find((name) => name.startsWith(`${pnpmPrefix}@`))
|
|
69
90
|
if (!pkgDir) return null
|
|
70
91
|
|
|
71
|
-
const resolved = path.join(pnpmDir, pkgDir, 'node_modules', pkgName)
|
|
92
|
+
const resolved = path.join(pnpmDir, pkgDir, 'node_modules', ...pkgName.split('/'))
|
|
72
93
|
return fs.existsSync(path.join(resolved, 'package.json')) ? resolved : null
|
|
73
94
|
}
|
|
74
95
|
|
|
75
96
|
function findUmoPackageEntryForSpec(spec: string): string | null {
|
|
76
|
-
const
|
|
97
|
+
const { pkgName, subPath } = parseNpmSpec(spec)
|
|
77
98
|
const pkgDir = findUmoPackageDir(pkgName)
|
|
78
99
|
if (!pkgDir) return null
|
|
79
100
|
|
|
80
|
-
if (
|
|
101
|
+
if (!subPath) {
|
|
81
102
|
const override = UMO_CJS_ENTRY_OVERRIDES[pkgName]
|
|
82
103
|
if (override) {
|
|
83
104
|
const overridePath = path.join(pkgDir, override)
|
|
@@ -88,11 +109,10 @@ function findUmoPackageEntryForSpec(spec: string): string | null {
|
|
|
88
109
|
return resolvePackageMain(pkgDir)
|
|
89
110
|
}
|
|
90
111
|
|
|
91
|
-
const sub = subParts.join('/')
|
|
92
112
|
const candidates = [
|
|
93
|
-
path.join(pkgDir, `${
|
|
94
|
-
path.join(pkgDir,
|
|
95
|
-
path.join(pkgDir,
|
|
113
|
+
path.join(pkgDir, `${subPath}.js`),
|
|
114
|
+
path.join(pkgDir, subPath, 'index.js'),
|
|
115
|
+
path.join(pkgDir, subPath),
|
|
96
116
|
]
|
|
97
117
|
for (const candidate of candidates) {
|
|
98
118
|
if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) return candidate
|
|
@@ -102,13 +122,12 @@ function findUmoPackageEntryForSpec(spec: string): string | null {
|
|
|
102
122
|
}
|
|
103
123
|
|
|
104
124
|
function matchesUmoCjsFile(source: string, spec: string): boolean {
|
|
105
|
-
const
|
|
106
|
-
if (!source.includes(`/${
|
|
107
|
-
if (
|
|
125
|
+
const { pkgName, subPath } = parseNpmSpec(spec)
|
|
126
|
+
if (!source.includes(`/${pkgName}/`)) return false
|
|
127
|
+
if (!subPath) {
|
|
108
128
|
return source.endsWith('.js') || source.includes('.js?')
|
|
109
129
|
}
|
|
110
|
-
|
|
111
|
-
return source.includes(`/${pkg}/${subPath}.js`) || source.includes(`/${pkg}/${subPath}?`)
|
|
130
|
+
return source.includes(`/${subPath}.js`) || source.includes(`/${subPath}?`)
|
|
112
131
|
}
|
|
113
132
|
|
|
114
133
|
function augmentUmoCjsNamedExports(code: string, spec: string): string {
|
package/vite/umoIntegration.js
CHANGED
|
@@ -448,13 +448,33 @@ var UMO_CJS_SPECS = [
|
|
|
448
448
|
"pure-svg-code",
|
|
449
449
|
"nzh/cn",
|
|
450
450
|
"jszip",
|
|
451
|
-
"exceljs"
|
|
451
|
+
"exceljs",
|
|
452
|
+
"@vxe-ui/plugin-render-element",
|
|
453
|
+
"@vxe-ui/plugin-export-xlsx",
|
|
454
|
+
"@vxe-ui/plugin-export-pdf"
|
|
452
455
|
];
|
|
453
456
|
var UMO_CJS_NAMED_EXPORTS = {
|
|
454
457
|
"file-saver": ["saveAs"],
|
|
455
|
-
"pure-svg-code": ["qrcode", "barcode", "svg2url"]
|
|
458
|
+
"pure-svg-code": ["qrcode", "barcode", "svg2url"],
|
|
459
|
+
"@vxe-ui/plugin-render-element": ["VxeUIPluginRenderElement"],
|
|
460
|
+
"@vxe-ui/plugin-export-xlsx": ["VxeUIPluginExportXLSX"],
|
|
461
|
+
"@vxe-ui/plugin-export-pdf": ["VxeUIPluginExportPDF"]
|
|
456
462
|
};
|
|
457
463
|
var VIRTUAL_UMO_CJS_PREFIX = "\0virtual:umo-cjs:";
|
|
464
|
+
function parseNpmSpec(spec) {
|
|
465
|
+
if (spec.startsWith("@")) {
|
|
466
|
+
const parts = spec.split("/");
|
|
467
|
+
if (parts.length >= 2) {
|
|
468
|
+
return {
|
|
469
|
+
pkgName: `${parts[0]}/${parts[1]}`,
|
|
470
|
+
subPath: parts.length > 2 ? parts.slice(2).join("/") : null
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
const slashIndex = spec.indexOf("/");
|
|
475
|
+
if (slashIndex === -1) return { pkgName: spec, subPath: null };
|
|
476
|
+
return { pkgName: spec.slice(0, slashIndex), subPath: spec.slice(slashIndex + 1) };
|
|
477
|
+
}
|
|
458
478
|
function requireFromProjectRoot() {
|
|
459
479
|
return createRequire4(path4.join(getProjectRoot(), "package.json"));
|
|
460
480
|
}
|
|
@@ -475,21 +495,21 @@ function resolvePackageMain(pkgDir) {
|
|
|
475
495
|
}
|
|
476
496
|
function findUmoPackageDir(pkgName) {
|
|
477
497
|
const projectRoot2 = getProjectRoot();
|
|
478
|
-
const hoisted = path4.join(projectRoot2, "node_modules", pkgName);
|
|
498
|
+
const hoisted = path4.join(projectRoot2, "node_modules", ...pkgName.split("/"));
|
|
479
499
|
if (fs5.existsSync(path4.join(hoisted, "package.json"))) return hoisted;
|
|
480
500
|
const pnpmDir = path4.join(projectRoot2, "node_modules/.pnpm");
|
|
481
501
|
if (!fs5.existsSync(pnpmDir)) return null;
|
|
482
502
|
const pnpmPrefix = pkgName.replace("/", "+");
|
|
483
503
|
const pkgDir = fs5.readdirSync(pnpmDir).find((name) => name.startsWith(`${pnpmPrefix}@`));
|
|
484
504
|
if (!pkgDir) return null;
|
|
485
|
-
const resolved = path4.join(pnpmDir, pkgDir, "node_modules", pkgName);
|
|
505
|
+
const resolved = path4.join(pnpmDir, pkgDir, "node_modules", ...pkgName.split("/"));
|
|
486
506
|
return fs5.existsSync(path4.join(resolved, "package.json")) ? resolved : null;
|
|
487
507
|
}
|
|
488
508
|
function findUmoPackageEntryForSpec(spec) {
|
|
489
|
-
const
|
|
509
|
+
const { pkgName, subPath } = parseNpmSpec(spec);
|
|
490
510
|
const pkgDir = findUmoPackageDir(pkgName);
|
|
491
511
|
if (!pkgDir) return null;
|
|
492
|
-
if (
|
|
512
|
+
if (!subPath) {
|
|
493
513
|
const override = UMO_CJS_ENTRY_OVERRIDES[pkgName];
|
|
494
514
|
if (override) {
|
|
495
515
|
const overridePath = path4.join(pkgDir, override);
|
|
@@ -499,11 +519,10 @@ function findUmoPackageEntryForSpec(spec) {
|
|
|
499
519
|
}
|
|
500
520
|
return resolvePackageMain(pkgDir);
|
|
501
521
|
}
|
|
502
|
-
const sub = subParts.join("/");
|
|
503
522
|
const candidates = [
|
|
504
|
-
path4.join(pkgDir, `${
|
|
505
|
-
path4.join(pkgDir,
|
|
506
|
-
path4.join(pkgDir,
|
|
523
|
+
path4.join(pkgDir, `${subPath}.js`),
|
|
524
|
+
path4.join(pkgDir, subPath, "index.js"),
|
|
525
|
+
path4.join(pkgDir, subPath)
|
|
507
526
|
];
|
|
508
527
|
for (const candidate of candidates) {
|
|
509
528
|
if (fs5.existsSync(candidate) && fs5.statSync(candidate).isFile()) return candidate;
|
|
@@ -511,13 +530,12 @@ function findUmoPackageEntryForSpec(spec) {
|
|
|
511
530
|
return null;
|
|
512
531
|
}
|
|
513
532
|
function matchesUmoCjsFile(source, spec) {
|
|
514
|
-
const
|
|
515
|
-
if (!source.includes(`/${
|
|
516
|
-
if (
|
|
533
|
+
const { pkgName, subPath } = parseNpmSpec(spec);
|
|
534
|
+
if (!source.includes(`/${pkgName}/`)) return false;
|
|
535
|
+
if (!subPath) {
|
|
517
536
|
return source.endsWith(".js") || source.includes(".js?");
|
|
518
537
|
}
|
|
519
|
-
|
|
520
|
-
return source.includes(`/${pkg}/${subPath}.js`) || source.includes(`/${pkg}/${subPath}?`);
|
|
538
|
+
return source.includes(`/${subPath}.js`) || source.includes(`/${subPath}?`);
|
|
521
539
|
}
|
|
522
540
|
function augmentUmoCjsNamedExports(code, spec) {
|
|
523
541
|
const named = UMO_CJS_NAMED_EXPORTS[spec] ?? UMO_CJS_NAMED_EXPORTS[spec.split("/")[0] ?? ""];
|
|
@@ -653,8 +671,24 @@ function docxPreviewViteFix() {
|
|
|
653
671
|
}
|
|
654
672
|
};
|
|
655
673
|
}
|
|
674
|
+
function coreVxeTableViteFix() {
|
|
675
|
+
return {
|
|
676
|
+
name: "core-vxe-table-vite",
|
|
677
|
+
config() {
|
|
678
|
+
return {
|
|
679
|
+
optimizeDeps: {
|
|
680
|
+
exclude: [
|
|
681
|
+
"@vxe-ui/plugin-render-element",
|
|
682
|
+
"@vxe-ui/plugin-export-xlsx",
|
|
683
|
+
"@vxe-ui/plugin-export-pdf"
|
|
684
|
+
]
|
|
685
|
+
}
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
}
|
|
656
690
|
function coreOfficePreviewVitePlugins() {
|
|
657
|
-
return [createProjectRootPlugin(), umoCjsVirtual(), docxPreviewViteFix()];
|
|
691
|
+
return [createProjectRootPlugin(), umoCjsVirtual(), docxPreviewViteFix(), coreVxeTableViteFix()];
|
|
658
692
|
}
|
|
659
693
|
function coreUmoVitePlugins() {
|
|
660
694
|
return [
|
|
@@ -663,6 +697,7 @@ function coreUmoVitePlugins() {
|
|
|
663
697
|
highlightJsLibVirtual(),
|
|
664
698
|
umoCjsVirtual(),
|
|
665
699
|
docxPreviewViteFix(),
|
|
700
|
+
coreVxeTableViteFix(),
|
|
666
701
|
tiptapUmoResolve(),
|
|
667
702
|
yjsPeerResolve()
|
|
668
703
|
];
|
package/vite/umoIntegration.ts
CHANGED
|
@@ -23,12 +23,30 @@ function docxPreviewViteFix(): Plugin {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/** vxe-ui 插件为 CJS,交由 umoCjsVirtual 转 ESM,避免 Vite 直接解析 index.common.js */
|
|
27
|
+
function coreVxeTableViteFix(): Plugin {
|
|
28
|
+
return {
|
|
29
|
+
name: 'core-vxe-table-vite',
|
|
30
|
+
config() {
|
|
31
|
+
return {
|
|
32
|
+
optimizeDeps: {
|
|
33
|
+
exclude: [
|
|
34
|
+
'@vxe-ui/plugin-render-element',
|
|
35
|
+
'@vxe-ui/plugin-export-xlsx',
|
|
36
|
+
'@vxe-ui/plugin-export-pdf',
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
26
44
|
/**
|
|
27
45
|
* 核心包 CJS 兼容(附件预览 docx-preview/jszip、表格导出 exceljs 等)在宿主 Vite 中的插件。
|
|
28
46
|
* 前端系统框架等未接入完整 Umo 插件链的宿主也应引入。
|
|
29
47
|
*/
|
|
30
48
|
export function coreOfficePreviewVitePlugins(): Plugin[] {
|
|
31
|
-
return [createProjectRootPlugin(), umoCjsVirtual(), docxPreviewViteFix()]
|
|
49
|
+
return [createProjectRootPlugin(), umoCjsVirtual(), docxPreviewViteFix(), coreVxeTableViteFix()]
|
|
32
50
|
}
|
|
33
51
|
|
|
34
52
|
/**
|
|
@@ -42,6 +60,7 @@ export function coreUmoVitePlugins(): Plugin[] {
|
|
|
42
60
|
highlightJsLibVirtual(),
|
|
43
61
|
umoCjsVirtual(),
|
|
44
62
|
docxPreviewViteFix(),
|
|
63
|
+
coreVxeTableViteFix(),
|
|
45
64
|
tiptapUmoResolve(),
|
|
46
65
|
yjsPeerResolve(),
|
|
47
66
|
]
|