golden-logic-ui 1.2.375 → 1.3.0

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,13 +1,15 @@
1
- import { ref as k, onMounted as j, watch as w, onUnmounted as A, createElementBlock as g, openBlock as c, Fragment as q, createCommentVNode as S, normalizeClass as f, createElementVNode as l, withDirectives as D, toDisplayString as d, vModelText as M } from "vue";
2
- import { EditorState as G, StateEffect as U } from "../../node_modules/@codemirror/state/dist/index.js";
3
- import { highlightActiveLineGutter as h, keymap as L, EditorView as u, lineNumbers as W } from "../../node_modules/@codemirror/view/dist/index.js";
4
- import { defaultKeymap as T } from "../../node_modules/@codemirror/commands/dist/index.js";
5
- import { javascript as z } from "../../node_modules/@codemirror/lang-javascript/dist/index.js";
6
- import { html as F } from "../../node_modules/@codemirror/lang-html/dist/index.js";
7
- import { oneDark as E } from "../../node_modules/@codemirror/theme-one-dark/dist/index.js";
8
- import { autocompletion as C } from "../../node_modules/@codemirror/autocomplete/dist/index.js";
1
+ import { ref as q, watch as S, onMounted as D, onUnmounted as F, createElementBlock as g, openBlock as h, Fragment as G, createCommentVNode as E, normalizeClass as s, createElementVNode as n, toDisplayString as r, unref as u } from "vue";
2
+ import { glLocale as b } from "../../localeStore.js";
3
+ import { useTranslations as M } from "../../useTranslations.js";
4
+ import { EditorState as z, StateEffect as H } from "../../node_modules/@codemirror/state/dist/index.js";
5
+ import { highlightActiveLineGutter as L, keymap as J, EditorView as y, lineNumbers as K } from "../../node_modules/@codemirror/view/dist/index.js";
6
+ import { defaultKeymap as O } from "../../node_modules/@codemirror/commands/dist/index.js";
7
+ import { javascript as U } from "../../node_modules/@codemirror/lang-javascript/dist/index.js";
8
+ import { html as W } from "../../node_modules/@codemirror/lang-html/dist/index.js";
9
+ import { oneDark as _ } from "../../node_modules/@codemirror/theme-one-dark/dist/index.js";
10
+ import { autocompletion as I } from "../../node_modules/@codemirror/autocomplete/dist/index.js";
9
11
  /* empty css */
