@devtable/settings-form 5.8.3 → 5.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,6 @@ import { DataSourceType, IDataSource, IDataSourceConfig } from './datasource.typ
2
2
  import { PaginationResponse } from './types';
3
3
  export declare const datasource: {
4
4
  list: () => Promise<PaginationResponse<IDataSource>>;
5
- create: (type: DataSourceType, key: string, config: IDataSourceConfig) => Promise<PaginationResponse<IDataSource>>;
5
+ create: (type: DataSourceType, key: string, config: IDataSourceConfig) => Promise<PaginationResponse<IDataSource> | false>;
6
6
  delete: (id: string) => Promise<void>;
7
7
  };
@@ -1,7 +1,7 @@
1
1
  export declare const APICaller: {
2
2
  datasource: {
3
3
  list: () => Promise<import("./types").PaginationResponse<import("./datasource.typed").IDataSource>>;
4
- create: (type: import("./datasource.typed").DataSourceType, key: string, config: import("./datasource.typed").IDataSourceConfig) => Promise<import("./types").PaginationResponse<import("./datasource.typed").IDataSource>>;
4
+ create: (type: import("./datasource.typed").DataSourceType, key: string, config: import("./datasource.typed").IDataSourceConfig) => Promise<false | import("./types").PaginationResponse<import("./datasource.typed").IDataSource>>;
5
5
  delete: (id: string) => Promise<void>;
6
6
  };
7
7
  account: {
@@ -1,5 +1,5 @@
1
1
  import { Modal as se, Button as x, Box as L, SegmentedControl as qr, TextInput as j, Divider as er, Group as I, NumberInput as Lr, PasswordInput as ce, useMantineTheme as Mr, Tooltip as Nr, Text as oe, LoadingOverlay as Re, Table as Pe, Stack as rr, Select as $r, Switch as Ur } from "@mantine/core";
2
- import { showNotification as $, updateNotification as A } from "@mantine/notifications";
2
+ import { showNotification as $, updateNotification as O } from "@mantine/notifications";
3
3
  import J, { forwardRef as tr, useMemo as nr } from "react";
4
4
  import { useForm as ee, Controller as E } from "react-hook-form";
5
5
  import { PlaylistAdd as Ee, Trash as Ce, Edit as Wr } from "tabler-icons-react";
@@ -154,7 +154,11 @@ const Hr = {
154
154
  pagesize: 100
155
155
  }
156
156
  }),
157
- create: async (t, n, o) => C.getRequest("POST")("/datasource/create", { type: t, key: n, config: o }),
157
+ create: async (t, n, o) => await C.getRequest("POST")("/datasource/create", {
158
+ type: t,
159
+ key: n,
160
+ config: o
161
+ }),
158
162
  delete: async (t) => {
159
163
  await C.getRequest("POST")("/datasource/delete", { id: t });
160
164
  }
@@ -189,14 +193,14 @@ function et() {
189
193
  Qe = 1;
190
194
  var t = J, n = Symbol.for("react.element"), o = Symbol.for("react.fragment"), s = Object.prototype.hasOwnProperty, l = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
191
195
  function u(d, g, y) {
192
- var _, v = {}, f = null, O = null;
193
- y !== void 0 && (f = "" + y), g.key !== void 0 && (f = "" + g.key), g.ref !== void 0 && (O = g.ref);
196
+ var _, v = {}, f = null, A = null;
197
+ y !== void 0 && (f = "" + y), g.key !== void 0 && (f = "" + g.key), g.ref !== void 0 && (A = g.ref);
194
198
  for (_ in g)
195
199
  s.call(g, _) && !i.hasOwnProperty(_) && (v[_] = g[_]);
196
200
  if (d && d.defaultProps)
197
201
  for (_ in g = d.defaultProps, g)
198
202
  v[_] === void 0 && (v[_] = g[_]);
199
- return { $$typeof: n, type: d, key: f, ref: O, props: v, _owner: l.current };
203
+ return { $$typeof: n, type: d, key: f, ref: A, props: v, _owner: l.current };
200
204
  }
201
205
  return Q.Fragment = o, Q.jsx = u, Q.jsxs = u, Q;
202
206
  }
