@faasjs/ant-design 0.0.2-beta.371 → 0.0.2-beta.375
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/README.md +16 -9
- package/dist/index.d.ts +47 -7
- package/dist/index.js +44 -205
- package/dist/index.mjs +29 -190
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -158,7 +158,7 @@ ___
|
|
|
158
158
|
|
|
159
159
|
### DescriptionProps
|
|
160
160
|
|
|
161
|
-
Ƭ **DescriptionProps**<`T`, `ExtendItemProps`\>: { `dataSource?`: `T` ; `extendTypes?`: { [key: string]
|
|
161
|
+
Ƭ **DescriptionProps**<`T`, `ExtendItemProps`\>: { `dataSource?`: `T` ; `extendTypes?`: { `[key: string]`: [`ExtendDescriptionTypeProps`](#extenddescriptiontypeprops); } ; `faasData?`: `FaasDataWrapperProps`<`T`\> ; `items`: ([`DescriptionItemProps`](#descriptionitemprops) \| `ExtendItemProps`)[] } & `DescriptionsProps`
|
|
162
162
|
|
|
163
163
|
#### Type parameters
|
|
164
164
|
|
|
@@ -293,7 +293,7 @@ ___
|
|
|
293
293
|
|
|
294
294
|
### FormItemProps
|
|
295
295
|
|
|
296
|
-
Ƭ **FormItemProps**<`T`\>: { `children?`: `JSX.Element` \| ``null`` ; `extendTypes?`: { [type: string]
|
|
296
|
+
Ƭ **FormItemProps**<`T`\>: { `children?`: `JSX.Element` \| ``null`` ; `extendTypes?`: { `[type: string]`: [`ExtendFormTypeProps`](#extendformtypeprops); } ; `label?`: `string` \| ``false`` ; `rules?`: `RuleObject`[] ; `render?`: () => `Element` } & `FormItemInputProps`<`T`\> & [`FaasItemProps`](#faasitemprops) & `AntdFormItemProps`<`T`\>
|
|
297
297
|
|
|
298
298
|
#### Type parameters
|
|
299
299
|
|
|
@@ -305,7 +305,7 @@ ___
|
|
|
305
305
|
|
|
306
306
|
### FormProps
|
|
307
307
|
|
|
308
|
-
Ƭ **FormProps**<`Values`, `ExtendItemProps`\>: { `extendTypes?`: { [type: string]
|
|
308
|
+
Ƭ **FormProps**<`Values`, `ExtendItemProps`\>: { `extendTypes?`: { `[type: string]`: [`ExtendFormTypeProps`](#extendformtypeprops); } ; `items?`: ([`FormItemProps`](#formitemprops) \| `ExtendItemProps`)[] ; `submit?`: ``false`` \| { `text?`: `string` ; `to?`: { `action`: `string` ; `params?`: `Record`<`string`, `any`\> } } ; `onFinish?`: (`values`: `Values`, `submit?`: (`values`: `any`) => `Promise`<`any`\>) => `Promise`<`any`\> } & `Omit`<`AntdFormProps`<`Values`\>, ``"onFinish"``\>
|
|
309
309
|
|
|
310
310
|
#### Type parameters
|
|
311
311
|
|
|
@@ -350,7 +350,7 @@ ___
|
|
|
350
350
|
|
|
351
351
|
### TableProps
|
|
352
352
|
|
|
353
|
-
Ƭ **TableProps**<`T`, `ExtendTypes`\>: { `extendTypes?`: { [key: string]
|
|
353
|
+
Ƭ **TableProps**<`T`, `ExtendTypes`\>: { `extendTypes?`: { `[key: string]`: [`ExtendTableTypeProps`](#extendtabletypeprops); } ; `faasData?`: `FaasDataWrapperProps`<`T`\> ; `items`: ([`TableItemProps`](#tableitemprops) \| `ExtendTypes` & [`ExtendTableItemProps`](#extendtableitemprops))[] ; `onChange?`: (`pagination`: `TablePaginationConfig`, `filters`: `Record`<`string`, `FilterValue`\>, `sorter`: `SorterResult`<`T`\> \| `SorterResult`<`T`\>[], `extra`: `TableCurrentDataSource`<`T`\>) => { `extra`: `TableCurrentDataSource`<`T`\> ; `filters`: `Record`<`string`, `FilterValue` \| ``null``\> ; `pagination`: `TablePaginationConfig` ; `sorter`: `SorterResult`<`T`\> \| `SorterResult`<`T`\>[] } } & `AntdTableProps`<`T`\>
|
|
354
354
|
|
|
355
355
|
#### Type parameters
|
|
356
356
|
|
|
@@ -375,7 +375,8 @@ ___
|
|
|
375
375
|
|
|
376
376
|
| Name | Type | Description |
|
|
377
377
|
| :------ | :------ | :------ |
|
|
378
|
-
| `
|
|
378
|
+
| `children?` | `JSX.Element` | return children |
|
|
379
|
+
| `h1?` | `boolean` \| { `className?`: `string` ; `style?`: `React.CSSProperties` } | return a h1 element |
|
|
379
380
|
| `separator?` | `string` | ` - ` as default |
|
|
380
381
|
| `suffix?` | `string` | - |
|
|
381
382
|
| `title` | `string` \| `string`[] | - |
|
|
@@ -621,13 +622,19 @@ ___
|
|
|
621
622
|
▸ **Title**(`props`): `JSX.Element`
|
|
622
623
|
|
|
623
624
|
Title is used to change the title of the page.
|
|
625
|
+
Return null by default.
|
|
624
626
|
|
|
625
627
|
```ts
|
|
626
|
-
|
|
627
|
-
<Title title=
|
|
628
|
+
// return null
|
|
629
|
+
<Title title='hi' /> // => change the document.title to 'hi'
|
|
630
|
+
<Title title={['a', 'b']} /> // => change the document.title to 'a - b'
|
|
628
631
|
|
|
629
|
-
|
|
630
|
-
<Title title=
|
|
632
|
+
// return h1
|
|
633
|
+
<Title title='hi' h1 /> // => <h1>hi</h1>
|
|
634
|
+
<Title title={['a', 'b']} h1 /> // => <h1>a</h1>
|
|
635
|
+
|
|
636
|
+
// return children
|
|
637
|
+
<Title title='hi'><CustomTitle /></Title> // => <CustomTitle />
|
|
631
638
|
```
|
|
632
639
|
|
|
633
640
|
#### Parameters
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as antd_es_calendar_generateCalendar_js from 'antd/es/calendar/generateCalendar.js';
|
|
2
2
|
import { Dayjs } from 'dayjs';
|
|
3
3
|
import { CalendarProps as CalendarProps$1, DescriptionsProps, DrawerProps as DrawerProps$1, FormItemProps as FormItemProps$1, InputProps, InputNumberProps, SwitchProps, DatePickerProps as DatePickerProps$1, TimePickerProps as TimePickerProps$1, SelectProps, FormProps as FormProps$1, ModalProps as ModalProps$1, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1 } from 'antd';
|
|
4
4
|
export { Drawer, Modal } from 'antd';
|
|
@@ -33,7 +33,7 @@ declare type BlankProps = {
|
|
|
33
33
|
declare function Blank(options?: BlankProps): any;
|
|
34
34
|
|
|
35
35
|
declare type CalendarProps = CalendarProps$1<Dayjs>;
|
|
36
|
-
declare const Calendar: (props:
|
|
36
|
+
declare const Calendar: (props: antd_es_calendar_generateCalendar_js.CalendarProps<Dayjs>) => JSX.Element;
|
|
37
37
|
|
|
38
38
|
declare type FaasState = {
|
|
39
39
|
common: {
|
|
@@ -231,11 +231,42 @@ declare type FormProps<Values = any, ExtendItemProps = any> = {
|
|
|
231
231
|
submit?: false | {
|
|
232
232
|
/** Default: Submit */
|
|
233
233
|
text?: string;
|
|
234
|
+
/**
|
|
235
|
+
* Submit to FaasJS server.
|
|
236
|
+
*
|
|
237
|
+
* If use onFinish, you should call submit manually.
|
|
238
|
+
* ```ts
|
|
239
|
+
* {
|
|
240
|
+
* submit: {
|
|
241
|
+
* to: {
|
|
242
|
+
* action: 'action_name'
|
|
243
|
+
* }
|
|
244
|
+
* },
|
|
245
|
+
* onFinish: (values, submit) => {
|
|
246
|
+
* // do something before submit
|
|
247
|
+
*
|
|
248
|
+
* // submit
|
|
249
|
+
* await submit({
|
|
250
|
+
* ...values,
|
|
251
|
+
* extraProps: 'some extra props'
|
|
252
|
+
* })
|
|
253
|
+
*
|
|
254
|
+
* // do something after submit
|
|
255
|
+
* }
|
|
256
|
+
* }
|
|
257
|
+
* ```
|
|
258
|
+
*/
|
|
259
|
+
to?: {
|
|
260
|
+
action: string;
|
|
261
|
+
/** params will overwrite form values before submit */
|
|
262
|
+
params?: Record<string, any>;
|
|
263
|
+
};
|
|
234
264
|
};
|
|
265
|
+
onFinish?: (values: Values, submit?: (values: any) => Promise<any>) => Promise<any>;
|
|
235
266
|
extendTypes?: {
|
|
236
267
|
[type: string]: ExtendFormTypeProps;
|
|
237
268
|
};
|
|
238
|
-
} & FormProps$1<Values>;
|
|
269
|
+
} & Omit<FormProps$1<Values>, 'onFinish'>;
|
|
239
270
|
declare function Form<Values = any>(props: FormProps<Values>): JSX.Element;
|
|
240
271
|
declare namespace Form {
|
|
241
272
|
var useForm: typeof antd_lib_form_Form.useForm;
|
|
@@ -305,20 +336,29 @@ declare type TitleProps = {
|
|
|
305
336
|
/** ` - ` as default */
|
|
306
337
|
separator?: string;
|
|
307
338
|
suffix?: string;
|
|
339
|
+
/** return a h1 element */
|
|
308
340
|
h1?: boolean | {
|
|
309
341
|
className?: string;
|
|
310
342
|
style?: React.CSSProperties;
|
|
311
343
|
};
|
|
344
|
+
/** return children */
|
|
345
|
+
children?: JSX.Element;
|
|
312
346
|
};
|
|
313
347
|
/**
|
|
314
348
|
* Title is used to change the title of the page.
|
|
349
|
+
* Return null by default.
|
|
315
350
|
*
|
|
316
351
|
* ```ts
|
|
317
|
-
*
|
|
318
|
-
* <Title title=
|
|
352
|
+
* // return null
|
|
353
|
+
* <Title title='hi' /> // => change the document.title to 'hi'
|
|
354
|
+
* <Title title={['a', 'b']} /> // => change the document.title to 'a - b'
|
|
355
|
+
*
|
|
356
|
+
* // return h1
|
|
357
|
+
* <Title title='hi' h1 /> // => <h1>hi</h1>
|
|
358
|
+
* <Title title={['a', 'b']} h1 /> // => <h1>a</h1>
|
|
319
359
|
*
|
|
320
|
-
*
|
|
321
|
-
* <Title title=
|
|
360
|
+
* // return children
|
|
361
|
+
* <Title title='hi'><CustomTitle /></Title> // => <CustomTitle />
|
|
322
362
|
* ```
|
|
323
363
|
*/
|
|
324
364
|
declare function Title(props: TitleProps): JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -112,180 +112,11 @@ function Blank(options) {
|
|
|
112
112
|
}, (options == null ? void 0 : options.text) || config.Blank.text) : options.value;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
// ../../node_modules/rc-picker/es/generate/dayjs.js
|
|
116
|
-
var import_dayjs = __toESM(require("dayjs"));
|
|
117
|
-
|
|
118
|
-
// ../../node_modules/rc-util/es/warning.js
|
|
119
|
-
var warned = {};
|
|
120
|
-
function note(valid, message) {
|
|
121
|
-
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
122
|
-
console.warn("Note: ".concat(message));
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
function call(method, valid, message) {
|
|
126
|
-
if (!valid && !warned[message]) {
|
|
127
|
-
method(false, message);
|
|
128
|
-
warned[message] = true;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
function noteOnce(valid, message) {
|
|
132
|
-
call(note, valid, message);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// ../../node_modules/rc-picker/es/generate/dayjs.js
|
|
136
|
-
var import_weekday = __toESM(require("dayjs/plugin/weekday"));
|
|
137
|
-
var import_localeData = __toESM(require("dayjs/plugin/localeData"));
|
|
138
|
-
var import_weekOfYear = __toESM(require("dayjs/plugin/weekOfYear"));
|
|
139
|
-
var import_weekYear = __toESM(require("dayjs/plugin/weekYear"));
|
|
140
|
-
var import_advancedFormat = __toESM(require("dayjs/plugin/advancedFormat"));
|
|
141
|
-
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
|
|
142
|
-
import_dayjs.default.extend(import_customParseFormat.default);
|
|
143
|
-
import_dayjs.default.extend(import_advancedFormat.default);
|
|
144
|
-
import_dayjs.default.extend(import_weekday.default);
|
|
145
|
-
import_dayjs.default.extend(import_localeData.default);
|
|
146
|
-
import_dayjs.default.extend(import_weekOfYear.default);
|
|
147
|
-
import_dayjs.default.extend(import_weekYear.default);
|
|
148
|
-
import_dayjs.default.extend(function(o, c) {
|
|
149
|
-
var proto = c.prototype;
|
|
150
|
-
var oldFormat = proto.format;
|
|
151
|
-
proto.format = function f(formatStr) {
|
|
152
|
-
var str = (formatStr || "").replace("Wo", "wo");
|
|
153
|
-
return oldFormat.bind(this)(str);
|
|
154
|
-
};
|
|
155
|
-
});
|
|
156
|
-
var localeMap = {
|
|
157
|
-
en_GB: "en-gb",
|
|
158
|
-
en_US: "en",
|
|
159
|
-
zh_CN: "zh-cn",
|
|
160
|
-
zh_TW: "zh-tw"
|
|
161
|
-
};
|
|
162
|
-
var parseLocale = function parseLocale2(locale) {
|
|
163
|
-
var mapLocale = localeMap[locale];
|
|
164
|
-
return mapLocale || locale.split("_")[0];
|
|
165
|
-
};
|
|
166
|
-
var parseNoMatchNotice = function parseNoMatchNotice2() {
|
|
167
|
-
noteOnce(false, "Not match any format. Please help to fire a issue about this.");
|
|
168
|
-
};
|
|
169
|
-
var generateConfig = {
|
|
170
|
-
getNow: function getNow() {
|
|
171
|
-
return (0, import_dayjs.default)();
|
|
172
|
-
},
|
|
173
|
-
getFixedDate: function getFixedDate(string) {
|
|
174
|
-
return (0, import_dayjs.default)(string, "YYYY-MM-DD");
|
|
175
|
-
},
|
|
176
|
-
getEndDate: function getEndDate(date) {
|
|
177
|
-
return date.endOf("month");
|
|
178
|
-
},
|
|
179
|
-
getWeekDay: function getWeekDay(date) {
|
|
180
|
-
var clone = date.locale("en");
|
|
181
|
-
return clone.weekday() + clone.localeData().firstDayOfWeek();
|
|
182
|
-
},
|
|
183
|
-
getYear: function getYear(date) {
|
|
184
|
-
return date.year();
|
|
185
|
-
},
|
|
186
|
-
getMonth: function getMonth(date) {
|
|
187
|
-
return date.month();
|
|
188
|
-
},
|
|
189
|
-
getDate: function getDate(date) {
|
|
190
|
-
return date.date();
|
|
191
|
-
},
|
|
192
|
-
getHour: function getHour(date) {
|
|
193
|
-
return date.hour();
|
|
194
|
-
},
|
|
195
|
-
getMinute: function getMinute(date) {
|
|
196
|
-
return date.minute();
|
|
197
|
-
},
|
|
198
|
-
getSecond: function getSecond(date) {
|
|
199
|
-
return date.second();
|
|
200
|
-
},
|
|
201
|
-
addYear: function addYear(date, diff) {
|
|
202
|
-
return date.add(diff, "year");
|
|
203
|
-
},
|
|
204
|
-
addMonth: function addMonth(date, diff) {
|
|
205
|
-
return date.add(diff, "month");
|
|
206
|
-
},
|
|
207
|
-
addDate: function addDate(date, diff) {
|
|
208
|
-
return date.add(diff, "day");
|
|
209
|
-
},
|
|
210
|
-
setYear: function setYear(date, year) {
|
|
211
|
-
return date.year(year);
|
|
212
|
-
},
|
|
213
|
-
setMonth: function setMonth(date, month) {
|
|
214
|
-
return date.month(month);
|
|
215
|
-
},
|
|
216
|
-
setDate: function setDate(date, num) {
|
|
217
|
-
return date.date(num);
|
|
218
|
-
},
|
|
219
|
-
setHour: function setHour(date, hour) {
|
|
220
|
-
return date.hour(hour);
|
|
221
|
-
},
|
|
222
|
-
setMinute: function setMinute(date, minute) {
|
|
223
|
-
return date.minute(minute);
|
|
224
|
-
},
|
|
225
|
-
setSecond: function setSecond(date, second) {
|
|
226
|
-
return date.second(second);
|
|
227
|
-
},
|
|
228
|
-
isAfter: function isAfter(date1, date2) {
|
|
229
|
-
return date1.isAfter(date2);
|
|
230
|
-
},
|
|
231
|
-
isValidate: function isValidate(date) {
|
|
232
|
-
return date.isValid();
|
|
233
|
-
},
|
|
234
|
-
locale: {
|
|
235
|
-
getWeekFirstDay: function getWeekFirstDay(locale) {
|
|
236
|
-
return (0, import_dayjs.default)().locale(parseLocale(locale)).localeData().firstDayOfWeek();
|
|
237
|
-
},
|
|
238
|
-
getWeekFirstDate: function getWeekFirstDate(locale, date) {
|
|
239
|
-
return date.locale(parseLocale(locale)).weekday(0);
|
|
240
|
-
},
|
|
241
|
-
getWeek: function getWeek(locale, date) {
|
|
242
|
-
return date.locale(parseLocale(locale)).week();
|
|
243
|
-
},
|
|
244
|
-
getShortWeekDays: function getShortWeekDays(locale) {
|
|
245
|
-
return (0, import_dayjs.default)().locale(parseLocale(locale)).localeData().weekdaysMin();
|
|
246
|
-
},
|
|
247
|
-
getShortMonths: function getShortMonths(locale) {
|
|
248
|
-
return (0, import_dayjs.default)().locale(parseLocale(locale)).localeData().monthsShort();
|
|
249
|
-
},
|
|
250
|
-
format: function format(locale, date, _format) {
|
|
251
|
-
return date.locale(parseLocale(locale)).format(_format);
|
|
252
|
-
},
|
|
253
|
-
parse: function parse(locale, text, formats) {
|
|
254
|
-
var localeStr = parseLocale(locale);
|
|
255
|
-
for (var i = 0; i < formats.length; i += 1) {
|
|
256
|
-
var format2 = formats[i];
|
|
257
|
-
var formatText = text;
|
|
258
|
-
if (format2.includes("wo") || format2.includes("Wo")) {
|
|
259
|
-
var year = formatText.split("-")[0];
|
|
260
|
-
var weekStr = formatText.split("-")[1];
|
|
261
|
-
var firstWeek = (0, import_dayjs.default)(year, "YYYY").startOf("year").locale(localeStr);
|
|
262
|
-
for (var j = 0; j <= 52; j += 1) {
|
|
263
|
-
var nextWeek = firstWeek.add(j, "week");
|
|
264
|
-
if (nextWeek.format("Wo") === weekStr) {
|
|
265
|
-
return nextWeek;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
parseNoMatchNotice();
|
|
269
|
-
return null;
|
|
270
|
-
}
|
|
271
|
-
var date = (0, import_dayjs.default)(formatText, format2).locale(localeStr);
|
|
272
|
-
if (date.isValid()) {
|
|
273
|
-
return date;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
if (text) {
|
|
277
|
-
parseNoMatchNotice();
|
|
278
|
-
}
|
|
279
|
-
return null;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
|
-
var dayjs_default = generateConfig;
|
|
284
|
-
|
|
285
115
|
// src/Calendar.tsx
|
|
286
|
-
var
|
|
287
|
-
var
|
|
288
|
-
var
|
|
116
|
+
var import_dayjs = __toESM(require("rc-picker/es/generate/dayjs.js"));
|
|
117
|
+
var import_generateCalendar = __toESM(require("antd/es/calendar/generateCalendar.js"));
|
|
118
|
+
var import_style = require("antd/es/calendar/style/index.js");
|
|
119
|
+
var Calendar = (0, import_generateCalendar.default)(import_dayjs.default);
|
|
289
120
|
|
|
290
121
|
// src/data.ts
|
|
291
122
|
var import_lodash2 = require("lodash");
|
|
@@ -299,16 +130,17 @@ function transferOptions(options) {
|
|
|
299
130
|
}
|
|
300
131
|
|
|
301
132
|
// src/DatePicker.tsx
|
|
302
|
-
var
|
|
303
|
-
var
|
|
304
|
-
var
|
|
133
|
+
var import_dayjs2 = __toESM(require("rc-picker/es/generate/dayjs.js"));
|
|
134
|
+
var import_generatePicker = __toESM(require("antd/es/date-picker/generatePicker/index.js"));
|
|
135
|
+
var import_style2 = require("antd/es/date-picker/style/index.js");
|
|
136
|
+
var DatePicker = (0, import_generatePicker.default)(import_dayjs2.default);
|
|
305
137
|
|
|
306
138
|
// src/Description.tsx
|
|
307
139
|
var import_icons = require("@ant-design/icons");
|
|
308
140
|
var import_antd2 = require("antd");
|
|
309
141
|
var import_lodash3 = require("lodash");
|
|
310
142
|
var import_react3 = require("react");
|
|
311
|
-
var
|
|
143
|
+
var import_dayjs3 = __toESM(require("dayjs"));
|
|
312
144
|
var import_react4 = require("@faasjs/react");
|
|
313
145
|
function DescriptionItemContent(props) {
|
|
314
146
|
const [computedProps, setComputedProps] = (0, import_react3.useState)();
|
|
@@ -375,9 +207,9 @@ function DescriptionItemContent(props) {
|
|
|
375
207
|
}
|
|
376
208
|
});
|
|
377
209
|
case "time":
|
|
378
|
-
return typeof computedProps.value === "number" && computedProps.value.toString().length === 10 ?
|
|
210
|
+
return typeof computedProps.value === "number" && computedProps.value.toString().length === 10 ? import_dayjs3.default.unix(computedProps.value).format("YYYY-MM-DD HH:mm:ss") : (0, import_dayjs3.default)(computedProps.value).format("YYYY-MM-DD HH:mm:ss");
|
|
379
211
|
case "date":
|
|
380
|
-
return typeof computedProps.value === "number" && computedProps.value.toString().length === 10 ?
|
|
212
|
+
return typeof computedProps.value === "number" && computedProps.value.toString().length === 10 ? import_dayjs3.default.unix(computedProps.value).format("YYYY-MM-DD") : (0, import_dayjs3.default)(computedProps.value).format("YYYY-MM-DD");
|
|
381
213
|
default:
|
|
382
214
|
return computedProps.value;
|
|
383
215
|
}
|
|
@@ -429,8 +261,9 @@ function useDrawer(init) {
|
|
|
429
261
|
}
|
|
430
262
|
|
|
431
263
|
// src/Form.tsx
|
|
264
|
+
var import_react8 = require("@faasjs/react");
|
|
432
265
|
var import_antd5 = require("antd");
|
|
433
|
-
var
|
|
266
|
+
var import_react9 = require("react");
|
|
434
267
|
|
|
435
268
|
// src/FormItem.tsx
|
|
436
269
|
var import_antd4 = require("antd");
|
|
@@ -607,44 +440,48 @@ function FormItem(props) {
|
|
|
607
440
|
// src/Form.tsx
|
|
608
441
|
function Form(props) {
|
|
609
442
|
var _a, _b;
|
|
610
|
-
const [loading, setLoading] = (0,
|
|
611
|
-
const [computedProps, setComputedProps] = (0,
|
|
443
|
+
const [loading, setLoading] = (0, import_react9.useState)(false);
|
|
444
|
+
const [computedProps, setComputedProps] = (0, import_react9.useState)();
|
|
612
445
|
const [config] = useFaasState();
|
|
613
|
-
(0,
|
|
446
|
+
(0, import_react9.useEffect)(() => {
|
|
614
447
|
const propsCopy = __spreadValues({}, props);
|
|
615
448
|
if (propsCopy.onFinish) {
|
|
616
449
|
propsCopy.onFinish = async (values) => {
|
|
450
|
+
var _a2;
|
|
617
451
|
setLoading(true);
|
|
618
452
|
try {
|
|
619
|
-
|
|
453
|
+
if (propsCopy.submit && ((_a2 = propsCopy.submit.to) == null ? void 0 : _a2.action)) {
|
|
454
|
+
await props.onFinish(values, async (values2) => (0, import_react8.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values2), propsCopy.submit.to.params) : values2));
|
|
455
|
+
} else
|
|
456
|
+
await propsCopy.onFinish(values);
|
|
620
457
|
} catch (error) {
|
|
621
458
|
console.error(error);
|
|
622
459
|
}
|
|
623
460
|
setLoading(false);
|
|
624
461
|
};
|
|
625
462
|
}
|
|
626
|
-
setComputedProps(
|
|
463
|
+
setComputedProps(propsCopy);
|
|
627
464
|
}, []);
|
|
628
465
|
if (!computedProps)
|
|
629
466
|
return null;
|
|
630
|
-
return /* @__PURE__ */ import_react.default.createElement(import_antd5.Form, __spreadValues({}, computedProps), (_a =
|
|
467
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd5.Form, __spreadValues({}, computedProps), (_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ import_react.default.createElement(FormItem, __spreadProps(__spreadValues({
|
|
631
468
|
key: item.id
|
|
632
469
|
}, item), {
|
|
633
|
-
extendTypes:
|
|
634
|
-
}))),
|
|
470
|
+
extendTypes: computedProps.extendTypes
|
|
471
|
+
}))), computedProps.children, computedProps.submit !== false && /* @__PURE__ */ import_react.default.createElement(import_antd5.Button, {
|
|
635
472
|
htmlType: "submit",
|
|
636
473
|
type: "primary",
|
|
637
474
|
loading
|
|
638
|
-
}, ((_b =
|
|
475
|
+
}, ((_b = computedProps.submit) == null ? void 0 : _b.text) || config.Form.submit.text));
|
|
639
476
|
}
|
|
640
477
|
Form.useForm = import_antd5.Form.useForm;
|
|
641
478
|
Form.Item = FormItem;
|
|
642
479
|
|
|
643
480
|
// src/Modal.tsx
|
|
644
481
|
var import_antd6 = require("antd");
|
|
645
|
-
var
|
|
482
|
+
var import_react10 = require("react");
|
|
646
483
|
function useModal(init) {
|
|
647
|
-
const [props, setProps] = (0,
|
|
484
|
+
const [props, setProps] = (0, import_react10.useState)(__spreadValues({
|
|
648
485
|
visible: false,
|
|
649
486
|
onCancel: () => setProps((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
650
487
|
visible: false
|
|
@@ -661,7 +498,7 @@ function useModal(init) {
|
|
|
661
498
|
|
|
662
499
|
// src/Routers.tsx
|
|
663
500
|
var import_antd7 = require("antd");
|
|
664
|
-
var
|
|
501
|
+
var import_react11 = require("react");
|
|
665
502
|
var import_react_router_dom = require("react-router-dom");
|
|
666
503
|
function NotFound() {
|
|
667
504
|
const [config] = useFaasState();
|
|
@@ -674,7 +511,7 @@ function Routes(props) {
|
|
|
674
511
|
return /* @__PURE__ */ import_react.default.createElement(import_react_router_dom.Routes, null, props.routes.map((r) => /* @__PURE__ */ import_react.default.createElement(import_react_router_dom.Route, __spreadProps(__spreadValues({
|
|
675
512
|
key: r.path
|
|
676
513
|
}, r), {
|
|
677
|
-
element: r.element || /* @__PURE__ */ import_react.default.createElement(
|
|
514
|
+
element: r.element || /* @__PURE__ */ import_react.default.createElement(import_react11.Suspense, {
|
|
678
515
|
fallback: props.fallback || /* @__PURE__ */ import_react.default.createElement("div", {
|
|
679
516
|
style: { padding: "24px" }
|
|
680
517
|
}, /* @__PURE__ */ import_react.default.createElement(import_antd7.Skeleton, {
|
|
@@ -689,12 +526,12 @@ function Routes(props) {
|
|
|
689
526
|
}
|
|
690
527
|
|
|
691
528
|
// src/Table.tsx
|
|
692
|
-
var
|
|
529
|
+
var import_react12 = require("react");
|
|
693
530
|
var import_antd8 = require("antd");
|
|
694
|
-
var
|
|
531
|
+
var import_dayjs4 = __toESM(require("dayjs"));
|
|
695
532
|
var import_icons3 = require("@ant-design/icons");
|
|
696
533
|
var import_lodash5 = require("lodash");
|
|
697
|
-
var
|
|
534
|
+
var import_react13 = require("@faasjs/react");
|
|
698
535
|
function processValue(item, value) {
|
|
699
536
|
var _a;
|
|
700
537
|
if (typeof value !== "undefined" && value !== null) {
|
|
@@ -719,15 +556,15 @@ function processValue(item, value) {
|
|
|
719
556
|
if (["date", "time"].includes(item.type)) {
|
|
720
557
|
if (typeof value === "number" && value.toString().length === 10)
|
|
721
558
|
value = value * 1e3;
|
|
722
|
-
value = (0,
|
|
559
|
+
value = (0, import_dayjs4.default)(value).format(dayjsFormat);
|
|
723
560
|
}
|
|
724
561
|
}
|
|
725
562
|
return value;
|
|
726
563
|
}
|
|
727
564
|
function Table(props) {
|
|
728
|
-
const [columns, setColumns] = (0,
|
|
565
|
+
const [columns, setColumns] = (0, import_react12.useState)();
|
|
729
566
|
const [config] = useFaasState();
|
|
730
|
-
(0,
|
|
567
|
+
(0, import_react12.useEffect)(() => {
|
|
731
568
|
var _a;
|
|
732
569
|
for (const item of props.items) {
|
|
733
570
|
if (!item.key)
|
|
@@ -751,7 +588,7 @@ function Table(props) {
|
|
|
751
588
|
delete item.children;
|
|
752
589
|
if (props.extendTypes && props.extendTypes[item.type]) {
|
|
753
590
|
if (props.extendTypes[item.type].children) {
|
|
754
|
-
item.render = (value, values) => (0,
|
|
591
|
+
item.render = (value, values) => (0, import_react12.cloneElement)(props.extendTypes[item.type].children, {
|
|
755
592
|
value,
|
|
756
593
|
values
|
|
757
594
|
});
|
|
@@ -838,12 +675,12 @@ function Table(props) {
|
|
|
838
675
|
case "date":
|
|
839
676
|
item.render = (value) => processValue(item, value);
|
|
840
677
|
if (!item.onFilter)
|
|
841
|
-
item.onFilter = (value, row) => (0,
|
|
678
|
+
item.onFilter = (value, row) => (0, import_dayjs4.default)(row[item.id]).isSame((0, import_dayjs4.default)(value));
|
|
842
679
|
break;
|
|
843
680
|
case "time":
|
|
844
681
|
item.render = (value) => processValue(item, value);
|
|
845
682
|
if (!item.onFilter)
|
|
846
|
-
item.onFilter = (value, row) => (0,
|
|
683
|
+
item.onFilter = (value, row) => (0, import_dayjs4.default)(row[item.id]).isSame((0, import_dayjs4.default)(value));
|
|
847
684
|
break;
|
|
848
685
|
default:
|
|
849
686
|
item.render = (value) => processValue(item, value);
|
|
@@ -862,7 +699,7 @@ function Table(props) {
|
|
|
862
699
|
columns,
|
|
863
700
|
dataSource: props.dataSource
|
|
864
701
|
}));
|
|
865
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
702
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react13.FaasDataWrapper, __spreadValues({
|
|
866
703
|
fallback: props.faasData.fallback || /* @__PURE__ */ import_react.default.createElement(import_antd8.Skeleton, {
|
|
867
704
|
active: true
|
|
868
705
|
}),
|
|
@@ -910,10 +747,10 @@ function Table(props) {
|
|
|
910
747
|
}
|
|
911
748
|
|
|
912
749
|
// src/Title.tsx
|
|
913
|
-
var
|
|
750
|
+
var import_react14 = require("react");
|
|
914
751
|
function Title(props) {
|
|
915
752
|
const [config] = useFaasState();
|
|
916
|
-
(0,
|
|
753
|
+
(0, import_react14.useEffect)(() => {
|
|
917
754
|
const title = Array.isArray(props.title) ? props.title : [props.title];
|
|
918
755
|
document.title = title.concat(props.suffix || config.Title.suffix).filter((t) => !!t).join(props.separator || config.Title.separator);
|
|
919
756
|
}, []);
|
|
@@ -925,6 +762,8 @@ function Title(props) {
|
|
|
925
762
|
style: props.h1.style
|
|
926
763
|
}, Array.isArray(props.title) ? props.title[0] : props.title);
|
|
927
764
|
}
|
|
765
|
+
if (props.children)
|
|
766
|
+
return (0, import_react14.cloneElement)(props.children, { title: props.title });
|
|
928
767
|
return null;
|
|
929
768
|
}
|
|
930
769
|
module.exports = __toCommonJS(src_exports);
|
package/dist/index.mjs
CHANGED
|
@@ -65,180 +65,11 @@ function Blank(options) {
|
|
|
65
65
|
}, (options == null ? void 0 : options.text) || config.Blank.text) : options.value;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
// ../../node_modules/rc-picker/es/generate/dayjs.js
|
|
69
|
-
import dayjs from "dayjs";
|
|
70
|
-
|
|
71
|
-
// ../../node_modules/rc-util/es/warning.js
|
|
72
|
-
var warned = {};
|
|
73
|
-
function note(valid, message) {
|
|
74
|
-
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
75
|
-
console.warn("Note: ".concat(message));
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
function call(method, valid, message) {
|
|
79
|
-
if (!valid && !warned[message]) {
|
|
80
|
-
method(false, message);
|
|
81
|
-
warned[message] = true;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
function noteOnce(valid, message) {
|
|
85
|
-
call(note, valid, message);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// ../../node_modules/rc-picker/es/generate/dayjs.js
|
|
89
|
-
import weekday from "dayjs/plugin/weekday";
|
|
90
|
-
import localeData from "dayjs/plugin/localeData";
|
|
91
|
-
import weekOfYear from "dayjs/plugin/weekOfYear";
|
|
92
|
-
import weekYear from "dayjs/plugin/weekYear";
|
|
93
|
-
import advancedFormat from "dayjs/plugin/advancedFormat";
|
|
94
|
-
import customParseFormat from "dayjs/plugin/customParseFormat";
|
|
95
|
-
dayjs.extend(customParseFormat);
|
|
96
|
-
dayjs.extend(advancedFormat);
|
|
97
|
-
dayjs.extend(weekday);
|
|
98
|
-
dayjs.extend(localeData);
|
|
99
|
-
dayjs.extend(weekOfYear);
|
|
100
|
-
dayjs.extend(weekYear);
|
|
101
|
-
dayjs.extend(function(o, c) {
|
|
102
|
-
var proto = c.prototype;
|
|
103
|
-
var oldFormat = proto.format;
|
|
104
|
-
proto.format = function f(formatStr) {
|
|
105
|
-
var str = (formatStr || "").replace("Wo", "wo");
|
|
106
|
-
return oldFormat.bind(this)(str);
|
|
107
|
-
};
|
|
108
|
-
});
|
|
109
|
-
var localeMap = {
|
|
110
|
-
en_GB: "en-gb",
|
|
111
|
-
en_US: "en",
|
|
112
|
-
zh_CN: "zh-cn",
|
|
113
|
-
zh_TW: "zh-tw"
|
|
114
|
-
};
|
|
115
|
-
var parseLocale = function parseLocale2(locale) {
|
|
116
|
-
var mapLocale = localeMap[locale];
|
|
117
|
-
return mapLocale || locale.split("_")[0];
|
|
118
|
-
};
|
|
119
|
-
var parseNoMatchNotice = function parseNoMatchNotice2() {
|
|
120
|
-
noteOnce(false, "Not match any format. Please help to fire a issue about this.");
|
|
121
|
-
};
|
|
122
|
-
var generateConfig = {
|
|
123
|
-
getNow: function getNow() {
|
|
124
|
-
return dayjs();
|
|
125
|
-
},
|
|
126
|
-
getFixedDate: function getFixedDate(string) {
|
|
127
|
-
return dayjs(string, "YYYY-MM-DD");
|
|
128
|
-
},
|
|
129
|
-
getEndDate: function getEndDate(date) {
|
|
130
|
-
return date.endOf("month");
|
|
131
|
-
},
|
|
132
|
-
getWeekDay: function getWeekDay(date) {
|
|
133
|
-
var clone = date.locale("en");
|
|
134
|
-
return clone.weekday() + clone.localeData().firstDayOfWeek();
|
|
135
|
-
},
|
|
136
|
-
getYear: function getYear(date) {
|
|
137
|
-
return date.year();
|
|
138
|
-
},
|
|
139
|
-
getMonth: function getMonth(date) {
|
|
140
|
-
return date.month();
|
|
141
|
-
},
|
|
142
|
-
getDate: function getDate(date) {
|
|
143
|
-
return date.date();
|
|
144
|
-
},
|
|
145
|
-
getHour: function getHour(date) {
|
|
146
|
-
return date.hour();
|
|
147
|
-
},
|
|
148
|
-
getMinute: function getMinute(date) {
|
|
149
|
-
return date.minute();
|
|
150
|
-
},
|
|
151
|
-
getSecond: function getSecond(date) {
|
|
152
|
-
return date.second();
|
|
153
|
-
},
|
|
154
|
-
addYear: function addYear(date, diff) {
|
|
155
|
-
return date.add(diff, "year");
|
|
156
|
-
},
|
|
157
|
-
addMonth: function addMonth(date, diff) {
|
|
158
|
-
return date.add(diff, "month");
|
|
159
|
-
},
|
|
160
|
-
addDate: function addDate(date, diff) {
|
|
161
|
-
return date.add(diff, "day");
|
|
162
|
-
},
|
|
163
|
-
setYear: function setYear(date, year) {
|
|
164
|
-
return date.year(year);
|
|
165
|
-
},
|
|
166
|
-
setMonth: function setMonth(date, month) {
|
|
167
|
-
return date.month(month);
|
|
168
|
-
},
|
|
169
|
-
setDate: function setDate(date, num) {
|
|
170
|
-
return date.date(num);
|
|
171
|
-
},
|
|
172
|
-
setHour: function setHour(date, hour) {
|
|
173
|
-
return date.hour(hour);
|
|
174
|
-
},
|
|
175
|
-
setMinute: function setMinute(date, minute) {
|
|
176
|
-
return date.minute(minute);
|
|
177
|
-
},
|
|
178
|
-
setSecond: function setSecond(date, second) {
|
|
179
|
-
return date.second(second);
|
|
180
|
-
},
|
|
181
|
-
isAfter: function isAfter(date1, date2) {
|
|
182
|
-
return date1.isAfter(date2);
|
|
183
|
-
},
|
|
184
|
-
isValidate: function isValidate(date) {
|
|
185
|
-
return date.isValid();
|
|
186
|
-
},
|
|
187
|
-
locale: {
|
|
188
|
-
getWeekFirstDay: function getWeekFirstDay(locale) {
|
|
189
|
-
return dayjs().locale(parseLocale(locale)).localeData().firstDayOfWeek();
|
|
190
|
-
},
|
|
191
|
-
getWeekFirstDate: function getWeekFirstDate(locale, date) {
|
|
192
|
-
return date.locale(parseLocale(locale)).weekday(0);
|
|
193
|
-
},
|
|
194
|
-
getWeek: function getWeek(locale, date) {
|
|
195
|
-
return date.locale(parseLocale(locale)).week();
|
|
196
|
-
},
|
|
197
|
-
getShortWeekDays: function getShortWeekDays(locale) {
|
|
198
|
-
return dayjs().locale(parseLocale(locale)).localeData().weekdaysMin();
|
|
199
|
-
},
|
|
200
|
-
getShortMonths: function getShortMonths(locale) {
|
|
201
|
-
return dayjs().locale(parseLocale(locale)).localeData().monthsShort();
|
|
202
|
-
},
|
|
203
|
-
format: function format(locale, date, _format) {
|
|
204
|
-
return date.locale(parseLocale(locale)).format(_format);
|
|
205
|
-
},
|
|
206
|
-
parse: function parse(locale, text, formats) {
|
|
207
|
-
var localeStr = parseLocale(locale);
|
|
208
|
-
for (var i = 0; i < formats.length; i += 1) {
|
|
209
|
-
var format2 = formats[i];
|
|
210
|
-
var formatText = text;
|
|
211
|
-
if (format2.includes("wo") || format2.includes("Wo")) {
|
|
212
|
-
var year = formatText.split("-")[0];
|
|
213
|
-
var weekStr = formatText.split("-")[1];
|
|
214
|
-
var firstWeek = dayjs(year, "YYYY").startOf("year").locale(localeStr);
|
|
215
|
-
for (var j = 0; j <= 52; j += 1) {
|
|
216
|
-
var nextWeek = firstWeek.add(j, "week");
|
|
217
|
-
if (nextWeek.format("Wo") === weekStr) {
|
|
218
|
-
return nextWeek;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
parseNoMatchNotice();
|
|
222
|
-
return null;
|
|
223
|
-
}
|
|
224
|
-
var date = dayjs(formatText, format2).locale(localeStr);
|
|
225
|
-
if (date.isValid()) {
|
|
226
|
-
return date;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
if (text) {
|
|
230
|
-
parseNoMatchNotice();
|
|
231
|
-
}
|
|
232
|
-
return null;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
var dayjs_default = generateConfig;
|
|
237
|
-
|
|
238
68
|
// src/Calendar.tsx
|
|
239
|
-
import
|
|
240
|
-
import "antd/es/calendar/
|
|
241
|
-
|
|
69
|
+
import dayjsGenerateConfig from "rc-picker/es/generate/dayjs.js";
|
|
70
|
+
import generateCalendar from "antd/es/calendar/generateCalendar.js";
|
|
71
|
+
import "antd/es/calendar/style/index.js";
|
|
72
|
+
var Calendar = generateCalendar(dayjsGenerateConfig);
|
|
242
73
|
|
|
243
74
|
// src/data.ts
|
|
244
75
|
import { upperFirst } from "lodash";
|
|
@@ -252,9 +83,10 @@ function transferOptions(options) {
|
|
|
252
83
|
}
|
|
253
84
|
|
|
254
85
|
// src/DatePicker.tsx
|
|
255
|
-
import
|
|
256
|
-
import "antd/es/date-picker/
|
|
257
|
-
|
|
86
|
+
import dayjsGenerateConfig2 from "rc-picker/es/generate/dayjs.js";
|
|
87
|
+
import generatePicker from "antd/es/date-picker/generatePicker/index.js";
|
|
88
|
+
import "antd/es/date-picker/style/index.js";
|
|
89
|
+
var DatePicker = generatePicker(dayjsGenerateConfig2);
|
|
258
90
|
|
|
259
91
|
// src/Description.tsx
|
|
260
92
|
import { CheckOutlined, CloseOutlined } from "@ant-design/icons";
|
|
@@ -268,7 +100,7 @@ import {
|
|
|
268
100
|
useEffect as useEffect2,
|
|
269
101
|
useState
|
|
270
102
|
} from "react";
|
|
271
|
-
import
|
|
103
|
+
import dayjs from "dayjs";
|
|
272
104
|
import { FaasDataWrapper } from "@faasjs/react";
|
|
273
105
|
function DescriptionItemContent(props) {
|
|
274
106
|
const [computedProps, setComputedProps] = useState();
|
|
@@ -335,9 +167,9 @@ function DescriptionItemContent(props) {
|
|
|
335
167
|
}
|
|
336
168
|
});
|
|
337
169
|
case "time":
|
|
338
|
-
return typeof computedProps.value === "number" && computedProps.value.toString().length === 10 ?
|
|
170
|
+
return typeof computedProps.value === "number" && computedProps.value.toString().length === 10 ? dayjs.unix(computedProps.value).format("YYYY-MM-DD HH:mm:ss") : dayjs(computedProps.value).format("YYYY-MM-DD HH:mm:ss");
|
|
339
171
|
case "date":
|
|
340
|
-
return typeof computedProps.value === "number" && computedProps.value.toString().length === 10 ?
|
|
172
|
+
return typeof computedProps.value === "number" && computedProps.value.toString().length === 10 ? dayjs.unix(computedProps.value).format("YYYY-MM-DD") : dayjs(computedProps.value).format("YYYY-MM-DD");
|
|
341
173
|
default:
|
|
342
174
|
return computedProps.value;
|
|
343
175
|
}
|
|
@@ -389,6 +221,7 @@ function useDrawer(init) {
|
|
|
389
221
|
}
|
|
390
222
|
|
|
391
223
|
// src/Form.tsx
|
|
224
|
+
import { faas } from "@faasjs/react";
|
|
392
225
|
import {
|
|
393
226
|
Button as Button2,
|
|
394
227
|
Form as AntdForm2
|
|
@@ -586,28 +419,32 @@ function Form(props) {
|
|
|
586
419
|
const propsCopy = __spreadValues({}, props);
|
|
587
420
|
if (propsCopy.onFinish) {
|
|
588
421
|
propsCopy.onFinish = async (values) => {
|
|
422
|
+
var _a2;
|
|
589
423
|
setLoading(true);
|
|
590
424
|
try {
|
|
591
|
-
|
|
425
|
+
if (propsCopy.submit && ((_a2 = propsCopy.submit.to) == null ? void 0 : _a2.action)) {
|
|
426
|
+
await props.onFinish(values, async (values2) => faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values2), propsCopy.submit.to.params) : values2));
|
|
427
|
+
} else
|
|
428
|
+
await propsCopy.onFinish(values);
|
|
592
429
|
} catch (error) {
|
|
593
430
|
console.error(error);
|
|
594
431
|
}
|
|
595
432
|
setLoading(false);
|
|
596
433
|
};
|
|
597
434
|
}
|
|
598
|
-
setComputedProps(
|
|
435
|
+
setComputedProps(propsCopy);
|
|
599
436
|
}, []);
|
|
600
437
|
if (!computedProps)
|
|
601
438
|
return null;
|
|
602
|
-
return /* @__PURE__ */ React.createElement(AntdForm2, __spreadValues({}, computedProps), (_a =
|
|
439
|
+
return /* @__PURE__ */ React.createElement(AntdForm2, __spreadValues({}, computedProps), (_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ React.createElement(FormItem, __spreadProps(__spreadValues({
|
|
603
440
|
key: item.id
|
|
604
441
|
}, item), {
|
|
605
|
-
extendTypes:
|
|
606
|
-
}))),
|
|
442
|
+
extendTypes: computedProps.extendTypes
|
|
443
|
+
}))), computedProps.children, computedProps.submit !== false && /* @__PURE__ */ React.createElement(Button2, {
|
|
607
444
|
htmlType: "submit",
|
|
608
445
|
type: "primary",
|
|
609
446
|
loading
|
|
610
|
-
}, ((_b =
|
|
447
|
+
}, ((_b = computedProps.submit) == null ? void 0 : _b.text) || config.Form.submit.text));
|
|
611
448
|
}
|
|
612
449
|
Form.useForm = AntdForm2.useForm;
|
|
613
450
|
Form.Item = FormItem;
|
|
@@ -676,7 +513,7 @@ import {
|
|
|
676
513
|
Radio,
|
|
677
514
|
Skeleton as Skeleton3
|
|
678
515
|
} from "antd";
|
|
679
|
-
import
|
|
516
|
+
import dayjs2 from "dayjs";
|
|
680
517
|
import { CheckOutlined as CheckOutlined2, CloseOutlined as CloseOutlined2 } from "@ant-design/icons";
|
|
681
518
|
import { isNil as isNil2, upperFirst as upperFirst4 } from "lodash";
|
|
682
519
|
import { FaasDataWrapper as FaasDataWrapper2 } from "@faasjs/react";
|
|
@@ -704,7 +541,7 @@ function processValue(item, value) {
|
|
|
704
541
|
if (["date", "time"].includes(item.type)) {
|
|
705
542
|
if (typeof value === "number" && value.toString().length === 10)
|
|
706
543
|
value = value * 1e3;
|
|
707
|
-
value =
|
|
544
|
+
value = dayjs2(value).format(dayjsFormat);
|
|
708
545
|
}
|
|
709
546
|
}
|
|
710
547
|
return value;
|
|
@@ -823,12 +660,12 @@ function Table(props) {
|
|
|
823
660
|
case "date":
|
|
824
661
|
item.render = (value) => processValue(item, value);
|
|
825
662
|
if (!item.onFilter)
|
|
826
|
-
item.onFilter = (value, row) =>
|
|
663
|
+
item.onFilter = (value, row) => dayjs2(row[item.id]).isSame(dayjs2(value));
|
|
827
664
|
break;
|
|
828
665
|
case "time":
|
|
829
666
|
item.render = (value) => processValue(item, value);
|
|
830
667
|
if (!item.onFilter)
|
|
831
|
-
item.onFilter = (value, row) =>
|
|
668
|
+
item.onFilter = (value, row) => dayjs2(row[item.id]).isSame(dayjs2(value));
|
|
832
669
|
break;
|
|
833
670
|
default:
|
|
834
671
|
item.render = (value) => processValue(item, value);
|
|
@@ -895,7 +732,7 @@ function Table(props) {
|
|
|
895
732
|
}
|
|
896
733
|
|
|
897
734
|
// src/Title.tsx
|
|
898
|
-
import { useEffect as useEffect6 } from "react";
|
|
735
|
+
import { useEffect as useEffect6, cloneElement as cloneElement3 } from "react";
|
|
899
736
|
function Title(props) {
|
|
900
737
|
const [config] = useFaasState();
|
|
901
738
|
useEffect6(() => {
|
|
@@ -910,6 +747,8 @@ function Title(props) {
|
|
|
910
747
|
style: props.h1.style
|
|
911
748
|
}, Array.isArray(props.title) ? props.title[0] : props.title);
|
|
912
749
|
}
|
|
750
|
+
if (props.children)
|
|
751
|
+
return cloneElement3(props.children, { title: props.title });
|
|
913
752
|
return null;
|
|
914
753
|
}
|
|
915
754
|
export {
|
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.375",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"funding": "https://github.com/sponsors/faasjs",
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "tsup src/index.ts --format esm,cjs --inject react-shim.js",
|
|
19
|
+
"build": "tsup-node src/index.ts --format esm,cjs --inject react-shim.js",
|
|
20
20
|
"build:types": "tsup-node src/index.ts --dts-only"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"lodash": "*",
|
|
29
29
|
"react": "*",
|
|
30
30
|
"react-dom": "*",
|
|
31
|
-
"@faasjs/react": "^0.0.2-beta.
|
|
31
|
+
"@faasjs/react": "^0.0.2-beta.375",
|
|
32
32
|
"react-use": "*",
|
|
33
33
|
"react-router-dom": "*",
|
|
34
34
|
"dayjs": "*"
|