disguise-ui 0.3.8 → 0.3.9-10
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 +38 -9
- package/dist/avatar-cell-Dl9GMsFx.js +96 -0
- package/dist/disguise-ui.js +2772 -3191
- package/dist/file-cell-PHpjq7cj.js +127 -0
- package/dist/{file-upload-CdzTspvH.js → file-upload-CyIWePU6.js} +80 -80
- package/dist/{file-upload-CJIkJlcK.js → file-upload-DaiZfAfS.js} +1 -1
- package/dist/{i18n-DZQHHiTD.js → i18n-D1bcOHnw.js} +68 -56
- package/dist/picture-cell-BkGdf-KI.js +115 -0
- package/dist/{picture-upload-Ba5slmTG.js → picture-upload-B_5D6_Zt.js} +1 -1
- package/dist/{picture-upload-By35hBTI.js → picture-upload-s8mI86nq.js} +96 -96
- package/dist/rich-text-editor-B6-QyFOB.js +501 -0
- package/dist/rolldown-runtime-CGnMp29N.js +10 -0
- package/dist/style.css +1 -1
- package/dist/types/components/async-select/async-select.vue.d.ts +6 -6
- package/dist/types/components/crud-page/field-schema.d.ts +5 -0
- package/dist/types/components/crud-page/index.type.d.ts +11 -7
- package/dist/types/components/crud-page/index.vue.d.ts +4 -4
- package/dist/types/components/dialog-list/index.type.d.ts +21 -0
- package/dist/types/components/dialog-list/index.vue.d.ts +149 -160
- package/dist/types/components/dict-tag/index.vue.d.ts +2 -2
- package/dist/types/components/drawer-form-page/index.vue.d.ts +8 -8
- package/dist/types/components/file-upload/components/file-status.vue.d.ts +2 -2
- package/dist/types/components/file-upload/file-upload.vue.d.ts +7 -7
- package/dist/types/components/image-upload/index.vue.d.ts +3 -3
- package/dist/types/components/images-view/index.vue.d.ts +1 -1
- package/dist/types/components/import-dialog/index.type.d.ts +4 -0
- package/dist/types/components/import-dialog/index.vue.d.ts +27 -9
- package/dist/types/components/picture-upload/picture-upload.vue.d.ts +6 -6
- package/dist/types/components/rich-text-editor/index.vue.d.ts +2 -2
- package/dist/types/components/schema-form/schema-form-item.vue.d.ts +3 -1
- package/dist/types/components/schema-form/schema-form.type.d.ts +3 -2
- package/dist/types/components/schema-form/schema-form.vue.d.ts +4 -4
- package/dist/types/components/schema-form/translate-field.vue.d.ts +8 -2
- package/dist/types/components/schema-form/translate-toolbar.vue.d.ts +3 -3
- package/dist/types/components/schema-form/translate-validation.d.ts +7 -0
- package/dist/types/components/search-form/index.vue.d.ts +6 -6
- package/dist/types/components/table-entity/cells/avatar-cell.vue.d.ts +4 -6
- package/dist/types/components/table-entity/cells/price-cell.vue.d.ts +1 -1
- package/dist/types/components/table-entity/index.type.d.ts +3 -7
- package/dist/types/components/user-avatar-info/index.vue.d.ts +2 -2
- package/dist/types/composables/use-avatar-cell.d.ts +8 -0
- package/dist/types/composables/use-dict-data.d.ts +960 -18
- package/dist/types/entities/registry.d.ts +3 -3
- package/dist/types/index.d.ts +3 -0
- package/dist/types/runtime/context.d.ts +23 -3559
- package/dist/types/runtime/user.d.ts +24 -0
- package/dist/types/setup.d.ts +1 -1
- package/dist/{use-image-url-o26z5K19.js → use-image-url-XEPqhPby.js} +1 -1
- package/dist/{use-multiple-file-upload-DoEljuzF.js → use-multiple-file-upload-Bh_1WU4z.js} +2 -2
- package/dist/{user-avatar-info-DObwPt9B.js → user-avatar-info-DV0QZtS_.js} +38 -34
- package/package.json +5 -1
- package/dist/avatar-cell-Cx1YMRjp.js +0 -46
- package/dist/picture-cell-CogcfWjM.js +0 -121
package/README.md
CHANGED
|
@@ -1,14 +1,31 @@
|
|
|
1
|
-
# Disguise
|
|
1
|
+
# Disguise UI
|
|
2
2
|
|
|
3
|
-
[文档地址](
|
|
3
|
+
[文档地址](https://www.disguise-ui.com) · [GitHub](https://github.com/guitarxiaohe/disguise-ui)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
   
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
可独立使用的 Vue 3 后台组件库:列表、表单、上传、导入导出。安装后不依赖任何后台的接口、字典和权限——这些能力在应用启动时注入,组件只负责渲染和交互。
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## 特性
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
- **运行时注入**:请求、上传、字典、权限、文案全部通过 `setupDisguise` 在启动时注入,不绑定任何后端接口
|
|
12
|
+
- **元数据驱动**:一份字段 schema 同时生成搜索表单、表格和表单抽屉(`CrudPage`),也支持分拆单独使用
|
|
13
|
+
- **字典体系**:`fetchAllDictData` 注入 + vue-query 缓存,`DictTag` 把原始值渲染成彩色标签
|
|
14
|
+
- **权限控制**:`hasAccess` 按钮级权限码校验,`getAccessToken` 导出鉴权
|
|
15
|
+
- **导入导出**:`ImportDialog` 支持 Excel/CSV 导入、字段映射、模板下载;`CrudPage` 配置 `importUrl`/`exportUrl` 一键启用
|
|
16
|
+
- **虚拟化表格**:`TableEntity` 基于 ElTableV2,支持树形、拖拽排序、批量操作和内置单元格类型
|
|
17
|
+
- **国际化**:内置 zh-CN / en-US,支持 `locale` 切换与 `messages` 覆盖
|
|
18
|
+
- **TypeScript**:全部组件导出完整类型定义
|
|
19
|
+
|
|
20
|
+
## 组件
|
|
21
|
+
|
|
22
|
+
| 分类 | 组件 |
|
|
23
|
+
| -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
24
|
+
| 页面 | `CrudPage` 增删改查整页 |
|
|
25
|
+
| 数据录入 | `SchemaForm` 元数据表单、`SearchForm` 搜索表单、`DrawerFormPage` 抽屉表单、`AsyncSelect` 远程下拉、`DialogList` 弹窗列表、`PictureUpload` 图片上传(支持裁剪)、`ImageUpload` 轻量单图、`FileUpload` 文件上传、`RichTextEditor` 富文本 |
|
|
26
|
+
| 数据展示 | `TableEntity` 虚拟化表格、`ImagesView` 多图预览、`DictTag` 字典标签、`BaseCard` 卡片、`UserAvatarInfo` 用户头像 |
|
|
27
|
+
| 反馈 | `ImportDialog` 导入弹窗 |
|
|
28
|
+
| 其他 | `DisguiseIcon` 图标 |
|
|
12
29
|
|
|
13
30
|
## 安装
|
|
14
31
|
|
|
@@ -18,6 +35,8 @@ npm install disguise-ui vue element-plus @element-plus/icons-vue @vueuse/core @t
|
|
|
18
35
|
|
|
19
36
|
富文本还需要 `@tiptap/vue-3`、`@tiptap/starter-kit` 以及编辑器里用到的 `@tiptap/extension-*`。
|
|
20
37
|
|
|
38
|
+
兼容版本:Vue `^3.5.0`、Element Plus `^2.14.0`。
|
|
39
|
+
|
|
21
40
|
## 使用
|
|
22
41
|
|
|
23
42
|
```ts
|
|
@@ -74,7 +93,9 @@ app.use(VueQueryPlugin);
|
|
|
74
93
|
|
|
75
94
|
`fetchAllDictData` 返回 `{ 字典编码: 字典项[] }`。字典项至少包含 `code` 或 `dictValue`,以及 `name` 或 `dictLabel`。
|
|
76
95
|
|
|
77
|
-
|
|
96
|
+
### 远程下拉
|
|
97
|
+
|
|
98
|
+
用 `registerEntity` 注册业务实体,schema 里的 `async-select` 字段按 `entityKey` 即插即用:
|
|
78
99
|
|
|
79
100
|
```ts
|
|
80
101
|
import { registerEntity } from 'disguise-ui';
|
|
@@ -89,7 +110,9 @@ registerEntity({
|
|
|
89
110
|
});
|
|
90
111
|
```
|
|
91
112
|
|
|
92
|
-
|
|
113
|
+
### 样式与图标
|
|
114
|
+
|
|
115
|
+
页面里的工具类来自 Tailwind,使用方需要把构建产物加进扫描范围:
|
|
93
116
|
|
|
94
117
|
```js
|
|
95
118
|
content: ['./node_modules/disguise-ui/dist/**/*.js'];
|
|
@@ -97,7 +120,9 @@ content: ['./node_modules/disguise-ui/dist/**/*.js'];
|
|
|
97
120
|
|
|
98
121
|
`DisguiseIcon` 只负责拼接图标类名,图标字体样式需要使用方自己引入。
|
|
99
122
|
|
|
100
|
-
##
|
|
123
|
+
## 文档
|
|
124
|
+
|
|
125
|
+
完整文档(安装、快速开始、运行时注入、全部组件 API)见 [www.disguise-ui.com](https://www.disguise-ui.com)。
|
|
101
126
|
|
|
102
127
|
本地会启动一个类似 Element Plus 的组件说明站,包含实时示例、源码和 API:
|
|
103
128
|
|
|
@@ -114,3 +139,7 @@ npm run build
|
|
|
114
139
|
```
|
|
115
140
|
|
|
116
141
|
产物在 `dist/disguise-ui.js` 和 `dist/style.css`。
|
|
142
|
+
|
|
143
|
+
## License
|
|
144
|
+
|
|
145
|
+
[GPL-3.0](./LICENSE)
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { h as e, m as t, p as n } from "./i18n-D1bcOHnw.js";
|
|
2
|
+
import { n as r, t as i } from "./user-avatar-info-DV0QZtS_.js";
|
|
3
|
+
import { computed as a, createBlock as o, defineComponent as s, guardReactiveProps as c, normalizeProps as l, openBlock as u, unref as d } from "vue";
|
|
4
|
+
import { useQuery as f } from "@tanstack/vue-query";
|
|
5
|
+
// src/composables/use-avatar-cell.ts
|
|
6
|
+
var p = [
|
|
7
|
+
"userId",
|
|
8
|
+
"nickName",
|
|
9
|
+
"subtitle",
|
|
10
|
+
"gender",
|
|
11
|
+
"sex",
|
|
12
|
+
"age",
|
|
13
|
+
"workYears",
|
|
14
|
+
"jobLevel",
|
|
15
|
+
"email",
|
|
16
|
+
"phone",
|
|
17
|
+
"department",
|
|
18
|
+
"deptName",
|
|
19
|
+
"size",
|
|
20
|
+
"drawerAvatarSize",
|
|
21
|
+
"drawerTitle",
|
|
22
|
+
"drawerSize",
|
|
23
|
+
"drawerProps",
|
|
24
|
+
"drawerFields",
|
|
25
|
+
"enableDrawer"
|
|
26
|
+
];
|
|
27
|
+
function m(e) {
|
|
28
|
+
return e == null || e === "";
|
|
29
|
+
}
|
|
30
|
+
function h(e) {
|
|
31
|
+
let t = {};
|
|
32
|
+
for (let n of p) e[n] !== void 0 && (t[n] = e[n]);
|
|
33
|
+
let n = e.name ?? e.userName;
|
|
34
|
+
n !== void 0 && (t.name = n);
|
|
35
|
+
let r = typeof e.avatar == "string" ? e.avatar : e.src;
|
|
36
|
+
r !== void 0 && (t.src = r);
|
|
37
|
+
let i = e.avatar && typeof e.avatar == "object" ? e.avatar : e.avatarProps;
|
|
38
|
+
return i !== void 0 && (t.avatar = i), t;
|
|
39
|
+
}
|
|
40
|
+
function g(i) {
|
|
41
|
+
let o = n(), s = a(() => {
|
|
42
|
+
let t = e().value;
|
|
43
|
+
return i.field && Object.hasOwn(t, i.field) ? t[i.field] : void 0;
|
|
44
|
+
}), c = o.value ? f({
|
|
45
|
+
queryKey: a(() => [...r, t().value]),
|
|
46
|
+
queryFn: () => o.value?.() ?? Promise.resolve([]),
|
|
47
|
+
enabled: a(() => !!o.value && !!s.value && !m(i.value)),
|
|
48
|
+
staleTime: 18e5,
|
|
49
|
+
gcTime: 36e5,
|
|
50
|
+
refetchOnWindowFocus: !1
|
|
51
|
+
}) : void 0, l = a(() => {
|
|
52
|
+
let e = s.value;
|
|
53
|
+
if (e && !m(i.value)) return c?.data.value?.find((t) => !m(t[e]) && String(t[e]) === String(i.value));
|
|
54
|
+
});
|
|
55
|
+
return a(() => {
|
|
56
|
+
let e = !!s.value;
|
|
57
|
+
if (!e) return h({
|
|
58
|
+
...i.row,
|
|
59
|
+
...i.cellProps
|
|
60
|
+
});
|
|
61
|
+
let t = !e || i.field === s.value ? h(i.row ?? {}) : {}, n = h(i.cellProps ?? {}), r = !!l.value || [t, n].some((e) => [
|
|
62
|
+
"userId",
|
|
63
|
+
"name",
|
|
64
|
+
"nickName",
|
|
65
|
+
"src",
|
|
66
|
+
"email",
|
|
67
|
+
"phone",
|
|
68
|
+
"deptName",
|
|
69
|
+
"department"
|
|
70
|
+
].some((t) => !m(e[t])));
|
|
71
|
+
return {
|
|
72
|
+
...e ? {
|
|
73
|
+
name: m(i.value) ? "--" : String(i.value),
|
|
74
|
+
enableDrawer: r
|
|
75
|
+
} : {},
|
|
76
|
+
...t,
|
|
77
|
+
...h(l.value ?? {}),
|
|
78
|
+
...n
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
// src/components/table-entity/cells/avatar-cell.vue
|
|
83
|
+
var _ = /* @__PURE__ */ s({
|
|
84
|
+
__name: "avatar-cell",
|
|
85
|
+
props: {
|
|
86
|
+
row: { default: () => ({}) },
|
|
87
|
+
value: {},
|
|
88
|
+
field: { default: "" },
|
|
89
|
+
cellProps: { default: () => ({}) }
|
|
90
|
+
},
|
|
91
|
+
setup(e) {
|
|
92
|
+
let t = g(e);
|
|
93
|
+
return (e, n) => (u(), o(i, l(c(d(t))), null, 16));
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
export { _ as default };
|