@@ -213,7 +217,7 @@ var Z = {};
213
217
  var Ze;
214
218
  function rt() {
215
219
  return Ze || (Ze = 1, process.env.NODE_ENV !== "production" && function() {
216
- var t = J, n = Symbol.for("react.element"), o = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), l = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), d = Symbol.for("react.context"), g = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), _ = Symbol.for("react.suspense_list"), v = Symbol.for("react.memo"), f = Symbol.for("react.lazy"), O = Symbol.for("react.offscreen"), M = Symbol.iterator, V = "@@iterator";
220
+ var t = J, n = Symbol.for("react.element"), o = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), l = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), d = Symbol.for("react.context"), g = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), _ = Symbol.for("react.suspense_list"), v = Symbol.for("react.memo"), f = Symbol.for("react.lazy"), A = Symbol.for("react.offscreen"), M = Symbol.iterator, V = "@@iterator";
217
221
  function ge(e) {
218
222
  if (e === null || typeof e != "object")
219
223
  return null;
@@ -241,7 +245,7 @@ function rt() {
241
245
  var ir = !1, or = !1, sr = !1, cr = !1, lr = !1, ze;
242
246
  ze = Symbol.for("react.module.reference");
243
247
  function ur(e) {
244
- return !!(typeof e == "string" || typeof e == "function" || e === s || e === i || lr || e === l || e === y || e === _ || cr || e === O || ir || or || sr || typeof e == "object" && e !== null && (e.$$typeof === f || e.$$typeof === v || e.$$typeof === u || e.$$typeof === d || e.$$typeof === g || e.$$typeof === ze || e.getModuleId !== void 0));
248
+ return !!(typeof e == "string" || typeof e == "function" || e === s || e === i || lr || e === l || e === y || e === _ || cr || e === A || ir || or || sr || typeof e == "object" && e !== null && (e.$$typeof === f || e.$$typeof === v || e.$$typeof === u || e.$$typeof === d || e.$$typeof === g || e.$$typeof === ze || e.getModuleId !== void 0));
245
249
  }
246
250
  function dr(e, a, c) {
247
251
  var p = e.displayName;
@@ -250,7 +254,7 @@ function rt() {
250
254
  var b = a.displayName || a.name || "";
251
255
  return b !== "" ? c + "(" + b + ")" : c;
252
256
  }
253
- function Ae(e) {
257
+ function Oe(e) {
254
258
  return e.displayName || "Context";
255
259
  }
256
260
  function F(e) {
@@ -278,10 +282,10 @@ function rt() {
278
282
  switch (e.$$typeof) {
279
283
  case d:
280
284
  var a = e;
281
- return Ae(a) + ".Consumer";
285
+ return Oe(a) + ".Consumer";
282
286
  case u:
283
287
  var c = e;
284
- return Ae(c._context) + ".Provider";
288
+ return Oe(c._context) + ".Provider";
285
289
  case g:
286
290
  return dr(e, e.render, "ForwardRef");
287
291
  case v:
@@ -298,14 +302,14 @@ function rt() {
298
302
  }
299
303
  return null;
300
304
  }
301
- var Y = Object.assign, H = 0, Oe, ke, xe, De, je, Ie, Fe;
305
+ var Y = Object.assign, H = 0, Ae, ke, xe, De, je, Ie, Fe;
302
306
  function qe() {
303
307
  }
304
308
  qe.__reactDisabledLog = !0;
305
309
  function fr() {
306
310
  {
307
311
  if (H === 0) {
308
- Oe = console.log, ke = console.info, xe = console.warn, De = console.error, je = console.group, Ie = console.groupCollapsed, Fe = console.groupEnd;
312
+ Ae = console.log, ke = console.info, xe = console.warn, De = console.error, je = console.group, Ie = console.groupCollapsed, Fe = console.groupEnd;
309
313
  var e = {
310
314
  configurable: !0,
311
315
  enumerable: !0,
@@ -335,7 +339,7 @@ function rt() {
335
339
  };
336
340
  Object.defineProperties(console, {
337
341
  log: Y({}, e, {
338
- value: Oe
342
+ value: Ae
339
343
  }),
340
344
  info: Y({}, e, {
341
345
  value: ke
@@ -657,7 +661,7 @@ Check the render method of \`` + e + "`.";
657
661
  return "";
658
662
  }
659
663
  }
660
- function Ar(e) {
664
+ function Or(e) {
661
665
  {
662
666
  if (e !== void 0) {
663
667
  var a = e.fileName.replace(/^.*[\\\/]/, ""), c = e.lineNumber;
@@ -669,7 +673,7 @@ Check your code at ` + a + ":" + c + ".";
669
673
  }
670
674
  }
671
675
  var Be = {};
672
- function Or(e) {
676
+ function Ar(e) {
673
677
  {
674
678
  var a = Ke();
675
679
  if (!a) {
@@ -686,7 +690,7 @@ Check the top-level render call using <` + c + ">.");
686
690
  if (!e._store || e._store.validated || e.key != null)
687
691
  return;
688
692
  e._store.validated = !0;
689
- var c = Or(a);
693
+ var c = Ar(a);
690
694
  if (Be[c])
691
695
  return;
692
696
  Be[c] = !0;
@@ -754,7 +758,7 @@ Check the top-level render call using <` + c + ">.");
754
758
  if (!m) {
755
759
  var h = "";
756
760
  (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (h += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
757
- var z = Ar(b);
761
+ var z = Or(b);
758
762
  z ? h += z : h += Ke();
759
763
  var R;
760
764
  e === null ? R = "null" : be(e) ? R = "array" : e !== void 0 && e.$$typeof === n ? (R = "<" + (F(e.type) || "Unknown") + " />", h = " Did you accidentally export a JSX literal instead of a component?") : R = typeof e, T("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", R, h);
@@ -827,14 +831,14 @@ function tt({
827
831
  loading: !0
828
832
  });
829
833
  try {
830
- await k.datasource.create(i, u, d), A({
834
+ await k.datasource.create(i, u, d), O({
831
835
  id: "for-creating",
832
836
  title: "Successful",
833
837
  message: "Data source is added",
834
838
  color: "green"
835
839
  }), t();
836
840
  } catch (g) {
837
- A({
841
+ O({
838
842
  id: "for-creating",
839
843
  title: "Failed",
840
844
  message: g.message,
@@ -1030,7 +1034,7 @@ function ct({
1030
1034
  title: "Pending",
1031
1035
  message: "Deleting data source...",
1032
1036
  loading: !0
1033
- }), await k.datasource.delete(t), A({
1037
+ }), await k.datasource.delete(t), O({
1034
1038
  id: "for-deleting",
1035
1039
  title: "Successful",
1036
1040
  message: `Data source [${n}] is deleted`,
@@ -1073,7 +1077,7 @@ function ct({
1073
1077
  children: "Delete"
1074
1078
  });
1075
1079
  }
1076
- function At({
1080
+ function Ot({
1077
1081
  styles: t = de,
1078
1082
  config: n
1079
1083
  }) {
@@ -1244,14 +1248,14 @@ function ut({
1244
1248
  title: "Pending",
1245
1249
  message: "Adding account...",
1246
1250
  loading: !0
1247
- }), await k.account.create(u, d, g, y), A({
1251
+ }), await k.account.create(u, d, g, y), O({
1248
1252
  id: "for-creating",
1249
1253
  title: "Successful",
1250
1254
  message: "Account is added",
1251
1255
  color: "green"
1252
1256
  }), t();
1253
1257
  } catch (_) {
1254
- A({
1258
+ O({
1255
1259
  id: "for-creating",
1256
1260
  title: "Failed",
1257
1261
  message: _.message,
@@ -1365,14 +1369,14 @@ function ft({
1365
1369
  loading: !0
1366
1370
  });
1367
1371
  try {
1368
- await k.account.delete(t), A({
1372
+ await k.account.delete(t), O({
1369
1373
  id: "for-deleting",
1370
1374
  title: "Successful",
1371
1375
  message: `Account [${n}] is deleted`,
1372
1376
  color: "green"
1373
1377
  }), o();
1374
1378
  } catch (d) {
1375
- A({
1379
+ O({
1376
1380
  id: "for-deleting",
1377
1381
  title: "Failed",
1378
1382
  message: d.message,
@@ -1421,7 +1425,7 @@ function pt({
1421
1425
  }
1422
1426
  }), y = async ({
1423
1427
  name: f,
1424
- email: O,
1428
+ email: A,
1425
1429
  role_id: M,
1426
1430
  reset_password: V,
1427
1431
  new_password: ge
@@ -1435,18 +1439,18 @@ function pt({
1435
1439
  }), await k.account.edit({
1436
1440
  id: t,
1437
1441
  name: f,
1438
- email: O,
1442
+ email: A,
1439
1443
  role_id: M,
1440
1444
  reset_password: V,
1441
1445
  new_password: ge
1442
- }), A({
1446
+ }), O({
1443
1447
  id: "for-updating",
1444
1448
  title: "Successful",
1445
1449
  message: "Account is updated",
1446
1450
  color: "green"
1447
1451
  }), l();
1448
1452
  } catch (N) {
1449
- A({
1453
+ O({
1450
1454
  id: "for-updating",
1451
1455
  title: "Failed",
1452
1456
  message: N.message,
@@ -1506,7 +1510,7 @@ function pt({
1506
1510
  size: i.size,
1507
1511
  label: "Reset password",
1508
1512
  checked: f.value,
1509
- onChange: (O) => f.onChange(O.currentTarget.checked),
1513
+ onChange: (A) => f.onChange(A.currentTarget.checked),
1510
1514
  styles: {
1511
1515
  label: {
1512
1516
  verticalAlign: "middle"
@@ -1572,7 +1576,7 @@ function gt({
1572
1576
  })]
1573
1577
  });
1574
1578
  }
1575
- function Ot({
1579
+ function At({
1576
1580
  styles: t = W,
1577
1581
  config: n
1578
1582
  }) {
@@ -1639,14 +1643,14 @@ function Ot({
1639
1643
  children: o.map((v) => {
1640
1644
  const {
1641
1645
  id: f,
1642
- name: O,
1646
+ name: A,
1643
1647
  email: M,
1644
1648
  role_id: V
1645
1649
  } = v;
1646
1650
  return /* @__PURE__ */ w("tr", {
1647
1651
  children: [/* @__PURE__ */ r("td", {
1648
1652
  width: 200,
1649
- children: O
1653
+ children: A
1650
1654
  }), /* @__PURE__ */ r("td", {
1651
1655
  width: 200,
1652
1656
  children: M
@@ -1662,7 +1666,7 @@ function Ot({
1662
1666
  onSuccess: l
1663
1667
  }), /* @__PURE__ */ r(ft, {
1664
1668
  id: f,
1665
- name: O,
1669
+ name: A,
1666
1670
  onSuccess: l
1667
1671
  })]
1668
1672
  })
@@ -1702,14 +1706,14 @@ function ht({
1702
1706
  loading: !0
1703
1707
  });
1704
1708
  const d = await k.account.login(i, u);
1705
- window.localStorage.setItem("token", d.token), A({
1709
+ window.localStorage.setItem("token", d.token), O({
1706
1710
  id: "for-login",
1707
1711
  title: "Successful",
1708
1712
  message: "Logged in",
1709
1713
  color: "green"
1710
1714
  }), t(d);
1711
1715
  } catch (d) {
1712
- A({
1716
+ O({
1713
1717
  id: "for-login",
1714
1718
  title: "Login Failed",
1715
1719
  message: d.message,
@@ -1810,14 +1814,14 @@ function mt({
1810
1814
  app_id: g,
1811
1815
  app_secret: y
1812
1816
  } = await k.api_key.create(u, d);
1813
- A({
1817
+ O({
1814
1818
  id: "for-creating",
1815
1819
  title: "Successful",
1816
1820
  message: "API Key is added",
1817
1821
  color: "green"
1818
1822
  }), t(g, y);
1819
1823
  } catch (g) {
1820
- A({
1824
+ O({
1821
1825
  id: "for-creating",
1822
1826
  title: "Failed",
1823
1827
  message: g.message,
@@ -1941,14 +1945,14 @@ function bt({
1941
1945
  loading: !0
1942
1946
  });
1943
1947
  try {
1944
- await k.api_key.delete(t), A({
1948
+ await k.api_key.delete(t), O({
1945
1949
  id: "for-deleting",
1946
1950
  title: "Successful",
1947
1951
  message: `API Key [${n}] is deleted`,
1948
1952
  color: "green"
1949
1953
  }), o();
1950
1954
  } catch (d) {
1951
- A({
1955
+ O({
1952
1956
  id: "for-deleting",
1953
1957
  title: "Failed",
1954
1958
  message: d.message,
@@ -2042,14 +2046,14 @@ function xt({
2042
2046
  children: o.map((v) => {
2043
2047
  const {
2044
2048
  id: f,
2045
- name: O,
2049
+ name: A,
2046
2050
  app_id: M,
2047
2051
  role_id: V
2048
2052
  } = v;
2049
2053
  return /* @__PURE__ */ w("tr", {
2050
2054
  children: [/* @__PURE__ */ r("td", {
2051
2055
  width: 200,
2052
- children: O
2056
+ children: A
2053
2057
  }), /* @__PURE__ */ r("td", {
2054
2058
  width: 200,
2055
2059
  children: M
@@ -2062,7 +2066,7 @@ function xt({
2062
2066
  position: "left",
2063
2067
  children: /* @__PURE__ */ r(bt, {
2064
2068
  id: f,
2065
- name: O,
2069
+ name: A,
2066
2070
  onSuccess: l
2067
2071
  })
2068
2072
  })
@@ -2076,11 +2080,11 @@ function xt({
2076
2080
  }
2077
2081
  export {
2078
2082
  xt as APIKeyList,
2079
- Ot as AccountList,
2083
+ At as AccountList,
2080
2084
  vt as AddAPIKey,
2081
2085
  dt as AddAccount,
2082
2086
  nt as AddDataSource,
2083
- At as DataSourceList,
2087
+ Ot as DataSourceList,
2084
2088
  bt as DeleteAPIKey,
2085
2089
  ft as DeleteAccount,
2086
2090
  ct as DeleteDataSource,
@@ -1,4 +1,4 @@
1
- (function(S,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@mantine/core"),require("@mantine/notifications"),require("react"),require("react-hook-form"),require("tabler-icons-react"),require("axios"),require("crypto-js"),require("lodash"),require("ahooks"),require("@mantine/modals")):typeof define=="function"&&define.amd?define(["exports","@mantine/core","@mantine/notifications","react","react-hook-form","tabler-icons-react","axios","crypto-js","lodash","ahooks","@mantine/modals"],o):(S=typeof globalThis<"u"?globalThis:S||self,o(S["settings-form"]={},S["@mantine/core"],S["@mantine/notifications"],S.React,S["react-hook-form"],S["tabler-icons-react"],S.axios,S["crypto-js"],S._,S.ahooks,S["@mantine/modals"]))})(this,function(S,o,C,K,P,F,Ze,He,et,W,J){"use strict";const ee=r=>r&&typeof r=="object"&&"default"in r?r:{default:r},V=ee(K),tt=ee(Ze),rt=ee(He),nt=ee(et);function at(r){r=r||{};const n=Object.keys(r).sort(),s=[];for(let l=0;l<n.length;l++){const u=n[l];if(u!="authentication"&&r[u])s.push(n[l]+"="+(typeof r[u]=="object"?JSON.stringify(r[u]):r[u]));else{const i=Object.keys(r[u]).sort();for(let d=0;d<i.length;d++){const f=i[d];f!="sign"&&r[u][f]&&s.push(i[d]+"="+(typeof r[u][f]=="object"?JSON.stringify(r[u][f]):r[u][f]))}}}return s.sort().join("&")}function it(r,n){let s=at(r);return s+="&key="+n,rt.default.MD5(s).toString().toUpperCase()}const x={baseURL:"http://localhost:31200",app_id:"",app_secret:"",getAuthentication(r){if(!this.app_id||!this.app_secret)return;const n=new Date().getTime().toString();return{app_id:this.app_id,nonce_str:n,sign:it({app_id:this.app_id,nonce_str:n,...r},this.app_secret)}},getRequest(r){return(n,s,l={})=>{const u=window.localStorage.getItem("token"),i={"X-Requested-With":"XMLHttpRequest","Content-Type":l.string?"application/x-www-form-urlencoded":"application/json",authorization:u?`bearer ${u}`:"",...l.headers},d={baseURL:this.baseURL,method:r,url:n,params:r==="GET"?s:l.params,headers:i};return["POST","PUT"].includes(r)&&(d.data=l.string?JSON.stringify(s):s,d.data.authentication=this.getAuthentication(d.data)),tt.default(d).then(f=>f.data).catch(f=>nt.default.has(f,"response.data.detail.message")?Promise.reject(new Error(f.response.data.detail.message)):Promise.reject(f))}}};function te(r){x.baseURL!==r.apiBaseURL&&(x.baseURL=r.apiBaseURL),r.app_id&&(x.app_id=r.app_id),r.app_secret&&(x.app_secret=r.app_secret)}const D={datasource:{list:async()=>await x.getRequest("POST")("/datasource/list",{filter:{},sort:{field:"create_time",order:"ASC"},pagination:{page:1,pagesize:100}}),create:async(r,n,s)=>x.getRequest("POST")("/datasource/create",{type:r,key:n,config:s}),delete:async r=>{await x.getRequest("POST")("/datasource/delete",{id:r})}},account:{login:async(r,n)=>{const s={name:r,password:n};return await x.getRequest("POST")("/account/login",s)},list:async()=>await x.getRequest("POST")("/account/list",{filter:{search:""},sort:{field:"name",order:"ASC"},pagination:{page:1,pagesize:100}}),get:async()=>await x.getRequest("GET")("/account/get",{}),update:async(r,n)=>{const s={name:r,email:n};return await x.getRequest("PUT")("/account/update",s)},changepassword:async(r,n)=>{const s={old_password:r,new_password:n};return await x.getRequest("POST")("/account/changepassword",s)},create:async(r,n,s,l)=>await x.getRequest("POST")("/account/create",{name:r,email:n,password:s,role_id:l}),edit:async r=>(r.reset_password||(r.new_password=void 0),await x.getRequest("PUT")("/account/edit",r)),delete:async r=>{if(!!r)return x.getRequest("POST")("/account/delete",{id:r})}},role:{list:async()=>await x.getRequest("GET")("/role/list",{})},api_key:{list:async()=>await x.getRequest("POST")("/api/key/list",{filter:{search:""},sort:{field:"name",order:"ASC"},pagination:{page:1,pagesize:100}}),create:async(r,n)=>x.getRequest("POST")("/api/key/create",{name:r,role_id:n}),delete:async r=>{if(!!r)return x.getRequest("POST")("/api/key/delete",{id:r})}}},re={size:"sm",spacing:"md",button:{size:"xs"}};var ne={exports:{}},X={};/**
1
+ (function(S,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@mantine/core"),require("@mantine/notifications"),require("react"),require("react-hook-form"),require("tabler-icons-react"),require("axios"),require("crypto-js"),require("lodash"),require("ahooks"),require("@mantine/modals")):typeof define=="function"&&define.amd?define(["exports","@mantine/core","@mantine/notifications","react","react-hook-form","tabler-icons-react","axios","crypto-js","lodash","ahooks","@mantine/modals"],o):(S=typeof globalThis<"u"?globalThis:S||self,o(S["settings-form"]={},S["@mantine/core"],S["@mantine/notifications"],S.React,S["react-hook-form"],S["tabler-icons-react"],S.axios,S["crypto-js"],S._,S.ahooks,S["@mantine/modals"]))})(this,function(S,o,C,K,P,F,Ze,He,et,W,J){"use strict";const ee=r=>r&&typeof r=="object"&&"default"in r?r:{default:r},V=ee(K),tt=ee(Ze),rt=ee(He),nt=ee(et);function at(r){r=r||{};const n=Object.keys(r).sort(),s=[];for(let l=0;l<n.length;l++){const u=n[l];if(u!="authentication"&&r[u])s.push(n[l]+"="+(typeof r[u]=="object"?JSON.stringify(r[u]):r[u]));else{const i=Object.keys(r[u]).sort();for(let d=0;d<i.length;d++){const f=i[d];f!="sign"&&r[u][f]&&s.push(i[d]+"="+(typeof r[u][f]=="object"?JSON.stringify(r[u][f]):r[u][f]))}}}return s.sort().join("&")}function it(r,n){let s=at(r);return s+="&key="+n,rt.default.MD5(s).toString().toUpperCase()}const x={baseURL:"http://localhost:31200",app_id:"",app_secret:"",getAuthentication(r){if(!this.app_id||!this.app_secret)return;const n=new Date().getTime().toString();return{app_id:this.app_id,nonce_str:n,sign:it({app_id:this.app_id,nonce_str:n,...r},this.app_secret)}},getRequest(r){return(n,s,l={})=>{const u=window.localStorage.getItem("token"),i={"X-Requested-With":"XMLHttpRequest","Content-Type":l.string?"application/x-www-form-urlencoded":"application/json",authorization:u?`bearer ${u}`:"",...l.headers},d={baseURL:this.baseURL,method:r,url:n,params:r==="GET"?s:l.params,headers:i};return["POST","PUT"].includes(r)&&(d.data=l.string?JSON.stringify(s):s,d.data.authentication=this.getAuthentication(d.data)),tt.default(d).then(f=>f.data).catch(f=>nt.default.has(f,"response.data.detail.message")?Promise.reject(new Error(f.response.data.detail.message)):Promise.reject(f))}}};function te(r){x.baseURL!==r.apiBaseURL&&(x.baseURL=r.apiBaseURL),r.app_id&&(x.app_id=r.app_id),r.app_secret&&(x.app_secret=r.app_secret)}const D={datasource:{list:async()=>await x.getRequest("POST")("/datasource/list",{filter:{},sort:{field:"create_time",order:"ASC"},pagination:{page:1,pagesize:100}}),create:async(r,n,s)=>await x.getRequest("POST")("/datasource/create",{type:r,key:n,config:s}),delete:async r=>{await x.getRequest("POST")("/datasource/delete",{id:r})}},account:{login:async(r,n)=>{const s={name:r,password:n};return await x.getRequest("POST")("/account/login",s)},list:async()=>await x.getRequest("POST")("/account/list",{filter:{search:""},sort:{field:"name",order:"ASC"},pagination:{page:1,pagesize:100}}),get:async()=>await x.getRequest("GET")("/account/get",{}),update:async(r,n)=>{const s={name:r,email:n};return await x.getRequest("PUT")("/account/update",s)},changepassword:async(r,n)=>{const s={old_password:r,new_password:n};return await x.getRequest("POST")("/account/changepassword",s)},create:async(r,n,s,l)=>await x.getRequest("POST")("/account/create",{name:r,email:n,password:s,role_id:l}),edit:async r=>(r.reset_password||(r.new_password=void 0),await x.getRequest("PUT")("/account/edit",r)),delete:async r=>{if(!!r)return x.getRequest("POST")("/account/delete",{id:r})}},role:{list:async()=>await x.getRequest("GET")("/role/list",{})},api_key:{list:async()=>await x.getRequest("POST")("/api/key/list",{filter:{search:""},sort:{field:"name",order:"ASC"},pagination:{page:1,pagesize:100}}),create:async(r,n)=>x.getRequest("POST")("/api/key/create",{name:r,role_id:n}),delete:async r=>{if(!!r)return x.getRequest("POST")("/api/key/delete",{id:r})}}},re={size:"sm",spacing:"md",button:{size:"xs"}};var ne={exports:{}},X={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtable/settings-form",
3
- "version": "5.8.3",
3
+ "version": "5.9.1",
4
4
  "license": "Apache-2.0",
5
5
  "publishConfig": {
6
6
  "access": "public",