@xmszm/core 0.0.2 → 0.0.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.
Files changed (71) hide show
  1. package/README.md +10 -1
  2. package/dist/index.cjs +2 -2
  3. package/dist/index.mjs +1296 -1285
  4. package/dist/plugin/vite/initRouteMeta.cjs +1 -0
  5. package/dist/plugin/vite/initRouteMeta.mjs +13 -0
  6. package/dist/style.css +1 -1
  7. package/docs/.vitepress/config.mjs +10 -1
  8. package/docs/components/config-options.md +125 -0
  9. package/docs/components/dataform.md +175 -22
  10. package/docs/components/datatable.md +21 -39
  11. package/docs/components/dialog.md +155 -16
  12. package/docs/components/options.md +43 -14
  13. package/docs/components/query.md +20 -12
  14. package/docs/components/utils.md +118 -10
  15. package/docs/guide/changelog.md +81 -0
  16. package/docs/guide/config.md +241 -4
  17. package/docs/guide/quickstart.md +27 -2
  18. package/docs/index.md +1 -1
  19. package/docs/usage.md +16 -3
  20. package/examples/README.md +46 -0
  21. package/examples/index.html +14 -0
  22. package/examples/package.json +25 -0
  23. package/examples/pnpm-lock.yaml +1569 -0
  24. package/examples/pnpm-workspace.yaml +3 -0
  25. package/examples/src/AdminSystem.vue +870 -0
  26. package/examples/src/App.vue +330 -0
  27. package/examples/src/Introduction.vue +307 -0
  28. package/examples/src/main.js +22 -0
  29. package/examples/src/utils/permission.js +16 -0
  30. package/examples/src/utils/request.js +10 -0
  31. package/examples/vite.config.js +41 -0
  32. package/package.json +10 -4
  33. package/src/dialog/commonDialog.tsx +285 -0
  34. package/src/dialog/utils/{dialog.js → dialog.ts} +2 -0
  35. package/src/enum/sort.tsx +45 -0
  36. package/src/form/DataForm.vue +26 -52
  37. package/src/{index.js → index.ts} +7 -6
  38. package/src/list/{useList.jsx → useList.tsx} +49 -14
  39. package/src/options/{Options.jsx → Options.tsx} +37 -36
  40. package/src/options/defaultOptions.tsx +656 -0
  41. package/src/query/CommonQuery.vue +57 -89
  42. package/src/table/DataTable.vue +60 -94
  43. package/src/table/opr/{DataColumnCollet.jsx → DataColumnCollet.tsx} +18 -8
  44. package/src/table/opr/{useDataColumn.jsx → useDataColumn.tsx} +43 -48
  45. package/src/table/opr/{useDataColumnButton.jsx → useDataColumnButton.tsx} +13 -6
  46. package/src/table/opr/{useDataColumnPop.jsx → useDataColumnPop.tsx} +13 -5
  47. package/src/utils/{array.js → array.ts} +4 -6
  48. package/src/utils/{config.js → config.ts} +16 -2
  49. package/src/utils/{dialog.js → dialog.ts} +2 -2
  50. package/src/utils/{object.js → object.ts} +1 -0
  51. package/src/utils/{upload.js → upload.ts} +3 -3
  52. package/types/components.d.ts +402 -0
  53. package/types/index.d.ts +145 -7
  54. package/types/plugin/vite/initRouteMeta.d.ts +23 -0
  55. package/types/src.d.ts +55 -0
  56. package/types/vue-shim.d.ts +9 -0
  57. package/examples/demo.vue +0 -224
  58. package/src/dialog/commonDialog.jsx +0 -262
  59. package/src/enum/sort.jsx +0 -31
  60. package/src/options/defaultOptions.jsx +0 -580
  61. /package/src/dialog/{useCommonDialog.js → useCommonDialog.ts} +0 -0
  62. /package/src/directives/{auto-register.js → auto-register.ts} +0 -0
  63. /package/src/directives/{permission.js → permission.ts} +0 -0
  64. /package/src/enum/{options.js → options.ts} +0 -0
  65. /package/src/plugin/{index.js → index.ts} +0 -0
  66. /package/src/plugin/vite/{initRouteMeta.js → initRouteMeta.ts} +0 -0
  67. /package/src/store/utils/{index.js → index.ts} +0 -0
  68. /package/src/table/opr/{useQRCode.js → useQRCode.ts} +0 -0
  69. /package/src/table/utils/{ellipsis.js → ellipsis.ts} +0 -0
  70. /package/src/utils/{auth.js → auth.ts} +0 -0
  71. /package/src/utils/{time.js → time.ts} +0 -0
