morghulis 4.3.0 → 4.3.3

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/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  ## 安装
6
6
 
7
7
  ```bash
8
- npm install morghulis@4.3.0 vue@^3.5.42 vue-router@^5.4.0 element-plus@^2.14.7
8
+ npm install morghulis@4.3.1 vue@^3.5.42 vue-router@^5.4.0 element-plus@^2.14.7
9
9
  ```
10
10
 
11
11
  面向浏览器中的 Vue 3 应用。安装时会通过 SheetJS CDN 下载 `xlsx`,需要能够访问 `cdn.sheetjs.com`。
@@ -18,8 +18,8 @@ import ElementPlus from 'element-plus'
18
18
  import zhCn from 'element-plus/es/locale/lang/zh-cn'
19
19
  import 'element-plus/dist/index.css'
20
20
 
21
- import {createMorghulis, MApp, type MOptions} from 'morghulis'
22
- import 'morghulis/style.css'
21
+ import createMorghulis, {MApp, type MOptions} from 'morghulis'
22
+ import 'morghulis/style'
23
23
 
24
24
  const options: MOptions = {
25
25
  base_url: '/api',
@@ -36,7 +36,21 @@ app.mount('#app')
36
36
 
37
37
  `createMorghulis` 会安装 Vue Router,包含内置路由,并合并 `options.routes`;使用这个入口时无需另外创建 Router。Element Plus 需要由使用方安装到应用中。`MApp` 会连接后端服务,数据相关功能需要兼容的接口。
38
38
 
39
- `morghulis/style` 与 `morghulis/style.css` 指向相同样式文件,保留旧版样式入口。样式包含全局工具类,以及 `html`、`body` 的布局设置。
39
+ `base_url` 支持代理路径(例如 `/api/`)或后端完整地址(例如 `http://localhost:8000`),末尾的斜杠可以省略。WebSocket 地址会自动拼接客户端路径,并将 HTTP/HTTPS 协议转换为 WS/WSS。
40
+
41
+ `minio_url` 同样支持代理路径(例如 `/minio`)或对象存储完整地址(例如 `http://localhost:9000`),末尾的斜杠可以省略。文件预览与下载会自动补齐路径之间的斜杠,并保留地址中的路径前缀。
42
+
43
+ 跨域直连 Django 后端时,需要在后端允许组件库使用的 `Client`、`Auth` 请求头。例如使用 `django-cors-headers` 时:
44
+
45
+ ```python
46
+ from corsheaders.defaults import default_headers
47
+
48
+ CORS_ALLOW_HEADERS = (*default_headers, 'client', 'auth')
49
+ ```
50
+
51
+ `createMorghulis` 同时支持默认导入和具名导入:`import {createMorghulis} from 'morghulis'`。
52
+
53
+ `morghulis/style` 与 `morghulis/style.css` 指向相同样式文件,两个入口都提供类型声明。样式包含全局工具类,以及 `html`、`body` 的布局设置。
40
54
 
41
55
  ## 全局组件与类型
42
56
 
@@ -61,6 +75,7 @@ npm run generate:components # 更新全局组件类型声明
61
75
  npm run type-check # 检查类型
62
76
  npm run build # 构建演示应用到 dist-demo
63
77
  npm run build:lib # 构建库到 dist,包含 ESM、CommonJS、CSS 和类型声明
78
+ npm run test:package # 构建并验证样式入口、默认导出与类型声明
64
79
  npm pack # 自动构建并生成 npm 安装包
65
80
  ```
66
81