@litianxiang/portal-ui 0.0.3 → 0.0.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.
Files changed (63) hide show
  1. package/README.md +6 -0
  2. package/dist/file-preview.d.ts +4 -0
  3. package/dist/file-preview.js +180 -0
  4. package/dist/http-DePr1rnZ.js +31 -0
  5. package/dist/index.d.ts +38 -0
  6. package/dist/index.js +4587 -0
  7. package/dist/portal-ui.css +1 -0
  8. package/{src → dist}/styles/element-ui.scss +646 -17
  9. package/dist/styles/form.scss +161 -0
  10. package/dist/styles/global.scss +205 -0
  11. package/dist/styles/iconfont.css +1719 -0
  12. package/dist/styles/iconfont.ttf +0 -0
  13. package/dist/styles/iconfont.woff +0 -0
  14. package/dist/styles/iconfont.woff2 +0 -0
  15. package/dist/vue-office.d.ts +66 -0
  16. package/package.json +44 -6
  17. package/src/assets/iconfont/demo.css +539 -0
  18. package/src/assets/iconfont/demo_index.html +9986 -0
  19. package/src/assets/iconfont/iconfont.css +1719 -0
  20. package/src/assets/iconfont/iconfont.js +1 -0
  21. package/src/assets/iconfont/iconfont.json +2991 -0
  22. package/src/assets/iconfont/iconfont.ttf +0 -0
  23. package/src/assets/iconfont/iconfont.woff +0 -0
  24. package/src/assets/iconfont/iconfont.woff2 +0 -0
  25. package/src/assets/styles/element-ui.scss +3772 -0
  26. package/src/assets/styles/form.scss +161 -0
  27. package/src/assets/styles/global.scss +205 -0
  28. package/src/components/control/base/base-button.vue +118 -0
  29. package/src/components/control/base/base-checkbox.vue +217 -0
  30. package/src/components/control/base/base-china-area.vue +555 -0
  31. package/src/components/control/base/base-collapse-toggle.vue +28 -0
  32. package/src/components/control/base/base-dialog.vue +155 -0
  33. package/src/components/control/base/base-file-preview.vue +204 -0
  34. package/src/components/control/base/base-link.vue +110 -0
  35. package/src/components/control/base/base-messagebox.vue +154 -0
  36. package/src/components/control/base/base-number.vue +19 -13
  37. package/src/components/control/base/base-pagination.vue +60 -0
  38. package/src/components/control/base/base-radio.vue +140 -0
  39. package/src/components/control/base/base-switch.vue +134 -0
  40. package/src/components/control/base/base-table.vue +614 -0
  41. package/src/components/control/base/base-upload.vue +538 -0
  42. package/src/components/control/busi/busi-approval-record.vue +236 -0
  43. package/src/components/control/busi/busi-dept.vue +290 -0
  44. package/src/components/control/busi/busi-file-preview.vue +194 -0
  45. package/src/components/control/busi/busi-outuser.vue +210 -0
  46. package/src/components/control/busi/busi-user-dialog.vue +195 -0
  47. package/src/components/control/busi/busi-user.vue +321 -0
  48. package/src/components/layout/global-loading.vue +70 -0
  49. package/src/components/layout/main-aside.vue +179 -0
  50. package/src/components/layout/main-fullscreen.vue +79 -0
  51. package/src/components/layout/main-header-crumb.vue +78 -0
  52. package/src/components/layout/main-header-info.vue +150 -0
  53. package/src/components/layout/main-header-tab.vue +391 -0
  54. package/src/components/layout/main-header.vue +111 -0
  55. package/src/components/layout/main-language.vue +28 -0
  56. package/src/components/layout/main-layout.vue +252 -0
  57. package/src/components/layout/main-menu.vue +56 -0
  58. package/src/file-preview.d.ts +4 -0
  59. package/src/file-preview.ts +4 -0
  60. package/src/index.d.ts +37 -7
  61. package/src/index.ts +29 -1
  62. package/src/utils/http.ts +55 -0
  63. package/src/vue-office.d.ts +66 -0
package/README.md CHANGED
@@ -3,3 +3,9 @@
3
3
  统一的流程表单公共控件库。
4
4
 
5
5
  目前只是搭好包结构,后续可以从各项目的 `components/control` 中逐步抽取 Base/Busi 系列组件到此包,并通过 pnpm workspace 或 npm 发布给各微服务项目复用。
