@devtable/settings-form 2.0.0 → 2.3.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/api-caller/datasource.d.ts +1 -1
- package/dist/api-caller/index.d.ts +2 -2
- package/dist/api-caller/request.d.ts +5 -0
- package/dist/api-caller/types.d.ts +5 -0
- package/dist/datasource/add-data-source.d.ts +3 -1
- package/dist/datasource/data-source-list.d.ts +8 -1
- package/dist/datasource/delete-data-source.d.ts +6 -2
- package/dist/datasource/styles.d.ts +6 -0
- package/dist/datasource/types.d.ts +3 -0
- package/dist/settings-form.es.js +71 -48
- package/dist/settings-form.umd.js +2 -2
- package/package.json +18 -17
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataSourceType, IDataSource, IDataSourceConfig } from "./datasource.typed";
|
|
2
|
-
import { PaginationResponse } from "
|
|
2
|
+
import { PaginationResponse } from "./types";
|
|
3
3
|
export declare const datasource: {
|
|
4
4
|
list: () => Promise<PaginationResponse<IDataSource>>;
|
|
5
5
|
create: (type: DataSourceType, key: string, config: IDataSourceConfig) => Promise<PaginationResponse<IDataSource> | false>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const APICaller: {
|
|
2
2
|
datasource: {
|
|
3
|
-
list: () => Promise<import("
|
|
4
|
-
create: (type: import("./datasource.typed").DataSourceType, key: string, config: import("./datasource.typed").IDataSourceConfig) => Promise<false | import("
|
|
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<false | import("./types").PaginationResponse<import("./datasource.typed").IDataSource>>;
|
|
5
5
|
delete: (id: string) => Promise<void>;
|
|
6
6
|
};
|
|
7
7
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { IStyles } from "./styles";
|
|
2
3
|
interface IAddDataSource {
|
|
4
|
+
styles?: IStyles;
|
|
3
5
|
onSuccess: () => void;
|
|
4
6
|
}
|
|
5
|
-
export declare function AddDataSource({ onSuccess }: IAddDataSource): JSX.Element;
|
|
7
|
+
export declare function AddDataSource({ onSuccess, styles }: IAddDataSource): JSX.Element;
|
|
6
8
|
export {};
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import { IStyles } from "./styles";
|
|
3
|
+
import { ISettingsFormConfig } from "./types";
|
|
4
|
+
interface IDataSourceList {
|
|
5
|
+
styles?: IStyles;
|
|
6
|
+
config: ISettingsFormConfig;
|
|
7
|
+
}
|
|
8
|
+
export declare function DataSourceList({ styles, config }: IDataSourceList): JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import { IStyles } from "./styles";
|
|
3
|
+
interface IDeleteDataSource {
|
|
3
4
|
id: string;
|
|
4
5
|
name: string;
|
|
5
6
|
onSuccess: () => void;
|
|
6
|
-
|
|
7
|
+
styles?: IStyles;
|
|
8
|
+
}
|
|
9
|
+
export declare function DeleteDataSource({ id, name, onSuccess, styles }: IDeleteDataSource): JSX.Element;
|
|
10
|
+
export {};
|
package/dist/settings-form.es.js
CHANGED
|
@@ -6,34 +6,36 @@ import { PlaylistAdd, Trash } from "tabler-icons-react";
|
|
|
6
6
|
import axios from "axios";
|
|
7
7
|
import { useRequest } from "ahooks";
|
|
8
8
|
import { useModals } from "@mantine/modals";
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
const APIClient = {
|
|
10
|
+
baseURL: "http://localhost:31200",
|
|
11
|
+
getRequest(method) {
|
|
12
|
+
return (url, data, options = {}) => {
|
|
13
|
+
const headers = {
|
|
14
|
+
"X-Requested-With": "XMLHttpRequest",
|
|
15
|
+
"Content-Type": options.string ? "application/x-www-form-urlencoded" : "application/json",
|
|
16
|
+
...options.headers
|
|
17
|
+
};
|
|
18
|
+
const conf = {
|
|
19
|
+
baseURL: this.baseURL,
|
|
20
|
+
method,
|
|
21
|
+
url,
|
|
22
|
+
params: method === "GET" ? data : options.params,
|
|
23
|
+
headers
|
|
24
|
+
};
|
|
25
|
+
if (method === "POST") {
|
|
26
|
+
conf.data = options.string ? JSON.stringify(data) : data;
|
|
27
|
+
}
|
|
28
|
+
return axios(conf).then((res) => {
|
|
29
|
+
return res.data;
|
|
30
|
+
}).catch((err) => {
|
|
31
|
+
return Promise.reject(err);
|
|
32
|
+
});
|
|
22
33
|
};
|
|
23
|
-
|
|
24
|
-
conf.data = options.string ? JSON.stringify(data) : data;
|
|
25
|
-
}
|
|
26
|
-
return axios(conf).then((res) => {
|
|
27
|
-
return res.data;
|
|
28
|
-
}).catch((err) => {
|
|
29
|
-
return Promise.reject(err);
|
|
30
|
-
});
|
|
31
|
-
};
|
|
34
|
+
}
|
|
32
35
|
};
|
|
33
|
-
const post = getRequest("POST");
|
|
34
36
|
const datasource = {
|
|
35
37
|
list: async () => {
|
|
36
|
-
const res = await
|
|
38
|
+
const res = await APIClient.getRequest("POST")("/datasource/list", {
|
|
37
39
|
filter: {},
|
|
38
40
|
sort: {
|
|
39
41
|
field: "create_time",
|
|
@@ -48,7 +50,7 @@ const datasource = {
|
|
|
48
50
|
},
|
|
49
51
|
create: async (type, key, config) => {
|
|
50
52
|
try {
|
|
51
|
-
const res = await
|
|
53
|
+
const res = await APIClient.getRequest("POST")("/datasource/create", { type, key, config });
|
|
52
54
|
return res;
|
|
53
55
|
} catch (error) {
|
|
54
56
|
console.error(error);
|
|
@@ -56,12 +58,16 @@ const datasource = {
|
|
|
56
58
|
}
|
|
57
59
|
},
|
|
58
60
|
delete: async (id) => {
|
|
59
|
-
await
|
|
61
|
+
await APIClient.getRequest("POST")("/datasource/delete", { id });
|
|
60
62
|
}
|
|
61
63
|
};
|
|
62
64
|
const APICaller = {
|
|
63
65
|
datasource
|
|
64
66
|
};
|
|
67
|
+
const defaultStyles = {
|
|
68
|
+
size: "sm",
|
|
69
|
+
spacing: "md"
|
|
70
|
+
};
|
|
65
71
|
var jsxRuntime = { exports: {} };
|
|
66
72
|
var reactJsxRuntime_production_min = {};
|
|
67
73
|
/**
|
|
@@ -96,7 +102,8 @@ const jsx = jsxRuntime.exports.jsx;
|
|
|
96
102
|
const jsxs = jsxRuntime.exports.jsxs;
|
|
97
103
|
const Fragment = jsxRuntime.exports.Fragment;
|
|
98
104
|
function AddDataSourceForm({
|
|
99
|
-
postSubmit
|
|
105
|
+
postSubmit,
|
|
106
|
+
styles = defaultStyles
|
|
100
107
|
}) {
|
|
101
108
|
const {
|
|
102
109
|
control,
|
|
@@ -159,7 +166,8 @@ function AddDataSourceForm({
|
|
|
159
166
|
field
|
|
160
167
|
}) => /* @__PURE__ */ jsx(SegmentedControl, {
|
|
161
168
|
fullWidth: true,
|
|
162
|
-
mb:
|
|
169
|
+
mb: styles.spacing,
|
|
170
|
+
size: styles.size,
|
|
163
171
|
data: [{
|
|
164
172
|
label: "PostgreSQL",
|
|
165
173
|
value: "postgresql"
|
|
@@ -179,7 +187,8 @@ function AddDataSourceForm({
|
|
|
179
187
|
render: ({
|
|
180
188
|
field
|
|
181
189
|
}) => /* @__PURE__ */ jsx(TextInput, {
|
|
182
|
-
mb:
|
|
190
|
+
mb: styles.spacing,
|
|
191
|
+
size: styles.size,
|
|
183
192
|
required: true,
|
|
184
193
|
label: "Name",
|
|
185
194
|
placeholder: "A unique name",
|
|
@@ -189,7 +198,6 @@ function AddDataSourceForm({
|
|
|
189
198
|
label: "Connection Info",
|
|
190
199
|
labelPosition: "center"
|
|
191
200
|
}), /* @__PURE__ */ jsxs(Group, {
|
|
192
|
-
direction: "row",
|
|
193
201
|
grow: true,
|
|
194
202
|
children: [/* @__PURE__ */ jsx(Controller, {
|
|
195
203
|
name: "config.host",
|
|
@@ -197,7 +205,8 @@ function AddDataSourceForm({
|
|
|
197
205
|
render: ({
|
|
198
206
|
field
|
|
199
207
|
}) => /* @__PURE__ */ jsx(TextInput, {
|
|
200
|
-
mb:
|
|
208
|
+
mb: styles.spacing,
|
|
209
|
+
size: styles.size,
|
|
201
210
|
required: true,
|
|
202
211
|
label: "Host",
|
|
203
212
|
sx: {
|
|
@@ -211,7 +220,8 @@ function AddDataSourceForm({
|
|
|
211
220
|
render: ({
|
|
212
221
|
field
|
|
213
222
|
}) => /* @__PURE__ */ jsx(NumberInput, {
|
|
214
|
-
mb:
|
|
223
|
+
mb: styles.spacing,
|
|
224
|
+
size: styles.size,
|
|
215
225
|
required: true,
|
|
216
226
|
label: "Port",
|
|
217
227
|
hideControls: true,
|
|
@@ -227,7 +237,8 @@ function AddDataSourceForm({
|
|
|
227
237
|
render: ({
|
|
228
238
|
field
|
|
229
239
|
}) => /* @__PURE__ */ jsx(TextInput, {
|
|
230
|
-
mb:
|
|
240
|
+
mb: styles.spacing,
|
|
241
|
+
size: styles.size,
|
|
231
242
|
required: true,
|
|
232
243
|
label: "Username",
|
|
233
244
|
...field
|
|
@@ -238,7 +249,8 @@ function AddDataSourceForm({
|
|
|
238
249
|
render: ({
|
|
239
250
|
field
|
|
240
251
|
}) => /* @__PURE__ */ jsx(PasswordInput, {
|
|
241
|
-
mb:
|
|
252
|
+
mb: styles.spacing,
|
|
253
|
+
size: styles.size,
|
|
242
254
|
required: true,
|
|
243
255
|
label: "Password",
|
|
244
256
|
...field
|
|
@@ -249,16 +261,18 @@ function AddDataSourceForm({
|
|
|
249
261
|
render: ({
|
|
250
262
|
field
|
|
251
263
|
}) => /* @__PURE__ */ jsx(TextInput, {
|
|
252
|
-
mb:
|
|
264
|
+
mb: styles.spacing,
|
|
265
|
+
size: styles.size,
|
|
253
266
|
required: true,
|
|
254
267
|
label: "Database",
|
|
255
268
|
...field
|
|
256
269
|
})
|
|
257
270
|
}), /* @__PURE__ */ jsx(Group, {
|
|
258
271
|
position: "right",
|
|
259
|
-
mt:
|
|
272
|
+
mt: styles.spacing,
|
|
260
273
|
children: /* @__PURE__ */ jsx(Button, {
|
|
261
274
|
type: "submit",
|
|
275
|
+
size: styles.size,
|
|
262
276
|
children: "Save"
|
|
263
277
|
})
|
|
264
278
|
})]
|
|
@@ -266,7 +280,8 @@ function AddDataSourceForm({
|
|
|
266
280
|
});
|
|
267
281
|
}
|
|
268
282
|
function AddDataSource({
|
|
269
|
-
onSuccess
|
|
283
|
+
onSuccess,
|
|
284
|
+
styles = defaultStyles
|
|
270
285
|
}) {
|
|
271
286
|
const [opened, setOpened] = require$$0.useState(false);
|
|
272
287
|
const open = () => setOpened(true);
|
|
@@ -286,10 +301,11 @@ function AddDataSource({
|
|
|
286
301
|
e.stopPropagation();
|
|
287
302
|
},
|
|
288
303
|
children: /* @__PURE__ */ jsx(AddDataSourceForm, {
|
|
289
|
-
postSubmit
|
|
304
|
+
postSubmit,
|
|
305
|
+
styles
|
|
290
306
|
})
|
|
291
307
|
}), /* @__PURE__ */ jsx(Button, {
|
|
292
|
-
size:
|
|
308
|
+
size: styles.size,
|
|
293
309
|
onClick: open,
|
|
294
310
|
leftIcon: /* @__PURE__ */ jsx(PlaylistAdd, {
|
|
295
311
|
size: 20
|
|
@@ -301,7 +317,8 @@ function AddDataSource({
|
|
|
301
317
|
function DeleteDataSource({
|
|
302
318
|
id,
|
|
303
319
|
name,
|
|
304
|
-
onSuccess
|
|
320
|
+
onSuccess,
|
|
321
|
+
styles = defaultStyles
|
|
305
322
|
}) {
|
|
306
323
|
const modals = useModals();
|
|
307
324
|
const doDelete = async () => {
|
|
@@ -326,7 +343,7 @@ function DeleteDataSource({
|
|
|
326
343
|
const confirmAndDelete = () => modals.openConfirmModal({
|
|
327
344
|
title: "Delete this data source?",
|
|
328
345
|
children: /* @__PURE__ */ jsx(Text, {
|
|
329
|
-
size:
|
|
346
|
+
size: styles.size,
|
|
330
347
|
children: "This action won't affect your database."
|
|
331
348
|
}),
|
|
332
349
|
labels: {
|
|
@@ -337,7 +354,7 @@ function DeleteDataSource({
|
|
|
337
354
|
onConfirm: doDelete
|
|
338
355
|
});
|
|
339
356
|
return /* @__PURE__ */ jsx(Button, {
|
|
340
|
-
size:
|
|
357
|
+
size: styles.size,
|
|
341
358
|
color: "red",
|
|
342
359
|
onClick: confirmAndDelete,
|
|
343
360
|
leftIcon: /* @__PURE__ */ jsx(Trash, {
|
|
@@ -346,7 +363,10 @@ function DeleteDataSource({
|
|
|
346
363
|
children: "Delete"
|
|
347
364
|
});
|
|
348
365
|
}
|
|
349
|
-
function DataSourceList(
|
|
366
|
+
function DataSourceList({
|
|
367
|
+
styles = defaultStyles,
|
|
368
|
+
config
|
|
369
|
+
}) {
|
|
350
370
|
const {
|
|
351
371
|
data = [],
|
|
352
372
|
loading,
|
|
@@ -359,24 +379,27 @@ function DataSourceList() {
|
|
|
359
379
|
}, {
|
|
360
380
|
refreshDeps: []
|
|
361
381
|
});
|
|
382
|
+
if (APIClient.baseURL !== config.apiBaseURL) {
|
|
383
|
+
APIClient.baseURL = config.apiBaseURL;
|
|
384
|
+
}
|
|
362
385
|
return /* @__PURE__ */ jsxs(Fragment, {
|
|
363
386
|
children: [/* @__PURE__ */ jsx(Group, {
|
|
364
|
-
pt:
|
|
387
|
+
pt: styles.spacing,
|
|
365
388
|
position: "right",
|
|
366
389
|
children: /* @__PURE__ */ jsx(AddDataSource, {
|
|
367
390
|
onSuccess: refresh
|
|
368
391
|
})
|
|
369
392
|
}), /* @__PURE__ */ jsxs(Box, {
|
|
370
|
-
mt:
|
|
393
|
+
mt: styles.spacing,
|
|
371
394
|
sx: {
|
|
372
395
|
position: "relative"
|
|
373
396
|
},
|
|
374
397
|
children: [/* @__PURE__ */ jsx(LoadingOverlay, {
|
|
375
398
|
visible: loading
|
|
376
399
|
}), /* @__PURE__ */ jsxs(Table, {
|
|
377
|
-
horizontalSpacing:
|
|
378
|
-
verticalSpacing:
|
|
379
|
-
fontSize:
|
|
400
|
+
horizontalSpacing: styles.spacing,
|
|
401
|
+
verticalSpacing: styles.spacing,
|
|
402
|
+
fontSize: styles.size,
|
|
380
403
|
highlightOnHover: true,
|
|
381
404
|
children: [/* @__PURE__ */ jsx("thead", {
|
|
382
405
|
children: /* @__PURE__ */ jsxs("tr", {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(o,
|
|
1
|
+
(function(o,i){typeof exports=="object"&&typeof module!="undefined"?i(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"],i):(o=typeof globalThis!="undefined"?globalThis:o||self,i(o["settings-form"]={},o["@mantine/core"],o["react-hook-form"],o["@mantine/notifications"],o.React,o["tabler-icons-react"],o.axios,o.ahooks,o["@mantine/modals"]))})(this,function(o,i,u,p,T,z,P,R,L){"use strict";function q(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var w=q(T),O=q(P);const m={baseURL:"http://localhost:31200",getRequest(r){return(e,a,n={})=>{const l={"X-Requested-With":"XMLHttpRequest","Content-Type":n.string?"application/x-www-form-urlencoded":"application/json",...n.headers},s={baseURL:this.baseURL,method:r,url:e,params:r==="GET"?a:n.params,headers:l};return r==="POST"&&(s.data=n.string?JSON.stringify(a):a),O.default(s).then(d=>d.data).catch(d=>Promise.reject(d))}}},x={datasource:{list:async()=>await m.getRequest("POST")("/datasource/list",{filter:{},sort:{field:"create_time",order:"ASC"},pagination:{page:1,pagesize:100}}),create:async(r,e,a)=>{try{return await m.getRequest("POST")("/datasource/create",{type:r,key:e,config:a})}catch(n){return console.error(n),!1}},delete:async r=>{await m.getRequest("POST")("/datasource/delete",{id:r})}}},g={size:"sm",spacing:"md"};var S={exports:{}},b={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,4 +6,4 @@
|
|
|
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
|
|
9
|
+
*/var y=w.default,A=Symbol.for("react.element"),j=Symbol.for("react.fragment"),I=Object.prototype.hasOwnProperty,N=y.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,U={key:!0,ref:!0,__self:!0,__source:!0};function _(r,e,a){var n,l={},s=null,d=null;a!==void 0&&(s=""+a),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(d=e.ref);for(n in e)I.call(e,n)&&!U.hasOwnProperty(n)&&(l[n]=e[n]);if(r&&r.defaultProps)for(n in e=r.defaultProps,e)l[n]===void 0&&(l[n]=e[n]);return{$$typeof:A,type:r,key:s,ref:d,props:l,_owner:N.current}}b.Fragment=j,b.jsx=_,b.jsxs=_,S.exports=b;const t=S.exports.jsx,f=S.exports.jsxs,C=S.exports.Fragment;function B({postSubmit:r,styles:e=g}){const{control:a,handleSubmit:n,formState:{errors:l,isValidating:s,isValid:d}}=u.useForm({defaultValues:{type:"postgresql",key:"",config:{host:"",port:5432,username:"",password:"",database:""}}}),h=async({type:c,key:M,config:k})=>{if(p.showNotification({id:"for-creating",title:"Pending",message:"Adding data source...",loading:!0}),!await x.datasource.create(c,M,k)){p.updateNotification({id:"for-creating",title:"Failed",message:"Test connection failed with given info",color:"red"});return}p.updateNotification({id:"for-creating",title:"Successful",message:"Data source is added",color:"green"}),r()};return t(i.Box,{mx:"auto",children:f("form",{onSubmit:n(h),children:[t(u.Controller,{name:"type",control:a,render:({field:c})=>t(i.SegmentedControl,{fullWidth:!0,mb:e.spacing,size:e.size,data:[{label:"PostgreSQL",value:"postgresql"},{label:"MySQL",value:"mysql"},{label:"HTTP",value:"http",disabled:!0}],...c})}),t(u.Controller,{name:"key",control:a,render:({field:c})=>t(i.TextInput,{mb:e.spacing,size:e.size,required:!0,label:"Name",placeholder:"A unique name",...c})}),t(i.Divider,{label:"Connection Info",labelPosition:"center"}),f(i.Group,{grow:!0,children:[t(u.Controller,{name:"config.host",control:a,render:({field:c})=>t(i.TextInput,{mb:e.spacing,size:e.size,required:!0,label:"Host",sx:{flexGrow:1},...c})}),t(u.Controller,{name:"config.port",control:a,render:({field:c})=>t(i.NumberInput,{mb:e.spacing,size:e.size,required:!0,label:"Port",hideControls:!0,sx:{width:"8em"},...c})})]}),t(u.Controller,{name:"config.username",control:a,render:({field:c})=>t(i.TextInput,{mb:e.spacing,size:e.size,required:!0,label:"Username",...c})}),t(u.Controller,{name:"config.password",control:a,render:({field:c})=>t(i.PasswordInput,{mb:e.spacing,size:e.size,required:!0,label:"Password",...c})}),t(u.Controller,{name:"config.database",control:a,render:({field:c})=>t(i.TextInput,{mb:e.spacing,size:e.size,required:!0,label:"Database",...c})}),t(i.Group,{position:"right",mt:e.spacing,children:t(i.Button,{type:"submit",size:e.size,children:"Save"})})]})})}function D({onSuccess:r,styles:e=g}){const[a,n]=w.default.useState(!1),l=()=>n(!0),s=()=>n(!1),d=()=>{r(),s()};return f(C,{children:[t(i.Modal,{overflow:"inside",opened:a,onClose:()=>n(!1),title:"Add a data source",trapFocus:!0,onDragStart:h=>{h.stopPropagation()},children:t(B,{postSubmit:d,styles:e})}),t(i.Button,{size:e.size,onClick:l,leftIcon:t(z.PlaylistAdd,{size:20}),children:"Add a Data Source"})]})}function v({id:r,name:e,onSuccess:a,styles:n=g}){const l=L.useModals(),s=async()=>{!r||(p.showNotification({id:"for-deleting",title:"Pending",message:"Deleting data source...",loading:!0}),await x.datasource.delete(r),p.updateNotification({id:"for-deleting",title:"Successful",message:`Data source [${e}] is deleted`,color:"green"}),a())},d=()=>l.openConfirmModal({title:"Delete this data source?",children:t(i.Text,{size:n.size,children:"This action won't affect your database."}),labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:s});return t(i.Button,{size:n.size,color:"red",onClick:d,leftIcon:t(z.Trash,{size:20}),children:"Delete"})}function E({styles:r=g,config:e}){const{data:a=[],loading:n,refresh:l}=R.useRequest(async()=>{const{data:s}=await x.datasource.list();return s},{refreshDeps:[]});return m.baseURL!==e.apiBaseURL&&(m.baseURL=e.apiBaseURL),f(C,{children:[t(i.Group,{pt:r.spacing,position:"right",children:t(D,{onSuccess:l})}),f(i.Box,{mt:r.spacing,sx:{position:"relative"},children:[t(i.LoadingOverlay,{visible:n}),f(i.Table,{horizontalSpacing:r.spacing,verticalSpacing:r.spacing,fontSize:r.size,highlightOnHover:!0,children:[t("thead",{children:f("tr",{children:[t("th",{children:"Type"}),t("th",{children:"Name"}),t("th",{children:"Action"})]})}),t("tbody",{children:a.map(({id:s,key:d,type:h})=>f("tr",{children:[t("td",{width:200,children:h}),t("td",{children:d}),t("td",{width:200,children:t(i.Group,{position:"left",children:t(v,{id:s,name:d,onSuccess:l})})})]},d))})]})]})]})}o.AddDataSource=D,o.DataSourceList=E,o.DeleteDataSource=v,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devtable/settings-form",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -22,32 +22,33 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
|
-
"dev": "vite",
|
|
25
|
+
"dev-build": "tsc && vite build --watch",
|
|
26
26
|
"build": "tsc && vite build",
|
|
27
27
|
"preview": "vite preview"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {},
|
|
30
|
-
"devDependencies": {
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/lodash": "^4.14.182",
|
|
32
|
+
"@types/react": "^18.0.0",
|
|
33
|
+
"@types/react-dom": "^18.0.0",
|
|
34
|
+
"@types/react-grid-layout": "^1.3.2",
|
|
35
|
+
"@vitejs/plugin-react": "^1.3.0",
|
|
36
|
+
"rollup-plugin-visualizer": "5.6.0",
|
|
37
|
+
"typescript": "^4.6.3",
|
|
38
|
+
"vite": "^2.9.9",
|
|
39
|
+
"vite-plugin-dts": "^1.1.1"
|
|
40
|
+
},
|
|
31
41
|
"peerDependencies": {
|
|
32
|
-
"@
|
|
33
|
-
"@mantine/
|
|
34
|
-
"@mantine/
|
|
35
|
-
"@mantine/
|
|
36
|
-
"@mantine/
|
|
37
|
-
"@mantine/notifications": "^4.2.12",
|
|
38
|
-
"@mantine/prism": "^4.2.12",
|
|
39
|
-
"@mantine/rte": "^4.2.12",
|
|
42
|
+
"@emotion/react": "11.10.0",
|
|
43
|
+
"@mantine/core": "^5.0.2",
|
|
44
|
+
"@mantine/hooks": "^5.0.2",
|
|
45
|
+
"@mantine/modals": "^5.0.2",
|
|
46
|
+
"@mantine/notifications": "^5.0.2",
|
|
40
47
|
"ahooks": "^3.3.11",
|
|
41
48
|
"axios": "^0.27.2",
|
|
42
|
-
"echarts": "^5.3.2",
|
|
43
|
-
"echarts-for-react": "^3.0.2",
|
|
44
|
-
"echarts-gl": "^2.0.9",
|
|
45
|
-
"echarts-stat": "1.2.0",
|
|
46
49
|
"lodash": "^4.17.21",
|
|
47
|
-
"numbro": "^2.3.6",
|
|
48
50
|
"react": "^16.8.0 || 17.x || 18.x",
|
|
49
51
|
"react-dom": "^16.8.0 || 17.x || 18.x",
|
|
50
|
-
"react-grid-layout": "^1.3.4",
|
|
51
52
|
"react-hook-form": "^7.31.2",
|
|
52
53
|
"tabler-icons-react": "^1.48.0"
|
|
53
54
|
}
|