@gct-paas/design-web 0.1.4-dev.13 → 0.1.4-dev.14

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 (38) hide show
  1. package/dist/index.min.css +1 -1
  2. package/dist/loader.esm.min.js +1 -778
  3. package/es/components/I18nSelect/src/i18n-select-input.vue.mjs +2 -2
  4. package/es/components/I18nSelect/src/i18n-select-input.vue_vue_type_script_setup_true_name_i18n-select-input_lang.mjs +1 -1
  5. package/es/components/I18nSelect/src/i18n-select-input.vue_vue_type_style_index_0_scoped_64c5221c_lang.css +3 -0
  6. package/es/components/form-component/FieldCheckbox.d.ts +38 -0
  7. package/es/components/form-component/FieldCheckbox.mjs +71 -0
  8. package/es/components/form-component/FieldRadio.d.ts +38 -0
  9. package/es/components/form-component/FieldRadio.mjs +64 -0
  10. package/es/components/form-component/FieldSelect.d.ts +82 -0
  11. package/es/components/form-component/FieldSelect.mjs +174 -0
  12. package/es/components/form-component/field-emptyValue.d.ts +6 -0
  13. package/es/components/form-component/field-label/selectTag.vue.d.ts +10 -0
  14. package/es/components/form-component/field-label/selectTag.vue.mjs +5 -0
  15. package/es/components/form-component/field-label/selectTag.vue_vue_type_script_setup_true_lang.mjs +22 -0
  16. package/es/components/form-component/field-label/tag-label.vue.d.ts +36 -0
  17. package/es/components/form-component/field-label/tag-label.vue.mjs +7 -0
  18. package/es/components/form-component/field-label/tag-label.vue_vue_type_script_setup_true_lang.mjs +143 -0
  19. package/es/components/form-component/field-label/tag-label.vue_vue_type_style_index_0_scoped_a1ded441_lang.css +15 -0
  20. package/es/components/form-component/field-label/tag-layout.vue.d.ts +21 -0
  21. package/es/components/form-component/field-label/tag-layout.vue.mjs +7 -0
  22. package/es/components/form-component/field-label/tag-layout.vue_vue_type_script_setup_true_lang.mjs +16 -0
  23. package/es/components/form-component/field-label/tag-layout.vue_vue_type_style_index_0_scoped_85e6a8f5_lang.css +12 -0
  24. package/es/components/form-component/field-label/tag-span.vue.d.ts +21 -0
  25. package/es/components/form-component/field-label/tag-span.vue.mjs +7 -0
  26. package/es/components/form-component/field-label/tag-span.vue_vue_type_script_setup_true_lang.mjs +25 -0
  27. package/es/components/form-component/field-label/tag-span.vue_vue_type_style_index_0_scoped_3bf855f6_lang.css +31 -0
  28. package/es/components/form-component/field-readonly.vue.d.ts +22 -0
  29. package/es/components/form-component/field-readonly.vue.mjs +5 -0
  30. package/es/components/form-component/field-readonly.vue_vue_type_script_setup_true_lang.mjs +82 -0
  31. package/es/components/form-component/index.css +40 -0
  32. package/es/components/form-component/index.d.ts +7 -0
  33. package/es/components/form-component/index.mjs +6 -0
  34. package/es/components/index.d.ts +1 -0
  35. package/es/components/index.mjs +7 -0
  36. package/es/index.mjs +7 -1
  37. package/package.json +8 -12
  38. package/es/components/I18nSelect/src/i18n-select-input.vue_vue_type_style_index_0_scoped_412e1309_lang.css +0 -3
