@faasjs/ant-design 0.0.3-beta.54 → 0.0.3-beta.56
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/index.d.ts +7 -2
- package/dist/index.js +54 -32
- package/dist/index.mjs +68 -46
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,10 @@ import { MessageInstance } from 'antd/es/message/interface';
|
|
|
4
4
|
import { NotificationInstance } from 'antd/es/notification/interface';
|
|
5
5
|
import { ModalProps as ModalProps$1, DrawerProps as DrawerProps$1, FormItemProps as FormItemProps$1, InputProps, InputNumberProps, SwitchProps, SelectProps, DatePickerProps, TimePickerProps, FormInstance, DescriptionsProps, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, FormProps as FormProps$1, ButtonProps } from 'antd';
|
|
6
6
|
export { Drawer, Modal } from 'antd';
|
|
7
|
+
import { BrowserRouterProps, RouteProps } from 'react-router-dom';
|
|
7
8
|
import * as react from 'react';
|
|
8
9
|
import { CSSProperties, ReactNode, ReactElement, Component, LazyExoticComponent, ComponentType } from 'react';
|
|
10
|
+
export { lazy } from 'react';
|
|
9
11
|
import { Dayjs } from 'dayjs';
|
|
10
12
|
import { RuleObject } from 'rc-field-form/lib/interface';
|
|
11
13
|
import { FaasDataInjection as FaasDataInjection$1, FaasDataWrapperProps as FaasDataWrapperProps$1 } from '@faasjs/react';
|
|
@@ -16,7 +18,6 @@ import * as antd_es_form from 'antd/es/form';
|
|
|
16
18
|
import * as rc_field_form_es_useWatch from 'rc-field-form/es/useWatch';
|
|
17
19
|
import * as antd_es_form_hooks_useFormInstance from 'antd/es/form/hooks/useFormInstance';
|
|
18
20
|
import * as antd_es_form_Form from 'antd/es/form/Form';
|
|
19
|
-
import { RouteProps } from 'react-router-dom';
|
|
20
21
|
|
|
21
22
|
interface ModalProps extends ModalProps$1 {
|
|
22
23
|
children?: JSX.Element | JSX.Element[] | string;
|
|
@@ -74,6 +75,7 @@ interface AppProps {
|
|
|
74
75
|
children: React.ReactNode;
|
|
75
76
|
styleProviderProps?: StyleProviderProps;
|
|
76
77
|
configProviderProps?: ConfigProviderProps$1;
|
|
78
|
+
browserRouterProps?: BrowserRouterProps;
|
|
77
79
|
}
|
|
78
80
|
interface useAppProps {
|
|
79
81
|
message: MessageInstance;
|
|
@@ -82,6 +84,9 @@ interface useAppProps {
|
|
|
82
84
|
setDrawerProps: (changes: Partial<DrawerProps>) => void;
|
|
83
85
|
}
|
|
84
86
|
declare function App(props: AppProps): JSX.Element;
|
|
87
|
+
declare namespace App {
|
|
88
|
+
var useApp: typeof useApp;
|
|
89
|
+
}
|
|
85
90
|
declare function useApp(): useAppProps;
|
|
86
91
|
|
|
87
92
|
interface BlankProps {
|
|
@@ -478,7 +483,7 @@ interface RoutesProps {
|
|
|
478
483
|
* Routes with lazy loading and 404 page.
|
|
479
484
|
*
|
|
480
485
|
* ```tsx
|
|
481
|
-
* import { lazy } from '
|
|
486
|
+
* import { Routes, lazy } from '@faasjs/ant-design'
|
|
482
487
|
* import { BrowserRouter } from 'react-router-dom'
|
|
483
488
|
*
|
|
484
489
|
* export function App () {
|
package/dist/index.js
CHANGED
|
@@ -43,6 +43,7 @@ __export(src_exports, {
|
|
|
43
43
|
Routes: () => Routes,
|
|
44
44
|
Table: () => Table,
|
|
45
45
|
Title: () => Title,
|
|
46
|
+
lazy: () => import_react13.lazy,
|
|
46
47
|
transferOptions: () => transferOptions,
|
|
47
48
|
transferValue: () => transferValue,
|
|
48
49
|
useApp: () => useApp,
|
|
@@ -115,6 +116,7 @@ function useDrawer(init) {
|
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
// src/App.tsx
|
|
119
|
+
var import_react_router_dom = require("react-router-dom");
|
|
118
120
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
119
121
|
var AppContext = (0, import_react4.createContext)({
|
|
120
122
|
message: {},
|
|
@@ -122,6 +124,18 @@ var AppContext = (0, import_react4.createContext)({
|
|
|
122
124
|
setModalProps: () => void 0,
|
|
123
125
|
setDrawerProps: () => void 0
|
|
124
126
|
});
|
|
127
|
+
function RoutesApp(props) {
|
|
128
|
+
const location = (0, import_react_router_dom.useLocation)();
|
|
129
|
+
const { setDrawerProps, setModalProps } = useApp();
|
|
130
|
+
(0, import_react4.useEffect)(() => {
|
|
131
|
+
console.debug("location", location);
|
|
132
|
+
setDrawerProps({ open: false });
|
|
133
|
+
setModalProps({ open: false });
|
|
134
|
+
}, [location]);
|
|
135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
136
|
+
children: props.children
|
|
137
|
+
});
|
|
138
|
+
}
|
|
125
139
|
function App(props) {
|
|
126
140
|
const [messageApi, messageContextHolder] = import_antd3.message.useMessage();
|
|
127
141
|
const [notificationApi, notificationContextHolder] = import_antd3.notification.useNotification();
|
|
@@ -142,21 +156,26 @@ function App(props) {
|
|
|
142
156
|
]
|
|
143
157
|
);
|
|
144
158
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_cssinjs.StyleProvider, {
|
|
145
|
-
...props.styleProviderProps || {},
|
|
159
|
+
...Object.assign(props.styleProviderProps || {}, {
|
|
160
|
+
hashPriority: "high",
|
|
161
|
+
transformers: [import_cssinjs.legacyLogicalPropertiesTransformer]
|
|
162
|
+
}),
|
|
146
163
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.ConfigProvider, {
|
|
147
|
-
...
|
|
148
|
-
|
|
149
|
-
transformers: [import_cssinjs.legacyLogicalPropertiesTransformer]
|
|
150
|
-
}),
|
|
151
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AppContext.Provider, {
|
|
164
|
+
...props.configProviderProps,
|
|
165
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppContext.Provider, {
|
|
152
166
|
value: memoizedContextValue,
|
|
153
|
-
children:
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
167
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_router_dom.BrowserRouter, {
|
|
168
|
+
...props.browserRouterProps,
|
|
169
|
+
children: [
|
|
170
|
+
messageContextHolder,
|
|
171
|
+
notificationContextHolder,
|
|
172
|
+
modal,
|
|
173
|
+
drawer,
|
|
174
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RoutesApp, {
|
|
175
|
+
children: props.children
|
|
176
|
+
})
|
|
177
|
+
]
|
|
178
|
+
})
|
|
160
179
|
})
|
|
161
180
|
})
|
|
162
181
|
});
|
|
@@ -164,6 +183,7 @@ function App(props) {
|
|
|
164
183
|
function useApp() {
|
|
165
184
|
return (0, import_react4.useContext)(AppContext);
|
|
166
185
|
}
|
|
186
|
+
App.useApp = useApp;
|
|
167
187
|
|
|
168
188
|
// src/Blank.tsx
|
|
169
189
|
var import_antd4 = require("antd");
|
|
@@ -1054,7 +1074,7 @@ Form.ErrorList = import_antd9.Form.ErrorList;
|
|
|
1054
1074
|
Form.Provider = import_antd9.Form.Provider;
|
|
1055
1075
|
|
|
1056
1076
|
// src/Link.tsx
|
|
1057
|
-
var
|
|
1077
|
+
var import_react_router_dom2 = require("react-router-dom");
|
|
1058
1078
|
var import_antd10 = require("antd");
|
|
1059
1079
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
1060
1080
|
function Link(props) {
|
|
@@ -1087,7 +1107,7 @@ function Link(props) {
|
|
|
1087
1107
|
});
|
|
1088
1108
|
}
|
|
1089
1109
|
if (props.button)
|
|
1090
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Link, {
|
|
1091
1111
|
to: props.href,
|
|
1092
1112
|
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
1093
1113
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Button, {
|
|
@@ -1096,7 +1116,7 @@ function Link(props) {
|
|
|
1096
1116
|
children: (_c = props.text) != null ? _c : props.children
|
|
1097
1117
|
})
|
|
1098
1118
|
});
|
|
1099
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Link, {
|
|
1100
1120
|
to: props.href,
|
|
1101
1121
|
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
1102
1122
|
style,
|
|
@@ -1107,7 +1127,8 @@ function Link(props) {
|
|
|
1107
1127
|
// src/Routers.tsx
|
|
1108
1128
|
var import_antd11 = require("antd");
|
|
1109
1129
|
var import_react12 = require("react");
|
|
1110
|
-
var
|
|
1130
|
+
var import_react_router_dom3 = require("react-router-dom");
|
|
1131
|
+
var import_react13 = require("react");
|
|
1111
1132
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
1112
1133
|
function PageNotFound() {
|
|
1113
1134
|
const config = useConfigContext();
|
|
@@ -1117,9 +1138,9 @@ function PageNotFound() {
|
|
|
1117
1138
|
});
|
|
1118
1139
|
}
|
|
1119
1140
|
function Routes(props) {
|
|
1120
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_router_dom3.Routes, {
|
|
1121
1142
|
children: [
|
|
1122
|
-
props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1143
|
+
props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom3.Route, {
|
|
1123
1144
|
...r,
|
|
1124
1145
|
element: r.element || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react12.Suspense, {
|
|
1125
1146
|
fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
@@ -1131,7 +1152,7 @@ function Routes(props) {
|
|
|
1131
1152
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(r.page, {})
|
|
1132
1153
|
})
|
|
1133
1154
|
}, r.path)),
|
|
1134
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1155
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom3.Route, {
|
|
1135
1156
|
path: "*",
|
|
1136
1157
|
element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageNotFound, {})
|
|
1137
1158
|
}, "*")
|
|
@@ -1140,7 +1161,7 @@ function Routes(props) {
|
|
|
1140
1161
|
}
|
|
1141
1162
|
|
|
1142
1163
|
// src/Table.tsx
|
|
1143
|
-
var
|
|
1164
|
+
var import_react14 = require("react");
|
|
1144
1165
|
var import_antd12 = require("antd");
|
|
1145
1166
|
var import_dayjs2 = __toESM(require("dayjs"));
|
|
1146
1167
|
var import_icons3 = require("@ant-design/icons");
|
|
@@ -1171,9 +1192,9 @@ function processValue(item, value) {
|
|
|
1171
1192
|
return value;
|
|
1172
1193
|
}
|
|
1173
1194
|
function Table(props) {
|
|
1174
|
-
const [columns, setColumns] = (0,
|
|
1195
|
+
const [columns, setColumns] = (0, import_react14.useState)();
|
|
1175
1196
|
const { common: common2 } = useConfigContext();
|
|
1176
|
-
(0,
|
|
1197
|
+
(0, import_react14.useEffect)(() => {
|
|
1177
1198
|
var _a;
|
|
1178
1199
|
for (const item of props.items) {
|
|
1179
1200
|
if (!item.key)
|
|
@@ -1197,7 +1218,7 @@ function Table(props) {
|
|
|
1197
1218
|
if (item.tableChildren === null)
|
|
1198
1219
|
item.render = () => null;
|
|
1199
1220
|
else if (item.tableChildren)
|
|
1200
|
-
item.render = (value, values) => (0,
|
|
1221
|
+
item.render = (value, values) => (0, import_react14.cloneElement)(
|
|
1201
1222
|
item.tableChildren,
|
|
1202
1223
|
{
|
|
1203
1224
|
scene: "table",
|
|
@@ -1208,7 +1229,7 @@ function Table(props) {
|
|
|
1208
1229
|
else if (item.children === null)
|
|
1209
1230
|
item.render = () => null;
|
|
1210
1231
|
else if (item.children)
|
|
1211
|
-
item.render = (value, values) => (0,
|
|
1232
|
+
item.render = (value, values) => (0, import_react14.cloneElement)(
|
|
1212
1233
|
item.children,
|
|
1213
1234
|
{
|
|
1214
1235
|
scene: "table",
|
|
@@ -1218,7 +1239,7 @@ function Table(props) {
|
|
|
1218
1239
|
);
|
|
1219
1240
|
if (props.extendTypes && props.extendTypes[item.type]) {
|
|
1220
1241
|
if (props.extendTypes[item.type].children)
|
|
1221
|
-
item.render = (value, values) => (0,
|
|
1242
|
+
item.render = (value, values) => (0, import_react14.cloneElement)(
|
|
1222
1243
|
props.extendTypes[item.type].children,
|
|
1223
1244
|
{
|
|
1224
1245
|
scene: "table",
|
|
@@ -1484,7 +1505,7 @@ function Table(props) {
|
|
|
1484
1505
|
}
|
|
1485
1506
|
setColumns(props.items);
|
|
1486
1507
|
}, [props.items]);
|
|
1487
|
-
(0,
|
|
1508
|
+
(0, import_react14.useEffect)(() => {
|
|
1488
1509
|
if (!props.dataSource || !columns)
|
|
1489
1510
|
return;
|
|
1490
1511
|
for (const column of columns) {
|
|
@@ -1530,8 +1551,8 @@ function FaasDataTable({
|
|
|
1530
1551
|
params,
|
|
1531
1552
|
reload
|
|
1532
1553
|
}) {
|
|
1533
|
-
const [currentColumns, setCurrentColumns] = (0,
|
|
1534
|
-
(0,
|
|
1554
|
+
const [currentColumns, setCurrentColumns] = (0, import_react14.useState)(columns);
|
|
1555
|
+
(0, import_react14.useEffect)(() => {
|
|
1535
1556
|
if (!data || Array.isArray(data))
|
|
1536
1557
|
return;
|
|
1537
1558
|
setCurrentColumns((prev) => {
|
|
@@ -1611,11 +1632,11 @@ function FaasDataTable({
|
|
|
1611
1632
|
}
|
|
1612
1633
|
|
|
1613
1634
|
// src/Title.tsx
|
|
1614
|
-
var
|
|
1635
|
+
var import_react15 = require("react");
|
|
1615
1636
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
1616
1637
|
function Title(props) {
|
|
1617
1638
|
const { Title: Title2 } = useConfigContext();
|
|
1618
|
-
(0,
|
|
1639
|
+
(0, import_react15.useEffect)(() => {
|
|
1619
1640
|
const title = Array.isArray(props.title) ? props.title : [props.title];
|
|
1620
1641
|
document.title = title.concat(props.suffix || Title2.suffix).filter((t) => !!t).join(props.separator || Title2.separator);
|
|
1621
1642
|
}, [props]);
|
|
@@ -1635,7 +1656,7 @@ function Title(props) {
|
|
|
1635
1656
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1636
1657
|
});
|
|
1637
1658
|
if (props.children)
|
|
1638
|
-
return (0,
|
|
1659
|
+
return (0, import_react15.cloneElement)(props.children, { title: props.title });
|
|
1639
1660
|
return null;
|
|
1640
1661
|
}
|
|
1641
1662
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1657,6 +1678,7 @@ function Title(props) {
|
|
|
1657
1678
|
Routes,
|
|
1658
1679
|
Table,
|
|
1659
1680
|
Title,
|
|
1681
|
+
lazy,
|
|
1660
1682
|
transferOptions,
|
|
1661
1683
|
transferValue,
|
|
1662
1684
|
useApp,
|
package/dist/index.mjs
CHANGED
|
@@ -11,6 +11,7 @@ import { StyleProvider, legacyLogicalPropertiesTransformer } from "@ant-design/c
|
|
|
11
11
|
import {
|
|
12
12
|
createContext,
|
|
13
13
|
useContext,
|
|
14
|
+
useEffect,
|
|
14
15
|
useMemo
|
|
15
16
|
} from "react";
|
|
16
17
|
|
|
@@ -69,13 +70,26 @@ function useDrawer(init) {
|
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
// src/App.tsx
|
|
72
|
-
import {
|
|
73
|
+
import { BrowserRouter, useLocation } from "react-router-dom";
|
|
74
|
+
import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
73
75
|
var AppContext = createContext({
|
|
74
76
|
message: {},
|
|
75
77
|
notification: {},
|
|
76
78
|
setModalProps: () => void 0,
|
|
77
79
|
setDrawerProps: () => void 0
|
|
78
80
|
});
|
|
81
|
+
function RoutesApp(props) {
|
|
82
|
+
const location = useLocation();
|
|
83
|
+
const { setDrawerProps, setModalProps } = useApp();
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
console.debug("location", location);
|
|
86
|
+
setDrawerProps({ open: false });
|
|
87
|
+
setModalProps({ open: false });
|
|
88
|
+
}, [location]);
|
|
89
|
+
return /* @__PURE__ */ jsx3(Fragment, {
|
|
90
|
+
children: props.children
|
|
91
|
+
});
|
|
92
|
+
}
|
|
79
93
|
function App(props) {
|
|
80
94
|
const [messageApi, messageContextHolder] = message.useMessage();
|
|
81
95
|
const [notificationApi, notificationContextHolder] = notification.useNotification();
|
|
@@ -96,21 +110,26 @@ function App(props) {
|
|
|
96
110
|
]
|
|
97
111
|
);
|
|
98
112
|
return /* @__PURE__ */ jsx3(StyleProvider, {
|
|
99
|
-
...props.styleProviderProps || {},
|
|
113
|
+
...Object.assign(props.styleProviderProps || {}, {
|
|
114
|
+
hashPriority: "high",
|
|
115
|
+
transformers: [legacyLogicalPropertiesTransformer]
|
|
116
|
+
}),
|
|
100
117
|
children: /* @__PURE__ */ jsx3(ConfigProvider, {
|
|
101
|
-
...
|
|
102
|
-
|
|
103
|
-
transformers: [legacyLogicalPropertiesTransformer]
|
|
104
|
-
}),
|
|
105
|
-
children: /* @__PURE__ */ jsxs(AppContext.Provider, {
|
|
118
|
+
...props.configProviderProps,
|
|
119
|
+
children: /* @__PURE__ */ jsx3(AppContext.Provider, {
|
|
106
120
|
value: memoizedContextValue,
|
|
107
|
-
children:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
121
|
+
children: /* @__PURE__ */ jsxs(BrowserRouter, {
|
|
122
|
+
...props.browserRouterProps,
|
|
123
|
+
children: [
|
|
124
|
+
messageContextHolder,
|
|
125
|
+
notificationContextHolder,
|
|
126
|
+
modal,
|
|
127
|
+
drawer,
|
|
128
|
+
/* @__PURE__ */ jsx3(RoutesApp, {
|
|
129
|
+
children: props.children
|
|
130
|
+
})
|
|
131
|
+
]
|
|
132
|
+
})
|
|
114
133
|
})
|
|
115
134
|
})
|
|
116
135
|
});
|
|
@@ -118,6 +137,7 @@ function App(props) {
|
|
|
118
137
|
function useApp() {
|
|
119
138
|
return useContext(AppContext);
|
|
120
139
|
}
|
|
140
|
+
App.useApp = useApp;
|
|
121
141
|
|
|
122
142
|
// src/Blank.tsx
|
|
123
143
|
import { Typography } from "antd";
|
|
@@ -127,7 +147,7 @@ import { isNil } from "lodash-es";
|
|
|
127
147
|
import {
|
|
128
148
|
createContext as createContext2,
|
|
129
149
|
useContext as useContext2,
|
|
130
|
-
useEffect,
|
|
150
|
+
useEffect as useEffect2,
|
|
131
151
|
useState as useState3
|
|
132
152
|
} from "react";
|
|
133
153
|
import { defaultsDeep } from "lodash-es";
|
|
@@ -176,7 +196,7 @@ function ConfigProvider2({
|
|
|
176
196
|
children
|
|
177
197
|
}) {
|
|
178
198
|
const [values, setValues] = useState3(baseConfig);
|
|
179
|
-
|
|
199
|
+
useEffect2(() => {
|
|
180
200
|
if (config.lang === "zh") {
|
|
181
201
|
setValues(defaultsDeep(config, {
|
|
182
202
|
lang: "zh",
|
|
@@ -242,7 +262,7 @@ import {
|
|
|
242
262
|
import { isFunction, upperFirst as upperFirst2 } from "lodash-es";
|
|
243
263
|
import {
|
|
244
264
|
cloneElement,
|
|
245
|
-
useEffect as
|
|
265
|
+
useEffect as useEffect3,
|
|
246
266
|
useState as useState4
|
|
247
267
|
} from "react";
|
|
248
268
|
|
|
@@ -251,10 +271,10 @@ import { FaasDataWrapper as Origin } from "@faasjs/react";
|
|
|
251
271
|
|
|
252
272
|
// src/Loading.tsx
|
|
253
273
|
import { Spin } from "antd";
|
|
254
|
-
import { Fragment, jsx as jsx6 } from "react/jsx-runtime";
|
|
274
|
+
import { Fragment as Fragment2, jsx as jsx6 } from "react/jsx-runtime";
|
|
255
275
|
function Loading(props) {
|
|
256
276
|
if (props.loading === false)
|
|
257
|
-
return /* @__PURE__ */ jsx6(
|
|
277
|
+
return /* @__PURE__ */ jsx6(Fragment2, {
|
|
258
278
|
children: props.children
|
|
259
279
|
});
|
|
260
280
|
return /* @__PURE__ */ jsx6("div", {
|
|
@@ -283,11 +303,11 @@ function FaasDataWrapper(props) {
|
|
|
283
303
|
}
|
|
284
304
|
|
|
285
305
|
// src/Description.tsx
|
|
286
|
-
import { Fragment as
|
|
306
|
+
import { Fragment as Fragment3, jsx as jsx8 } from "react/jsx-runtime";
|
|
287
307
|
function DescriptionItemContent(props) {
|
|
288
308
|
var _a;
|
|
289
309
|
const [computedProps, setComputedProps] = useState4();
|
|
290
|
-
|
|
310
|
+
useEffect3(() => {
|
|
291
311
|
var _a2, _b;
|
|
292
312
|
const propsCopy = { ...props };
|
|
293
313
|
if (!propsCopy.item.title)
|
|
@@ -326,7 +346,7 @@ function DescriptionItemContent(props) {
|
|
|
326
346
|
}
|
|
327
347
|
);
|
|
328
348
|
else if (computedProps.extendTypes[computedProps.item.type].render)
|
|
329
|
-
return /* @__PURE__ */ jsx8(
|
|
349
|
+
return /* @__PURE__ */ jsx8(Fragment3, {
|
|
330
350
|
children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values, 0, "description")
|
|
331
351
|
});
|
|
332
352
|
else
|
|
@@ -355,13 +375,13 @@ function DescriptionItemContent(props) {
|
|
|
355
375
|
return /* @__PURE__ */ jsx8(Blank, {});
|
|
356
376
|
switch (computedProps.item.type) {
|
|
357
377
|
case "string[]":
|
|
358
|
-
return /* @__PURE__ */ jsx8(
|
|
378
|
+
return /* @__PURE__ */ jsx8(Fragment3, {
|
|
359
379
|
children: computedProps.value.join(", ")
|
|
360
380
|
});
|
|
361
381
|
case "number":
|
|
362
382
|
return computedProps.value || null;
|
|
363
383
|
case "number[]":
|
|
364
|
-
return /* @__PURE__ */ jsx8(
|
|
384
|
+
return /* @__PURE__ */ jsx8(Fragment3, {
|
|
365
385
|
children: computedProps.value.join(", ")
|
|
366
386
|
});
|
|
367
387
|
case "boolean":
|
|
@@ -377,11 +397,11 @@ function DescriptionItemContent(props) {
|
|
|
377
397
|
}
|
|
378
398
|
});
|
|
379
399
|
case "time":
|
|
380
|
-
return /* @__PURE__ */ jsx8(
|
|
400
|
+
return /* @__PURE__ */ jsx8(Fragment3, {
|
|
381
401
|
children: computedProps.value.format("YYYY-MM-DD HH:mm:ss")
|
|
382
402
|
});
|
|
383
403
|
case "date":
|
|
384
|
-
return /* @__PURE__ */ jsx8(
|
|
404
|
+
return /* @__PURE__ */ jsx8(Fragment3, {
|
|
385
405
|
children: computedProps.value.format("YYYY-MM-DD")
|
|
386
406
|
});
|
|
387
407
|
case "object":
|
|
@@ -500,7 +520,7 @@ import {
|
|
|
500
520
|
Form as AntdForm2
|
|
501
521
|
} from "antd";
|
|
502
522
|
import {
|
|
503
|
-
useEffect as
|
|
523
|
+
useEffect as useEffect5,
|
|
504
524
|
useState as useState6,
|
|
505
525
|
useCallback,
|
|
506
526
|
isValidElement
|
|
@@ -522,11 +542,11 @@ import {
|
|
|
522
542
|
import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
|
|
523
543
|
import {
|
|
524
544
|
cloneElement as cloneElement2,
|
|
525
|
-
useEffect as
|
|
545
|
+
useEffect as useEffect4,
|
|
526
546
|
useState as useState5
|
|
527
547
|
} from "react";
|
|
528
548
|
import { upperFirst as upperFirst3 } from "lodash-es";
|
|
529
|
-
import { Fragment as
|
|
549
|
+
import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
530
550
|
function processProps(propsCopy, config) {
|
|
531
551
|
if (!propsCopy.title)
|
|
532
552
|
propsCopy.title = upperFirst3(propsCopy.id);
|
|
@@ -579,7 +599,7 @@ function FormItem(props) {
|
|
|
579
599
|
const [extendTypes, setExtendTypes] = useState5();
|
|
580
600
|
const { common: common2 } = useConfigContext();
|
|
581
601
|
const [hidden, setHidden] = useState5(props.hidden || false);
|
|
582
|
-
|
|
602
|
+
useEffect4(() => {
|
|
583
603
|
const propsCopy = { ...props };
|
|
584
604
|
if (propsCopy.extendTypes) {
|
|
585
605
|
setExtendTypes(propsCopy.extendTypes);
|
|
@@ -664,7 +684,7 @@ function FormItem(props) {
|
|
|
664
684
|
rules: computedProps.rules,
|
|
665
685
|
children: (fields, { add, remove }, { errors }) => {
|
|
666
686
|
var _a2;
|
|
667
|
-
return /* @__PURE__ */ jsxs2(
|
|
687
|
+
return /* @__PURE__ */ jsxs2(Fragment4, {
|
|
668
688
|
children: [
|
|
669
689
|
computedProps.label && /* @__PURE__ */ jsx10("div", {
|
|
670
690
|
className: "ant-form-item-label",
|
|
@@ -749,7 +769,7 @@ function FormItem(props) {
|
|
|
749
769
|
rules: computedProps.rules,
|
|
750
770
|
children: (fields, { add, remove }, { errors }) => {
|
|
751
771
|
var _a2, _b;
|
|
752
|
-
return /* @__PURE__ */ jsxs2(
|
|
772
|
+
return /* @__PURE__ */ jsxs2(Fragment4, {
|
|
753
773
|
children: [
|
|
754
774
|
computedProps.label && /* @__PURE__ */ jsx10("div", {
|
|
755
775
|
className: "ant-form-item-label",
|
|
@@ -833,7 +853,7 @@ function FormItem(props) {
|
|
|
833
853
|
})
|
|
834
854
|
});
|
|
835
855
|
case "object":
|
|
836
|
-
return /* @__PURE__ */ jsxs2(
|
|
856
|
+
return /* @__PURE__ */ jsxs2(Fragment4, {
|
|
837
857
|
children: [
|
|
838
858
|
computedProps.label && /* @__PURE__ */ jsx10("div", {
|
|
839
859
|
className: "ant-form-item-label",
|
|
@@ -851,7 +871,7 @@ function FormItem(props) {
|
|
|
851
871
|
return /* @__PURE__ */ jsx10(AntdForm.List, {
|
|
852
872
|
name: computedProps.name,
|
|
853
873
|
rules: computedProps.rules,
|
|
854
|
-
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ jsxs2(
|
|
874
|
+
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ jsxs2(Fragment4, {
|
|
855
875
|
children: [
|
|
856
876
|
fields.map((field) => /* @__PURE__ */ jsxs2(AntdForm.Item, {
|
|
857
877
|
style: { marginBottom: 0 },
|
|
@@ -925,7 +945,7 @@ function Form(props) {
|
|
|
925
945
|
const [extendTypes, setExtendTypes] = useState6();
|
|
926
946
|
const [form] = AntdForm2.useForm(props.form);
|
|
927
947
|
const [initialValues, setInitialValues] = useState6(props.initialValues);
|
|
928
|
-
|
|
948
|
+
useEffect5(() => {
|
|
929
949
|
var _a2, _b2, _c;
|
|
930
950
|
const propsCopy = {
|
|
931
951
|
...props,
|
|
@@ -1005,7 +1025,7 @@ function Form(props) {
|
|
|
1005
1025
|
item.onValueChange(changedValues[key], allValues, form);
|
|
1006
1026
|
}
|
|
1007
1027
|
}, [computedProps]);
|
|
1008
|
-
|
|
1028
|
+
useEffect5(() => {
|
|
1009
1029
|
if (!initialValues)
|
|
1010
1030
|
return;
|
|
1011
1031
|
console.debug("Form:initialValues", initialValues);
|
|
@@ -1102,6 +1122,7 @@ import {
|
|
|
1102
1122
|
Routes as OriginRoutes,
|
|
1103
1123
|
Route
|
|
1104
1124
|
} from "react-router-dom";
|
|
1125
|
+
import { lazy } from "react";
|
|
1105
1126
|
import { jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1106
1127
|
function PageNotFound() {
|
|
1107
1128
|
const config = useConfigContext();
|
|
@@ -1136,7 +1157,7 @@ function Routes(props) {
|
|
|
1136
1157
|
// src/Table.tsx
|
|
1137
1158
|
import {
|
|
1138
1159
|
useState as useState7,
|
|
1139
|
-
useEffect as
|
|
1160
|
+
useEffect as useEffect6,
|
|
1140
1161
|
cloneElement as cloneElement3
|
|
1141
1162
|
} from "react";
|
|
1142
1163
|
import {
|
|
@@ -1151,7 +1172,7 @@ import {
|
|
|
1151
1172
|
uniqBy,
|
|
1152
1173
|
upperFirst as upperFirst4
|
|
1153
1174
|
} from "lodash-es";
|
|
1154
|
-
import { Fragment as
|
|
1175
|
+
import { Fragment as Fragment5, jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1155
1176
|
function processValue(item, value) {
|
|
1156
1177
|
var _a;
|
|
1157
1178
|
const transferred = transferValue(item.type, value);
|
|
@@ -1179,7 +1200,7 @@ function processValue(item, value) {
|
|
|
1179
1200
|
function Table(props) {
|
|
1180
1201
|
const [columns, setColumns] = useState7();
|
|
1181
1202
|
const { common: common2 } = useConfigContext();
|
|
1182
|
-
|
|
1203
|
+
useEffect6(() => {
|
|
1183
1204
|
var _a;
|
|
1184
1205
|
for (const item of props.items) {
|
|
1185
1206
|
if (!item.key)
|
|
@@ -1468,7 +1489,7 @@ function Table(props) {
|
|
|
1468
1489
|
break;
|
|
1469
1490
|
case "object[]":
|
|
1470
1491
|
if (!item.render)
|
|
1471
|
-
item.render = (value) => /* @__PURE__ */ jsx14(
|
|
1492
|
+
item.render = (value) => /* @__PURE__ */ jsx14(Fragment5, {
|
|
1472
1493
|
children: value.map((v, i) => /* @__PURE__ */ jsx14(Description, {
|
|
1473
1494
|
items: item.object,
|
|
1474
1495
|
dataSource: v || [],
|
|
@@ -1490,7 +1511,7 @@ function Table(props) {
|
|
|
1490
1511
|
}
|
|
1491
1512
|
setColumns(props.items);
|
|
1492
1513
|
}, [props.items]);
|
|
1493
|
-
|
|
1514
|
+
useEffect6(() => {
|
|
1494
1515
|
if (!props.dataSource || !columns)
|
|
1495
1516
|
return;
|
|
1496
1517
|
for (const column of columns) {
|
|
@@ -1537,7 +1558,7 @@ function FaasDataTable({
|
|
|
1537
1558
|
reload
|
|
1538
1559
|
}) {
|
|
1539
1560
|
const [currentColumns, setCurrentColumns] = useState7(columns);
|
|
1540
|
-
|
|
1561
|
+
useEffect6(() => {
|
|
1541
1562
|
if (!data || Array.isArray(data))
|
|
1542
1563
|
return;
|
|
1543
1564
|
setCurrentColumns((prev) => {
|
|
@@ -1617,11 +1638,11 @@ function FaasDataTable({
|
|
|
1617
1638
|
}
|
|
1618
1639
|
|
|
1619
1640
|
// src/Title.tsx
|
|
1620
|
-
import { useEffect as
|
|
1621
|
-
import { Fragment as
|
|
1641
|
+
import { useEffect as useEffect7, cloneElement as cloneElement4 } from "react";
|
|
1642
|
+
import { Fragment as Fragment6, jsx as jsx15 } from "react/jsx-runtime";
|
|
1622
1643
|
function Title(props) {
|
|
1623
1644
|
const { Title: Title2 } = useConfigContext();
|
|
1624
|
-
|
|
1645
|
+
useEffect7(() => {
|
|
1625
1646
|
const title = Array.isArray(props.title) ? props.title : [props.title];
|
|
1626
1647
|
document.title = title.concat(props.suffix || Title2.suffix).filter((t) => !!t).join(props.separator || Title2.separator);
|
|
1627
1648
|
}, [props]);
|
|
@@ -1637,7 +1658,7 @@ function Title(props) {
|
|
|
1637
1658
|
});
|
|
1638
1659
|
}
|
|
1639
1660
|
if (props.plain)
|
|
1640
|
-
return /* @__PURE__ */ jsx15(
|
|
1661
|
+
return /* @__PURE__ */ jsx15(Fragment6, {
|
|
1641
1662
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1642
1663
|
});
|
|
1643
1664
|
if (props.children)
|
|
@@ -1662,6 +1683,7 @@ export {
|
|
|
1662
1683
|
Routes,
|
|
1663
1684
|
Table,
|
|
1664
1685
|
Title,
|
|
1686
|
+
lazy,
|
|
1665
1687
|
transferOptions,
|
|
1666
1688
|
transferValue,
|
|
1667
1689
|
useApp,
|