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

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