@faasjs/ant-design 0.0.2-beta.344 → 0.0.2-beta.348
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 +30 -27
- package/dist/index.js +125 -80
- package/dist/index.mjs +84 -42
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DescriptionsProps, FormItemProps as FormItemProps$1, InputProps, InputNumberProps, SwitchProps, SelectProps, FormProps as FormProps$1, TableColumnProps, TableProps as TableProps$1 } from 'antd';
|
|
1
|
+
import { DescriptionsProps, DrawerProps as DrawerProps$1, FormItemProps as FormItemProps$1, InputProps, InputNumberProps, SwitchProps, SelectProps, FormProps as FormProps$1, TableColumnProps, TableProps as TableProps$1 } from 'antd';
|
|
2
|
+
export { Drawer } from 'antd';
|
|
2
3
|
import * as antd_lib_form_Form from 'antd/lib/form/Form';
|
|
3
4
|
import { RuleObject } from 'rc-field-form/lib/interface';
|
|
4
|
-
import { ReactNode } from 'react';
|
|
5
5
|
|
|
6
6
|
declare function Blank(options?: {
|
|
7
7
|
value?: any;
|
|
@@ -16,28 +16,33 @@ declare type FaasItemTypeValue = {
|
|
|
16
16
|
'number[]': number[];
|
|
17
17
|
boolean: boolean;
|
|
18
18
|
};
|
|
19
|
-
declare type
|
|
19
|
+
declare type BaseOption = string | number | {
|
|
20
|
+
label: string;
|
|
21
|
+
value?: string | number;
|
|
22
|
+
};
|
|
23
|
+
declare type BaseItemProps = {
|
|
20
24
|
id: string;
|
|
21
25
|
title?: string;
|
|
26
|
+
options?: BaseOption[];
|
|
22
27
|
};
|
|
23
|
-
declare type FaasItemProps =
|
|
28
|
+
declare type FaasItemProps = BaseItemProps & {
|
|
24
29
|
/**
|
|
25
30
|
* Support string, string[], number, number[], boolean
|
|
26
31
|
* @default 'string'
|
|
27
32
|
*/
|
|
28
33
|
type?: FaasItemType;
|
|
29
34
|
};
|
|
35
|
+
declare function transferOptions(options: BaseOption[]): {
|
|
36
|
+
label: string;
|
|
37
|
+
value?: string | number;
|
|
38
|
+
}[];
|
|
30
39
|
|
|
31
40
|
declare type ExtendDescriptionTypeProps = {
|
|
32
41
|
children?: JSX.Element | null;
|
|
33
42
|
render?: (value: any, values: any) => JSX.Element | string | number | boolean | null;
|
|
34
43
|
};
|
|
35
|
-
declare type ExtendDescriptionItemProps =
|
|
44
|
+
declare type ExtendDescriptionItemProps = BaseItemProps;
|
|
36
45
|
declare type DescriptionItemProps<T = any> = {
|
|
37
|
-
options?: {
|
|
38
|
-
label: string;
|
|
39
|
-
value?: T;
|
|
40
|
-
}[];
|
|
41
46
|
children?: JSX.Element;
|
|
42
47
|
render?: (value: T, values: any) => JSX.Element | string | number | boolean | null;
|
|
43
48
|
} & FaasItemProps;
|
|
@@ -54,6 +59,15 @@ declare type DescriptionProps<T = any, ExtendItemProps = any> = {
|
|
|
54
59
|
} & DescriptionsProps;
|
|
55
60
|
declare function Description(props: DescriptionProps): JSX.Element;
|
|
56
61
|
|
|
62
|
+
declare type DrawerProps = DrawerProps$1 & {
|
|
63
|
+
children?: JSX.Element | JSX.Element[];
|
|
64
|
+
};
|
|
65
|
+
declare function useDrawer(init?: DrawerProps): {
|
|
66
|
+
drawer: JSX.Element;
|
|
67
|
+
drawerProps: DrawerProps;
|
|
68
|
+
setDrawerProps(changes: Partial<DrawerProps>): void;
|
|
69
|
+
};
|
|
70
|
+
|
|
57
71
|
declare type StringProps = {
|
|
58
72
|
type?: 'string';
|
|
59
73
|
input?: InputProps;
|
|
@@ -76,22 +90,16 @@ declare type BooleanProps = {
|
|
|
76
90
|
type: 'boolean';
|
|
77
91
|
input?: SwitchProps;
|
|
78
92
|
};
|
|
79
|
-
declare type
|
|
80
|
-
|
|
81
|
-
value?: T;
|
|
82
|
-
disabled?: boolean;
|
|
83
|
-
children?: Omit<OptionType<T>, 'children'>[];
|
|
84
|
-
};
|
|
85
|
-
declare type OptionsProps<T = any> = {
|
|
86
|
-
options?: OptionType<T>[] | string[] | number[];
|
|
93
|
+
declare type OptionsProps = {
|
|
94
|
+
options: BaseOption[];
|
|
87
95
|
type?: 'string' | 'string[]' | 'number' | 'number[]';
|
|
88
96
|
input?: SelectProps<any>;
|
|
89
97
|
};
|
|
90
|
-
declare type FormItemInputProps<T = any> = StringProps | StringListProps | NumberProps | NumberListProps | BooleanProps | OptionsProps
|
|
98
|
+
declare type FormItemInputProps<T = any> = StringProps | StringListProps | NumberProps | NumberListProps | BooleanProps | OptionsProps;
|
|
91
99
|
declare type ExtendFormTypeProps = {
|
|
92
100
|
children?: JSX.Element | null;
|
|
93
101
|
};
|
|
94
|
-
declare type ExtendFormItemProps =
|
|
102
|
+
declare type ExtendFormItemProps = BaseItemProps & FormItemProps$1;
|
|
95
103
|
declare type FormItemProps<T = any> = {
|
|
96
104
|
children?: JSX.Element;
|
|
97
105
|
rules?: RuleObject[];
|
|
@@ -119,17 +127,12 @@ declare namespace Form {
|
|
|
119
127
|
var Item: typeof FormItem;
|
|
120
128
|
}
|
|
121
129
|
|
|
122
|
-
declare type TableItemProps<T = any> =
|
|
123
|
-
options?: {
|
|
124
|
-
label: string;
|
|
125
|
-
value?: T;
|
|
126
|
-
}[];
|
|
127
|
-
} & FaasItemProps & TableColumnProps<T>;
|
|
130
|
+
declare type TableItemProps<T = any> = FaasItemProps & TableColumnProps<T>;
|
|
128
131
|
declare type ExtendTableTypeProps = {
|
|
129
132
|
children?: JSX.Element | null;
|
|
130
133
|
render?: (value: any, values: any) => JSX.Element | string | number | boolean | null;
|
|
131
134
|
};
|
|
132
|
-
declare type ExtendTableItemProps<T = any> =
|
|
135
|
+
declare type ExtendTableItemProps<T = any> = BaseItemProps & TableColumnProps<T>;
|
|
133
136
|
declare type TableProps<T = any, ExtendTypes = any> = {
|
|
134
137
|
items: (TableItemProps | (ExtendTypes & ExtendTableItemProps))[];
|
|
135
138
|
extendTypes?: {
|
|
@@ -142,4 +145,4 @@ declare type TableProps<T = any, ExtendTypes = any> = {
|
|
|
142
145
|
} & TableProps$1<T>;
|
|
143
146
|
declare function Table<T = any, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): JSX.Element;
|
|
144
147
|
|
|
145
|
-
export {
|
|
148
|
+
export { BaseItemProps, BaseOption, Blank, Description, DescriptionItemProps, DescriptionProps, DrawerProps, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, ExtendFormItemProps, ExtendFormTypeProps, ExtendTableItemProps, ExtendTableTypeProps, FaasItemProps, FaasItemType, FaasItemTypeValue, Form, FormItem, FormItemProps, FormProps, Table, TableItemProps, TableProps, transferOptions, useDrawer };
|
package/dist/index.js
CHANGED
|
@@ -48,9 +48,12 @@ var src_exports = {};
|
|
|
48
48
|
__export(src_exports, {
|
|
49
49
|
Blank: () => Blank,
|
|
50
50
|
Description: () => Description,
|
|
51
|
+
Drawer: () => import_antd3.Drawer,
|
|
51
52
|
Form: () => Form,
|
|
52
53
|
FormItem: () => FormItem,
|
|
53
|
-
Table: () => Table
|
|
54
|
+
Table: () => Table,
|
|
55
|
+
transferOptions: () => transferOptions,
|
|
56
|
+
useDrawer: () => useDrawer
|
|
54
57
|
});
|
|
55
58
|
|
|
56
59
|
// react-shim.js
|
|
@@ -60,17 +63,28 @@ var import_react = __toESM(require("react"));
|
|
|
60
63
|
var import_antd = require("antd");
|
|
61
64
|
var import_lodash = require("lodash");
|
|
62
65
|
var _a;
|
|
63
|
-
var text = ((_a = navigator.language) == null ? void 0 : _a.includes("
|
|
66
|
+
var text = ((_a = navigator.language) == null ? void 0 : _a.includes("CN")) ? "\u7A7A" : "Empty";
|
|
64
67
|
function Blank(options) {
|
|
65
68
|
return !options || (0, import_lodash.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ import_react.default.createElement(import_antd.Typography.Text, {
|
|
66
69
|
disabled: true
|
|
67
70
|
}, (options == null ? void 0 : options.text) || text) : options.value;
|
|
68
71
|
}
|
|
69
72
|
|
|
73
|
+
// src/data.ts
|
|
74
|
+
var import_lodash2 = require("lodash");
|
|
75
|
+
function transferOptions(options) {
|
|
76
|
+
if (!options)
|
|
77
|
+
return [];
|
|
78
|
+
return options.map((item) => typeof item === "object" ? item : {
|
|
79
|
+
label: (0, import_lodash2.upperFirst)(item.toString()),
|
|
80
|
+
value: item
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
70
84
|
// src/Description.tsx
|
|
71
85
|
var import_icons = require("@ant-design/icons");
|
|
72
86
|
var import_antd2 = require("antd");
|
|
73
|
-
var
|
|
87
|
+
var import_lodash3 = require("lodash");
|
|
74
88
|
var import_react4 = require("react");
|
|
75
89
|
|
|
76
90
|
// src/FaasWrapper.tsx
|
|
@@ -86,7 +100,7 @@ function FaasDataWrapper({
|
|
|
86
100
|
(0, import_react2.useEffect)(() => {
|
|
87
101
|
if (!faasData)
|
|
88
102
|
return;
|
|
89
|
-
(0, import_react3.getClient)().faas(faasData.action, faasData.
|
|
103
|
+
(0, import_react3.getClient)().faas(faasData.action, faasData.params).then((res) => setData(res.data));
|
|
90
104
|
}, [JSON.stringify(faasData)]);
|
|
91
105
|
if (dataSource)
|
|
92
106
|
return render({ data: dataSource });
|
|
@@ -99,20 +113,23 @@ function FaasDataWrapper({
|
|
|
99
113
|
function DescriptionItemContent(props) {
|
|
100
114
|
const [computedProps, setComputedProps] = (0, import_react4.useState)();
|
|
101
115
|
(0, import_react4.useEffect)(() => {
|
|
102
|
-
var _a2;
|
|
116
|
+
var _a2, _b;
|
|
103
117
|
const propsCopy = __spreadValues({}, props);
|
|
104
118
|
if (!propsCopy.item.title)
|
|
105
|
-
propsCopy.item.title = (0,
|
|
119
|
+
propsCopy.item.title = (0, import_lodash3.upperFirst)(propsCopy.item.id);
|
|
106
120
|
if (!propsCopy.item.type)
|
|
107
121
|
propsCopy.item.type = "string";
|
|
108
|
-
if (
|
|
109
|
-
|
|
110
|
-
|
|
122
|
+
if ((_a2 = propsCopy.item.options) == null ? void 0 : _a2.length) {
|
|
123
|
+
propsCopy.item.options = transferOptions(propsCopy.item.options);
|
|
124
|
+
}
|
|
125
|
+
if (propsCopy.item.options && typeof propsCopy.value !== "undefined" && propsCopy.value !== null) {
|
|
126
|
+
if (propsCopy.item.type.endsWith("[]"))
|
|
127
|
+
propsCopy.value = propsCopy.value.map((v) => {
|
|
111
128
|
var _a3;
|
|
112
|
-
return ((_a3 =
|
|
129
|
+
return ((_a3 = propsCopy.item.options.find((option) => option.value === v)) == null ? void 0 : _a3.label) || v;
|
|
113
130
|
});
|
|
114
131
|
else
|
|
115
|
-
propsCopy.value = ((
|
|
132
|
+
propsCopy.value = ((_b = props.item.options.find((option) => option.value === props.value)) == null ? void 0 : _b.label) || props.value;
|
|
116
133
|
}
|
|
117
134
|
setComputedProps(propsCopy);
|
|
118
135
|
}, [props]);
|
|
@@ -163,7 +180,7 @@ function Description(props) {
|
|
|
163
180
|
faasData: props.faasData,
|
|
164
181
|
render: ({ data }) => /* @__PURE__ */ import_react.default.createElement(import_antd2.Descriptions, __spreadValues({}, props), props.items.map((item) => /* @__PURE__ */ import_react.default.createElement(import_antd2.Descriptions.Item, {
|
|
165
182
|
key: item.id,
|
|
166
|
-
label: item.title || (0,
|
|
183
|
+
label: item.title || (0, import_lodash3.upperFirst)(item.id)
|
|
167
184
|
}, /* @__PURE__ */ import_react.default.createElement(DescriptionItemContent, {
|
|
168
185
|
item,
|
|
169
186
|
value: data[item.id],
|
|
@@ -173,20 +190,39 @@ function Description(props) {
|
|
|
173
190
|
});
|
|
174
191
|
}
|
|
175
192
|
|
|
193
|
+
// src/Drawer.tsx
|
|
194
|
+
var import_antd3 = require("antd");
|
|
195
|
+
var import_react5 = require("react");
|
|
196
|
+
function useDrawer(init) {
|
|
197
|
+
const [props, setProps] = (0, import_react5.useState)(__spreadValues({
|
|
198
|
+
visible: false,
|
|
199
|
+
onClose: () => setProps((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
200
|
+
visible: false
|
|
201
|
+
}))
|
|
202
|
+
}, init));
|
|
203
|
+
return {
|
|
204
|
+
drawer: /* @__PURE__ */ import_react.default.createElement(import_antd3.Drawer, __spreadValues({}, props)),
|
|
205
|
+
drawerProps: props,
|
|
206
|
+
setDrawerProps(changes) {
|
|
207
|
+
setProps((prev) => __spreadValues(__spreadValues({}, prev), changes));
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
176
212
|
// src/Form.tsx
|
|
177
|
-
var
|
|
213
|
+
var import_antd5 = require("antd");
|
|
178
214
|
|
|
179
215
|
// src/FormItem.tsx
|
|
180
|
-
var
|
|
216
|
+
var import_antd4 = require("antd");
|
|
181
217
|
var import_icons2 = require("@ant-design/icons");
|
|
182
|
-
var
|
|
183
|
-
var
|
|
218
|
+
var import_react6 = require("react");
|
|
219
|
+
var import_lodash4 = require("lodash");
|
|
184
220
|
function FormItem(props) {
|
|
185
|
-
const [computedProps, setComputedProps] = (0,
|
|
186
|
-
(0,
|
|
221
|
+
const [computedProps, setComputedProps] = (0, import_react6.useState)();
|
|
222
|
+
(0, import_react6.useEffect)(() => {
|
|
187
223
|
const propsCopy = __spreadValues({}, props);
|
|
188
224
|
if (!propsCopy.title)
|
|
189
|
-
propsCopy.title = (0,
|
|
225
|
+
propsCopy.title = (0, import_lodash4.upperFirst)(propsCopy.id);
|
|
190
226
|
if (!propsCopy.label && props.label !== false)
|
|
191
227
|
propsCopy.label = propsCopy.title;
|
|
192
228
|
if (!propsCopy.name)
|
|
@@ -212,20 +248,8 @@ function FormItem(props) {
|
|
|
212
248
|
}
|
|
213
249
|
if (!propsCopy.input)
|
|
214
250
|
propsCopy.input = {};
|
|
215
|
-
if (propsCopy.options)
|
|
216
|
-
|
|
217
|
-
if (propsCopy.options.length > 0)
|
|
218
|
-
for (const option of propsCopy.options) {
|
|
219
|
-
if (typeof option === "object")
|
|
220
|
-
options.push(option);
|
|
221
|
-
else
|
|
222
|
-
options.push({
|
|
223
|
-
label: (0, import_lodash3.upperFirst)(option.toString()),
|
|
224
|
-
value: option
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
propsCopy.input.options = options;
|
|
228
|
-
}
|
|
251
|
+
if (propsCopy.options)
|
|
252
|
+
propsCopy.input.options = transferOptions(propsCopy.options);
|
|
229
253
|
switch (propsCopy.type) {
|
|
230
254
|
case "boolean":
|
|
231
255
|
propsCopy.valuePropName = "checked";
|
|
@@ -236,58 +260,58 @@ function FormItem(props) {
|
|
|
236
260
|
if (!computedProps)
|
|
237
261
|
return null;
|
|
238
262
|
if (computedProps.extendTypes && computedProps.extendTypes[computedProps.type])
|
|
239
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
263
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadValues({}, computedProps), computedProps.extendTypes[computedProps.type].children);
|
|
240
264
|
if (computedProps.children)
|
|
241
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
265
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadValues({}, computedProps), computedProps.children);
|
|
242
266
|
switch (computedProps.type) {
|
|
243
267
|
case "string":
|
|
244
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
268
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadValues({}, computedProps), computedProps.options ? /* @__PURE__ */ import_react.default.createElement(import_antd4.Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ import_react.default.createElement(import_antd4.Input, __spreadValues({}, computedProps.input)));
|
|
245
269
|
case "string[]":
|
|
246
270
|
if (computedProps.options)
|
|
247
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
271
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadValues({}, computedProps), /* @__PURE__ */ import_react.default.createElement(import_antd4.Select, __spreadValues({
|
|
248
272
|
mode: "multiple"
|
|
249
273
|
}, computedProps.input)));
|
|
250
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
274
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.List, {
|
|
251
275
|
name: computedProps.name,
|
|
252
276
|
rules: computedProps.rules
|
|
253
277
|
}, (fields, { add, remove }, { errors }) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, computedProps.label && /* @__PURE__ */ import_react.default.createElement("div", {
|
|
254
278
|
className: "ant-form-item-label"
|
|
255
279
|
}, /* @__PURE__ */ import_react.default.createElement("label", {
|
|
256
280
|
className: computedProps.rules.find((r) => r.required) && "ant-form-item-required"
|
|
257
|
-
}, computedProps.label)), fields.map((field) => /* @__PURE__ */ import_react.default.createElement(
|
|
281
|
+
}, computedProps.label)), fields.map((field) => /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, {
|
|
258
282
|
key: field.key
|
|
259
|
-
}, /* @__PURE__ */ import_react.default.createElement(
|
|
283
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_antd4.Row, {
|
|
260
284
|
gutter: 24
|
|
261
|
-
}, /* @__PURE__ */ import_react.default.createElement(
|
|
285
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
|
|
262
286
|
span: 23
|
|
263
|
-
}, /* @__PURE__ */ import_react.default.createElement(
|
|
287
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadProps(__spreadValues({}, field), {
|
|
264
288
|
noStyle: true
|
|
265
|
-
}), /* @__PURE__ */ import_react.default.createElement(
|
|
289
|
+
}), /* @__PURE__ */ import_react.default.createElement(import_antd4.Input, __spreadValues({}, computedProps.input)))), /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
|
|
266
290
|
span: 1
|
|
267
|
-
}, (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ import_react.default.createElement(
|
|
291
|
+
}, (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ import_react.default.createElement(import_antd4.Button, {
|
|
268
292
|
danger: true,
|
|
269
293
|
type: "link",
|
|
270
294
|
style: { float: "right" },
|
|
271
295
|
icon: /* @__PURE__ */ import_react.default.createElement(import_icons2.MinusCircleOutlined, null),
|
|
272
296
|
onClick: () => remove(field.name)
|
|
273
|
-
}))))), /* @__PURE__ */ import_react.default.createElement(
|
|
297
|
+
}))))), /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, null, (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ import_react.default.createElement(import_antd4.Button, {
|
|
274
298
|
type: "dashed",
|
|
275
299
|
block: true,
|
|
276
300
|
onClick: () => add(),
|
|
277
301
|
icon: /* @__PURE__ */ import_react.default.createElement(import_icons2.PlusOutlined, null)
|
|
278
|
-
}), /* @__PURE__ */ import_react.default.createElement(
|
|
302
|
+
}), /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.ErrorList, {
|
|
279
303
|
errors
|
|
280
304
|
}))));
|
|
281
305
|
case "number":
|
|
282
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
306
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadValues({}, computedProps), computedProps.options ? /* @__PURE__ */ import_react.default.createElement(import_antd4.Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ import_react.default.createElement(import_antd4.InputNumber, __spreadValues({
|
|
283
307
|
style: { width: "100%" }
|
|
284
308
|
}, computedProps.input)));
|
|
285
309
|
case "number[]":
|
|
286
310
|
if (computedProps.options)
|
|
287
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
311
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadValues({}, computedProps), /* @__PURE__ */ import_react.default.createElement(import_antd4.Select, __spreadValues({
|
|
288
312
|
mode: "multiple"
|
|
289
313
|
}, computedProps.input)));
|
|
290
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
314
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.List, {
|
|
291
315
|
name: computedProps.name,
|
|
292
316
|
rules: computedProps.rules
|
|
293
317
|
}, (fields, { add, remove }, { errors }) => {
|
|
@@ -296,35 +320,35 @@ function FormItem(props) {
|
|
|
296
320
|
className: "ant-form-item-label"
|
|
297
321
|
}, /* @__PURE__ */ import_react.default.createElement("label", {
|
|
298
322
|
className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required"
|
|
299
|
-
}, computedProps.label)), fields.map((field) => /* @__PURE__ */ import_react.default.createElement(
|
|
323
|
+
}, computedProps.label)), fields.map((field) => /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, {
|
|
300
324
|
key: field.key
|
|
301
|
-
}, /* @__PURE__ */ import_react.default.createElement(
|
|
325
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_antd4.Row, {
|
|
302
326
|
gutter: 24
|
|
303
|
-
}, /* @__PURE__ */ import_react.default.createElement(
|
|
327
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
|
|
304
328
|
span: 23
|
|
305
|
-
}, /* @__PURE__ */ import_react.default.createElement(
|
|
329
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadProps(__spreadValues({}, field), {
|
|
306
330
|
noStyle: true
|
|
307
|
-
}), /* @__PURE__ */ import_react.default.createElement(
|
|
331
|
+
}), /* @__PURE__ */ import_react.default.createElement(import_antd4.InputNumber, __spreadValues({
|
|
308
332
|
style: { width: "100%" }
|
|
309
|
-
}, computedProps.input)))), /* @__PURE__ */ import_react.default.createElement(
|
|
333
|
+
}, computedProps.input)))), /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
|
|
310
334
|
span: 1
|
|
311
|
-
}, (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ import_react.default.createElement(
|
|
335
|
+
}, (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ import_react.default.createElement(import_antd4.Button, {
|
|
312
336
|
danger: true,
|
|
313
337
|
type: "link",
|
|
314
338
|
style: { float: "right" },
|
|
315
339
|
icon: /* @__PURE__ */ import_react.default.createElement(import_icons2.MinusCircleOutlined, null),
|
|
316
340
|
onClick: () => remove(field.name)
|
|
317
|
-
}))))), /* @__PURE__ */ import_react.default.createElement(
|
|
341
|
+
}))))), /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, null, (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ import_react.default.createElement(import_antd4.Button, {
|
|
318
342
|
type: "dashed",
|
|
319
343
|
block: true,
|
|
320
344
|
onClick: () => add(),
|
|
321
345
|
icon: /* @__PURE__ */ import_react.default.createElement(import_icons2.PlusOutlined, null)
|
|
322
|
-
}), /* @__PURE__ */ import_react.default.createElement(
|
|
346
|
+
}), /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.ErrorList, {
|
|
323
347
|
errors
|
|
324
348
|
})));
|
|
325
349
|
});
|
|
326
350
|
case "boolean":
|
|
327
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
351
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadValues({}, computedProps), /* @__PURE__ */ import_react.default.createElement(import_antd4.Switch, __spreadValues({}, computedProps.input)));
|
|
328
352
|
default:
|
|
329
353
|
return null;
|
|
330
354
|
}
|
|
@@ -333,23 +357,23 @@ function FormItem(props) {
|
|
|
333
357
|
// src/Form.tsx
|
|
334
358
|
function Form(props) {
|
|
335
359
|
var _a2, _b;
|
|
336
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
360
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd5.Form, __spreadValues({}, props), (_a2 = props.items) == null ? void 0 : _a2.map((item) => /* @__PURE__ */ import_react.default.createElement(FormItem, __spreadProps(__spreadValues({
|
|
337
361
|
key: item.id
|
|
338
362
|
}, item), {
|
|
339
363
|
extendTypes: props.extendTypes
|
|
340
|
-
}))), props.children, props.submit !== false && /* @__PURE__ */ import_react.default.createElement(
|
|
364
|
+
}))), props.children, props.submit !== false && /* @__PURE__ */ import_react.default.createElement(import_antd5.Button, {
|
|
341
365
|
htmlType: "submit",
|
|
342
366
|
type: "primary"
|
|
343
367
|
}, ((_b = props.submit) == null ? void 0 : _b.text) || "Submit"));
|
|
344
368
|
}
|
|
345
|
-
Form.useForm =
|
|
369
|
+
Form.useForm = import_antd5.Form.useForm;
|
|
346
370
|
Form.Item = FormItem;
|
|
347
371
|
|
|
348
372
|
// src/Table.tsx
|
|
349
|
-
var
|
|
350
|
-
var
|
|
373
|
+
var import_react7 = require("react");
|
|
374
|
+
var import_antd6 = require("antd");
|
|
351
375
|
var import_icons3 = require("@ant-design/icons");
|
|
352
|
-
var
|
|
376
|
+
var import_lodash5 = require("lodash");
|
|
353
377
|
function processValue(item, value) {
|
|
354
378
|
var _a2;
|
|
355
379
|
if (item.options && typeof value !== "undefined" && value !== null) {
|
|
@@ -364,22 +388,30 @@ function processValue(item, value) {
|
|
|
364
388
|
return value;
|
|
365
389
|
}
|
|
366
390
|
function Table(props) {
|
|
367
|
-
const [columns, setColumns] = (0,
|
|
368
|
-
(0,
|
|
391
|
+
const [columns, setColumns] = (0, import_react7.useState)();
|
|
392
|
+
(0, import_react7.useEffect)(() => {
|
|
393
|
+
var _a2;
|
|
369
394
|
for (const item of props.items) {
|
|
370
395
|
if (!item.key)
|
|
371
396
|
item.key = item.id;
|
|
372
397
|
if (!item.dataIndex)
|
|
373
398
|
item.dataIndex = item.id;
|
|
374
399
|
if (!item.title)
|
|
375
|
-
item.title = (0,
|
|
400
|
+
item.title = (0, import_lodash5.upperFirst)(item.id);
|
|
376
401
|
if (!item.type)
|
|
377
402
|
item.type = "string";
|
|
403
|
+
if ((_a2 = item.options) == null ? void 0 : _a2.length) {
|
|
404
|
+
item.options = transferOptions(item.options);
|
|
405
|
+
item.filters = item.options.map((o) => ({
|
|
406
|
+
text: o.label,
|
|
407
|
+
value: o.value
|
|
408
|
+
}));
|
|
409
|
+
}
|
|
378
410
|
if (item.render)
|
|
379
411
|
continue;
|
|
380
412
|
if (props.extendTypes && props.extendTypes[item.type]) {
|
|
381
413
|
if (props.extendTypes[item.type].children) {
|
|
382
|
-
item.render = (value, values) => (0,
|
|
414
|
+
item.render = (value, values) => (0, import_react7.cloneElement)(props.extendTypes[item.type].children, {
|
|
383
415
|
value,
|
|
384
416
|
values
|
|
385
417
|
});
|
|
@@ -419,8 +451,8 @@ function Table(props) {
|
|
|
419
451
|
selectedKeys,
|
|
420
452
|
confirm
|
|
421
453
|
}) => {
|
|
422
|
-
var
|
|
423
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
454
|
+
var _a3, _b;
|
|
455
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd6.Radio.Group, {
|
|
424
456
|
style: { padding: 8 },
|
|
425
457
|
buttonStyle: "solid",
|
|
426
458
|
value: selectedKeys[0],
|
|
@@ -428,23 +460,33 @@ function Table(props) {
|
|
|
428
460
|
setSelectedKeys(e.target.value ? [e.target.value] : []);
|
|
429
461
|
confirm();
|
|
430
462
|
}
|
|
431
|
-
}, /* @__PURE__ */ import_react.default.createElement(
|
|
463
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_antd6.Radio.Button, null, ((_a3 = navigator.language) == null ? void 0 : _a3.includes("CN")) ? "\u5168\u90E8" : "All"), /* @__PURE__ */ import_react.default.createElement(import_antd6.Radio.Button, {
|
|
432
464
|
value: "true"
|
|
433
|
-
}, /* @__PURE__ */ import_react.default.createElement(import_icons3.CheckOutlined,
|
|
465
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_icons3.CheckOutlined, {
|
|
466
|
+
style: {
|
|
467
|
+
color: "#52c41a",
|
|
468
|
+
verticalAlign: "middle"
|
|
469
|
+
}
|
|
470
|
+
})), /* @__PURE__ */ import_react.default.createElement(import_antd6.Radio.Button, {
|
|
434
471
|
value: "false"
|
|
435
|
-
}, /* @__PURE__ */ import_react.default.createElement(import_icons3.CloseOutlined,
|
|
472
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_icons3.CloseOutlined, {
|
|
473
|
+
style: {
|
|
474
|
+
verticalAlign: "middle",
|
|
475
|
+
color: "#ff4d4f"
|
|
476
|
+
}
|
|
477
|
+
})), /* @__PURE__ */ import_react.default.createElement(import_antd6.Radio.Button, {
|
|
436
478
|
value: "empty"
|
|
437
|
-
},
|
|
479
|
+
}, ((_b = navigator.language) == null ? void 0 : _b.includes("CN")) ? "\u7A7A" : "Empty"));
|
|
438
480
|
};
|
|
439
481
|
if (!item.onFilter)
|
|
440
482
|
item.onFilter = (value, row) => {
|
|
441
483
|
switch (value) {
|
|
442
484
|
case "true":
|
|
443
|
-
return row[item.id]
|
|
485
|
+
return !(0, import_lodash5.isNil)(row[item.id]) && !!row[item.id];
|
|
444
486
|
case "false":
|
|
445
|
-
return row[item.id]
|
|
487
|
+
return !(0, import_lodash5.isNil)(row[item.id]) && !row[item.id];
|
|
446
488
|
case "empty":
|
|
447
|
-
return
|
|
489
|
+
return (0, import_lodash5.isNil)(row[item.id]);
|
|
448
490
|
default:
|
|
449
491
|
return true;
|
|
450
492
|
}
|
|
@@ -462,7 +504,7 @@ function Table(props) {
|
|
|
462
504
|
return /* @__PURE__ */ import_react.default.createElement(FaasDataWrapper, {
|
|
463
505
|
dataSource: props.dataSource,
|
|
464
506
|
faasData: props.faasData,
|
|
465
|
-
render: ({ data }) => /* @__PURE__ */ import_react.default.createElement(
|
|
507
|
+
render: ({ data }) => /* @__PURE__ */ import_react.default.createElement(import_antd6.Table, __spreadProps(__spreadValues({}, props), {
|
|
466
508
|
rowKey: props.rowKey || "id",
|
|
467
509
|
columns,
|
|
468
510
|
dataSource: data
|
|
@@ -474,7 +516,10 @@ module.exports = __toCommonJS(src_exports);
|
|
|
474
516
|
0 && (module.exports = {
|
|
475
517
|
Blank,
|
|
476
518
|
Description,
|
|
519
|
+
Drawer,
|
|
477
520
|
Form,
|
|
478
521
|
FormItem,
|
|
479
|
-
Table
|
|
522
|
+
Table,
|
|
523
|
+
transferOptions,
|
|
524
|
+
useDrawer
|
|
480
525
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -25,17 +25,28 @@ import React from "react";
|
|
|
25
25
|
import { Typography } from "antd";
|
|
26
26
|
import { isNil } from "lodash";
|
|
27
27
|
var _a;
|
|
28
|
-
var text = ((_a = navigator.language) == null ? void 0 : _a.includes("
|
|
28
|
+
var text = ((_a = navigator.language) == null ? void 0 : _a.includes("CN")) ? "\u7A7A" : "Empty";
|
|
29
29
|
function Blank(options) {
|
|
30
30
|
return !options || isNil(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ React.createElement(Typography.Text, {
|
|
31
31
|
disabled: true
|
|
32
32
|
}, (options == null ? void 0 : options.text) || text) : options.value;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
// src/data.ts
|
|
36
|
+
import { upperFirst } from "lodash";
|
|
37
|
+
function transferOptions(options) {
|
|
38
|
+
if (!options)
|
|
39
|
+
return [];
|
|
40
|
+
return options.map((item) => typeof item === "object" ? item : {
|
|
41
|
+
label: upperFirst(item.toString()),
|
|
42
|
+
value: item
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
35
46
|
// src/Description.tsx
|
|
36
47
|
import { CheckOutlined, CloseOutlined } from "@ant-design/icons";
|
|
37
48
|
import { Descriptions } from "antd";
|
|
38
|
-
import { upperFirst } from "lodash";
|
|
49
|
+
import { upperFirst as upperFirst2 } from "lodash";
|
|
39
50
|
import {
|
|
40
51
|
cloneElement,
|
|
41
52
|
useEffect as useEffect2,
|
|
@@ -55,7 +66,7 @@ function FaasDataWrapper({
|
|
|
55
66
|
useEffect(() => {
|
|
56
67
|
if (!faasData)
|
|
57
68
|
return;
|
|
58
|
-
getClient().faas(faasData.action, faasData.
|
|
69
|
+
getClient().faas(faasData.action, faasData.params).then((res) => setData(res.data));
|
|
59
70
|
}, [JSON.stringify(faasData)]);
|
|
60
71
|
if (dataSource)
|
|
61
72
|
return render({ data: dataSource });
|
|
@@ -68,20 +79,23 @@ function FaasDataWrapper({
|
|
|
68
79
|
function DescriptionItemContent(props) {
|
|
69
80
|
const [computedProps, setComputedProps] = useState2();
|
|
70
81
|
useEffect2(() => {
|
|
71
|
-
var _a2;
|
|
82
|
+
var _a2, _b;
|
|
72
83
|
const propsCopy = __spreadValues({}, props);
|
|
73
84
|
if (!propsCopy.item.title)
|
|
74
|
-
propsCopy.item.title =
|
|
85
|
+
propsCopy.item.title = upperFirst2(propsCopy.item.id);
|
|
75
86
|
if (!propsCopy.item.type)
|
|
76
87
|
propsCopy.item.type = "string";
|
|
77
|
-
if (
|
|
78
|
-
|
|
79
|
-
|
|
88
|
+
if ((_a2 = propsCopy.item.options) == null ? void 0 : _a2.length) {
|
|
89
|
+
propsCopy.item.options = transferOptions(propsCopy.item.options);
|
|
90
|
+
}
|
|
91
|
+
if (propsCopy.item.options && typeof propsCopy.value !== "undefined" && propsCopy.value !== null) {
|
|
92
|
+
if (propsCopy.item.type.endsWith("[]"))
|
|
93
|
+
propsCopy.value = propsCopy.value.map((v) => {
|
|
80
94
|
var _a3;
|
|
81
|
-
return ((_a3 =
|
|
95
|
+
return ((_a3 = propsCopy.item.options.find((option) => option.value === v)) == null ? void 0 : _a3.label) || v;
|
|
82
96
|
});
|
|
83
97
|
else
|
|
84
|
-
propsCopy.value = ((
|
|
98
|
+
propsCopy.value = ((_b = props.item.options.find((option) => option.value === props.value)) == null ? void 0 : _b.label) || props.value;
|
|
85
99
|
}
|
|
86
100
|
setComputedProps(propsCopy);
|
|
87
101
|
}, [props]);
|
|
@@ -132,7 +146,7 @@ function Description(props) {
|
|
|
132
146
|
faasData: props.faasData,
|
|
133
147
|
render: ({ data }) => /* @__PURE__ */ React.createElement(Descriptions, __spreadValues({}, props), props.items.map((item) => /* @__PURE__ */ React.createElement(Descriptions.Item, {
|
|
134
148
|
key: item.id,
|
|
135
|
-
label: item.title ||
|
|
149
|
+
label: item.title || upperFirst2(item.id)
|
|
136
150
|
}, /* @__PURE__ */ React.createElement(DescriptionItemContent, {
|
|
137
151
|
item,
|
|
138
152
|
value: data[item.id],
|
|
@@ -142,6 +156,25 @@ function Description(props) {
|
|
|
142
156
|
});
|
|
143
157
|
}
|
|
144
158
|
|
|
159
|
+
// src/Drawer.tsx
|
|
160
|
+
import { Drawer } from "antd";
|
|
161
|
+
import { useState as useState3 } from "react";
|
|
162
|
+
function useDrawer(init) {
|
|
163
|
+
const [props, setProps] = useState3(__spreadValues({
|
|
164
|
+
visible: false,
|
|
165
|
+
onClose: () => setProps((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
166
|
+
visible: false
|
|
167
|
+
}))
|
|
168
|
+
}, init));
|
|
169
|
+
return {
|
|
170
|
+
drawer: /* @__PURE__ */ React.createElement(Drawer, __spreadValues({}, props)),
|
|
171
|
+
drawerProps: props,
|
|
172
|
+
setDrawerProps(changes) {
|
|
173
|
+
setProps((prev) => __spreadValues(__spreadValues({}, prev), changes));
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
145
178
|
// src/Form.tsx
|
|
146
179
|
import {
|
|
147
180
|
Button as Button2,
|
|
@@ -162,15 +195,15 @@ import {
|
|
|
162
195
|
import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
|
|
163
196
|
import {
|
|
164
197
|
useEffect as useEffect3,
|
|
165
|
-
useState as
|
|
198
|
+
useState as useState4
|
|
166
199
|
} from "react";
|
|
167
|
-
import { upperFirst as
|
|
200
|
+
import { upperFirst as upperFirst3 } from "lodash";
|
|
168
201
|
function FormItem(props) {
|
|
169
|
-
const [computedProps, setComputedProps] =
|
|
202
|
+
const [computedProps, setComputedProps] = useState4();
|
|
170
203
|
useEffect3(() => {
|
|
171
204
|
const propsCopy = __spreadValues({}, props);
|
|
172
205
|
if (!propsCopy.title)
|
|
173
|
-
propsCopy.title =
|
|
206
|
+
propsCopy.title = upperFirst3(propsCopy.id);
|
|
174
207
|
if (!propsCopy.label && props.label !== false)
|
|
175
208
|
propsCopy.label = propsCopy.title;
|
|
176
209
|
if (!propsCopy.name)
|
|
@@ -196,20 +229,8 @@ function FormItem(props) {
|
|
|
196
229
|
}
|
|
197
230
|
if (!propsCopy.input)
|
|
198
231
|
propsCopy.input = {};
|
|
199
|
-
if (propsCopy.options)
|
|
200
|
-
|
|
201
|
-
if (propsCopy.options.length > 0)
|
|
202
|
-
for (const option of propsCopy.options) {
|
|
203
|
-
if (typeof option === "object")
|
|
204
|
-
options.push(option);
|
|
205
|
-
else
|
|
206
|
-
options.push({
|
|
207
|
-
label: upperFirst2(option.toString()),
|
|
208
|
-
value: option
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
propsCopy.input.options = options;
|
|
212
|
-
}
|
|
232
|
+
if (propsCopy.options)
|
|
233
|
+
propsCopy.input.options = transferOptions(propsCopy.options);
|
|
213
234
|
switch (propsCopy.type) {
|
|
214
235
|
case "boolean":
|
|
215
236
|
propsCopy.valuePropName = "checked";
|
|
@@ -331,7 +352,7 @@ Form.Item = FormItem;
|
|
|
331
352
|
|
|
332
353
|
// src/Table.tsx
|
|
333
354
|
import {
|
|
334
|
-
useState as
|
|
355
|
+
useState as useState5,
|
|
335
356
|
useEffect as useEffect4,
|
|
336
357
|
cloneElement as cloneElement2
|
|
337
358
|
} from "react";
|
|
@@ -340,7 +361,7 @@ import {
|
|
|
340
361
|
Radio
|
|
341
362
|
} from "antd";
|
|
342
363
|
import { CheckOutlined as CheckOutlined2, CloseOutlined as CloseOutlined2 } from "@ant-design/icons";
|
|
343
|
-
import { upperFirst as
|
|
364
|
+
import { isNil as isNil2, upperFirst as upperFirst4 } from "lodash";
|
|
344
365
|
function processValue(item, value) {
|
|
345
366
|
var _a2;
|
|
346
367
|
if (item.options && typeof value !== "undefined" && value !== null) {
|
|
@@ -355,17 +376,25 @@ function processValue(item, value) {
|
|
|
355
376
|
return value;
|
|
356
377
|
}
|
|
357
378
|
function Table(props) {
|
|
358
|
-
const [columns, setColumns] =
|
|
379
|
+
const [columns, setColumns] = useState5();
|
|
359
380
|
useEffect4(() => {
|
|
381
|
+
var _a2;
|
|
360
382
|
for (const item of props.items) {
|
|
361
383
|
if (!item.key)
|
|
362
384
|
item.key = item.id;
|
|
363
385
|
if (!item.dataIndex)
|
|
364
386
|
item.dataIndex = item.id;
|
|
365
387
|
if (!item.title)
|
|
366
|
-
item.title =
|
|
388
|
+
item.title = upperFirst4(item.id);
|
|
367
389
|
if (!item.type)
|
|
368
390
|
item.type = "string";
|
|
391
|
+
if ((_a2 = item.options) == null ? void 0 : _a2.length) {
|
|
392
|
+
item.options = transferOptions(item.options);
|
|
393
|
+
item.filters = item.options.map((o) => ({
|
|
394
|
+
text: o.label,
|
|
395
|
+
value: o.value
|
|
396
|
+
}));
|
|
397
|
+
}
|
|
369
398
|
if (item.render)
|
|
370
399
|
continue;
|
|
371
400
|
if (props.extendTypes && props.extendTypes[item.type]) {
|
|
@@ -410,7 +439,7 @@ function Table(props) {
|
|
|
410
439
|
selectedKeys,
|
|
411
440
|
confirm
|
|
412
441
|
}) => {
|
|
413
|
-
var
|
|
442
|
+
var _a3, _b;
|
|
414
443
|
return /* @__PURE__ */ React.createElement(Radio.Group, {
|
|
415
444
|
style: { padding: 8 },
|
|
416
445
|
buttonStyle: "solid",
|
|
@@ -419,23 +448,33 @@ function Table(props) {
|
|
|
419
448
|
setSelectedKeys(e.target.value ? [e.target.value] : []);
|
|
420
449
|
confirm();
|
|
421
450
|
}
|
|
422
|
-
}, /* @__PURE__ */ React.createElement(Radio.Button, null, ((
|
|
451
|
+
}, /* @__PURE__ */ React.createElement(Radio.Button, null, ((_a3 = navigator.language) == null ? void 0 : _a3.includes("CN")) ? "\u5168\u90E8" : "All"), /* @__PURE__ */ React.createElement(Radio.Button, {
|
|
423
452
|
value: "true"
|
|
424
|
-
}, /* @__PURE__ */ React.createElement(CheckOutlined2,
|
|
453
|
+
}, /* @__PURE__ */ React.createElement(CheckOutlined2, {
|
|
454
|
+
style: {
|
|
455
|
+
color: "#52c41a",
|
|
456
|
+
verticalAlign: "middle"
|
|
457
|
+
}
|
|
458
|
+
})), /* @__PURE__ */ React.createElement(Radio.Button, {
|
|
425
459
|
value: "false"
|
|
426
|
-
}, /* @__PURE__ */ React.createElement(CloseOutlined2,
|
|
460
|
+
}, /* @__PURE__ */ React.createElement(CloseOutlined2, {
|
|
461
|
+
style: {
|
|
462
|
+
verticalAlign: "middle",
|
|
463
|
+
color: "#ff4d4f"
|
|
464
|
+
}
|
|
465
|
+
})), /* @__PURE__ */ React.createElement(Radio.Button, {
|
|
427
466
|
value: "empty"
|
|
428
|
-
},
|
|
467
|
+
}, ((_b = navigator.language) == null ? void 0 : _b.includes("CN")) ? "\u7A7A" : "Empty"));
|
|
429
468
|
};
|
|
430
469
|
if (!item.onFilter)
|
|
431
470
|
item.onFilter = (value, row) => {
|
|
432
471
|
switch (value) {
|
|
433
472
|
case "true":
|
|
434
|
-
return row[item.id]
|
|
473
|
+
return !isNil2(row[item.id]) && !!row[item.id];
|
|
435
474
|
case "false":
|
|
436
|
-
return row[item.id]
|
|
475
|
+
return !isNil2(row[item.id]) && !row[item.id];
|
|
437
476
|
case "empty":
|
|
438
|
-
return
|
|
477
|
+
return isNil2(row[item.id]);
|
|
439
478
|
default:
|
|
440
479
|
return true;
|
|
441
480
|
}
|
|
@@ -463,7 +502,10 @@ function Table(props) {
|
|
|
463
502
|
export {
|
|
464
503
|
Blank,
|
|
465
504
|
Description,
|
|
505
|
+
Drawer,
|
|
466
506
|
Form,
|
|
467
507
|
FormItem,
|
|
468
|
-
Table
|
|
508
|
+
Table,
|
|
509
|
+
transferOptions,
|
|
510
|
+
useDrawer
|
|
469
511
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/ant-design",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.348",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"lodash": "*",
|
|
28
28
|
"react": "*",
|
|
29
29
|
"react-dom": "*",
|
|
30
|
-
"@faasjs/react": "^0.0.2-beta.
|
|
30
|
+
"@faasjs/react": "^0.0.2-beta.348"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/lodash": "*",
|