@pubinfo/module-crypto 2.1.10-beta.2 → 2.1.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.
@@ -1,5 +1,5 @@
1
1
  import { n as getCryptoGetCryptoConfig, r as postCryptoEditCryptoConfig, t as ctx } from "./index.js";
2
- import { n as useToggle, t as drawerCryptoUrl_default } from "./drawerCryptoUrl-CKgf1Uxz.js";
2
+ import { r as useToggle, t as drawerCryptoUrl_default } from "./drawerCryptoUrl-I-5m5_57.js";
3
3
  import { PubinfoIcon, useAuth } from "pubinfo";
4
4
  import { Button, CheckableTag, Form, FormItem, Space, Switch } from "ant-design-vue/es";
5
5
  import { createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, onMounted, openBlock, reactive, ref, resolveDirective, toDisplayString, unref, withCtx, withDirectives } from "vue";
@@ -18,51 +18,51 @@ var _hoisted_1 = {
18
18
  }, _hoisted_2 = {
19
19
  "h-full": "",
20
20
  "min-w-1130px": ""
21
- }, _hoisted_3 = { class: "pt-20px pl-20px h-161px flex flex-col bg-[#ffffff] box-border bg-[url('@/assets/images/crypto-setting-bg.png')] bg-cover text-[#4e5969] dark:text-[#C9CDD4]" }, _hoisted_4 = { class: "flex items-center" }, _hoisted_5 = { class: "p-5px bg-[#f2f3f5] rounded-5px flex items-center" }, _hoisted_6 = { class: "flex items-center ml-15px text-[#a3a4a8]" }, _hoisted_7 = { class: "h-[calc(100%-165px)]" }, _hoisted_8 = ["onClick"], _hoisted_9 = { class: "ml-4px" }, _hoisted_10 = ["onClick"], _hoisted_11 = { class: "ml-4px" }, setting_default = /* @__PURE__ */ ((e, E) => {
22
- let D = e.__vccOpts || e;
23
- for (let [e, O] of E) D[e] = O;
24
- return D;
21
+ }, _hoisted_3 = { class: "pt-20px pl-20px h-161px flex flex-col bg-[#ffffff] box-border bg-[url('@/assets/images/crypto-setting-bg.png')] bg-cover text-[#4e5969] dark:text-[#C9CDD4]" }, _hoisted_4 = { class: "flex items-center" }, _hoisted_5 = { class: "p-5px bg-[#f2f3f5] rounded-5px flex items-center" }, _hoisted_6 = { class: "flex items-center ml-15px text-[#a3a4a8]" }, _hoisted_7 = { class: "h-[calc(100%-165px)]" }, _hoisted_8 = ["onClick"], _hoisted_9 = { class: "ml-4px" }, _hoisted_10 = ["onClick"], _hoisted_11 = { class: "ml-4px" }, setting_default = /* @__PURE__ */ ((e, t) => {
22
+ let n = e.__vccOpts || e;
23
+ for (let [e, r] of t) n[e] = r;
24
+ return n;
25
25
  })(/* @__PURE__ */ defineComponent({
26
26
  __name: "setting",
27
- setup(M) {
28
- let R = ref(), z = ref(), B = ref(), V = { style: { width: "auto" } }, H = { span: 24 }, { auth: U } = useAuth(), W = reactive({
27
+ setup(s) {
28
+ let p = ref(), m = ref(), h = ref(), g = { style: { width: "auto" } }, _ = { span: 24 }, { auth: v } = useAuth(), y = reactive({
29
29
  isCrypto: !0,
30
30
  mode: !0,
31
31
  whiteListUrls: []
32
- }), [G, K] = useToggle(!1);
33
- onMounted(q);
34
- async function q() {
32
+ }), [b, x] = useToggle(!1);
33
+ onMounted(S);
34
+ async function S() {
35
35
  await getCryptoGetCryptoConfig().then((e) => {
36
- K(!1), e && e.data && e.success && (W.isCrypto = e.data.cryptoEnabled || !1, W.whiteListUrls = e.data.cryptoWhitePath, W.mode = e.data.cryptoMode === void 0 ? !0 : e.data.cryptoMode);
36
+ x(!1), e && e.data && e.success && (y.isCrypto = e.data.cryptoEnabled || !1, y.whiteListUrls = e.data.cryptoWhitePath, y.mode = e.data.cryptoMode === void 0 ? !0 : e.data.cryptoMode);
37
37
  });
38
38
  }
39
- function J(e, E) {
40
- E && (W.mode = e, Y());
39
+ function C(e, t) {
40
+ t && (y.mode = e, w());
41
41
  }
42
- async function Y() {
43
- if (!G.value) {
44
- K(!0);
42
+ async function w() {
43
+ if (!b.value) {
44
+ x(!0);
45
45
  try {
46
- await z.value?.validate();
47
- let { isCrypto: e, mode: O, whiteListUrls: k } = W, A = {
46
+ await m.value?.validate();
47
+ let { isCrypto: e, mode: r, whiteListUrls: i } = y, a = {
48
48
  cryptoEnabled: e,
49
- cryptoMode: O,
50
- cryptoWhitePath: k
51
- }, { success: j } = await postCryptoEditCryptoConfig({ json: JSON.stringify(A) });
52
- j && (message.success("配置更改成功"), ctx.callAsync({
49
+ cryptoMode: r,
50
+ cryptoWhitePath: i
51
+ }, { success: o } = await postCryptoEditCryptoConfig({ json: JSON.stringify(a) });
52
+ o && (message.success("配置更改成功"), ctx.callAsync({
53
53
  ...ctx.use(),
54
- isCrypto: W.isCrypto,
55
- cryptoMode: W.mode,
56
- whiteListUrls: W.whiteListUrls
54
+ isCrypto: y.isCrypto,
55
+ cryptoMode: y.mode,
56
+ whiteListUrls: y.whiteListUrls
57
57
  }, () => {
58
- q();
58
+ S();
59
59
  }));
60
60
  } catch {
61
- K(!1);
61
+ x(!1);
62
62
  }
63
63
  }
64
64
  }
65
- let X = [
65
+ let T = [
66
66
  {
67
67
  minWidth: 60,
68
68
  hideInTable: !1,
@@ -83,7 +83,7 @@ var _hoisted_1 = {
83
83
  width: 200,
84
84
  fixed: "right",
85
85
  hideInTable() {
86
- return !U([
86
+ return !v([
87
87
  "crypto_url_add",
88
88
  "crypto_url_edit",
89
89
  "crypto_url_delete"
@@ -91,124 +91,124 @@ var _hoisted_1 = {
91
91
  }
92
92
  }
93
93
  ];
94
- function Z(e, E) {
95
- if (!G.value) switch (e) {
94
+ function E(e, t) {
95
+ if (!b.value) switch (e) {
96
96
  case ACTION.ADD:
97
- B.value.open(!1, W.whiteListUrls);
97
+ h.value.open(!1, y.whiteListUrls);
98
98
  break;
99
99
  case ACTION.EDIT:
100
- B.value.open(!0, W.whiteListUrls, E);
100
+ h.value.open(!0, y.whiteListUrls, t);
101
101
  break;
102
102
  case ACTION.REMOVE:
103
- Q(W.whiteListUrls || [], E || 0);
103
+ D(y.whiteListUrls || [], t || 0);
104
104
  break;
105
105
  }
106
106
  }
107
- function Q(e, E) {
107
+ function D(e, t) {
108
108
  Modal.confirm({
109
109
  title: "删除",
110
110
  content: "确定要删除该条数据吗?",
111
111
  async onOk() {
112
- e.splice(E, 1), $(e);
112
+ e.splice(t, 1), O(e);
113
113
  }
114
114
  });
115
115
  }
116
- function $(e) {
117
- W.whiteListUrls = e, Y();
116
+ function O(e) {
117
+ y.whiteListUrls = e, w();
118
118
  }
119
- return (e, E) => {
120
- let D = Switch, O = FormItem, j = CheckableTag, M = Form, N = PlusCircleOutlined, P = Button, F = PubinfoIcon, I = Space, L = resolveDirective("auth");
121
- return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createElementVNode("div", _hoisted_3, [createVNode(M, {
119
+ return (e, t) => {
120
+ let n = Switch, r = FormItem, o = CheckableTag, s = Form, c = PlusCircleOutlined, l = Button, u = PubinfoIcon, d = Space, f = resolveDirective("auth");
121
+ return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createElementVNode("div", _hoisted_3, [createVNode(s, {
122
122
  ref_key: "formRef",
123
- ref: z,
124
- model: W,
125
- "label-col": V,
126
- "wrapper-col": H,
123
+ ref: m,
124
+ model: y,
125
+ "label-col": g,
126
+ "wrapper-col": _,
127
127
  class: "safe-rule-form"
128
128
  }, {
129
- default: withCtx(() => [createVNode(O, {
129
+ default: withCtx(() => [createVNode(r, {
130
130
  label: "开启加密",
131
131
  name: "isCrypto"
132
132
  }, {
133
- default: withCtx(() => [createVNode(D, {
134
- checked: W.isCrypto,
135
- "onUpdate:checked": E[0] ||= (e) => W.isCrypto = e,
136
- disabled: unref(G),
137
- onChange: Y
133
+ default: withCtx(() => [createVNode(n, {
134
+ checked: y.isCrypto,
135
+ "onUpdate:checked": t[0] ||= (e) => y.isCrypto = e,
136
+ disabled: unref(b),
137
+ onChange: w
138
138
  }, null, 8, ["checked", "disabled"])]),
139
139
  _: 1
140
- }), createVNode(O, {
140
+ }), createVNode(r, {
141
141
  label: "模式",
142
142
  name: "isCrypto"
143
143
  }, {
144
- default: withCtx(() => [createElementVNode("div", _hoisted_4, [createElementVNode("div", _hoisted_5, [createVNode(j, {
145
- checked: W.mode,
146
- disabled: unref(G),
147
- class: normalizeClass(unref(G) ? "cursor-not-allowed!" : ""),
148
- onChange: E[1] ||= (e) => !unref(G) && J(!0, e)
144
+ default: withCtx(() => [createElementVNode("div", _hoisted_4, [createElementVNode("div", _hoisted_5, [createVNode(o, {
145
+ checked: y.mode,
146
+ disabled: unref(b),
147
+ class: normalizeClass(unref(b) ? "cursor-not-allowed!" : ""),
148
+ onChange: t[1] ||= (e) => !unref(b) && C(!0, e)
149
149
  }, {
150
- default: withCtx(() => [...E[4] ||= [createTextVNode(" 白名单 ", -1)]]),
150
+ default: withCtx(() => [...t[4] ||= [createTextVNode(" 白名单 ", -1)]]),
151
151
  _: 1
152
152
  }, 8, [
153
153
  "checked",
154
154
  "disabled",
155
155
  "class"
156
- ]), createVNode(j, {
157
- checked: !W.mode,
158
- class: normalizeClass(["mr-0px!", unref(G) ? "cursor-not-allowed!" : ""]),
159
- onChange: E[2] ||= (e) => !unref(G) && J(!1, e)
156
+ ]), createVNode(o, {
157
+ checked: !y.mode,
158
+ class: normalizeClass(["mr-0px!", unref(b) ? "cursor-not-allowed!" : ""]),
159
+ onChange: t[2] ||= (e) => !unref(b) && C(!1, e)
160
160
  }, {
161
- default: withCtx(() => [...E[5] ||= [createTextVNode(" 黑名单 ", -1)]]),
161
+ default: withCtx(() => [...t[5] ||= [createTextVNode(" 黑名单 ", -1)]]),
162
162
  _: 1
163
- }, 8, ["checked", "class"])]), createElementVNode("div", _hoisted_6, [createVNode(unref(QuestionCircleOutlined), { class: "mr-5px" }), E[6] ||= createTextVNode("白名单模式下,仅不加密过滤列表中的接口;黑名单模式下,仅加密过滤列表中的接口。 ", -1)])])]),
163
+ }, 8, ["checked", "class"])]), createElementVNode("div", _hoisted_6, [createVNode(unref(QuestionCircleOutlined), { class: "mr-5px" }), t[6] ||= createTextVNode("白名单模式下,仅不加密过滤列表中的接口;黑名单模式下,仅加密过滤列表中的接口。 ", -1)])])]),
164
164
  _: 1
165
165
  })]),
166
166
  _: 1
167
167
  }, 8, ["model"])]), createElementVNode("div", _hoisted_7, [createVNode(unref(ProTable), {
168
168
  ref_key: "tableRef",
169
- ref: R,
169
+ ref: p,
170
170
  "row-key": "id",
171
- "data-source": W.whiteListUrls,
172
- columns: X,
171
+ "data-source": y.whiteListUrls,
172
+ columns: T,
173
173
  "auto-height": "",
174
174
  search: !1,
175
175
  pagination: !1,
176
176
  scroll: { x: 1e3 }
177
177
  }, {
178
- toolbar: withCtx(() => [withDirectives((openBlock(), createBlock(P, {
178
+ toolbar: withCtx(() => [withDirectives((openBlock(), createBlock(l, {
179
179
  type: "primary",
180
- disabled: unref(G),
181
- onClick: E[3] ||= (e) => Z(unref(ACTION).ADD)
180
+ disabled: unref(b),
181
+ onClick: t[3] ||= (e) => E(unref(ACTION).ADD)
182
182
  }, {
183
- default: withCtx(() => [createVNode(N), createTextVNode(" " + toDisplayString(unref(ACTION).ADD), 1)]),
183
+ default: withCtx(() => [createVNode(c), createTextVNode(" " + toDisplayString(unref(ACTION).ADD), 1)]),
184
184
  _: 1
185
- }, 8, ["disabled"])), [[L, "crypto_url_add"]])]),
186
- bodyCell: withCtx(({ column: e, index: E }) => [e.dataIndex === "action" ? (openBlock(), createBlock(I, { key: 0 }, {
185
+ }, 8, ["disabled"])), [[f, "crypto_url_add"]])]),
186
+ bodyCell: withCtx(({ column: e, index: t }) => [e.dataIndex === "action" ? (openBlock(), createBlock(d, { key: 0 }, {
187
187
  default: withCtx(() => [withDirectives((openBlock(), createElementBlock("a", {
188
188
  class: "flex items-center hover:opacity-80",
189
- onClick: (e) => Z(unref(ACTION).EDIT, E)
190
- }, [createVNode(F, {
189
+ onClick: (e) => E(unref(ACTION).EDIT, t)
190
+ }, [createVNode(u, {
191
191
  name: "edit",
192
192
  class: "text-base"
193
- }), createElementVNode("span", _hoisted_9, toDisplayString(unref(ACTION).EDIT), 1)], 8, _hoisted_8)), [[L, "crypto_url_edit"]]), withDirectives((openBlock(), createElementBlock("span", {
193
+ }), createElementVNode("span", _hoisted_9, toDisplayString(unref(ACTION).EDIT), 1)], 8, _hoisted_8)), [[f, "crypto_url_edit"]]), withDirectives((openBlock(), createElementBlock("span", {
194
194
  flex: "",
195
195
  "items-center": "",
196
196
  "text-red-500": "",
197
197
  "hover:cursor-pointer": "",
198
198
  "hover:text-red-500": "",
199
199
  "hover:opacity-80": "",
200
- onClick: (e) => Z(unref(ACTION).REMOVE, E)
201
- }, [createVNode(F, {
200
+ onClick: (e) => E(unref(ACTION).REMOVE, t)
201
+ }, [createVNode(u, {
202
202
  name: "remove",
203
203
  class: "text-base"
204
- }), createElementVNode("span", _hoisted_11, toDisplayString(unref(ACTION).REMOVE), 1)], 8, _hoisted_10)), [[L, "crypto_url_delete"]])]),
204
+ }), createElementVNode("span", _hoisted_11, toDisplayString(unref(ACTION).REMOVE), 1)], 8, _hoisted_10)), [[f, "crypto_url_delete"]])]),
205
205
  _: 2
206
206
  }, 1024)) : createCommentVNode("", !0)]),
207
207
  _: 1
208
208
  }, 8, ["data-source"])])]), createVNode(drawerCryptoUrl_default, {
209
209
  ref_key: "drawerRef",
210
- ref: B,
211
- onSubmit: $
210
+ ref: h,
211
+ onSubmit: O
212
212
  }, null, 512)]);
213
213
  };
214
214
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pubinfo/module-crypto",
3
3
  "type": "module",
4
- "version": "2.1.10-beta.2",
4
+ "version": "2.1.10",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -21,22 +21,22 @@
21
21
  },
22
22
  "peerDependencies": {
23
23
  "@ant-design/icons-vue": "^7.0.1",
24
- "@pubinfo/pro-components": "^1.8.0",
24
+ "@pubinfo/pro-components": "^1.8.2",
25
25
  "ant-design-vue": "^4.2.6",
26
- "pubinfo": "2.1.10-beta.2"
26
+ "pubinfo": "2.1.10"
27
27
  },
28
28
  "dependencies": {
29
- "@vueuse/core": "^14.1.0",
29
+ "@vueuse/core": "^14.2.1",
30
30
  "crypto-js": "^4.2.0",
31
31
  "gm-crypto": "^0.1.12",
32
- "jsencrypt": "^3.3.2"
32
+ "jsencrypt": "^3.5.4"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@ant-design/icons-vue": "^7.0.1",
36
- "@pubinfo/pro-components": "^1.8.0",
36
+ "@pubinfo/pro-components": "^1.8.2",
37
37
  "@types/crypto-js": "^4.2.2",
38
38
  "ant-design-vue": "^4.2.6",
39
- "pubinfo": "2.1.10-beta.2"
39
+ "pubinfo": "2.1.10"
40
40
  },
41
41
  "scripts": {
42
42
  "dev": "pubinfo build -w --sourcemap",
@@ -1,106 +0,0 @@
1
- import { Button, Drawer, Form, FormItem, Input, Space, Textarea } from "ant-design-vue/es";
2
- import { createBlock, createTextVNode, createVNode, defineComponent, isRef, onMounted, openBlock, reactive, ref, shallowRef, toValue, unref, withCtx } from "vue";
3
- typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
4
- function useToggle(e = !1, c = {}) {
5
- let { truthyValue: l = !0, falsyValue: u = !1 } = c, d = isRef(e), f = shallowRef(e);
6
- function p(e) {
7
- if (arguments.length) return f.value = e, f.value;
8
- {
9
- let e = toValue(l);
10
- return f.value = f.value === e ? toValue(u) : e, f.value;
11
- }
12
- }
13
- return d ? p : [f, p];
14
- }
15
- var drawerCryptoUrl_default = /* @__PURE__ */ defineComponent({
16
- name: "DrawerCryptoUrl",
17
- __name: "drawerCryptoUrl",
18
- emits: ["submit"],
19
- setup(m, { expose: h, emit: g }) {
20
- let v = g, y = { url: [{
21
- required: !0,
22
- validator: O,
23
- trigger: ["blur", "change"]
24
- }] }, [x, S] = useToggle(!1), C = ref(), w = ref({}), T = ref(!1), E = ref([]), D = ref(0);
25
- function O(e, c, l) {
26
- c ? /^\/(?!.*\*{3})(?:[\w-]+|:\w+|\*{1,2})(?:\/(?:[\w-]+|:\w+|\*{1,2}))*$/.test(c) ? l() : l(/* @__PURE__ */ Error("url格式不正确")) : l(/* @__PURE__ */ Error("请输入url"));
27
- }
28
- async function k(e, c, l) {
29
- S(!0), E.value = c || [], D.value = l || 0, e ? (T.value = !0, w.value = { ...c?.[l || 0] }) : (T.value = !1, w.value = {});
30
- }
31
- let [A, j] = useToggle(!1);
32
- function M() {
33
- C.value?.validate().then(() => {
34
- j(!0);
35
- let e = { ...w.value };
36
- T.value ? E.value[D.value] = e : E.value.push(e), j(!1), N(), v("submit", E.value);
37
- });
38
- }
39
- function N() {
40
- S(!1);
41
- }
42
- return h({ open: k }), (m, h) => {
43
- let g = Input, _ = FormItem, v = Textarea, b = Form, S = Button, T = Space, E = Drawer;
44
- return openBlock(), createBlock(E, {
45
- open: unref(x),
46
- "onUpdate:open": h[3] ||= (e) => isRef(x) ? x.value = e : null,
47
- title: "url信息",
48
- placement: "right",
49
- width: 600,
50
- "destroy-on-close": "",
51
- "footer-style": { textAlign: "right" },
52
- onClose: N
53
- }, {
54
- footer: withCtx(() => [createVNode(T, null, {
55
- default: withCtx(() => [createVNode(S, { onClick: N }, {
56
- default: withCtx(() => [...h[4] ||= [createTextVNode(" 取消 ", -1)]]),
57
- _: 1
58
- }), createVNode(S, {
59
- type: "primary",
60
- loading: unref(A),
61
- onClick: h[2] ||= (e) => M()
62
- }, {
63
- default: withCtx(() => [...h[5] ||= [createTextVNode(" 提交 ", -1)]]),
64
- _: 1
65
- }, 8, ["loading"])]),
66
- _: 1
67
- })]),
68
- default: withCtx(() => [createVNode(b, {
69
- ref_key: "formRef",
70
- ref: C,
71
- model: unref(w),
72
- rules: y,
73
- "label-col": { style: { width: "90px" } }
74
- }, {
75
- default: withCtx(() => [createVNode(_, {
76
- label: "url地址",
77
- name: "url",
78
- tooltip: "支持url通配符,示例:/api/v1/user/*,/api/login/**"
79
- }, {
80
- default: withCtx(() => [createVNode(g, {
81
- value: unref(w).url,
82
- "onUpdate:value": h[0] ||= (e) => unref(w).url = e,
83
- maxlength: 200
84
- }, null, 8, ["value"])]),
85
- _: 1
86
- }), createVNode(_, {
87
- label: "描述",
88
- name: "description"
89
- }, {
90
- default: withCtx(() => [createVNode(v, {
91
- value: unref(w).description,
92
- "onUpdate:value": h[1] ||= (e) => unref(w).description = e,
93
- rows: 3,
94
- "show-count": "",
95
- maxlength: 200
96
- }, null, 8, ["value"])]),
97
- _: 1
98
- })]),
99
- _: 1
100
- }, 8, ["model"])]),
101
- _: 1
102
- }, 8, ["open"]);
103
- };
104
- }
105
- });
106
- export { useToggle as n, drawerCryptoUrl_default as t };
@@ -1,2 +0,0 @@
1
- import { t as drawerCryptoUrl_default } from "./drawerCryptoUrl-CKgf1Uxz.js";
2
- export { drawerCryptoUrl_default as default };