@devtable/settings-form 4.1.1 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { Method } from 'axios';
2
2
  export declare const APIClient: {
3
3
  baseURL: string;
4
- getRequest(method: Method): (url: string, data: any, options?: any) => Promise<any>;
4
+ getRequest(method: Method): (url: string, data: $TSFixMe, options?: $TSFixMe) => Promise<any>;
5
5
  };
@@ -0,0 +1,2 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
+ type $TSFixMe = any;
@@ -1,7 +1,7 @@
1
1
  import { Modal as Rr, Button as ie, Box as Ie, SegmentedControl as Er, TextInput as B, Divider as _r, Group as G, NumberInput as yr, PasswordInput as Sr, Text as Tr, LoadingOverlay as wr, Table as Cr } from "@mantine/core";
2
- import { useForm as Pr, Controller as D } from "react-hook-form";
3
2
  import { showNotification as ze, updateNotification as ae } from "@mantine/notifications";
4
3
  import oe from "react";
4
+ import { useForm as Pr, Controller as j } from "react-hook-form";
5
5
  import { PlaylistAdd as Or, Trash as xr } from "tabler-icons-react";
6
6
  import jr from "axios";
7
7
  import { useRequest as Dr } from "ahooks";
@@ -10,18 +10,18 @@ const $ = {
10
10
  baseURL: "http://localhost:31200",
11
11
  getRequest(l) {
12
12
  return (o, v, d = {}) => {
13
- const _ = {
13
+ const E = {
14
14
  "X-Requested-With": "XMLHttpRequest",
15
15
  "Content-Type": d.string ? "application/x-www-form-urlencoded" : "application/json",
16
16
  ...d.headers
17
- }, h = {
17
+ }, u = {
18
18
  baseURL: this.baseURL,
19
19
  method: l,
20
20
  url: o,
21
21
  params: l === "GET" ? v : d.params,
22
- headers: _
22
+ headers: E
23
23
  };
24
- return l === "POST" && (h.data = d.string ? JSON.stringify(v) : v), jr(h).then((m) => m.data).catch((m) => Promise.reject(m));
24
+ return l === "POST" && (u.data = d.string ? JSON.stringify(v) : v), jr(u).then((m) => m.data).catch((m) => Promise.reject(m));
25
25
  };
26
26
  }
27
27
  }, Ar = {
@@ -67,16 +67,16 @@ function Fr() {
67
67
  if (Ae)
68
68
  return L;
69
69
  Ae = 1;
70
- var l = oe, o = Symbol.for("react.element"), v = Symbol.for("react.fragment"), d = Object.prototype.hasOwnProperty, _ = l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, h = { key: !0, ref: !0, __self: !0, __source: !0 };
71
- function m(y, u, P) {
72
- var b, T = {}, x = null, q = null;
73
- P !== void 0 && (x = "" + P), u.key !== void 0 && (x = "" + u.key), u.ref !== void 0 && (q = u.ref);
74
- for (b in u)
75
- d.call(u, b) && !h.hasOwnProperty(b) && (T[b] = u[b]);
76
- if (y && y.defaultProps)
77
- for (b in u = y.defaultProps, u)
78
- T[b] === void 0 && (T[b] = u[b]);
79
- return { $$typeof: o, type: y, key: x, ref: q, props: T, _owner: _.current };
70
+ var l = oe, o = Symbol.for("react.element"), v = Symbol.for("react.fragment"), d = Object.prototype.hasOwnProperty, E = l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, u = { key: !0, ref: !0, __self: !0, __source: !0 };
71
+ function m(_, h, D) {
72
+ var y, T = {}, O = null, q = null;
73
+ D !== void 0 && (O = "" + D), h.key !== void 0 && (O = "" + h.key), h.ref !== void 0 && (q = h.ref);
74
+ for (y in h)
75
+ d.call(h, y) && !u.hasOwnProperty(y) && (T[y] = h[y]);
76
+ if (_ && _.defaultProps)
77
+ for (y in h = _.defaultProps, h)
78
+ T[y] === void 0 && (T[y] = h[y]);
79
+ return { $$typeof: o, type: _, key: O, ref: q, props: T, _owner: E.current };
80
80
  }
81
81
  return L.Fragment = v, L.jsx = m, L.jsxs = m, L;
82
82
  }
@@ -93,7 +93,7 @@ var W = {};
93
93
  var Fe;
94
94
  function Ir() {
95
95
  return Fe || (Fe = 1, process.env.NODE_ENV !== "production" && function() {
96
- var l = oe, o = Symbol.for("react.element"), v = Symbol.for("react.portal"), d = Symbol.for("react.fragment"), _ = Symbol.for("react.strict_mode"), h = Symbol.for("react.profiler"), m = Symbol.for("react.provider"), y = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), b = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), x = Symbol.for("react.lazy"), q = Symbol.for("react.offscreen"), ue = Symbol.iterator, We = "@@iterator";
96
+ var l = oe, o = Symbol.for("react.element"), v = Symbol.for("react.portal"), d = Symbol.for("react.fragment"), E = Symbol.for("react.strict_mode"), u = Symbol.for("react.profiler"), m = Symbol.for("react.provider"), _ = Symbol.for("react.context"), h = Symbol.for("react.forward_ref"), D = Symbol.for("react.suspense"), y = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), q = Symbol.for("react.offscreen"), ue = Symbol.iterator, We = "@@iterator";
97
97
  function $e(e) {
98
98
  if (e === null || typeof e != "object")
99
99
  return null;
@@ -101,7 +101,7 @@ function Ir() {
101
101
  return typeof r == "function" ? r : null;
102
102
  }
103
103
  var k = l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
104
- function R(e) {
104
+ function b(e) {
105
105
  {
106
106
  for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
107
107
  t[n - 1] = arguments[n];
@@ -121,7 +121,7 @@ function Ir() {
121
121
  var Ne = !1, Ue = !1, Ye = !1, Me = !1, Ve = !1, ce;
122
122
  ce = Symbol.for("react.module.reference");
123
123
  function Be(e) {
124
- return !!(typeof e == "string" || typeof e == "function" || e === d || e === h || Ve || e === _ || e === P || e === b || Me || e === q || Ne || Ue || Ye || typeof e == "object" && e !== null && (e.$$typeof === x || e.$$typeof === T || e.$$typeof === m || e.$$typeof === y || e.$$typeof === u || e.$$typeof === ce || e.getModuleId !== void 0));
124
+ return !!(typeof e == "string" || typeof e == "function" || e === d || e === u || Ve || e === E || e === D || e === y || Me || e === q || Ne || Ue || Ye || typeof e == "object" && e !== null && (e.$$typeof === O || e.$$typeof === T || e.$$typeof === m || e.$$typeof === _ || e.$$typeof === h || e.$$typeof === ce || e.getModuleId !== void 0));
125
125
  }
126
126
  function Ge(e, r, t) {
127
127
  var n = e.displayName;
@@ -136,7 +136,7 @@ function Ir() {
136
136
  function w(e) {
137
137
  if (e == null)
138
138
  return null;
139
- if (typeof e.tag == "number" && R("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
139
+ if (typeof e.tag == "number" && b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
140
140
  return e.displayName || e.name || null;
141
141
  if (typeof e == "string")
142
142
  return e;
@@ -145,29 +145,29 @@ function Ir() {
145
145
  return "Fragment";
146
146
  case v:
147
147
  return "Portal";
148
- case h:
148
+ case u:
149
149
  return "Profiler";
150
- case _:
150
+ case E:
151
151
  return "StrictMode";
152
- case P:
152
+ case D:
153
153
  return "Suspense";
154
- case b:
154
+ case y:
155
155
  return "SuspenseList";
156
156
  }
157
157
  if (typeof e == "object")
158
158
  switch (e.$$typeof) {
159
- case y:
159
+ case _:
160
160
  var r = e;
161
161
  return le(r) + ".Consumer";
162
162
  case m:
163
163
  var t = e;
164
164
  return le(t._context) + ".Provider";
165
- case u:
165
+ case h:
166
166
  return Ge(e, e.render, "ForwardRef");
167
167
  case T:
168
168
  var n = e.displayName || null;
169
169
  return n !== null ? n : w(e.type) || "Memo";
170
- case x: {
170
+ case O: {
171
171
  var c = e, f = c._payload, s = c._init;
172
172
  try {
173
173
  return w(s(f));
@@ -178,7 +178,7 @@ function Ir() {
178
178
  }
179
179
  return null;
180
180
  }
181
- var j = Object.assign, I = 0, fe, de, ve, pe, ge, me, he;
181
+ var x = Object.assign, I = 0, fe, de, ve, pe, ge, me, he;
182
182
  function be() {
183
183
  }
184
184
  be.__reactDisabledLog = !0;
@@ -214,30 +214,30 @@ function Ir() {
214
214
  writable: !0
215
215
  };
216
216
  Object.defineProperties(console, {
217
- log: j({}, e, {
217
+ log: x({}, e, {
218
218
  value: fe
219
219
  }),
220
- info: j({}, e, {
220
+ info: x({}, e, {
221
221
  value: de
222
222
  }),
223
- warn: j({}, e, {
223
+ warn: x({}, e, {
224
224
  value: ve
225
225
  }),
226
- error: j({}, e, {
226
+ error: x({}, e, {
227
227
  value: pe
228
228
  }),
229
- group: j({}, e, {
229
+ group: x({}, e, {
230
230
  value: ge
231
231
  }),
232
- groupCollapsed: j({}, e, {
232
+ groupCollapsed: x({}, e, {
233
233
  value: me
234
234
  }),
235
- groupEnd: j({}, e, {
235
+ groupEnd: x({}, e, {
236
236
  value: he
237
237
  })
238
238
  });
239
239
  }
240
- I < 0 && R("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
240
+ I < 0 && b("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
241
241
  }
242
242
  }
243
243
  var X = k.ReactCurrentDispatcher, K;
@@ -308,14 +308,14 @@ function Ir() {
308
308
  } catch (C) {
309
309
  if (C && n && typeof C.stack == "string") {
310
310
  for (var i = C.stack.split(`
311
- `), E = n.stack.split(`
312
- `), p = i.length - 1, g = E.length - 1; p >= 1 && g >= 0 && i[p] !== E[g]; )
311
+ `), R = n.stack.split(`
312
+ `), p = i.length - 1, g = R.length - 1; p >= 1 && g >= 0 && i[p] !== R[g]; )
313
313
  g--;
314
314
  for (; p >= 1 && g >= 0; p--, g--)
315
- if (i[p] !== E[g]) {
315
+ if (i[p] !== R[g]) {
316
316
  if (p !== 1 || g !== 1)
317
317
  do
318
- if (p--, g--, g < 0 || i[p] !== E[g]) {
318
+ if (p--, g--, g < 0 || i[p] !== R[g]) {
319
319
  var S = `
320
320
  ` + i[p].replace(" at new ", " at ");
321
321
  return e.displayName && S.includes("<anonymous>") && (S = S.replace("<anonymous>", e.displayName)), typeof e == "function" && U.set(e, S), S;
@@ -345,18 +345,18 @@ function Ir() {
345
345
  if (typeof e == "string")
346
346
  return N(e);
347
347
  switch (e) {
348
- case P:
348
+ case D:
349
349
  return N("Suspense");
350
- case b:
350
+ case y:
351
351
  return N("SuspenseList");
352
352
  }
353
353
  if (typeof e == "object")
354
354
  switch (e.$$typeof) {
355
- case u:
355
+ case h:
356
356
  return Ke(e.render);
357
357
  case T:
358
358
  return Y(e.type, r, t);
359
- case x: {
359
+ case O: {
360
360
  var n = e, c = n._payload, f = n._init;
361
361
  try {
362
362
  return Y(f(c), r, t);
@@ -382,14 +382,14 @@ function Ir() {
382
382
  var i = void 0;
383
383
  try {
384
384
  if (typeof e[s] != "function") {
385
- var E = Error((n || "React class") + ": " + t + " type `" + s + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[s] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
386
- throw E.name = "Invariant Violation", E;
385
+ var R = Error((n || "React class") + ": " + t + " type `" + s + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[s] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
386
+ throw R.name = "Invariant Violation", R;
387
387
  }
388
388
  i = e[s](r, s, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
389
389
  } catch (p) {
390
390
  i = p;
391
391
  }
392
- i && !(i instanceof Error) && (V(c), R("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", n || "React class", t, s, typeof i), V(null)), i instanceof Error && !(i.message in Ee) && (Ee[i.message] = !0, V(c), R("Failed %s type: %s", t, i.message), V(null));
392
+ i && !(i instanceof Error) && (V(c), b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", n || "React class", t, s, typeof i), V(null)), i instanceof Error && !(i.message in Ee) && (Ee[i.message] = !0, V(c), b("Failed %s type: %s", t, i.message), V(null));
393
393
  }
394
394
  }
395
395
  }
@@ -415,7 +415,7 @@ function Ir() {
415
415
  }
416
416
  function Se(e) {
417
417
  if (tr(e))
418
- return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", rr(e)), ye(e);
418
+ return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", rr(e)), ye(e);
419
419
  }
420
420
  var z = k.ReactCurrentOwner, nr = {
421
421
  key: !0,
@@ -443,13 +443,13 @@ function Ir() {
443
443
  function or(e, r) {
444
444
  if (typeof e.ref == "string" && z.current && r && z.current.stateNode !== r) {
445
445
  var t = w(z.current.type);
446
- ee[t] || (R('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', w(z.current.type), e.ref), ee[t] = !0);
446
+ ee[t] || (b('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', w(z.current.type), e.ref), ee[t] = !0);
447
447
  }
448
448
  }
449
449
  function sr(e, r) {
450
450
  {
451
451
  var t = function() {
452
- Te || (Te = !0, R("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
452
+ Te || (Te = !0, b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
453
453
  };
454
454
  t.isReactWarning = !0, Object.defineProperty(e, "key", {
455
455
  get: t,
@@ -460,7 +460,7 @@ function Ir() {
460
460
  function ur(e, r) {
461
461
  {
462
462
  var t = function() {
463
- we || (we = !0, R("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
463
+ we || (we = !0, b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
464
464
  };
465
465
  t.isReactWarning = !0, Object.defineProperty(e, "ref", {
466
466
  get: t,
@@ -496,8 +496,8 @@ function Ir() {
496
496
  };
497
497
  function lr(e, r, t, n, c) {
498
498
  {
499
- var f, s = {}, i = null, E = null;
500
- t !== void 0 && (Se(t), i = "" + t), ir(r) && (Se(r.key), i = "" + r.key), ar(r) && (E = r.ref, or(r, c));
499
+ var f, s = {}, i = null, R = null;
500
+ t !== void 0 && (Se(t), i = "" + t), ir(r) && (Se(r.key), i = "" + r.key), ar(r) && (R = r.ref, or(r, c));
501
501
  for (f in r)
502
502
  M.call(r, f) && !nr.hasOwnProperty(f) && (s[f] = r[f]);
503
503
  if (e && e.defaultProps) {
@@ -505,11 +505,11 @@ function Ir() {
505
505
  for (f in p)
506
506
  s[f] === void 0 && (s[f] = p[f]);
507
507
  }
508
- if (i || E) {
508
+ if (i || R) {
509
509
  var g = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
510
- i && sr(s, g), E && ur(s, g);
510
+ i && sr(s, g), R && ur(s, g);
511
511
  }
512
- return cr(e, i, E, c, n, z.current, s);
512
+ return cr(e, i, R, c, n, z.current, s);
513
513
  }
514
514
  }
515
515
  var re = k.ReactCurrentOwner, Ce = k.ReactDebugCurrentFrame;
@@ -571,7 +571,7 @@ Check the top-level render call using <` + t + ">.");
571
571
  return;
572
572
  Oe[t] = !0;
573
573
  var n = "";
574
- e && e._owner && e._owner !== re.current && (n = " It was passed a child from " + w(e._owner.type) + "."), A(e), R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), A(null);
574
+ e && e._owner && e._owner !== re.current && (n = " It was passed a child from " + w(e._owner.type) + "."), A(e), b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), A(null);
575
575
  }
576
576
  }
577
577
  function je(e, r) {
@@ -601,7 +601,7 @@ Check the top-level render call using <` + t + ">.");
601
601
  var t;
602
602
  if (typeof r == "function")
603
603
  t = r.propTypes;
604
- else if (typeof r == "object" && (r.$$typeof === u || r.$$typeof === T))
604
+ else if (typeof r == "object" && (r.$$typeof === h || r.$$typeof === T))
605
605
  t = r.propTypes;
606
606
  else
607
607
  return;
@@ -611,9 +611,9 @@ Check the top-level render call using <` + t + ">.");
611
611
  } else if (r.PropTypes !== void 0 && !te) {
612
612
  te = !0;
613
613
  var c = w(r);
614
- R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", c || "Unknown");
614
+ b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", c || "Unknown");
615
615
  }
616
- typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
616
+ typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
617
617
  }
618
618
  }
619
619
  function pr(e) {
@@ -621,11 +621,11 @@ Check the top-level render call using <` + t + ">.");
621
621
  for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
622
622
  var n = r[t];
623
623
  if (n !== "children" && n !== "key") {
624
- A(e), R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), A(null);
624
+ A(e), b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), A(null);
625
625
  break;
626
626
  }
627
627
  }
628
- e.ref !== null && (A(e), R("Invalid attribute `ref` supplied to `React.Fragment`."), A(null));
628
+ e.ref !== null && (A(e), b("Invalid attribute `ref` supplied to `React.Fragment`."), A(null));
629
629
  }
630
630
  }
631
631
  function De(e, r, t, n, c, f) {
@@ -634,10 +634,10 @@ Check the top-level render call using <` + t + ">.");
634
634
  if (!s) {
635
635
  var i = "";
636
636
  (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (i += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
637
- var E = fr(c);
638
- E ? i += E : i += Pe();
637
+ var R = fr(c);
638
+ R ? i += R : i += Pe();
639
639
  var p;
640
- e === null ? p = "null" : Z(e) ? p = "array" : e !== void 0 && e.$$typeof === o ? (p = "<" + (w(e.type) || "Unknown") + " />", i = " Did you accidentally export a JSX literal instead of a component?") : p = typeof e, R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", p, i);
640
+ e === null ? p = "null" : Z(e) ? p = "array" : e !== void 0 && e.$$typeof === o ? (p = "<" + (w(e.type) || "Unknown") + " />", i = " Did you accidentally export a JSX literal instead of a component?") : p = typeof e, b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", p, i);
641
641
  }
642
642
  var g = lr(e, r, t, c, f);
643
643
  if (g == null)
@@ -651,7 +651,7 @@ Check the top-level render call using <` + t + ">.");
651
651
  je(S[F], e);
652
652
  Object.freeze && Object.freeze(S);
653
653
  } else
654
- R("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
654
+ b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
655
655
  else
656
656
  je(S, e);
657
657
  }
@@ -671,19 +671,14 @@ Check the top-level render call using <` + t + ">.");
671
671
  (function(l) {
672
672
  process.env.NODE_ENV === "production" ? l.exports = Fr() : l.exports = Ir();
673
673
  })(H);
674
- const Le = H.exports.Fragment, a = H.exports.jsx, O = H.exports.jsxs;
674
+ const Le = H.exports.Fragment, a = H.exports.jsx, P = H.exports.jsxs;
675
675
  function zr({
676
676
  postSubmit: l,
677
677
  styles: o = J
678
678
  }) {
679
679
  const {
680
680
  control: v,
681
- handleSubmit: d,
682
- formState: {
683
- errors: _,
684
- isValidating: h,
685
- isValid: m
686
- }
681
+ handleSubmit: d
687
682
  } = Pr({
688
683
  defaultValues: {
689
684
  type: "postgresql",
@@ -699,18 +694,18 @@ function zr({
699
694
  });
700
695
  return /* @__PURE__ */ a(Ie, {
701
696
  mx: "auto",
702
- children: /* @__PURE__ */ O("form", {
697
+ children: /* @__PURE__ */ P("form", {
703
698
  onSubmit: d(async ({
704
699
  type: u,
705
- key: P,
706
- config: b
700
+ key: m,
701
+ config: _
707
702
  }) => {
708
703
  if (ze({
709
704
  id: "for-creating",
710
705
  title: "Pending",
711
706
  message: "Adding data source...",
712
707
  loading: !0
713
- }), !await se.datasource.create(u, P, b)) {
708
+ }), !await se.datasource.create(u, m, _)) {
714
709
  ae({
715
710
  id: "for-creating",
716
711
  title: "Failed",
@@ -726,7 +721,7 @@ function zr({
726
721
  color: "green"
727
722
  }), l();
728
723
  }),
729
- children: [/* @__PURE__ */ a(D, {
724
+ children: [/* @__PURE__ */ a(j, {
730
725
  name: "type",
731
726
  control: v,
732
727
  render: ({
@@ -748,7 +743,7 @@ function zr({
748
743
  }],
749
744
  ...u
750
745
  })
751
- }), /* @__PURE__ */ a(D, {
746
+ }), /* @__PURE__ */ a(j, {
752
747
  name: "key",
753
748
  control: v,
754
749
  render: ({
@@ -764,9 +759,9 @@ function zr({
764
759
  }), /* @__PURE__ */ a(_r, {
765
760
  label: "Connection Info",
766
761
  labelPosition: "center"
767
- }), /* @__PURE__ */ O(G, {
762
+ }), /* @__PURE__ */ P(G, {
768
763
  grow: !0,
769
- children: [/* @__PURE__ */ a(D, {
764
+ children: [/* @__PURE__ */ a(j, {
770
765
  name: "config.host",
771
766
  control: v,
772
767
  render: ({
@@ -781,7 +776,7 @@ function zr({
781
776
  },
782
777
  ...u
783
778
  })
784
- }), /* @__PURE__ */ a(D, {
779
+ }), /* @__PURE__ */ a(j, {
785
780
  name: "config.port",
786
781
  control: v,
787
782
  render: ({
@@ -798,7 +793,7 @@ function zr({
798
793
  ...u
799
794
  })
800
795
  })]
801
- }), /* @__PURE__ */ a(D, {
796
+ }), /* @__PURE__ */ a(j, {
802
797
  name: "config.username",
803
798
  control: v,
804
799
  render: ({
@@ -810,7 +805,7 @@ function zr({
810
805
  label: "Username",
811
806
  ...u
812
807
  })
813
- }), /* @__PURE__ */ a(D, {
808
+ }), /* @__PURE__ */ a(j, {
814
809
  name: "config.password",
815
810
  control: v,
816
811
  render: ({
@@ -822,7 +817,7 @@ function zr({
822
817
  label: "Password",
823
818
  ...u
824
819
  })
825
- }), /* @__PURE__ */ a(D, {
820
+ }), /* @__PURE__ */ a(j, {
826
821
  name: "config.database",
827
822
  control: v,
828
823
  render: ({
@@ -850,26 +845,26 @@ function Lr({
850
845
  onSuccess: l,
851
846
  styles: o = J
852
847
  }) {
853
- const [v, d] = oe.useState(!1), _ = () => d(!0), h = () => d(!1);
854
- return /* @__PURE__ */ O(Le, {
848
+ const [v, d] = oe.useState(!1), E = () => d(!0), u = () => d(!1);
849
+ return /* @__PURE__ */ P(Le, {
855
850
  children: [/* @__PURE__ */ a(Rr, {
856
851
  overflow: "inside",
857
852
  opened: v,
858
853
  onClose: () => d(!1),
859
854
  title: "Add a data source",
860
855
  trapFocus: !0,
861
- onDragStart: (y) => {
862
- y.stopPropagation();
856
+ onDragStart: (_) => {
857
+ _.stopPropagation();
863
858
  },
864
859
  children: /* @__PURE__ */ a(zr, {
865
860
  postSubmit: () => {
866
- l(), h();
861
+ l(), u();
867
862
  },
868
863
  styles: o
869
864
  })
870
865
  }), /* @__PURE__ */ a(ie, {
871
866
  size: o.size,
872
- onClick: _,
867
+ onClick: E,
873
868
  leftIcon: /* @__PURE__ */ a(Or, {
874
869
  size: 20
875
870
  }),
@@ -883,7 +878,7 @@ function Wr({
883
878
  onSuccess: v,
884
879
  styles: d = J
885
880
  }) {
886
- const _ = kr(), h = async () => {
881
+ const E = kr(), u = async () => {
887
882
  !l || (ze({
888
883
  id: "for-deleting",
889
884
  title: "Pending",
@@ -895,7 +890,7 @@ function Wr({
895
890
  message: `Data source [${o}] is deleted`,
896
891
  color: "green"
897
892
  }), v());
898
- }, m = () => _.openConfirmModal({
893
+ }, m = () => E.openConfirmModal({
899
894
  title: "Delete this data source?",
900
895
  children: /* @__PURE__ */ a(Tr, {
901
896
  size: d.size,
@@ -906,7 +901,7 @@ function Wr({
906
901
  cancel: "Cancel"
907
902
  },
908
903
  onCancel: () => console.log("Cancel"),
909
- onConfirm: h
904
+ onConfirm: u
910
905
  });
911
906
  return /* @__PURE__ */ a(ie, {
912
907
  size: d.size,
@@ -925,36 +920,36 @@ function Gr({
925
920
  const {
926
921
  data: v = [],
927
922
  loading: d,
928
- refresh: _
923
+ refresh: E
929
924
  } = Dr(async () => {
930
925
  const {
931
- data: h
926
+ data: u
932
927
  } = await se.datasource.list();
933
- return h;
928
+ return u;
934
929
  }, {
935
930
  refreshDeps: []
936
931
  });
937
- return $.baseURL !== o.apiBaseURL && ($.baseURL = o.apiBaseURL), /* @__PURE__ */ O(Le, {
932
+ return $.baseURL !== o.apiBaseURL && ($.baseURL = o.apiBaseURL), /* @__PURE__ */ P(Le, {
938
933
  children: [/* @__PURE__ */ a(G, {
939
934
  pt: l.spacing,
940
935
  position: "right",
941
936
  children: /* @__PURE__ */ a(Lr, {
942
- onSuccess: _
937
+ onSuccess: E
943
938
  })
944
- }), /* @__PURE__ */ O(Ie, {
939
+ }), /* @__PURE__ */ P(Ie, {
945
940
  mt: l.spacing,
946
941
  sx: {
947
942
  position: "relative"
948
943
  },
949
944
  children: [/* @__PURE__ */ a(wr, {
950
945
  visible: d
951
- }), /* @__PURE__ */ O(Cr, {
946
+ }), /* @__PURE__ */ P(Cr, {
952
947
  horizontalSpacing: l.spacing,
953
948
  verticalSpacing: l.spacing,
954
949
  fontSize: l.size,
955
950
  highlightOnHover: !0,
956
951
  children: [/* @__PURE__ */ a("thead", {
957
- children: /* @__PURE__ */ O("tr", {
952
+ children: /* @__PURE__ */ P("tr", {
958
953
  children: [/* @__PURE__ */ a("th", {
959
954
  children: "Type"
960
955
  }), /* @__PURE__ */ a("th", {
@@ -965,13 +960,13 @@ function Gr({
965
960
  })
966
961
  }), /* @__PURE__ */ a("tbody", {
967
962
  children: v.map(({
968
- id: h,
963
+ id: u,
969
964
  key: m,
970
- type: y
971
- }) => /* @__PURE__ */ O("tr", {
965
+ type: _
966
+ }) => /* @__PURE__ */ P("tr", {
972
967
  children: [/* @__PURE__ */ a("td", {
973
968
  width: 200,
974
- children: y
969
+ children: _
975
970
  }), /* @__PURE__ */ a("td", {
976
971
  children: m
977
972
  }), /* @__PURE__ */ a("td", {
@@ -979,9 +974,9 @@ function Gr({
979
974
  children: /* @__PURE__ */ a(G, {
980
975
  position: "left",
981
976
  children: /* @__PURE__ */ a(Wr, {
982
- id: h,
977
+ id: u,
983
978
  name: m,
984
- onSuccess: _
979
+ onSuccess: E
985
980
  })
986
981
  })
987
982
  })]
@@ -1,4 +1,4 @@
1
- (function(b,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("@mantine/core"),require("react-hook-form"),require("@mantine/notifications"),require("react"),require("tabler-icons-react"),require("axios"),require("ahooks"),require("@mantine/modals")):typeof define=="function"&&define.amd?define(["exports","@mantine/core","react-hook-form","@mantine/notifications","react","tabler-icons-react","axios","ahooks","@mantine/modals"],d):(b=typeof globalThis<"u"?globalThis:b||self,d(b["settings-form"]={},b["@mantine/core"],b["react-hook-form"],b["@mantine/notifications"],b.React,b["tabler-icons-react"],b.axios,b.ahooks,b["@mantine/modals"]))})(this,function(b,d,x,q,Ne,se,$e,We,Ue){"use strict";const ue=o=>o&&typeof o=="object"&&"default"in o?o:{default:o},Q=ue(Ne),Me=ue($e),L={baseURL:"http://localhost:31200",getRequest(o){return(s,v,p={})=>{const S={"X-Requested-With":"XMLHttpRequest","Content-Type":p.string?"application/x-www-form-urlencoded":"application/json",...p.headers},R={baseURL:this.baseURL,method:o,url:s,params:o==="GET"?v:p.params,headers:S};return o==="POST"&&(R.data=p.string?JSON.stringify(v):v),Me.default(R).then(m=>m.data).catch(m=>Promise.reject(m))}}},Z={datasource:{list:async()=>await L.getRequest("POST")("/datasource/list",{filter:{},sort:{field:"create_time",order:"ASC"},pagination:{page:1,pagesize:100}}),create:async(o,s,v)=>{try{return await L.getRequest("POST")("/datasource/create",{type:o,key:s,config:v})}catch(p){return console.error(p),!1}},delete:async o=>{await L.getRequest("POST")("/datasource/delete",{id:o})}}},M={size:"sm",spacing:"md"};var Y={exports:{}},N={};/**
1
+ (function(b,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("@mantine/core"),require("@mantine/notifications"),require("react"),require("react-hook-form"),require("tabler-icons-react"),require("axios"),require("ahooks"),require("@mantine/modals")):typeof define=="function"&&define.amd?define(["exports","@mantine/core","@mantine/notifications","react","react-hook-form","tabler-icons-react","axios","ahooks","@mantine/modals"],d):(b=typeof globalThis<"u"?globalThis:b||self,d(b["settings-form"]={},b["@mantine/core"],b["@mantine/notifications"],b.React,b["react-hook-form"],b["tabler-icons-react"],b.axios,b.ahooks,b["@mantine/modals"]))})(this,function(b,d,q,Ne,x,se,$e,We,Ue){"use strict";const ue=o=>o&&typeof o=="object"&&"default"in o?o:{default:o},Q=ue(Ne),Me=ue($e),L={baseURL:"http://localhost:31200",getRequest(o){return(s,v,p={})=>{const _={"X-Requested-With":"XMLHttpRequest","Content-Type":p.string?"application/x-www-form-urlencoded":"application/json",...p.headers},l={baseURL:this.baseURL,method:o,url:s,params:o==="GET"?v:p.params,headers:_};return o==="POST"&&(l.data=p.string?JSON.stringify(v):v),Me.default(l).then(m=>m.data).catch(m=>Promise.reject(m))}}},Z={datasource:{list:async()=>await L.getRequest("POST")("/datasource/list",{filter:{},sort:{field:"create_time",order:"ASC"},pagination:{page:1,pagesize:100}}),create:async(o,s,v)=>{try{return await L.getRequest("POST")("/datasource/create",{type:o,key:s,config:v})}catch(p){return console.error(p),!1}},delete:async o=>{await L.getRequest("POST")("/datasource/delete",{id:o})}}},M={size:"sm",spacing:"md"};var Y={exports:{}},N={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var le;function Ye(){if(le)return N;le=1;var o=Q.default,s=Symbol.for("react.element"),v=Symbol.for("react.fragment"),p=Object.prototype.hasOwnProperty,S=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,R={key:!0,ref:!0,__self:!0,__source:!0};function m(T,l,j){var _,w={},A=null,V=null;j!==void 0&&(A=""+j),l.key!==void 0&&(A=""+l.key),l.ref!==void 0&&(V=l.ref);for(_ in l)p.call(l,_)&&!R.hasOwnProperty(_)&&(w[_]=l[_]);if(T&&T.defaultProps)for(_ in l=T.defaultProps,l)w[_]===void 0&&(w[_]=l[_]);return{$$typeof:s,type:T,key:A,ref:V,props:w,_owner:S.current}}return N.Fragment=v,N.jsx=m,N.jsxs=m,N}var $={};/**
9
+ */var le;function Ye(){if(le)return N;le=1;var o=Q.default,s=Symbol.for("react.element"),v=Symbol.for("react.fragment"),p=Object.prototype.hasOwnProperty,_=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function m(S,R,k){var T,w={},j=null,V=null;k!==void 0&&(j=""+k),R.key!==void 0&&(j=""+R.key),R.ref!==void 0&&(V=R.ref);for(T in R)p.call(R,T)&&!l.hasOwnProperty(T)&&(w[T]=R[T]);if(S&&S.defaultProps)for(T in R=S.defaultProps,R)w[T]===void 0&&(w[T]=R[T]);return{$$typeof:s,type:S,key:j,ref:V,props:w,_owner:_.current}}return N.Fragment=v,N.jsx=m,N.jsxs=m,N}var $={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,14 +14,14 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var ce;function Ve(){return ce||(ce=1,process.env.NODE_ENV!=="production"&&function(){var o=Q.default,s=Symbol.for("react.element"),v=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),T=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),V=Symbol.for("react.offscreen"),ve=Symbol.iterator,Je="@@iterator";function Xe(e){if(e===null||typeof e!="object")return null;var r=ve&&e[ve]||e[Je];return typeof r=="function"?r:null}var I=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];Ke("error",e,t)}}function Ke(e,r,t){{var n=I.ReactDebugCurrentFrame,c=n.getStackAddendum();c!==""&&(r+="%s",t=t.concat([c]));var f=t.map(function(u){return String(u)});f.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,f)}}var Qe=!1,Ze=!1,He=!1,er=!1,rr=!1,he;he=Symbol.for("react.module.reference");function tr(e){return!!(typeof e=="string"||typeof e=="function"||e===p||e===R||rr||e===S||e===j||e===_||er||e===V||Qe||Ze||He||typeof e=="object"&&e!==null&&(e.$$typeof===A||e.$$typeof===w||e.$$typeof===m||e.$$typeof===T||e.$$typeof===l||e.$$typeof===he||e.getModuleId!==void 0))}function nr(e,r,t){var n=e.displayName;if(n)return n;var c=r.displayName||r.name||"";return c!==""?t+"("+c+")":t}function ge(e){return e.displayName||"Context"}function P(e){if(e==null)return null;if(typeof e.tag=="number"&&y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case p:return"Fragment";case v:return"Portal";case R:return"Profiler";case S:return"StrictMode";case j:return"Suspense";case _:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case T:var r=e;return ge(r)+".Consumer";case m:var t=e;return ge(t._context)+".Provider";case l:return nr(e,e.render,"ForwardRef");case w:var n=e.displayName||null;return n!==null?n:P(e.type)||"Memo";case A:{var c=e,f=c._payload,u=c._init;try{return P(u(f))}catch{return null}}}return null}var k=Object.assign,W=0,me,be,Re,_e,ye,Ee,Se;function Te(){}Te.__reactDisabledLog=!0;function ar(){{if(W===0){me=console.log,be=console.info,Re=console.warn,_e=console.error,ye=console.group,Ee=console.groupCollapsed,Se=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Te,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}W++}}function ir(){{if(W--,W===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:k({},e,{value:me}),info:k({},e,{value:be}),warn:k({},e,{value:Re}),error:k({},e,{value:_e}),group:k({},e,{value:ye}),groupCollapsed:k({},e,{value:Ee}),groupEnd:k({},e,{value:Se})})}W<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var H=I.ReactCurrentDispatcher,ee;function B(e,r,t){{if(ee===void 0)try{throw Error()}catch(c){var n=c.stack.trim().match(/\n( *(at )?)/);ee=n&&n[1]||""}return`
17
+ */var ce;function Ve(){return ce||(ce=1,process.env.NODE_ENV!=="production"&&function(){var o=Q.default,s=Symbol.for("react.element"),v=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),S=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),V=Symbol.for("react.offscreen"),ve=Symbol.iterator,Je="@@iterator";function Xe(e){if(e===null||typeof e!="object")return null;var r=ve&&e[ve]||e[Je];return typeof r=="function"?r:null}var I=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];Ke("error",e,t)}}function Ke(e,r,t){{var n=I.ReactDebugCurrentFrame,c=n.getStackAddendum();c!==""&&(r+="%s",t=t.concat([c]));var f=t.map(function(u){return String(u)});f.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,f)}}var Qe=!1,Ze=!1,He=!1,er=!1,rr=!1,he;he=Symbol.for("react.module.reference");function tr(e){return!!(typeof e=="string"||typeof e=="function"||e===p||e===l||rr||e===_||e===k||e===T||er||e===V||Qe||Ze||He||typeof e=="object"&&e!==null&&(e.$$typeof===j||e.$$typeof===w||e.$$typeof===m||e.$$typeof===S||e.$$typeof===R||e.$$typeof===he||e.getModuleId!==void 0))}function nr(e,r,t){var n=e.displayName;if(n)return n;var c=r.displayName||r.name||"";return c!==""?t+"("+c+")":t}function ge(e){return e.displayName||"Context"}function P(e){if(e==null)return null;if(typeof e.tag=="number"&&y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case p:return"Fragment";case v:return"Portal";case l:return"Profiler";case _:return"StrictMode";case k:return"Suspense";case T:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case S:var r=e;return ge(r)+".Consumer";case m:var t=e;return ge(t._context)+".Provider";case R:return nr(e,e.render,"ForwardRef");case w:var n=e.displayName||null;return n!==null?n:P(e.type)||"Memo";case j:{var c=e,f=c._payload,u=c._init;try{return P(u(f))}catch{return null}}}return null}var A=Object.assign,W=0,me,be,Re,_e,ye,Ee,Se;function Te(){}Te.__reactDisabledLog=!0;function ar(){{if(W===0){me=console.log,be=console.info,Re=console.warn,_e=console.error,ye=console.group,Ee=console.groupCollapsed,Se=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Te,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}W++}}function ir(){{if(W--,W===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:A({},e,{value:me}),info:A({},e,{value:be}),warn:A({},e,{value:Re}),error:A({},e,{value:_e}),group:A({},e,{value:ye}),groupCollapsed:A({},e,{value:Ee}),groupEnd:A({},e,{value:Se})})}W<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var H=I.ReactCurrentDispatcher,ee;function B(e,r,t){{if(ee===void 0)try{throw Error()}catch(c){var n=c.stack.trim().match(/\n( *(at )?)/);ee=n&&n[1]||""}return`
18
18
  `+ee+e}}var re=!1,G;{var or=typeof WeakMap=="function"?WeakMap:Map;G=new or}function Ce(e,r){if(!e||re)return"";{var t=G.get(e);if(t!==void 0)return t}var n;re=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var f;f=H.current,H.current=null,ar();try{if(r){var u=function(){throw Error()};if(Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(O){n=O}Reflect.construct(e,[],u)}else{try{u.call()}catch(O){n=O}e.call(u.prototype)}}else{try{throw Error()}catch(O){n=O}e()}}catch(O){if(O&&n&&typeof O.stack=="string"){for(var i=O.stack.split(`
19
19
  `),E=n.stack.split(`
20
20
  `),h=i.length-1,g=E.length-1;h>=1&&g>=0&&i[h]!==E[g];)g--;for(;h>=1&&g>=0;h--,g--)if(i[h]!==E[g]){if(h!==1||g!==1)do if(h--,g--,g<0||i[h]!==E[g]){var C=`
21
- `+i[h].replace(" at new "," at ");return e.displayName&&C.includes("<anonymous>")&&(C=C.replace("<anonymous>",e.displayName)),typeof e=="function"&&G.set(e,C),C}while(h>=1&&g>=0);break}}}finally{re=!1,H.current=f,ir(),Error.prepareStackTrace=c}var z=e?e.displayName||e.name:"",Le=z?B(z):"";return typeof e=="function"&&G.set(e,Le),Le}function sr(e,r,t){return Ce(e,!1)}function ur(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function J(e,r,t){if(e==null)return"";if(typeof e=="function")return Ce(e,ur(e));if(typeof e=="string")return B(e);switch(e){case j:return B("Suspense");case _:return B("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case l:return sr(e.render);case w:return J(e.type,r,t);case A:{var n=e,c=n._payload,f=n._init;try{return J(f(c),r,t)}catch{}}}return""}var X=Object.prototype.hasOwnProperty,we={},Pe=I.ReactDebugCurrentFrame;function K(e){if(e){var r=e._owner,t=J(e.type,e._source,r?r.type:null);Pe.setExtraStackFrame(t)}else Pe.setExtraStackFrame(null)}function lr(e,r,t,n,c){{var f=Function.call.bind(X);for(var u in e)if(f(e,u)){var i=void 0;try{if(typeof e[u]!="function"){var E=Error((n||"React class")+": "+t+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw E.name="Invariant Violation",E}i=e[u](r,u,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(h){i=h}i&&!(i instanceof Error)&&(K(c),y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,u,typeof i),K(null)),i instanceof Error&&!(i.message in we)&&(we[i.message]=!0,K(c),y("Failed %s type: %s",t,i.message),K(null))}}}var cr=Array.isArray;function te(e){return cr(e)}function fr(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function dr(e){try{return Oe(e),!1}catch{return!0}}function Oe(e){return""+e}function xe(e){if(dr(e))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",fr(e)),Oe(e)}var U=I.ReactCurrentOwner,pr={key:!0,ref:!0,__self:!0,__source:!0},De,je,ne;ne={};function vr(e){if(X.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function hr(e){if(X.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function gr(e,r){if(typeof e.ref=="string"&&U.current&&r&&U.current.stateNode!==r){var t=P(U.current.type);ne[t]||(y('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',P(U.current.type),e.ref),ne[t]=!0)}}function mr(e,r){{var t=function(){De||(De=!0,y("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function br(e,r){{var t=function(){je||(je=!0,y("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var Rr=function(e,r,t,n,c,f,u){var i={$$typeof:s,type:e,key:r,ref:t,props:u,_owner:f};return i._store={},Object.defineProperty(i._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(i,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(i,"_source",{configurable:!1,enumerable:!1,writable:!1,value:c}),Object.freeze&&(Object.freeze(i.props),Object.freeze(i)),i};function _r(e,r,t,n,c){{var f,u={},i=null,E=null;t!==void 0&&(xe(t),i=""+t),hr(r)&&(xe(r.key),i=""+r.key),vr(r)&&(E=r.ref,gr(r,c));for(f in r)X.call(r,f)&&!pr.hasOwnProperty(f)&&(u[f]=r[f]);if(e&&e.defaultProps){var h=e.defaultProps;for(f in h)u[f]===void 0&&(u[f]=h[f])}if(i||E){var g=typeof e=="function"?e.displayName||e.name||"Unknown":e;i&&mr(u,g),E&&br(u,g)}return Rr(e,i,E,c,n,U.current,u)}}var ae=I.ReactCurrentOwner,Ae=I.ReactDebugCurrentFrame;function F(e){if(e){var r=e._owner,t=J(e.type,e._source,r?r.type:null);Ae.setExtraStackFrame(t)}else Ae.setExtraStackFrame(null)}var ie;ie=!1;function oe(e){return typeof e=="object"&&e!==null&&e.$$typeof===s}function ke(){{if(ae.current){var e=P(ae.current.type);if(e)return`
21
+ `+i[h].replace(" at new "," at ");return e.displayName&&C.includes("<anonymous>")&&(C=C.replace("<anonymous>",e.displayName)),typeof e=="function"&&G.set(e,C),C}while(h>=1&&g>=0);break}}}finally{re=!1,H.current=f,ir(),Error.prepareStackTrace=c}var z=e?e.displayName||e.name:"",Le=z?B(z):"";return typeof e=="function"&&G.set(e,Le),Le}function sr(e,r,t){return Ce(e,!1)}function ur(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function J(e,r,t){if(e==null)return"";if(typeof e=="function")return Ce(e,ur(e));if(typeof e=="string")return B(e);switch(e){case k:return B("Suspense");case T:return B("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case R:return sr(e.render);case w:return J(e.type,r,t);case j:{var n=e,c=n._payload,f=n._init;try{return J(f(c),r,t)}catch{}}}return""}var X=Object.prototype.hasOwnProperty,we={},Pe=I.ReactDebugCurrentFrame;function K(e){if(e){var r=e._owner,t=J(e.type,e._source,r?r.type:null);Pe.setExtraStackFrame(t)}else Pe.setExtraStackFrame(null)}function lr(e,r,t,n,c){{var f=Function.call.bind(X);for(var u in e)if(f(e,u)){var i=void 0;try{if(typeof e[u]!="function"){var E=Error((n||"React class")+": "+t+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw E.name="Invariant Violation",E}i=e[u](r,u,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(h){i=h}i&&!(i instanceof Error)&&(K(c),y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,u,typeof i),K(null)),i instanceof Error&&!(i.message in we)&&(we[i.message]=!0,K(c),y("Failed %s type: %s",t,i.message),K(null))}}}var cr=Array.isArray;function te(e){return cr(e)}function fr(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function dr(e){try{return Oe(e),!1}catch{return!0}}function Oe(e){return""+e}function xe(e){if(dr(e))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",fr(e)),Oe(e)}var U=I.ReactCurrentOwner,pr={key:!0,ref:!0,__self:!0,__source:!0},De,je,ne;ne={};function vr(e){if(X.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function hr(e){if(X.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function gr(e,r){if(typeof e.ref=="string"&&U.current&&r&&U.current.stateNode!==r){var t=P(U.current.type);ne[t]||(y('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',P(U.current.type),e.ref),ne[t]=!0)}}function mr(e,r){{var t=function(){De||(De=!0,y("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function br(e,r){{var t=function(){je||(je=!0,y("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var Rr=function(e,r,t,n,c,f,u){var i={$$typeof:s,type:e,key:r,ref:t,props:u,_owner:f};return i._store={},Object.defineProperty(i._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(i,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(i,"_source",{configurable:!1,enumerable:!1,writable:!1,value:c}),Object.freeze&&(Object.freeze(i.props),Object.freeze(i)),i};function _r(e,r,t,n,c){{var f,u={},i=null,E=null;t!==void 0&&(xe(t),i=""+t),hr(r)&&(xe(r.key),i=""+r.key),vr(r)&&(E=r.ref,gr(r,c));for(f in r)X.call(r,f)&&!pr.hasOwnProperty(f)&&(u[f]=r[f]);if(e&&e.defaultProps){var h=e.defaultProps;for(f in h)u[f]===void 0&&(u[f]=h[f])}if(i||E){var g=typeof e=="function"?e.displayName||e.name||"Unknown":e;i&&mr(u,g),E&&br(u,g)}return Rr(e,i,E,c,n,U.current,u)}}var ae=I.ReactCurrentOwner,Ae=I.ReactDebugCurrentFrame;function F(e){if(e){var r=e._owner,t=J(e.type,e._source,r?r.type:null);Ae.setExtraStackFrame(t)}else Ae.setExtraStackFrame(null)}var ie;ie=!1;function oe(e){return typeof e=="object"&&e!==null&&e.$$typeof===s}function ke(){{if(ae.current){var e=P(ae.current.type);if(e)return`
22
22
 
23
23
  Check the render method of \``+e+"`."}return""}}function yr(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return`
24
24
 
25
25
  Check your code at `+r+":"+t+"."}return""}}var Ie={};function Er(e){{var r=ke();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
26
26
 
27
- Check the top-level render call using <`+t+">.")}return r}}function Fe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=Er(r);if(Ie[t])return;Ie[t]=!0;var n="";e&&e._owner&&e._owner!==ae.current&&(n=" It was passed a child from "+P(e._owner.type)+"."),F(e),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),F(null)}}function ze(e,r){{if(typeof e!="object")return;if(te(e))for(var t=0;t<e.length;t++){var n=e[t];oe(n)&&Fe(n,r)}else if(oe(e))e._store&&(e._store.validated=!0);else if(e){var c=Xe(e);if(typeof c=="function"&&c!==e.entries)for(var f=c.call(e),u;!(u=f.next()).done;)oe(u.value)&&Fe(u.value,r)}}}function Sr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===l||r.$$typeof===w))t=r.propTypes;else return;if(t){var n=P(r);lr(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!ie){ie=!0;var c=P(r);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",c||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Tr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){F(e),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),F(null);break}}e.ref!==null&&(F(e),y("Invalid attribute `ref` supplied to `React.Fragment`."),F(null))}}function qe(e,r,t,n,c,f){{var u=tr(e);if(!u){var i="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(i+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var E=yr(c);E?i+=E:i+=ke();var h;e===null?h="null":te(e)?h="array":e!==void 0&&e.$$typeof===s?(h="<"+(P(e.type)||"Unknown")+" />",i=" Did you accidentally export a JSX literal instead of a component?"):h=typeof e,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",h,i)}var g=_r(e,r,t,c,f);if(g==null)return g;if(u){var C=r.children;if(C!==void 0)if(n)if(te(C)){for(var z=0;z<C.length;z++)ze(C[z],e);Object.freeze&&Object.freeze(C)}else y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ze(C,e)}return e===p?Tr(g):Sr(g),g}}function Cr(e,r,t){return qe(e,r,t,!0)}function wr(e,r,t){return qe(e,r,t,!1)}var Pr=wr,Or=Cr;$.Fragment=p,$.jsx=Pr,$.jsxs=Or}()),$}(function(o){process.env.NODE_ENV==="production"?o.exports=Ye():o.exports=Ve()})(Y);const fe=Y.exports.Fragment,a=Y.exports.jsx,D=Y.exports.jsxs;function Be({postSubmit:o,styles:s=M}){const{control:v,handleSubmit:p,formState:{errors:S,isValidating:R,isValid:m}}=x.useForm({defaultValues:{type:"postgresql",key:"",config:{host:"",port:5432,username:"",password:"",database:""}}}),T=async({type:l,key:j,config:_})=>{if(q.showNotification({id:"for-creating",title:"Pending",message:"Adding data source...",loading:!0}),!await Z.datasource.create(l,j,_)){q.updateNotification({id:"for-creating",title:"Failed",message:"Test connection failed with given info",color:"red"});return}q.updateNotification({id:"for-creating",title:"Successful",message:"Data source is added",color:"green"}),o()};return a(d.Box,{mx:"auto",children:D("form",{onSubmit:p(T),children:[a(x.Controller,{name:"type",control:v,render:({field:l})=>a(d.SegmentedControl,{fullWidth:!0,mb:s.spacing,size:s.size,data:[{label:"PostgreSQL",value:"postgresql"},{label:"MySQL",value:"mysql"},{label:"HTTP",value:"http",disabled:!0}],...l})}),a(x.Controller,{name:"key",control:v,render:({field:l})=>a(d.TextInput,{mb:s.spacing,size:s.size,required:!0,label:"Name",placeholder:"A unique name",...l})}),a(d.Divider,{label:"Connection Info",labelPosition:"center"}),D(d.Group,{grow:!0,children:[a(x.Controller,{name:"config.host",control:v,render:({field:l})=>a(d.TextInput,{mb:s.spacing,size:s.size,required:!0,label:"Host",sx:{flexGrow:1},...l})}),a(x.Controller,{name:"config.port",control:v,render:({field:l})=>a(d.NumberInput,{mb:s.spacing,size:s.size,required:!0,label:"Port",hideControls:!0,sx:{width:"8em"},...l})})]}),a(x.Controller,{name:"config.username",control:v,render:({field:l})=>a(d.TextInput,{mb:s.spacing,size:s.size,required:!0,label:"Username",...l})}),a(x.Controller,{name:"config.password",control:v,render:({field:l})=>a(d.PasswordInput,{mb:s.spacing,size:s.size,required:!0,label:"Password",...l})}),a(x.Controller,{name:"config.database",control:v,render:({field:l})=>a(d.TextInput,{mb:s.spacing,size:s.size,required:!0,label:"Database",...l})}),a(d.Group,{position:"right",mt:s.spacing,children:a(d.Button,{type:"submit",size:s.size,children:"Save"})})]})})}function de({onSuccess:o,styles:s=M}){const[v,p]=Q.default.useState(!1),S=()=>p(!0),R=()=>p(!1),m=()=>{o(),R()};return D(fe,{children:[a(d.Modal,{overflow:"inside",opened:v,onClose:()=>p(!1),title:"Add a data source",trapFocus:!0,onDragStart:T=>{T.stopPropagation()},children:a(Be,{postSubmit:m,styles:s})}),a(d.Button,{size:s.size,onClick:S,leftIcon:a(se.PlaylistAdd,{size:20}),children:"Add a Data Source"})]})}function pe({id:o,name:s,onSuccess:v,styles:p=M}){const S=Ue.useModals(),R=async()=>{!o||(q.showNotification({id:"for-deleting",title:"Pending",message:"Deleting data source...",loading:!0}),await Z.datasource.delete(o),q.updateNotification({id:"for-deleting",title:"Successful",message:`Data source [${s}] is deleted`,color:"green"}),v())},m=()=>S.openConfirmModal({title:"Delete this data source?",children:a(d.Text,{size:p.size,children:"This action won't affect your database."}),labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:R});return a(d.Button,{size:p.size,color:"red",onClick:m,leftIcon:a(se.Trash,{size:20}),children:"Delete"})}function Ge({styles:o=M,config:s}){const{data:v=[],loading:p,refresh:S}=We.useRequest(async()=>{const{data:R}=await Z.datasource.list();return R},{refreshDeps:[]});return L.baseURL!==s.apiBaseURL&&(L.baseURL=s.apiBaseURL),D(fe,{children:[a(d.Group,{pt:o.spacing,position:"right",children:a(de,{onSuccess:S})}),D(d.Box,{mt:o.spacing,sx:{position:"relative"},children:[a(d.LoadingOverlay,{visible:p}),D(d.Table,{horizontalSpacing:o.spacing,verticalSpacing:o.spacing,fontSize:o.size,highlightOnHover:!0,children:[a("thead",{children:D("tr",{children:[a("th",{children:"Type"}),a("th",{children:"Name"}),a("th",{children:"Action"})]})}),a("tbody",{children:v.map(({id:R,key:m,type:T})=>D("tr",{children:[a("td",{width:200,children:T}),a("td",{children:m}),a("td",{width:200,children:a(d.Group,{position:"left",children:a(pe,{id:R,name:m,onSuccess:S})})})]},m))})]})]})]})}b.AddDataSource=de,b.DataSourceList=Ge,b.DeleteDataSource=pe,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
27
+ Check the top-level render call using <`+t+">.")}return r}}function Fe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=Er(r);if(Ie[t])return;Ie[t]=!0;var n="";e&&e._owner&&e._owner!==ae.current&&(n=" It was passed a child from "+P(e._owner.type)+"."),F(e),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),F(null)}}function ze(e,r){{if(typeof e!="object")return;if(te(e))for(var t=0;t<e.length;t++){var n=e[t];oe(n)&&Fe(n,r)}else if(oe(e))e._store&&(e._store.validated=!0);else if(e){var c=Xe(e);if(typeof c=="function"&&c!==e.entries)for(var f=c.call(e),u;!(u=f.next()).done;)oe(u.value)&&Fe(u.value,r)}}}function Sr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===R||r.$$typeof===w))t=r.propTypes;else return;if(t){var n=P(r);lr(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!ie){ie=!0;var c=P(r);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",c||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Tr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){F(e),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),F(null);break}}e.ref!==null&&(F(e),y("Invalid attribute `ref` supplied to `React.Fragment`."),F(null))}}function qe(e,r,t,n,c,f){{var u=tr(e);if(!u){var i="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(i+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var E=yr(c);E?i+=E:i+=ke();var h;e===null?h="null":te(e)?h="array":e!==void 0&&e.$$typeof===s?(h="<"+(P(e.type)||"Unknown")+" />",i=" Did you accidentally export a JSX literal instead of a component?"):h=typeof e,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",h,i)}var g=_r(e,r,t,c,f);if(g==null)return g;if(u){var C=r.children;if(C!==void 0)if(n)if(te(C)){for(var z=0;z<C.length;z++)ze(C[z],e);Object.freeze&&Object.freeze(C)}else y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ze(C,e)}return e===p?Tr(g):Sr(g),g}}function Cr(e,r,t){return qe(e,r,t,!0)}function wr(e,r,t){return qe(e,r,t,!1)}var Pr=wr,Or=Cr;$.Fragment=p,$.jsx=Pr,$.jsxs=Or}()),$}(function(o){process.env.NODE_ENV==="production"?o.exports=Ye():o.exports=Ve()})(Y);const fe=Y.exports.Fragment,a=Y.exports.jsx,D=Y.exports.jsxs;function Be({postSubmit:o,styles:s=M}){const{control:v,handleSubmit:p}=x.useForm({defaultValues:{type:"postgresql",key:"",config:{host:"",port:5432,username:"",password:"",database:""}}}),_=async({type:l,key:m,config:S})=>{if(q.showNotification({id:"for-creating",title:"Pending",message:"Adding data source...",loading:!0}),!await Z.datasource.create(l,m,S)){q.updateNotification({id:"for-creating",title:"Failed",message:"Test connection failed with given info",color:"red"});return}q.updateNotification({id:"for-creating",title:"Successful",message:"Data source is added",color:"green"}),o()};return a(d.Box,{mx:"auto",children:D("form",{onSubmit:p(_),children:[a(x.Controller,{name:"type",control:v,render:({field:l})=>a(d.SegmentedControl,{fullWidth:!0,mb:s.spacing,size:s.size,data:[{label:"PostgreSQL",value:"postgresql"},{label:"MySQL",value:"mysql"},{label:"HTTP",value:"http",disabled:!0}],...l})}),a(x.Controller,{name:"key",control:v,render:({field:l})=>a(d.TextInput,{mb:s.spacing,size:s.size,required:!0,label:"Name",placeholder:"A unique name",...l})}),a(d.Divider,{label:"Connection Info",labelPosition:"center"}),D(d.Group,{grow:!0,children:[a(x.Controller,{name:"config.host",control:v,render:({field:l})=>a(d.TextInput,{mb:s.spacing,size:s.size,required:!0,label:"Host",sx:{flexGrow:1},...l})}),a(x.Controller,{name:"config.port",control:v,render:({field:l})=>a(d.NumberInput,{mb:s.spacing,size:s.size,required:!0,label:"Port",hideControls:!0,sx:{width:"8em"},...l})})]}),a(x.Controller,{name:"config.username",control:v,render:({field:l})=>a(d.TextInput,{mb:s.spacing,size:s.size,required:!0,label:"Username",...l})}),a(x.Controller,{name:"config.password",control:v,render:({field:l})=>a(d.PasswordInput,{mb:s.spacing,size:s.size,required:!0,label:"Password",...l})}),a(x.Controller,{name:"config.database",control:v,render:({field:l})=>a(d.TextInput,{mb:s.spacing,size:s.size,required:!0,label:"Database",...l})}),a(d.Group,{position:"right",mt:s.spacing,children:a(d.Button,{type:"submit",size:s.size,children:"Save"})})]})})}function de({onSuccess:o,styles:s=M}){const[v,p]=Q.default.useState(!1),_=()=>p(!0),l=()=>p(!1),m=()=>{o(),l()};return D(fe,{children:[a(d.Modal,{overflow:"inside",opened:v,onClose:()=>p(!1),title:"Add a data source",trapFocus:!0,onDragStart:S=>{S.stopPropagation()},children:a(Be,{postSubmit:m,styles:s})}),a(d.Button,{size:s.size,onClick:_,leftIcon:a(se.PlaylistAdd,{size:20}),children:"Add a Data Source"})]})}function pe({id:o,name:s,onSuccess:v,styles:p=M}){const _=Ue.useModals(),l=async()=>{!o||(q.showNotification({id:"for-deleting",title:"Pending",message:"Deleting data source...",loading:!0}),await Z.datasource.delete(o),q.updateNotification({id:"for-deleting",title:"Successful",message:`Data source [${s}] is deleted`,color:"green"}),v())},m=()=>_.openConfirmModal({title:"Delete this data source?",children:a(d.Text,{size:p.size,children:"This action won't affect your database."}),labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:l});return a(d.Button,{size:p.size,color:"red",onClick:m,leftIcon:a(se.Trash,{size:20}),children:"Delete"})}function Ge({styles:o=M,config:s}){const{data:v=[],loading:p,refresh:_}=We.useRequest(async()=>{const{data:l}=await Z.datasource.list();return l},{refreshDeps:[]});return L.baseURL!==s.apiBaseURL&&(L.baseURL=s.apiBaseURL),D(fe,{children:[a(d.Group,{pt:o.spacing,position:"right",children:a(de,{onSuccess:_})}),D(d.Box,{mt:o.spacing,sx:{position:"relative"},children:[a(d.LoadingOverlay,{visible:p}),D(d.Table,{horizontalSpacing:o.spacing,verticalSpacing:o.spacing,fontSize:o.size,highlightOnHover:!0,children:[a("thead",{children:D("tr",{children:[a("th",{children:"Type"}),a("th",{children:"Name"}),a("th",{children:"Action"})]})}),a("tbody",{children:v.map(({id:l,key:m,type:S})=>D("tr",{children:[a("td",{width:200,children:S}),a("td",{children:m}),a("td",{width:200,children:a(d.Group,{position:"left",children:a(pe,{id:l,name:m,onSuccess:_})})})]},m))})]})]})]})}b.AddDataSource=de,b.DataSourceList=Ge,b.DeleteDataSource=pe,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@devtable/settings-form",
3
- "version": "4.1.1",
3
+ "version": "4.2.0",
4
+ "license": "Apache-2.0",
4
5
  "publishConfig": {
5
6
  "access": "public",
6
7
  "registry": "https://registry.npmjs.org/"