@devtable/settings-form 8.51.2 → 8.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/settings-form.es.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import * as K from "/Users/leto/Merico/merico-dev/table/node_modules/react/jsx-runtime.js";
|
|
2
|
-
import { Box as v, TextInput as z, Divider as V, Group as w, NumberInput as ie, PasswordInput as L, Button as b, Modal as
|
|
2
|
+
import { Box as v, TextInput as z, Divider as V, Group as w, NumberInput as ie, PasswordInput as L, Button as b, Modal as O, Stack as B, Alert as oe, SegmentedControl as ae, useMantineTheme as se, Tooltip as ce, Text as I, LoadingOverlay as H, Table as $, Select as le, Switch as de } from "@mantine/core";
|
|
3
3
|
import { showNotification as _, updateNotification as S } from "@mantine/notifications";
|
|
4
4
|
import * as x from "react";
|
|
5
5
|
import F, { useEffect as G, forwardRef as J, useState as Z, useMemo as ee } from "react";
|
|
6
|
-
import { Recycle as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { useForm as
|
|
11
|
-
import { useBoolean as
|
|
12
|
-
import
|
|
13
|
-
import { useModals as
|
|
6
|
+
import { Recycle as ue, AlertCircle as pe, PlaylistAdd as Q, Trash as W, Edit as ge } from "tabler-icons-react";
|
|
7
|
+
import me from "axios";
|
|
8
|
+
import he from "crypto-js";
|
|
9
|
+
import fe from "lodash";
|
|
10
|
+
import { useForm as q, Controller as m } from "react-hook-form";
|
|
11
|
+
import { useBoolean as be, useRequest as T } from "ahooks";
|
|
12
|
+
import we, { loader as U } from "@monaco-editor/react";
|
|
13
|
+
import { useModals as E, closeAllModals as Se } from "@mantine/modals";
|
|
14
14
|
const C = K.Fragment, e = K.jsx, d = K.jsxs;
|
|
15
|
-
function
|
|
15
|
+
function ze(t) {
|
|
16
16
|
t = t || {};
|
|
17
17
|
const n = Object.keys(t).sort(), r = [];
|
|
18
18
|
for (let i = 0; i < n.length; i++) {
|
|
@@ -29,9 +29,9 @@ function we(t) {
|
|
|
29
29
|
}
|
|
30
30
|
return r.sort().join("&");
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
let r =
|
|
34
|
-
return r += "&key=" + n,
|
|
32
|
+
function Pe(t, n) {
|
|
33
|
+
let r = ze(t);
|
|
34
|
+
return r += "&key=" + n, he.MD5(r).toString().toUpperCase();
|
|
35
35
|
}
|
|
36
36
|
const f = {
|
|
37
37
|
baseURL: "http://localhost:31200",
|
|
@@ -44,7 +44,7 @@ const f = {
|
|
|
44
44
|
return {
|
|
45
45
|
app_id: this.app_id,
|
|
46
46
|
nonce_str: n,
|
|
47
|
-
sign:
|
|
47
|
+
sign: Pe({
|
|
48
48
|
app_id: this.app_id,
|
|
49
49
|
nonce_str: n,
|
|
50
50
|
...t
|
|
@@ -65,14 +65,14 @@ const f = {
|
|
|
65
65
|
params: t === "GET" ? r : i.params,
|
|
66
66
|
headers: o
|
|
67
67
|
};
|
|
68
|
-
return ["POST", "PUT"].includes(t) && (a.data = i.string ? JSON.stringify(r) : r, a.data.authentication = this.getAuthentication(a.data)),
|
|
68
|
+
return ["POST", "PUT"].includes(t) && (a.data = i.string ? JSON.stringify(r) : r, a.data.authentication = this.getAuthentication(a.data)), me(a).then((c) => c.data).catch((c) => fe.has(c, "response.data.detail.message") ? Promise.reject(new Error(c.response.data.detail.message)) : Promise.reject(c));
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
-
function
|
|
72
|
+
function j(t) {
|
|
73
73
|
f.baseURL !== t.apiBaseURL && (f.baseURL = t.apiBaseURL), t.app_id && (f.app_id = t.app_id), t.app_secret && (f.app_secret = t.app_secret);
|
|
74
74
|
}
|
|
75
|
-
const
|
|
75
|
+
const ve = {
|
|
76
76
|
login: async (t, n) => {
|
|
77
77
|
const r = {
|
|
78
78
|
name: t,
|
|
@@ -128,7 +128,7 @@ const ze = {
|
|
|
128
128
|
id: t
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
|
-
},
|
|
131
|
+
}, Ae = {
|
|
132
132
|
list: async () => await f.getRequest("POST")("/api/key/list", {
|
|
133
133
|
filter: {
|
|
134
134
|
search: ""
|
|
@@ -152,7 +152,7 @@ const ze = {
|
|
|
152
152
|
id: t
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
|
-
},
|
|
155
|
+
}, Ce = {
|
|
156
156
|
list: async () => await f.getRequest("POST")("/datasource/list", {
|
|
157
157
|
filter: {},
|
|
158
158
|
sort: [{
|
|
@@ -174,30 +174,30 @@ const ze = {
|
|
|
174
174
|
id: t
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
|
-
},
|
|
177
|
+
}, _e = {
|
|
178
178
|
list: async () => await f.getRequest("GET")("/role/list", {})
|
|
179
179
|
}, P = {
|
|
180
|
-
datasource:
|
|
181
|
-
account:
|
|
182
|
-
role:
|
|
183
|
-
api_key:
|
|
184
|
-
},
|
|
180
|
+
datasource: Ce,
|
|
181
|
+
account: ve,
|
|
182
|
+
role: _e,
|
|
183
|
+
api_key: Ae
|
|
184
|
+
}, D = {
|
|
185
185
|
size: "sm",
|
|
186
186
|
spacing: "md",
|
|
187
187
|
button: {
|
|
188
188
|
size: "xs"
|
|
189
189
|
}
|
|
190
190
|
};
|
|
191
|
-
function
|
|
191
|
+
function ye({
|
|
192
192
|
submit: t,
|
|
193
|
-
styles: n =
|
|
193
|
+
styles: n = D,
|
|
194
194
|
type: r
|
|
195
195
|
}) {
|
|
196
196
|
const {
|
|
197
197
|
control: i,
|
|
198
198
|
setValue: s,
|
|
199
199
|
handleSubmit: o
|
|
200
|
-
} =
|
|
200
|
+
} = q({
|
|
201
201
|
defaultValues: {
|
|
202
202
|
type: r,
|
|
203
203
|
key: "",
|
|
@@ -241,12 +241,12 @@ function Ce({
|
|
|
241
241
|
/* @__PURE__ */ e(w, { position: "right", mt: n.spacing, children: /* @__PURE__ */ e(b, { type: "submit", size: n.button.size, children: "Save" }) })
|
|
242
242
|
] }) });
|
|
243
243
|
}
|
|
244
|
-
const
|
|
244
|
+
const ke = ({
|
|
245
245
|
value: t,
|
|
246
246
|
onChange: n
|
|
247
247
|
}) => /* @__PURE__ */ e(v, { sx: {
|
|
248
248
|
position: "relative"
|
|
249
|
-
}, children: /* @__PURE__ */ e(
|
|
249
|
+
}, children: /* @__PURE__ */ e(we, { height: "500px", defaultLanguage: "javascript", value: t, onChange: (i) => {
|
|
250
250
|
i && n(i);
|
|
251
251
|
}, theme: "vs-dark", options: {
|
|
252
252
|
minimap: {
|
|
@@ -263,7 +263,7 @@ const _e = ({
|
|
|
263
263
|
const [c, {
|
|
264
264
|
setTrue: u,
|
|
265
265
|
setFalse: g
|
|
266
|
-
}] =
|
|
266
|
+
}] = be(), [l, p] = Z(t), h = () => {
|
|
267
267
|
g(), n(l);
|
|
268
268
|
}, A = () => {
|
|
269
269
|
g(), p(t);
|
|
@@ -276,10 +276,10 @@ const _e = ({
|
|
|
276
276
|
/* @__PURE__ */ e(b, { variant: "filled", size: o.button.size, onClick: u, sx: {
|
|
277
277
|
flexGrow: 1
|
|
278
278
|
}, children: r }),
|
|
279
|
-
/* @__PURE__ */ e(
|
|
280
|
-
/* @__PURE__ */ e(
|
|
279
|
+
/* @__PURE__ */ e(O, { size: 800, title: i, opened: c, onClose: g, closeOnClickOutside: !1, withCloseButton: !1, children: c && /* @__PURE__ */ d(B, { children: [
|
|
280
|
+
/* @__PURE__ */ e(ke, { value: l, onChange: p }),
|
|
281
281
|
/* @__PURE__ */ d(w, { position: "apart", children: [
|
|
282
|
-
/* @__PURE__ */ e(b, { onClick: k, color: "red", leftIcon: /* @__PURE__ */ e(
|
|
282
|
+
/* @__PURE__ */ e(b, { onClick: k, color: "red", leftIcon: /* @__PURE__ */ e(ue, { size: 20 }), children: "Rest" }),
|
|
283
283
|
/* @__PURE__ */ d(w, { position: "right", children: [
|
|
284
284
|
/* @__PURE__ */ e(b, { onClick: A, variant: "subtle", children: "Cancel" }),
|
|
285
285
|
/* @__PURE__ */ e(b, { onClick: h, children: "OK" })
|
|
@@ -287,29 +287,29 @@ const _e = ({
|
|
|
287
287
|
] })
|
|
288
288
|
] }) })
|
|
289
289
|
] });
|
|
290
|
-
}),
|
|
290
|
+
}), R = {
|
|
291
291
|
pre: ["function pre_process({ method, url, params, headers, data }, utils) {", " // your code goes here", " return { method, url, params, headers, data }", "}"].join(`
|
|
292
292
|
`),
|
|
293
293
|
post: ["function post_process(res, utils) {", " // your code goes here", " return data", "}"].join(`
|
|
294
294
|
`)
|
|
295
295
|
};
|
|
296
|
-
function
|
|
296
|
+
function De({
|
|
297
297
|
submit: t,
|
|
298
|
-
styles: n =
|
|
298
|
+
styles: n = D
|
|
299
299
|
}) {
|
|
300
300
|
const {
|
|
301
301
|
control: r,
|
|
302
302
|
setValue: i,
|
|
303
303
|
handleSubmit: s
|
|
304
|
-
} =
|
|
304
|
+
} = q({
|
|
305
305
|
defaultValues: {
|
|
306
306
|
type: "http",
|
|
307
307
|
key: "",
|
|
308
308
|
config: {
|
|
309
309
|
host: "",
|
|
310
310
|
processing: {
|
|
311
|
-
pre:
|
|
312
|
-
post:
|
|
311
|
+
pre: R.pre,
|
|
312
|
+
post: R.post
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
}
|
|
@@ -327,17 +327,26 @@ function ye({
|
|
|
327
327
|
/* @__PURE__ */ d(w, { grow: !0, children: [
|
|
328
328
|
/* @__PURE__ */ e(m, { name: "config.processing.pre", control: r, render: ({
|
|
329
329
|
field: o
|
|
330
|
-
}) => /* @__PURE__ */ e(Y, { label: "Pre Processing", modalTitle: "This function will run before sending the request (for scenarios like encryption)", defaultValue:
|
|
330
|
+
}) => /* @__PURE__ */ e(Y, { label: "Pre Processing", modalTitle: "This function will run before sending the request (for scenarios like encryption)", defaultValue: R.pre, ...o, styles: n }) }),
|
|
331
331
|
/* @__PURE__ */ e(m, { name: "config.processing.post", control: r, render: ({
|
|
332
332
|
field: o
|
|
333
|
-
}) => /* @__PURE__ */ e(Y, { label: "Post Processing", modalTitle: "This function will run after sending the request (for scenarios like decryption)", defaultValue:
|
|
333
|
+
}) => /* @__PURE__ */ e(Y, { label: "Post Processing", modalTitle: "This function will run after sending the request (for scenarios like decryption)", defaultValue: R.post, ...o, styles: n }) })
|
|
334
334
|
] }),
|
|
335
335
|
/* @__PURE__ */ e(w, { position: "right", mt: n.spacing, children: /* @__PURE__ */ e(b, { type: "submit", size: n.button.size, children: "Save" }) })
|
|
336
336
|
] }) });
|
|
337
337
|
}
|
|
338
|
-
function
|
|
338
|
+
function Te({
|
|
339
|
+
styles: t = D
|
|
340
|
+
}) {
|
|
341
|
+
return /* @__PURE__ */ e(v, { mx: "auto", children: /* @__PURE__ */ d(oe, { mt: t.spacing, icon: /* @__PURE__ */ e(pe, { size: 16 }), children: [
|
|
342
|
+
"Only ",
|
|
343
|
+
/* @__PURE__ */ e("b", { children: "SELECT" }),
|
|
344
|
+
" privilege is needed."
|
|
345
|
+
] }) });
|
|
346
|
+
}
|
|
347
|
+
function qe({
|
|
339
348
|
postSubmit: t,
|
|
340
|
-
styles: n =
|
|
349
|
+
styles: n = D
|
|
341
350
|
}) {
|
|
342
351
|
const [r, i] = Z("postgresql"), s = async ({
|
|
343
352
|
type: c,
|
|
@@ -371,7 +380,7 @@ function ke({
|
|
|
371
380
|
}
|
|
372
381
|
}, o = r === "postgresql" || r === "mysql", a = r === "http";
|
|
373
382
|
return /* @__PURE__ */ d(v, { mx: "auto", children: [
|
|
374
|
-
/* @__PURE__ */ e(
|
|
383
|
+
/* @__PURE__ */ e(ae, { fullWidth: !0, mb: n.spacing, size: n.size, data: [{
|
|
375
384
|
label: "PostgreSQL",
|
|
376
385
|
value: "postgresql"
|
|
377
386
|
}, {
|
|
@@ -381,31 +390,32 @@ function ke({
|
|
|
381
390
|
label: "HTTP",
|
|
382
391
|
value: "http"
|
|
383
392
|
}], value: r, onChange: (c) => i(c) }),
|
|
384
|
-
o && /* @__PURE__ */ e(
|
|
385
|
-
|
|
393
|
+
o && /* @__PURE__ */ e(Te, { styles: n }),
|
|
394
|
+
o && /* @__PURE__ */ e(ye, { submit: s, styles: n, type: r }),
|
|
395
|
+
a && /* @__PURE__ */ e(De, { submit: s, styles: n })
|
|
386
396
|
] });
|
|
387
397
|
}
|
|
388
|
-
function
|
|
398
|
+
function xe({
|
|
389
399
|
onSuccess: t,
|
|
390
|
-
styles: n =
|
|
400
|
+
styles: n = D
|
|
391
401
|
}) {
|
|
392
402
|
const [r, i] = F.useState(!1), s = () => i(!0), o = () => i(!1);
|
|
393
403
|
return /* @__PURE__ */ d(C, { children: [
|
|
394
|
-
/* @__PURE__ */ e(
|
|
404
|
+
/* @__PURE__ */ e(O, { overflow: "inside", opened: r, onClose: () => i(!1), title: "Add a data source", trapFocus: !0, onDragStart: (c) => {
|
|
395
405
|
c.stopPropagation();
|
|
396
|
-
}, children: /* @__PURE__ */ e(
|
|
406
|
+
}, children: /* @__PURE__ */ e(qe, { postSubmit: () => {
|
|
397
407
|
t(), o();
|
|
398
408
|
}, styles: n }) }),
|
|
399
409
|
/* @__PURE__ */ e(b, { size: n.button.size, onClick: s, leftIcon: /* @__PURE__ */ e(Q, { size: 20 }), children: "Add a Data Source" })
|
|
400
410
|
] });
|
|
401
411
|
}
|
|
402
|
-
const
|
|
403
|
-
function
|
|
412
|
+
const Oe = (t) => t.replace(/([^:])(\/\/+)/g, "$1/");
|
|
413
|
+
function Re(t) {
|
|
404
414
|
G(() => {
|
|
405
415
|
if (U.__getMonacoInstance())
|
|
406
416
|
return;
|
|
407
417
|
console.log("loading monaco for @devtable/settings-form");
|
|
408
|
-
const r =
|
|
418
|
+
const r = Oe(t);
|
|
409
419
|
U.config({
|
|
410
420
|
paths: {
|
|
411
421
|
vs: r
|
|
@@ -423,7 +433,7 @@ function N() {
|
|
|
423
433
|
return t;
|
|
424
434
|
}, N.apply(this, arguments);
|
|
425
435
|
}
|
|
426
|
-
function
|
|
436
|
+
function Ie(t, n) {
|
|
427
437
|
if (t == null)
|
|
428
438
|
return {};
|
|
429
439
|
var r, i, s = function(a, c) {
|
|
@@ -441,19 +451,19 @@ function xe(t, n) {
|
|
|
441
451
|
}
|
|
442
452
|
return s;
|
|
443
453
|
}
|
|
444
|
-
var
|
|
445
|
-
function
|
|
446
|
-
var n = t.size, r = n === void 0 ? 24 : n, i = t.color, s = i === void 0 ? "currentColor" : i, o = t.stroke, a = o === void 0 ? 2 : o, c =
|
|
454
|
+
var Le = ["size", "color", "stroke"];
|
|
455
|
+
function Fe(t) {
|
|
456
|
+
var n = t.size, r = n === void 0 ? 24 : n, i = t.color, s = i === void 0 ? "currentColor" : i, o = t.stroke, a = o === void 0 ? 2 : o, c = Ie(t, Le);
|
|
447
457
|
return x.createElement("svg", N({ xmlns: "http://www.w3.org/2000/svg", className: "icon icon-tabler icon-tabler-lock", width: r, height: r, viewBox: "0 0 24 24", strokeWidth: a, stroke: s, fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, c), x.createElement("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), x.createElement("rect", { x: 5, y: 11, width: 14, height: 10, rx: 2 }), x.createElement("circle", { cx: 12, cy: 16, r: 1 }), x.createElement("path", { d: "M8 11v-4a4 4 0 0 1 8 0v4" }));
|
|
448
458
|
}
|
|
449
|
-
function
|
|
459
|
+
function Ee({
|
|
450
460
|
id: t,
|
|
451
461
|
name: n,
|
|
452
462
|
isProtected: r,
|
|
453
463
|
onSuccess: i,
|
|
454
|
-
styles: s =
|
|
464
|
+
styles: s = D
|
|
455
465
|
}) {
|
|
456
|
-
const o =
|
|
466
|
+
const o = E(), a = async () => {
|
|
457
467
|
t && (_({
|
|
458
468
|
id: "for-deleting",
|
|
459
469
|
title: "Pending",
|
|
@@ -474,23 +484,23 @@ function Ie({
|
|
|
474
484
|
},
|
|
475
485
|
onCancel: () => console.log("Cancel"),
|
|
476
486
|
onConfirm: a
|
|
477
|
-
}), u =
|
|
478
|
-
return r ? /* @__PURE__ */ e(
|
|
487
|
+
}), u = se();
|
|
488
|
+
return r ? /* @__PURE__ */ e(ce, { withArrow: !0, events: {
|
|
479
489
|
hover: !0,
|
|
480
490
|
touch: !1,
|
|
481
491
|
focus: !1
|
|
482
|
-
}, label: "This is a preset datasource, it can not be deleted", children: /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
|
|
492
|
+
}, label: "This is a preset datasource, it can not be deleted", children: /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(Fe, { size: 16, color: u.colors.gray[7] }) }) }) : /* @__PURE__ */ e(b, { size: s.button.size, color: "red", onClick: c, leftIcon: /* @__PURE__ */ e(W, { size: 20 }), children: "Delete" });
|
|
483
493
|
}
|
|
484
|
-
function
|
|
485
|
-
styles: t =
|
|
494
|
+
function ot({
|
|
495
|
+
styles: t = D,
|
|
486
496
|
config: n
|
|
487
497
|
}) {
|
|
488
|
-
|
|
498
|
+
Re(n.monacoPath), j(n);
|
|
489
499
|
const {
|
|
490
500
|
data: r = [],
|
|
491
501
|
loading: i,
|
|
492
502
|
refresh: s
|
|
493
|
-
} =
|
|
503
|
+
} = T(async () => {
|
|
494
504
|
const {
|
|
495
505
|
data: o
|
|
496
506
|
} = await P.datasource.list();
|
|
@@ -499,7 +509,7 @@ function nt({
|
|
|
499
509
|
refreshDeps: []
|
|
500
510
|
});
|
|
501
511
|
return /* @__PURE__ */ d(C, { children: [
|
|
502
|
-
/* @__PURE__ */ e(w, { pt: t.spacing, position: "right", children: /* @__PURE__ */ e(
|
|
512
|
+
/* @__PURE__ */ e(w, { pt: t.spacing, position: "right", children: /* @__PURE__ */ e(xe, { onSuccess: s }) }),
|
|
503
513
|
/* @__PURE__ */ d(v, { mt: t.spacing, sx: {
|
|
504
514
|
position: "relative"
|
|
505
515
|
}, children: [
|
|
@@ -518,13 +528,13 @@ function nt({
|
|
|
518
528
|
}) => /* @__PURE__ */ d("tr", { children: [
|
|
519
529
|
/* @__PURE__ */ e("td", { width: 200, children: c }),
|
|
520
530
|
/* @__PURE__ */ e("td", { children: a }),
|
|
521
|
-
/* @__PURE__ */ e("td", { width: 200, children: /* @__PURE__ */ e(w, { position: "left", children: /* @__PURE__ */ e(
|
|
531
|
+
/* @__PURE__ */ e("td", { width: 200, children: /* @__PURE__ */ e(w, { position: "left", children: /* @__PURE__ */ e(Ee, { isProtected: u, id: o, name: a, onSuccess: s }) }) })
|
|
522
532
|
] }, a)) })
|
|
523
533
|
] })
|
|
524
534
|
] })
|
|
525
535
|
] });
|
|
526
536
|
}
|
|
527
|
-
const
|
|
537
|
+
const je = J(({
|
|
528
538
|
label: t,
|
|
529
539
|
value: n,
|
|
530
540
|
description: r,
|
|
@@ -540,7 +550,7 @@ const Le = J(({
|
|
|
540
550
|
const {
|
|
541
551
|
data: s = [],
|
|
542
552
|
loading: o
|
|
543
|
-
} =
|
|
553
|
+
} = T(async () => (await P.role.list()).map((c) => ({
|
|
544
554
|
label: c.name,
|
|
545
555
|
value: c.id,
|
|
546
556
|
description: c.description,
|
|
@@ -550,14 +560,14 @@ const Le = J(({
|
|
|
550
560
|
refreshDeps: []
|
|
551
561
|
});
|
|
552
562
|
return /* @__PURE__ */ e(
|
|
553
|
-
|
|
563
|
+
le,
|
|
554
564
|
{
|
|
555
565
|
ref: i,
|
|
556
566
|
mb: t.spacing,
|
|
557
567
|
size: t.size,
|
|
558
568
|
required: !0,
|
|
559
569
|
label: "Role",
|
|
560
|
-
itemComponent:
|
|
570
|
+
itemComponent: je,
|
|
561
571
|
data: s,
|
|
562
572
|
disabled: o,
|
|
563
573
|
styles: () => ({
|
|
@@ -582,7 +592,7 @@ const Le = J(({
|
|
|
582
592
|
size: "xs"
|
|
583
593
|
}
|
|
584
594
|
};
|
|
585
|
-
function
|
|
595
|
+
function Me({
|
|
586
596
|
postSubmit: t,
|
|
587
597
|
styles: n = y,
|
|
588
598
|
initialRoleID: r
|
|
@@ -590,7 +600,7 @@ function Fe({
|
|
|
590
600
|
const {
|
|
591
601
|
control: i,
|
|
592
602
|
handleSubmit: s
|
|
593
|
-
} =
|
|
603
|
+
} = q({
|
|
594
604
|
defaultValues: {
|
|
595
605
|
name: "",
|
|
596
606
|
email: "",
|
|
@@ -640,28 +650,28 @@ function Fe({
|
|
|
640
650
|
/* @__PURE__ */ e(w, { position: "right", mt: n.spacing, children: /* @__PURE__ */ e(b, { type: "submit", size: n.button.size, children: "Save" }) })
|
|
641
651
|
] }) });
|
|
642
652
|
}
|
|
643
|
-
function
|
|
653
|
+
function Ue({
|
|
644
654
|
onSuccess: t,
|
|
645
655
|
styles: n = y,
|
|
646
656
|
initialRoleID: r
|
|
647
657
|
}) {
|
|
648
658
|
const [i, s] = F.useState(!1), o = () => s(!0), a = () => s(!1);
|
|
649
659
|
return /* @__PURE__ */ d(C, { children: [
|
|
650
|
-
/* @__PURE__ */ e(
|
|
660
|
+
/* @__PURE__ */ e(O, { overflow: "inside", opened: i, onClose: () => s(!1), title: "Add an Account", trapFocus: !0, onDragStart: (u) => {
|
|
651
661
|
u.stopPropagation();
|
|
652
|
-
}, children: /* @__PURE__ */ e(
|
|
662
|
+
}, children: /* @__PURE__ */ e(Me, { postSubmit: () => {
|
|
653
663
|
t(), a();
|
|
654
664
|
}, styles: n, initialRoleID: r }) }),
|
|
655
665
|
/* @__PURE__ */ e(b, { size: n.button.size, onClick: o, leftIcon: /* @__PURE__ */ e(Q, { size: 20 }), children: "Add an Account" })
|
|
656
666
|
] });
|
|
657
667
|
}
|
|
658
|
-
function
|
|
668
|
+
function Ne({
|
|
659
669
|
id: t,
|
|
660
670
|
name: n,
|
|
661
671
|
onSuccess: r,
|
|
662
672
|
styles: i = y
|
|
663
673
|
}) {
|
|
664
|
-
const s =
|
|
674
|
+
const s = E(), o = async () => {
|
|
665
675
|
if (t) {
|
|
666
676
|
_({
|
|
667
677
|
id: "for-deleting",
|
|
@@ -696,7 +706,7 @@ function Ee({
|
|
|
696
706
|
});
|
|
697
707
|
return /* @__PURE__ */ e(b, { size: i.button.size, color: "red", onClick: a, leftIcon: /* @__PURE__ */ e(W, { size: 20 }), children: "Delete" });
|
|
698
708
|
}
|
|
699
|
-
function
|
|
709
|
+
function Ke({
|
|
700
710
|
id: t,
|
|
701
711
|
name: n,
|
|
702
712
|
email: r,
|
|
@@ -708,7 +718,7 @@ function Me({
|
|
|
708
718
|
control: a,
|
|
709
719
|
handleSubmit: c,
|
|
710
720
|
watch: u
|
|
711
|
-
} =
|
|
721
|
+
} = q({
|
|
712
722
|
defaultValues: {
|
|
713
723
|
name: n,
|
|
714
724
|
email: r,
|
|
@@ -764,7 +774,7 @@ function Me({
|
|
|
764
774
|
/* @__PURE__ */ e(V, { my: 20, variant: "dashed", label: "", labelPosition: "center" }),
|
|
765
775
|
/* @__PURE__ */ e(m, { name: "reset_password", control: a, render: ({
|
|
766
776
|
field: h
|
|
767
|
-
}) => /* @__PURE__ */ e(
|
|
777
|
+
}) => /* @__PURE__ */ e(de, { mb: o.spacing, size: o.size, label: "Reset password", checked: h.value, onChange: (A) => h.onChange(A.currentTarget.checked), styles: {
|
|
768
778
|
label: {
|
|
769
779
|
verticalAlign: "middle"
|
|
770
780
|
}
|
|
@@ -782,7 +792,7 @@ function Me({
|
|
|
782
792
|
/* @__PURE__ */ e(w, { position: "right", mt: o.spacing, children: /* @__PURE__ */ e(b, { type: "submit", size: o.button.size, children: "Submit" }) })
|
|
783
793
|
] }) });
|
|
784
794
|
}
|
|
785
|
-
function
|
|
795
|
+
function Ve({
|
|
786
796
|
account: t,
|
|
787
797
|
onSuccess: n,
|
|
788
798
|
styles: r = y
|
|
@@ -791,23 +801,23 @@ function Ue({
|
|
|
791
801
|
n(), a();
|
|
792
802
|
};
|
|
793
803
|
return /* @__PURE__ */ d(C, { children: [
|
|
794
|
-
/* @__PURE__ */ e(
|
|
804
|
+
/* @__PURE__ */ e(O, { overflow: "inside", opened: i, onClose: () => s(!1), title: `Editing ${t.name}`, trapFocus: !0, onDragStart: (u) => {
|
|
795
805
|
u.stopPropagation();
|
|
796
|
-
}, children: /* @__PURE__ */ e(
|
|
797
|
-
/* @__PURE__ */ e(b, { size: r.button.size, onClick: o, leftIcon: /* @__PURE__ */ e(
|
|
806
|
+
}, children: /* @__PURE__ */ e(Ke, { ...t, postSubmit: c, styles: r }) }),
|
|
807
|
+
/* @__PURE__ */ e(b, { size: r.button.size, onClick: o, leftIcon: /* @__PURE__ */ e(ge, { size: 20 }), children: "Edit" })
|
|
798
808
|
] });
|
|
799
809
|
}
|
|
800
|
-
function
|
|
810
|
+
function at({
|
|
801
811
|
styles: t = y,
|
|
802
812
|
config: n
|
|
803
813
|
}) {
|
|
804
814
|
var g;
|
|
805
|
-
|
|
815
|
+
j(n);
|
|
806
816
|
const {
|
|
807
817
|
data: r = [],
|
|
808
818
|
loading: i,
|
|
809
819
|
refresh: s
|
|
810
|
-
} =
|
|
820
|
+
} = T(async () => {
|
|
811
821
|
const {
|
|
812
822
|
data: l
|
|
813
823
|
} = await P.account.list();
|
|
@@ -817,7 +827,7 @@ function rt({
|
|
|
817
827
|
}), {
|
|
818
828
|
data: o = [],
|
|
819
829
|
loading: a
|
|
820
|
-
} =
|
|
830
|
+
} = T(async () => (await P.role.list()).map((p) => ({
|
|
821
831
|
label: p.name,
|
|
822
832
|
value: p.id,
|
|
823
833
|
description: p.description,
|
|
@@ -827,7 +837,7 @@ function rt({
|
|
|
827
837
|
refreshDeps: []
|
|
828
838
|
}), c = ee(() => o.reduce((l, p) => (l.set(p.value, p.label), l), /* @__PURE__ */ new Map()), [o]), u = (l) => c.get(l) ?? l;
|
|
829
839
|
return /* @__PURE__ */ d(C, { children: [
|
|
830
|
-
/* @__PURE__ */ e(w, { pt: t.spacing, position: "right", children: /* @__PURE__ */ e(
|
|
840
|
+
/* @__PURE__ */ e(w, { pt: t.spacing, position: "right", children: /* @__PURE__ */ e(Ue, { onSuccess: s, initialRoleID: ((g = o == null ? void 0 : o[0]) == null ? void 0 : g.value) ?? 0 }) }),
|
|
831
841
|
/* @__PURE__ */ d(v, { mt: t.spacing, sx: {
|
|
832
842
|
position: "relative"
|
|
833
843
|
}, children: [
|
|
@@ -851,8 +861,8 @@ function rt({
|
|
|
851
861
|
/* @__PURE__ */ e("td", { width: 200, children: A }),
|
|
852
862
|
/* @__PURE__ */ e("td", { width: 200, children: u(k) }),
|
|
853
863
|
/* @__PURE__ */ e("td", { width: 200, children: /* @__PURE__ */ d(w, { position: "left", children: [
|
|
854
|
-
/* @__PURE__ */ e(
|
|
855
|
-
/* @__PURE__ */ e(
|
|
864
|
+
/* @__PURE__ */ e(Ve, { account: l, onSuccess: s }),
|
|
865
|
+
/* @__PURE__ */ e(Ne, { id: p, name: h, onSuccess: s })
|
|
856
866
|
] }) })
|
|
857
867
|
] }, p);
|
|
858
868
|
}) })
|
|
@@ -860,14 +870,14 @@ function rt({
|
|
|
860
870
|
] })
|
|
861
871
|
] });
|
|
862
872
|
}
|
|
863
|
-
function
|
|
873
|
+
function Be({
|
|
864
874
|
postSubmit: t,
|
|
865
875
|
styles: n = y
|
|
866
876
|
}) {
|
|
867
877
|
const {
|
|
868
878
|
control: r,
|
|
869
879
|
handleSubmit: i
|
|
870
|
-
} =
|
|
880
|
+
} = q({
|
|
871
881
|
defaultValues: {
|
|
872
882
|
name: "",
|
|
873
883
|
password: ""
|
|
@@ -909,14 +919,14 @@ function Ne({
|
|
|
909
919
|
/* @__PURE__ */ e(w, { position: "right", mt: n.spacing, children: /* @__PURE__ */ e(b, { type: "submit", size: n.button.size, children: "Submit" }) })
|
|
910
920
|
] }) });
|
|
911
921
|
}
|
|
912
|
-
function
|
|
922
|
+
function st({
|
|
913
923
|
styles: t = y,
|
|
914
924
|
config: n,
|
|
915
925
|
onSuccess: r
|
|
916
926
|
}) {
|
|
917
|
-
return
|
|
927
|
+
return j(n), /* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(v, { mt: t.spacing, sx: {
|
|
918
928
|
position: "relative"
|
|
919
|
-
}, children: /* @__PURE__ */ e(
|
|
929
|
+
}, children: /* @__PURE__ */ e(Be, { styles: t, postSubmit: r }) }) });
|
|
920
930
|
}
|
|
921
931
|
const M = {
|
|
922
932
|
size: "sm",
|
|
@@ -925,7 +935,7 @@ const M = {
|
|
|
925
935
|
size: "xs"
|
|
926
936
|
}
|
|
927
937
|
};
|
|
928
|
-
function
|
|
938
|
+
function He({
|
|
929
939
|
postSubmit: t,
|
|
930
940
|
styles: n = M,
|
|
931
941
|
initialRoleID: r
|
|
@@ -933,7 +943,7 @@ function Ke({
|
|
|
933
943
|
const {
|
|
934
944
|
control: i,
|
|
935
945
|
handleSubmit: s
|
|
936
|
-
} =
|
|
946
|
+
} = q({
|
|
937
947
|
defaultValues: {
|
|
938
948
|
name: "",
|
|
939
949
|
role_id: r
|
|
@@ -978,16 +988,16 @@ function Ke({
|
|
|
978
988
|
/* @__PURE__ */ e(w, { position: "right", mt: n.spacing, children: /* @__PURE__ */ e(b, { type: "submit", size: n.button.size, children: "Save" }) })
|
|
979
989
|
] }) });
|
|
980
990
|
}
|
|
981
|
-
function
|
|
991
|
+
function $e({
|
|
982
992
|
onSuccess: t,
|
|
983
993
|
styles: n = M,
|
|
984
994
|
initialRoleID: r
|
|
985
995
|
}) {
|
|
986
|
-
const i =
|
|
996
|
+
const i = E(), [s, o] = F.useState(!1), a = () => o(!0), c = () => o(!1);
|
|
987
997
|
return /* @__PURE__ */ d(C, { children: [
|
|
988
|
-
/* @__PURE__ */ e(
|
|
998
|
+
/* @__PURE__ */ e(O, { overflow: "inside", opened: s, onClose: () => o(!1), title: "Add an API Key", trapFocus: !0, onDragStart: (g) => {
|
|
989
999
|
g.stopPropagation();
|
|
990
|
-
}, children: /* @__PURE__ */ e(
|
|
1000
|
+
}, children: /* @__PURE__ */ e(He, { postSubmit: (g, l) => {
|
|
991
1001
|
c(), i.openModal({
|
|
992
1002
|
title: "API Key is generated",
|
|
993
1003
|
children: /* @__PURE__ */ d(B, { children: [
|
|
@@ -1003,7 +1013,7 @@ function Ve({
|
|
|
1003
1013
|
}
|
|
1004
1014
|
} }),
|
|
1005
1015
|
/* @__PURE__ */ e(b, { size: "sm", onClick: () => {
|
|
1006
|
-
|
|
1016
|
+
Se();
|
|
1007
1017
|
}, children: "I've saved this API Key" })
|
|
1008
1018
|
] }),
|
|
1009
1019
|
onClose: () => {
|
|
@@ -1014,13 +1024,13 @@ function Ve({
|
|
|
1014
1024
|
/* @__PURE__ */ e(b, { size: n.button.size, onClick: a, leftIcon: /* @__PURE__ */ e(Q, { size: 20 }), children: "Add an API Key" })
|
|
1015
1025
|
] });
|
|
1016
1026
|
}
|
|
1017
|
-
function
|
|
1027
|
+
function Ge({
|
|
1018
1028
|
id: t,
|
|
1019
1029
|
name: n,
|
|
1020
1030
|
onSuccess: r,
|
|
1021
1031
|
styles: i = M
|
|
1022
1032
|
}) {
|
|
1023
|
-
const s =
|
|
1033
|
+
const s = E(), o = async () => {
|
|
1024
1034
|
if (t) {
|
|
1025
1035
|
_({
|
|
1026
1036
|
id: "for-deleting",
|
|
@@ -1055,17 +1065,17 @@ function Be({
|
|
|
1055
1065
|
});
|
|
1056
1066
|
return /* @__PURE__ */ e(b, { size: i.button.size, color: "red", onClick: a, leftIcon: /* @__PURE__ */ e(W, { size: 20 }), children: "Delete" });
|
|
1057
1067
|
}
|
|
1058
|
-
function
|
|
1068
|
+
function ct({
|
|
1059
1069
|
styles: t = M,
|
|
1060
1070
|
config: n
|
|
1061
1071
|
}) {
|
|
1062
1072
|
var g;
|
|
1063
|
-
|
|
1073
|
+
j(n);
|
|
1064
1074
|
const {
|
|
1065
1075
|
data: r = [],
|
|
1066
1076
|
loading: i,
|
|
1067
1077
|
refresh: s
|
|
1068
|
-
} =
|
|
1078
|
+
} = T(async () => {
|
|
1069
1079
|
const {
|
|
1070
1080
|
data: l
|
|
1071
1081
|
} = await P.api_key.list();
|
|
@@ -1075,7 +1085,7 @@ function ot({
|
|
|
1075
1085
|
}), {
|
|
1076
1086
|
data: o = [],
|
|
1077
1087
|
loading: a
|
|
1078
|
-
} =
|
|
1088
|
+
} = T(async () => (await P.role.list()).map((p) => ({
|
|
1079
1089
|
label: p.name,
|
|
1080
1090
|
value: p.id,
|
|
1081
1091
|
description: p.description,
|
|
@@ -1085,7 +1095,7 @@ function ot({
|
|
|
1085
1095
|
refreshDeps: []
|
|
1086
1096
|
}), c = ee(() => o.reduce((l, p) => (l.set(p.value, p.label), l), /* @__PURE__ */ new Map()), [o]), u = (l) => c.get(l) ?? l;
|
|
1087
1097
|
return /* @__PURE__ */ d(C, { children: [
|
|
1088
|
-
/* @__PURE__ */ e(w, { pt: t.spacing, position: "right", children: /* @__PURE__ */ e(
|
|
1098
|
+
/* @__PURE__ */ e(w, { pt: t.spacing, position: "right", children: /* @__PURE__ */ e($e, { onSuccess: s, initialRoleID: ((g = o == null ? void 0 : o[0]) == null ? void 0 : g.value) ?? 0 }) }),
|
|
1089
1099
|
/* @__PURE__ */ d(v, { mt: t.spacing, sx: {
|
|
1090
1100
|
position: "relative"
|
|
1091
1101
|
}, children: [
|
|
@@ -1108,26 +1118,26 @@ function ot({
|
|
|
1108
1118
|
/* @__PURE__ */ e("td", { width: 200, children: h }),
|
|
1109
1119
|
/* @__PURE__ */ e("td", { width: 200, children: A }),
|
|
1110
1120
|
/* @__PURE__ */ e("td", { width: 200, children: u(k) }),
|
|
1111
|
-
/* @__PURE__ */ e("td", { width: 200, children: /* @__PURE__ */ e(w, { position: "left", children: /* @__PURE__ */ e(
|
|
1121
|
+
/* @__PURE__ */ e("td", { width: 200, children: /* @__PURE__ */ e(w, { position: "left", children: /* @__PURE__ */ e(Ge, { id: p, name: h, onSuccess: s }) }) })
|
|
1112
1122
|
] }, p);
|
|
1113
1123
|
}) })
|
|
1114
1124
|
] })
|
|
1115
1125
|
] })
|
|
1116
1126
|
] });
|
|
1117
1127
|
}
|
|
1118
|
-
const
|
|
1128
|
+
const lt = () => import("./package-76f6ee42.mjs").then(({
|
|
1119
1129
|
version: t
|
|
1120
1130
|
}) => (console.log(`[@devtable/dashboard] version: ${t}`), t));
|
|
1121
1131
|
export {
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1132
|
+
ct as APIKeyList,
|
|
1133
|
+
at as AccountList,
|
|
1134
|
+
$e as AddAPIKey,
|
|
1135
|
+
Ue as AddAccount,
|
|
1136
|
+
xe as AddDataSource,
|
|
1137
|
+
ot as DataSourceList,
|
|
1138
|
+
Ge as DeleteAPIKey,
|
|
1139
|
+
Ne as DeleteAccount,
|
|
1140
|
+
Ee as DeleteDataSource,
|
|
1141
|
+
st as Login,
|
|
1142
|
+
lt as getVersion
|
|
1133
1143
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(function(m,q){typeof exports=="object"&&typeof module<"u"?q(exports,require("/Users/leto/Merico/merico-dev/table/node_modules/react/jsx-runtime.js"),require("@mantine/core"),require("@mantine/notifications"),require("react"),require("tabler-icons-react"),require("axios"),require("crypto-js"),require("lodash"),require("react-hook-form"),require("ahooks"),require("@monaco-editor/react"),require("@mantine/modals")):typeof define=="function"&&define.amd?define(["exports","/Users/leto/Merico/merico-dev/table/node_modules/react/jsx-runtime.js","@mantine/core","@mantine/notifications","react","tabler-icons-react","axios","crypto-js","lodash","react-hook-form","ahooks","@monaco-editor/react","@mantine/modals"],q):(m=typeof globalThis<"u"?globalThis:m||self,q(m["settings-form"]={},m["/Users/leto/Merico/merico-dev/table/node_modules/react/jsx-runtime"].js,m["@mantine/core"],m["@mantine/notifications"],m.react,m["tabler-icons-react"],m.axios,m.CryptoJS,m._,m["react-hook-form"],m.ahooks,m["@monaco-editor/react"],m["@mantine/modals"]))})(this,function(m,q,r,b,z,
|
|
1
|
+
(function(m,q){typeof exports=="object"&&typeof module<"u"?q(exports,require("/Users/leto/Merico/merico-dev/table/node_modules/react/jsx-runtime.js"),require("@mantine/core"),require("@mantine/notifications"),require("react"),require("tabler-icons-react"),require("axios"),require("crypto-js"),require("lodash"),require("react-hook-form"),require("ahooks"),require("@monaco-editor/react"),require("@mantine/modals")):typeof define=="function"&&define.amd?define(["exports","/Users/leto/Merico/merico-dev/table/node_modules/react/jsx-runtime.js","@mantine/core","@mantine/notifications","react","tabler-icons-react","axios","crypto-js","lodash","react-hook-form","ahooks","@monaco-editor/react","@mantine/modals"],q):(m=typeof globalThis<"u"?globalThis:m||self,q(m["settings-form"]={},m["/Users/leto/Merico/merico-dev/table/node_modules/react/jsx-runtime"].js,m["@mantine/core"],m["@mantine/notifications"],m.react,m["tabler-icons-react"],m.axios,m.CryptoJS,m._,m["react-hook-form"],m.ahooks,m["@monaco-editor/react"],m["@mantine/modals"]))})(this,function(m,q,r,b,z,P,oe,se,le,h,x,I,D){"use strict";function k(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const a=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,a.get?a:{enumerable:!0,get:()=>t[i]})}}return n.default=t,Object.freeze(n)}const B=k(q),O=k(z),C=B.Fragment,e=B.jsx,d=B.jsxs;function ce(t){t=t||{};const n=Object.keys(t).sort(),i=[];for(let a=0;a<n.length;a++){const l=n[a];if(l!="authentication"&&t[l])i.push(n[a]+"="+(typeof t[l]=="object"?JSON.stringify(t[l]):t[l]));else{const o=Object.keys(t[l]).sort();for(let s=0;s<o.length;s++){const c=o[s];c!="sign"&&t[l][c]&&i.push(o[s]+"="+(typeof t[l][c]=="object"?JSON.stringify(t[l][c]):t[l][c]))}}}return i.sort().join("&")}function de(t,n){let i=ce(t);return i+="&key="+n,se.MD5(i).toString().toUpperCase()}const S={baseURL:"http://localhost:31200",app_id:"",app_secret:"",getAuthentication(t){if(!this.app_id||!this.app_secret)return;const n=new Date().getTime().toString();return{app_id:this.app_id,nonce_str:n,sign:de({app_id:this.app_id,nonce_str:n,...t},this.app_secret)}},getRequest(t){return(n,i,a={})=>{const l=window.localStorage.getItem("token"),o={"X-Requested-With":"XMLHttpRequest","Content-Type":a.string?"application/x-www-form-urlencoded":"application/json",authorization:l?`bearer ${l}`:"",...a.headers},s={baseURL:this.baseURL,method:t,url:n,params:t==="GET"?i:a.params,headers:o};return["POST","PUT"].includes(t)&&(s.data=a.string?JSON.stringify(i):i,s.data.authentication=this.getAuthentication(s.data)),oe(s).then(c=>c.data).catch(c=>le.has(c,"response.data.detail.message")?Promise.reject(new Error(c.response.data.detail.message)):Promise.reject(c))}}};function j(t){S.baseURL!==t.apiBaseURL&&(S.baseURL=t.apiBaseURL),t.app_id&&(S.app_id=t.app_id),t.app_secret&&(S.app_secret=t.app_secret)}const v={datasource:{list:async()=>await S.getRequest("POST")("/datasource/list",{filter:{},sort:[{field:"create_time",order:"ASC"}],pagination:{page:1,pagesize:100}}),create:async(t,n,i)=>await S.getRequest("POST")("/datasource/create",{type:t,key:n,config:i}),delete:async t=>{await S.getRequest("POST")("/datasource/delete",{id:t})}},account:{login:async(t,n)=>{const i={name:t,password:n};return await S.getRequest("POST")("/account/login",i)},list:async()=>await S.getRequest("POST")("/account/list",{filter:{},sort:[{field:"name",order:"ASC"}],pagination:{page:1,pagesize:100}}),get:async()=>await S.getRequest("GET")("/account/get",{}),update:async(t,n)=>{const i={name:t,email:n};return await S.getRequest("PUT")("/account/update",i)},changepassword:async(t,n)=>{const i={old_password:t,new_password:n};return await S.getRequest("POST")("/account/changepassword",i)},create:async(t,n,i,a)=>await S.getRequest("POST")("/account/create",{name:t,email:n,password:i,role_id:a}),edit:async t=>(t.reset_password||(t.new_password=void 0),await S.getRequest("PUT")("/account/edit",t)),delete:async t=>{if(t)return S.getRequest("POST")("/account/delete",{id:t})}},role:{list:async()=>await S.getRequest("GET")("/role/list",{})},api_key:{list:async()=>await S.getRequest("POST")("/api/key/list",{filter:{search:""},sort:[{field:"name",order:"ASC"}],pagination:{page:1,pagesize:100}}),create:async(t,n)=>S.getRequest("POST")("/api/key/create",{name:t,role_id:n}),delete:async t=>{if(t)return S.getRequest("POST")("/api/key/delete",{id:t})}}},T={size:"sm",spacing:"md",button:{size:"xs"}};function ue({submit:t,styles:n=T,type:i}){const{control:a,setValue:l,handleSubmit:o}=h.useForm({defaultValues:{type:i,key:"",config:{host:"",port:5432,username:"",password:"",database:""}}});return z.useEffect(()=>{l("type",i)},[l,i]),e(r.Box,{mx:"auto",children:d("form",{onSubmit:o(t),children:[e(h.Controller,{name:"key",control:a,render:({field:s})=>e(r.TextInput,{mb:n.spacing,size:n.size,required:!0,label:"Name",placeholder:"A unique name",...s})}),e(r.Divider,{label:"Connection Info",labelPosition:"center"}),d(r.Group,{grow:!0,children:[e(h.Controller,{name:"config.host",control:a,render:({field:s})=>e(r.TextInput,{mb:n.spacing,size:n.size,required:!0,label:"Host",sx:{flexGrow:1},...s})}),e(h.Controller,{name:"config.port",control:a,render:({field:s})=>e(r.NumberInput,{mb:n.spacing,size:n.size,required:!0,label:"Port",hideControls:!0,sx:{width:"8em"},...s})})]}),e(h.Controller,{name:"config.username",control:a,render:({field:s})=>e(r.TextInput,{mb:n.spacing,size:n.size,required:!0,label:"Username",...s})}),e(h.Controller,{name:"config.password",control:a,render:({field:s})=>e(r.PasswordInput,{mb:n.spacing,size:n.size,required:!0,label:"Password",...s})}),e(h.Controller,{name:"config.database",control:a,render:({field:s})=>e(r.TextInput,{mb:n.spacing,size:n.size,required:!0,label:"Database",...s})}),e(r.Group,{position:"right",mt:n.spacing,children:e(r.Button,{type:"submit",size:n.button.size,children:"Save"})})]})})}const pe=({value:t,onChange:n})=>{const i=a=>{a&&n(a)};return e(r.Box,{sx:{position:"relative"},children:e(I,{height:"500px",defaultLanguage:"javascript",value:t,onChange:i,theme:"vs-dark",options:{minimap:{enabled:!1}}})})},E=z.forwardRef(({value:t,onChange:n,label:i,modalTitle:a,defaultValue:l,styles:o},s)=>{const[c,{setTrue:p,setFalse:f}]=x.useBoolean(),[u,g]=z.useState(t),w=()=>{f(),n(u)},y=()=>{f(),g(t)},_=()=>{g(l)};return z.useEffect(()=>{g(t)},[t]),d(C,{children:[e(r.Button,{variant:"filled",size:o.button.size,onClick:p,sx:{flexGrow:1},children:i}),e(r.Modal,{size:800,title:a,opened:c,onClose:f,closeOnClickOutside:!1,withCloseButton:!1,children:c&&d(r.Stack,{children:[e(pe,{value:u,onChange:g}),d(r.Group,{position:"apart",children:[e(r.Button,{onClick:_,color:"red",leftIcon:e(P.Recycle,{size:20}),children:"Rest"}),d(r.Group,{position:"right",children:[e(r.Button,{onClick:y,variant:"subtle",children:"Cancel"}),e(r.Button,{onClick:w,children:"OK"})]})]})]})})]})}),R={pre:["function pre_process({ method, url, params, headers, data }, utils) {"," // your code goes here"," return { method, url, params, headers, data }","}"].join(`
|
|
2
2
|
`),post:["function post_process(res, utils) {"," // your code goes here"," return data","}"].join(`
|
|
3
|
-
`)};function ge({submit:t,styles:n=T}){const{control:i,setValue:a,handleSubmit:l}=h.useForm({defaultValues:{type:"http",key:"",config:{host:"",processing:{pre:R.pre,post:R.post}}}});return e(r.Box,{mx:"auto",children:u("form",{onSubmit:l(t),children:[e(h.Controller,{name:"key",control:i,render:({field:o})=>e(r.TextInput,{mb:n.spacing,size:n.size,required:!0,label:"Name",placeholder:"A unique name",...o})}),e(r.Divider,{label:"Connection Info",labelPosition:"center"}),e(h.Controller,{name:"config.host",control:i,render:({field:o})=>e(r.TextInput,{mb:n.spacing,size:n.size,required:!0,label:"Base URL",sx:{flexGrow:1},...o})}),u(r.Group,{grow:!0,children:[e(h.Controller,{name:"config.processing.pre",control:i,render:({field:o})=>e(G,{label:"Pre Processing",modalTitle:"This function will run before sending the request (for scenarios like encryption)",defaultValue:R.pre,...o,styles:n})}),e(h.Controller,{name:"config.processing.post",control:i,render:({field:o})=>e(G,{label:"Post Processing",modalTitle:"This function will run after sending the request (for scenarios like decryption)",defaultValue:R.post,...o,styles:n})})]}),e(r.Group,{position:"right",mt:n.spacing,children:e(r.Button,{type:"submit",size:n.button.size,children:"Save"})})]})})}function he({postSubmit:t,styles:n=T}){const[i,a]=z.useState("postgresql"),l=async({type:c,key:p,config:f})=>{b.showNotification({id:"for-creating",title:"Pending",message:"Adding data source...",loading:!0});try{console.log({type:c,key:p,config:f}),await v.datasource.create(c,p,f),b.updateNotification({id:"for-creating",title:"Successful",message:"Data source is added",color:"green"}),t()}catch(d){b.updateNotification({id:"for-creating",title:"Failed",message:d.message,color:"red"})}},o=i==="postgresql"||i==="mysql",s=i==="http";return u(r.Box,{mx:"auto",children:[e(r.SegmentedControl,{fullWidth:!0,mb:n.spacing,size:n.size,data:[{label:"PostgreSQL",value:"postgresql"},{label:"MySQL",value:"mysql"},{label:"HTTP",value:"http"}],value:i,onChange:c=>a(c)}),o&&e(ue,{submit:l,styles:n,type:i}),s&&e(ge,{submit:l,styles:n})]})}function U({onSuccess:t,styles:n=T}){const[i,a]=z.useState(!1),l=()=>a(!0),o=()=>a(!1),s=()=>{t(),o()};return u(P,{children:[e(r.Modal,{overflow:"inside",opened:i,onClose:()=>a(!1),title:"Add a data source",trapFocus:!0,onDragStart:c=>{c.stopPropagation()},children:e(he,{postSubmit:s,styles:n})}),e(r.Button,{size:n.button.size,onClick:l,leftIcon:e(y.PlaylistAdd,{size:20}),children:"Add a Data Source"})]})}const me=t=>t.replace(/([^:])(\/\/+)/g,"$1/");function fe(t){z.useEffect(()=>{if(I.loader.__getMonacoInstance())return;console.log("loading monaco for @devtable/settings-form");const i=me(t);I.loader.config({paths:{vs:i}}),I.loader.init().then(a=>console.log("monaco instance:",a))},[])}function L(){return L=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(t[a]=i[a])}return t},L.apply(this,arguments)}function be(t,n){if(t==null)return{};var i,a,l=function(s,c){if(s==null)return{};var p,f,d={},g=Object.keys(s);for(f=0;f<g.length;f++)p=g[f],c.indexOf(p)>=0||(d[p]=s[p]);return d}(t,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(a=0;a<o.length;a++)i=o[a],n.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(l[i]=t[i])}return l}var we=["size","color","stroke"];function Se(t){var n=t.size,i=n===void 0?24:n,a=t.color,l=a===void 0?"currentColor":a,o=t.stroke,s=o===void 0?2:o,c=be(t,we);return O.createElement("svg",L({xmlns:"http://www.w3.org/2000/svg",className:"icon icon-tabler icon-tabler-lock",width:i,height:i,viewBox:"0 0 24 24",strokeWidth:s,stroke:l,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},c),O.createElement("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),O.createElement("rect",{x:5,y:11,width:14,height:10,rx:2}),O.createElement("circle",{cx:12,cy:16,r:1}),O.createElement("path",{d:"M8 11v-4a4 4 0 0 1 8 0v4"}))}function E({id:t,name:n,isProtected:i,onSuccess:a,styles:l=T}){const o=D.useModals(),s=async()=>{t&&(b.showNotification({id:"for-deleting",title:"Pending",message:"Deleting data source...",loading:!0}),await v.datasource.delete(t),b.updateNotification({id:"for-deleting",title:"Successful",message:`Data source [${n}] is deleted`,color:"green"}),a())},c=()=>o.openConfirmModal({title:"Delete this data source?",children:e(r.Text,{size:l.size,children:"This action won't affect your database."}),labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:s}),p=r.useMantineTheme();return i?e(r.Tooltip,{withArrow:!0,events:{hover:!0,touch:!1,focus:!1},label:"This is a preset datasource, it can not be deleted",children:e("span",{children:e(Se,{size:16,color:p.colors.gray[7]})})}):e(r.Button,{size:l.button.size,color:"red",onClick:c,leftIcon:e(y.Trash,{size:20}),children:"Delete"})}function ze({styles:t=T,config:n}){fe(n.monacoPath),j(n);const{data:i=[],loading:a,refresh:l}=x.useRequest(async()=>{const{data:o}=await v.datasource.list();return o},{refreshDeps:[]});return u(P,{children:[e(r.Group,{pt:t.spacing,position:"right",children:e(U,{onSuccess:l})}),u(r.Box,{mt:t.spacing,sx:{position:"relative"},children:[e(r.LoadingOverlay,{visible:a}),u(r.Table,{horizontalSpacing:t.spacing,verticalSpacing:t.spacing,fontSize:t.size,highlightOnHover:!0,children:[e("thead",{children:u("tr",{children:[e("th",{children:"Type"}),e("th",{children:"Name"}),e("th",{children:"Action"})]})}),e("tbody",{children:i.map(({id:o,key:s,type:c,is_preset:p})=>u("tr",{children:[e("td",{width:200,children:c}),e("td",{children:s}),e("td",{width:200,children:e(r.Group,{position:"left",children:e(E,{isProtected:p,id:o,name:s,onSuccess:l})})})]},s))})]})]})]})}const ve=z.forwardRef(({label:t,value:n,description:i,...a},l)=>u(r.Stack,{spacing:2,ref:l,...a,children:[e(r.Text,{size:"sm",children:t}),e(r.Text,{size:"xs",color:"dimmed",className:"role-description",children:i})]})),M=z.forwardRef(({styles:t,value:n,onChange:i},a)=>{const{data:l=[],loading:o}=x.useRequest(async()=>(await v.role.list()).map(c=>({label:c.name,value:c.id,description:c.description,disabled:c.id===50})),{refreshDeps:[]});return e(r.Select,{ref:a,mb:t.spacing,size:t.size,required:!0,label:"Role",itemComponent:ve,data:l,disabled:o,styles:()=>({item:{"&[data-selected]":{"&, &:hover":{".role-description":{color:"rgba(255,255,255,.8)"}}}}}),value:n,onChange:i})}),A={size:"sm",spacing:"md",button:{size:"xs"}};function Pe({postSubmit:t,styles:n=A,initialRoleID:i}){const{control:a,handleSubmit:l}=h.useForm({defaultValues:{name:"",email:"",role_id:i,password:""}}),o=async({name:s,email:c,password:p,role_id:f})=>{try{b.showNotification({id:"for-creating",title:"Pending",message:"Adding account...",loading:!0}),await v.account.create(s,c,p,f),b.updateNotification({id:"for-creating",title:"Successful",message:"Account is added",color:"green"}),t()}catch(d){b.updateNotification({id:"for-creating",title:"Failed",message:d.message,color:"red"})}};return e(r.Box,{mx:"auto",children:u("form",{onSubmit:l(o),children:[e(h.Controller,{name:"name",control:a,render:({field:s})=>e(r.TextInput,{mb:n.spacing,size:n.size,required:!0,label:"Username",...s})}),e(h.Controller,{name:"email",control:a,render:({field:s})=>e(r.TextInput,{mb:n.spacing,size:n.size,required:!0,label:"Email",...s})}),e(h.Controller,{name:"password",control:a,render:({field:s})=>e(r.PasswordInput,{mb:n.spacing,size:n.size,required:!0,label:"Password",description:"Password must be at least 8 characters long",...s})}),e(h.Controller,{name:"role_id",control:a,render:({field:s})=>e(M,{styles:n,...s})}),e(r.Group,{position:"right",mt:n.spacing,children:e(r.Button,{type:"submit",size:n.button.size,children:"Save"})})]})})}function K({onSuccess:t,styles:n=A,initialRoleID:i}){const[a,l]=z.useState(!1),o=()=>l(!0),s=()=>l(!1),c=()=>{t(),s()};return u(P,{children:[e(r.Modal,{overflow:"inside",opened:a,onClose:()=>l(!1),title:"Add an Account",trapFocus:!0,onDragStart:p=>{p.stopPropagation()},children:e(Pe,{postSubmit:c,styles:n,initialRoleID:i})}),e(r.Button,{size:n.button.size,onClick:o,leftIcon:e(y.PlaylistAdd,{size:20}),children:"Add an Account"})]})}function V({id:t,name:n,onSuccess:i,styles:a=A}){const l=D.useModals(),o=async()=>{if(t){b.showNotification({id:"for-deleting",title:"Pending",message:"Deleting account...",loading:!0});try{await v.account.delete(t),b.updateNotification({id:"for-deleting",title:"Successful",message:`Account [${n}] is deleted`,color:"green"}),i()}catch(c){b.updateNotification({id:"for-deleting",title:"Failed",message:c.message,color:"red"})}}},s=()=>l.openConfirmModal({title:"Delete this account?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:o});return e(r.Button,{size:a.button.size,color:"red",onClick:s,leftIcon:e(y.Trash,{size:20}),children:"Delete"})}function Ce({id:t,name:n,email:i,role_id:a,postSubmit:l,styles:o=A}){const{control:s,handleSubmit:c,watch:p}=h.useForm({defaultValues:{name:n,email:i,role_id:a,reset_password:!1,new_password:""}}),f=async({name:w,email:C,role_id:_,reset_password:Ie,new_password:je})=>{try{b.showNotification({id:"for-updating",title:"Pending",message:"Updating account...",loading:!0}),await v.account.edit({id:t,name:w,email:C,role_id:_,reset_password:Ie,new_password:je}),b.updateNotification({id:"for-updating",title:"Successful",message:"Account is updated",color:"green"}),l()}catch(Re){b.updateNotification({id:"for-updating",title:"Failed",message:Re.message,color:"red"})}},[d,g]=p(["reset_password","new_password"]);return e(r.Box,{mx:"auto",children:u("form",{onSubmit:c(f),children:[e(h.Controller,{name:"name",control:s,render:({field:w})=>e(r.TextInput,{mb:o.spacing,size:o.size,required:!0,label:"Username",...w})}),e(h.Controller,{name:"email",control:s,render:({field:w})=>e(r.TextInput,{mb:o.spacing,size:o.size,required:!0,label:"Email",...w})}),e(h.Controller,{name:"role_id",control:s,render:({field:w})=>e(M,{styles:o,...w})}),e(r.Divider,{my:20,variant:"dashed",label:"",labelPosition:"center"}),e(h.Controller,{name:"reset_password",control:s,render:({field:w})=>e(r.Switch,{mb:o.spacing,size:o.size,label:"Reset password",checked:w.value,onChange:C=>w.onChange(C.currentTarget.checked),styles:{label:{verticalAlign:"middle"}}})}),d&&e(h.Controller,{name:"new_password",control:s,render:({field:w})=>e(r.PasswordInput,{autoComplete:"off",mb:o.spacing,size:o.size,required:!0,description:"Password must be at least 8 characters long",label:"New Password",...w})}),e(r.Group,{position:"right",mt:o.spacing,children:e(r.Button,{type:"submit",size:o.button.size,children:"Submit"})})]})})}function ye({account:t,onSuccess:n,styles:i=A}){const[a,l]=z.useState(!1),o=()=>l(!0),s=()=>l(!1),c=()=>{n(),s()};return u(P,{children:[e(r.Modal,{overflow:"inside",opened:a,onClose:()=>l(!1),title:`Editing ${t.name}`,trapFocus:!0,onDragStart:p=>{p.stopPropagation()},children:e(Ce,{...t,postSubmit:c,styles:i})}),e(r.Button,{size:i.button.size,onClick:o,leftIcon:e(y.Edit,{size:20}),children:"Edit"})]})}function Ae({styles:t=A,config:n}){var f;j(n);const{data:i=[],loading:a,refresh:l}=x.useRequest(async()=>{const{data:d}=await v.account.list();return d},{refreshDeps:[]}),{data:o=[],loading:s}=x.useRequest(async()=>(await v.role.list()).map(g=>({label:g.name,value:g.id,description:g.description,disabled:g.id===50})),{refreshDeps:[]}),c=z.useMemo(()=>o.reduce((d,g)=>(d.set(g.value,g.label),d),new Map),[o]),p=d=>c.get(d)??d;return u(P,{children:[e(r.Group,{pt:t.spacing,position:"right",children:e(K,{onSuccess:l,initialRoleID:((f=o==null?void 0:o[0])==null?void 0:f.value)??0})}),u(r.Box,{mt:t.spacing,sx:{position:"relative"},children:[e(r.LoadingOverlay,{visible:a||s}),u(r.Table,{horizontalSpacing:t.spacing,verticalSpacing:t.spacing,fontSize:t.size,highlightOnHover:!0,children:[e("thead",{children:u("tr",{children:[e("th",{children:"Username"}),e("th",{children:"Email"}),e("th",{children:"Role"}),e("th",{children:"Action"})]})}),e("tbody",{children:i.map(d=>{const{id:g,name:w,email:C,role_id:_}=d;return u("tr",{children:[e("td",{width:200,children:w}),e("td",{width:200,children:C}),e("td",{width:200,children:p(_)}),e("td",{width:200,children:u(r.Group,{position:"left",children:[e(ye,{account:d,onSuccess:l}),e(V,{id:g,name:w,onSuccess:l})]})})]},g)})})]})]})]})}function xe({postSubmit:t,styles:n=A}){const{control:i,handleSubmit:a}=h.useForm({defaultValues:{name:"",password:""}}),l=async({name:o,password:s})=>{try{b.showNotification({id:"for-login",title:"Pending",message:"Loggin in...",loading:!0});const c=await v.account.login(o,s);window.localStorage.setItem("token",c.token),b.updateNotification({id:"for-login",title:"Successful",message:"Logged in",color:"green"}),t(c)}catch(c){b.updateNotification({id:"for-login",title:"Login Failed",message:c.message,color:"red"})}};return e(r.Box,{mx:"auto",children:u("form",{onSubmit:a(l),children:[e(h.Controller,{name:"name",control:i,render:({field:o})=>e(r.TextInput,{mb:n.spacing,size:n.size,required:!0,label:"Username",...o})}),e(h.Controller,{name:"password",control:i,render:({field:o})=>e(r.PasswordInput,{mb:n.spacing,size:n.size,required:!0,label:"Password",...o})}),e(r.Group,{position:"right",mt:n.spacing,children:e(r.Button,{type:"submit",size:n.button.size,children:"Submit"})})]})})}function _e({styles:t=A,config:n,onSuccess:i}){return j(n),e(P,{children:e(r.Box,{mt:t.spacing,sx:{position:"relative"},children:e(xe,{styles:t,postSubmit:i})})})}const N={size:"sm",spacing:"md",button:{size:"xs"}};function Te({postSubmit:t,styles:n=N,initialRoleID:i}){const{control:a,handleSubmit:l}=h.useForm({defaultValues:{name:"",role_id:i}}),o=async({name:s,role_id:c})=>{try{b.showNotification({id:"for-creating",title:"Pending",message:"Adding API Key...",loading:!0});const{app_id:p,app_secret:f}=await v.api_key.create(s,c);b.updateNotification({id:"for-creating",title:"Successful",message:"API Key is added",color:"green"}),t(p,f)}catch(p){b.updateNotification({id:"for-creating",title:"Failed",message:p.message,color:"red"})}};return e(r.Box,{mx:"auto",children:u("form",{onSubmit:l(o),children:[e(h.Controller,{name:"name",control:a,render:({field:s})=>e(r.TextInput,{mb:n.spacing,size:n.size,required:!0,label:"Name",...s})}),e(h.Controller,{name:"role_id",control:a,render:({field:s})=>e(M,{styles:n,...s})}),e(r.Group,{position:"right",mt:n.spacing,children:e(r.Button,{type:"submit",size:n.button.size,children:"Save"})})]})})}function $({onSuccess:t,styles:n=N,initialRoleID:i}){const a=D.useModals(),[l,o]=z.useState(!1),s=()=>o(!0),c=()=>o(!1),p=(f,d)=>{c(),a.openModal({title:"API Key is generated",children:u(r.Stack,{children:[e(r.Text,{color:"dimmed",children:"Make sure you save it - you won't be able to access it again."}),e(r.TextInput,{defaultValue:f,disabled:!0,label:"APP ID",styles:{input:{cursor:"text !important"}}}),e(r.TextInput,{defaultValue:d,disabled:!0,label:"APP Secret",styles:{input:{cursor:"text !important"}}}),e(r.Button,{size:"sm",onClick:()=>{D.closeAllModals()},children:"I've saved this API Key"})]}),onClose:()=>{t()}})};return u(P,{children:[e(r.Modal,{overflow:"inside",opened:l,onClose:()=>o(!1),title:"Add an API Key",trapFocus:!0,onDragStart:f=>{f.stopPropagation()},children:e(Te,{postSubmit:p,styles:n,initialRoleID:i})}),e(r.Button,{size:n.button.size,onClick:s,leftIcon:e(y.PlaylistAdd,{size:20}),children:"Add an API Key"})]})}function F({id:t,name:n,onSuccess:i,styles:a=N}){const l=D.useModals(),o=async()=>{if(t){b.showNotification({id:"for-deleting",title:"Pending",message:"Deleting API Key...",loading:!0});try{await v.api_key.delete(t),b.updateNotification({id:"for-deleting",title:"Successful",message:`API Key [${n}] is deleted`,color:"green"}),i()}catch(c){b.updateNotification({id:"for-deleting",title:"Failed",message:c.message,color:"red"})}}},s=()=>l.openConfirmModal({title:"Delete this api-key?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:o});return e(r.Button,{size:a.button.size,color:"red",onClick:s,leftIcon:e(y.Trash,{size:20}),children:"Delete"})}function qe({styles:t=N,config:n}){var f;j(n);const{data:i=[],loading:a,refresh:l}=x.useRequest(async()=>{const{data:d}=await v.api_key.list();return d},{refreshDeps:[]}),{data:o=[],loading:s}=x.useRequest(async()=>(await v.role.list()).map(g=>({label:g.name,value:g.id,description:g.description,disabled:g.id===50})),{refreshDeps:[]}),c=z.useMemo(()=>o.reduce((d,g)=>(d.set(g.value,g.label),d),new Map),[o]),p=d=>c.get(d)??d;return u(P,{children:[e(r.Group,{pt:t.spacing,position:"right",children:e($,{onSuccess:l,initialRoleID:((f=o==null?void 0:o[0])==null?void 0:f.value)??0})}),u(r.Box,{mt:t.spacing,sx:{position:"relative"},children:[e(r.LoadingOverlay,{visible:a||s}),u(r.Table,{horizontalSpacing:t.spacing,verticalSpacing:t.spacing,fontSize:t.size,highlightOnHover:!0,children:[e("thead",{children:u("tr",{children:[e("th",{children:"Name"}),e("th",{children:"APP ID"}),e("th",{children:"Role"}),e("th",{children:"Action"})]})}),e("tbody",{children:i.map(d=>{const{id:g,name:w,app_id:C,role_id:_}=d;return u("tr",{children:[e("td",{width:200,children:w}),e("td",{width:200,children:C}),e("td",{width:200,children:p(_)}),e("td",{width:200,children:e(r.Group,{position:"left",children:e(F,{id:g,name:w,onSuccess:l})})})]},g)})})]})]})]})}const De=()=>Promise.resolve().then(()=>Oe).then(({version:t})=>(console.log(`[@devtable/dashboard] version: ${t}`),t)),J="@devtable/settings-form",Q="8.51.2",W="Apache-2.0",X={access:"public",registry:"https://registry.npmjs.org/"},Y=["dist"],Z="./dist/settings-form.umd.js",H="./dist/settings-form.es.js",ee="./dist/index.d.ts",te={".":{import:"./dist/settings-form.es.js",require:"./dist/settings-form.umd.js"},"./dist/style.css":{import:"./dist/style.css",require:"./dist/style.css"}},ne={"dev-build":"tsc && vite build --watch",build:"tsc && vite build",preview:"vite preview"},ie={"@monaco-editor/react":"4.4.6","monaco-editor":"0.36.0"},re={"@emotion/babel-plugin":"11.7.2","@types/crypto-js":"v4.1.1","@types/lodash":"^4.14.182","@types/react":"^18.0.0","@types/react-dom":"^18.0.0","@types/react-grid-layout":"^1.3.2","rollup-plugin-visualizer":"5.6.0",typescript:"^4.6.3","vite-plugin-static-copy":"0.13.1"},ae={"@emotion/react":"11.10.0","@mantine/core":"5.9.5","@mantine/hooks":"5.9.5","@mantine/modals":"5.9.5","@mantine/notifications":"5.9.5",ahooks:"^3.3.11",axios:"^0.27.2","crypto-js":"^4.1.1",lodash:"^4.17.21",react:"^16.8.0 || 17.x || 18.x","react-dom":"^16.8.0 || 17.x || 18.x","react-hook-form":"^7.31.2","tabler-icons-react":"^1.48.0"},Oe=Object.freeze(Object.defineProperty({__proto__:null,default:{name:J,version:Q,license:W,publishConfig:X,files:Y,main:Z,module:H,types:ee,exports:te,scripts:ne,dependencies:ie,devDependencies:re,peerDependencies:ae},dependencies:ie,devDependencies:re,exports:te,files:Y,license:W,main:Z,module:H,name:J,peerDependencies:ae,publishConfig:X,scripts:ne,types:ee,version:Q},Symbol.toStringTag,{value:"Module"}));m.APIKeyList=qe,m.AccountList=Ae,m.AddAPIKey=$,m.AddAccount=K,m.AddDataSource=U,m.DataSourceList=ze,m.DeleteAPIKey=F,m.DeleteAccount=V,m.DeleteDataSource=E,m.Login=_e,m.getVersion=De,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
|
|
3
|
+
`)};function ge({submit:t,styles:n=T}){const{control:i,setValue:a,handleSubmit:l}=h.useForm({defaultValues:{type:"http",key:"",config:{host:"",processing:{pre:R.pre,post:R.post}}}});return e(r.Box,{mx:"auto",children:d("form",{onSubmit:l(t),children:[e(h.Controller,{name:"key",control:i,render:({field:o})=>e(r.TextInput,{mb:n.spacing,size:n.size,required:!0,label:"Name",placeholder:"A unique name",...o})}),e(r.Divider,{label:"Connection Info",labelPosition:"center"}),e(h.Controller,{name:"config.host",control:i,render:({field:o})=>e(r.TextInput,{mb:n.spacing,size:n.size,required:!0,label:"Base URL",sx:{flexGrow:1},...o})}),d(r.Group,{grow:!0,children:[e(h.Controller,{name:"config.processing.pre",control:i,render:({field:o})=>e(E,{label:"Pre Processing",modalTitle:"This function will run before sending the request (for scenarios like encryption)",defaultValue:R.pre,...o,styles:n})}),e(h.Controller,{name:"config.processing.post",control:i,render:({field:o})=>e(E,{label:"Post Processing",modalTitle:"This function will run after sending the request (for scenarios like decryption)",defaultValue:R.post,...o,styles:n})})]}),e(r.Group,{position:"right",mt:n.spacing,children:e(r.Button,{type:"submit",size:n.button.size,children:"Save"})})]})})}function he({styles:t=T}){return e(r.Box,{mx:"auto",children:d(r.Alert,{mt:t.spacing,icon:e(P.AlertCircle,{size:16}),children:["Only ",e("b",{children:"SELECT"})," privilege is needed."]})})}function me({postSubmit:t,styles:n=T}){const[i,a]=z.useState("postgresql"),l=async({type:c,key:p,config:f})=>{b.showNotification({id:"for-creating",title:"Pending",message:"Adding data source...",loading:!0});try{console.log({type:c,key:p,config:f}),await v.datasource.create(c,p,f),b.updateNotification({id:"for-creating",title:"Successful",message:"Data source is added",color:"green"}),t()}catch(u){b.updateNotification({id:"for-creating",title:"Failed",message:u.message,color:"red"})}},o=i==="postgresql"||i==="mysql",s=i==="http";return d(r.Box,{mx:"auto",children:[e(r.SegmentedControl,{fullWidth:!0,mb:n.spacing,size:n.size,data:[{label:"PostgreSQL",value:"postgresql"},{label:"MySQL",value:"mysql"},{label:"HTTP",value:"http"}],value:i,onChange:c=>a(c)}),o&&e(he,{styles:n}),o&&e(ue,{submit:l,styles:n,type:i}),s&&e(ge,{submit:l,styles:n})]})}function G({onSuccess:t,styles:n=T}){const[i,a]=z.useState(!1),l=()=>a(!0),o=()=>a(!1),s=()=>{t(),o()};return d(C,{children:[e(r.Modal,{overflow:"inside",opened:i,onClose:()=>a(!1),title:"Add a data source",trapFocus:!0,onDragStart:c=>{c.stopPropagation()},children:e(me,{postSubmit:s,styles:n})}),e(r.Button,{size:n.button.size,onClick:l,leftIcon:e(P.PlaylistAdd,{size:20}),children:"Add a Data Source"})]})}const fe=t=>t.replace(/([^:])(\/\/+)/g,"$1/");function be(t){z.useEffect(()=>{if(I.loader.__getMonacoInstance())return;console.log("loading monaco for @devtable/settings-form");const i=fe(t);I.loader.config({paths:{vs:i}}),I.loader.init().then(a=>console.log("monaco instance:",a))},[])}function L(){return L=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(t[a]=i[a])}return t},L.apply(this,arguments)}function we(t,n){if(t==null)return{};var i,a,l=function(s,c){if(s==null)return{};var p,f,u={},g=Object.keys(s);for(f=0;f<g.length;f++)p=g[f],c.indexOf(p)>=0||(u[p]=s[p]);return u}(t,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(a=0;a<o.length;a++)i=o[a],n.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(l[i]=t[i])}return l}var Se=["size","color","stroke"];function ze(t){var n=t.size,i=n===void 0?24:n,a=t.color,l=a===void 0?"currentColor":a,o=t.stroke,s=o===void 0?2:o,c=we(t,Se);return O.createElement("svg",L({xmlns:"http://www.w3.org/2000/svg",className:"icon icon-tabler icon-tabler-lock",width:i,height:i,viewBox:"0 0 24 24",strokeWidth:s,stroke:l,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},c),O.createElement("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),O.createElement("rect",{x:5,y:11,width:14,height:10,rx:2}),O.createElement("circle",{cx:12,cy:16,r:1}),O.createElement("path",{d:"M8 11v-4a4 4 0 0 1 8 0v4"}))}function U({id:t,name:n,isProtected:i,onSuccess:a,styles:l=T}){const o=D.useModals(),s=async()=>{t&&(b.showNotification({id:"for-deleting",title:"Pending",message:"Deleting data source...",loading:!0}),await v.datasource.delete(t),b.updateNotification({id:"for-deleting",title:"Successful",message:`Data source [${n}] is deleted`,color:"green"}),a())},c=()=>o.openConfirmModal({title:"Delete this data source?",children:e(r.Text,{size:l.size,children:"This action won't affect your database."}),labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:s}),p=r.useMantineTheme();return i?e(r.Tooltip,{withArrow:!0,events:{hover:!0,touch:!1,focus:!1},label:"This is a preset datasource, it can not be deleted",children:e("span",{children:e(ze,{size:16,color:p.colors.gray[7]})})}):e(r.Button,{size:l.button.size,color:"red",onClick:c,leftIcon:e(P.Trash,{size:20}),children:"Delete"})}function ve({styles:t=T,config:n}){be(n.monacoPath),j(n);const{data:i=[],loading:a,refresh:l}=x.useRequest(async()=>{const{data:o}=await v.datasource.list();return o},{refreshDeps:[]});return d(C,{children:[e(r.Group,{pt:t.spacing,position:"right",children:e(G,{onSuccess:l})}),d(r.Box,{mt:t.spacing,sx:{position:"relative"},children:[e(r.LoadingOverlay,{visible:a}),d(r.Table,{horizontalSpacing:t.spacing,verticalSpacing:t.spacing,fontSize:t.size,highlightOnHover:!0,children:[e("thead",{children:d("tr",{children:[e("th",{children:"Type"}),e("th",{children:"Name"}),e("th",{children:"Action"})]})}),e("tbody",{children:i.map(({id:o,key:s,type:c,is_preset:p})=>d("tr",{children:[e("td",{width:200,children:c}),e("td",{children:s}),e("td",{width:200,children:e(r.Group,{position:"left",children:e(U,{isProtected:p,id:o,name:s,onSuccess:l})})})]},s))})]})]})]})}const Pe=z.forwardRef(({label:t,value:n,description:i,...a},l)=>d(r.Stack,{spacing:2,ref:l,...a,children:[e(r.Text,{size:"sm",children:t}),e(r.Text,{size:"xs",color:"dimmed",className:"role-description",children:i})]})),M=z.forwardRef(({styles:t,value:n,onChange:i},a)=>{const{data:l=[],loading:o}=x.useRequest(async()=>(await v.role.list()).map(c=>({label:c.name,value:c.id,description:c.description,disabled:c.id===50})),{refreshDeps:[]});return e(r.Select,{ref:a,mb:t.spacing,size:t.size,required:!0,label:"Role",itemComponent:Pe,data:l,disabled:o,styles:()=>({item:{"&[data-selected]":{"&, &:hover":{".role-description":{color:"rgba(255,255,255,.8)"}}}}}),value:n,onChange:i})}),A={size:"sm",spacing:"md",button:{size:"xs"}};function Ce({postSubmit:t,styles:n=A,initialRoleID:i}){const{control:a,handleSubmit:l}=h.useForm({defaultValues:{name:"",email:"",role_id:i,password:""}}),o=async({name:s,email:c,password:p,role_id:f})=>{try{b.showNotification({id:"for-creating",title:"Pending",message:"Adding account...",loading:!0}),await v.account.create(s,c,p,f),b.updateNotification({id:"for-creating",title:"Successful",message:"Account is added",color:"green"}),t()}catch(u){b.updateNotification({id:"for-creating",title:"Failed",message:u.message,color:"red"})}};return e(r.Box,{mx:"auto",children:d("form",{onSubmit:l(o),children:[e(h.Controller,{name:"name",control:a,render:({field:s})=>e(r.TextInput,{mb:n.spacing,size:n.size,required:!0,label:"Username",...s})}),e(h.Controller,{name:"email",control:a,render:({field:s})=>e(r.TextInput,{mb:n.spacing,size:n.size,required:!0,label:"Email",...s})}),e(h.Controller,{name:"password",control:a,render:({field:s})=>e(r.PasswordInput,{mb:n.spacing,size:n.size,required:!0,label:"Password",description:"Password must be at least 8 characters long",...s})}),e(h.Controller,{name:"role_id",control:a,render:({field:s})=>e(M,{styles:n,...s})}),e(r.Group,{position:"right",mt:n.spacing,children:e(r.Button,{type:"submit",size:n.button.size,children:"Save"})})]})})}function K({onSuccess:t,styles:n=A,initialRoleID:i}){const[a,l]=z.useState(!1),o=()=>l(!0),s=()=>l(!1),c=()=>{t(),s()};return d(C,{children:[e(r.Modal,{overflow:"inside",opened:a,onClose:()=>l(!1),title:"Add an Account",trapFocus:!0,onDragStart:p=>{p.stopPropagation()},children:e(Ce,{postSubmit:c,styles:n,initialRoleID:i})}),e(r.Button,{size:n.button.size,onClick:o,leftIcon:e(P.PlaylistAdd,{size:20}),children:"Add an Account"})]})}function V({id:t,name:n,onSuccess:i,styles:a=A}){const l=D.useModals(),o=async()=>{if(t){b.showNotification({id:"for-deleting",title:"Pending",message:"Deleting account...",loading:!0});try{await v.account.delete(t),b.updateNotification({id:"for-deleting",title:"Successful",message:`Account [${n}] is deleted`,color:"green"}),i()}catch(c){b.updateNotification({id:"for-deleting",title:"Failed",message:c.message,color:"red"})}}},s=()=>l.openConfirmModal({title:"Delete this account?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:o});return e(r.Button,{size:a.button.size,color:"red",onClick:s,leftIcon:e(P.Trash,{size:20}),children:"Delete"})}function ye({id:t,name:n,email:i,role_id:a,postSubmit:l,styles:o=A}){const{control:s,handleSubmit:c,watch:p}=h.useForm({defaultValues:{name:n,email:i,role_id:a,reset_password:!1,new_password:""}}),f=async({name:w,email:y,role_id:_,reset_password:je,new_password:Re})=>{try{b.showNotification({id:"for-updating",title:"Pending",message:"Updating account...",loading:!0}),await v.account.edit({id:t,name:w,email:y,role_id:_,reset_password:je,new_password:Re}),b.updateNotification({id:"for-updating",title:"Successful",message:"Account is updated",color:"green"}),l()}catch(Ne){b.updateNotification({id:"for-updating",title:"Failed",message:Ne.message,color:"red"})}},[u,g]=p(["reset_password","new_password"]);return e(r.Box,{mx:"auto",children:d("form",{onSubmit:c(f),children:[e(h.Controller,{name:"name",control:s,render:({field:w})=>e(r.TextInput,{mb:o.spacing,size:o.size,required:!0,label:"Username",...w})}),e(h.Controller,{name:"email",control:s,render:({field:w})=>e(r.TextInput,{mb:o.spacing,size:o.size,required:!0,label:"Email",...w})}),e(h.Controller,{name:"role_id",control:s,render:({field:w})=>e(M,{styles:o,...w})}),e(r.Divider,{my:20,variant:"dashed",label:"",labelPosition:"center"}),e(h.Controller,{name:"reset_password",control:s,render:({field:w})=>e(r.Switch,{mb:o.spacing,size:o.size,label:"Reset password",checked:w.value,onChange:y=>w.onChange(y.currentTarget.checked),styles:{label:{verticalAlign:"middle"}}})}),u&&e(h.Controller,{name:"new_password",control:s,render:({field:w})=>e(r.PasswordInput,{autoComplete:"off",mb:o.spacing,size:o.size,required:!0,description:"Password must be at least 8 characters long",label:"New Password",...w})}),e(r.Group,{position:"right",mt:o.spacing,children:e(r.Button,{type:"submit",size:o.button.size,children:"Submit"})})]})})}function Ae({account:t,onSuccess:n,styles:i=A}){const[a,l]=z.useState(!1),o=()=>l(!0),s=()=>l(!1),c=()=>{n(),s()};return d(C,{children:[e(r.Modal,{overflow:"inside",opened:a,onClose:()=>l(!1),title:`Editing ${t.name}`,trapFocus:!0,onDragStart:p=>{p.stopPropagation()},children:e(ye,{...t,postSubmit:c,styles:i})}),e(r.Button,{size:i.button.size,onClick:o,leftIcon:e(P.Edit,{size:20}),children:"Edit"})]})}function xe({styles:t=A,config:n}){var f;j(n);const{data:i=[],loading:a,refresh:l}=x.useRequest(async()=>{const{data:u}=await v.account.list();return u},{refreshDeps:[]}),{data:o=[],loading:s}=x.useRequest(async()=>(await v.role.list()).map(g=>({label:g.name,value:g.id,description:g.description,disabled:g.id===50})),{refreshDeps:[]}),c=z.useMemo(()=>o.reduce((u,g)=>(u.set(g.value,g.label),u),new Map),[o]),p=u=>c.get(u)??u;return d(C,{children:[e(r.Group,{pt:t.spacing,position:"right",children:e(K,{onSuccess:l,initialRoleID:((f=o==null?void 0:o[0])==null?void 0:f.value)??0})}),d(r.Box,{mt:t.spacing,sx:{position:"relative"},children:[e(r.LoadingOverlay,{visible:a||s}),d(r.Table,{horizontalSpacing:t.spacing,verticalSpacing:t.spacing,fontSize:t.size,highlightOnHover:!0,children:[e("thead",{children:d("tr",{children:[e("th",{children:"Username"}),e("th",{children:"Email"}),e("th",{children:"Role"}),e("th",{children:"Action"})]})}),e("tbody",{children:i.map(u=>{const{id:g,name:w,email:y,role_id:_}=u;return d("tr",{children:[e("td",{width:200,children:w}),e("td",{width:200,children:y}),e("td",{width:200,children:p(_)}),e("td",{width:200,children:d(r.Group,{position:"left",children:[e(Ae,{account:u,onSuccess:l}),e(V,{id:g,name:w,onSuccess:l})]})})]},g)})})]})]})]})}function Te({postSubmit:t,styles:n=A}){const{control:i,handleSubmit:a}=h.useForm({defaultValues:{name:"",password:""}}),l=async({name:o,password:s})=>{try{b.showNotification({id:"for-login",title:"Pending",message:"Loggin in...",loading:!0});const c=await v.account.login(o,s);window.localStorage.setItem("token",c.token),b.updateNotification({id:"for-login",title:"Successful",message:"Logged in",color:"green"}),t(c)}catch(c){b.updateNotification({id:"for-login",title:"Login Failed",message:c.message,color:"red"})}};return e(r.Box,{mx:"auto",children:d("form",{onSubmit:a(l),children:[e(h.Controller,{name:"name",control:i,render:({field:o})=>e(r.TextInput,{mb:n.spacing,size:n.size,required:!0,label:"Username",...o})}),e(h.Controller,{name:"password",control:i,render:({field:o})=>e(r.PasswordInput,{mb:n.spacing,size:n.size,required:!0,label:"Password",...o})}),e(r.Group,{position:"right",mt:n.spacing,children:e(r.Button,{type:"submit",size:n.button.size,children:"Submit"})})]})})}function _e({styles:t=A,config:n,onSuccess:i}){return j(n),e(C,{children:e(r.Box,{mt:t.spacing,sx:{position:"relative"},children:e(Te,{styles:t,postSubmit:i})})})}const N={size:"sm",spacing:"md",button:{size:"xs"}};function qe({postSubmit:t,styles:n=N,initialRoleID:i}){const{control:a,handleSubmit:l}=h.useForm({defaultValues:{name:"",role_id:i}}),o=async({name:s,role_id:c})=>{try{b.showNotification({id:"for-creating",title:"Pending",message:"Adding API Key...",loading:!0});const{app_id:p,app_secret:f}=await v.api_key.create(s,c);b.updateNotification({id:"for-creating",title:"Successful",message:"API Key is added",color:"green"}),t(p,f)}catch(p){b.updateNotification({id:"for-creating",title:"Failed",message:p.message,color:"red"})}};return e(r.Box,{mx:"auto",children:d("form",{onSubmit:l(o),children:[e(h.Controller,{name:"name",control:a,render:({field:s})=>e(r.TextInput,{mb:n.spacing,size:n.size,required:!0,label:"Name",...s})}),e(h.Controller,{name:"role_id",control:a,render:({field:s})=>e(M,{styles:n,...s})}),e(r.Group,{position:"right",mt:n.spacing,children:e(r.Button,{type:"submit",size:n.button.size,children:"Save"})})]})})}function $({onSuccess:t,styles:n=N,initialRoleID:i}){const a=D.useModals(),[l,o]=z.useState(!1),s=()=>o(!0),c=()=>o(!1),p=(f,u)=>{c(),a.openModal({title:"API Key is generated",children:d(r.Stack,{children:[e(r.Text,{color:"dimmed",children:"Make sure you save it - you won't be able to access it again."}),e(r.TextInput,{defaultValue:f,disabled:!0,label:"APP ID",styles:{input:{cursor:"text !important"}}}),e(r.TextInput,{defaultValue:u,disabled:!0,label:"APP Secret",styles:{input:{cursor:"text !important"}}}),e(r.Button,{size:"sm",onClick:()=>{D.closeAllModals()},children:"I've saved this API Key"})]}),onClose:()=>{t()}})};return d(C,{children:[e(r.Modal,{overflow:"inside",opened:l,onClose:()=>o(!1),title:"Add an API Key",trapFocus:!0,onDragStart:f=>{f.stopPropagation()},children:e(qe,{postSubmit:p,styles:n,initialRoleID:i})}),e(r.Button,{size:n.button.size,onClick:s,leftIcon:e(P.PlaylistAdd,{size:20}),children:"Add an API Key"})]})}function F({id:t,name:n,onSuccess:i,styles:a=N}){const l=D.useModals(),o=async()=>{if(t){b.showNotification({id:"for-deleting",title:"Pending",message:"Deleting API Key...",loading:!0});try{await v.api_key.delete(t),b.updateNotification({id:"for-deleting",title:"Successful",message:`API Key [${n}] is deleted`,color:"green"}),i()}catch(c){b.updateNotification({id:"for-deleting",title:"Failed",message:c.message,color:"red"})}}},s=()=>l.openConfirmModal({title:"Delete this api-key?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:o});return e(r.Button,{size:a.button.size,color:"red",onClick:s,leftIcon:e(P.Trash,{size:20}),children:"Delete"})}function De({styles:t=N,config:n}){var f;j(n);const{data:i=[],loading:a,refresh:l}=x.useRequest(async()=>{const{data:u}=await v.api_key.list();return u},{refreshDeps:[]}),{data:o=[],loading:s}=x.useRequest(async()=>(await v.role.list()).map(g=>({label:g.name,value:g.id,description:g.description,disabled:g.id===50})),{refreshDeps:[]}),c=z.useMemo(()=>o.reduce((u,g)=>(u.set(g.value,g.label),u),new Map),[o]),p=u=>c.get(u)??u;return d(C,{children:[e(r.Group,{pt:t.spacing,position:"right",children:e($,{onSuccess:l,initialRoleID:((f=o==null?void 0:o[0])==null?void 0:f.value)??0})}),d(r.Box,{mt:t.spacing,sx:{position:"relative"},children:[e(r.LoadingOverlay,{visible:a||s}),d(r.Table,{horizontalSpacing:t.spacing,verticalSpacing:t.spacing,fontSize:t.size,highlightOnHover:!0,children:[e("thead",{children:d("tr",{children:[e("th",{children:"Name"}),e("th",{children:"APP ID"}),e("th",{children:"Role"}),e("th",{children:"Action"})]})}),e("tbody",{children:i.map(u=>{const{id:g,name:w,app_id:y,role_id:_}=u;return d("tr",{children:[e("td",{width:200,children:w}),e("td",{width:200,children:y}),e("td",{width:200,children:p(_)}),e("td",{width:200,children:e(r.Group,{position:"left",children:e(F,{id:g,name:w,onSuccess:l})})})]},g)})})]})]})]})}const Oe=()=>Promise.resolve().then(()=>Ie).then(({version:t})=>(console.log(`[@devtable/dashboard] version: ${t}`),t)),J="@devtable/settings-form",Q="8.52.0",W="Apache-2.0",X={access:"public",registry:"https://registry.npmjs.org/"},Y=["dist"],Z="./dist/settings-form.umd.js",H="./dist/settings-form.es.js",ee="./dist/index.d.ts",te={".":{import:"./dist/settings-form.es.js",require:"./dist/settings-form.umd.js"},"./dist/style.css":{import:"./dist/style.css",require:"./dist/style.css"}},ne={"dev-build":"tsc && vite build --watch",build:"tsc && vite build",preview:"vite preview"},ie={"@monaco-editor/react":"4.4.6","monaco-editor":"0.36.0"},re={"@emotion/babel-plugin":"11.7.2","@types/crypto-js":"v4.1.1","@types/lodash":"^4.14.182","@types/react":"^18.0.0","@types/react-dom":"^18.0.0","@types/react-grid-layout":"^1.3.2","rollup-plugin-visualizer":"5.6.0",typescript:"^4.6.3","vite-plugin-static-copy":"0.13.1"},ae={"@emotion/react":"11.10.0","@mantine/core":"5.9.5","@mantine/hooks":"5.9.5","@mantine/modals":"5.9.5","@mantine/notifications":"5.9.5",ahooks:"^3.3.11",axios:"^0.27.2","crypto-js":"^4.1.1",lodash:"^4.17.21",react:"^16.8.0 || 17.x || 18.x","react-dom":"^16.8.0 || 17.x || 18.x","react-hook-form":"^7.31.2","tabler-icons-react":"^1.48.0"},Ie=Object.freeze(Object.defineProperty({__proto__:null,default:{name:J,version:Q,license:W,publishConfig:X,files:Y,main:Z,module:H,types:ee,exports:te,scripts:ne,dependencies:ie,devDependencies:re,peerDependencies:ae},dependencies:ie,devDependencies:re,exports:te,files:Y,license:W,main:Z,module:H,name:J,peerDependencies:ae,publishConfig:X,scripts:ne,types:ee,version:Q},Symbol.toStringTag,{value:"Module"}));m.APIKeyList=De,m.AccountList=xe,m.AddAPIKey=$,m.AddAccount=K,m.AddDataSource=G,m.DataSourceList=ve,m.DeleteAPIKey=F,m.DeleteAccount=V,m.DeleteDataSource=U,m.Login=_e,m.getVersion=Oe,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
|