@faasjs/ant-design 0.0.2-beta.418 → 0.0.2-beta.420
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 +6 -2
- package/dist/index.js +12 -1
- package/dist/index.mjs +13 -2
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as antd_es_calendar_generateCalendar_js from 'antd/es/calendar/generateCalendar.js';
|
|
2
2
|
import { Dayjs } from 'dayjs';
|
|
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, ButtonProps, ModalProps as ModalProps$1, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1 } from 'antd';
|
|
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, ButtonProps, ModalProps as ModalProps$1, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, PageHeaderProps } from 'antd';
|
|
4
4
|
export { Drawer, Modal } from 'antd';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import { CSSProperties, ReactNode, LazyExoticComponent, ComponentType } from 'react';
|
|
@@ -145,7 +145,7 @@ declare type DescriptionItemProps<T = any> = {
|
|
|
145
145
|
render?: (value: T, values: any) => JSX.Element | string | number | boolean | null;
|
|
146
146
|
} & FaasItemProps;
|
|
147
147
|
declare type DescriptionProps<T = any, ExtendItemProps = any> = {
|
|
148
|
-
|
|
148
|
+
renderTitle?: ((values: T) => ReactNode);
|
|
149
149
|
items: (DescriptionItemProps | ExtendItemProps)[];
|
|
150
150
|
extendTypes?: {
|
|
151
151
|
[key: string]: ExtendDescriptionTypeProps;
|
|
@@ -420,6 +420,10 @@ declare type TitleProps = {
|
|
|
420
420
|
className?: string;
|
|
421
421
|
style?: React.CSSProperties;
|
|
422
422
|
};
|
|
423
|
+
/** return a pure text element */
|
|
424
|
+
plain?: boolean;
|
|
425
|
+
/** return a PageHeader element */
|
|
426
|
+
header?: PageHeaderProps;
|
|
423
427
|
/** return children */
|
|
424
428
|
children?: JSX.Element;
|
|
425
429
|
};
|
package/dist/index.js
CHANGED
|
@@ -260,6 +260,7 @@ function Description(props) {
|
|
|
260
260
|
if (!props.faasData)
|
|
261
261
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Descriptions, {
|
|
262
262
|
...props,
|
|
263
|
+
title: (0, import_lodash4.isFunction)(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
|
|
263
264
|
children: props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Descriptions.Item, {
|
|
264
265
|
label: item.title || (0, import_lodash4.upperFirst)(item.id),
|
|
265
266
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DescriptionItemContent, {
|
|
@@ -277,7 +278,7 @@ function Description(props) {
|
|
|
277
278
|
render: ({ data }) => {
|
|
278
279
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Descriptions, {
|
|
279
280
|
...props,
|
|
280
|
-
title: (0, import_lodash4.isFunction)(props.
|
|
281
|
+
title: (0, import_lodash4.isFunction)(props.renderTitle) ? props.renderTitle(data) : props.title,
|
|
281
282
|
children: props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Descriptions.Item, {
|
|
282
283
|
label: item.title || (0, import_lodash4.upperFirst)(item.id),
|
|
283
284
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DescriptionItemContent, {
|
|
@@ -1260,6 +1261,7 @@ function Table(props) {
|
|
|
1260
1261
|
|
|
1261
1262
|
// src/Title.tsx
|
|
1262
1263
|
var import_react14 = require("react");
|
|
1264
|
+
var import_antd11 = require("antd");
|
|
1263
1265
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1264
1266
|
function Title(props) {
|
|
1265
1267
|
const config = useConfigContext();
|
|
@@ -1278,6 +1280,15 @@ function Title(props) {
|
|
|
1278
1280
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1279
1281
|
});
|
|
1280
1282
|
}
|
|
1283
|
+
if (props.plain)
|
|
1284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, {
|
|
1285
|
+
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1286
|
+
});
|
|
1287
|
+
if (props.header)
|
|
1288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_antd11.PageHeader, {
|
|
1289
|
+
title: Array.isArray(props.title) ? props.title[0] : props.title,
|
|
1290
|
+
...props.header
|
|
1291
|
+
});
|
|
1281
1292
|
if (props.children)
|
|
1282
1293
|
return (0, import_react14.cloneElement)(props.children, { title: props.title });
|
|
1283
1294
|
return null;
|
package/dist/index.mjs
CHANGED
|
@@ -221,6 +221,7 @@ function Description(props) {
|
|
|
221
221
|
if (!props.faasData)
|
|
222
222
|
return /* @__PURE__ */ jsx3(Descriptions, {
|
|
223
223
|
...props,
|
|
224
|
+
title: isFunction(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
|
|
224
225
|
children: props.items.map((item) => /* @__PURE__ */ jsx3(Descriptions.Item, {
|
|
225
226
|
label: item.title || upperFirst2(item.id),
|
|
226
227
|
children: /* @__PURE__ */ jsx3(DescriptionItemContent, {
|
|
@@ -238,7 +239,7 @@ function Description(props) {
|
|
|
238
239
|
render: ({ data }) => {
|
|
239
240
|
return /* @__PURE__ */ jsx3(Descriptions, {
|
|
240
241
|
...props,
|
|
241
|
-
title: isFunction(props.
|
|
242
|
+
title: isFunction(props.renderTitle) ? props.renderTitle(data) : props.title,
|
|
242
243
|
children: props.items.map((item) => /* @__PURE__ */ jsx3(Descriptions.Item, {
|
|
243
244
|
label: item.title || upperFirst2(item.id),
|
|
244
245
|
children: /* @__PURE__ */ jsx3(DescriptionItemContent, {
|
|
@@ -1254,7 +1255,8 @@ function Table(props) {
|
|
|
1254
1255
|
|
|
1255
1256
|
// src/Title.tsx
|
|
1256
1257
|
import { useEffect as useEffect6, cloneElement as cloneElement3 } from "react";
|
|
1257
|
-
import {
|
|
1258
|
+
import { PageHeader } from "antd";
|
|
1259
|
+
import { Fragment as Fragment3, jsx as jsx12 } from "react/jsx-runtime";
|
|
1258
1260
|
function Title(props) {
|
|
1259
1261
|
const config = useConfigContext();
|
|
1260
1262
|
useEffect6(() => {
|
|
@@ -1272,6 +1274,15 @@ function Title(props) {
|
|
|
1272
1274
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1273
1275
|
});
|
|
1274
1276
|
}
|
|
1277
|
+
if (props.plain)
|
|
1278
|
+
return /* @__PURE__ */ jsx12(Fragment3, {
|
|
1279
|
+
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1280
|
+
});
|
|
1281
|
+
if (props.header)
|
|
1282
|
+
return /* @__PURE__ */ jsx12(PageHeader, {
|
|
1283
|
+
title: Array.isArray(props.title) ? props.title[0] : props.title,
|
|
1284
|
+
...props.header
|
|
1285
|
+
});
|
|
1275
1286
|
if (props.children)
|
|
1276
1287
|
return cloneElement3(props.children, { title: props.title });
|
|
1277
1288
|
return null;
|
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.420",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -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.420",
|
|
32
32
|
"react-router-dom": "*",
|
|
33
33
|
"dayjs": "*"
|
|
34
34
|
},
|