package/docs/usage.md CHANGED
@@ -20,11 +20,23 @@ yarn add @xmszm/core
20
20
  如项目使用 `@` 别名,请确保存在对应的打包/运行时配置。
21
21
 
22
22
  ## 快速开始
23
+
24
+ ### 全局引入样式(推荐)
25
+
26
+ 在项目的入口文件中全局引入样式:
27
+
28
+ ```javascript
29
+ // main.js 或 main.ts
30
+ import '@xmszm/core/dist/style.css'
31
+ ```
32
+
33
+ ### 组件中使用
34
+
23
35
  ```vue
24
36
  <script setup>
25
37
  import { ref } from 'vue'
26
38
  import { DataForm, DataTable, commonDialogMethod } from '@xmszm/core'
27
- import '@xmszm/core/dist/style.css' // 如需默认样式
39
+ // 如果已在全局引入样式,这里无需重复引入
28
40
 
29
41
  const formValue = ref({})
30
42
  const formOptions = [
@@ -61,12 +73,13 @@ function openDialog() {
61
73
 
62
74
  ## 主要导出清单
63
75
  - 组件:`DataForm`、`Options`、`CommonQuery`、`DataTable`、`OprButton`、`Pop`
64
- - 方法:`commonDialogMethod`、`createActionColumnJsx`、`initRules`
76
+ - 方法:`commonDialogMethod`、`createActionColumnJsx`、`initRules`(用于自动生成表单校验规则)
65
77
  - 工具:`toArray`、`ArrayToObject`、`ObjectToArray`、`customUpload`、`registryUpload`、`getFileUrl`
66
- - 常量:`orderEnum`、`globalLabelField`、`globalValueField`
78
+ - 常量:`globalLabelField`(默认 `'name'`)、`globalValueField`(默认 `'id'`)
67
79
  - 路由辅助:`initRouteMeta`、`useApiConfig`、`useAuthPermission`、`cellectChildenPermission`
68
80
 
69
81
  ## 常见提示
70
82
  - 若打包时报 `@/utils/...` 未找到,请在宿主项目配置 `@` 路径或提供对应实现。
83
+ - **样式引入**:推荐在全局入口文件(`main.js` 或 `main.ts`)中引入 `@xmszm/core/dist/style.css`,这样整个项目都可以使用默认样式,无需在每个组件中重复引入。
71
84
  - Vue TS 项目可直接使用内置 `types/index.d.ts` 获取基础类型提示。
72
85
 
@@ -0,0 +1,46 @@
1
+ # Core 组件库测试应用
2
+
3
+ 这是一个用于本地测试 `@xmszm/core` 组件库的测试应用。
4
+
5
+ ## 使用 npm link 进行本地测试
6
+
7
+ ### 1. 在库项目根目录创建 link
8
+
9
+ ```bash
10
+ # 在 core 项目根目录执行
11
+ cd E:\HundredsCompany\template\core
12
+ npm link
13
+ ```
14
+
15
+ ### 2. 在测试项目中链接库
16
+
17
+ ```bash
18
+ # 在 test-app 目录执行
19
+ cd test-app
20
+ npm link @xmszm/core
21
+ ```
22
+
23
+ ### 3. 安装依赖
24
+
25
+ ```bash
26
+ npm install
27
+ ```
28
+
29
+ ### 4. 启动开发服务器
30
+
31
+ ```bash
32
+ npm run dev
33
+ ```
34
+
35
+ ## 注意事项
36
+
37
+ - 修改库代码后,需要重新构建:在 core 目录执行 `npm run build`
38
+ - 测试应用会自动使用最新的构建结果
39
+ - 如果遇到问题,可以尝试重新 link:
40
+ ```bash
41
+ # 取消 link
42
+ npm unlink @xmszm/core
43
+ # 重新 link
44
+ npm link @xmszm/core
45
+ ```
46
+
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Core 组件库测试</title>
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="/src/main.js"></script>
12
+ </body>
13
+ </html>
14
+
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "core-test-app",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "scripts": {
6
+ "dev": "vite",
7
+ "build": "vite build",
8
+ "preview": "vite preview"
9
+ },
10
+ "dependencies": {
11
+ "@vicons/ionicons5": "^0.13.0",
12
+ "@xmszm/core": "^0.0.2",
13
+ "dayjs": "^1.11.0",
14
+ "lodash-es": "^4.17.21",
15
+ "naive-ui": "^2.38.0",
16
+ "vue": "^3.3.0",
17
+ "vue-router": "^4.2.0"
18
+ },
19
+ "devDependencies": {
20
+ "@vitejs/plugin-vue": "^5.1.2",
21
+ "@vitejs/plugin-vue-jsx": "^4.0.1",
22
+ "less": "^4.2.0",
23
+ "vite": "^5.4.0"
24
+ }
25
+ }