adtec-core-package 3.2.0 → 3.2.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adtec-core-package",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -158,6 +158,20 @@ div:focus {
158
158
  .adtec-scrollbar-active();
159
159
  }
160
160
 
161
+ /* vxe-table 使用独立滚动条手柄,禁止全局 hover 样式作用于表格内部(含固定列) */
162
+ .vxe-table,
163
+ .vxe-table *,
164
+ .vxe-table *:hover {
165
+ .adtec-scrollbar-hidden();
166
+ }
167
+
168
+ .vxe-table:hover {
169
+ .vxe-table--scroll-x-handle,
170
+ .vxe-table--scroll-y-handle {
171
+ .adtec-vxe-scrollbar-active();
172
+ }
173
+ }
174
+
161
175
  /* 附件预览:常显滚动条,避免 hover 才出现导致“没有滚动条” */
162
176
  .pdf-js-viewer,
163
177
  .docx-js-viewer,
@@ -7,11 +7,9 @@ import {
7
7
  import VxeUIPluginRenderElement from '@vxe-ui/plugin-render-element'
8
8
  import '@vxe-ui/plugin-render-element/dist/style.css'
9
9
  import VxeUIPluginExportXLSX from '@vxe-ui/plugin-export-xlsx'
10
- import ExcelJS from 'exceljs'
11
10
  import 'vxe-pc-ui/lib/style.css'
12
11
  import '../css/vxeTableUI/all.scss'
13
12
  import VxeUIPluginExportPDF from '@vxe-ui/plugin-export-pdf'
14
- import { jsPDF } from 'jspdf'
15
13
  // 导入默认的语言
16
14
  import zhCN from 'vxe-table/lib/locale/lang/zh-CN'
17
15
 
@@ -29,8 +27,16 @@ export function initVxeTableInPage(
29
27
  VxeUI.component(VxeTooltip)
30
28
  // 局部注册插件
31
29
  enableElementPlus && VxeUI.use(VxeUIPluginRenderElement)
32
- enableExcel && VxeUI.use(VxeUIPluginExportXLSX, { ExcelJS })
33
- enablePdf && VxeUI.use(VxeUIPluginExportPDF, { jsPDF })
30
+ if (enableExcel) {
31
+ void import('exceljs').then(({ default: ExcelJS }) => {
32
+ VxeUI.use(VxeUIPluginExportXLSX, { ExcelJS })
33
+ })
34
+ }
35
+ if (enablePdf) {
36
+ void import('jspdf').then(({ jsPDF }) => {
37
+ VxeUI.use(VxeUIPluginExportPDF, { jsPDF })
38
+ })
39
+ }
34
40
 
35
41
  // 设置表格配置(可复制你在 VxeTableConfig.ts 中的配置)
36
42
  VxeUI.setConfig({
@@ -51,11 +51,20 @@
51
51
  .vxe-table--body-wrapper,
52
52
  .vxe-table--footer-wrapper,
53
53
  .vxe-table--fixed-left-body-wrapper,
54
- .vxe-table--fixed-right-body-wrapper {
54
+ .vxe-table--fixed-right-body-wrapper,
55
+ .vxe-table--fixed-left-wrapper,
56
+ .vxe-table--fixed-right-wrapper {
55
57
  overflow: hidden;
56
58
  outline: 0;
57
59
  scrollbar-width: none;
60
+ -ms-overflow-style: none;
58
61
  -webkit-overflow-scrolling: touch;
62
+
63
+ &::-webkit-scrollbar {
64
+ display: none;
65
+ width: 0;
66
+ height: 0;
67
+ }
59
68
  }
60
69
  .vxe-table--header-inner-wrapper,
61
70
  .vxe-table--body-inner-wrapper,
@@ -66,8 +75,11 @@
66
75
  scrollbar-width: none;
67
76
  -ms-overflow-style: none;
68
77
  -webkit-overflow-scrolling: touch;
78
+
69
79
  &::-webkit-scrollbar {
70
80
  display: none;
81
+ width: 0;
82
+ height: 0;
71
83
  }
72
84
  }
73
85
  .vxe-table--header-inner-wrapper,
@@ -80,7 +92,7 @@
80
92
  overflow-x: scroll;
81
93
  }
82
94
 
83
- /* vxe 表格:hover 时显示现代圆角滚动条 */
95
+ /* vxe 表格:hover 时仅在手柄上显示现代圆角滚动条(全局 index.less 已排除表格内部) */
84
96
  .vxe-table--scroll-x-handle,
85
97
  .vxe-table--scroll-y-handle {
86
98
  @include classic.adtec-scrollbar-hidden;
@@ -6,6 +6,12 @@ import { transformWithEsbuild } from 'vite'
6
6
  import type { Plugin } from 'vite'
7
7
  import { getProjectRoot } from './projectRoot'
8
8
 
9
+ const UMO_CJS_ENTRY_OVERRIDES: Record<string, string> = {
10
+ /** browser 字段会落到 min.js(无 ESM default);用完整 UMD 构建再转 ESM */
11
+ jszip: 'dist/jszip.js',
12
+ exceljs: 'dist/exceljs.js',
13
+ }
14
+
9
15
  const UMO_CJS_SPECS = [
10
16
  'dom-to-image-more',
11
17
  'hotkeys-js',
@@ -15,6 +21,8 @@ const UMO_CJS_SPECS = [
15
21
  'smooth-signature',
16
22
  'pure-svg-code',
17
23
  'nzh/cn',
24
+ 'jszip',
25
+ 'exceljs',
18
26
  ] as const
19
27
 
20
28
  const UMO_CJS_NAMED_EXPORTS: Record<string, string[]> = {
@@ -37,8 +45,15 @@ function resolvePackageMain(pkgDir: string): string | null {
37
45
  module?: string
38
46
  }
39
47
  const main = pkgJson.module || pkgJson.main || 'index.js'
40
- const entry = path.join(pkgDir, main)
41
- return fs.existsSync(entry) ? entry : null
48
+ const candidates = [
49
+ path.join(pkgDir, main),
50
+ path.join(pkgDir, `${main}.js`),
51
+ path.join(pkgDir, main, 'index.js'),
52
+ ]
53
+ for (const entry of candidates) {
54
+ if (fs.existsSync(entry) && fs.statSync(entry).isFile()) return entry
55
+ }
56
+ return null
42
57
  }
43
58
 
44
59
  function findUmoPackageDir(pkgName: string): string | null {
@@ -63,6 +78,13 @@ function findUmoPackageEntryForSpec(spec: string): string | null {
63
78
  if (!pkgDir) return null
64
79
 
65
80
  if (subParts.length === 0) {
81
+ const override = UMO_CJS_ENTRY_OVERRIDES[pkgName]
82
+ if (override) {
83
+ const overridePath = path.join(pkgDir, override)
84
+ if (fs.existsSync(overridePath) && fs.statSync(overridePath).isFile()) {
85
+ return overridePath
86
+ }
87
+ }
66
88
  return resolvePackageMain(pkgDir)
67
89
  }
68
90
 
@@ -433,6 +433,11 @@ import path4 from "node:path";
433
433
  import { createRequire as createRequire4 } from "node:module";
434
434
  import { pathToFileURL } from "node:url";
435
435
  import { transformWithEsbuild as transformWithEsbuild2 } from "vite";
436
+ var UMO_CJS_ENTRY_OVERRIDES = {
437
+ /** browser 字段会落到 min.js(无 ESM default);用完整 UMD 构建再转 ESM */
438
+ jszip: "dist/jszip.js",
439
+ exceljs: "dist/exceljs.js"
440
+ };
436
441
  var UMO_CJS_SPECS = [
437
442
  "dom-to-image-more",
438
443
  "hotkeys-js",
@@ -441,7 +446,9 @@ var UMO_CJS_SPECS = [
441
446
  "pretty-bytes",
442
447
  "smooth-signature",
443
448
  "pure-svg-code",
444
- "nzh/cn"
449
+ "nzh/cn",
450
+ "jszip",
451
+ "exceljs"
445
452
  ];
446
453
  var UMO_CJS_NAMED_EXPORTS = {
447
454
  "file-saver": ["saveAs"],
@@ -456,8 +463,15 @@ function resolvePackageMain(pkgDir) {
456
463
  if (!fs5.existsSync(pkgJsonPath)) return null;
457
464
  const pkgJson = JSON.parse(fs5.readFileSync(pkgJsonPath, "utf-8"));
458
465
  const main = pkgJson.module || pkgJson.main || "index.js";
459
- const entry = path4.join(pkgDir, main);
460
- return fs5.existsSync(entry) ? entry : null;
466
+ const candidates = [
467
+ path4.join(pkgDir, main),
468
+ path4.join(pkgDir, `${main}.js`),
469
+ path4.join(pkgDir, main, "index.js")
470
+ ];
471
+ for (const entry of candidates) {
472
+ if (fs5.existsSync(entry) && fs5.statSync(entry).isFile()) return entry;
473
+ }
474
+ return null;
461
475
  }
462
476
  function findUmoPackageDir(pkgName) {
463
477
  const projectRoot2 = getProjectRoot();
@@ -476,6 +490,13 @@ function findUmoPackageEntryForSpec(spec) {
476
490
  const pkgDir = findUmoPackageDir(pkgName);
477
491
  if (!pkgDir) return null;
478
492
  if (subParts.length === 0) {
493
+ const override = UMO_CJS_ENTRY_OVERRIDES[pkgName];
494
+ if (override) {
495
+ const overridePath = path4.join(pkgDir, override);
496
+ if (fs5.existsSync(overridePath) && fs5.statSync(overridePath).isFile()) {
497
+ return overridePath;
498
+ }
499
+ }
479
500
  return resolvePackageMain(pkgDir);
480
501
  }
481
502
  const sub = subParts.join("/");
@@ -620,12 +641,28 @@ function yjsPeerResolve() {
620
641
  }
621
642
 
622
643
  // vite/umoIntegration.ts
644
+ function docxPreviewViteFix() {
645
+ return {
646
+ name: "core-docx-preview-vite",
647
+ config() {
648
+ return {
649
+ optimizeDeps: {
650
+ exclude: ["docx-preview", "jszip", "exceljs"]
651
+ }
652
+ };
653
+ }
654
+ };
655
+ }
656
+ function coreOfficePreviewVitePlugins() {
657
+ return [createProjectRootPlugin(), umoCjsVirtual(), docxPreviewViteFix()];
658
+ }
623
659
  function coreUmoVitePlugins() {
624
660
  return [
625
661
  createProjectRootPlugin(),
626
662
  tiptapVueRendererFix(),
627
663
  highlightJsLibVirtual(),
628
664
  umoCjsVirtual(),
665
+ docxPreviewViteFix(),
629
666
  tiptapUmoResolve(),
630
667
  yjsPeerResolve()
631
668
  ];
@@ -653,6 +690,7 @@ function coreUmoManualChunk(id) {
653
690
  return void 0;
654
691
  }
655
692
  export {
693
+ coreOfficePreviewVitePlugins,
656
694
  coreUmoManualChunk,
657
695
  coreUmoResolveConfig,
658
696
  coreUmoVitePlugins,
@@ -6,6 +6,31 @@ import { tiptapVueRendererFix } from './tiptapVueRendererFix'
6
6
  import { umoCjsVirtual } from './umoCjsVirtual'
7
7
  import { buildYjsPeerAliases, yjsPeerResolve } from './yjsPeerResolve'
8
8
 
9
+ /**
10
+ * docx-preview / exceljs 等 CJS 包在 Vite 浏览器解析会落到 *.min.js(无 default 导出)。
11
+ * 排除预构建,让 umoCjsVirtual 在 resolve 阶段接管。
12
+ */
13
+ function docxPreviewViteFix(): Plugin {
14
+ return {
15
+ name: 'core-docx-preview-vite',
16
+ config() {
17
+ return {
18
+ optimizeDeps: {
19
+ exclude: ['docx-preview', 'jszip', 'exceljs'],
20
+ },
21
+ }
22
+ },
23
+ }
24
+ }
25
+
26
+ /**
27
+ * 核心包 CJS 兼容(附件预览 docx-preview/jszip、表格导出 exceljs 等)在宿主 Vite 中的插件。
28
+ * 前端系统框架等未接入完整 Umo 插件链的宿主也应引入。
29
+ */
30
+ export function coreOfficePreviewVitePlugins(): Plugin[] {
31
+ return [createProjectRootPlugin(), umoCjsVirtual(), docxPreviewViteFix()]
32
+ }
33
+
9
34
  /**
10
35
  * Umo 富文本(editor-main 源码)在宿主 Vite 中所需的全部构建插件。
11
36
  * 必须放在 vue() 之前,且需配合 coreUmoResolveConfig()。
@@ -16,6 +41,7 @@ export function coreUmoVitePlugins(): Plugin[] {
16
41
  tiptapVueRendererFix(),
17
42
  highlightJsLibVirtual(),
18
43
  umoCjsVirtual(),
44
+ docxPreviewViteFix(),
19
45
  tiptapUmoResolve(),
20
46
  yjsPeerResolve(),
21
47
  ]