6
+
7
+ ## 别名约定
8
+
9
+ - `portal.ui` 内部新增专属别名:`@ui/* -> src/*`
10
+ - 该别名仅用于 `portal.ui` 工程内的类型解析与开发体验
11
+ - 当前包以 `src` 源码形式发布给宿主项目,库内运行时导入建议继续使用相对路径,避免宿主缺少 `@ui` 解析配置导致构建失败
@@ -0,0 +1,4 @@
1
+ export { default as BaseFilePreview } from './components/control/base/base-file-preview.vue'
2
+ export { default as BusiFilePreview } from './components/control/busi/busi-file-preview.vue'
3
+ /** @deprecated 请使用 BusiFilePreview */
4
+ export { default as WorkflowFilePreview } from './components/control/busi/busi-file-preview.vue'
@@ -0,0 +1,180 @@
1
+ import { defineComponent as k, computed as y, resolveComponent as x, openBlock as n, createElementBlock as i, createVNode as s, withCtx as h, unref as m, createElementVNode as _, Fragment as E, renderSlot as R, ref as v, onUnmounted as L, watch as T, onMounted as U } from "vue";
2
+ import { Loading as j } from "@element-plus/icons-vue";
3
+ import N from "@vue-office/docx";
4
+ import $ from "@vue-office/excel";
5
+ import B from "@vue-office/pdf";
6
+ import { _ as b, g as P } from "./http-DePr1rnZ.js";
7
+ const C = { class: "base-file-preview" }, F = {
8
+ key: 0,
9
+ class: "preview-loading"
10
+ }, O = {
11
+ key: 0,
12
+ class: "preview-content preview-image"
13
+ }, I = ["src", "alt"], V = {
14
+ key: 1,
15
+ class: "preview-content preview-pdf"
16
+ }, D = {
17
+ key: 2,
18
+ class: "preview-content preview-docx"
19
+ }, M = {
20
+ key: 3,
21
+ class: "preview-content preview-excel"
22
+ }, S = {
23
+ key: 4,
24
+ class: "preview-content preview-unsupported"
25
+ }, A = /* @__PURE__ */ k({
26
+ __name: "base-file-preview",
27
+ props: {
28
+ src: {},
29
+ fileExt: {},
30
+ fileName: { default: "" },
31
+ loading: { type: Boolean, default: !1 }
32
+ },
33
+ emits: ["rendered", "error"],
34
+ setup(l, { expose: o, emit: d }) {
35
+ const c = l, r = d, a = y(() => {
36
+ const e = c.fileExt.toLowerCase();
37
+ return ["png", "jpg", "jpeg", "gif", "bmp", "webp"].includes(e) ? "image" : e === "pdf" ? "pdf" : ["doc", "docx"].includes(e) ? "docx" : ["xls", "xlsx"].includes(e) ? "excel" : "unsupported";
38
+ }), w = y(() => a.value !== "unsupported");
39
+ function f() {
40
+ r("rendered");
41
+ }
42
+ function p(e) {
43
+ r("error", e);
44
+ }
45
+ return o({
46
+ previewType: a,
47
+ isSupported: w
48
+ }), (e, t) => {
49
+ const u = x("el-icon"), g = x("el-empty");
50
+ return n(), i("div", C, [
51
+ l.loading ? (n(), i("div", F, [
52
+ s(u, { class: "loading-icon" }, {
53
+ default: h(() => [
54
+ s(m(j))
55
+ ]),
56
+ _: 1
57
+ }),
58
+ t[0] || (t[0] = _("span", null, "加载中...", -1))
59
+ ])) : (n(), i(E, { key: 1 }, [
60
+ a.value === "image" ? (n(), i("div", O, [
61
+ _("img", {
62
+ src: l.src,
63
+ alt: l.fileName
64
+ }, null, 8, I)
65
+ ])) : a.value === "pdf" ? (n(), i("div", V, [
66
+ s(m(B), {
67
+ src: l.src,
68
+ onRendered: f,
69
+ onError: p
70
+ }, null, 8, ["src"])
71
+ ])) : a.value === "docx" ? (n(), i("div", D, [
72
+ s(m(N), {
73
+ src: l.src,
74
+ onRendered: f,
75
+ onError: p
76
+ }, null, 8, ["src"])
77
+ ])) : a.value === "excel" ? (n(), i("div", M, [
78
+ s(m($), {
79
+ src: l.src,
80
+ onRendered: f,
81
+ onError: p
82
+ }, null, 8, ["src"])
83
+ ])) : (n(), i("div", S, [
84
+ s(g, { description: "该文件类型不支持在线预览" }, {
85
+ default: h(() => [
86
+ R(e.$slots, "unsupported-action", {}, void 0, !0)
87
+ ]),
88
+ _: 3
89
+ })
90
+ ]))
91
+ ], 64))
92
+ ]);
93
+ };
94
+ }
95
+ }), W = /* @__PURE__ */ b(A, [["__scopeId", "data-v-c69bdde9"]]), H = { class: "file-preview-page" }, q = {
96
+ key: 0,
97
+ class: "preview-error"
98
+ }, z = {
99
+ key: 1,
100
+ class: "preview-body"
101
+ }, G = /* @__PURE__ */ k({
102
+ __name: "busi-file-preview",
103
+ props: {
104
+ fid: {},
105
+ fileName: { default: "" },
106
+ fileExt: { default: "" },
107
+ watermarkText: { default: "" }
108
+ },
109
+ setup(l) {
110
+ const o = l, d = v(!0), c = v(""), r = v(""), a = v();
111
+ function w() {
112
+ if (!a.value || !o.watermarkText) return;
113
+ const e = document.createElement("canvas"), t = e.getContext("2d");
114
+ t && (e.width = 200, e.height = 150, t.font = "16px Arial", t.fillStyle = "rgba(0, 0, 0, 0.12)", t.textAlign = "center", t.textBaseline = "middle", t.translate(e.width / 2, e.height / 2), t.rotate(-25 * Math.PI / 180), t.fillText(o.watermarkText, 0, 0), a.value.style.backgroundImage = `url(${e.toDataURL("image/png")})`);
115
+ }
116
+ function f(e) {
117
+ return {
118
+ pdf: "application/pdf",
119
+ png: "image/png",
120
+ jpg: "image/jpeg",
121
+ jpeg: "image/jpeg",
122
+ gif: "image/gif",
123
+ bmp: "image/bmp",
124
+ webp: "image/webp",
125
+ doc: "application/msword",
126
+ docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
127
+ xls: "application/vnd.ms-excel",
128
+ xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
129
+ }[e.toLowerCase()] || "application/octet-stream";
130
+ }
131
+ async function p() {
132
+ if (!o.fid) {
133
+ c.value = "文件ID不能为空", d.value = !1;
134
+ return;
135
+ }
136
+ o.fileName && (document.title = `预览 - ${o.fileName}`);
137
+ try {
138
+ const t = await P().get(`/proxy/workflow/attachment/api/preview/${o.fid}`, {
139
+ responseType: "blob"
140
+ }), u = f(o.fileExt), g = new Blob([t], { type: u });
141
+ r.value = window.URL.createObjectURL(g);
142
+ } catch (e) {
143
+ console.error("加载文件失败:", e), c.value = "加载文件失败,请稍后重试";
144
+ } finally {
145
+ d.value = !1;
146
+ }
147
+ }
148
+ return L(() => {
149
+ r.value && window.URL.revokeObjectURL(r.value);
150
+ }), T(() => o.fid, (e) => {
151
+ e && (d.value = !0, c.value = "", r.value && (window.URL.revokeObjectURL(r.value), r.value = ""), p());
152
+ }), U(() => {
153
+ w(), p();
154
+ }), (e, t) => {
155
+ const u = x("el-empty");
156
+ return n(), i("div", H, [
157
+ _("div", {
158
+ class: "watermark-layer",
159
+ ref_key: "watermarkRef",
160
+ ref: a
161
+ }, null, 512),
162
+ c.value ? (n(), i("div", q, [
163
+ s(u, { description: c.value }, null, 8, ["description"])
164
+ ])) : (n(), i("div", z, [
165
+ s(W, {
166
+ src: r.value,
167
+ "file-ext": o.fileExt,
168
+ "file-name": o.fileName,
169
+ loading: d.value
170
+ }, null, 8, ["src", "file-ext", "file-name", "loading"])
171
+ ]))
172
+ ]);
173
+ };
174
+ }
175
+ }), ee = /* @__PURE__ */ b(G, [["__scopeId", "data-v-b73ca84d"]]);
176
+ export {
177
+ W as BaseFilePreview,
178
+ ee as BusiFilePreview,
179
+ ee as WorkflowFilePreview
180
+ };
@@ -0,0 +1,31 @@
1
+ import { createAuthHttpClient as s } from "@litianxiang/portal-core";
2
+ const p = (t, o) => {
3
+ const r = t.__vccOpts || t;
4
+ for (const [i, a] of o)
5
+ r[i] = a;
6
+ return r;
7
+ }, n = "__portalUiHttp__", e = "__portalUiLogoutToAuth__";
8
+ function w(t, o) {
9
+ window[n] = t, o && (window[e] = o);
10
+ }
11
+ function c(t) {
12
+ const { http: o, logoutToAuth: r } = s({
13
+ baseURL: t.baseURL || "",
14
+ getUserStore: t.getUserStore,
15
+ getLoadingStore: t.getLoadingStore,
16
+ onShowError: t.onShowError
17
+ });
18
+ return window[n] = o, window[e] = r, { http: o, logoutToAuth: r };
19
+ }
20
+ function U() {
21
+ const t = window[n];
22
+ if (!t)
23
+ throw new Error("[portal-ui] http 未初始化,请先在 main.ts 中调用 initPortalUiHttp() 或 setPortalUiHttp()");
24
+ return t;
25
+ }
26
+ export {
27
+ p as _,
28
+ U as g,
29
+ c as i,
30
+ w as s
31
+ };
@@ -0,0 +1,38 @@
1
+ /// <reference path="./vue-office.d.ts" />
2
+
3
+ export { default as BaseInput } from './components/control/base/base-input.vue'
4
+ export { default as BaseButton } from './components/control/base/base-button.vue'
5
+ export { default as BaseCollapseToggle } from './components/control/base/base-collapse-toggle.vue'
6
+ export { default as BaseSwitch } from './components/control/base/base-switch.vue'
7
+ export { default as BaseTable } from './components/control/base/base-table.vue'
8
+ export { default as BaseSelect } from './components/control/base/base-select.vue'
9
+ export { default as BaseNumber } from './components/control/base/base-number.vue'
10
+ export { default as BaseTextarea } from './components/control/base/base-textarea.vue'
11
+ export { default as BaseDate } from './components/control/base/base-date.vue'
12
+ export { default as BaseTime } from './components/control/base/base-time.vue'
13
+ export { default as BaseUpload } from './components/control/base/base-upload.vue'
14
+ export { default as BaseCheckbox } from './components/control/base/base-checkbox.vue'
15
+ export { default as BaseRadio } from './components/control/base/base-radio.vue'
16
+ export { default as BaseLink } from './components/control/base/base-link.vue'
17
+ export { default as BaseDialog } from './components/control/base/base-dialog.vue'
18
+ export { default as BaseChinaArea } from './components/control/base/base-china-area.vue'
19
+ export { default as BasePagination } from './components/control/base/base-pagination.vue'
20
+ export { default as BaseApprovalRecord } from './components/control/busi/busi-approval-record.vue'
21
+ export { default as BaseUser } from './components/control/busi/busi-user.vue'
22
+ export { default as BusiDept } from './components/control/busi/busi-dept.vue'
23
+ export { default as BusiOutUser } from './components/control/busi/busi-outuser.vue'
24
+ export { default as BusiUserDialog } from './components/control/busi/busi-user-dialog.vue'
25
+ export { default as MainLayout } from './components/layout/main-layout.vue'
26
+ export { default as MainAside } from './components/layout/main-aside.vue'
27
+ export { default as MainHeader } from './components/layout/main-header.vue'
28
+ export { default as MainHeaderCrumb } from './components/layout/main-header-crumb.vue'
29
+ export { default as MainHeaderInfo } from './components/layout/main-header-info.vue'
30
+ export { default as MainHeaderTab } from './components/layout/main-header-tab.vue'
31
+ export { default as MainFullscreen } from './components/layout/main-fullscreen.vue'
32
+ export { default as MainLanguage } from './components/layout/main-language.vue'
33
+ export { default as MainMenu } from './components/layout/main-menu.vue'
34
+ export { default as GlobalLoading } from './components/layout/global-loading.vue'
35
+ export { baseMessageBox } from './components/control/base/base-messagebox.vue'
36
+
37
+ export type { InitPortalUiHttpOptions } from './utils/http'
38
+ export { initPortalUiHttp, setPortalUiHttp } from './utils/http'