@das-fed/ui 7.1.0-dev.26 → 7.1.0-dev.28

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": "@das-fed/ui",
3
- "version": "7.1.0-dev.26",
3
+ "version": "7.1.0-dev.28",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -26,7 +26,7 @@
26
26
  "@antv/x6-plugin-snapline": "^2.1.7",
27
27
  "@antv/x6-plugin-transform": "^2.1.8",
28
28
  "@antv/x6-vue-shape": "^2.1.2",
29
- "@das-fed/cli": "7.1.0-dev.26",
29
+ "@das-fed/cli": "7.1.0-dev.28",
30
30
  "@element-plus/icons-vue": "^2.3.1",
31
31
  "@types/lodash": "^4.14.194",
32
32
  "@types/lodash-es": "^4.17.9",
@@ -56,9 +56,9 @@
56
56
  "vue-tsc": "^2.0.29"
57
57
  },
58
58
  "dependencies": {
59
- "@das-fed/ui": "7.1.0-dev.26",
60
- "@das-fed/utils": "7.1.0-dev.26",
61
- "@das-fed/web": "7.1.0-dev.26",
59
+ "@das-fed/ui": "7.1.0-dev.28",
60
+ "@das-fed/utils": "7.1.0-dev.28",
61
+ "@das-fed/web": "7.1.0-dev.28",
62
62
  "@types/markdown-it": "^14.1.2",
63
63
  "@wangeditor-next/editor": "5.6.31",
64
64
  "@wangeditor-next/editor-for-vue": "5.1.14",
@@ -1,20 +1,57 @@
1
1
  import '@das-fed/ui/packages/business-components/change-pwd/style.css';
2
- import { ref as R, reactive as F, defineComponent as T, createBlock as v, openBlock as y, unref as r, isRef as $, withCtx as g, createElementVNode as z, createVNode as h, createCommentVNode as I, createTextVNode as V, toDisplayString as D } from "vue";
3
- import { withInstall as B } from "@das-fed/utils/with-install/index";
4
- import { t as s, i18n as x, setI18nRule as O } from "@das-fed/web/packages/i18n/index";
2
+ import { ref as y, reactive as F, defineComponent as T, createBlock as v, openBlock as z, unref as t, isRef as B, withCtx as h, createElementVNode as V, createVNode as C, createCommentVNode as I, createTextVNode as A, toDisplayString as S } from "vue";
3
+ import { withInstall as O } from "@das-fed/utils/with-install/index";
4
+ import { t as d, i18n as x, setI18nRule as $ } from "@das-fed/web/packages/i18n/index";
5
5
  import { DasDialog as Z } from "@das-fed/ui/packages/components/dialog/index";
6
- import { DasFormRef as W, DasForm as G } from "@das-fed/ui/packages/components/form/index";
7
- import { DasFormItem as q } from "@das-fed/ui/packages/components/form-item/index";
8
- import { DasButton as U } from "@das-fed/ui/packages/components/button/index";
9
- import { DasMessage as K } from "@das-fed/ui/packages/components/message/index";
10
- import { enterpriseright as M, superadminPortal as Y, systemConfiguration as j } from "@das-fed/utils/api-services/modules";
6
+ import { DasFormRef as W, DasForm as j } from "@das-fed/ui/packages/components/form/index";
7
+ import { DasFormItem as N } from "@das-fed/ui/packages/components/form-item/index";
8
+ import { DasButton as E } from "@das-fed/ui/packages/components/button/index";
9
+ import { DasMessage as G } from "@das-fed/ui/packages/components/message/index";
10
+ import { enterpriseright as q, superadminPortal as H, systemConfiguration as X, justauth as Y } from "@das-fed/utils/api-services/modules";
11
11
  import { encryption as k } from "@das-fed/utils/atob";
12
- const S = M.get("/user/change-pwd", (n) => (n.ignoreErrorMessage = !0, n)), A = M.put("/user/change-pwd", (n) => (n.csrf = !0, n)), H = Y.put("/change-pwd"), J = j.get("/visitor/login/with-default"), Q = (n, f) => {
13
- const w = R(!1), m = W(), d = R({
12
+ const D = q.get("/user/change-pwd", (r) => (r.ignoreErrorMessage = !0, r)), U = q.put("/user/change-pwd", (r) => (r.csrf = !0, r)), J = H.put("/change-pwd"), Q = X.get("/visitor/login/with-default"), ee = "RSA_V1:", re = async (r) => {
13
+ const n = window.atob(r), p = new Uint8Array(n.length);
14
+ for (let a = 0; a < n.length; a++)
15
+ p[a] = n.charCodeAt(a);
16
+ return window.crypto.subtle.importKey("spki", p.buffer, { name: "RSA-OAEP", hash: "SHA-256" }, !1, ["encrypt"]);
17
+ }, te = (r) => {
18
+ let n = "";
19
+ const p = new Uint8Array(r);
20
+ for (let a = 0; a < p.byteLength; a++)
21
+ n += String.fromCharCode(p[a]);
22
+ return window.btoa(n);
23
+ }, ne = async (r) => {
24
+ try {
25
+ const n = await r();
26
+ if (!n.trim())
27
+ return async (a) => k(a);
28
+ const p = await re(n);
29
+ return async (a) => {
30
+ try {
31
+ const l = await window.crypto.subtle.encrypt(
32
+ { name: "RSA-OAEP" },
33
+ p,
34
+ new TextEncoder().encode(a)
35
+ );
36
+ return ee + te(l);
37
+ } catch {
38
+ return k(a);
39
+ }
40
+ };
41
+ } catch {
42
+ return async (n) => k(n);
43
+ }
44
+ }, ae = q.get("/visitor/rsa/public-key", (r) => (r.ignoreErrorMessage = !0, r));
45
+ Y.get("/rsa/public-key", (r) => (r.ignoreErrorMessage = !0, r));
46
+ const oe = async () => {
47
+ const [r, n] = await ae().run();
48
+ return r || !n ? "" : typeof n.publicKey == "string" ? n.publicKey : "";
49
+ }, se = (r, n) => {
50
+ const p = y(!1), a = W(), l = y({
14
51
  prePwd: "",
15
52
  pwd: "",
16
53
  confirmPwd: ""
17
- }), t = F({
54
+ }), o = F({
18
55
  pwdStrongLimit: !1,
19
56
  // 是否开启密码强度校验
20
57
  pwdRequireLength: !1,
@@ -29,117 +66,118 @@ const S = M.get("/user/change-pwd", (n) => (n.ignoreErrorMessage = !0, n)), A =
29
66
  // 密码要求包含大写字母
30
67
  pwdRequireSpecialCharacter: !1
31
68
  // 密码要求特殊字符
32
- }), L = async () => {
33
- const [o, e] = await J().run();
34
- o || (t.pwdStrongLimit = e.pwdStrongLimit, t.pwdRequireLength = e.pwdRequireLength, t.pwdMinLength = e.pwdMinLength, t.pwdRequireNum = e.pwdRequireNum, t.pwdRequireLowercaseLetters = e.pwdRequireLowercaseLetters, t.pwdRequireUppercaseLetters = e.pwdRequireUppercaseLetters, t.pwdRequireSpecialCharacter = e.pwdRequireSpecialCharacter);
35
- }, l = (o) => {
69
+ }), R = async () => {
70
+ const [s, e] = await Q().run();
71
+ s || (o.pwdStrongLimit = e.pwdStrongLimit, o.pwdRequireLength = e.pwdRequireLength, o.pwdMinLength = e.pwdMinLength, o.pwdRequireNum = e.pwdRequireNum, o.pwdRequireLowercaseLetters = e.pwdRequireLowercaseLetters, o.pwdRequireUppercaseLetters = e.pwdRequireUppercaseLetters, o.pwdRequireSpecialCharacter = e.pwdRequireSpecialCharacter);
72
+ }, m = (s) => {
36
73
  let e = "";
37
- return t.pwdStrongLimit ? e = E(o) : e = u(o), e;
38
- }, _ = (o, e, a) => {
39
- var i;
40
- if (!e) return a(new Error(s("新密码不能为空")));
41
- if (n.mainApp === "enterpriseadmin") {
42
- const C = l(e);
43
- if ((i = m.value) == null || i.validateField("confirmPwd", () => null), C) return a(new Error(C));
74
+ return o.pwdStrongLimit ? e = M(s) : e = f(s), e;
75
+ }, P = (s, e, i) => {
76
+ var u;
77
+ if (!e) return i(new Error(d("新密码不能为空")));
78
+ if (r.mainApp === "enterpriseadmin") {
79
+ const c = m(e);
80
+ if ((u = a.value) == null || u.validateField("confirmPwd", () => null), c) return i(new Error(c));
44
81
  }
45
- a();
46
- }, N = (o, e, a) => {
47
- if (!e) return a(new Error(s("确认密码不能为空")));
48
- if (d.value.pwd !== e) return a(new Error(s("与新密码不一致")));
49
- if (n.mainApp === "enterpriseadmin") {
50
- const i = l(e);
51
- if (i) return a(new Error(i));
82
+ i();
83
+ }, _ = (s, e, i) => {
84
+ if (!e) return i(new Error(d("确认密码不能为空")));
85
+ if (l.value.pwd !== e) return i(new Error(d("与新密码不一致")));
86
+ if (r.mainApp === "enterpriseadmin") {
87
+ const u = m(e);
88
+ if (u) return i(new Error(u));
52
89
  }
53
- a();
54
- }, P = R({
90
+ i();
91
+ }, b = y({
55
92
  prePwd: [
56
93
  {
57
- required: !n.forceUpdate,
58
- message: s("旧密码不能为空"),
94
+ required: !r.forceUpdate,
95
+ message: d("旧密码不能为空"),
59
96
  trigger: "blur"
60
97
  }
61
98
  ],
62
- pwd: [{ validator: _, trigger: "blur" }],
63
- confirmPwd: [{ validator: N, trigger: "blur" }]
64
- }), c = R(""), b = (o) => {
65
- n.mainApp === "enterpriseadmin" && L(), w.value = !0, c.value = o || "";
66
- }, p = (o = !1) => {
99
+ pwd: [{ validator: P, trigger: "blur" }],
100
+ confirmPwd: [{ validator: _, trigger: "blur" }]
101
+ }), g = y(""), L = (s) => {
102
+ r.mainApp === "enterpriseadmin" && R(), p.value = !0, g.value = s || "";
103
+ }, w = (s = !1) => {
67
104
  var e;
68
- d.value.prePwd = "", d.value.pwd = "", d.value.confirmPwd = "", (e = m.value) == null || e.resetField(), w.value = !1, o || f("onCancel");
69
- }, u = (o) => {
70
- const e = s("das-ui-business-components-change-pwd-passwordFormatRule");
71
- return /^(?=.*[a-zA-Z])(?=.*[\d])(?=.*[\w])[a-zA-Z\d\W_]{8,20}$/.test(o) ? "" : e;
72
- }, E = (o) => {
73
- let e = "", a = !1;
74
- e += s("das-ui-business-components-change-pwd-limit-number", t.pwdMinLength);
75
- const i = `\\S{${t.pwdMinLength},}`;
76
- return new RegExp(i).test(o) || (a = !0), (t.pwdRequireNum || t.pwdRequireLowercaseLetters || t.pwdRequireUppercaseLetters || t.pwdRequireSpecialCharacter) && (e += s("必须包含")), t.pwdRequireNum && (e += s("数字,"), /\d+/.test(o) || (a = !0)), t.pwdRequireLowercaseLetters && (e += s("小写字母,"), /[a-z]+/.test(o) || (a = !0)), t.pwdRequireUppercaseLetters && (e += s("大写字母,"), /[A-Z]+/.test(o) || (a = !0)), t.pwdRequireSpecialCharacter && (e += s("符号,"), /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~]+/.test(o) || (a = !0)), a ? e.slice(0, -1) : "";
105
+ l.value.prePwd = "", l.value.pwd = "", l.value.confirmPwd = "", (e = a.value) == null || e.resetField(), p.value = !1, s || n("onCancel");
106
+ }, f = (s) => {
107
+ const e = d("das-ui-business-components-change-pwd-passwordFormatRule");
108
+ return /^(?=.*[a-zA-Z])(?=.*[\d])(?=.*[\w])[a-zA-Z\d\W_]{8,20}$/.test(s) ? "" : e;
109
+ }, M = (s) => {
110
+ let e = "", i = !1;
111
+ e += d("das-ui-business-components-change-pwd-limit-number", o.pwdMinLength);
112
+ const u = `\\S{${o.pwdMinLength},}`;
113
+ return new RegExp(u).test(s) || (i = !0), (o.pwdRequireNum || o.pwdRequireLowercaseLetters || o.pwdRequireUppercaseLetters || o.pwdRequireSpecialCharacter) && (e += d("必须包含")), o.pwdRequireNum && (e += d("数字,"), /\d+/.test(s) || (i = !0)), o.pwdRequireLowercaseLetters && (e += d("小写字母,"), /[a-z]+/.test(s) || (i = !0)), o.pwdRequireUppercaseLetters && (e += d("大写字母,"), /[A-Z]+/.test(s) || (i = !0)), o.pwdRequireSpecialCharacter && (e += d("符号,"), /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~]+/.test(s) || (i = !0)), i ? e.slice(0, -1) : "";
77
114
  };
78
115
  return {
79
- visible: w,
80
- formData: d,
81
- form: m,
82
- rules: P,
83
- openDialog: b,
84
- onCancel: p,
116
+ visible: p,
117
+ formData: l,
118
+ form: a,
119
+ rules: b,
120
+ openDialog: L,
121
+ onCancel: w,
85
122
  onConfirm: async () => {
86
- var o;
87
- (o = m.value) == null || o.validate(async (e) => {
123
+ var s;
124
+ (s = a.value) == null || s.validate(async (e) => {
125
+ const i = await ne(oe);
88
126
  if (e) {
89
- const a = {
90
- pwd: k(d.value.pwd),
91
- confirmPwd: k(d.value.confirmPwd)
127
+ const u = {
128
+ pwd: i(l.value.pwd),
129
+ confirmPwd: i(l.value.confirmPwd)
92
130
  };
93
- if (n.mainApp === "enterpriseadmin" && n.forceUpdate) {
94
- let i = {};
95
- c.value && (i = { headers: { Authorization: c.value } }), await S({}, i).run();
96
- const [C] = await A({}, i).run(a);
97
- if (C) return;
98
- } else if (a.prePwd = k(d.value.prePwd), n.mainApp === "enterpriseadmin") {
99
- await S().run();
100
- const [i] = await A().run(a);
101
- if (i) return;
131
+ if (r.mainApp === "enterpriseadmin" && r.forceUpdate) {
132
+ let c = {};
133
+ g.value && (c = { headers: { Authorization: g.value } }), await D({}, c).run();
134
+ const [K] = await U({}, c).run(u);
135
+ if (K) return;
136
+ } else if (u.prePwd = i(l.value.prePwd), r.mainApp === "enterpriseadmin") {
137
+ await D().run();
138
+ const [c] = await U().run(u);
139
+ if (c) return;
102
140
  } else {
103
- const [i] = await H().run(a);
104
- if (i) return;
141
+ const [c] = await J().run(u);
142
+ if (c) return;
105
143
  }
106
- p(!0), K.success(s("修改密码成功!")), f("onConfirm");
144
+ w(!0), G.success(d("修改密码成功!")), n("onConfirm");
107
145
  }
108
146
  });
109
147
  }
110
148
  };
111
- }, X = { class: "dialog-content" }, ee = {
149
+ }, ie = { class: "dialog-content" }, pe = {
112
150
  name: "ChangePwd"
113
- }, re = /* @__PURE__ */ T({
114
- ...ee,
151
+ }, de = /* @__PURE__ */ T({
152
+ ...pe,
115
153
  props: {
116
154
  mainApp: { default: "enterpriseadmin" },
117
155
  forceUpdate: { type: Boolean }
118
156
  },
119
157
  emits: ["onCancel", "onConfirm"],
120
- setup(n, { expose: f, emit: w }) {
121
- const m = n, d = w, { visible: t, form: L, formData: l, rules: _, openDialog: N, onCancel: P, onConfirm: c } = Q(m, d);
122
- return f({
123
- openDialog: N
124
- }), (b, p) => (y(), v(r(Z), {
125
- title: r(s)("修改密码"),
158
+ setup(r, { expose: n, emit: p }) {
159
+ const a = r, l = p, { visible: o, form: R, formData: m, rules: P, openDialog: _, onCancel: b, onConfirm: g } = se(a, l);
160
+ return n({
161
+ openDialog: _
162
+ }), (L, w) => (z(), v(t(Z), {
163
+ title: t(d)("修改密码"),
126
164
  width: "460px",
127
165
  height: "360px",
128
166
  bodyStyle: { padding: 0 },
129
- modelValue: r(t),
130
- "onUpdate:modelValue": p[3] || (p[3] = (u) => $(t) ? t.value = u : null),
131
- "before-close": r(P)
167
+ modelValue: t(o),
168
+ "onUpdate:modelValue": w[3] || (w[3] = (f) => B(o) ? o.value = f : null),
169
+ "before-close": t(b)
132
170
  }, {
133
- footer: g(() => [
134
- z("div", null, [
135
- h(r(U), {
171
+ footer: h(() => [
172
+ V("div", null, [
173
+ C(t(E), {
136
174
  size: "middle",
137
175
  style: { "margin-right": "12px" },
138
- onClick: r(P)
176
+ onClick: t(b)
139
177
  }, {
140
- default: g(() => [
141
- V(
142
- D(r(x)("取消").value),
178
+ default: h(() => [
179
+ A(
180
+ S(t(x)("取消").value),
143
181
  1
144
182
  /* TEXT */
145
183
  )
@@ -147,14 +185,14 @@ const S = M.get("/user/change-pwd", (n) => (n.ignoreErrorMessage = !0, n)), A =
147
185
  _: 1
148
186
  /* STABLE */
149
187
  }, 8, ["onClick"]),
150
- h(r(U), {
188
+ C(t(E), {
151
189
  btnType: "primary",
152
190
  size: "middle",
153
- onClick: r(c)
191
+ onClick: t(g)
154
192
  }, {
155
- default: g(() => [
156
- V(
157
- D(r(x)("确定").value),
193
+ default: h(() => [
194
+ A(
195
+ S(t(x)("确定").value),
158
196
  1
159
197
  /* TEXT */
160
198
  )
@@ -164,51 +202,51 @@ const S = M.get("/user/change-pwd", (n) => (n.ignoreErrorMessage = !0, n)), A =
164
202
  }, 8, ["onClick"])
165
203
  ])
166
204
  ]),
167
- default: g(() => [
168
- z("div", X, [
169
- h(r(G), {
205
+ default: h(() => [
206
+ V("div", ie, [
207
+ C(t(j), {
170
208
  ref_key: "form",
171
- ref: L,
172
- rules: r(_),
209
+ ref: R,
210
+ rules: t(P),
173
211
  style: { "overflow-x": "hidden !important" }
174
212
  }, {
175
- default: g(() => [
176
- b.forceUpdate ? I("v-if", !0) : (y(), v(r(q), {
213
+ default: h(() => [
214
+ L.forceUpdate ? I("v-if", !0) : (z(), v(t(N), {
177
215
  key: 0,
178
216
  type: "password",
179
217
  isTitle: !1,
180
218
  autocomplete: "new-password",
181
219
  "show-password": "",
182
220
  prop: "prePwd",
183
- label: r(s)("旧密码"),
184
- modelValue: r(l).prePwd,
185
- "onUpdate:modelValue": p[0] || (p[0] = (u) => r(l).prePwd = u),
221
+ label: t(d)("旧密码"),
222
+ modelValue: t(m).prePwd,
223
+ "onUpdate:modelValue": w[0] || (w[0] = (f) => t(m).prePwd = f),
186
224
  modelModifiers: { trim: !0 },
187
225
  maxlength: 20,
188
226
  required: ""
189
227
  }, null, 8, ["label", "modelValue"])),
190
- h(r(q), {
228
+ C(t(N), {
191
229
  type: "password",
192
230
  isTitle: !1,
193
231
  autocomplete: "new-password",
194
232
  "show-password": "",
195
233
  prop: "pwd",
196
- label: r(s)("新密码"),
197
- modelValue: r(l).pwd,
198
- "onUpdate:modelValue": p[1] || (p[1] = (u) => r(l).pwd = u),
234
+ label: t(d)("新密码"),
235
+ modelValue: t(m).pwd,
236
+ "onUpdate:modelValue": w[1] || (w[1] = (f) => t(m).pwd = f),
199
237
  modelModifiers: { trim: !0 },
200
238
  maxlength: 20,
201
239
  required: ""
202
240
  }, null, 8, ["label", "modelValue"]),
203
- h(r(q), {
241
+ C(t(N), {
204
242
  type: "password",
205
243
  isTitle: !1,
206
244
  autocomplete: "new-password",
207
245
  "show-password": "",
208
246
  prop: "confirmPwd",
209
- label: r(s)("确认新密码"),
210
- modelValue: r(l).confirmPwd,
211
- "onUpdate:modelValue": p[2] || (p[2] = (u) => r(l).confirmPwd = u),
247
+ label: t(d)("确认新密码"),
248
+ modelValue: t(m).confirmPwd,
249
+ "onUpdate:modelValue": w[2] || (w[2] = (f) => t(m).confirmPwd = f),
212
250
  modelModifiers: { trim: !0 },
213
251
  maxlength: 20,
214
252
  required: ""
@@ -223,12 +261,12 @@ const S = M.get("/user/change-pwd", (n) => (n.ignoreErrorMessage = !0, n)), A =
223
261
  /* STABLE */
224
262
  }, 8, ["title", "modelValue", "before-close"]));
225
263
  }
226
- }), te = (n, f) => {
227
- const w = n.__vccOpts || n;
228
- for (const [m, d] of f)
229
- w[m] = d;
230
- return w;
231
- }, oe = /* @__PURE__ */ te(re, [["__scopeId", "data-v-901c1af6"]]), ae = {
264
+ }), le = (r, n) => {
265
+ const p = r.__vccOpts || r;
266
+ for (const [a, l] of n)
267
+ p[a] = l;
268
+ return p;
269
+ }, ue = /* @__PURE__ */ le(de, [["__scopeId", "data-v-901c1af6"]]), we = {
232
270
  新密码不能为空: { "zh-CN": "新密码不能为空", en: "New password cannot be empty", _appCode: "framework" },
233
271
  确认密码不能为空: { "zh-CN": "确认密码不能为空", en: "Confirm password cannot be empty", _appCode: "framework" },
234
272
  与新密码不一致: { "zh-CN": "与新密码不一致", en: "Doesn't match the new password", _appCode: "framework" },
@@ -260,9 +298,9 @@ const S = M.get("/user/change-pwd", (n) => (n.ignoreErrorMessage = !0, n)), A =
260
298
  _appCode: "framework"
261
299
  }
262
300
  };
263
- O(ae);
264
- const Ce = B(oe), ge = () => R(null);
301
+ $(we);
302
+ const Le = O(ue), Ne = () => y(null);
265
303
  export {
266
- Ce as DasChangePwd,
267
- ge as DasChangePwdRef
304
+ Le as DasChangePwd,
305
+ Ne as DasChangePwdRef
268
306
  };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * 获取 EnterpriseRight 服务的 RSA 公钥字符串。
3
+ * 请求失败时返回空字符串,由调用方兼容旧编码方式。
4
+ */
5
+ export declare const getEnterpriseRightPublicKey: () => Promise<string>;
6
+ /**
7
+ * 获取 OAuth 服务的 RSA 公钥字符串。
8
+ * 请求失败时返回空字符串,由调用方兼容旧编码方式。
9
+ */
10
+ export declare const getAuthPublicKey: () => Promise<string>;
@@ -0,0 +1,8 @@
1
+ type GetPublicKey = () => Promise<string>;
2
+ export type SensitiveValueEncryptor = (value: string) => Promise<string>;
3
+ /**
4
+ * 根据对应服务的公钥创建敏感值加密函数。
5
+ * 公钥不可用时保留原编码方式,确保兼容尚未启用 RSA 的服务。
6
+ */
7
+ export declare const createSensitiveValueEncryptor: (getPublicKey: GetPublicKey) => Promise<SensitiveValueEncryptor>;
8
+ export {};