@enerex/template-studio 1.1.40 → 1.1.41
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,65 +1,65 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import W, { useContext as Se, useEffect as
|
|
3
|
-
import { QueryClient as
|
|
1
|
+
import { jsx as t, jsxs as c, Fragment as fe } from "react/jsx-runtime";
|
|
2
|
+
import W, { useContext as Se, useEffect as L, useState as N, useRef as J, useCallback as xe, createContext as je, memo as qe, useMemo as re } from "react";
|
|
3
|
+
import { QueryClient as Ue, QueryClientProvider as Ve, useQuery as he, useMutation as oe, useQueryClient as He } from "@tanstack/react-query";
|
|
4
4
|
import be from "axios";
|
|
5
|
-
import { Spinner as
|
|
6
|
-
import { Controller as
|
|
7
|
-
import
|
|
8
|
-
const
|
|
5
|
+
import { Spinner as Ke } from "react-bootstrap";
|
|
6
|
+
import { Controller as Ge, useForm as We } from "react-hook-form";
|
|
7
|
+
import Le, { components as Pe } from "react-select";
|
|
8
|
+
const Me = W.createContext(
|
|
9
9
|
void 0
|
|
10
|
-
),
|
|
10
|
+
), ze = ({
|
|
11
11
|
children: e,
|
|
12
12
|
configs: n
|
|
13
13
|
}) => {
|
|
14
|
-
const [s, a] = W.useState(n.clientId), [i, r] = W.useState(n.apiKey), [l,
|
|
14
|
+
const [s, a] = W.useState(n.clientId), [i, r] = W.useState(n.apiKey), [l, o] = W.useState(
|
|
15
15
|
n.enerexIdentifier
|
|
16
|
-
), [
|
|
16
|
+
), [d, y] = W.useState(n.projectId), [m, T] = W.useState(n.userEmail), [w, E] = W.useState(n.isAdmin), [A, h] = W.useState(n.meBaseUrl), [g, b] = W.useState(
|
|
17
17
|
n.defaultSelector
|
|
18
|
-
),
|
|
19
|
-
r(v.apiKey), a(v.clientId),
|
|
18
|
+
), p = (v) => {
|
|
19
|
+
r(v.apiKey), a(v.clientId), y(v.projectId), o(v.enerexIdentifier), T(v.userEmail), E(v.isAdmin), b(v.defaultSelector), h(v.meBaseUrl);
|
|
20
20
|
};
|
|
21
21
|
return /* @__PURE__ */ t(
|
|
22
|
-
|
|
22
|
+
Me.Provider,
|
|
23
23
|
{
|
|
24
24
|
value: {
|
|
25
25
|
clientId: s,
|
|
26
26
|
apiKey: i,
|
|
27
|
-
setConfiguration:
|
|
27
|
+
setConfiguration: p,
|
|
28
28
|
enerexIdentifier: l,
|
|
29
|
-
projectId:
|
|
30
|
-
userEmail:
|
|
31
|
-
isAdmin:
|
|
32
|
-
defaultSelector:
|
|
29
|
+
projectId: d,
|
|
30
|
+
userEmail: m,
|
|
31
|
+
isAdmin: w,
|
|
32
|
+
defaultSelector: g,
|
|
33
33
|
meBaseUrl: A
|
|
34
34
|
},
|
|
35
35
|
children: e
|
|
36
36
|
}
|
|
37
37
|
);
|
|
38
|
-
},
|
|
39
|
-
const e = Se(
|
|
38
|
+
}, q = () => {
|
|
39
|
+
const e = Se(Me);
|
|
40
40
|
if (!e)
|
|
41
41
|
throw new Error("widgetConfig must be used within a ConfigProvider");
|
|
42
42
|
return e;
|
|
43
|
-
},
|
|
43
|
+
}, Qe = ({
|
|
44
44
|
message: e,
|
|
45
45
|
type: n = "info",
|
|
46
46
|
duration: s = 3e3,
|
|
47
47
|
onClose: a
|
|
48
|
-
}) => (
|
|
48
|
+
}) => (L(() => {
|
|
49
49
|
const i = setTimeout(a, s);
|
|
50
50
|
return () => clearTimeout(i);
|
|
51
|
-
}, [s, a]), /* @__PURE__ */
|
|
51
|
+
}, [s, a]), /* @__PURE__ */ c("div", { className: `ts-toast ts-toast-${n}`, children: [
|
|
52
52
|
/* @__PURE__ */ t("span", { className: "ts-toast-message", children: e }),
|
|
53
53
|
/* @__PURE__ */ t("button", { className: "ts-toast-close", onClick: a, children: "×" })
|
|
54
|
-
] })),
|
|
55
|
-
const [e, n] = N(null), s =
|
|
56
|
-
return { showNotification:
|
|
54
|
+
] })), Xe = () => {
|
|
55
|
+
const [e, n] = N(null), s = J(null);
|
|
56
|
+
return { showNotification: xe(
|
|
57
57
|
(r, l = "info") => {
|
|
58
58
|
s.current !== r && (s.current = r, n({ message: r, type: l }));
|
|
59
59
|
},
|
|
60
60
|
[]
|
|
61
61
|
), NotificationRenderer: () => e ? /* @__PURE__ */ t(
|
|
62
|
-
|
|
62
|
+
Qe,
|
|
63
63
|
{
|
|
64
64
|
message: e.message,
|
|
65
65
|
type: e.type,
|
|
@@ -68,16 +68,16 @@ const De = W.createContext(
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
) : null };
|
|
71
|
-
},
|
|
71
|
+
}, Re = je(null), Ye = ({
|
|
72
72
|
children: e
|
|
73
73
|
}) => {
|
|
74
|
-
const n =
|
|
75
|
-
return /* @__PURE__ */
|
|
74
|
+
const n = Xe();
|
|
75
|
+
return /* @__PURE__ */ c(Re.Provider, { value: n, children: [
|
|
76
76
|
e,
|
|
77
77
|
/* @__PURE__ */ t(n.NotificationRenderer, {})
|
|
78
78
|
] });
|
|
79
|
-
},
|
|
80
|
-
const e = Se(
|
|
79
|
+
}, ke = () => {
|
|
80
|
+
const e = Se(Re);
|
|
81
81
|
if (!e)
|
|
82
82
|
throw new Error(
|
|
83
83
|
"useGlobalNotification must be used within NotificationProvider"
|
|
@@ -85,37 +85,37 @@ const De = W.createContext(
|
|
|
85
85
|
return e;
|
|
86
86
|
}, Oe = (e = "", n) => ({ get: async (r, l) => {
|
|
87
87
|
try {
|
|
88
|
-
const
|
|
88
|
+
const o = await be.get(
|
|
89
89
|
`${e}${r}`,
|
|
90
90
|
l ?? n
|
|
91
91
|
);
|
|
92
|
-
if (
|
|
93
|
-
return
|
|
94
|
-
} catch (
|
|
95
|
-
throw
|
|
92
|
+
if (o.status === 200)
|
|
93
|
+
return o.data;
|
|
94
|
+
} catch (o) {
|
|
95
|
+
throw o;
|
|
96
96
|
}
|
|
97
|
-
}, post: async (r, l,
|
|
97
|
+
}, post: async (r, l, o) => {
|
|
98
98
|
try {
|
|
99
|
-
const
|
|
99
|
+
const d = await be.post(
|
|
100
100
|
`${e}${r}`,
|
|
101
101
|
l,
|
|
102
|
-
|
|
102
|
+
o ?? n
|
|
103
103
|
);
|
|
104
|
-
if (
|
|
105
|
-
return
|
|
106
|
-
} catch (
|
|
107
|
-
throw
|
|
104
|
+
if (d.status === 200)
|
|
105
|
+
return d.data;
|
|
106
|
+
} catch (d) {
|
|
107
|
+
throw d;
|
|
108
108
|
}
|
|
109
109
|
}, delete: async (r, l) => {
|
|
110
110
|
try {
|
|
111
|
-
const
|
|
111
|
+
const o = await be.delete(
|
|
112
112
|
`${e}${r}`,
|
|
113
113
|
l ?? n
|
|
114
114
|
);
|
|
115
|
-
if (
|
|
116
|
-
return
|
|
117
|
-
} catch (
|
|
118
|
-
throw
|
|
115
|
+
if (o.status === 200 || o.status === 204)
|
|
116
|
+
return o.data;
|
|
117
|
+
} catch (o) {
|
|
118
|
+
throw o;
|
|
119
119
|
}
|
|
120
120
|
} }), Be = W.createContext({
|
|
121
121
|
get: () => {
|
|
@@ -127,18 +127,18 @@ const De = W.createContext(
|
|
|
127
127
|
delete: () => {
|
|
128
128
|
throw new Error("HttpClientContext.delete not implemented");
|
|
129
129
|
}
|
|
130
|
-
}),
|
|
131
|
-
const { clientId: n, apiKey: s, isAdmin: a, meBaseUrl: i } =
|
|
130
|
+
}), Je = ({ children: e }) => {
|
|
131
|
+
const { clientId: n, apiKey: s, isAdmin: a, meBaseUrl: i } = q(), r = {
|
|
132
132
|
headers: {
|
|
133
133
|
client_id: n,
|
|
134
134
|
"x-api-key": s,
|
|
135
135
|
"Security-Context": a ? "admin" : "viewer"
|
|
136
136
|
}
|
|
137
|
-
}, { get: l, post:
|
|
138
|
-
return /* @__PURE__ */ t(Be.Provider, { value: { get: l, post:
|
|
139
|
-
},
|
|
140
|
-
const n = new
|
|
141
|
-
return /* @__PURE__ */ t(
|
|
137
|
+
}, { get: l, post: o, delete: d } = Oe(i, r);
|
|
138
|
+
return /* @__PURE__ */ t(Be.Provider, { value: { get: l, post: o, delete: d }, children: e });
|
|
139
|
+
}, Ze = ({ children: e }) => {
|
|
140
|
+
const n = new Ue();
|
|
141
|
+
return /* @__PURE__ */ t(Je, { children: /* @__PURE__ */ t(Ve, { client: n, children: e }) });
|
|
142
142
|
}, z = () => {
|
|
143
143
|
const e = Se(Be);
|
|
144
144
|
if (e)
|
|
@@ -154,9 +154,9 @@ const De = W.createContext(
|
|
|
154
154
|
markFavourite: "/Template/MarkFavourite/",
|
|
155
155
|
deleteTemplate: "/Template/DeleteTemplate/",
|
|
156
156
|
duplicateTemplate: "/Template/DuplicateTemplate/"
|
|
157
|
-
},
|
|
158
|
-
const e = z(), { enerexIdentifier: n, projectId: s } =
|
|
159
|
-
return
|
|
157
|
+
}, et = () => {
|
|
158
|
+
const e = z(), { enerexIdentifier: n, projectId: s } = q();
|
|
159
|
+
return he({
|
|
160
160
|
queryKey: ["getTemplatesList"],
|
|
161
161
|
queryFn: async (i) => await e.get(
|
|
162
162
|
`${Q.Template_list}${s}/${n}`
|
|
@@ -165,9 +165,9 @@ const De = W.createContext(
|
|
|
165
165
|
refetchOnReconnect: !1,
|
|
166
166
|
refetchOnMount: !1
|
|
167
167
|
});
|
|
168
|
-
},
|
|
169
|
-
const e = z(), { enerexIdentifier: n, projectId: s } =
|
|
170
|
-
return
|
|
168
|
+
}, tt = () => {
|
|
169
|
+
const e = z(), { enerexIdentifier: n, projectId: s } = q();
|
|
170
|
+
return he({
|
|
171
171
|
queryKey: ["getTemplateTypes"],
|
|
172
172
|
queryFn: async (i) => await e.get(
|
|
173
173
|
`${Q.TemplateTypes}${n}/${s}`
|
|
@@ -176,8 +176,8 @@ const De = W.createContext(
|
|
|
176
176
|
refetchOnReconnect: !1,
|
|
177
177
|
refetchOnMount: !1
|
|
178
178
|
});
|
|
179
|
-
},
|
|
180
|
-
const e = z(), { enerexIdentifier: n, projectId: s } =
|
|
179
|
+
}, nt = () => {
|
|
180
|
+
const e = z(), { enerexIdentifier: n, projectId: s } = q();
|
|
181
181
|
return oe({
|
|
182
182
|
mutationKey: ["getTemplate"],
|
|
183
183
|
mutationFn: async ({ id: i }) => {
|
|
@@ -187,48 +187,142 @@ const De = W.createContext(
|
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
189
|
});
|
|
190
|
-
},
|
|
190
|
+
}, se = ({
|
|
191
191
|
size: e = "md",
|
|
192
192
|
center: n = !1,
|
|
193
193
|
overlay: s = !1
|
|
194
194
|
}) => {
|
|
195
195
|
const a = /* @__PURE__ */ t("div", { className: `ts-loader ts-loader-${e}` });
|
|
196
196
|
return s ? /* @__PURE__ */ t("div", { className: "ts-loader-overlay", children: a }) : n ? /* @__PURE__ */ t("div", { className: "ts-loader-center", children: a }) : a;
|
|
197
|
+
}, Fe = () => {
|
|
198
|
+
const e = z(), { enerexIdentifier: n, projectId: s } = q();
|
|
199
|
+
return oe({
|
|
200
|
+
mutationKey: ["markFavourite"],
|
|
201
|
+
mutationFn: async (i) => await e.post(
|
|
202
|
+
`${Q.markFavourite}${s}/${n}`,
|
|
203
|
+
i
|
|
204
|
+
)
|
|
205
|
+
});
|
|
206
|
+
}, Ee = (e) => {
|
|
207
|
+
let n = /* @__PURE__ */ t(
|
|
208
|
+
"span",
|
|
209
|
+
{
|
|
210
|
+
style: { width: "20px", height: "20px", display: "inline-block" }
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
return e.variant === "filled" ? n = /* @__PURE__ */ t(
|
|
214
|
+
"svg",
|
|
215
|
+
{
|
|
216
|
+
version: "1.0",
|
|
217
|
+
id: "Layer_1",
|
|
218
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
219
|
+
width: "20px",
|
|
220
|
+
height: "20px",
|
|
221
|
+
viewBox: "0 0 64 64",
|
|
222
|
+
"enable-background": "new 0 0 64 64",
|
|
223
|
+
children: /* @__PURE__ */ t(
|
|
224
|
+
"path",
|
|
225
|
+
{
|
|
226
|
+
fill: "#2196F3",
|
|
227
|
+
d: `M63.893,24.277c-0.238-0.711-0.854-1.229-1.595-1.343l-19.674-3.006L33.809,1.15\r
|
|
228
|
+
C33.479,0.448,32.773,0,31.998,0s-1.48,0.448-1.811,1.15l-8.815,18.778L1.698,22.935c-0.741,0.113-1.356,0.632-1.595,1.343\r
|
|
229
|
+
c-0.238,0.71-0.059,1.494,0.465,2.031l14.294,14.657L11.484,61.67c-0.124,0.756,0.195,1.517,0.822,1.957\r
|
|
230
|
+
c0.344,0.243,0.747,0.366,1.151,0.366c0.332,0,0.666-0.084,0.968-0.25l17.572-9.719l17.572,9.719c0.302,0.166,0.636,0.25,0.968,0.25\r
|
|
231
|
+
c0.404,0,0.808-0.123,1.151-0.366c0.627-0.44,0.946-1.201,0.822-1.957l-3.378-20.704l14.294-14.657\r
|
|
232
|
+
C63.951,25.771,64.131,24.987,63.893,24.277z`
|
|
233
|
+
}
|
|
234
|
+
)
|
|
235
|
+
}
|
|
236
|
+
) : e.variant === "outlined" && (n = /* @__PURE__ */ t(
|
|
237
|
+
"svg",
|
|
238
|
+
{
|
|
239
|
+
version: "1.0",
|
|
240
|
+
id: "Layer_1",
|
|
241
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
242
|
+
width: "20px",
|
|
243
|
+
height: "20px",
|
|
244
|
+
viewBox: "0 0 64 64",
|
|
245
|
+
enableBackground: "new 0 0 64 64",
|
|
246
|
+
children: /* @__PURE__ */ t(
|
|
247
|
+
"path",
|
|
248
|
+
{
|
|
249
|
+
fill: e.fill || "rgba(247, 216, 40, 0)",
|
|
250
|
+
stroke: e.stroke || "#000000",
|
|
251
|
+
strokeWidth: e.strokeWidth || "2",
|
|
252
|
+
d: `M63.893,24.277c-0.238-0.711-0.854-1.229-1.595-1.343l-19.674-3.006L33.809,1.15\r
|
|
253
|
+
C33.479,0.448,32.773,0,31.998,0s-1.48,0.448-1.811,1.15l-8.815,18.778L1.698,22.935c-0.741,0.113-1.356,0.632-1.595,1.343\r
|
|
254
|
+
c-0.238,0.71-0.059,1.494,0.465,2.031l14.294,14.657L11.484,61.67c-0.124,0.756,0.195,1.517,0.822,1.957\r
|
|
255
|
+
c0.344,0.243,0.747,0.366,1.151,0.366c0.332,0,0.666-0.084,0.968-0.25l17.572-9.719l17.572,9.719c0.302,0.166,0.636,0.25,0.968,0.25\r
|
|
256
|
+
c0.404,0,0.808-0.123,1.151-0.366c0.627-0.44,0.946-1.201,0.822-1.957l-3.378-20.704l14.294-14.657\r
|
|
257
|
+
C63.951,25.771,64.131,24.987,63.893,24.277z`
|
|
258
|
+
}
|
|
259
|
+
)
|
|
260
|
+
}
|
|
261
|
+
)), n;
|
|
197
262
|
};
|
|
198
|
-
function
|
|
263
|
+
function rt({
|
|
199
264
|
template: e,
|
|
200
265
|
openActionId: n,
|
|
201
266
|
setOpenActionId: s,
|
|
202
267
|
onEdit: a,
|
|
203
268
|
onDuplicate: i,
|
|
204
269
|
onRemove: r,
|
|
205
|
-
onPreview: l
|
|
270
|
+
onPreview: l,
|
|
271
|
+
onRefresh: o
|
|
206
272
|
}) {
|
|
207
|
-
const { isAdmin:
|
|
208
|
-
|
|
209
|
-
function
|
|
210
|
-
|
|
273
|
+
const { isAdmin: d } = q(), y = n === e.id, m = J(null), T = J(null), [w, E, A] = e.categoryChain, { mutateAsync: h, isPending: g } = Fe(), { showNotification: b } = ke(), p = E?.key, v = A?.key, O = p === 9, M = d || v !== 2, P = d || v !== 2;
|
|
274
|
+
L(() => {
|
|
275
|
+
function C(k) {
|
|
276
|
+
y && m.current && !m.current.contains(k.target) && !T.current?.contains(k.target) && s(null);
|
|
211
277
|
}
|
|
212
|
-
return document.addEventListener("mousedown",
|
|
213
|
-
}, [
|
|
214
|
-
function
|
|
215
|
-
|
|
278
|
+
return document.addEventListener("mousedown", C), () => document.removeEventListener("mousedown", C);
|
|
279
|
+
}, [y, s]), L(() => {
|
|
280
|
+
function C(k) {
|
|
281
|
+
k.key === "Escape" && s(null);
|
|
216
282
|
}
|
|
217
|
-
return
|
|
218
|
-
}, [
|
|
219
|
-
if (!
|
|
220
|
-
const
|
|
221
|
-
|
|
283
|
+
return y && document.addEventListener("keydown", C), () => document.removeEventListener("keydown", C);
|
|
284
|
+
}, [y, s]), L(() => {
|
|
285
|
+
if (!y || !m.current) return;
|
|
286
|
+
const C = Array.from(
|
|
287
|
+
m.current.querySelectorAll('[role="menuitem"]')
|
|
222
288
|
);
|
|
223
|
-
if (!
|
|
224
|
-
let
|
|
225
|
-
|
|
226
|
-
function
|
|
227
|
-
|
|
289
|
+
if (!C.length) return;
|
|
290
|
+
let k = 0;
|
|
291
|
+
C[0].focus();
|
|
292
|
+
function x($) {
|
|
293
|
+
$.key === "ArrowDown" && (k = (k + 1) % C.length, C[k].focus(), $.preventDefault()), $.key === "ArrowUp" && (k = (k - 1 + C.length) % C.length, C[k].focus(), $.preventDefault());
|
|
228
294
|
}
|
|
229
|
-
return document.addEventListener("keydown",
|
|
230
|
-
}, [
|
|
231
|
-
|
|
295
|
+
return document.addEventListener("keydown", x), () => document.removeEventListener("keydown", x);
|
|
296
|
+
}, [y]);
|
|
297
|
+
const U = async () => {
|
|
298
|
+
try {
|
|
299
|
+
await h({
|
|
300
|
+
categoryId: v?.toString() ?? "",
|
|
301
|
+
templateId: e.id ?? ""
|
|
302
|
+
}), o(), b(
|
|
303
|
+
`Template "${e?.name}" marked as favourite`,
|
|
304
|
+
"success"
|
|
305
|
+
);
|
|
306
|
+
} catch (C) {
|
|
307
|
+
console.error(C), b(
|
|
308
|
+
"Unable to mark template as favourite. Please try again.",
|
|
309
|
+
"error"
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
return /* @__PURE__ */ t(fe, { children: /* @__PURE__ */ c("tr", { className: "ts-table-row", children: [
|
|
314
|
+
/* @__PURE__ */ t("td", { children: /* @__PURE__ */ c("div", { className: "ts-name-cell", children: [
|
|
315
|
+
O && /* @__PURE__ */ t(
|
|
316
|
+
"button",
|
|
317
|
+
{
|
|
318
|
+
type: "button",
|
|
319
|
+
className: "ts-fav-btn ts-btn-light",
|
|
320
|
+
disabled: e.is_favourite,
|
|
321
|
+
onClick: U,
|
|
322
|
+
title: "Mark as favourite",
|
|
323
|
+
children: g ? /* @__PURE__ */ t(se, { size: "sm" }) : e.is_favourite ? /* @__PURE__ */ t(Ee, { variant: "filled" }) : /* @__PURE__ */ t(Ee, { variant: "outlined" })
|
|
324
|
+
}
|
|
325
|
+
),
|
|
232
326
|
/* @__PURE__ */ t(
|
|
233
327
|
"span",
|
|
234
328
|
{
|
|
@@ -236,29 +330,29 @@ function nt({
|
|
|
236
330
|
children: e.readonly ? "Default" : "Custom"
|
|
237
331
|
}
|
|
238
332
|
),
|
|
239
|
-
/* @__PURE__ */ t("span", { children: e.name })
|
|
333
|
+
/* @__PURE__ */ t("span", { className: "ts-template-name", children: e.name })
|
|
240
334
|
] }) }),
|
|
241
|
-
/* @__PURE__ */ t("td", { children:
|
|
242
|
-
/* @__PURE__ */ t("td", { children:
|
|
243
|
-
/* @__PURE__ */ t("td", { children:
|
|
335
|
+
/* @__PURE__ */ t("td", { children: w?.name ?? "" }),
|
|
336
|
+
/* @__PURE__ */ t("td", { children: E?.name ?? "" }),
|
|
337
|
+
/* @__PURE__ */ t("td", { children: A?.name ?? "" }),
|
|
244
338
|
/* @__PURE__ */ t("td", { children: e?.updatedByName ?? "" }),
|
|
245
|
-
/* @__PURE__ */ t("td", { className: "ts-actions-cell", children: /* @__PURE__ */
|
|
339
|
+
/* @__PURE__ */ t("td", { className: "ts-actions-cell", children: /* @__PURE__ */ c("div", { className: "ts-actions-wrapper", children: [
|
|
246
340
|
/* @__PURE__ */ t(
|
|
247
341
|
"button",
|
|
248
342
|
{
|
|
249
|
-
ref:
|
|
343
|
+
ref: T,
|
|
250
344
|
className: "ts-actions-btn",
|
|
251
345
|
"aria-haspopup": "true",
|
|
252
|
-
"aria-expanded":
|
|
253
|
-
onClick: () => s(
|
|
346
|
+
"aria-expanded": y,
|
|
347
|
+
onClick: () => s(y ? null : e.id),
|
|
254
348
|
children: "⋯"
|
|
255
349
|
}
|
|
256
350
|
),
|
|
257
|
-
/* @__PURE__ */
|
|
351
|
+
/* @__PURE__ */ c(
|
|
258
352
|
"div",
|
|
259
353
|
{
|
|
260
|
-
ref:
|
|
261
|
-
className: `ts-actions-menu ${
|
|
354
|
+
ref: m,
|
|
355
|
+
className: `ts-actions-menu ${y ? "open" : ""}`,
|
|
262
356
|
role: "menu",
|
|
263
357
|
children: [
|
|
264
358
|
/* @__PURE__ */ t(
|
|
@@ -273,7 +367,7 @@ function nt({
|
|
|
273
367
|
children: "Preview"
|
|
274
368
|
}
|
|
275
369
|
),
|
|
276
|
-
|
|
370
|
+
M && /* @__PURE__ */ t(
|
|
277
371
|
"button",
|
|
278
372
|
{
|
|
279
373
|
type: "button",
|
|
@@ -285,7 +379,7 @@ function nt({
|
|
|
285
379
|
children: "Edit"
|
|
286
380
|
}
|
|
287
381
|
),
|
|
288
|
-
|
|
382
|
+
/* @__PURE__ */ t(
|
|
289
383
|
"button",
|
|
290
384
|
{
|
|
291
385
|
type: "button",
|
|
@@ -297,7 +391,7 @@ function nt({
|
|
|
297
391
|
children: "Duplicate"
|
|
298
392
|
}
|
|
299
393
|
),
|
|
300
|
-
|
|
394
|
+
P && /* @__PURE__ */ t(
|
|
301
395
|
"button",
|
|
302
396
|
{
|
|
303
397
|
type: "button",
|
|
@@ -315,36 +409,36 @@ function nt({
|
|
|
315
409
|
] }) })
|
|
316
410
|
] }) });
|
|
317
411
|
}
|
|
318
|
-
const
|
|
412
|
+
const st = qe(rt), ve = 5, at = ({
|
|
319
413
|
page: e,
|
|
320
414
|
pageSize: n,
|
|
321
415
|
totalRecords: s,
|
|
322
416
|
onPageChange: a,
|
|
323
417
|
onPageSizeChange: i
|
|
324
418
|
}) => {
|
|
325
|
-
const r = Math.ceil(s / n),
|
|
326
|
-
return /* @__PURE__ */
|
|
327
|
-
/* @__PURE__ */
|
|
328
|
-
/* @__PURE__ */
|
|
419
|
+
const r = Math.ceil(s / n), o = r <= ve ? Array.from({ length: r }, (m, T) => T + 1) : Array.from({ length: ve }, (m, T) => T + 1), d = r > ve, y = r;
|
|
420
|
+
return /* @__PURE__ */ c("div", { className: "ts-pagination-bar", children: [
|
|
421
|
+
/* @__PURE__ */ c("div", { className: "ts-page-container", children: [
|
|
422
|
+
/* @__PURE__ */ c("div", { className: "ts-page-size", children: [
|
|
329
423
|
"Display:",
|
|
330
424
|
/* @__PURE__ */ t(
|
|
331
425
|
"select",
|
|
332
426
|
{
|
|
333
427
|
value: n,
|
|
334
|
-
onChange: (
|
|
335
|
-
i(Number(
|
|
428
|
+
onChange: (m) => {
|
|
429
|
+
i(Number(m.target.value)), a(1);
|
|
336
430
|
},
|
|
337
|
-
children: [10, 25, 50, 100].map((
|
|
431
|
+
children: [10, 25, 50, 100].map((m) => /* @__PURE__ */ t("option", { value: m, children: m }, m))
|
|
338
432
|
}
|
|
339
433
|
)
|
|
340
434
|
] }),
|
|
341
|
-
/* @__PURE__ */
|
|
435
|
+
/* @__PURE__ */ c("div", { className: "ts-page-info", children: [
|
|
342
436
|
"Page ",
|
|
343
437
|
e,
|
|
344
438
|
" of ",
|
|
345
439
|
r
|
|
346
440
|
] }),
|
|
347
|
-
/* @__PURE__ */
|
|
441
|
+
/* @__PURE__ */ c("div", { className: "ts-go-to", children: [
|
|
348
442
|
"Go to page:",
|
|
349
443
|
/* @__PURE__ */ t(
|
|
350
444
|
"input",
|
|
@@ -353,36 +447,36 @@ const rt = je(nt), ve = 5, st = ({
|
|
|
353
447
|
min: 1,
|
|
354
448
|
max: r,
|
|
355
449
|
value: e,
|
|
356
|
-
onChange: (
|
|
357
|
-
const
|
|
358
|
-
|
|
450
|
+
onChange: (m) => {
|
|
451
|
+
const T = Number(m.target.value);
|
|
452
|
+
T >= 1 && T <= r && a(T);
|
|
359
453
|
}
|
|
360
454
|
}
|
|
361
455
|
)
|
|
362
456
|
] })
|
|
363
457
|
] }),
|
|
364
|
-
/* @__PURE__ */
|
|
458
|
+
/* @__PURE__ */ c("div", { className: "ts-total", children: [
|
|
365
459
|
"Total: ",
|
|
366
460
|
s
|
|
367
461
|
] }),
|
|
368
|
-
/* @__PURE__ */
|
|
462
|
+
/* @__PURE__ */ c("div", { className: "ts-page-buttons", children: [
|
|
369
463
|
/* @__PURE__ */ t("button", { disabled: e === 1, onClick: () => a(e - 1), children: "‹" }),
|
|
370
|
-
|
|
464
|
+
o.map((m) => /* @__PURE__ */ t(
|
|
371
465
|
"button",
|
|
372
466
|
{
|
|
373
|
-
className:
|
|
374
|
-
onClick: () => a(
|
|
375
|
-
children:
|
|
467
|
+
className: m === e ? "active" : "",
|
|
468
|
+
onClick: () => a(m),
|
|
469
|
+
children: m
|
|
376
470
|
},
|
|
377
|
-
|
|
471
|
+
m
|
|
378
472
|
)),
|
|
379
|
-
|
|
380
|
-
|
|
473
|
+
d && /* @__PURE__ */ t("span", { style: { padding: "0 6px" }, children: "…" }),
|
|
474
|
+
d && /* @__PURE__ */ t(
|
|
381
475
|
"button",
|
|
382
476
|
{
|
|
383
|
-
className: e ===
|
|
384
|
-
onClick: () => a(
|
|
385
|
-
children:
|
|
477
|
+
className: e === y ? "active" : "",
|
|
478
|
+
onClick: () => a(y),
|
|
479
|
+
children: y
|
|
386
480
|
}
|
|
387
481
|
),
|
|
388
482
|
/* @__PURE__ */ t(
|
|
@@ -395,7 +489,7 @@ const rt = je(nt), ve = 5, st = ({
|
|
|
395
489
|
)
|
|
396
490
|
] })
|
|
397
491
|
] });
|
|
398
|
-
},
|
|
492
|
+
}, it = ({
|
|
399
493
|
show: e,
|
|
400
494
|
variant: n,
|
|
401
495
|
title: s = "Are you sure?",
|
|
@@ -403,56 +497,56 @@ const rt = je(nt), ve = 5, st = ({
|
|
|
403
497
|
label: i = "Name",
|
|
404
498
|
value: r = "",
|
|
405
499
|
placeholder: l = "",
|
|
406
|
-
requiredMessage:
|
|
407
|
-
externalError:
|
|
408
|
-
externalErrorMessage:
|
|
409
|
-
confirmText:
|
|
410
|
-
cancelText:
|
|
411
|
-
confirmButtonVariant:
|
|
412
|
-
disableConfirm:
|
|
500
|
+
requiredMessage: o = "This field is required",
|
|
501
|
+
externalError: d = !1,
|
|
502
|
+
externalErrorMessage: y = "",
|
|
503
|
+
confirmText: m = "Ok",
|
|
504
|
+
cancelText: T = "Cancel",
|
|
505
|
+
confirmButtonVariant: w = "danger",
|
|
506
|
+
disableConfirm: E = !1,
|
|
413
507
|
onConfirm: A,
|
|
414
508
|
onCancel: h,
|
|
415
|
-
onInputChange:
|
|
509
|
+
onInputChange: g
|
|
416
510
|
}) => {
|
|
417
|
-
const [b,
|
|
418
|
-
if (
|
|
511
|
+
const [b, p] = N(r), [v, O] = N(!1), M = J(null);
|
|
512
|
+
if (L(() => {
|
|
419
513
|
if (!e) return;
|
|
420
|
-
const
|
|
421
|
-
|
|
514
|
+
const x = ($) => {
|
|
515
|
+
$.key === "Escape" && h();
|
|
422
516
|
};
|
|
423
|
-
return document.addEventListener("keydown",
|
|
424
|
-
}, [e, h]),
|
|
517
|
+
return document.addEventListener("keydown", x), () => document.removeEventListener("keydown", x);
|
|
518
|
+
}, [e, h]), L(() => {
|
|
425
519
|
if (!e) return;
|
|
426
|
-
const
|
|
427
|
-
|
|
520
|
+
const x = ($) => {
|
|
521
|
+
M.current && !M.current.contains($.target) && h();
|
|
428
522
|
};
|
|
429
|
-
return document.addEventListener("mousedown",
|
|
430
|
-
}, [e, h]),
|
|
523
|
+
return document.addEventListener("mousedown", x), () => document.removeEventListener("mousedown", x);
|
|
524
|
+
}, [e, h]), L(() => {
|
|
431
525
|
if (e)
|
|
432
526
|
return document.body.style.overflow = "hidden", () => {
|
|
433
527
|
document.body.style.overflow = "";
|
|
434
528
|
};
|
|
435
|
-
}, [e]),
|
|
436
|
-
e && (
|
|
437
|
-
}, [e, r]),
|
|
438
|
-
|
|
439
|
-
}, [
|
|
440
|
-
const
|
|
441
|
-
if (
|
|
442
|
-
|
|
529
|
+
}, [e]), L(() => {
|
|
530
|
+
e && (p(r), O(!1));
|
|
531
|
+
}, [e, r]), L(() => {
|
|
532
|
+
d && O(!0);
|
|
533
|
+
}, [d]), !e) return null;
|
|
534
|
+
const P = n === "input" && !b.trim(), U = n === "input" && (P || d), C = P ? o : d ? y : "", k = () => {
|
|
535
|
+
if (U || E) {
|
|
536
|
+
O(!0);
|
|
443
537
|
return;
|
|
444
538
|
}
|
|
445
539
|
A(b.trim());
|
|
446
540
|
};
|
|
447
|
-
return /* @__PURE__ */ t("div", { className: "ts-modal-overlay", children: /* @__PURE__ */
|
|
448
|
-
/* @__PURE__ */
|
|
541
|
+
return /* @__PURE__ */ t("div", { className: "ts-modal-overlay", children: /* @__PURE__ */ c("div", { ref: M, className: "ts-modal", children: [
|
|
542
|
+
/* @__PURE__ */ c("div", { className: "ts-modal-header", children: [
|
|
449
543
|
/* @__PURE__ */ t("h4", { className: "ts-modal-title ", children: s }),
|
|
450
544
|
/* @__PURE__ */ t("button", { className: "ts-modal-close", onClick: h, children: "✕" })
|
|
451
545
|
] }),
|
|
452
|
-
/* @__PURE__ */
|
|
546
|
+
/* @__PURE__ */ c("div", { className: "ts-modal-body", children: [
|
|
453
547
|
a && /* @__PURE__ */ t("p", { className: "ts-modal-message", children: a }),
|
|
454
|
-
n === "input" && /* @__PURE__ */
|
|
455
|
-
/* @__PURE__ */
|
|
548
|
+
n === "input" && /* @__PURE__ */ c("div", { className: "ts-form-group", children: [
|
|
549
|
+
/* @__PURE__ */ c("label", { className: "ts-label", children: [
|
|
456
550
|
i,
|
|
457
551
|
/* @__PURE__ */ t("span", { className: "ts-required", children: "*" })
|
|
458
552
|
] }),
|
|
@@ -460,42 +554,42 @@ const rt = je(nt), ve = 5, st = ({
|
|
|
460
554
|
"input",
|
|
461
555
|
{
|
|
462
556
|
type: "text",
|
|
463
|
-
className: `ts-input ${v &&
|
|
557
|
+
className: `ts-input ${v && U ? "ts-input-error" : ""}`,
|
|
464
558
|
placeholder: l,
|
|
465
559
|
value: b,
|
|
466
|
-
onChange: (
|
|
467
|
-
|
|
560
|
+
onChange: (x) => {
|
|
561
|
+
p(x.target.value), v && O(!1), g?.(x.target.value);
|
|
468
562
|
},
|
|
469
563
|
autoFocus: !0,
|
|
470
564
|
style: { paddingBlock: "0", paddingInline: "0" }
|
|
471
565
|
}
|
|
472
566
|
),
|
|
473
|
-
v &&
|
|
567
|
+
v && U && /* @__PURE__ */ t("div", { className: "ts-error-text", children: C })
|
|
474
568
|
] })
|
|
475
569
|
] }),
|
|
476
|
-
/* @__PURE__ */
|
|
570
|
+
/* @__PURE__ */ c("div", { className: "ts-modal-footer", children: [
|
|
477
571
|
/* @__PURE__ */ t(
|
|
478
572
|
"button",
|
|
479
573
|
{
|
|
480
574
|
type: "button",
|
|
481
575
|
className: "ts-btn ts-btn-secondary",
|
|
482
576
|
onClick: h,
|
|
483
|
-
children:
|
|
577
|
+
children: T
|
|
484
578
|
}
|
|
485
579
|
),
|
|
486
580
|
/* @__PURE__ */ t(
|
|
487
581
|
"button",
|
|
488
582
|
{
|
|
489
583
|
type: "button",
|
|
490
|
-
className: `ts-btn ts-btn-${
|
|
491
|
-
onClick:
|
|
492
|
-
disabled:
|
|
493
|
-
children:
|
|
584
|
+
className: `ts-btn ts-btn-${w}`,
|
|
585
|
+
onClick: k,
|
|
586
|
+
disabled: E,
|
|
587
|
+
children: m
|
|
494
588
|
}
|
|
495
589
|
)
|
|
496
590
|
] })
|
|
497
591
|
] }) });
|
|
498
|
-
},
|
|
592
|
+
}, lt = () => /* @__PURE__ */ t(
|
|
499
593
|
"svg",
|
|
500
594
|
{
|
|
501
595
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -504,8 +598,8 @@ const rt = je(nt), ve = 5, st = ({
|
|
|
504
598
|
height: "16px",
|
|
505
599
|
children: /* @__PURE__ */ t("path", { fill: "#ffffff", d: "M368 208A160 160 0 1 0 48 208a160 160 0 1 0 320 0zM337.1 371.1C301.7 399.2 256.8 416 208 416C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208c0 48.8-16.8 93.7-44.9 129.1L505 471c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0L337.1 371.1z" })
|
|
506
600
|
}
|
|
507
|
-
),
|
|
508
|
-
const e = z(), { enerexIdentifier: n, projectId: s, userEmail: a } =
|
|
601
|
+
), ot = () => {
|
|
602
|
+
const e = z(), { enerexIdentifier: n, projectId: s, userEmail: a } = q();
|
|
509
603
|
return oe({
|
|
510
604
|
mutationKey: ["duplicateTemplate"],
|
|
511
605
|
mutationFn: async ({ templateId: r, request: l }) => (l.enerexIdentifier = n ?? "", l.projectId = s ?? "", l.updatedBy = a ?? "", await e.post(
|
|
@@ -513,7 +607,7 @@ const rt = je(nt), ve = 5, st = ({
|
|
|
513
607
|
l
|
|
514
608
|
))
|
|
515
609
|
});
|
|
516
|
-
},
|
|
610
|
+
}, ct = () => {
|
|
517
611
|
const e = z();
|
|
518
612
|
return oe({
|
|
519
613
|
mutationKey: ["deleteTemplate"],
|
|
@@ -523,17 +617,17 @@ const rt = je(nt), ve = 5, st = ({
|
|
|
523
617
|
);
|
|
524
618
|
}
|
|
525
619
|
});
|
|
526
|
-
},
|
|
620
|
+
}, dt = ({
|
|
527
621
|
data: e,
|
|
528
622
|
page: n,
|
|
529
623
|
pageSize: s
|
|
530
624
|
}) => {
|
|
531
|
-
const a =
|
|
532
|
-
return { pagedData:
|
|
625
|
+
const a = re(() => Math.ceil(e.length / s), [e.length, s]);
|
|
626
|
+
return { pagedData: re(() => {
|
|
533
627
|
const r = (n - 1) * s, l = n * s;
|
|
534
628
|
return e.slice(r, l);
|
|
535
629
|
}, [e, n, s]), totalPages: a };
|
|
536
|
-
},
|
|
630
|
+
}, mt = ({
|
|
537
631
|
templates: e,
|
|
538
632
|
templateTypes: n,
|
|
539
633
|
onRefresh: s,
|
|
@@ -541,162 +635,164 @@ const rt = je(nt), ve = 5, st = ({
|
|
|
541
635
|
onEdit: i,
|
|
542
636
|
onPreview: r
|
|
543
637
|
}) => {
|
|
544
|
-
const { mutateAsync: l, isPending:
|
|
545
|
-
|
|
546
|
-
}, [
|
|
547
|
-
|
|
548
|
-
const
|
|
549
|
-
|
|
550
|
-
|
|
638
|
+
const { mutateAsync: l, isPending: o } = ot(), { mutateAsync: d, isPending: y } = ct(), [m, T] = N(""), [w, E] = N(""), [A, h] = N(null), [g, b] = N(e), [p, v] = N(n), [O, M] = N(!1), [P, U] = N("input"), [C, k] = N(!1), [x, $] = N(null), [B, ce] = N("asc"), V = (u) => {
|
|
639
|
+
x === u ? ce((S) => S === "asc" ? "desc" : "asc") : ($(u), ce("asc")), ie(1);
|
|
640
|
+
}, [K, G] = N(null);
|
|
641
|
+
L(() => {
|
|
642
|
+
const u = [...e].sort((S, R) => {
|
|
643
|
+
if (S.is_favourite !== R.is_favourite)
|
|
644
|
+
return Number(R.is_favourite) - Number(S.is_favourite);
|
|
645
|
+
const D = new Date(R.updatedDateTime).getTime() - new Date(S.updatedDateTime).getTime();
|
|
646
|
+
return D !== 0 ? D : S.readonly !== R.readonly ? Number(S.readonly) - Number(R.readonly) : S.name.localeCompare(R.name);
|
|
551
647
|
});
|
|
552
|
-
b(
|
|
553
|
-
}, [e]),
|
|
554
|
-
v(n.filter((
|
|
648
|
+
b(u), $(null);
|
|
649
|
+
}, [e]), L(() => {
|
|
650
|
+
v(n.filter((u) => u.id != null));
|
|
555
651
|
}, [n]);
|
|
556
|
-
const
|
|
557
|
-
const
|
|
558
|
-
return
|
|
559
|
-
}, [
|
|
560
|
-
(
|
|
561
|
-
const
|
|
562
|
-
let
|
|
563
|
-
for (;
|
|
564
|
-
|
|
565
|
-
return
|
|
652
|
+
const Z = re(() => {
|
|
653
|
+
const u = /* @__PURE__ */ new Map();
|
|
654
|
+
return p.forEach((S) => u.set(S.id, S)), u;
|
|
655
|
+
}, [p]), ye = xe(
|
|
656
|
+
(u) => {
|
|
657
|
+
const S = [], R = /* @__PURE__ */ new Set();
|
|
658
|
+
let D = Z.get(u);
|
|
659
|
+
for (; D && !(R.has(D.id) || (R.add(D.id), S.push({ id: D.id, name: D.name, key: D.key }), !D.parent_id)); )
|
|
660
|
+
D = Z.get(D.parent_id);
|
|
661
|
+
return S.reverse();
|
|
566
662
|
},
|
|
567
|
-
[
|
|
568
|
-
),
|
|
569
|
-
...
|
|
570
|
-
categoryChain:
|
|
571
|
-
})), [
|
|
572
|
-
|
|
573
|
-
const
|
|
574
|
-
|
|
663
|
+
[Z]
|
|
664
|
+
), ee = re(() => !g.length || !p.length ? [] : g.map((u) => ({
|
|
665
|
+
...u,
|
|
666
|
+
categoryChain: ye(u.type)
|
|
667
|
+
})), [g, p]);
|
|
668
|
+
L(() => {
|
|
669
|
+
const u = setTimeout(() => {
|
|
670
|
+
E(m), ie(1);
|
|
575
671
|
}, 300);
|
|
576
|
-
return () => clearTimeout(
|
|
577
|
-
}, [
|
|
578
|
-
const [
|
|
579
|
-
const
|
|
580
|
-
return
|
|
581
|
-
const R =
|
|
582
|
-
(
|
|
672
|
+
return () => clearTimeout(u);
|
|
673
|
+
}, [m]);
|
|
674
|
+
const [te, ae] = N(10), [H, ie] = N(1), ne = re(() => {
|
|
675
|
+
const u = w.trim().toLowerCase();
|
|
676
|
+
return u ? ee.filter((S) => {
|
|
677
|
+
const R = S.name.toLowerCase().includes(u), D = S.categoryChain?.some(
|
|
678
|
+
(Y) => Y.name.toLowerCase().includes(u)
|
|
583
679
|
);
|
|
584
|
-
return R ||
|
|
585
|
-
}) :
|
|
586
|
-
}, [
|
|
587
|
-
const
|
|
588
|
-
return
|
|
589
|
-
let
|
|
590
|
-
switch (
|
|
680
|
+
return R || D;
|
|
681
|
+
}) : ee;
|
|
682
|
+
}, [ee, w]), de = re(() => {
|
|
683
|
+
const u = [...ne];
|
|
684
|
+
return u.sort((S, R) => {
|
|
685
|
+
let D = "", Y = "";
|
|
686
|
+
switch (x) {
|
|
591
687
|
case "name":
|
|
592
|
-
|
|
688
|
+
D = S.name, Y = R.name;
|
|
593
689
|
break;
|
|
594
690
|
case "category":
|
|
595
|
-
|
|
691
|
+
D = S.categoryChain?.[0]?.name ?? "", Y = R.categoryChain?.[0]?.name ?? "";
|
|
596
692
|
break;
|
|
597
693
|
case "type":
|
|
598
|
-
|
|
694
|
+
D = S.categoryChain?.[1]?.name ?? "", Y = R.categoryChain?.[1]?.name ?? "";
|
|
599
695
|
break;
|
|
600
696
|
case "subtype":
|
|
601
|
-
|
|
697
|
+
D = S.categoryChain?.[2]?.name ?? "", Y = R.categoryChain?.[2]?.name ?? "";
|
|
602
698
|
break;
|
|
603
699
|
}
|
|
604
|
-
const
|
|
700
|
+
const Ie = D.localeCompare(Y, void 0, {
|
|
605
701
|
sensitivity: "base"
|
|
606
702
|
});
|
|
607
|
-
return B === "asc" ?
|
|
608
|
-
}),
|
|
609
|
-
}, [
|
|
703
|
+
return B === "asc" ? Ie : -Ie;
|
|
704
|
+
}), u;
|
|
705
|
+
}, [ne, x, B]), { pagedData: le } = dt({
|
|
610
706
|
data: de,
|
|
611
|
-
page:
|
|
612
|
-
pageSize:
|
|
613
|
-
}),
|
|
614
|
-
(
|
|
615
|
-
(
|
|
707
|
+
page: H,
|
|
708
|
+
pageSize: te
|
|
709
|
+
}), ge = xe(
|
|
710
|
+
(u) => g.some(
|
|
711
|
+
(S) => S.name.trim().toLowerCase() === u.trim().toLowerCase()
|
|
616
712
|
),
|
|
617
|
-
[
|
|
618
|
-
),
|
|
619
|
-
|
|
620
|
-
},
|
|
621
|
-
|
|
622
|
-
}, { showNotification:
|
|
623
|
-
if (
|
|
713
|
+
[g]
|
|
714
|
+
), f = (u) => {
|
|
715
|
+
G(u), k(!1), U("input"), M(!0);
|
|
716
|
+
}, I = (u) => {
|
|
717
|
+
G(u), U("confirm"), M(!0);
|
|
718
|
+
}, { showNotification: _ } = ke(), j = async (u) => {
|
|
719
|
+
if (K)
|
|
624
720
|
try {
|
|
625
|
-
if (
|
|
626
|
-
if (!
|
|
627
|
-
if (
|
|
628
|
-
|
|
721
|
+
if (P === "input") {
|
|
722
|
+
if (!u) return;
|
|
723
|
+
if (ge(u)) {
|
|
724
|
+
k(!0);
|
|
629
725
|
return;
|
|
630
726
|
}
|
|
631
727
|
await l({
|
|
632
|
-
templateId:
|
|
728
|
+
templateId: K.id,
|
|
633
729
|
request: {
|
|
634
730
|
projectId: "",
|
|
635
731
|
enerexIdentifier: "",
|
|
636
|
-
newName:
|
|
637
|
-
parent_id:
|
|
732
|
+
newName: u,
|
|
733
|
+
parent_id: K.id ?? null
|
|
638
734
|
}
|
|
639
|
-
}),
|
|
640
|
-
`Template "${
|
|
735
|
+
}), _(
|
|
736
|
+
`Template "${u}" duplicated successfully`,
|
|
641
737
|
"success"
|
|
642
738
|
);
|
|
643
739
|
}
|
|
644
|
-
|
|
645
|
-
`Template "${
|
|
740
|
+
P === "confirm" && (await d(K.id), _(
|
|
741
|
+
`Template "${K.name}" deleted successfully`,
|
|
646
742
|
"success"
|
|
647
|
-
)),
|
|
743
|
+
)), M(!1), G(null), s();
|
|
648
744
|
} catch {
|
|
649
|
-
|
|
650
|
-
|
|
745
|
+
_(
|
|
746
|
+
P === "confirm" ? "Failed to delete template. Please try again." : "Failed to duplicate template. Please try again.",
|
|
651
747
|
"error"
|
|
652
748
|
);
|
|
653
749
|
}
|
|
654
|
-
},
|
|
655
|
-
return /* @__PURE__ */
|
|
656
|
-
(
|
|
657
|
-
/* @__PURE__ */
|
|
658
|
-
/* @__PURE__ */
|
|
750
|
+
}, X = K?.categoryChain?.[2]?.name?.toLowerCase() ?? "this", F = K?.name?.toLowerCase() ?? "";
|
|
751
|
+
return /* @__PURE__ */ c(fe, { children: [
|
|
752
|
+
(o || y) && /* @__PURE__ */ t(se, { overlay: !0 }),
|
|
753
|
+
/* @__PURE__ */ c("div", { className: "ts-page", children: [
|
|
754
|
+
/* @__PURE__ */ c("div", { className: "ts-header", children: [
|
|
659
755
|
/* @__PURE__ */ t("h1", { className: "ts-title", children: "Templates" }),
|
|
660
756
|
/* @__PURE__ */ t("button", { className: "ts-btn ts-btn-primary", onClick: a, children: "+ Add Template" })
|
|
661
757
|
] }),
|
|
662
|
-
/* @__PURE__ */ t("div", { className: "ts-search", children: /* @__PURE__ */
|
|
758
|
+
/* @__PURE__ */ t("div", { className: "ts-search", children: /* @__PURE__ */ c("div", { className: "ts-search-box", children: [
|
|
663
759
|
/* @__PURE__ */ t(
|
|
664
760
|
"input",
|
|
665
761
|
{
|
|
666
762
|
type: "text",
|
|
667
763
|
placeholder: "Search...",
|
|
668
|
-
value:
|
|
669
|
-
onChange: (
|
|
764
|
+
value: m,
|
|
765
|
+
onChange: (u) => T(u.target.value)
|
|
670
766
|
}
|
|
671
767
|
),
|
|
672
|
-
|
|
768
|
+
m && /* @__PURE__ */ t(
|
|
673
769
|
"button",
|
|
674
770
|
{
|
|
675
771
|
className: "ts-clear-btn",
|
|
676
772
|
"aria-label": "Clear search",
|
|
677
|
-
onClick: () =>
|
|
773
|
+
onClick: () => T(""),
|
|
678
774
|
children: "×"
|
|
679
775
|
}
|
|
680
776
|
),
|
|
681
|
-
/* @__PURE__ */ t("button", { className: "ts-search-btn", "aria-label": "Search", children: /* @__PURE__ */ t(
|
|
777
|
+
/* @__PURE__ */ t("button", { className: "ts-search-btn", "aria-label": "Search", children: /* @__PURE__ */ t(lt, {}) })
|
|
682
778
|
] }) }),
|
|
683
|
-
/* @__PURE__ */
|
|
684
|
-
/* @__PURE__ */
|
|
685
|
-
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */
|
|
686
|
-
/* @__PURE__ */ t("th", { onClick: () =>
|
|
779
|
+
/* @__PURE__ */ c("div", { className: "ts-table-wrapper", children: [
|
|
780
|
+
/* @__PURE__ */ c("table", { className: "ts-table", children: [
|
|
781
|
+
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ c("tr", { children: [
|
|
782
|
+
/* @__PURE__ */ t("th", { onClick: () => V("name"), className: "ts-sortable", children: /* @__PURE__ */ c("div", { className: "ts-th-sort", children: [
|
|
687
783
|
"Name",
|
|
688
|
-
/* @__PURE__ */
|
|
784
|
+
/* @__PURE__ */ c("span", { className: "ts-sort-icons", children: [
|
|
689
785
|
/* @__PURE__ */ t(
|
|
690
786
|
"span",
|
|
691
787
|
{
|
|
692
|
-
className:
|
|
788
|
+
className: x === "name" && B === "asc" ? "active" : "",
|
|
693
789
|
children: "▲"
|
|
694
790
|
}
|
|
695
791
|
),
|
|
696
792
|
/* @__PURE__ */ t(
|
|
697
793
|
"span",
|
|
698
794
|
{
|
|
699
|
-
className:
|
|
795
|
+
className: x === "name" && B === "desc" ? "active" : "",
|
|
700
796
|
children: "▼"
|
|
701
797
|
}
|
|
702
798
|
)
|
|
@@ -705,22 +801,22 @@ const rt = je(nt), ve = 5, st = ({
|
|
|
705
801
|
/* @__PURE__ */ t(
|
|
706
802
|
"th",
|
|
707
803
|
{
|
|
708
|
-
onClick: () =>
|
|
804
|
+
onClick: () => V("category"),
|
|
709
805
|
className: "ts-sortable",
|
|
710
|
-
children: /* @__PURE__ */
|
|
806
|
+
children: /* @__PURE__ */ c("div", { className: "ts-th-sort", children: [
|
|
711
807
|
"Category",
|
|
712
|
-
/* @__PURE__ */
|
|
808
|
+
/* @__PURE__ */ c("span", { className: "ts-sort-icons", children: [
|
|
713
809
|
/* @__PURE__ */ t(
|
|
714
810
|
"span",
|
|
715
811
|
{
|
|
716
|
-
className:
|
|
812
|
+
className: x === "category" && B === "asc" ? "active" : "",
|
|
717
813
|
children: "▲"
|
|
718
814
|
}
|
|
719
815
|
),
|
|
720
816
|
/* @__PURE__ */ t(
|
|
721
817
|
"span",
|
|
722
818
|
{
|
|
723
|
-
className:
|
|
819
|
+
className: x === "category" && B === "desc" ? "active" : "",
|
|
724
820
|
children: "▼"
|
|
725
821
|
}
|
|
726
822
|
)
|
|
@@ -728,20 +824,20 @@ const rt = je(nt), ve = 5, st = ({
|
|
|
728
824
|
] })
|
|
729
825
|
}
|
|
730
826
|
),
|
|
731
|
-
/* @__PURE__ */ t("th", { onClick: () =>
|
|
827
|
+
/* @__PURE__ */ t("th", { onClick: () => V("type"), className: "ts-sortable", children: /* @__PURE__ */ c("div", { className: "ts-th-sort", children: [
|
|
732
828
|
"Type",
|
|
733
|
-
/* @__PURE__ */
|
|
829
|
+
/* @__PURE__ */ c("span", { className: "ts-sort-icons", children: [
|
|
734
830
|
/* @__PURE__ */ t(
|
|
735
831
|
"span",
|
|
736
832
|
{
|
|
737
|
-
className:
|
|
833
|
+
className: x === "type" && B === "asc" ? "active" : "",
|
|
738
834
|
children: "▲"
|
|
739
835
|
}
|
|
740
836
|
),
|
|
741
837
|
/* @__PURE__ */ t(
|
|
742
838
|
"span",
|
|
743
839
|
{
|
|
744
|
-
className:
|
|
840
|
+
className: x === "type" && B === "desc" ? "active" : "",
|
|
745
841
|
children: "▼"
|
|
746
842
|
}
|
|
747
843
|
)
|
|
@@ -750,22 +846,22 @@ const rt = je(nt), ve = 5, st = ({
|
|
|
750
846
|
/* @__PURE__ */ t(
|
|
751
847
|
"th",
|
|
752
848
|
{
|
|
753
|
-
onClick: () =>
|
|
849
|
+
onClick: () => V("subtype"),
|
|
754
850
|
className: "ts-sortable",
|
|
755
|
-
children: /* @__PURE__ */
|
|
851
|
+
children: /* @__PURE__ */ c("div", { className: "ts-th-sort", children: [
|
|
756
852
|
"Subtype",
|
|
757
|
-
/* @__PURE__ */
|
|
853
|
+
/* @__PURE__ */ c("span", { className: "ts-sort-icons", children: [
|
|
758
854
|
/* @__PURE__ */ t(
|
|
759
855
|
"span",
|
|
760
856
|
{
|
|
761
|
-
className:
|
|
857
|
+
className: x === "subtype" && B === "asc" ? "active" : "",
|
|
762
858
|
children: "▲"
|
|
763
859
|
}
|
|
764
860
|
),
|
|
765
861
|
/* @__PURE__ */ t(
|
|
766
862
|
"span",
|
|
767
863
|
{
|
|
768
|
-
className:
|
|
864
|
+
className: x === "subtype" && B === "desc" ? "active" : "",
|
|
769
865
|
children: "▼"
|
|
770
866
|
}
|
|
771
867
|
)
|
|
@@ -776,53 +872,54 @@ const rt = je(nt), ve = 5, st = ({
|
|
|
776
872
|
/* @__PURE__ */ t("th", { children: "Updated by" }),
|
|
777
873
|
/* @__PURE__ */ t("th", { className: "align-right", children: "Actions" })
|
|
778
874
|
] }) }),
|
|
779
|
-
/* @__PURE__ */ t("tbody", { children:
|
|
780
|
-
|
|
875
|
+
/* @__PURE__ */ t("tbody", { children: le.map((u) => /* @__PURE__ */ t(
|
|
876
|
+
st,
|
|
781
877
|
{
|
|
782
|
-
template:
|
|
878
|
+
template: u,
|
|
783
879
|
openActionId: A,
|
|
784
880
|
setOpenActionId: h,
|
|
785
|
-
onDuplicate:
|
|
881
|
+
onDuplicate: f,
|
|
786
882
|
onEdit: i,
|
|
787
|
-
onRemove:
|
|
788
|
-
onPreview: r
|
|
883
|
+
onRemove: I,
|
|
884
|
+
onPreview: r,
|
|
885
|
+
onRefresh: s
|
|
789
886
|
},
|
|
790
|
-
|
|
887
|
+
u.id
|
|
791
888
|
)) })
|
|
792
889
|
] }),
|
|
793
890
|
/* @__PURE__ */ t(
|
|
794
|
-
|
|
891
|
+
at,
|
|
795
892
|
{
|
|
796
|
-
page:
|
|
797
|
-
pageSize:
|
|
893
|
+
page: H,
|
|
894
|
+
pageSize: te,
|
|
798
895
|
totalRecords: de.length,
|
|
799
896
|
onPageChange: ie,
|
|
800
|
-
onPageSizeChange:
|
|
897
|
+
onPageSizeChange: ae
|
|
801
898
|
}
|
|
802
899
|
)
|
|
803
900
|
] })
|
|
804
901
|
] }),
|
|
805
902
|
/* @__PURE__ */ t(
|
|
806
|
-
|
|
903
|
+
it,
|
|
807
904
|
{
|
|
808
|
-
show:
|
|
809
|
-
variant:
|
|
810
|
-
title:
|
|
811
|
-
message:
|
|
812
|
-
placeholder:
|
|
905
|
+
show: O,
|
|
906
|
+
variant: P,
|
|
907
|
+
title: P === "confirm" ? "Are you sure?" : "Save Template As",
|
|
908
|
+
message: P === "confirm" ? `Are you sure you want to remove ${X} template "${F}"?` : "",
|
|
909
|
+
placeholder: P === "input" ? "New name" : "",
|
|
813
910
|
label: "New Name",
|
|
814
911
|
requiredMessage: "Enter a new name",
|
|
815
|
-
externalError:
|
|
912
|
+
externalError: C,
|
|
816
913
|
externalErrorMessage: "Template name already exists. Please choose a different name",
|
|
817
|
-
confirmText:
|
|
818
|
-
confirmButtonVariant:
|
|
819
|
-
onConfirm:
|
|
820
|
-
onCancel: () =>
|
|
821
|
-
onInputChange:
|
|
914
|
+
confirmText: P === "confirm" ? "Ok" : "Save as",
|
|
915
|
+
confirmButtonVariant: P === "confirm" ? "danger" : "primary",
|
|
916
|
+
onConfirm: j,
|
|
917
|
+
onCancel: () => M(!1),
|
|
918
|
+
onInputChange: P === "input" ? () => k(!1) : void 0
|
|
822
919
|
}
|
|
823
920
|
)
|
|
824
921
|
] });
|
|
825
|
-
},
|
|
922
|
+
}, pe = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
|
|
826
923
|
<html\r
|
|
827
924
|
dir="ltr"\r
|
|
828
925
|
xmlns:o="urn:schemas-microsoft-com:office:office"\r
|
|
@@ -1182,7 +1279,7 @@ const rt = je(nt), ve = 5, st = ({
|
|
|
1182
1279
|
EDITOR_SCRIPT_URL: "https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js",
|
|
1183
1280
|
EDITOR_PLUGIN_ID: "1afdc3161ec7409a8627a1c8561d45f5",
|
|
1184
1281
|
EDITOR_SECRET_KEY: "54ba748ed7e94f2e929555783acb03da"
|
|
1185
|
-
},
|
|
1282
|
+
}, ut = (e) => {
|
|
1186
1283
|
const n = Array.from(new Set(e.map((a) => a.category))), s = [];
|
|
1187
1284
|
return n.forEach((a) => {
|
|
1188
1285
|
const i = e.filter((r) => r.category === a).map((r) => ({
|
|
@@ -1193,55 +1290,55 @@ const rt = je(nt), ve = 5, st = ({
|
|
|
1193
1290
|
}));
|
|
1194
1291
|
s.push({ category: a, entries: i });
|
|
1195
1292
|
}), s;
|
|
1196
|
-
},
|
|
1197
|
-
const e = z(), { enerexIdentifier: n, projectId: s } =
|
|
1198
|
-
return
|
|
1293
|
+
}, pt = () => {
|
|
1294
|
+
const e = z(), { enerexIdentifier: n, projectId: s } = q();
|
|
1295
|
+
return he({
|
|
1199
1296
|
queryKey: ["getTemplateTags"],
|
|
1200
1297
|
queryFn: async (i) => await e.get(
|
|
1201
1298
|
`${Q.MergeTags}${s}/${n}`
|
|
1202
1299
|
)
|
|
1203
1300
|
});
|
|
1204
|
-
},
|
|
1205
|
-
const e = z(), { enerexIdentifier: n, projectId: s } =
|
|
1206
|
-
return
|
|
1301
|
+
}, ft = () => {
|
|
1302
|
+
const e = z(), { enerexIdentifier: n, projectId: s } = q();
|
|
1303
|
+
return he({
|
|
1207
1304
|
queryKey: ["getExcludeCategory"],
|
|
1208
1305
|
queryFn: async (i) => await e.get(
|
|
1209
1306
|
`${Q.ExcludeCategory}${s}/${n}`
|
|
1210
1307
|
)
|
|
1211
1308
|
});
|
|
1212
|
-
},
|
|
1309
|
+
}, ht = ({
|
|
1213
1310
|
templateHTML: e,
|
|
1214
1311
|
className: n = "",
|
|
1215
1312
|
loading: s = !1,
|
|
1216
1313
|
onEditorInitialized: a
|
|
1217
1314
|
}) => {
|
|
1218
|
-
const { post: i } = Oe(), { data: r } =
|
|
1219
|
-
e ?? { html:
|
|
1220
|
-
), { userEmail:
|
|
1221
|
-
|
|
1222
|
-
(async () => (await
|
|
1315
|
+
const { post: i } = Oe(), { data: r } = pt(), { data: l } = ft(), [o, d] = N(
|
|
1316
|
+
e ?? { html: pe, css: "" }
|
|
1317
|
+
), { userEmail: y } = q(), m = J(null), T = "https://plugin.stripocdn.email/content/guids/CABINET_eab4e7d5a4603ac03f4120652a3a5a540f0c79c688514939f095f67433ed4a67/images/photo256.png", w = "https://plugins.stripo.email/api/v1/auth";
|
|
1318
|
+
L(() => {
|
|
1319
|
+
(async () => (await E(), r && l && await A(we.EDITOR_SCRIPT_URL)))();
|
|
1223
1320
|
}, [r, l]);
|
|
1224
|
-
async function
|
|
1225
|
-
window.Zone || await new Promise((
|
|
1226
|
-
const
|
|
1227
|
-
|
|
1321
|
+
async function E() {
|
|
1322
|
+
window.Zone || await new Promise((g, b) => {
|
|
1323
|
+
const p = document.createElement("script");
|
|
1324
|
+
p.src = "https://unpkg.com/zone.js@0.13.1/bundles/zone.umd.min.js";
|
|
1228
1325
|
const v = document.querySelector("script[nonce]")?.nonce;
|
|
1229
|
-
v &&
|
|
1326
|
+
v && p.setAttribute("nonce", v), p.onload = () => g(), p.onerror = () => b(new Error("Failed to load zone.js")), document.head.appendChild(p);
|
|
1230
1327
|
});
|
|
1231
1328
|
}
|
|
1232
|
-
async function A(
|
|
1329
|
+
async function A(g) {
|
|
1233
1330
|
let b = document.getElementById(
|
|
1234
1331
|
"UiEditorScript"
|
|
1235
1332
|
);
|
|
1236
|
-
b || (b = document.createElement("script"), b.id = "UiEditorScript", b.src =
|
|
1333
|
+
b || (b = document.createElement("script"), b.id = "UiEditorScript", b.src = g, b.onload = async () => {
|
|
1237
1334
|
await h();
|
|
1238
1335
|
}, document.body.appendChild(b)), await new Promise(
|
|
1239
|
-
(
|
|
1336
|
+
(p) => b.addEventListener("load", () => p(), { once: !0 })
|
|
1240
1337
|
);
|
|
1241
1338
|
}
|
|
1242
1339
|
const h = async () => {
|
|
1243
|
-
const
|
|
1244
|
-
if (!
|
|
1340
|
+
const g = m.current;
|
|
1341
|
+
if (!g) {
|
|
1245
1342
|
console.error("Missing #stripoEditorContainer in DOM");
|
|
1246
1343
|
return;
|
|
1247
1344
|
}
|
|
@@ -1250,47 +1347,47 @@ const rt = je(nt), ve = 5, st = ({
|
|
|
1250
1347
|
return;
|
|
1251
1348
|
}
|
|
1252
1349
|
const b = {
|
|
1253
|
-
html:
|
|
1254
|
-
css:
|
|
1350
|
+
html: o.html,
|
|
1351
|
+
css: o.css,
|
|
1255
1352
|
modulesExcludedCategories: l ?? [],
|
|
1256
1353
|
forceRecreate: !0,
|
|
1257
1354
|
metadata: {
|
|
1258
|
-
emailId:
|
|
1355
|
+
emailId: y,
|
|
1259
1356
|
userId: "1",
|
|
1260
1357
|
// username: userName,
|
|
1261
|
-
avatarUrl:
|
|
1358
|
+
avatarUrl: T
|
|
1262
1359
|
},
|
|
1263
1360
|
locale: "en",
|
|
1264
|
-
onTokenRefreshRequest: async (
|
|
1361
|
+
onTokenRefreshRequest: async (p) => {
|
|
1265
1362
|
const v = {
|
|
1266
1363
|
pluginId: we.EDITOR_PLUGIN_ID,
|
|
1267
1364
|
secretKey: we.EDITOR_SECRET_KEY,
|
|
1268
|
-
userId:
|
|
1365
|
+
userId: y,
|
|
1269
1366
|
role: "user"
|
|
1270
|
-
},
|
|
1271
|
-
|
|
1367
|
+
}, O = await i(
|
|
1368
|
+
w,
|
|
1272
1369
|
v
|
|
1273
1370
|
);
|
|
1274
|
-
|
|
1371
|
+
O?.token && p(O.token);
|
|
1275
1372
|
},
|
|
1276
1373
|
onTemplateLoaded: () => {
|
|
1277
1374
|
a && a(!0);
|
|
1278
1375
|
},
|
|
1279
|
-
mergeTags:
|
|
1376
|
+
mergeTags: ut(r ?? [])
|
|
1280
1377
|
};
|
|
1281
|
-
for (const [
|
|
1378
|
+
for (const [p, v] of Object.entries({
|
|
1282
1379
|
codeEditorButtonSelector: "#codeEditor",
|
|
1283
1380
|
undoButtonSelector: "#undoButton",
|
|
1284
1381
|
redoButtonSelector: "#redoButton",
|
|
1285
1382
|
mobileViewButtonSelector: "#mobileViewButton",
|
|
1286
1383
|
desktopViewButtonSelector: "#desktopViewButton"
|
|
1287
1384
|
}))
|
|
1288
|
-
|
|
1289
|
-
await window.UIEditor.initEditor(
|
|
1385
|
+
g.ownerDocument && g.getRootNode() instanceof ShadowRoot && g.getRootNode().querySelector(v) && (b[p] = v);
|
|
1386
|
+
await window.UIEditor.initEditor(g, b);
|
|
1290
1387
|
};
|
|
1291
|
-
return /* @__PURE__ */ t("div", { className: "position-relative", children: /* @__PURE__ */
|
|
1388
|
+
return /* @__PURE__ */ t("div", { className: "position-relative", children: /* @__PURE__ */ c("div", { className: `editor-container ${n}`, children: [
|
|
1292
1389
|
s && /* @__PURE__ */ t("div", { className: "loading-overlay", children: /* @__PURE__ */ t(
|
|
1293
|
-
|
|
1390
|
+
Ke,
|
|
1294
1391
|
{
|
|
1295
1392
|
animation: "border",
|
|
1296
1393
|
style: { width: "11px", height: "11px" },
|
|
@@ -1301,9 +1398,9 @@ const rt = je(nt), ve = 5, st = ({
|
|
|
1301
1398
|
}
|
|
1302
1399
|
) }),
|
|
1303
1400
|
/* @__PURE__ */ t("div", { id: "externalSystemContainer" }),
|
|
1304
|
-
/* @__PURE__ */ t("div", { id: "stripoEditorContainer", ref:
|
|
1401
|
+
/* @__PURE__ */ t("div", { id: "stripoEditorContainer", ref: m })
|
|
1305
1402
|
] }) });
|
|
1306
|
-
},
|
|
1403
|
+
}, $e = ({
|
|
1307
1404
|
label: e,
|
|
1308
1405
|
register: n,
|
|
1309
1406
|
validation: s,
|
|
@@ -1311,11 +1408,11 @@ const rt = je(nt), ve = 5, st = ({
|
|
|
1311
1408
|
name: i,
|
|
1312
1409
|
error: r,
|
|
1313
1410
|
className: l = "",
|
|
1314
|
-
...
|
|
1411
|
+
...o
|
|
1315
1412
|
}) => {
|
|
1316
|
-
const
|
|
1317
|
-
return /* @__PURE__ */
|
|
1318
|
-
e && /* @__PURE__ */
|
|
1413
|
+
const d = !!(r && r[i]);
|
|
1414
|
+
return /* @__PURE__ */ c("div", { className: `ts-form-group ${l}`, children: [
|
|
1415
|
+
e && /* @__PURE__ */ c("label", { className: "ts-form-label", children: [
|
|
1319
1416
|
e,
|
|
1320
1417
|
a && /* @__PURE__ */ t("span", { className: "ts-required", children: "*" })
|
|
1321
1418
|
] }),
|
|
@@ -1324,47 +1421,37 @@ const rt = je(nt), ve = 5, st = ({
|
|
|
1324
1421
|
{
|
|
1325
1422
|
name: i,
|
|
1326
1423
|
type: "text",
|
|
1327
|
-
...
|
|
1424
|
+
...o,
|
|
1328
1425
|
...n ? n(i, {
|
|
1329
1426
|
...s
|
|
1330
1427
|
}) : {},
|
|
1331
|
-
className: `ts-input ${
|
|
1332
|
-
"aria-invalid":
|
|
1428
|
+
className: `ts-input ${d ? "ts-input-error" : ""}`,
|
|
1429
|
+
"aria-invalid": d
|
|
1333
1430
|
}
|
|
1334
1431
|
),
|
|
1335
|
-
|
|
1432
|
+
d && /* @__PURE__ */ t("div", { className: "ts-error-text", children: r?.[i]?.message })
|
|
1336
1433
|
] });
|
|
1337
1434
|
};
|
|
1338
|
-
function
|
|
1435
|
+
function Ne(e) {
|
|
1339
1436
|
return e.sort((n, s) => n.name.localeCompare(s.name));
|
|
1340
1437
|
}
|
|
1341
|
-
function
|
|
1438
|
+
function yt(e) {
|
|
1342
1439
|
const n = /* @__PURE__ */ new Map(), s = [];
|
|
1343
1440
|
e.forEach((r) => n.set(r.id, r));
|
|
1344
1441
|
let a = e.filter((r) => r.parent_id === 0), i = 0;
|
|
1345
1442
|
for (; a.length > 0; ) {
|
|
1346
1443
|
s.push({ level: i, data: a });
|
|
1347
|
-
const r = a.map((
|
|
1444
|
+
const r = a.map((o) => o.id);
|
|
1348
1445
|
a = e.filter(
|
|
1349
|
-
(
|
|
1446
|
+
(o) => r.includes(o.parent_id)
|
|
1350
1447
|
), i++;
|
|
1351
1448
|
}
|
|
1352
1449
|
return s;
|
|
1353
1450
|
}
|
|
1354
|
-
function
|
|
1355
|
-
const a =
|
|
1451
|
+
function Te(e, n) {
|
|
1452
|
+
const a = yt(e).find((i) => i.level === n);
|
|
1356
1453
|
return a ? a.data : [];
|
|
1357
1454
|
}
|
|
1358
|
-
const yt = () => {
|
|
1359
|
-
const e = z(), { enerexIdentifier: n, projectId: s } = H();
|
|
1360
|
-
return oe({
|
|
1361
|
-
mutationKey: ["markFavourite"],
|
|
1362
|
-
mutationFn: async (i) => await e.post(
|
|
1363
|
-
`${Q.markFavourite}${s}/${n}`,
|
|
1364
|
-
i
|
|
1365
|
-
)
|
|
1366
|
-
});
|
|
1367
|
-
};
|
|
1368
1455
|
function gt(e) {
|
|
1369
1456
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
1370
1457
|
}
|
|
@@ -1374,15 +1461,15 @@ var Ce = { exports: {} };
|
|
|
1374
1461
|
Licensed under the MIT License (MIT), see
|
|
1375
1462
|
http://jedwatson.github.io/classnames
|
|
1376
1463
|
*/
|
|
1377
|
-
var
|
|
1464
|
+
var Ae;
|
|
1378
1465
|
function bt() {
|
|
1379
|
-
return
|
|
1466
|
+
return Ae || (Ae = 1, function(e) {
|
|
1380
1467
|
(function() {
|
|
1381
1468
|
var n = {}.hasOwnProperty;
|
|
1382
1469
|
function s() {
|
|
1383
1470
|
for (var r = "", l = 0; l < arguments.length; l++) {
|
|
1384
|
-
var
|
|
1385
|
-
|
|
1471
|
+
var o = arguments[l];
|
|
1472
|
+
o && (r = i(r, a(o)));
|
|
1386
1473
|
}
|
|
1387
1474
|
return r;
|
|
1388
1475
|
}
|
|
@@ -1396,8 +1483,8 @@ function bt() {
|
|
|
1396
1483
|
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
1397
1484
|
return r.toString();
|
|
1398
1485
|
var l = "";
|
|
1399
|
-
for (var
|
|
1400
|
-
n.call(r,
|
|
1486
|
+
for (var o in r)
|
|
1487
|
+
n.call(r, o) && r[o] && (l = i(l, o));
|
|
1401
1488
|
return l;
|
|
1402
1489
|
}
|
|
1403
1490
|
function i(r, l) {
|
|
@@ -1408,7 +1495,7 @@ function bt() {
|
|
|
1408
1495
|
}(Ce)), Ce.exports;
|
|
1409
1496
|
}
|
|
1410
1497
|
var vt = bt();
|
|
1411
|
-
const
|
|
1498
|
+
const _e = /* @__PURE__ */ gt(vt), De = (e) => e.data.isSeparator ? /* @__PURE__ */ t("div", { style: { padding: 0, margin: "2px 0" }, children: /* @__PURE__ */ t(
|
|
1412
1499
|
"hr",
|
|
1413
1500
|
{
|
|
1414
1501
|
style: {
|
|
@@ -1418,10 +1505,10 @@ const Ae = /* @__PURE__ */ gt(vt), _e = (e) => e.data.isSeparator ? /* @__PURE__
|
|
|
1418
1505
|
margin: 0
|
|
1419
1506
|
}
|
|
1420
1507
|
}
|
|
1421
|
-
) }) : e.data.icon ? /* @__PURE__ */
|
|
1422
|
-
/* @__PURE__ */ t(
|
|
1508
|
+
) }) : e.data.icon ? /* @__PURE__ */ c("div", { className: "d-flex align-items-center", children: [
|
|
1509
|
+
/* @__PURE__ */ t(Pe.Option, { ...e }),
|
|
1423
1510
|
/* @__PURE__ */ t("span", { className: "px-1 template-studio-dropdown-postfix-icon", children: e.data.icon })
|
|
1424
|
-
] }) : /* @__PURE__ */ t(
|
|
1511
|
+
] }) : /* @__PURE__ */ t(Pe.Option, { ...e }), wt = ({
|
|
1425
1512
|
name: e = "",
|
|
1426
1513
|
control: n,
|
|
1427
1514
|
options: s,
|
|
@@ -1429,26 +1516,26 @@ const Ae = /* @__PURE__ */ gt(vt), _e = (e) => e.data.isSeparator ? /* @__PURE__
|
|
|
1429
1516
|
placeholder: i,
|
|
1430
1517
|
validation: r,
|
|
1431
1518
|
labelKey: l = "name",
|
|
1432
|
-
disabled:
|
|
1433
|
-
isInvalid:
|
|
1434
|
-
value:
|
|
1435
|
-
onChange:
|
|
1436
|
-
uncontrolled:
|
|
1437
|
-
menuPlacement:
|
|
1438
|
-
closeOnSelect:
|
|
1519
|
+
disabled: o,
|
|
1520
|
+
isInvalid: d,
|
|
1521
|
+
value: y,
|
|
1522
|
+
onChange: m,
|
|
1523
|
+
uncontrolled: T,
|
|
1524
|
+
menuPlacement: w = "auto",
|
|
1525
|
+
closeOnSelect: E = !0
|
|
1439
1526
|
}) => {
|
|
1440
1527
|
const A = {
|
|
1441
1528
|
control: (h) => ({
|
|
1442
1529
|
...h,
|
|
1443
1530
|
minHeight: "33px",
|
|
1444
1531
|
// state.isFocused can display different borderColor if you need it
|
|
1445
|
-
borderColor:
|
|
1446
|
-
backgroundImage:
|
|
1532
|
+
borderColor: d ? "var(--bs-form-invalid-border-color) !important" : "var(--ct-input-border-color)",
|
|
1533
|
+
backgroundImage: d ? 'url("data:image/svg+xml,%3csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 12 12%27 width=%2712%27 height=%2712%27 fill=%27none%27 stroke=%27%23fa5c7c%27%3e%3ccircle cx=%276%27 cy=%276%27 r=%274.5%27/%3e%3cpath stroke-linejoin=%27round%27 d=%27M5.8 3.6h.4L6 6.5z%27/%3e%3ccircle cx=%276%27 cy=%278.2%27 r=%27.6%27 fill=%27%23fa5c7c%27 stroke=%27none%27/%3e%3c/svg%3e")' : "none",
|
|
1447
1534
|
backgroundRepeat: "no-repeat",
|
|
1448
1535
|
backgroundPosition: "right calc(0.375em + 0.225rem) center",
|
|
1449
1536
|
backgroundSize: "calc(0.75em + 0.45rem) calc(0.75em + 0.45rem)",
|
|
1450
1537
|
"&:hover": {
|
|
1451
|
-
borderColor:
|
|
1538
|
+
borderColor: d ? "var(--bs-form-invalid-border-color)" : "var(--ct-input-border-color)"
|
|
1452
1539
|
},
|
|
1453
1540
|
"& .react-select__single-value": {
|
|
1454
1541
|
color: "var(--ct-input-color) !important"
|
|
@@ -1472,44 +1559,44 @@ const Ae = /* @__PURE__ */ gt(vt), _e = (e) => e.data.isSeparator ? /* @__PURE__
|
|
|
1472
1559
|
}),
|
|
1473
1560
|
multiValueRemove: (h) => ({
|
|
1474
1561
|
...h,
|
|
1475
|
-
display:
|
|
1562
|
+
display: o ? "none" : "block"
|
|
1476
1563
|
})
|
|
1477
1564
|
};
|
|
1478
|
-
return
|
|
1479
|
-
|
|
1565
|
+
return T ? /* @__PURE__ */ t(
|
|
1566
|
+
Le,
|
|
1480
1567
|
{
|
|
1481
|
-
components: { Option:
|
|
1568
|
+
components: { Option: De },
|
|
1482
1569
|
isOptionDisabled: (h) => !!h.isSeparator,
|
|
1483
|
-
className:
|
|
1484
|
-
"is-invalid":
|
|
1570
|
+
className: _e({
|
|
1571
|
+
"is-invalid": d
|
|
1485
1572
|
}),
|
|
1486
1573
|
styles: A,
|
|
1487
1574
|
classNamePrefix: "react-select",
|
|
1488
1575
|
isMulti: a,
|
|
1489
1576
|
options: s,
|
|
1490
|
-
onChange:
|
|
1577
|
+
onChange: m,
|
|
1491
1578
|
placeholder: i,
|
|
1492
1579
|
menuPortalTarget: document.body,
|
|
1493
|
-
value:
|
|
1580
|
+
value: y,
|
|
1494
1581
|
getOptionLabel: typeof l == "string" ? (h) => h[l] : l,
|
|
1495
1582
|
getOptionValue: (h) => h.id,
|
|
1496
|
-
isDisabled:
|
|
1497
|
-
menuPlacement:
|
|
1498
|
-
closeMenuOnSelect:
|
|
1583
|
+
isDisabled: o,
|
|
1584
|
+
menuPlacement: w,
|
|
1585
|
+
closeMenuOnSelect: E
|
|
1499
1586
|
}
|
|
1500
1587
|
) : /* @__PURE__ */ t(
|
|
1501
|
-
|
|
1588
|
+
Ge,
|
|
1502
1589
|
{
|
|
1503
1590
|
control: n,
|
|
1504
1591
|
name: e,
|
|
1505
1592
|
rules: r,
|
|
1506
|
-
render: ({ field: { onChange: h, value:
|
|
1507
|
-
|
|
1593
|
+
render: ({ field: { onChange: h, value: g, onBlur: b } }) => /* @__PURE__ */ t(
|
|
1594
|
+
Le,
|
|
1508
1595
|
{
|
|
1509
|
-
components: { Option:
|
|
1510
|
-
isOptionDisabled: (
|
|
1511
|
-
className:
|
|
1512
|
-
"is-invalid":
|
|
1596
|
+
components: { Option: De },
|
|
1597
|
+
isOptionDisabled: (p) => !!p.isSeparator,
|
|
1598
|
+
className: _e({
|
|
1599
|
+
"is-invalid": d
|
|
1513
1600
|
}),
|
|
1514
1601
|
styles: A,
|
|
1515
1602
|
classNamePrefix: "react-select",
|
|
@@ -1519,18 +1606,18 @@ const Ae = /* @__PURE__ */ gt(vt), _e = (e) => e.data.isSeparator ? /* @__PURE__
|
|
|
1519
1606
|
onChange: h,
|
|
1520
1607
|
placeholder: i,
|
|
1521
1608
|
menuPortalTarget: document.body,
|
|
1522
|
-
value:
|
|
1523
|
-
getOptionLabel: typeof l == "string" ? (
|
|
1524
|
-
getOptionValue: (
|
|
1525
|
-
isDisabled:
|
|
1526
|
-
menuPlacement:
|
|
1527
|
-
closeMenuOnSelect:
|
|
1609
|
+
value: g,
|
|
1610
|
+
getOptionLabel: typeof l == "string" ? (p) => p[l] : l,
|
|
1611
|
+
getOptionValue: (p) => p.id,
|
|
1612
|
+
isDisabled: o,
|
|
1613
|
+
menuPlacement: w,
|
|
1614
|
+
closeMenuOnSelect: E
|
|
1528
1615
|
},
|
|
1529
|
-
|
|
1616
|
+
g ? g.id || g.value || JSON.stringify(g) : "reset"
|
|
1530
1617
|
)
|
|
1531
1618
|
}
|
|
1532
1619
|
);
|
|
1533
|
-
},
|
|
1620
|
+
}, ue = ({
|
|
1534
1621
|
label: e,
|
|
1535
1622
|
name: n,
|
|
1536
1623
|
validation: s,
|
|
@@ -1538,12 +1625,12 @@ const Ae = /* @__PURE__ */ gt(vt), _e = (e) => e.data.isSeparator ? /* @__PURE__
|
|
|
1538
1625
|
error: i,
|
|
1539
1626
|
options: r = [],
|
|
1540
1627
|
required: l = !1,
|
|
1541
|
-
disabled:
|
|
1542
|
-
className:
|
|
1628
|
+
disabled: o = !1,
|
|
1629
|
+
className: d = ""
|
|
1543
1630
|
}) => {
|
|
1544
|
-
const
|
|
1545
|
-
return /* @__PURE__ */
|
|
1546
|
-
e && /* @__PURE__ */
|
|
1631
|
+
const y = !!(i && i[n]);
|
|
1632
|
+
return /* @__PURE__ */ c("div", { className: `ts-form-group ${d}`, children: [
|
|
1633
|
+
e && /* @__PURE__ */ c("label", { className: "ts-form-label", children: [
|
|
1547
1634
|
e,
|
|
1548
1635
|
l && /* @__PURE__ */ t("span", { className: "ts-required", children: "*" })
|
|
1549
1636
|
] }),
|
|
@@ -1554,16 +1641,16 @@ const Ae = /* @__PURE__ */ gt(vt), _e = (e) => e.data.isSeparator ? /* @__PURE__
|
|
|
1554
1641
|
control: a,
|
|
1555
1642
|
options: r,
|
|
1556
1643
|
validation: s,
|
|
1557
|
-
disabled:
|
|
1558
|
-
isInvalid:
|
|
1644
|
+
disabled: o,
|
|
1645
|
+
isInvalid: y
|
|
1559
1646
|
}
|
|
1560
1647
|
),
|
|
1561
|
-
|
|
1648
|
+
y && /* @__PURE__ */ t("div", { className: "ts-error-text", children: i?.[n]?.message })
|
|
1562
1649
|
] });
|
|
1563
|
-
},
|
|
1650
|
+
}, Nt = () => {
|
|
1564
1651
|
const e = z();
|
|
1565
|
-
|
|
1566
|
-
const { enerexIdentifier: n, projectId: s } =
|
|
1652
|
+
He();
|
|
1653
|
+
const { enerexIdentifier: n, projectId: s } = q();
|
|
1567
1654
|
return oe({
|
|
1568
1655
|
mutationKey: ["saveTemplate"],
|
|
1569
1656
|
mutationFn: async (i) => (i.enerexIdentifier = n ?? "", i.projectId = s ?? "", await e.post(
|
|
@@ -1571,63 +1658,7 @@ const Ae = /* @__PURE__ */ gt(vt), _e = (e) => e.data.isSeparator ? /* @__PURE__
|
|
|
1571
1658
|
i
|
|
1572
1659
|
))
|
|
1573
1660
|
});
|
|
1574
|
-
},
|
|
1575
|
-
let n = /* @__PURE__ */ t(
|
|
1576
|
-
"span",
|
|
1577
|
-
{
|
|
1578
|
-
style: { width: "20px", height: "20px", display: "inline-block" }
|
|
1579
|
-
}
|
|
1580
|
-
);
|
|
1581
|
-
return e.variant === "filled" ? n = /* @__PURE__ */ t(
|
|
1582
|
-
"svg",
|
|
1583
|
-
{
|
|
1584
|
-
version: "1.0",
|
|
1585
|
-
id: "Layer_1",
|
|
1586
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1587
|
-
width: "20px",
|
|
1588
|
-
height: "20px",
|
|
1589
|
-
viewBox: "0 0 64 64",
|
|
1590
|
-
"enable-background": "new 0 0 64 64",
|
|
1591
|
-
children: /* @__PURE__ */ t(
|
|
1592
|
-
"path",
|
|
1593
|
-
{
|
|
1594
|
-
fill: "#2196F3",
|
|
1595
|
-
d: `M63.893,24.277c-0.238-0.711-0.854-1.229-1.595-1.343l-19.674-3.006L33.809,1.15\r
|
|
1596
|
-
C33.479,0.448,32.773,0,31.998,0s-1.48,0.448-1.811,1.15l-8.815,18.778L1.698,22.935c-0.741,0.113-1.356,0.632-1.595,1.343\r
|
|
1597
|
-
c-0.238,0.71-0.059,1.494,0.465,2.031l14.294,14.657L11.484,61.67c-0.124,0.756,0.195,1.517,0.822,1.957\r
|
|
1598
|
-
c0.344,0.243,0.747,0.366,1.151,0.366c0.332,0,0.666-0.084,0.968-0.25l17.572-9.719l17.572,9.719c0.302,0.166,0.636,0.25,0.968,0.25\r
|
|
1599
|
-
c0.404,0,0.808-0.123,1.151-0.366c0.627-0.44,0.946-1.201,0.822-1.957l-3.378-20.704l14.294-14.657\r
|
|
1600
|
-
C63.951,25.771,64.131,24.987,63.893,24.277z`
|
|
1601
|
-
}
|
|
1602
|
-
)
|
|
1603
|
-
}
|
|
1604
|
-
) : e.variant === "outlined" && (n = /* @__PURE__ */ t(
|
|
1605
|
-
"svg",
|
|
1606
|
-
{
|
|
1607
|
-
version: "1.0",
|
|
1608
|
-
id: "Layer_1",
|
|
1609
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1610
|
-
width: "20px",
|
|
1611
|
-
height: "20px",
|
|
1612
|
-
viewBox: "0 0 64 64",
|
|
1613
|
-
enableBackground: "new 0 0 64 64",
|
|
1614
|
-
children: /* @__PURE__ */ t(
|
|
1615
|
-
"path",
|
|
1616
|
-
{
|
|
1617
|
-
fill: e.fill || "rgba(247, 216, 40, 0)",
|
|
1618
|
-
stroke: e.stroke || "#000000",
|
|
1619
|
-
strokeWidth: e.strokeWidth || "2",
|
|
1620
|
-
d: `M63.893,24.277c-0.238-0.711-0.854-1.229-1.595-1.343l-19.674-3.006L33.809,1.15\r
|
|
1621
|
-
C33.479,0.448,32.773,0,31.998,0s-1.48,0.448-1.811,1.15l-8.815,18.778L1.698,22.935c-0.741,0.113-1.356,0.632-1.595,1.343\r
|
|
1622
|
-
c-0.238,0.71-0.059,1.494,0.465,2.031l14.294,14.657L11.484,61.67c-0.124,0.756,0.195,1.517,0.822,1.957\r
|
|
1623
|
-
c0.344,0.243,0.747,0.366,1.151,0.366c0.332,0,0.666-0.084,0.968-0.25l17.572-9.719l17.572,9.719c0.302,0.166,0.636,0.25,0.968,0.25\r
|
|
1624
|
-
c0.404,0,0.808-0.123,1.151-0.366c0.627-0.44,0.946-1.201,0.822-1.957l-3.378-20.704l14.294-14.657\r
|
|
1625
|
-
C63.951,25.771,64.131,24.987,63.893,24.277z`
|
|
1626
|
-
}
|
|
1627
|
-
)
|
|
1628
|
-
}
|
|
1629
|
-
)), n;
|
|
1630
|
-
}, Nt = {
|
|
1661
|
+
}, Tt = {
|
|
1631
1662
|
id: "",
|
|
1632
1663
|
name: "New (Blank)"
|
|
1633
1664
|
}, Ct = ({
|
|
@@ -1638,238 +1669,222 @@ const Ae = /* @__PURE__ */ gt(vt), _e = (e) => e.data.isSeparator ? /* @__PURE__
|
|
|
1638
1669
|
templateList: i,
|
|
1639
1670
|
template: r,
|
|
1640
1671
|
onRefresh: l,
|
|
1641
|
-
closeEditorModal:
|
|
1672
|
+
closeEditorModal: o
|
|
1642
1673
|
}) => {
|
|
1643
|
-
const { defaultSelector:
|
|
1644
|
-
register:
|
|
1674
|
+
const { defaultSelector: d, isAdmin: y, userEmail: m } = q(), { mutateAsync: T, isPending: w } = Fe(), {
|
|
1675
|
+
register: E,
|
|
1645
1676
|
handleSubmit: A,
|
|
1646
1677
|
clearErrors: h,
|
|
1647
|
-
setValue:
|
|
1678
|
+
setValue: g,
|
|
1648
1679
|
control: b,
|
|
1649
|
-
watch:
|
|
1680
|
+
watch: p,
|
|
1650
1681
|
reset: v,
|
|
1651
|
-
setError:
|
|
1652
|
-
formState: { errors:
|
|
1653
|
-
} =
|
|
1682
|
+
setError: O,
|
|
1683
|
+
formState: { errors: M }
|
|
1684
|
+
} = We({
|
|
1654
1685
|
defaultValues: {
|
|
1655
1686
|
templateName: "",
|
|
1656
1687
|
subTemplateType: void 0,
|
|
1657
1688
|
subTemplateType2: void 0,
|
|
1658
1689
|
subject: "",
|
|
1659
1690
|
templateType: void 0,
|
|
1660
|
-
template:
|
|
1691
|
+
template: Tt
|
|
1661
1692
|
},
|
|
1662
1693
|
mode: "onChange"
|
|
1663
|
-
}), [
|
|
1664
|
-
|
|
1694
|
+
}), [P, U] = N([]), [C, k] = N(), { mutateAsync: x, isPending: $ } = Nt(), [B, ce] = N([]), [V, K] = N([]), [G, Z] = N([]), [ye, ee] = N(!1), te = J(!1), { showNotification: ae } = ke(), H = s === "edit", ie = ye || $ || w || !n;
|
|
1695
|
+
L(() => {
|
|
1665
1696
|
if (a) {
|
|
1666
|
-
let
|
|
1667
|
-
ce(
|
|
1697
|
+
let f = a.filter((_) => _.id != null), I = Te(f, 0);
|
|
1698
|
+
ce(Ne(I));
|
|
1668
1699
|
}
|
|
1669
|
-
}, [a]),
|
|
1670
|
-
s === "edit" && !
|
|
1671
|
-
}, [s]),
|
|
1672
|
-
if (s !== "edit" || !r || !n || !a.length || !
|
|
1673
|
-
const
|
|
1674
|
-
if (!
|
|
1675
|
-
const
|
|
1700
|
+
}, [a]), L(() => {
|
|
1701
|
+
s === "edit" && !te.current && ee(!0);
|
|
1702
|
+
}, [s]), L(() => {
|
|
1703
|
+
if (s !== "edit" || !r || !n || !a.length || !P.length || te.current) return;
|
|
1704
|
+
const f = P.find((F) => F.id === r.templateID);
|
|
1705
|
+
if (!f) return;
|
|
1706
|
+
const I = a.filter((F) => F.id != null), _ = I.find((F) => `${F.id}` == `${f.type}`), j = _ ? I.find((F) => `${F.id}` == `${_.parent_id}`) : void 0, X = j ? I.find((F) => `${F.id}` == `${j.parent_id}`) : void 0;
|
|
1676
1707
|
v({
|
|
1677
|
-
templateType: X ?
|
|
1678
|
-
subTemplateType:
|
|
1679
|
-
subTemplateType2: _ ?
|
|
1680
|
-
template:
|
|
1708
|
+
templateType: X ? ne(X) : void 0,
|
|
1709
|
+
subTemplateType: j ? ne(j) : void 0,
|
|
1710
|
+
subTemplateType2: _ ? ne(_) : void 0,
|
|
1711
|
+
template: f,
|
|
1681
1712
|
templateName: r.name ?? "",
|
|
1682
1713
|
subject: r.subject ?? ""
|
|
1683
|
-
}),
|
|
1684
|
-
}, [s, r, n, a,
|
|
1685
|
-
const
|
|
1686
|
-
id: String(
|
|
1687
|
-
name:
|
|
1688
|
-
key:
|
|
1714
|
+
}), k(f), te.current = !0, ee(!1);
|
|
1715
|
+
}, [s, r, n, a, P, v]);
|
|
1716
|
+
const ne = (f) => ({
|
|
1717
|
+
id: String(f.id),
|
|
1718
|
+
name: f.name,
|
|
1719
|
+
key: f.key
|
|
1689
1720
|
});
|
|
1690
|
-
|
|
1691
|
-
i?.sort((
|
|
1692
|
-
}, [i]),
|
|
1693
|
-
if (!
|
|
1694
|
-
const
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1721
|
+
L(() => {
|
|
1722
|
+
i?.sort((f, I) => f.readonly !== I.readonly ? (f.readonly ? 0 : 1) - (I.readonly ? 0 : 1) : f.name.localeCompare(I.name)), U(i ?? []);
|
|
1723
|
+
}, [i]), L(() => {
|
|
1724
|
+
if (!p("templateType")) return;
|
|
1725
|
+
const f = Te(a, 1);
|
|
1726
|
+
K(
|
|
1727
|
+
Ne(
|
|
1728
|
+
f.filter((I) => `${I.parent_id}` == `${p("templateType")?.id}`)
|
|
1698
1729
|
)
|
|
1699
1730
|
);
|
|
1700
|
-
}, [
|
|
1701
|
-
const
|
|
1702
|
-
if (!
|
|
1703
|
-
const
|
|
1704
|
-
let _ =
|
|
1705
|
-
|
|
1731
|
+
}, [p("templateType"), a]), L(() => {
|
|
1732
|
+
const f = p("subTemplateType");
|
|
1733
|
+
if (!f) return;
|
|
1734
|
+
const I = Te(a, 2);
|
|
1735
|
+
let _ = Ne(
|
|
1736
|
+
I.filter((j) => `${j.parent_id}` == `${f.id}`)
|
|
1706
1737
|
);
|
|
1707
|
-
s !== "edit" && !
|
|
1708
|
-
}, [
|
|
1709
|
-
if (
|
|
1710
|
-
const
|
|
1711
|
-
(
|
|
1738
|
+
s !== "edit" && !y && (_ = _.filter((j) => j.key !== 2)), Z(_);
|
|
1739
|
+
}, [p("subTemplateType"), a, s]), L(() => {
|
|
1740
|
+
if (d && d.type1) {
|
|
1741
|
+
const f = B?.find(
|
|
1742
|
+
(I) => `${I.id}` === d.type1
|
|
1712
1743
|
);
|
|
1713
|
-
|
|
1744
|
+
g("templateType", f);
|
|
1714
1745
|
}
|
|
1715
|
-
}, [a, B]),
|
|
1716
|
-
if (
|
|
1717
|
-
const
|
|
1718
|
-
(
|
|
1746
|
+
}, [a, B]), L(() => {
|
|
1747
|
+
if (d && d.type2) {
|
|
1748
|
+
const f = V?.find(
|
|
1749
|
+
(I) => `${I.id}` === d.type2
|
|
1719
1750
|
);
|
|
1720
|
-
|
|
1751
|
+
g("subTemplateType", f);
|
|
1721
1752
|
}
|
|
1722
|
-
}, [a,
|
|
1723
|
-
if (
|
|
1724
|
-
const
|
|
1725
|
-
(
|
|
1753
|
+
}, [a, V]), L(() => {
|
|
1754
|
+
if (d && d.type3) {
|
|
1755
|
+
const f = G?.find(
|
|
1756
|
+
(I) => `${I.id}` === d.type3
|
|
1726
1757
|
);
|
|
1727
|
-
|
|
1758
|
+
g("subTemplateType2", f);
|
|
1728
1759
|
}
|
|
1729
|
-
}, [a,
|
|
1730
|
-
const de = (
|
|
1760
|
+
}, [a, G]);
|
|
1761
|
+
const de = (f) => {
|
|
1731
1762
|
window.StripoEditorApi.actionsApi.getTemplateData(
|
|
1732
|
-
async (
|
|
1763
|
+
async (I) => {
|
|
1733
1764
|
try {
|
|
1734
|
-
let _ =
|
|
1735
|
-
const X =
|
|
1736
|
-
|
|
1737
|
-
const
|
|
1738
|
-
(
|
|
1765
|
+
let _ = f.template.id, j = "";
|
|
1766
|
+
const X = f.templateName.trim();
|
|
1767
|
+
C?.readonly && (_ = "", j = f.template.id);
|
|
1768
|
+
const F = P.find(
|
|
1769
|
+
(R) => R.name === f.templateName.trim()
|
|
1739
1770
|
);
|
|
1740
|
-
if (
|
|
1741
|
-
|
|
1771
|
+
if (F && F.id !== _) {
|
|
1772
|
+
O("templateName", {
|
|
1742
1773
|
type: "validate",
|
|
1743
1774
|
message: "Template name already exists. Please choose a different name."
|
|
1744
1775
|
});
|
|
1745
1776
|
return;
|
|
1746
1777
|
}
|
|
1747
|
-
let
|
|
1748
|
-
|
|
1749
|
-
const
|
|
1778
|
+
let me = f.templateType.id;
|
|
1779
|
+
G?.length > 0 ? me = f.subTemplateType2.id : V?.length > 0 && (me = f.subTemplateType.id);
|
|
1780
|
+
const u = {
|
|
1750
1781
|
enerexIdentifier: "",
|
|
1751
1782
|
projectId: "",
|
|
1752
1783
|
templateId: _,
|
|
1753
|
-
templateType:
|
|
1784
|
+
templateType: me,
|
|
1754
1785
|
name: X,
|
|
1755
|
-
html:
|
|
1756
|
-
css:
|
|
1757
|
-
subject:
|
|
1758
|
-
parent_id:
|
|
1759
|
-
updatedBy:
|
|
1786
|
+
html: I.html,
|
|
1787
|
+
css: I.css,
|
|
1788
|
+
subject: f.templateType.id === "2" ? f?.subject ?? "" : "",
|
|
1789
|
+
parent_id: j,
|
|
1790
|
+
updatedBy: m ?? ""
|
|
1760
1791
|
};
|
|
1761
|
-
if (!await
|
|
1762
|
-
|
|
1792
|
+
if (!await x(u)) {
|
|
1793
|
+
ae(
|
|
1763
1794
|
"Failed to save template. Please try again.",
|
|
1764
1795
|
"error"
|
|
1765
1796
|
);
|
|
1766
1797
|
return;
|
|
1767
1798
|
}
|
|
1768
|
-
|
|
1769
|
-
|
|
1799
|
+
ae(
|
|
1800
|
+
H ? `Template "${X}" updated successfully.` : `Template "${X}" created successfully.`,
|
|
1770
1801
|
"success"
|
|
1771
|
-
), h(), l(),
|
|
1802
|
+
), h(), l(), o();
|
|
1772
1803
|
} catch (_) {
|
|
1773
|
-
console.error(_),
|
|
1804
|
+
console.error(_), ae(
|
|
1774
1805
|
"Something went wrong while saving the template.",
|
|
1775
1806
|
"error"
|
|
1776
1807
|
);
|
|
1777
1808
|
}
|
|
1778
1809
|
}
|
|
1779
1810
|
);
|
|
1780
|
-
},
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
categoryId: u ?? "",
|
|
1785
|
-
templateId: m("template")?.id ?? ""
|
|
1786
|
-
}), M && F({
|
|
1787
|
-
...M,
|
|
1788
|
-
is_favourite: !0
|
|
1789
|
-
}), Y("Template marked as favourite", "success"), l();
|
|
1790
|
-
} catch (u) {
|
|
1791
|
-
console.error("Mark favourite failed", u), Y(
|
|
1792
|
-
"Unable to mark template as favourite. Please try again.",
|
|
1793
|
-
"error"
|
|
1794
|
-
);
|
|
1795
|
-
}
|
|
1796
|
-
}, le = m("templateType"), ge = m("subTemplateType");
|
|
1797
|
-
return /* @__PURE__ */ d(pe, { children: [
|
|
1798
|
-
ie && /* @__PURE__ */ t(ae, { overlay: !0 }),
|
|
1799
|
-
/* @__PURE__ */ t("div", { className: "ts-card", children: /* @__PURE__ */ t("div", { className: "ts-card-body", children: /* @__PURE__ */ t("form", { children: /* @__PURE__ */ t("div", { className: "template-list-container", children: /* @__PURE__ */ d("div", { className: "ts-row", children: [
|
|
1811
|
+
}, le = p("templateType"), ge = p("subTemplateType");
|
|
1812
|
+
return /* @__PURE__ */ c(fe, { children: [
|
|
1813
|
+
ie && /* @__PURE__ */ t(se, { overlay: !0 }),
|
|
1814
|
+
/* @__PURE__ */ t("div", { className: "ts-card", children: /* @__PURE__ */ t("div", { className: "ts-card-body", children: /* @__PURE__ */ t("form", { children: /* @__PURE__ */ t("div", { className: "template-list-container", children: /* @__PURE__ */ c("div", { className: "ts-row", children: [
|
|
1800
1815
|
/* @__PURE__ */ t("div", { className: "ts-col", children: /* @__PURE__ */ t(
|
|
1801
|
-
|
|
1816
|
+
ue,
|
|
1802
1817
|
{
|
|
1803
1818
|
label: "Category",
|
|
1804
1819
|
control: b,
|
|
1805
|
-
error:
|
|
1820
|
+
error: M,
|
|
1806
1821
|
options: B,
|
|
1807
1822
|
required: !0,
|
|
1808
|
-
disabled:
|
|
1823
|
+
disabled: H || $ || w || !n,
|
|
1809
1824
|
validation: {
|
|
1810
1825
|
required: {
|
|
1811
1826
|
value: !0,
|
|
1812
1827
|
message: "Select a category"
|
|
1813
1828
|
}
|
|
1814
1829
|
},
|
|
1815
|
-
...
|
|
1830
|
+
...E("templateType")
|
|
1816
1831
|
}
|
|
1817
1832
|
) }),
|
|
1818
|
-
|
|
1819
|
-
|
|
1833
|
+
V && V.length > 0 && /* @__PURE__ */ t("div", { className: "ts-col", children: /* @__PURE__ */ t(
|
|
1834
|
+
ue,
|
|
1820
1835
|
{
|
|
1821
1836
|
label: "Type",
|
|
1822
1837
|
control: b,
|
|
1823
|
-
error:
|
|
1824
|
-
options:
|
|
1838
|
+
error: M,
|
|
1839
|
+
options: V,
|
|
1825
1840
|
required: !0,
|
|
1826
|
-
disabled:
|
|
1841
|
+
disabled: H || $ || w || !n,
|
|
1827
1842
|
validation: {
|
|
1828
1843
|
required: {
|
|
1829
1844
|
value: !0,
|
|
1830
1845
|
message: "Select a type"
|
|
1831
1846
|
}
|
|
1832
1847
|
},
|
|
1833
|
-
...
|
|
1848
|
+
...E("subTemplateType")
|
|
1834
1849
|
}
|
|
1835
1850
|
) }),
|
|
1836
|
-
|
|
1837
|
-
|
|
1851
|
+
G && G.length > 0 && /* @__PURE__ */ t("div", { className: "ts-col", children: /* @__PURE__ */ t(
|
|
1852
|
+
ue,
|
|
1838
1853
|
{
|
|
1839
1854
|
label: "Sub Type",
|
|
1840
1855
|
control: b,
|
|
1841
|
-
error:
|
|
1842
|
-
options:
|
|
1856
|
+
error: M,
|
|
1857
|
+
options: G,
|
|
1843
1858
|
required: !0,
|
|
1844
|
-
disabled:
|
|
1859
|
+
disabled: H || $ || w || !n,
|
|
1845
1860
|
validation: {
|
|
1846
1861
|
required: {
|
|
1847
1862
|
value: !0,
|
|
1848
1863
|
message: "Select a subtype"
|
|
1849
1864
|
}
|
|
1850
1865
|
},
|
|
1851
|
-
...
|
|
1866
|
+
...E("subTemplateType2")
|
|
1852
1867
|
}
|
|
1853
1868
|
) }),
|
|
1854
1869
|
/* @__PURE__ */ t("div", { className: "ts-col", children: /* @__PURE__ */ t(
|
|
1855
|
-
|
|
1870
|
+
ue,
|
|
1856
1871
|
{
|
|
1857
1872
|
label: "Template",
|
|
1858
1873
|
control: b,
|
|
1859
|
-
error:
|
|
1860
|
-
disabled:
|
|
1874
|
+
error: M,
|
|
1875
|
+
disabled: H || !H || $ || w || !n,
|
|
1861
1876
|
options: [],
|
|
1862
1877
|
required: !1,
|
|
1863
|
-
...
|
|
1878
|
+
...E("template")
|
|
1864
1879
|
}
|
|
1865
1880
|
) }),
|
|
1866
|
-
/* @__PURE__ */
|
|
1881
|
+
/* @__PURE__ */ c("div", { className: "ts-col ts-template-name-col", children: [
|
|
1867
1882
|
/* @__PURE__ */ t(
|
|
1868
|
-
|
|
1883
|
+
$e,
|
|
1869
1884
|
{
|
|
1870
1885
|
label: "Name",
|
|
1871
|
-
register:
|
|
1872
|
-
error:
|
|
1886
|
+
register: E,
|
|
1887
|
+
error: M,
|
|
1873
1888
|
required: !0,
|
|
1874
1889
|
name: "templateName",
|
|
1875
1890
|
validation: {
|
|
@@ -1880,50 +1895,65 @@ const Ae = /* @__PURE__ */ gt(vt), _e = (e) => e.data.isSeparator ? /* @__PURE__
|
|
|
1880
1895
|
}
|
|
1881
1896
|
}
|
|
1882
1897
|
),
|
|
1883
|
-
ge?.key?.toString() === "9" &&
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1898
|
+
ge?.key?.toString() === "9" && H && C?.is_favourite && // <button
|
|
1899
|
+
// type="button"
|
|
1900
|
+
// className="template-favourite-btn ts-btn-light"
|
|
1901
|
+
// disabled={
|
|
1902
|
+
// loading3 ||
|
|
1903
|
+
// loading5 ||
|
|
1904
|
+
// (selectedTemplateMeta
|
|
1905
|
+
// ? selectedTemplateMeta?.is_favourite
|
|
1906
|
+
// : false)
|
|
1907
|
+
// }
|
|
1908
|
+
// onClick={handlemarkFavourite}
|
|
1909
|
+
// >
|
|
1910
|
+
// {loading3 || loading5 ? (
|
|
1911
|
+
// <Loader size="sm" />
|
|
1912
|
+
// ) : selectedTemplateMeta ? (
|
|
1913
|
+
// selectedTemplateMeta?.is_favourite ? (
|
|
1914
|
+
// <StarIcon variant="filled" />
|
|
1915
|
+
// ) : (
|
|
1916
|
+
// <StarIcon variant="outlined" />
|
|
1917
|
+
// )
|
|
1918
|
+
// ) : (
|
|
1919
|
+
// <StarIcon variant="outlined" />
|
|
1920
|
+
// )}
|
|
1921
|
+
// </button>
|
|
1922
|
+
/* @__PURE__ */ t("span", { className: "ts-favourite-icon", children: /* @__PURE__ */ t(Ee, { variant: "filled" }) })
|
|
1893
1923
|
] }),
|
|
1894
1924
|
le?.key?.toString() === "12" && /* @__PURE__ */ t("div", { className: "ts-col", children: /* @__PURE__ */ t(
|
|
1895
|
-
|
|
1925
|
+
$e,
|
|
1896
1926
|
{
|
|
1897
1927
|
label: "Subject",
|
|
1898
|
-
register:
|
|
1899
|
-
error:
|
|
1928
|
+
register: E,
|
|
1929
|
+
error: M,
|
|
1900
1930
|
required: !1,
|
|
1901
1931
|
name: "subject"
|
|
1902
1932
|
}
|
|
1903
1933
|
) }),
|
|
1904
|
-
/* @__PURE__ */
|
|
1905
|
-
!
|
|
1934
|
+
/* @__PURE__ */ c("div", { className: "ts-col ts-actions btn-padding", children: [
|
|
1935
|
+
!H && /* @__PURE__ */ t(
|
|
1906
1936
|
"button",
|
|
1907
1937
|
{
|
|
1908
1938
|
type: "button",
|
|
1909
1939
|
className: "ts-btn ts-btn-primary",
|
|
1910
|
-
disabled:
|
|
1940
|
+
disabled: $ || w || !n,
|
|
1911
1941
|
onClick: () => {
|
|
1912
|
-
|
|
1942
|
+
k(void 0), v(), K([]), Z([]), e();
|
|
1913
1943
|
},
|
|
1914
|
-
children:
|
|
1944
|
+
children: $ || w ? /* @__PURE__ */ t(se, { size: "sm" }) : "Clear"
|
|
1915
1945
|
}
|
|
1916
1946
|
),
|
|
1917
|
-
(le?.key?.toString() !== "12" || (le?.key?.toString() === "12" && (
|
|
1947
|
+
(le?.key?.toString() !== "12" || (le?.key?.toString() === "12" && (C?.id ?? "")) !== "") && /* @__PURE__ */ t(
|
|
1918
1948
|
"button",
|
|
1919
1949
|
{
|
|
1920
1950
|
type: "button",
|
|
1921
1951
|
className: "ts-btn ts-btn-primary",
|
|
1922
|
-
disabled:
|
|
1952
|
+
disabled: $ || w || !n,
|
|
1923
1953
|
onClick: A(de),
|
|
1924
|
-
children:
|
|
1954
|
+
children: $ || w ? (
|
|
1925
1955
|
// <span className="ts-spinner" />
|
|
1926
|
-
/* @__PURE__ */ t(
|
|
1956
|
+
/* @__PURE__ */ t(se, { size: "sm" })
|
|
1927
1957
|
) : "Save"
|
|
1928
1958
|
}
|
|
1929
1959
|
)
|
|
@@ -1938,57 +1968,57 @@ const Ae = /* @__PURE__ */ gt(vt), _e = (e) => e.data.isSeparator ? /* @__PURE__
|
|
|
1938
1968
|
templateList: i,
|
|
1939
1969
|
editorInitialized: r,
|
|
1940
1970
|
previewHtml: l,
|
|
1941
|
-
onEditorInitialized:
|
|
1942
|
-
onClose:
|
|
1943
|
-
onRefresh:
|
|
1971
|
+
onEditorInitialized: o,
|
|
1972
|
+
onClose: d,
|
|
1973
|
+
onRefresh: y
|
|
1944
1974
|
}) => {
|
|
1945
|
-
const
|
|
1946
|
-
|
|
1947
|
-
e && r && window.StripoEditorApi?.actionsApi && (n === "add" ? window.StripoEditorApi.actionsApi.updateHtmlAndCss(
|
|
1948
|
-
s.html ??
|
|
1975
|
+
const m = J(null), [T, w] = N(!1);
|
|
1976
|
+
L(() => {
|
|
1977
|
+
e && r && window.StripoEditorApi?.actionsApi && (n === "add" ? window.StripoEditorApi.actionsApi.updateHtmlAndCss(pe, "", "") : n === "edit" && s && window.StripoEditorApi.actionsApi.updateHtmlAndCss(
|
|
1978
|
+
s.html ?? pe,
|
|
1949
1979
|
s.css ?? "",
|
|
1950
1980
|
""
|
|
1951
1981
|
));
|
|
1952
|
-
}, [e, r, n, s]),
|
|
1953
|
-
e ||
|
|
1982
|
+
}, [e, r, n, s]), L(() => {
|
|
1983
|
+
e || w(!1);
|
|
1954
1984
|
}, [e]);
|
|
1955
|
-
const
|
|
1956
|
-
window.StripoEditorApi.actionsApi.updateHtmlAndCss(
|
|
1985
|
+
const E = () => {
|
|
1986
|
+
window.StripoEditorApi.actionsApi.updateHtmlAndCss(pe, "", "");
|
|
1957
1987
|
};
|
|
1958
|
-
return e ? /* @__PURE__ */ t("div", { className: "ts-editor-modal-overlay", children: /* @__PURE__ */
|
|
1988
|
+
return e ? /* @__PURE__ */ t("div", { className: "ts-editor-modal-overlay", children: /* @__PURE__ */ c(
|
|
1959
1989
|
"div",
|
|
1960
1990
|
{
|
|
1961
|
-
className: `ts-editor-modal ${
|
|
1962
|
-
ref:
|
|
1991
|
+
className: `ts-editor-modal ${T ? "ts-editor-modal--fullscreen" : ""}`,
|
|
1992
|
+
ref: m,
|
|
1963
1993
|
children: [
|
|
1964
|
-
/* @__PURE__ */
|
|
1965
|
-
/* @__PURE__ */
|
|
1994
|
+
/* @__PURE__ */ c("div", { className: "ts-editor-modal-header", children: [
|
|
1995
|
+
/* @__PURE__ */ c("h3", { className: "ts-modal-title", children: [
|
|
1966
1996
|
n === "add" && "Create Template",
|
|
1967
1997
|
n === "edit" && "Edit Template",
|
|
1968
1998
|
n === "preview" && "Preview Template"
|
|
1969
1999
|
] }),
|
|
1970
|
-
/* @__PURE__ */
|
|
2000
|
+
/* @__PURE__ */ c("div", { className: "ts-editor-header-actions", children: [
|
|
1971
2001
|
/* @__PURE__ */ t(
|
|
1972
2002
|
"button",
|
|
1973
2003
|
{
|
|
1974
2004
|
className: "ts-editor-fullscreen-btn",
|
|
1975
|
-
onClick: () =>
|
|
2005
|
+
onClick: () => w((A) => !A),
|
|
1976
2006
|
"aria-label": "Toggle fullscreen",
|
|
1977
|
-
children:
|
|
2007
|
+
children: T ? "🗗" : "🗖"
|
|
1978
2008
|
}
|
|
1979
2009
|
),
|
|
1980
2010
|
/* @__PURE__ */ t(
|
|
1981
2011
|
"button",
|
|
1982
2012
|
{
|
|
1983
2013
|
className: "ts-editor-close-btn",
|
|
1984
|
-
onClick:
|
|
2014
|
+
onClick: d,
|
|
1985
2015
|
"aria-label": "Close editor",
|
|
1986
2016
|
children: "✕"
|
|
1987
2017
|
}
|
|
1988
2018
|
)
|
|
1989
2019
|
] })
|
|
1990
2020
|
] }),
|
|
1991
|
-
/* @__PURE__ */
|
|
2021
|
+
/* @__PURE__ */ c("div", { className: "ts-editor-modal-body", children: [
|
|
1992
2022
|
n !== "preview" && /* @__PURE__ */ t(
|
|
1993
2023
|
Ct,
|
|
1994
2024
|
{
|
|
@@ -1997,9 +2027,9 @@ const Ae = /* @__PURE__ */ gt(vt), _e = (e) => e.data.isSeparator ? /* @__PURE__
|
|
|
1997
2027
|
templateTypes: a,
|
|
1998
2028
|
templateList: i,
|
|
1999
2029
|
editorInitialized: r,
|
|
2000
|
-
onReset:
|
|
2001
|
-
onRefresh:
|
|
2002
|
-
closeEditorModal:
|
|
2030
|
+
onReset: E,
|
|
2031
|
+
onRefresh: y,
|
|
2032
|
+
closeEditorModal: d
|
|
2003
2033
|
}
|
|
2004
2034
|
),
|
|
2005
2035
|
n === "preview" ? /* @__PURE__ */ t("div", { className: "ts-template-preview", children: /* @__PURE__ */ t(
|
|
@@ -2010,9 +2040,9 @@ const Ae = /* @__PURE__ */ gt(vt), _e = (e) => e.data.isSeparator ? /* @__PURE__
|
|
|
2010
2040
|
srcDoc: l ?? ""
|
|
2011
2041
|
}
|
|
2012
2042
|
) }) : /* @__PURE__ */ t(
|
|
2013
|
-
|
|
2043
|
+
ht,
|
|
2014
2044
|
{
|
|
2015
|
-
onEditorInitialized:
|
|
2045
|
+
onEditorInitialized: o,
|
|
2016
2046
|
loading: !1,
|
|
2017
2047
|
className: "editor-container"
|
|
2018
2048
|
}
|
|
@@ -2027,55 +2057,55 @@ const Ae = /* @__PURE__ */ gt(vt), _e = (e) => e.data.isSeparator ? /* @__PURE__
|
|
|
2027
2057
|
isLoading: n,
|
|
2028
2058
|
isFetching: s,
|
|
2029
2059
|
refetch: a
|
|
2030
|
-
} =
|
|
2060
|
+
} = et(), {
|
|
2031
2061
|
data: i,
|
|
2032
2062
|
isLoading: r,
|
|
2033
2063
|
isFetching: l
|
|
2034
|
-
} =
|
|
2035
|
-
|
|
2036
|
-
},
|
|
2037
|
-
const
|
|
2038
|
-
|
|
2039
|
-
},
|
|
2064
|
+
} = tt(), { mutateAsync: o, isPending: d } = nt(), [y, m] = N(!1), [T, w] = N("add"), [E, A] = N(!1), [h, g] = N(""), [b, p] = N(), v = () => {
|
|
2065
|
+
w("add"), m(!0);
|
|
2066
|
+
}, O = async (C) => {
|
|
2067
|
+
const k = await o({ id: C.id });
|
|
2068
|
+
p({ ...k }), w("edit"), m(!0);
|
|
2069
|
+
}, M = (C) => {
|
|
2040
2070
|
if (!e || e.length === 0) return;
|
|
2041
|
-
const
|
|
2042
|
-
|
|
2043
|
-
},
|
|
2044
|
-
|
|
2071
|
+
const k = e.find((x) => x.id === C.id);
|
|
2072
|
+
g(k?.html ?? ""), w("preview"), m(!0);
|
|
2073
|
+
}, P = () => {
|
|
2074
|
+
m(!1), A(!1), document.getElementById("UiEditorScript")?.remove();
|
|
2045
2075
|
};
|
|
2046
|
-
return /* @__PURE__ */
|
|
2047
|
-
(n || r || s || l ||
|
|
2076
|
+
return /* @__PURE__ */ c(fe, { children: [
|
|
2077
|
+
(n || r || s || l || d) && /* @__PURE__ */ t(se, { overlay: !0 }),
|
|
2048
2078
|
/* @__PURE__ */ t(
|
|
2049
|
-
|
|
2079
|
+
mt,
|
|
2050
2080
|
{
|
|
2051
2081
|
templates: e ?? [],
|
|
2052
2082
|
templateTypes: i ?? [],
|
|
2053
2083
|
onRefresh: a,
|
|
2054
2084
|
onAdd: v,
|
|
2055
|
-
onEdit:
|
|
2056
|
-
onPreview:
|
|
2085
|
+
onEdit: O,
|
|
2086
|
+
onPreview: M
|
|
2057
2087
|
}
|
|
2058
2088
|
),
|
|
2059
2089
|
/* @__PURE__ */ t(
|
|
2060
2090
|
xt,
|
|
2061
2091
|
{
|
|
2062
|
-
show:
|
|
2063
|
-
mode:
|
|
2092
|
+
show: y,
|
|
2093
|
+
mode: T,
|
|
2064
2094
|
template: b,
|
|
2065
2095
|
templateTypes: i ?? [],
|
|
2066
2096
|
templateList: e ?? [],
|
|
2067
|
-
editorInitialized:
|
|
2097
|
+
editorInitialized: E,
|
|
2068
2098
|
onEditorInitialized: A,
|
|
2069
|
-
onClose:
|
|
2099
|
+
onClose: P,
|
|
2070
2100
|
onSaved: () => {
|
|
2071
|
-
|
|
2101
|
+
P(), a();
|
|
2072
2102
|
},
|
|
2073
2103
|
onRefresh: a,
|
|
2074
2104
|
previewHtml: h
|
|
2075
2105
|
}
|
|
2076
2106
|
)
|
|
2077
2107
|
] });
|
|
2078
|
-
}, _t = ({ config: e }) => /* @__PURE__ */ t(
|
|
2108
|
+
}, _t = ({ config: e }) => /* @__PURE__ */ t(ze, { configs: e, children: /* @__PURE__ */ t(Ze, { children: /* @__PURE__ */ t(Ye, { children: /* @__PURE__ */ t("div", { className: "root-widget", children: /* @__PURE__ */ t(Et, {}) }) }) }) });
|
|
2079
2109
|
export {
|
|
2080
2110
|
_t as EditorWidget
|
|
2081
2111
|
};
|