10
- const H = { class: "font-bold ptext-lg dark:text-white" }, I = ["id"], K = ["name", "id"], O = ["for"], J = ["name", "id"], P = ["name", "id"], Q = { class: "gl-span-form-error" }, R = { class: "block mt-1 text-sm font-normal leading-5 text-gray-500" }, ie = {
12
+ const P = { class: "font-bold ptext-lg dark:text-white" }, Q = ["id"], R = ["name", "id", "value"], X = ["for"], Y = { class: "language-label js-language-label bg-blue-100 text-blue-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded-sm dark:bg-blue-900 dark:text-blue-300" }, Z = ["name", "id", "value"], $ = ["name", "id"], ee = { class: "gl-span-form-error" }, te = { class: "block mt-1 text-sm font-normal leading-5 text-gray-500" }, fe = {
11
13
  __name: "GlCodeMirrorTranslate",
12
14
  props: {
13
15
  modelValue: {
@@ -43,152 +45,134 @@ const H = { class: "font-bold ptext-lg dark:text-white" }, I = ["id"], K = ["nam
43
45
  default: !0
44
46
  }
45
47
  },
46
- emits: ["update:modelValue", "change"],
47
- setup(e, { emit: N }) {
48
- const n = e, r = N, m = k(null), s = k(null);
49
- let i = null;
50
- const p = (t) => {
48
+ emits: ["update:modelValue", "update:modelValueTranslate", "change"],
49
+ setup(e, { emit: C }) {
50
+ const a = e, p = C, d = q(null);
51
+ let i = null, m = !1;
52
+ const v = () => {
53
+ if (!i)
54
+ return;
55
+ const t = i.state.doc.toString();
56
+ t !== o.value && (m = !0, i.dispatch({
57
+ changes: { from: 0, to: t.length, insert: o.value }
58
+ }), m = !1);
59
+ }, { asJson: x, currentText: o, setCurrent: N } = M(
60
+ a,
61
+ p,
62
+ v
63
+ ), V = (t) => {
64
+ m || !b.current || o.value !== t && (N(t), p("change", t));
65
+ };
66
+ S(
67
+ () => b.current,
68
+ () => {
69
+ v();
70
+ }
71
+ );
72
+ const B = (t) => {
51
73
  switch (t) {
52
74
  case "javascript":
53
- return z();
75
+ return U();
54
76
  case "html":
55
- return F();
77
+ return W();
56
78
  // Add more languages here
57
79
  default:
58
80
  return [];
59
81
  }
60
- }, y = (t) => t === "one-dark" ? E : document.body.classList.contains("dark") ? E : [], b = (t) => t ? [W()] : [], v = (t) => t ? [h()] : [], B = () => {
61
- s.value && r("update:modelValueTranslate", s.value.value);
62
- };
63
- return j(() => {
64
- if (m.value) {
65
- const t = G.create({
66
- doc: n.modelValue,
67
- extensions: [
68
- ...b(n.showLineNumbers),
69
- ...v(n.highlightActiveLine),
70
- h(),
71
- //
72
- L.of(T),
73
- p(n.language),
74
- ...y(n.theme),
75
- C(),
76
- u.updateListener.of((a) => {
77
- if (a.docChanged) {
78
- const o = a.state.doc.toString();
79
- r("update:modelValue", o), r("change", o);
80
- }
81
- }),
82
- u.lineWrapping
83
- ]
82
+ }, T = (t) => t === "one-dark" ? _ : document.body.classList.contains("dark") ? _ : [], j = (t) => t ? [K()] : [], A = (t) => t ? [L()] : [], w = (t, l, c, f) => [
83
+ ...j(c),
84
+ ...A(f),
85
+ L(),
86
+ J.of(O),
87
+ B(t),
88
+ ...T(l),
89
+ I(),
90
+ y.updateListener.of((k) => {
91
+ k.docChanged && V(k.state.doc.toString());
92
+ }),
93
+ y.lineWrapping
94
+ ];
95
+ return D(() => {
96
+ if (d.value) {
97
+ const t = z.create({
98
+ doc: o.value,
99
+ extensions: w(
100
+ a.language,
101
+ a.theme,
102
+ a.showLineNumbers,
103
+ a.highlightActiveLine
104
+ )
84
105
  });
85
- i = new u({
106
+ i = new y({
86
107
  state: t,
87
- parent: m.value
108
+ parent: d.value
88
109
  });
89
110
  }
90
- n.modelValueTranslate && (r("update:modelValueTranslate", n.modelValueTranslate), s.value.value = n.modelValueTranslate), m.value.classList.add("gl-multilanguage");
91
- }), w(
92
- () => n.modelValue,
93
- (t) => {
94
- if (i) {
95
- const a = i.state.doc.toString();
96
- t !== a && i.dispatch({
97
- changes: {
98
- from: 0,
99
- to: a.length,
100
- insert: t
101
- }
102
- });
103
- }
104
- }
105
- ), w(
106
- () => [n.language, n.theme, n.showLineNumbers, n.highlightActiveLine],
107
- ([t, a, o, _]) => {
111
+ }), S(
112
+ () => [a.language, a.theme, a.showLineNumbers, a.highlightActiveLine],
113
+ ([t, l, c, f]) => {
108
114
  i && i.dispatch({
109
- effects: U.reconfigure.of([
110
- ...b(o),
111
- ...v(_),
112
- h(),
113
- // Ensure it's included if highlightActiveLine is true
114
- L.of([...T]),
115
- p(t),
116
- ...y(a),
117
- C(),
118
- u.updateListener.of((V) => {
119
- if (V.docChanged) {
120
- const x = V.state.doc.toString();
121
- r("update:modelValue", x), r("change", x);
122
- }
123
- }),
124
- u.lineWrapping
125
- ])
115
+ effects: H.reconfigure.of(
116
+ w(t, l, c, f)
117
+ )
126
118
  });
127
119
  }
128
- ), A(() => {
120
+ ), F(() => {
129
121
  i && i.destroy();
130
- }), (t, a) => (c(), g(q, null, [
131
- e.show ? (c(), g("div", {
122
+ }), (t, l) => (h(), g(G, null, [
123
+ e.show ? (h(), g("div", {
132
124
  key: 0,
133
- class: f(e.field_name)
125
+ class: s(e.field_name)
134
126
  }, [
135
- l("h3", H, d(e.label_name), 1),
136
- l("p", {
127
+ n("h3", P, r(e.label_name), 1),
128
+ n("p", {
137
129
  id: e.field_name,
138
- class: "mb-4 text-base text-gray-900 input_tr_show dark:text-white"
139
- }, d(e.model_value), 9, I),
140
- D(l("input", {
130
+ class: "mb-4 text-base text-gray-900 gl-multilanguage input_tr_show dark:text-white"
131
+ }, r(u(o)), 9, Q),
132
+ n("input", {
141
133
  type: "hidden",
142
- "data-i18n": "true",
143
134
  name: e.field_name + "_i18n",
144
135
  id: e.field_name + "_i18n",
145
- ref_key: "input_translate",
146
- ref: s,
147
- "onUpdate:modelValue": a[0] || (a[0] = (o) => t.inputTranslateValue = o)
148
- }, null, 8, K), [
149
- [M, t.inputTranslateValue]
150
- ]),
151
- a[1] || (a[1] = l("hr", { class: "opacity-100! bg-gray-200 border-0 dark:bg-gray-700" }, null, -1))
152
- ], 2)) : S("", !0),
153
- e.show ? S("", !0) : (c(), g("div", {
136
+ value: u(x)()
137
+ }, null, 8, R),
138
+ l[0] || (l[0] = n("hr", { class: "opacity-100! bg-gray-200 border-0 dark:bg-gray-700" }, null, -1))
139
+ ], 2)) : E("", !0),
140
+ e.show ? E("", !0) : (h(), g("div", {
154
141
  key: 1,
155
- class: f(["mb-4", e.field_name])
142
+ class: s(["mb-4", e.field_name])
156
143
  }, [
157
- l("label", {
158
- class: f({
144
+ n("label", {
145
+ class: s({
159
146
  "gl-label-translation-form": e.error_message == "",
160
147
  "gl-label-translation-form-invalid": e.error_message !== "",
161
148
  required: e.is_required
162
149
  }),
163
150
  for: e.field_name
164
- }, d(e.label_name), 11, O),
165
- a[2] || (a[2] = l("span", { class: "language-label js-language-label bg-blue-100 text-blue-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded-sm dark:bg-blue-900 dark:text-blue-300" }, null, -1)),
166
- l("input", {
151
+ }, r(e.label_name), 11, X),
152
+ n("span", Y, r(u(b).current), 1),
153
+ n("input", {
167
154
  class: "mb-4",
168
155
  type: "hidden",
169
- "data-i18n": "true",
170
156
  name: e.field_name + "_i18n",
171
157
  id: e.field_name + "_i18n",
172
- onChange: B,
173
- ref_key: "input_translate",
174
- ref: s
175
- }, null, 40, J),
176
- l("div", {
158
+ value: u(x)()
159
+ }, null, 8, Z),
160
+ n("div", {
177
161
  ref_key: "editor",
178
- ref: m,
179
- class: f(["CodeEditor custom-editor form-input-translation", {
162
+ ref: d,
163
+ class: s(["CodeEditor custom-editor form-input-translation gl-multilanguage", {
180
164
  "gl-input-form": e.error_message == "",
181
165
  "gl-input-form-invalid ": e.error_message !== ""
182
166
  }]),
183
167
  name: e.field_name,
184
168
  id: e.field_name
185
- }, null, 10, P),
186
- l("span", Q, d(e.error_message), 1),
187
- l("small", R, d(e.description), 1)
169
+ }, null, 10, $),
170
+ n("span", ee, r(e.error_message), 1),
171
+ n("small", te, r(e.description), 1)
188
172
  ], 2))
189
173
  ], 64));
190
174
  }
191
175
  };
192
176
  export {
193
- ie as default
177
+ fe as default
194
178
  };
@@ -1,7 +1,7 @@
1
- import { createElementBlock as o, openBlock as s, Fragment as n, renderList as g, createElementVNode as c, normalizeClass as u, toDisplayString as i } from "vue";
2
- import _ from "../../_virtual/_plugin-vue_export-helper.js";
3
- const m = {
4
- components: {},
1
+ import { glLocale as n, setGlLocales as i } from "../../localeStore.js";
2
+ import { createElementBlock as a, openBlock as c, normalizeClass as s, Fragment as m, renderList as f, withDirectives as _, createElementVNode as g, vModelRadio as p, toDisplayString as b } from "vue";
3
+ import h from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const y = {
5
5
  props: {
6
6
  field_name: {
7
7
  type: String,
@@ -11,6 +11,9 @@ const m = {
11
11
  type: String,
12
12
  default: "i18n_selector"
13
13
  },
14
+ // Kept on the element from first render (it used to be added only after
15
+ // the locales request returned): consuming apps count elements carrying
16
+ // it to decide when a modal has finished loading.
14
17
  selectorClass: {
15
18
  type: String,
16
19
  default: "gl-multilanguage"
@@ -18,17 +21,13 @@ const m = {
18
21
  },
19
22
  data() {
20
23
  return {
21
- locals: [],
22
- default_language: ""
24
+ glLocale: n
23
25
  };
24
26
  },
25
27
  methods: {
26
28
  getLocals() {
27
- const d = {
28
- id: this.menu_id
29
- };
30
- axios.get("/admin/get_locals", { params: d }).then((e) => {
31
- this.locals = e.data.locals, this.default_language = e.data.default_language, this.$refs.language_selector.classList.add(this.selectorClass);
29
+ n.locals.length > 0 || axios.get("/admin/get_locals").then((e) => {
30
+ i(e.data.locals, e.data.default_language);
32
31
  }).catch((e) => {
33
32
  console.error(e);
34
33
  });
@@ -36,37 +35,37 @@ const m = {
36
35
  },
37
36
  created() {
38
37
  this.getLocals();
39
- },
40
- mounted() {
41
38
  }
42
- }, f = {
43
- class: "grid w-full gap-1 mt-5 mb-5 md:gap-0 md:grid-cols-10 language-selector",
44
- ref: "language_selector"
45
- }, h = ["name", "value", "id", "checked"], p = ["for"];
46
- function b(d, e, l, k, r, y) {
47
- return s(), o("ul", f, [
48
- (s(!0), o(n, null, g(r.locals, (t, a) => (s(), o("li", null, [
49
- c("input", {
39
+ }, k = ["name", "value", "id"], L = ["for"];
40
+ function v(e, d, l, x, r, S) {
41
+ return c(), a("ul", {
42
+ class: s(["grid w-full gap-1 mt-5 mb-5 md:gap-0 md:grid-cols-10 language-selector", l.selectorClass]),
43
+ ref: "language_selector"
44
+ }, [
45
+ (c(!0), a(m, null, f(r.glLocale.locals, (t, o) => (c(), a("li", { key: t }, [
46
+ _(g("input", {
50
47
  type: "radio",
51
48
  name: l.trans_selector_name,
52
49
  value: t,
53
50
  class: "hidden! peer",
54
51
  id: t + "_" + l.field_name,
55
52
  autocomplete: "off",
56
- checked: t === r.default_language
57
- }, null, 8, h),
58
- c("label", {
53
+ "onUpdate:modelValue": d[0] || (d[0] = (u) => r.glLocale.current = u)
54
+ }, null, 8, k), [
55
+ [p, r.glLocale.current]
56
+ ]),
57
+ g("label", {
59
58
  for: t + "_" + l.field_name,
60
- class: u([{
61
- "border md:rounded-s-lg!": a === 0,
62
- "border md:rounded-e-lg!": a === r.locals.length - 1,
63
- "border-t border-b": a !== 0 && a !== r.locals.length - 1
59
+ class: s([{
60
+ "border md:rounded-s-lg!": o === 0,
61
+ "border md:rounded-e-lg!": o === r.glLocale.locals.length - 1,
62
+ "border-t border-b": o !== 0 && o !== r.glLocale.locals.length - 1
64
63
  }, "block w-full p-1 font-bold text-center text-gray-500 uppercase bg-white border-gray-200 rounded-lg cursor-pointer md:rounded-none dark:hover:text-gray-300 dark:border-gray-700 dark:peer-checked:text-blue-500 peer-checked:border-blue-600 peer-checked:text-blue-600 hover:text-gray-600 hover:bg-gray-100 dark:text-gray-400 dark:bg-gray-800 dark:hover:bg-gray-700"])
65
- }, i(t), 11, p)
66
- ]))), 256))
67
- ], 512);
64
+ }, b(t), 11, L)
65
+ ]))), 128))
66
+ ], 2);
68
67
  }
69
- const L = /* @__PURE__ */ _(m, [["render", b]]);
68
+ const D = /* @__PURE__ */ h(y, [["render", v]]);
70
69
  export {
71
- L as default
70
+ D as default
72
71
  };
@@ -1,5 +1,5 @@
1
- import { useSlots as T, ref as m, Comment as C, provide as _, watch as b, onMounted as S, onBeforeUnmount as L, createElementBlock as o, openBlock as n, Fragment as h, createElementVNode as s, withDirectives as B, normalizeClass as l, renderList as D, createCommentVNode as E, createTextVNode as F, toDisplayString as H, renderSlot as I, vShow as M } from "vue";
2
- const N = ["onClick"], U = ["innerHTML"], V = { class: "relative flex flex-col w-full min-w-0 mb-6 wrap-break-word rounded-[20px] border border-gray-200 dark:border-gray-700" }, W = { class: "flex-auto px-4 py-5" }, R = { class: "tab-content tab-space" }, z = {
1
+ import { useSlots as C, ref as f, Comment as _, provide as S, watch as m, onMounted as L, onBeforeUnmount as H, createElementBlock as o, openBlock as n, Fragment as b, createElementVNode as s, withDirectives as B, normalizeClass as l, renderList as D, createCommentVNode as E, createTextVNode as F, toDisplayString as I, renderSlot as M, vShow as N } from "vue";
2
+ const U = ["onClick"], V = ["innerHTML"], W = { class: "relative flex flex-col w-full min-w-0 mb-6 wrap-break-word rounded-[20px] border border-gray-200 dark:border-gray-700" }, R = { class: "flex-auto px-4 py-5" }, $ = { class: "tab-content tab-space" }, A = {
3
3
  __name: "GlTabsWrapper",
4
4
  props: {
5
5
  autoFlexTabs: {
@@ -16,14 +16,16 @@ const N = ["onClick"], U = ["innerHTML"], V = { class: "relative flex flex-col w
16
16
  }
17
17
  },
18
18
  emits: ["TabChange"],
19
- setup(i, { expose: v, emit: f }) {
20
- const c = i, y = f, x = T(), d = m(
21
- (x.default?.() ?? []).filter((e) => e.type !== C && e.props !== null).map((e) => e.props)
22
- ), k = (e) => typeof e == "string" && /<\s*(svg|path|g|circle|rect)\b/i.test(e), a = m("");
23
- _("selectedTitle", a);
24
- const g = (e) => e.trim().toLowerCase().replace(/\s+/g, "-"), w = (e) => {
25
- const r = g(e);
26
- window.location.hash = encodeURIComponent(r), y("TabChange", e);
19
+ setup(i, { expose: v, emit: y }) {
20
+ const c = i, x = y, w = C(), d = f(
21
+ (w.default?.() ?? []).filter((e) => e.type !== _ && e.props !== null).map((e) => e.props)
22
+ ), k = (e) => typeof e == "string" && /<\s*(svg|path|g|circle|rect)\b/i.test(e), a = f("");
23
+ S("selectedTitle", a);
24
+ const g = (e) => e.trim().toLowerCase().replace(/\s+/g, "-");
25
+ let u = !1;
26
+ const T = (e) => {
27
+ const r = g(e), t = encodeURIComponent(r);
28
+ window.location.hash.replace("#", "") !== t && (u = !0, window.location.hash = t), x("TabChange", e);
27
29
  }, p = (e) => {
28
30
  if (typeof e != "string") return;
29
31
  d.value.find((t) => t.title === e) && (a.value = e);
@@ -31,25 +33,29 @@ const N = ["onClick"], U = ["innerHTML"], V = { class: "relative flex flex-col w
31
33
  v({
32
34
  setActiveTab: p
33
35
  });
34
- const u = () => {
36
+ const h = () => {
37
+ if (u) {
38
+ u = !1;
39
+ return;
40
+ }
35
41
  const e = decodeURIComponent(window.location.hash.replace("#", "")), r = d.value.find((t) => g(t.title) === e);
36
42
  r && (a.value = r.title);
37
43
  };
38
- return b(a, (e) => {
39
- w(e);
40
- }), b(() => c.activeTab, (e) => {
44
+ return m(a, (e) => {
45
+ T(e);
46
+ }), m(() => c.activeTab, (e) => {
41
47
  e && e !== a.value && p(e);
42
- }), S(() => {
43
- u(), !a.value && c.activeTab && p(c.activeTab), window.addEventListener("hashchange", u);
44
48
  }), L(() => {
45
- window.removeEventListener("hashchange", u);
46
- }), (e, r) => (n(), o(h, null, [
49
+ h(), !a.value && c.activeTab && p(c.activeTab), window.addEventListener("hashchange", h);
50
+ }), H(() => {
51
+ window.removeEventListener("hashchange", h);
52
+ }), (e, r) => (n(), o(b, null, [
47
53
  s("ul", {
48
54
  class: l(["flex flex-row flex-wrap gap-2 pt-3 pb-4 mb-0 list-none text-gray-500 dark:text-gray-400", i.tabsWrapperClass])
49
55
  }, [
50
- (n(!0), o(h, null, D(d.value, (t) => (n(), o("li", {
56
+ (n(!0), o(b, null, D(d.value, (t) => (n(), o("li", {
51
57
  key: t.title,
52
- onClick: ($) => a.value = t.title,
58
+ onClick: (j) => a.value = t.title,
53
59
  class: l(["-mb-px text-center", {
54
60
  "flex-auto ": i.autoFlexTabs
55
61
  }])
@@ -61,26 +67,26 @@ const N = ["onClick"], U = ["innerHTML"], V = { class: "relative flex flex-col w
61
67
  key: 0,
62
68
  class: "inline-flex items-center justify-center me-2 align-middle",
63
69
  innerHTML: t.icon
64
- }, null, 8, U)) : t.icon ? (n(), o("i", {
70
+ }, null, 8, V)) : t.icon ? (n(), o("i", {
65
71
  key: 1,
66
72
  class: l([t.icon, "me-2 text-sm"])
67
73
  }, null, 2)) : E("", !0),
68
- F(H(t.title), 1)
74
+ F(I(t.title), 1)
69
75
  ], 2)
70
- ], 10, N))), 128))
76
+ ], 10, U))), 128))
71
77
  ], 2),
72
- B(s("div", V, [
73
- s("div", W, [
74
- s("div", R, [
75
- I(e.$slots, "default")
78
+ B(s("div", W, [
79
+ s("div", R, [
80
+ s("div", $, [
81
+ M(e.$slots, "default")
76
82
  ])
77
83
  ])
78
84
  ], 512), [
79
- [M, a.value]
85
+ [N, a.value]
80
86
  ])
81
87
  ], 64));
82
88
  }
83
89
  };
84
90
  export {
85
- z as default
91
+ A as default
86
92
  };
@@ -1,5 +1,7 @@
1
- import { ref as f, onMounted as V, createElementBlock as g, openBlock as y, Fragment as h, createCommentVNode as b, normalizeClass as d, createElementVNode as t, toDisplayString as i } from "vue";
2
- const x = { class: "font-bold ptext-lg dark:text-white" }, p = ["name", "id"], T = ["id"], w = ["for"], S = ["name", "id"], q = ["required", "name", "id", "type"], _ = { class: "gl-span-form-error" }, B = { class: "block mt-1 text-sm font-normal leading-5 text-gray-500" }, j = {
1
+ import { ref as v, createElementBlock as s, openBlock as d, Fragment as w, createCommentVNode as f, normalizeClass as i, createElementVNode as t, toDisplayString as a, unref as l } from "vue";
2
+ import { glLocale as S } from "../../localeStore.js";
3
+ import { useTranslations as p } from "../../useTranslations.js";
4
+ const q = { class: "font-bold ptext-lg dark:text-white" }, T = ["name", "id", "value"], V = ["id"], _ = ["for"], B = { class: "language-label js-language-label bg-blue-100 text-blue-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded-sm dark:bg-blue-900 dark:text-blue-300" }, j = ["name", "id", "value"], C = ["required", "name", "id", "type", "value"], N = { class: "gl-span-form-error" }, E = { class: "block mt-1 text-sm font-normal leading-5 text-gray-500" }, D = {
3
5
  __name: "GlTextTranslate",
4
6
  props: {
5
7
  is_required: {
@@ -48,77 +50,69 @@ const x = { class: "font-bold ptext-lg dark:text-white" }, p = ["name", "id"], T
48
50
  }
49
51
  },
50
52
  emits: ["update:modelValue", "update:modelValueTranslate", "keydown"],
51
- setup(e, { expose: c, emit: v }) {
52
- const n = e, s = v, a = f(null), u = f(null), r = f(null), k = () => {
53
- u.value && s("update:modelValueTranslate", u.value.value);
53
+ setup(e, { expose: g, emit: c }) {
54
+ const y = e, b = c, u = v(null), { asJson: o, currentText: m, setCurrent: x } = p(y, b), h = (r) => {
55
+ x(r.target.value);
54
56
  };
55
- return V(() => {
56
- a.value !== null && a.value.hasAttribute("autofocus") && a.value.focus(), n.modelValue && (s("update:modelValue", n.modelValue), a.value && (a.value.value = n.modelValue)), n.modelValueTranslate && (s("update:modelValueTranslate", n.modelValueTranslate), u.value && (u.value.value = n.modelValueTranslate)), a.value && a.value.classList.add("gl-multilanguage"), r.value && r.value.classList.add("gl-multilanguage");
57
- }), c({ focus: () => a.value.focus() }), (o, l) => (y(), g(h, null, [
58
- e.show ? (y(), g("div", {
57
+ return g({ focus: () => u.value?.focus() }), (r, n) => (d(), s(w, null, [
58
+ e.show ? (d(), s("div", {
59
59
  key: 0,
60
- class: d(e.field_name)
60
+ class: i(e.field_name)
61
61
  }, [
62
- t("h3", x, i(e.label_name), 1),
62
+ t("h3", q, a(e.label_name), 1),
63
63
  t("input", {
64
64
  type: "hidden",
65
- "data-i18n": "true",
66
65
  name: e.field_name + "_i18n",
67
66
  id: e.field_name + "_i18n",
68
- ref_key: "input_translate",
69
- ref: u
70
- }, null, 8, p),
67
+ value: l(o)()
68
+ }, null, 8, T),
71
69
  t("p", {
72
- ref_key: "output_translate",
73
- ref: r,
74
70
  id: e.field_name,
75
- class: "mb-4 text-base text-gray-900 input_tr_show dark:text-white"
76
- }, i(o.model_value), 9, T),
77
- l[2] || (l[2] = t("hr", { class: "opacity-100! bg-gray-200 border-0 dark:bg-gray-700" }, null, -1))
78
- ], 2)) : b("", !0),
79
- e.show ? b("", !0) : (y(), g("div", {
71
+ class: "mb-4 text-base text-gray-900 gl-multilanguage input_tr_show dark:text-white"
72
+ }, a(l(m)), 9, V),
73
+ n[1] || (n[1] = t("hr", { class: "opacity-100! bg-gray-200 border-0 dark:bg-gray-700" }, null, -1))
74
+ ], 2)) : f("", !0),
75
+ e.show ? f("", !0) : (d(), s("div", {
80
76
  key: 1,
81
- class: d(["mb-4", e.field_name])
77
+ class: i(["mb-4", e.field_name])
82
78
  }, [
83
79
  t("label", {
84
- class: d({
80
+ class: i({
85
81
  "gl-label-translation-form": e.error_message == "",
86
82
  "gl-label-translation-form-invalid": e.error_message !== "",
87
83
  required: e.is_required
88
84
  }),
89
85
  for: e.field_name
90
- }, i(e.label_name), 11, w),
91
- l[3] || (l[3] = t("span", { class: "language-label js-language-label bg-blue-100 text-blue-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded-sm dark:bg-blue-900 dark:text-blue-300" }, null, -1)),
86
+ }, a(e.label_name), 11, _),
87
+ t("span", B, a(l(S).current), 1),
92
88
  t("input", {
93
89
  class: "mb-4",
94
90
  type: "hidden",
95
- "data-i18n": "true",
96
91
  name: e.field_name + "_i18n",
97
92
  id: e.field_name + "_i18n",
98
- onChange: k,
99
- ref_key: "input_translate",
100
- ref: u
101
- }, null, 40, S),
93
+ value: l(o)()
94
+ }, null, 8, j),
102
95
  t("input", {
103
96
  required: e.is_required,
104
97
  name: e.field_name,
105
98
  id: e.field_name,
106
- class: d(["mt-2 form-input-translation", {
99
+ class: i(["mt-2 form-input-translation gl-multilanguage", {
107
100
  " gl-input-form": e.error_message == "",
108
101
  " gl-input-form-invalid": e.error_message !== ""
109
102
  }]),
110
103
  type: e.type,
111
- onInput: l[0] || (l[0] = (m) => o.$emit("update:modelValue", m.target.value)),
112
- onKeydown: l[1] || (l[1] = (m) => o.$emit("keydown", m)),
104
+ value: l(m),
105
+ onInput: h,
106
+ onKeydown: n[0] || (n[0] = (k) => r.$emit("keydown", k)),
113
107
  ref_key: "input",
114
- ref: a
115
- }, null, 42, q),
116
- t("span", _, i(e.error_message), 1),
117
- t("small", B, i(e.description), 1)
108
+ ref: u
109
+ }, null, 42, C),
110
+ t("span", N, a(e.error_message), 1),
111
+ t("small", E, a(e.description), 1)
118
112
  ], 2))
119
113
  ], 64));
120
114
  }
121
115
  };
122
116
  export {
123
- j as default
117
+ D as default
124
118
  };