golden-logic-ui 1.2.375 → 1.3.1

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,13 @@
1
- import { ref as c, resolveDirective as x, createElementBlock as s, openBlock as i, Fragment as b, createVNode as k, withDirectives as u, createCommentVNode as p, createElementVNode as e, withModifiers as D, createTextVNode as _, vShow as C } from "vue";
2
- import A from "../DeleteConfirmationModal.vue.js";
3
- import M from "../../../Stores/toast.js";
1
+ import { ref as c, resolveDirective as x, createElementBlock as d, openBlock as n, Fragment as k, createVNode as D, withDirectives as u, createCommentVNode as p, createElementVNode as e, withModifiers as _, createTextVNode as C, vShow as A } from "vue";
2
+ import M from "../DeleteConfirmationModal.vue.js";
3
+ import g from "../../../Stores/toast.js";
4
4
  const O = {
5
5
  key: 0,
6
6
  class: "flex lg:justify-center"
7
7
  }, j = { class: "absolute z-10 mt-5 origin-top-right bg-white divide-y divide-gray-100 rounded-lg shadow-sm w-44 dark:bg-gray-700 dark:divide-gray-600" }, B = {
8
8
  class: "py-2 text-sm text-gray-700 dark:text-gray-200",
9
9
  "aria-labelledby": "dropdownDividerButton"
10
- }, N = { key: 0 }, Z = {
10
+ }, N = { key: 0 }, T = {
11
11
  __name: "DatatableDeleteAction",
12
12
  props: {
13
13
  field: {
@@ -32,37 +32,41 @@ const O = {
32
32
  }
33
33
  },
34
34
  emits: ["deleteAction"],
35
- setup(t, { emit: g }) {
36
- const n = t, a = c(!1), l = c(!1), m = () => {
37
- a.value = !1;
38
- }, f = () => {
39
- a.value = !0;
40
- }, d = () => {
41
- l.value = !1;
35
+ setup(t, { emit: m }) {
36
+ const a = t, s = c(!1), l = c(!1), f = () => {
37
+ s.value = !1;
42
38
  }, y = () => {
39
+ s.value = !0;
40
+ }, i = () => {
41
+ l.value = !1;
42
+ }, h = () => {
43
43
  l.value = !0;
44
- }, v = g, h = () => {
45
- axios.delete(`${n.xprops.route}/${n.row.id}`).then(() => {
46
- d(), v("deleteAction"), M.methods.add({
44
+ }, v = m, w = () => {
45
+ axios.delete(`${a.xprops.route}/${a.row.id}`).then(() => {
46
+ i(), v("deleteAction"), g.methods.add({
47
47
  message: "Item deleted successfully.",
48
48
  type: "success",
49
49
  duration: 5e3
50
50
  });
51
51
  }).catch((o) => {
52
- console.log(o);
52
+ i(), g.methods.add({
53
+ message: o.response?.data?.message ?? a.language?.delete_failed ?? "That item could not be deleted.",
54
+ type: "error",
55
+ duration: 5e3
56
+ });
53
57
  });
54
58
  };
55
59
  return (o, r) => {
56
- const w = x("click-outside");
57
- return i(), s(b, null, [
58
- k(A, {
60
+ const b = x("click-outside");
61
+ return n(), d(k, null, [
62
+ D(M, {
59
63
  isOpen: l.value,
60
- onConfirmDelete: h,
61
- onCancelDelete: d
64
+ onConfirmDelete: w,
65
+ onCancelDelete: i
62
66
  }, null, 8, ["isOpen"]),
63
- t.row && o.can(`delete_${t.xprops.permission}`) ? u((i(), s("div", O, [
67
+ t.row && o.can(`delete_${t.xprops.permission}`) ? u((n(), d("div", O, [
64
68
  e("button", {
65
- onClick: f,
69
+ onClick: y,
66
70
  class: "inline-flex items-center p-2 text-sm font-medium text-center text-gray-900 bg-white rounded-lg hover:bg-gray-100 focus:ring-4 focus:outline-hidden dark:text-white focus:ring-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700 dark:focus:ring-gray-600",
67
71
  type: "button"
68
72
  }, r[0] || (r[0] = [
@@ -78,27 +82,27 @@ const O = {
78
82
  ])),
79
83
  u(e("div", j, [
80
84
  e("ul", B, [
81
- o.can(`delete_${t.xprops.permission}`) ? (i(), s("li", N, [
85
+ o.can(`delete_${t.xprops.permission}`) ? (n(), d("li", N, [
82
86
  e("a", {
83
87
  href: "#",
84
- onClick: D(y, ["prevent"]),
88
+ onClick: _(h, ["prevent"]),
85
89
  class: "block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white"
86
90
  }, r[1] || (r[1] = [
87
91
  e("i", { class: "mr-2 fa-solid fa-trash-can opacity-80" }, null, -1),
88
- _(" Remove")
92
+ C(" Remove")
89
93
  ]))
90
94
  ])) : p("", !0)
91
95
  ])
92
96
  ], 512), [
93
- [C, a.value]
97
+ [A, s.value]
94
98
  ])
95
99
  ])), [
96
- [w, m]
100
+ [b, f]
97
101
  ]) : p("", !0)
98
102
  ], 64);
99
103
  };
100
104
  }
101
105
  };
102
106
  export {
103
- Z as default
107
+ T as default
104
108
  };
@@ -1,6 +1,6 @@
1
- import { ref as g, resolveDirective as A, createElementBlock as a, openBlock as l, Fragment as C, createVNode as $, withDirectives as p, createCommentVNode as d, createElementVNode as t, withModifiers as m, createTextVNode as f, toDisplayString as y, vShow as O } from "vue";
2
- import j from "../DeleteConfirmationModal.vue.js";
3
- import M from "../../../Stores/toast.js";
1
+ import { ref as g, resolveDirective as C, createElementBlock as l, openBlock as i, Fragment as $, createVNode as O, withDirectives as m, createCommentVNode as c, createElementVNode as t, withModifiers as p, createTextVNode as f, toDisplayString as y, vShow as j } from "vue";
2
+ import M from "../DeleteConfirmationModal.vue.js";
3
+ import v from "../../../Stores/toast.js";
4
4
  const B = {
5
5
  key: 0,
6
6
  class: "flex lg:justify-center"
@@ -38,40 +38,44 @@ const B = {
38
38
  }
39
39
  },
40
40
  emits: ["deleteAction", "editAction"],
41
- setup(e, { emit: v }) {
42
- const i = e, s = g(!1), n = g(!1), c = () => {
41
+ setup(e, { emit: h }) {
42
+ const a = e, s = g(!1), n = g(!1), d = () => {
43
43
  n.value = !1;
44
- }, h = () => {
45
- n.value = !0;
46
44
  }, x = () => {
47
- s.value = !1;
45
+ n.value = !0;
48
46
  }, k = () => {
47
+ s.value = !1;
48
+ }, w = () => {
49
49
  s.value = !0;
50
- }, u = v, w = (o) => {
50
+ }, u = h, b = (o) => {
51
51
  u("editAction", o);
52
- }, b = () => {
53
- axios.delete(`${i.xprops.route}/${i.row.id}`).then(() => {
54
- c(), u("deleteAction"), M.methods.add({
55
- message: i.language?.item_deleted_successfully ?? "Item deleted successfully.",
52
+ }, D = () => {
53
+ axios.delete(`${a.xprops.route}/${a.row.id}`).then(() => {
54
+ d(), u("deleteAction"), v.methods.add({
55
+ message: a.language?.item_deleted_successfully ?? "Item deleted successfully.",
56
56
  type: "success",
57
57
  duration: 5e3
58
58
  });
59
59
  }).catch((o) => {
60
- console.log(o);
60
+ d(), v.methods.add({
61
+ message: o.response?.data?.message ?? a.language?.delete_failed ?? "That item could not be deleted.",
62
+ type: "error",
63
+ duration: 5e3
64
+ });
61
65
  });
62
66
  };
63
67
  return (o, r) => {
64
- const D = A("click-outside");
65
- return l(), a(C, null, [
66
- $(j, {
68
+ const A = C("click-outside");
69
+ return i(), l($, null, [
70
+ O(M, {
67
71
  language: e.language,
68
72
  isOpen: n.value,
69
- onConfirmDelete: b,
70
- onCancelDelete: c
73
+ onConfirmDelete: D,
74
+ onCancelDelete: d
71
75
  }, null, 8, ["language", "isOpen"]),
72
- e.row && (o.can(`delete_${e.xprops.permission}`) || o.can(`access_${e.xprops.permission}`)) ? p((l(), a("div", B, [
76
+ e.row && (o.can(`delete_${e.xprops.permission}`) || o.can(`access_${e.xprops.permission}`)) ? m((i(), l("div", B, [
73
77
  t("button", {
74
- onClick: k,
78
+ onClick: w,
75
79
  class: "inline-flex items-center p-2 text-sm font-medium text-center text-gray-900 bg-white rounded-lg hover:bg-gray-100 focus:ring-4 focus:outline-hidden dark:text-white focus:ring-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700 dark:focus:ring-gray-600",
76
80
  type: "button"
77
81
  }, r[1] || (r[1] = [
@@ -85,35 +89,35 @@ const B = {
85
89
  t("path", { d: "M3.5 1.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm0 6.041a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm0 5.959a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z" })
86
90
  ], -1)
87
91
  ])),
88
- p(t("div", E, [
92
+ m(t("div", E, [
89
93
  t("ul", N, [
90
- o.can(`access_${e.xprops.permission}`) ? (l(), a("li", S, [
94
+ o.can(`access_${e.xprops.permission}`) ? (i(), l("li", S, [
91
95
  t("a", {
92
96
  href: "#",
93
- onClick: r[0] || (r[0] = m((Z) => w(e.row), ["prevent"])),
97
+ onClick: r[0] || (r[0] = p((T) => b(e.row), ["prevent"])),
94
98
  class: "block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white"
95
99
  }, [
96
100
  r[2] || (r[2] = t("i", { class: "mr-1 fa-solid fa-pen-to-square opacity-80" }, null, -1)),
97
101
  f(" " + y(e.language?.edit ?? "Edit"), 1)
98
102
  ])
99
- ])) : d("", !0),
100
- o.can(`delete_${e.xprops.permission}`) ? (l(), a("li", V, [
103
+ ])) : c("", !0),
104
+ o.can(`delete_${e.xprops.permission}`) ? (i(), l("li", V, [
101
105
  t("a", {
102
106
  href: "#",
103
- onClick: m(h, ["prevent"]),
107
+ onClick: p(x, ["prevent"]),
104
108
  class: "block px-4 py-2 text-red-600 hover:text-white hover:bg-red-600 dark:text-red-500 dark:hover:text-white dark:hover:bg-red-600"
105
109
  }, [
106
110
  r[3] || (r[3] = t("i", { class: "mr-1 fa-solid fa-trash-can opacity-80" }, null, -1)),
107
111
  f(" " + y(e.language?.remove ?? "Remove"), 1)
108
112
  ])
109
- ])) : d("", !0)
113
+ ])) : c("", !0)
110
114
  ])
111
115
  ], 512), [
112
- [O, s.value]
116
+ [j, s.value]
113
117
  ])
114
118
  ])), [
115
- [D, x]
116
- ]) : d("", !0)
119
+ [A, k]
120
+ ]) : c("", !0)
117
121
  ], 64);
118
122
  };
119
123
  }
@@ -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
  };