@@ -1,778 +1 @@
1
- import { ButtonSize as e, cssLoader as t, t as n } from "@gct-paas/core";
2
- import { Fragment as r, computed as i, createApp as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, mergeProps as p, normalizeClass as m, onMounted as h, openBlock as g, reactive as _, ref as v, renderList as y, renderSlot as b, resolveComponent as x, toDisplayString as S, toRaw as C, toValue as w, unref as T, watch as E, withCtx as D } from "vue";
3
- import { has as O, isEmpty as k, omit as A } from "lodash-es";
4
- import { useModal as j, useModalInner as M } from "@gct-paas/core-web";
5
- import { SearchOutlined as ee } from "@ant-design/icons-vue";
6
- //#endregion
7
- //#region src/components/I18nSelect/src/i18n-modal.vue
8
- var N = /* @__PURE__ */ f({
9
- __name: "i18n-modal",
10
- props: {
11
- lang: {},
12
- getContainer: { type: Function }
13
- },
14
- emits: ["ok", "register"],
15
- setup(e, { emit: t }) {
16
- let i = e, a = t, s = v(), l = _({ id: "" }), u = v(!1), f = (e) => {
17
- e && (u.value = !1);
18
- }, [m, { closeModal: h }] = M((e) => {
19
- e && b(e);
20
- }), b = (e) => {
21
- u.value = !0, l.id = e.key;
22
- let { lang: t } = i;
23
- console.log(t, "lang========");
24
- for (let n of t) {
25
- let t = n.dataIndex;
26
- l[t] = e[t];
27
- }
28
- }, S = (e, t, r) => {
29
- /^[a-zA-Z_.]*$/.test(t) || r(n("sys.i18n.validated18nKeyErrorMsg")), r();
30
- }, w = async (e, t) => /^\s*$/g.test(t) ? Promise.reject(n("sys.notEmptySth", { sth: n("sys.i18n") })) : Promise.resolve(), E = () => {
31
- s.value?.validate().then(() => {
32
- a("ok", { ...C(l) }, u.value), h();
33
- });
34
- }, O = () => {
35
- s.value?.resetFields();
36
- };
37
- return (t, a) => {
38
- let h = x("a-input"), _ = x("a-form-item"), v = x("a-form"), b = x("BasicModal");
39
- return g(), o(b, p(t.$attrs, {
40
- title: u.value ? T(n)("sys.edit") : T(n)("sys.new"),
41
- centered: "",
42
- width: "640px",
43
- "min-height": 100,
44
- "mask-closable": !1,
45
- "after-close": O,
46
- "get-container": e.getContainer,
47
- onRegister: T(m),
48
- onOk: E,
49
- onVisibleChange: f
50
- }), {
51
- default: D(() => [d(v, {
52
- ref_key: "formRef",
53
- ref: s,
54
- model: l,
55
- "label-col": { span: 6 },
56
- "wrapper-col": { span: 16 },
57
- autocomplete: "off",
58
- layout: "horizontal"
59
- }, {
60
- default: D(() => [d(_, {
61
- label: T(n)("sys.i18n.resourceIdentification"),
62
- name: "id",
63
- rules: [{
64
- required: !0,
65
- message: T(n)("sys.pleaseInputSth", { sth: T(n)("sys.i18n.resourceIdentification") })
66
- }, { validator: S }]
67
- }, {
68
- default: D(() => [d(h, {
69
- value: l.id,
70
- "onUpdate:value": a[0] ||= (e) => l.id = e,
71
- "show-count": "",
72
- maxlength: 128,
73
- disabled: u.value
74
- }, null, 8, ["value", "disabled"])]),
75
- _: 1
76
- }, 8, ["label", "rules"]), (g(!0), c(r, null, y(i.lang, (e) => (g(), o(_, {
77
- key: e.dataIndex,
78
- label: e.title,
79
- name: e.dataIndex,
80
- rules: [{
81
- required: !0,
82
- message: T(n)("sys.pleaseInputSth", { sth: e.title })
83
- }, { validator: w }]
84
- }, {
85
- default: D(() => [d(h, {
86
- value: l[e.dataIndex],
87
- "onUpdate:value": (t) => l[e.dataIndex] = t,
88
- "show-count": "",
89
- maxlength: 300
90
- }, null, 8, ["value", "onUpdate:value"])]),
91
- _: 2
92
- }, 1032, [
93
- "label",
94
- "name",
95
- "rules"
96
- ]))), 128))]),
97
- _: 1
98
- }, 8, ["model"])]),
99
- _: 1
100
- }, 16, [
101
- "title",
102
- "get-container",
103
- "onRegister"
104
- ]);
105
- };
106
- }
107
- }), P = { class: "i18n-select-container" }, F = { class: "table-wrap" }, I = /* @__PURE__ */ f({
108
- __name: "i18n-select-container",
109
- props: {
110
- i18nModalKey: {},
111
- destroyCallback: { type: Function },
112
- saveCallback: { type: Function }
113
- },
114
- setup(e) {
115
- let [t, { closeModal: r }] = M(), [a, { openModal: s }] = j(), c = e, f = () => document.querySelector(`#${c.i18nModalKey}`), m = v(), y = _({ keywords: "" }), b = _({
116
- current: 1,
117
- pageSize: 5,
118
- total: 0,
119
- size: "small",
120
- showTotal: (e) => n("sys.component.table.total", { total: e })
121
- }), C = v([]), w = v(), E = v({
122
- type: "radio",
123
- hideSelectAll: !0,
124
- selectedRowKeys: [],
125
- onChange: B
126
- }), O = v(!1), k = i(() => []), A = async (e, t) => {
127
- O.value = !0;
128
- let n = await _api.apaas.i18NInfo.getPageList({
129
- pageNo: t ?? b.current,
130
- pageSize: b.pageSize,
131
- searchKey: e
132
- });
133
- if (O.value = !1, n && n.data) {
134
- let e = n.data.map((e) => {
135
- let t = JSON.parse(e?.info);
136
- return {
137
- key: e.key,
138
- type: e.type,
139
- ...Object.fromEntries(t.map((e) => [e.locale, e.info]))
140
- };
141
- });
142
- b.total = n.totalCount, C.value = e;
143
- }
144
- };
145
- h(A);
146
- let I = () => {
147
- m.value?.validate().then(async () => {
148
- await A(y.keywords, 1);
149
- });
150
- }, L = (e) => {
151
- let { current: t, total: n, pageSize: r } = e;
152
- b.current = t, b.total = n, b.pageSize = r, A();
153
- }, R = () => {
154
- s();
155
- }, z = async (e, t) => {
156
- let n = k.value.map((t) => ({
157
- locale: t.dataIndex,
158
- info: e[t.dataIndex]
159
- }));
160
- O.value = !0;
161
- try {
162
- t ? await _api.apaas.i18NInfo.putKey({ key: e.id }, { info: JSON.stringify(n) }) : await _api.apaas.i18NInfo.post({
163
- info: JSON.stringify(n),
164
- key: e.id
165
- }), A(), B([e.id], [_(e)]);
166
- } catch {
167
- O.value = !1;
168
- }
169
- };
170
- function B(e, t) {
171
- E.value.selectedRowKeys = e, w.value = t;
172
- }
173
- let V = () => {
174
- c.destroyCallback && typeof c.destroyCallback == "function" && c.destroyCallback();
175
- }, H = async () => {
176
- if (c.saveCallback && typeof c.saveCallback == "function") {
177
- let e = E.value.selectedRowKeys, t = {};
178
- if (e && e[0]) {
179
- let n = w.value?.[0];
180
- console.log("selectRow", n), Object.assign(t, { i18nKey: e[0] });
181
- }
182
- c.saveCallback(t);
183
- }
184
- r();
185
- };
186
- return (e, r) => {
187
- let i = x("a-input"), s = x("a-form-item"), c = x("a-col"), h = x("a-button"), _ = x("plus-outlined"), v = x("a-row"), w = x("a-form"), A = x("a-table"), j = x("basic-modal");
188
- return g(), o(j, p(e.$attrs, {
189
- "min-height": 40,
190
- title: T(n)("sys.i18n.i18nConfig"),
191
- centered: "",
192
- width: "640px",
193
- "can-fullscreen": !1,
194
- "mask-closable": !1,
195
- "after-close": V,
196
- "get-container": f,
197
- onRegister: T(t),
198
- onOk: H
199
- }), {
200
- default: D(() => [l("div", P, [d(w, {
201
- ref_key: "formRef",
202
- ref: m,
203
- model: y,
204
- autocomplete: "off",
205
- layout: "horizontal"
206
- }, {
207
- default: D(() => [d(v, null, {
208
- default: D(() => [d(c, { span: 12 }, {
209
- default: D(() => [d(s, {
210
- name: "keywords",
211
- label: T(n)("sys.keywords")
212
- }, {
213
- default: D(() => [d(i, {
214
- value: y.keywords,
215
- "onUpdate:value": r[0] ||= (e) => y.keywords = e,
216
- placeholder: T(n)("sys.keywordsPlaceholder"),
217
- style: { display: "inline-flex" }
218
- }, null, 8, ["value", "placeholder"])]),
219
- _: 1
220
- }, 8, ["label"])]),
221
- _: 1
222
- }), d(c, {
223
- span: 12,
224
- style: { "text-align": "right" }
225
- }, {
226
- default: D(() => [d(h, {
227
- type: "primary",
228
- onClick: I
229
- }, {
230
- icon: D(() => [d(T(ee))]),
231
- default: D(() => [u(" " + S(T(n)("sys.queryText")), 1)]),
232
- _: 1
233
- }), d(h, {
234
- style: { margin: "0 8px" },
235
- type: "primary",
236
- onClick: R
237
- }, {
238
- icon: D(() => [d(_)]),
239
- default: D(() => [u(" " + S(T(n)("sys.new")), 1)]),
240
- _: 1
241
- })]),
242
- _: 1
243
- })]),
244
- _: 1
245
- })]),
246
- _: 1
247
- }, 8, ["model"]), l("div", F, [d(A, {
248
- ref: "tableRef",
249
- "data-source": C.value,
250
- columns: k.value,
251
- "show-index-column": !1,
252
- pagination: b,
253
- striped: !1,
254
- bordered: !0,
255
- "row-selection": E.value,
256
- loading: O.value,
257
- onChange: L
258
- }, null, 8, [
259
- "data-source",
260
- "columns",
261
- "pagination",
262
- "row-selection",
263
- "loading"
264
- ]), d(N, {
265
- lang: k.value,
266
- "get-container": f,
267
- onRegister: T(a),
268
- onOk: z
269
- }, null, 8, ["lang", "onRegister"])])])]),
270
- _: 1
271
- }, 16, ["title", "onRegister"]);
272
- };
273
- }
274
- }), L = (e, t) => {
275
- let n = e.__vccOpts || e;
276
- for (let [e, r] of t) n[e] = r;
277
- return n;
278
- }, R = /* @__PURE__ */ L(I, [["__scopeId", "data-v-0160ed5e"]]), z = /* @__PURE__ */ f({
279
- __name: "i18n-select-modal",
280
- setup(e, { expose: t }) {
281
- let [n, { openModal: r }] = j();
282
- return t({ open: () => {
283
- r();
284
- } }), (e, t) => (g(), o(R, { onRegister: T(n) }, null, 8, ["onRegister"]));
285
- }
286
- });
287
- //#endregion
288
- //#region src/components/I18nSelect/src/useI18nSelect.ts
289
- function B() {
290
- let e = null, t = null, n = v("");
291
- function r(r) {
292
- let o, s = document.body;
293
- if (O(r, "target") || O(r, "props")) {
294
- let e = r;
295
- o = e.props || {}, s = e.target || document.body;
296
- } else o = r;
297
- n.value = o.i18nModalKey || `i18n-select-modal-${Math.random().toString(16).substring(8)}`;
298
- let c = {
299
- ...o,
300
- destroyCallback: () => i(o?.destroyCallback),
301
- i18nModalKey: T(n)
302
- };
303
- if (!e) {
304
- let r = document.createElement("div");
305
- r.id = T(n), T(s)?.appendChild(r), e = a(z, c), t = e.mount(r);
306
- }
307
- t?.open();
308
- }
309
- function i(t) {
310
- typeof t == "function" && t(), document.querySelector(`#${T(n)}`).remove(), e &&= (e.unmount(), null);
311
- }
312
- return {
313
- open: r,
314
- close: i
315
- };
316
- }
317
- //#endregion
318
- //#region src/components/I18nSelect/src/i18n-select-btn.vue?vue&type=script&setup=true&name=i18n-select-btn&lang.ts
319
- var V = { class: "i18n-tooltip-title" }, H = { style: { "margin-left": "4px" } }, U = /* @__PURE__ */ L(/* @__PURE__ */ f({
320
- __name: "i18n-select-btn",
321
- props: {
322
- i18nValue: {},
323
- buttonExtraProps: {},
324
- size: {},
325
- i18nModalKey: {},
326
- simpleBtn: { type: Boolean },
327
- btnHeight: {},
328
- btnWidth: {}
329
- },
330
- emits: ["on-select-i18n", "closed"],
331
- setup(e, { emit: t }) {
332
- let n = v(), a = B(), s = e, u = t, f = _({}), h = i(() => !k(s.i18nValue)), b = async (e) => {
333
- let t = await _api.apaas.i18NInfo.getPageList({
334
- pageNo: 1,
335
- pageSize: 20,
336
- searchKey: e
337
- });
338
- if (t && t.data) {
339
- let e = t.data.find((e) => e.key === s.i18nValue);
340
- e && Object.assign(f, Object.fromEntries(Object.entries(JSON.parse(e.info)).map(([e, t]) => [t.locale, t.info])));
341
- }
342
- };
343
- E(() => s.i18nValue, () => {
344
- k(s.i18nValue) || b(s.i18nValue);
345
- }, { immediate: !0 });
346
- let C = () => {
347
- a.open({
348
- i18nModalKey: s.i18nModalKey,
349
- saveCallback: (e) => {
350
- u("on-select-i18n", { ...e });
351
- },
352
- destroyCallback: () => {
353
- u("closed");
354
- }
355
- });
356
- };
357
- return (t, i) => {
358
- let a = x("Icon"), s = x("a-button"), u = x("a-tooltip");
359
- return e.simpleBtn ? (g(), o(a, {
360
- key: 0,
361
- class: m(["i18n-icon simple-btn", { "is-highlight": h.value }]),
362
- icon: "ion:language",
363
- onClick: C
364
- }, null, 8, ["class"])) : h.value ? (g(), o(u, {
365
- key: 1,
366
- color: "#fff",
367
- placement: "topRight"
368
- }, {
369
- title: D(() => [l("div", V, "语言标识:" + S(e.i18nValue), 1), (g(!0), c(r, null, y(n.value, (e) => (g(), c("div", {
370
- key: e.id,
371
- class: "i18n-tooltip-item"
372
- }, [l("strong", null, S(e.language) + ": ", 1), l("span", H, S(f[e.languageTag]), 1)]))), 128))]),
373
- default: D(() => [d(s, p(e.buttonExtraProps, {
374
- class: { "is-highlight": h.value },
375
- style: {
376
- "--btn-width": e.btnWidth,
377
- "--btn-height": e.btnHeight
378
- },
379
- size: e.size,
380
- onClick: C
381
- }), {
382
- icon: D(() => [d(a, {
383
- class: "i18n-icon",
384
- icon: "ion:language"
385
- })]),
386
- _: 1
387
- }, 16, [
388
- "class",
389
- "style",
390
- "size"
391
- ])]),
392
- _: 1
393
- })) : (g(), o(s, p({ key: 2 }, e.buttonExtraProps, {
394
- class: { "is-highlight": h.value },
395
- style: {
396
- "--btn-width": e.btnWidth,
397
- "--btn-height": e.btnHeight
398
- },
399
- size: e.size,
400
- onClick: C
401
- }), {
402
- icon: D(() => [d(a, {
403
- class: "i18n-icon",
404
- icon: "ion:language"
405
- })]),
406
- _: 1
407
- }, 16, [
408
- "class",
409
- "style",
410
- "size"
411
- ]));
412
- };
413
- }
414
- }), [["__scopeId", "data-v-dc8ffb2c"]]), W = typeof window < "u" && typeof document < "u";
415
- typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
416
- var G = Object.prototype.toString, te = (e) => G.call(e) === "[object Object]", K = () => {}, ne = /* @__PURE__ */ re();
417
- function re() {
418
- var e, t;
419
- return W && !!(!((e = window) == null || (e = e.navigator) == null) && e.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((t = window) == null || (t = t.navigator) == null ? void 0 : t.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window?.navigator.userAgent));
420
- }
421
- function q(e) {
422
- return Array.isArray(e) ? e : [e];
423
- }
424
- function ie(e, t, n) {
425
- return E(e, t, {
426
- ...n,
427
- immediate: !0
428
- });
429
- }
430
- //#endregion
431
- //#region ../../node_modules/.pnpm/@vueuse+core@14.2.1_vue@3.5.30_typescript@5.9.3_/node_modules/@vueuse/core/dist/index.js
432
- var J = W ? window : void 0;
433
- W && window.document, W && window.navigator, W && window.location;
434
- function Y(e) {
435
- let t = w(e);
436
- return t?.$el ?? t;
437
- }
438
- function X(...e) {
439
- let t = (e, t, n, r) => (e.addEventListener(t, n, r), () => e.removeEventListener(t, n, r)), n = i(() => {
440
- let t = q(w(e[0])).filter((e) => e != null);
441
- return t.every((e) => typeof e != "string") ? t : void 0;
442
- });
443
- return ie(() => [
444
- n.value?.map((e) => Y(e)) ?? [J].filter((e) => e != null),
445
- q(w(n.value ? e[1] : e[0])),
446
- q(T(n.value ? e[2] : e[1])),
447
- w(n.value ? e[3] : e[2])
448
- ], ([e, n, r, i], a, o) => {
449
- if (!e?.length || !n?.length || !r?.length) return;
450
- let s = te(i) ? { ...i } : i, c = e.flatMap((e) => n.flatMap((n) => r.map((r) => t(e, n, r, s))));
451
- o(() => {
452
- c.forEach((e) => e());
453
- });
454
- }, { flush: "post" });
455
- }
456
- var Z = !1;
457
- function ae(e, t, n = {}) {
458
- let { window: r = J, ignore: i = [], capture: a = !0, detectIframe: o = !1, controls: s = !1 } = n;
459
- if (!r) return s ? {
460
- stop: K,
461
- cancel: K,
462
- trigger: K
463
- } : K;
464
- if (ne && !Z) {
465
- Z = !0;
466
- let e = { passive: !0 };
467
- Array.from(r.document.body.children).forEach((t) => t.addEventListener("click", K, e)), r.document.documentElement.addEventListener("click", K, e);
468
- }
469
- let c = !0, l = (e) => w(i).some((t) => {
470
- if (typeof t == "string") return Array.from(r.document.querySelectorAll(t)).some((t) => t === e.target || e.composedPath().includes(t));
471
- {
472
- let n = Y(t);
473
- return n && (e.target === n || e.composedPath().includes(n));
474
- }
475
- });
476
- function u(e) {
477
- let t = w(e);
478
- return t && t.$.subTree.shapeFlag === 16;
479
- }
480
- function d(e, t) {
481
- let n = w(e), r = n.$.subTree && n.$.subTree.children;
482
- return r == null || !Array.isArray(r) ? !1 : r.some((e) => e.el === t.target || t.composedPath().includes(e.el));
483
- }
484
- let f = (n) => {
485
- let r = Y(e);
486
- if (n.target != null && !(!(r instanceof Element) && u(e) && d(e, n)) && !(!r || r === n.target || n.composedPath().includes(r))) {
487
- if ("detail" in n && n.detail === 0 && (c = !l(n)), !c) {
488
- c = !0;
489
- return;
490
- }
491
- t(n);
492
- }
493
- }, p = !1, m = [
494
- X(r, "click", (e) => {
495
- p || (p = !0, setTimeout(() => {
496
- p = !1;
497
- }, 0), f(e));
498
- }, {
499
- passive: !0,
500
- capture: a
501
- }),
502
- X(r, "pointerdown", (t) => {
503
- let n = Y(e);
504
- c = !l(t) && !!(n && !t.composedPath().includes(n));
505
- }, { passive: !0 }),
506
- o && X(r, "blur", (n) => {
507
- setTimeout(() => {
508
- let i = Y(e);
509
- r.document.activeElement?.tagName === "IFRAME" && !i?.contains(r.document.activeElement) && t(n);
510
- }, 0);
511
- }, { passive: !0 })
512
- ].filter(Boolean), h = () => m.forEach((e) => e());
513
- return s ? {
514
- stop: h,
515
- cancel: () => {
516
- c = !1;
517
- },
518
- trigger: (e) => {
519
- c = !0, f(e), c = !1;
520
- }
521
- } : h;
522
- }
523
- //#endregion
524
- //#region src/components/I18nSelect/src/i18n-select-input.vue
525
- var Q = /* @__PURE__ */ L(/* @__PURE__ */ f({
526
- __name: "i18n-select-input",
527
- props: {
528
- attr: {},
529
- inputExtraProps: {},
530
- i18nConfig: {},
531
- i18nText: {},
532
- placeholderText: {},
533
- size: {},
534
- i18nModalKey: {},
535
- forceUpdate: { type: Boolean },
536
- btnHeight: {},
537
- btnWidth: {}
538
- },
539
- emits: [
540
- "update:i18nText",
541
- "update:i18nConfig",
542
- "on-i18n-select",
543
- "clickOutside",
544
- "focus",
545
- "blur"
546
- ],
547
- setup(t, { emit: n }) {
548
- let r = i(() => !!_gct.store.appInfo.id), a = t, c = n, l = i({
549
- get() {
550
- return a.i18nText ?? "";
551
- },
552
- set(e) {
553
- e !== a.i18nText && c("update:i18nText", e);
554
- }
555
- }), u = i(() => k(a.i18nConfig) ? {} : typeof a.i18nConfig == "string" ? JSON.parse(a.i18nConfig) ?? {} : a.i18nConfig ?? {}), f = i(() => u.value?.[a.attr]), m = (e) => {
556
- console.log("emit", e), e && ((k(l.value) || a.forceUpdate === !0) && c("update:i18nText", e.i18nTitle), c("update:i18nConfig", JSON.stringify(k(e) ? A(u.value, a.attr) : {
557
- ...u.value,
558
- [a.attr]: e.i18nKey
559
- })), c("on-i18n-select", e));
560
- }, h = v(), _ = () => {
561
- c("focus", h.value);
562
- }, y = () => {
563
- c("blur", h.value);
564
- }, S = v();
565
- return ae(S, () => {
566
- c("clickOutside");
567
- }), (n, i) => {
568
- let a = x("a-input"), u = x("a-input-group");
569
- return g(), o(u, {
570
- id: "i18nInputGroup",
571
- ref_key: "i18nInputGroup",
572
- ref: S,
573
- compact: ""
574
- }, {
575
- default: D(() => [b(n.$slots, "i18n-input", {}, () => [d(a, p({
576
- ref_key: "inputRef",
577
- ref: h
578
- }, t.inputExtraProps, {
579
- value: l.value,
580
- "onUpdate:value": i[0] ||= (e) => l.value = e,
581
- valueModifiers: { trim: !0 },
582
- style: {
583
- height: t.btnHeight ? t.btnHeight : t.size === T(e).SMALL ? "26px" : "32px",
584
- width: r.value ? `calc(100% - ${t.btnWidth ? t.btnWidth : t.size === T(e).SMALL ? "26px" : "32px"}` : "100%"
585
- },
586
- placeholder: t.placeholderText,
587
- size: t.size,
588
- "allow-clear": "",
589
- onFocus: _,
590
- onBlur: y
591
- }), null, 16, [
592
- "value",
593
- "style",
594
- "placeholder",
595
- "size"
596
- ])], !0), r.value ? (g(), o(U, {
597
- key: 0,
598
- "btn-height": t.btnHeight,
599
- "btn-width": t.btnWidth,
600
- "i18n-value": f.value,
601
- size: t.size,
602
- "i18n-modal-key": t.i18nModalKey,
603
- onOnSelectI18n: m,
604
- onClosed: i[1] ||= (e) => c("clickOutside")
605
- }, null, 8, [
606
- "btn-height",
607
- "btn-width",
608
- "i18n-value",
609
- "size",
610
- "i18n-modal-key"
611
- ])) : s("", !0)]),
612
- _: 3
613
- }, 512);
614
- };
615
- }
616
- }), [["__scopeId", "data-v-412e1309"]]), oe = /* @__PURE__ */ f({
617
- __name: "i18n-select-input-form",
618
- props: {
619
- formItemName: {},
620
- fromItemExtraProps: {},
621
- inputExtraProps: {},
622
- i18nConfig: {},
623
- text: {},
624
- formRef: {}
625
- },
626
- emits: ["update:text"],
627
- setup(e, { emit: t }) {
628
- let n = e, a = t, o = i({
629
- get() {
630
- return n.text ?? "";
631
- },
632
- set(e) {
633
- a("update:text", e), n.formRef?.validateFields([n.formItemName]);
634
- }
635
- });
636
- return (t, n) => {
637
- let i = x("a-form-item");
638
- return g(), c(r, null, [d(i, p({ name: e.formItemName }, e.fromItemExtraProps), {
639
- default: D(() => [d(Q, p(t.$attrs, {
640
- "i18n-text": o.value,
641
- "onUpdate:i18nText": n[0] ||= (e) => o.value = e,
642
- "input-extra-props": e.inputExtraProps,
643
- "i18n-config": e.i18nConfig,
644
- attr: Array.isArray(e.formItemName) ? e.formItemName.join(".") : e.formItemName,
645
- "placeholder-text": t.$t("sys.inputText")
646
- }), null, 16, [
647
- "i18n-text",
648
- "input-extra-props",
649
- "i18n-config",
650
- "attr",
651
- "placeholder-text"
652
- ])]),
653
- _: 1
654
- }, 16, ["name"]), d(i, {
655
- name: "i18nConfig",
656
- hidden: ""
657
- }, {
658
- default: D(() => [l("span", null, S(e.i18nConfig), 1)]),
659
- _: 1
660
- })], 64);
661
- };
662
- }
663
- }), se = { class: "inline-block w100% relative" }, $ = /* @__PURE__ */ L(/* @__PURE__ */ f({
664
- __name: "i18n-select-textarea",
665
- props: {
666
- attr: {},
667
- inputExtraProps: {},
668
- i18nConfig: {},
669
- i18nText: {},
670
- placeholderText: {},
671
- rows: {},
672
- style: {}
673
- },
674
- emits: [
675
- "update:i18nText",
676
- "update:i18nConfig",
677
- "on-i18n-select",
678
- "clickOutside",
679
- "focus"
680
- ],
681
- setup(e, { emit: t }) {
682
- let n = e, r = t, a = i({
683
- get() {
684
- return n.i18nText ?? "";
685
- },
686
- set(e) {
687
- r("update:i18nText", e);
688
- }
689
- }), o = i(() => k(n.i18nConfig) ? {} : typeof n.i18nConfig == "string" ? JSON.parse(n.i18nConfig) ?? {} : n.i18nConfig ?? {}), s = i(() => o.value?.[n.attr]), l = (e) => {
690
- e && (k(a.value) && r("update:i18nText", e.i18nTitle), r("update:i18nConfig", JSON.stringify(k(e) ? A(o.value, n.attr) : {
691
- ...o.value,
692
- [n.attr]: e.i18nKey
693
- })), r("on-i18n-select", e));
694
- }, u = v(), f = () => {
695
- r("focus", u.value);
696
- };
697
- return (t, n) => {
698
- let i = x("a-textarea");
699
- return g(), c("div", se, [d(i, p({
700
- ref_key: "inputRef",
701
- ref: u,
702
- value: a.value,
703
- "onUpdate:value": n[0] ||= (e) => a.value = e,
704
- placeholder: e.placeholderText
705
- }, e.inputExtraProps, {
706
- style: {
707
- resize: "none",
708
- ...e.style
709
- },
710
- onFocus: f
711
- }), null, 16, [
712
- "value",
713
- "placeholder",
714
- "style"
715
- ]), d(U, {
716
- "i18n-value": s.value,
717
- "simple-btn": !0,
718
- type: "text",
719
- onOnSelectI18n: l,
720
- onClosed: n[1] ||= (e) => r("clickOutside")
721
- }, null, 8, ["i18n-value"])]);
722
- };
723
- }
724
- }), [["__scopeId", "data-v-cd95c416"]]), ce = /* @__PURE__ */ f({
725
- __name: "i18n-select-textarea-form",
726
- props: {
727
- formItemName: {},
728
- fromItemExtraProps: {},
729
- inputExtraProps: {},
730
- i18nConfig: {},
731
- text: {},
732
- formRef: {}
733
- },
734
- emits: ["update:text"],
735
- setup(e, { emit: t }) {
736
- let n = e, a = t, o = i({
737
- get() {
738
- return n.text ?? "";
739
- },
740
- set(e) {
741
- a("update:text", e), n.formRef?.validateFields([n.formItemName]);
742
- }
743
- });
744
- return (t, n) => {
745
- let i = x("a-form-item");
746
- return g(), c(r, null, [d(i, p({ name: e.formItemName }, e.fromItemExtraProps), {
747
- default: D(() => [d($, p(t.$attrs, {
748
- "i18n-text": o.value,
749
- "onUpdate:i18nText": n[0] ||= (e) => o.value = e,
750
- "placeholder-text": t.$t("sys.inputText"),
751
- "input-extra-props": e.inputExtraProps,
752
- "i18n-config": e.i18nConfig,
753
- attr: Array.isArray(e.formItemName) ? e.formItemName.join(".") : e.formItemName
754
- }), null, 16, [
755
- "i18n-text",
756
- "placeholder-text",
757
- "input-extra-props",
758
- "i18n-config",
759
- "attr"
760
- ])]),
761
- _: 1
762
- }, 16, ["name"]), d(i, {
763
- name: "i18nConfig",
764
- hidden: ""
765
- }, {
766
- default: D(() => [l("span", null, S(e.i18nConfig), 1)]),
767
- _: 1
768
- })], 64);
769
- };
770
- }
771
- }), le = new URL(
772
- /* @vite-ignore */
773
- "./index.min.css",
774
- import.meta.url
775
- );
776
- t.load(le.href);
777
- //#endregion
778
- export { N as I18Modal, U as I18nSelectBtn, Q as I18nSelectInput, oe as I18nSelectInputForm, $ as I18nSelectTextarea, ce as I18nSelectTextareaForm, B as useI18nSelect };
1
+ import{ButtonSize as e,FIELD_TYPE as t,FormComponents as a,TagTypeEnum as l,cssLoader as o,t as n}from"@gct-paas/core";import{Fragment as i,computed as s,createApp as r,createBlock as u,createCommentVNode as c,createElementBlock as d,createElementVNode as p,createTextVNode as g,createVNode as y,defineComponent as m,h as f,inject as v,isVNode as b,mergeProps as x,normalizeClass as h,normalizeStyle as _,onMounted as S,openBlock as w,reactive as k,ref as C,renderList as T,renderSlot as E,resolveComponent as I,toDisplayString as P,toRaw as O,toRef as N,toValue as L,unref as M,useCssVars as A,watch as R,withCtx as z,withModifiers as W}from"vue";import{has as j,isEmpty as B,isString as F,omit as $,pick as U}from"lodash-es";import{IconNext as K,transformUrl as q,useModal as V,useModalInner as H}from"@gct-paas/core-web";import{SearchOutlined as J}from"@ant-design/icons-vue";import{Avatar as D,Checkbox as G,CheckboxGroup as Z,Radio as Y,RadioGroup as Q,Select as X}from"ant-design-vue";import{schemaToStyle as ee,transformField2Component as te}from"@gct-paas/design";var ae=/* @__PURE__ */m({__name:"i18n-modal",props:{lang:{},getContainer:{type:Function}},emits:["ok","register"],setup(e,{emit:t}){const a=e,l=t,o=C(),s=k({id:""}),r=C(!1),c=e=>{e&&(r.value=!1)},[p,{closeModal:g}]=H(e=>{e&&m(e)}),m=e=>{r.value=!0,s.id=e.key;const{lang:t}=a;console.log(t,"lang========");for(const a of t){const t=a.dataIndex;s[t]=e[t]}},f=(e,t,a)=>{/^[a-zA-Z_.]*$/.test(t)||a(n("sys.i18n.validated18nKeyErrorMsg")),a()},v=async(e,t)=>/^\s*$/g.test(t)?Promise.reject(n("sys.notEmptySth",{sth:n("sys.i18n")})):Promise.resolve(),b=()=>{o.value?.validate().then(()=>{l("ok",{...O(s)},r.value),g()})},h=()=>{o.value?.resetFields()};return(t,l)=>{const g=I("a-input"),m=I("a-form-item"),_=I("a-form"),S=I("BasicModal");return w(),u(S,x(t.$attrs,{title:r.value?M(n)("sys.edit"):M(n)("sys.new"),centered:"",width:"640px","min-height":100,"mask-closable":!1,"after-close":h,"get-container":e.getContainer,onRegister:M(p),onOk:b,onVisibleChange:c}),{default:z(()=>[y(_,{ref_key:"formRef",ref:o,model:s,"label-col":{span:6},"wrapper-col":{span:16},autocomplete:"off",layout:"horizontal"},{default:z(()=>[y(m,{label:M(n)("sys.i18n.resourceIdentification"),name:"id",rules:[{required:!0,message:M(n)("sys.pleaseInputSth",{sth:M(n)("sys.i18n.resourceIdentification")})},{validator:f}]},{default:z(()=>[y(g,{value:s.id,"onUpdate:value":l[0]||(l[0]=e=>s.id=e),"show-count":"",maxlength:128,disabled:r.value},null,8,["value","disabled"])]),_:1},8,["label","rules"]),(w(!0),d(i,null,T(a.lang,e=>(w(),u(m,{key:e.dataIndex,label:e.title,name:e.dataIndex,rules:[{required:!0,message:M(n)("sys.pleaseInputSth",{sth:e.title})},{validator:v}]},{default:z(()=>[y(g,{value:s[e.dataIndex],"onUpdate:value":t=>s[e.dataIndex]=t,"show-count":"",maxlength:300},null,8,["value","onUpdate:value"])]),_:2},1032,["label","name","rules"]))),128))]),_:1},8,["model"])]),_:1},16,["title","get-container","onRegister"])}}}),le={class:"i18n-select-container"},oe={class:"table-wrap"},ne=(e,t)=>{const a=e.__vccOpts||e;for(const[l,o]of t)a[l]=o;return a},ie=/* @__PURE__ */ne(/* @__PURE__ */m({__name:"i18n-select-container",props:{i18nModalKey:{},destroyCallback:{type:Function},saveCallback:{type:Function}},setup(e){const[t,{closeModal:a}]=H(),[l,{openModal:o}]=V(),i=e,r=()=>document.querySelector(`#${i.i18nModalKey}`),c=C(),d=k({keywords:""}),m=k({current:1,pageSize:5,total:0,size:"small",showTotal:e=>n("sys.component.table.total",{total:e})}),f=C([]),v=C(),b=C({type:"radio",hideSelectAll:!0,selectedRowKeys:[],onChange:A}),h=C(!1),_=s(()=>[]),T=async(e,t)=>{h.value=!0;const a=await _api.apaas.i18NInfo.getPageList({pageNo:t??m.current,pageSize:m.pageSize,searchKey:e});if(h.value=!1,a&&a.data){const e=a.data.map(e=>{const t=JSON.parse(e?.info);return{key:e.key,type:e.type,...Object.fromEntries(t.map(e=>[e.locale,e.info]))}});m.total=a.totalCount,f.value=e}};S(T);const E=()=>{c.value?.validate().then(async()=>{await T(d.keywords,1)})},O=e=>{const{current:t,total:a,pageSize:l}=e;m.current=t,m.total=a,m.pageSize=l,T()},N=()=>{o()},L=async(e,t)=>{const a=_.value.map(t=>({locale:t.dataIndex,info:e[t.dataIndex]}));h.value=!0;try{t?await _api.apaas.i18NInfo.putKey({key:e.id},{info:JSON.stringify(a)}):await _api.apaas.i18NInfo.post({info:JSON.stringify(a),key:e.id}),T(),A([e.id],[k(e)])}catch(l){h.value=!1}};function A(e,t){b.value.selectedRowKeys=e,v.value=t}const R=()=>{i.destroyCallback&&"function"==typeof i.destroyCallback&&i.destroyCallback()},W=async()=>{if(i.saveCallback&&"function"==typeof i.saveCallback){const e=b.value.selectedRowKeys,t={};if(e&&e[0]){const a=v.value?.[0];console.log("selectRow",a),Object.assign(t,{i18nKey:e[0]})}i.saveCallback(t)}a()};return(e,a)=>{const o=I("a-input"),i=I("a-form-item"),s=I("a-col"),v=I("a-button"),S=I("plus-outlined"),k=I("a-row"),C=I("a-form"),T=I("a-table"),A=I("basic-modal");return w(),u(A,x(e.$attrs,{"min-height":40,title:M(n)("sys.i18n.i18nConfig"),centered:"",width:"640px","can-fullscreen":!1,"mask-closable":!1,"after-close":R,"get-container":r,onRegister:M(t),onOk:W}),{default:z(()=>[p("div",le,[y(C,{ref_key:"formRef",ref:c,model:d,autocomplete:"off",layout:"horizontal"},{default:z(()=>[y(k,null,{default:z(()=>[y(s,{span:12},{default:z(()=>[y(i,{name:"keywords",label:M(n)("sys.keywords")},{default:z(()=>[y(o,{value:d.keywords,"onUpdate:value":a[0]||(a[0]=e=>d.keywords=e),placeholder:M(n)("sys.keywordsPlaceholder"),style:{display:"inline-flex"}},null,8,["value","placeholder"])]),_:1},8,["label"])]),_:1}),y(s,{span:12,style:{"text-align":"right"}},{default:z(()=>[y(v,{type:"primary",onClick:E},{icon:z(()=>[y(M(J))]),default:z(()=>[g(" "+P(M(n)("sys.queryText")),1)]),_:1}),y(v,{style:{margin:"0 8px"},type:"primary",onClick:N},{icon:z(()=>[y(S)]),default:z(()=>[g(" "+P(M(n)("sys.new")),1)]),_:1})]),_:1})]),_:1})]),_:1},8,["model"]),p("div",oe,[y(T,{ref:"tableRef","data-source":f.value,columns:_.value,"show-index-column":!1,pagination:m,striped:!1,bordered:!0,"row-selection":b.value,loading:h.value,onChange:O},null,8,["data-source","columns","pagination","row-selection","loading"]),y(ae,{lang:_.value,"get-container":r,onRegister:M(l),onOk:L},null,8,["lang","onRegister"])])])]),_:1},16,["title","onRegister"])}}}),[["__scopeId","data-v-0160ed5e"]]),se=/* @__PURE__ */m({__name:"i18n-select-modal",setup(e,{expose:t}){const[a,{openModal:l}]=V();return t({open:()=>{l()}}),(e,t)=>(w(),u(ie,{onRegister:M(a)},null,8,["onRegister"]))}});function re(){let e=null,t=null;const a=C("");function l(t){"function"==typeof t&&t(),document.querySelector(`#${M(a)}`).remove(),e&&(e.unmount(),e=null)}return{open:function(o){let n,i=document.body;if(j(o,"target")||j(o,"props")){const e=o;n=e.props||{},i=e.target||document.body}else n=o;a.value=n.i18nModalKey||`i18n-select-modal-${Math.random().toString(16).substring(8)}`;const s={...n,destroyCallback:()=>l(n?.destroyCallback),i18nModalKey:M(a)};if(!e){const l=document.createElement("div");l.id=M(a),M(i)?.appendChild(l),e=r(se,s),t=e.mount(l)}t?.open()},close:l}}var ue={class:"i18n-tooltip-title"},ce={style:{"margin-left":"4px"}},de=/* @__PURE__ */ne(/* @__PURE__ */m({__name:"i18n-select-btn",props:{i18nValue:{},buttonExtraProps:{},size:{},i18nModalKey:{},simpleBtn:{type:Boolean},btnHeight:{},btnWidth:{}},emits:["on-select-i18n","closed"],setup(e,{emit:t}){const a=C(),l=re(),o=e,n=t,r=k({}),c=s(()=>!B(o.i18nValue));R(()=>o.i18nValue,()=>{B(o.i18nValue)||(async e=>{const t=await _api.apaas.i18NInfo.getPageList({pageNo:1,pageSize:20,searchKey:e});if(t&&t.data){const e=t.data.find(e=>e.key===o.i18nValue);e&&Object.assign(r,Object.fromEntries(Object.entries(JSON.parse(e.info)).map(([e,t])=>[t.locale,t.info])))}})(o.i18nValue)},{immediate:!0});const g=()=>{l.open({i18nModalKey:o.i18nModalKey,saveCallback:e=>{n("on-select-i18n",{...e})},destroyCallback:()=>{n("closed")}})};return(t,l)=>{const o=I("Icon"),n=I("a-button"),s=I("a-tooltip");return e.simpleBtn?(w(),u(o,{key:0,class:h(["i18n-icon simple-btn",{"is-highlight":c.value}]),icon:"ion:language",onClick:g},null,8,["class"])):c.value?(w(),u(s,{key:1,color:"#fff",placement:"topRight"},{title:z(()=>[p("div",ue,"语言标识:"+P(e.i18nValue),1),(w(!0),d(i,null,T(a.value,e=>(w(),d("div",{key:e.id,class:"i18n-tooltip-item"},[p("strong",null,P(e.language)+": ",1),p("span",ce,P(r[e.languageTag]),1)]))),128))]),default:z(()=>[y(n,x(e.buttonExtraProps,{class:{"is-highlight":c.value},style:{"--btn-width":e.btnWidth,"--btn-height":e.btnHeight},size:e.size,onClick:g}),{icon:z(()=>[y(o,{class:"i18n-icon",icon:"ion:language"})]),_:1},16,["class","style","size"])]),_:1})):(w(),u(n,x({key:2},e.buttonExtraProps,{class:{"is-highlight":c.value},style:{"--btn-width":e.btnWidth,"--btn-height":e.btnHeight},size:e.size,onClick:g}),{icon:z(()=>[y(o,{class:"i18n-icon",icon:"ion:language"})]),_:1},16,["class","style","size"]))}}}),[["__scopeId","data-v-dc8ffb2c"]]),pe="undefined"!=typeof window&&"undefined"!=typeof document,ge=("undefined"!=typeof WorkerGlobalScope&&(globalThis,WorkerGlobalScope),Object.prototype.toString),ye=()=>{},me=/* @__PURE__ */fe();function fe(){var e,t,a;return pe&&!!(null===(e=window)||void 0===e||null===(e=e.navigator)||void 0===e?void 0:e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||(null===(t=window)||void 0===t||null===(t=t.navigator)||void 0===t?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(null===(a=window)||void 0===a?void 0:a.navigator.userAgent))}function ve(e){return Array.isArray(e)?e:[e]}function be(e){const t=Object.create(null);return a=>t[a]||(t[a]=e(a))}var xe=/\B([A-Z])/g,he=(be(e=>e.replace(xe,"-$1").toLowerCase()),/-(\w)/g);be(e=>e.replace(he,(e,t)=>t?t.toUpperCase():""));var _e=pe?window:void 0;function Se(e){var t;const a=L(e);return null!==(t=null==a?void 0:a.$el)&&void 0!==t?t:a}function we(...e){const t=s(()=>{const t=ve(L(e[0])).filter(e=>null!=e);return t.every(e=>"string"!=typeof e)?t:void 0});return a=([e,t,a,l],o,n)=>{if(!(null==e?void 0:e.length)||!(null==t?void 0:t.length)||!(null==a?void 0:a.length))return;const i=(s=l,"[object Object]"===ge.call(s)?{...l}:l);var s;const r=e.flatMap(e=>t.flatMap(t=>a.map(a=>((e,t,a,l)=>(e.addEventListener(t,a,l),()=>e.removeEventListener(t,a,l)))(e,t,a,i))));n(()=>{r.forEach(e=>e())})},l={flush:"post"},R(()=>{var a,l;return[null!==(a=null===(l=t.value)||void 0===l?void 0:l.map(e=>Se(e)))&&void 0!==a?a:[_e].filter(e=>null!=e),ve(L(t.value?e[1]:e[0])),ve(M(t.value?e[2]:e[1])),L(t.value?e[3]:e[2])]},a,{...l,immediate:!0});var a,l}pe&&window.document,pe&&window.navigator,pe&&window.location;var ke=!1;Number.POSITIVE_INFINITY;var Ce=/* @__PURE__ */ne(/* @__PURE__ */m({__name:"i18n-select-input",props:{attr:{},inputExtraProps:{},i18nConfig:{},i18nText:{},placeholderText:{},size:{},i18nModalKey:{},forceUpdate:{type:Boolean},btnHeight:{},btnWidth:{}},emits:["update:i18nText","update:i18nConfig","on-i18n-select","clickOutside","focus","blur"],setup(t,{emit:a}){const l=s(()=>!!_gct.store.appInfo.id),o=t,n=a,i=s({get:()=>o.i18nText??"",set(e){e!==o.i18nText&&n("update:i18nText",e)}}),r=s(()=>B(o.i18nConfig)?{}:"string"==typeof o.i18nConfig?JSON.parse(o.i18nConfig)??{}:o.i18nConfig??{}),d=s(()=>r.value?.[o.attr]??""),p=e=>{console.log("emit",e),e&&((B(i.value)||!0===o.forceUpdate)&&n("update:i18nText",e.i18nTitle),n("update:i18nConfig",JSON.stringify(B(e)?$(r.value,o.attr):{...r.value,[o.attr]:e.i18nKey})),n("on-i18n-select",e))},g=C(),m=()=>{n("focus",g.value)},f=()=>{n("blur",g.value)},v=C();return function(e,t,a={}){const{window:l=_e,ignore:o=[],capture:n=!0,detectIframe:i=!1,controls:s=!1}=a;if(!l)return s?{stop:ye,cancel:ye,trigger:ye}:ye;if(me&&!ke){ke=!0;const e={passive:!0};Array.from(l.document.body.children).forEach(t=>t.addEventListener("click",ye,e)),l.document.documentElement.addEventListener("click",ye,e)}let r=!0;const u=e=>L(o).some(t=>{if("string"==typeof t)return Array.from(l.document.querySelectorAll(t)).some(t=>t===e.target||e.composedPath().includes(t));{const a=Se(t);return a&&(e.target===a||e.composedPath().includes(a))}}),c=a=>{const l=Se(e);null!=a.target&&(l instanceof Element||!function(e){const t=L(e);return t&&16===t.$.subTree.shapeFlag}(e)||!function(e,t){const a=L(e),l=a.$.subTree&&a.$.subTree.children;return!(null==l||!Array.isArray(l))&&l.some(e=>e.el===t.target||t.composedPath().includes(e.el))}(e,a))&&l&&l!==a.target&&!a.composedPath().includes(l)&&("detail"in a&&0===a.detail&&(r=!u(a)),r?t(a):r=!0)};let d=!1;const p=[we(l,"click",e=>{d||(d=!0,setTimeout(()=>{d=!1},0),c(e))},{passive:!0,capture:n}),we(l,"pointerdown",t=>{const a=Se(e);r=!u(t)&&!(!a||t.composedPath().includes(a))},{passive:!0}),i&&we(l,"blur",a=>{setTimeout(()=>{var o;const n=Se(e);"IFRAME"!==(null===(o=l.document.activeElement)||void 0===o?void 0:o.tagName)||(null==n?void 0:n.contains(l.document.activeElement))||t(a)},0)},{passive:!0})].filter(Boolean),g=()=>p.forEach(e=>e())}(v,()=>{n("clickOutside")}),(a,o)=>{const s=I("a-input"),r=I("a-input-group");return w(),u(r,{id:"i18nInputGroup",ref_key:"i18nInputGroup",ref:v,compact:""},{default:z(()=>[E(a.$slots,"i18n-input",{},()=>[y(s,x({ref_key:"inputRef",ref:g},t.inputExtraProps,{value:i.value,"onUpdate:value":o[0]||(o[0]=e=>i.value=e),valueModifiers:{trim:!0},style:{height:t.btnHeight?t.btnHeight:t.size===M(e).SMALL?"26px":"32px",width:l.value?`calc(100% - ${t.btnWidth?t.btnWidth:t.size===M(e).SMALL?"26px":"32px"}`:"100%"},placeholder:t.placeholderText,size:t.size,"allow-clear":"",onFocus:m,onBlur:f}),null,16,["value","style","placeholder","size"])],!0),l.value?(w(),u(de,{key:0,"btn-height":t.btnHeight,"btn-width":t.btnWidth,"i18n-value":d.value,size:t.size,"i18n-modal-key":t.i18nModalKey,onOnSelectI18n:p,onClosed:o[1]||(o[1]=e=>n("clickOutside"))},null,8,["btn-height","btn-width","i18n-value","size","i18n-modal-key"])):c("",!0)]),_:3},512)}}}),[["__scopeId","data-v-64c5221c"]]),Te=/* @__PURE__ */m({__name:"i18n-select-input-form",props:{formItemName:{},fromItemExtraProps:{},inputExtraProps:{},i18nConfig:{},text:{},formRef:{}},emits:["update:text"],setup(e,{emit:t}){const a=e,l=t,o=s({get:()=>a.text??"",set(e){l("update:text",e),a.formRef?.validateFields([a.formItemName])}});return(t,a)=>{const l=I("a-form-item");return w(),d(i,null,[y(l,x({name:e.formItemName},e.fromItemExtraProps),{default:z(()=>[y(Ce,x(t.$attrs,{"i18n-text":o.value,"onUpdate:i18nText":a[0]||(a[0]=e=>o.value=e),"input-extra-props":e.inputExtraProps,"i18n-config":e.i18nConfig,attr:Array.isArray(e.formItemName)?e.formItemName.join("."):e.formItemName,"placeholder-text":t.$t("sys.inputText")}),null,16,["i18n-text","input-extra-props","i18n-config","attr","placeholder-text"])]),_:1},16,["name"]),y(l,{name:"i18nConfig",hidden:""},{default:z(()=>[p("span",null,P(e.i18nConfig),1)]),_:1})],64)}}}),Ee={class:"inline-block w100% relative"},Ie=/* @__PURE__ */ne(/* @__PURE__ */m({__name:"i18n-select-textarea",props:{attr:{},inputExtraProps:{},i18nConfig:{},i18nText:{},placeholderText:{},rows:{},style:{}},emits:["update:i18nText","update:i18nConfig","on-i18n-select","clickOutside","focus"],setup(e,{emit:t}){const a=e,l=t,o=s({get:()=>a.i18nText??"",set(e){l("update:i18nText",e)}}),n=s(()=>B(a.i18nConfig)?{}:"string"==typeof a.i18nConfig?JSON.parse(a.i18nConfig)??{}:a.i18nConfig??{}),i=s(()=>n.value?.[a.attr]),r=e=>{e&&(B(o.value)&&l("update:i18nText",e.i18nTitle),l("update:i18nConfig",JSON.stringify(B(e)?$(n.value,a.attr):{...n.value,[a.attr]:e.i18nKey})),l("on-i18n-select",e))},u=C(),c=()=>{l("focus",u.value)};return(t,a)=>{const n=I("a-textarea");return w(),d("div",Ee,[y(n,x({ref_key:"inputRef",ref:u,value:o.value,"onUpdate:value":a[0]||(a[0]=e=>o.value=e),placeholder:e.placeholderText},e.inputExtraProps,{style:{resize:"none",...e.style},onFocus:c}),null,16,["value","placeholder","style"]),y(de,{"i18n-value":i.value,"simple-btn":!0,type:"text",onOnSelectI18n:r,onClosed:a[1]||(a[1]=e=>l("clickOutside"))},null,8,["i18n-value"])])}}}),[["__scopeId","data-v-cd95c416"]]),Pe=/* @__PURE__ */m({__name:"i18n-select-textarea-form",props:{formItemName:{},fromItemExtraProps:{},inputExtraProps:{},i18nConfig:{},text:{},formRef:{}},emits:["update:text"],setup(e,{emit:t}){const a=e,l=t,o=s({get:()=>a.text??"",set(e){l("update:text",e),a.formRef?.validateFields([a.formItemName])}});return(t,a)=>{const l=I("a-form-item");return w(),d(i,null,[y(l,x({name:e.formItemName},e.fromItemExtraProps),{default:z(()=>[y(Ie,x(t.$attrs,{"i18n-text":o.value,"onUpdate:i18nText":a[0]||(a[0]=e=>o.value=e),"placeholder-text":t.$t("sys.inputText"),"input-extra-props":e.inputExtraProps,"i18n-config":e.i18nConfig,attr:Array.isArray(e.formItemName)?e.formItemName.join("."):e.formItemName}),null,16,["i18n-text","placeholder-text","input-extra-props","i18n-config","attr"])]),_:1},16,["name"]),y(l,{name:"i18nConfig",hidden:""},{default:z(()=>[p("span",null,P(e.i18nConfig),1)]),_:1})],64)}}}),Oe=/* @__PURE__ */ne(/* @__PURE__ */m({__name:"tag-span",props:{tagStyle:{}},setup(e){A(e=>({v650d3ac5:o.value}));const t=e,a=N(()=>t.tagStyle?.tagType||l.RADIUS),o=N(()=>t.tagStyle?.color||"#f0f0f0"),n=N(()=>`tag-${a.value}`);return(e,t)=>(w(),d("span",{class:h(["tag cursor-pointer",n.value])},[E(e.$slots,"default",{},void 0,!0)],2))}}),[["__scopeId","data-v-3bf855f6"]]),Ne=/* @__PURE__ */ne(/* @__PURE__ */m({__name:"tag-layout",props:{labelLayout:{},disabled:{type:Boolean}},setup:e=>(t,a)=>(w(),d("span",{class:h([e.disabled?"tag-label-disabled":null,!e.labelLayout?.hasLabelWidth||"left"!==e.labelLayout?.layout.label&&"horizontal"!=e.labelLayout?.layout?"":"ellipsis"==e.labelLayout?.overLabelDisplay?"label-ellipsis":"label-wrap"])},[E(t.$slots,"default",{},void 0,!0)],2))}),[["__scopeId","data-v-85e6a8f5"]]),Le={class:"select-text"},Me={class:"select-text"},Ae={key:0},Re=/* @__PURE__ */ne(/* @__PURE__ */m({__name:"tag-label",props:{tagWidgetStyle:{},type:{},disabled:{type:Boolean},label:{},isDesign:{type:Boolean},closable:{type:Boolean},showTagStyle:{type:Boolean,default:!0},avatar:{},iconExtraProps:{},iconProps:{}},emits:["on-close"],setup(e){const a=e,l=_gct.platformStore.themeSetting,o=v("labelLayout",{}),r=s(()=>{let e=a.label??"";if((!e||e.length<=0)&&a.isDesign){const t=a.type&&te(a.type)?.example||"";e=t?F(t)?n(t):t.map(e=>n(e)):""}return a.showTagStyle&&a.tagWidgetStyle?.tagStyleOpen||a.type===t.ENUM_MULTI||a.type===t.ENUM?e?F(e)?e.split(","):e:[]:e instanceof Array?e.join(","):e+""}),m=N(()=>{const e=a.tagWidgetStyle?.contentFont;return e?ee(e):{}}),b=(e="")=>{const t=a.iconExtraProps?.[e]||{},l={};return t?.textColor&&Object.assign(l,{color:t?.textColor}),m.value?.color?m.value:{wordBreak:"break-all",...m.value,...l}},x={render:({$attrs:e})=>{if(e.labelName){const t=a.iconExtraProps?.[e.labelName]||a.iconProps||{};if(!t?.icon)return;return f(K,{size:16,value:t?.icon,color:t?.iconColor||l.themeColor,style:"vertical-align: text-bottom; margin-right: 3px"})}}};return(l,n)=>e.showTagStyle&&e.tagWidgetStyle?.tagStyleOpen?(w(),u(Ne,{key:0,disabled:!!e.disabled,"label-layout":M(o)},{default:z(()=>[(w(!0),d(i,null,T(r.value,(t,o)=>(w(),u(Oe,{key:o,"tag-style":e.tagWidgetStyle.tagStyle,style:_(b(t))},{default:z(()=>[a.avatar?(w(),u(M(D),{key:0,src:M(q)(a.avatar),size:20,style:{"margin-top":"-5px"},class:"mr4px"},null,8,["src"])):c("",!0),y(x,{"label-name":t},null,8,["label-name"]),p("span",Le,P(t),1),e.closable?(w(),u(M(K),{key:1,size:15,value:"icon-park:close-small",style:{verticalAlign:"text-bottom","--color":"rgba(0,0,0,.45)",lineHeight:"1",marginLeft:"2px"},onClick:n[0]||(n[0]=W(e=>l.$emit("on-close"),["prevent","stop"]))})):c("",!0)]),_:2},1032,["tag-style","style"]))),128))]),_:1},8,["disabled","label-layout"])):e.type===M(t).ENUM_MULTI||e.type===M(t).ENUM?(w(),u(Ne,{key:1,disabled:!!e.disabled,"label-layout":M(o)},{default:z(()=>[(w(!0),d(i,null,T(r.value,(t,a)=>(w(),d("span",{key:a,style:_(b(t)),class:"mr-5px"},[y(x,{"label-name":t},null,8,["label-name"]),p("span",Me,P(t)+P(!e.tagWidgetStyle?.tagStyleOpen&&a<r.value.length-1?",":""),1)],4))),128)),r.value.length?c("",!0):(w(),d("span",Ae," "))]),_:1},8,["disabled","label-layout"])):(w(),u(Ne,{key:2,style:_(b(r.value)),disabled:!!e.disabled,"label-layout":M(o),class:"select-text leading-none ell"},{default:z(()=>[g(P(r.value||" "),1)]),_:1},8,["style","disabled","label-layout"]))}}),[["__scopeId","data-v-a1ded441"]]),ze={key:0,class:"w100% ell"},We={key:0,class:"gct-custom-tag ml8px"},je=/* @__PURE__ */m({__name:"field-readonly",props:{isTooltip:{type:Boolean},label:{},type:{},modelValue:{},tagWidgetStyle:{},disabled:{type:Boolean},iconExtraProps:{}},setup(e){const a=e,l=C(!1),o=s(()=>Array.isArray(a.label)?a.label.join(","):a.label),n=s(()=>Re);function i(e){if(!a.isTooltip)return;const t=e.target?.parentNode;console.log(),t.scrollWidth>t.clientWidth&&(l.value=!0)}function r(){l.value=!1}return(s,p)=>{const m=I("a-tooltip");return w(),u(m,{placement:"topLeft",visible:l.value},{title:z(()=>[g(P(o.value),1)]),default:z(()=>[a.type===M(t).RDO_REF?(w(),d("div",ze,[y(M(n),x(s.$attrs,{label:e.label,"tag-widget-style":a.tagWidgetStyle,disabled:a.disabled,"icon-extra-props":a.iconExtraProps,onMouseenter:i,onMouseleave:r}),null,16,["label","tag-widget-style","disabled","icon-extra-props"]),a.type===M(t).RDO_REF&&a.modelValue&&!a.modelValue?.includes(":")?(w(),d("span",We," 默认 ")):c("",!0)])):(w(),u(M(n),x({key:1},s.$attrs,{label:e.label,"tag-widget-style":a.tagWidgetStyle,disabled:a.disabled,"icon-extra-props":a.iconExtraProps,onMouseenter:i,onMouseleave:r}),null,16,["label","tag-widget-style","disabled","icon-extra-props"]))]),_:1},8,["visible"])}}}),Be=/* @__PURE__ */m({__name:"selectTag",props:{tagWidgetStyle:{}},setup(e){const t=e,a=N(()=>t.tagWidgetStyle.tagStyleOpen?t.tagWidgetStyle:{tagStyleOpen:!0,contentFont:t.tagWidgetStyle?.contentFont});return(e,t)=>(w(),u(Re,{"tag-widget-style":a.value},null,8,["tag-widget-style"]))}}),Fe=/* @__PURE__ */m({name:"FieldSelect",props:{design:Boolean,disabled:Boolean,readonly:Boolean,selectExtraProps:Object,fieldType:{type:String,required:!0},type:{type:String,required:!0},tagStyle:{type:Object,required:!0},options:Array,value:[String,Number],maxTagCount:{type:[Number,String],default:5},maxTagTextLength:{type:Number,default:6},selectOptionLabel:{type:String}},setup(e,{emit:t}){const l=s({get:()=>e.value,set(e){t("update:value",e)}}),o=(t,{name:a,iconExtraProps:l,otherParams:o={}})=>f(t,{tagWidgetStyle:e.tagStyle,type:e.fieldType,label:a,disabled:e.disabled,iconExtraProps:l,...o}),n=s(()=>(e.options??[]).map(t=>{const{iconColor:a,icon:l,textColor:n}=t._item||{};return{...t,[e.selectExtraProps?.optionLabelProp||"titleLabel"]:o(Re,{name:t.label,iconExtraProps:{[t.label]:{icon:l,iconColor:a,textColor:n}}})}}));function i(e,t){const{_DICT:a={}}=e,l=e[t];return a[t]?.[l]?.join(",")??l??e.id_}const r=s(()=>{if(e.readonly){const t=n.value?.filter(t=>"multiple"===e.selectExtraProps?.mode?Array.isArray(l.value)&&l.value.includes(t.value):t.value===l.value)??[],a=Object.fromEntries(t?.map(e=>[e.label,U(e?._item||{},["iconColor","icon","textColor"])])??[]);return{labels:t.map(e=>e.label),icons:a}}return{}}),u={option:t=>{const{label:l,_item:n={}}=t;return e.type===a.Userpicker?y("div",{class:"flex items-center"},[y(D,{size:30,style:"margin: 0 8px;min-width:32px",src:q(n.avatar)},null),y("div",{style:"width:calc(100% - 35px)"},[y("div",{class:" w100% ell",title:l},[l]),y("div",{class:"text-[#8F8F8F] text-[12px] mt2px"},[n.masterOrgName])])]):o(Re,{name:e.selectOptionLabel?i(n,e.selectOptionLabel):l,iconExtraProps:{[l]:U(n,["iconColor","icon","textColor"])},otherParams:{showTagStyle:!1}})}},c=t=>{const{label:a,option:l,closable:o,onClose:n}=t,{_item:i={}}=l||{};return(({name:t,title:a,iconExtraProps:l,avatar:o,otherParams:n={}})=>y(Be,x({tagWidgetStyle:e.tagStyle,type:e.fieldType,label:t,avatar:o,title:a?.length>e.maxTagTextLength?a:null,disabled:e.disabled,iconExtraProps:l},n),null))({name:a,title:l?.label,avatar:l?._item?.avatar,iconExtraProps:{[a]:U(i,["iconColor","icon","textColor"])},otherParams:{closable:o,"onOn-close":n,style:"margin-right: 4px"}})};return()=>e.readonly?o(je,{name:r.value?.labels,iconExtraProps:r.value?.icons}):y(X,x({class:["field-select","w100%"],value:l.value,"onUpdate:value":e=>l.value=e,options:n.value,disabled:e.disabled,optionLabelProp:"titleLabel",tagRender:c,showArrow:!0,maxTagCount:e.maxTagCount,maxTagTextLength:e.maxTagTextLength,dropdownMatchSelectWidth:180,dropdownClassName:"multiple"===e.selectExtraProps?.mode?"gct-project-select-dropdown gct-project-select-multiple vxe-table--ignore-clear":"gct-project-select-dropdown vxe-table--ignore-clear"},e.selectExtraProps),e.selectExtraProps?.optionNoStyle?null:u)}}),$e=/* @__PURE__ */m({name:"FieldRadio",props:{design:Boolean,disabled:Boolean,readonly:Boolean,fieldType:{type:Object,required:!0},tagStyle:{type:Object,required:!0},options:Array,value:[String,Number]},setup(e,{emit:t}){const a=s({get:()=>e.value,set(e){t("update:value",e)}});return()=>{let t;return y(Q,{value:a.value,"onUpdate:value":e=>a.value=e,disabled:e.disabled,class:["field-radio-group",e.readonly?"field-radio-group--readonly":""]},"function"==typeof(l=t=(e.options??[]).map(t=>{const a=t,{icon:l,iconColor:o,textColor:n}=a?._item||{};return y(Y,{key:a.value,value:a.value},{default:()=>[y(je,{tagWidgetStyle:e.tagStyle,type:e.fieldType,label:a.label,disabled:e.disabled,iconExtraProps:{[a.label]:{icon:l,iconColor:o,textColor:n}}},null)]})}))||"[object Object]"===Object.prototype.toString.call(l)&&!b(l)?t:{default:()=>[t]});var l}}}),Ue=/* @__PURE__ */m({name:"FieldCheckbox",props:{design:Boolean,disabled:Boolean,readonly:Boolean,fieldType:{type:Object,required:!0},tagStyle:{type:Object,required:!0},options:Array,value:[String,Number]},setup(e,{emit:a}){const l=e.fieldType===t.BOOLEAN,o=s({get:()=>l?[e.value]:Array.isArray(e.value)?e.value:e.value?e.value.split(","):void 0,set(e){if(l){const t=e?.[0];a("update:value",null==t||"boolean"!=typeof t?Boolean(t):!!t)}else a("update:value",e)}}),n=s(()=>l?(e.options??[]).filter(e=>e.value):e.options??[]);return()=>y(Z,{value:o.value,"onUpdate:value":e=>o.value=e,disabled:e.disabled,class:["field-checkbox-group",e.readonly?"field-checkbox-group--readonly":""]},{default:()=>[n.value?.map(t=>{const a=t,{icon:l,iconColor:o,textColor:n}=a?._item||{};return y(G,{key:a.value,value:a.value},{default:()=>[y(je,{tagWidgetStyle:e.tagStyle,type:e.fieldType,label:a.label,disabled:e.disabled,iconExtraProps:{[a.label]:{icon:l,iconColor:o,textColor:n}}},null)]})})]})}}),Ke=new URL("./index.min.css",import.meta.url);o.load(Ke.href);export{Ue as FieldCheckbox,$e as FieldRadio,Fe as FieldSelect,ae as I18Modal,de as I18nSelectBtn,Ce as I18nSelectInput,Te as I18nSelectInputForm,Ie as I18nSelectTextarea,Pe as I18nSelectTextareaForm,je as fieldReadonly,Be as selectTag,Re as taglabel,re as useI18nSelect};