@faasjs/ant-design 6.5.0 → 6.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/index.cjs +11 -11
- package/dist/index.d.ts +18 -3
- package/dist/index.mjs +11 -11
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -49,6 +49,7 @@ type FaasItemProps = {
|
|
|
49
49
|
- [FaasDataWrapper](functions/FaasDataWrapper.md)
|
|
50
50
|
- [Form](functions/Form.md)
|
|
51
51
|
- [FormItem](functions/FormItem.md)
|
|
52
|
+
- [idToTitle](functions/idToTitle.md)
|
|
52
53
|
- [Link](functions/Link.md)
|
|
53
54
|
- [Loading](functions/Loading.md)
|
|
54
55
|
- [Modal](functions/Modal.md)
|
|
@@ -59,7 +60,6 @@ type FaasItemProps = {
|
|
|
59
60
|
- [Title](functions/Title.md)
|
|
60
61
|
- [transferOptions](functions/transferOptions.md)
|
|
61
62
|
- [transferValue](functions/transferValue.md)
|
|
62
|
-
- [upperFirst](functions/upperFirst.md)
|
|
63
63
|
- [useApp](functions/useApp.md)
|
|
64
64
|
- [useConfigContext](functions/useConfigContext.md)
|
|
65
65
|
- [useDrawer](functions/useDrawer.md)
|
|
@@ -104,6 +104,7 @@ type FaasItemProps = {
|
|
|
104
104
|
- [ExtendTableTypeProps](type-aliases/ExtendTableTypeProps.md)
|
|
105
105
|
- [ExtendTypes](type-aliases/ExtendTypes.md)
|
|
106
106
|
- [FaasDataInjection](type-aliases/FaasDataInjection.md)
|
|
107
|
+
- [FaasDataWrapperRef](type-aliases/FaasDataWrapperRef.md)
|
|
107
108
|
- [FaasItemType](type-aliases/FaasItemType.md)
|
|
108
109
|
- [FaasItemTypeValue](type-aliases/FaasItemTypeValue.md)
|
|
109
110
|
- [FormSubmitProps](type-aliases/FormSubmitProps.md)
|
package/dist/index.cjs
CHANGED
|
@@ -241,14 +241,15 @@ function Blank(options) {
|
|
|
241
241
|
return !options || options.value === void 0 || options.value === null || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { disabled: true, children: options?.text || theme2.Blank.text }) : options.value;
|
|
242
242
|
}
|
|
243
243
|
Blank.whyDidYouRender = true;
|
|
244
|
-
function
|
|
245
|
-
|
|
244
|
+
function idToTitle(id) {
|
|
245
|
+
const splitted = id.split(/(\s|_|-)/).filter((word) => !/(\s|_|-)/.test(word)).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
246
|
+
return splitted.charAt(0).toUpperCase() + splitted.slice(1);
|
|
246
247
|
}
|
|
247
248
|
function transferOptions(options) {
|
|
248
249
|
if (!options) return [];
|
|
249
250
|
return options.map(
|
|
250
251
|
(item) => typeof item === "object" ? item : {
|
|
251
|
-
label:
|
|
252
|
+
label: idToTitle(item.toString()),
|
|
252
253
|
value: item
|
|
253
254
|
}
|
|
254
255
|
);
|
|
@@ -324,8 +325,7 @@ function DescriptionItemContent(props) {
|
|
|
324
325
|
const [computedProps, setComputedProps] = react$1.useState();
|
|
325
326
|
react$1.useEffect(() => {
|
|
326
327
|
const propsCopy = { ...props };
|
|
327
|
-
|
|
328
|
-
propsCopy.item.title = upperFirst(propsCopy.item.id);
|
|
328
|
+
propsCopy.item.title = propsCopy.item.title ?? idToTitle(propsCopy.item.id);
|
|
329
329
|
if (!propsCopy.item.type) propsCopy.item.type = "string";
|
|
330
330
|
if (propsCopy.item.options?.length) {
|
|
331
331
|
propsCopy.item.options = transferOptions(propsCopy.item.options);
|
|
@@ -468,7 +468,7 @@ function Description({
|
|
|
468
468
|
).map((item) => ({
|
|
469
469
|
...item,
|
|
470
470
|
key: item.id,
|
|
471
|
-
label: item.title
|
|
471
|
+
label: item.title ?? idToTitle(item.id),
|
|
472
472
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
473
473
|
DescriptionItemContent,
|
|
474
474
|
{
|
|
@@ -488,7 +488,7 @@ function isOptionsProps(item) {
|
|
|
488
488
|
return item && Array.isArray(item.options);
|
|
489
489
|
}
|
|
490
490
|
function processProps(propsCopy, config) {
|
|
491
|
-
|
|
491
|
+
propsCopy.title = propsCopy.title ?? idToTitle(propsCopy.id);
|
|
492
492
|
if (!propsCopy.label && propsCopy.label !== false)
|
|
493
493
|
propsCopy.label = propsCopy.title;
|
|
494
494
|
if (!propsCopy.name) propsCopy.name = propsCopy.id;
|
|
@@ -1033,7 +1033,7 @@ function Table(props) {
|
|
|
1033
1033
|
for (const item of items) {
|
|
1034
1034
|
if (!item.key) item.key = item.id;
|
|
1035
1035
|
if (!item.dataIndex) item.dataIndex = item.id;
|
|
1036
|
-
|
|
1036
|
+
item.title = item.title ?? idToTitle(item.id);
|
|
1037
1037
|
if (!item.type) item.type = "string";
|
|
1038
1038
|
if (item.options?.length) {
|
|
1039
1039
|
item.options = transferOptions(item.options);
|
|
@@ -1535,8 +1535,8 @@ function Tabs(props) {
|
|
|
1535
1535
|
...props,
|
|
1536
1536
|
items: props.items.filter(Boolean).map((i) => ({
|
|
1537
1537
|
...i,
|
|
1538
|
-
key: i.key
|
|
1539
|
-
label: i.label
|
|
1538
|
+
key: i.key ?? i.id,
|
|
1539
|
+
label: i.label ?? i.title ?? i.id
|
|
1540
1540
|
}))
|
|
1541
1541
|
}
|
|
1542
1542
|
);
|
|
@@ -1596,9 +1596,9 @@ exports.Table = Table;
|
|
|
1596
1596
|
exports.Tabs = Tabs;
|
|
1597
1597
|
exports.Title = Title;
|
|
1598
1598
|
exports.cloneUnionFaasItemElement = cloneUnionFaasItemElement;
|
|
1599
|
+
exports.idToTitle = idToTitle;
|
|
1599
1600
|
exports.transferOptions = transferOptions;
|
|
1600
1601
|
exports.transferValue = transferValue;
|
|
1601
|
-
exports.upperFirst = upperFirst;
|
|
1602
1602
|
exports.useApp = useApp;
|
|
1603
1603
|
exports.useConfigContext = useConfigContext;
|
|
1604
1604
|
exports.useDrawer = useDrawer;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FaasReactClientOptions, ErrorBoundaryProps, FaasDataWrapperProps as FaasDataWrapperProps$1, FaasDataInjection as FaasDataInjection$1 } from '@faasjs/react';
|
|
2
|
-
export { ErrorBoundaryProps, faas, useFaas } from '@faasjs/react';
|
|
2
|
+
export { ErrorBoundaryProps, FaasDataWrapperRef, faas, useFaas } from '@faasjs/react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { StyleProviderProps } from '@ant-design/cssinjs';
|
|
5
5
|
import { DrawerProps as DrawerProps$1, ModalProps as ModalProps$1, ConfigProviderProps as ConfigProviderProps$1, DescriptionsProps, FormItemProps as FormItemProps$1, InputProps, SelectProps, RadioProps, InputNumberProps, SwitchProps, DatePickerProps, FormInstance, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, FormProps as FormProps$1, ButtonProps, TabsProps as TabsProps$1, GlobalToken } from 'antd';
|
|
@@ -266,6 +266,7 @@ interface FaasDataWrapperProps<T = any> extends FaasDataWrapperProps$1<T> {
|
|
|
266
266
|
loadingProps?: LoadingProps;
|
|
267
267
|
loading?: JSX.Element;
|
|
268
268
|
}
|
|
269
|
+
|
|
269
270
|
/**
|
|
270
271
|
* FaasDataWrapper component with Loading
|
|
271
272
|
*
|
|
@@ -522,7 +523,21 @@ interface FaasItemProps extends BaseItemProps {
|
|
|
522
523
|
*/
|
|
523
524
|
type?: FaasItemType;
|
|
524
525
|
}
|
|
525
|
-
|
|
526
|
+
/**
|
|
527
|
+
* Converts an identifier string to a title case string.
|
|
528
|
+
*
|
|
529
|
+
* This function takes an identifier string with words separated by underscores,
|
|
530
|
+
* capitalizes the first letter of each word, and joins them together without spaces.
|
|
531
|
+
*
|
|
532
|
+
* @param id - The identifier string to convert.
|
|
533
|
+
* @returns The converted title case string.
|
|
534
|
+
*
|
|
535
|
+
* @example
|
|
536
|
+
* ```typescript
|
|
537
|
+
* idToTitle('example_id'); // returns 'ExampleId'
|
|
538
|
+
* ```
|
|
539
|
+
*/
|
|
540
|
+
declare function idToTitle(id: string): string;
|
|
526
541
|
/**
|
|
527
542
|
* convert string[] or number[] to { label, value }[]
|
|
528
543
|
*/
|
|
@@ -914,4 +929,4 @@ declare namespace Title {
|
|
|
914
929
|
*/
|
|
915
930
|
declare function useThemeToken(): GlobalToken;
|
|
916
931
|
|
|
917
|
-
export { App, type AppProps, type BaseItemProps, type BaseOption, Blank, type BlankProps, ConfigContext, ConfigProvider, type ConfigProviderProps, Description, type DescriptionItemContentProps, type DescriptionItemProps, type DescriptionProps, Drawer, type DrawerProps, ErrorBoundary, type ExtendDescriptionItemProps, type ExtendDescriptionTypeProps, type ExtendFormItemProps, type ExtendFormTypeProps, type ExtendTableItemProps, type ExtendTableTypeProps, type ExtendTypes, type FaasDataInjection, FaasDataWrapper, type FaasDataWrapperProps, type FaasItemProps, type FaasItemType, type FaasItemTypeValue, Form, FormItem, type FormItemProps, type FormProps, type FormSubmitProps, Link, type LinkProps, Loading, type LoadingProps, Modal, type ModalProps, PageNotFound, Routes, type RoutesProps, type TabProps, Table, type TableItemProps, type TableProps, Tabs, type TabsProps, Title, type TitleProps, type UnionFaasItemElement, type UnionFaasItemInjection, type UnionFaasItemProps, type UnionFaasItemRender, type UnionScene, cloneUnionFaasItemElement, type setDrawerProps, type setModalProps, transferOptions, transferValue,
|
|
932
|
+
export { App, type AppProps, type BaseItemProps, type BaseOption, Blank, type BlankProps, ConfigContext, ConfigProvider, type ConfigProviderProps, Description, type DescriptionItemContentProps, type DescriptionItemProps, type DescriptionProps, Drawer, type DrawerProps, ErrorBoundary, type ExtendDescriptionItemProps, type ExtendDescriptionTypeProps, type ExtendFormItemProps, type ExtendFormTypeProps, type ExtendTableItemProps, type ExtendTableTypeProps, type ExtendTypes, type FaasDataInjection, FaasDataWrapper, type FaasDataWrapperProps, type FaasItemProps, type FaasItemType, type FaasItemTypeValue, Form, FormItem, type FormItemProps, type FormProps, type FormSubmitProps, Link, type LinkProps, Loading, type LoadingProps, Modal, type ModalProps, PageNotFound, Routes, type RoutesProps, type TabProps, Table, type TableItemProps, type TableProps, Tabs, type TabsProps, Title, type TitleProps, type UnionFaasItemElement, type UnionFaasItemInjection, type UnionFaasItemProps, type UnionFaasItemRender, type UnionScene, cloneUnionFaasItemElement, idToTitle, type setDrawerProps, type setModalProps, transferOptions, transferValue, useApp, type useAppProps, useConfigContext, useDrawer, useModal, useThemeToken, withFaasData };
|
package/dist/index.mjs
CHANGED
|
@@ -237,14 +237,15 @@ function Blank(options) {
|
|
|
237
237
|
return !options || options.value === void 0 || options.value === null || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ jsx(Typography.Text, { disabled: true, children: options?.text || theme2.Blank.text }) : options.value;
|
|
238
238
|
}
|
|
239
239
|
Blank.whyDidYouRender = true;
|
|
240
|
-
function
|
|
241
|
-
|
|
240
|
+
function idToTitle(id) {
|
|
241
|
+
const splitted = id.split(/(\s|_|-)/).filter((word) => !/(\s|_|-)/.test(word)).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
242
|
+
return splitted.charAt(0).toUpperCase() + splitted.slice(1);
|
|
242
243
|
}
|
|
243
244
|
function transferOptions(options) {
|
|
244
245
|
if (!options) return [];
|
|
245
246
|
return options.map(
|
|
246
247
|
(item) => typeof item === "object" ? item : {
|
|
247
|
-
label:
|
|
248
|
+
label: idToTitle(item.toString()),
|
|
248
249
|
value: item
|
|
249
250
|
}
|
|
250
251
|
);
|
|
@@ -320,8 +321,7 @@ function DescriptionItemContent(props) {
|
|
|
320
321
|
const [computedProps, setComputedProps] = useState();
|
|
321
322
|
useEffect(() => {
|
|
322
323
|
const propsCopy = { ...props };
|
|
323
|
-
|
|
324
|
-
propsCopy.item.title = upperFirst(propsCopy.item.id);
|
|
324
|
+
propsCopy.item.title = propsCopy.item.title ?? idToTitle(propsCopy.item.id);
|
|
325
325
|
if (!propsCopy.item.type) propsCopy.item.type = "string";
|
|
326
326
|
if (propsCopy.item.options?.length) {
|
|
327
327
|
propsCopy.item.options = transferOptions(propsCopy.item.options);
|
|
@@ -464,7 +464,7 @@ function Description({
|
|
|
464
464
|
).map((item) => ({
|
|
465
465
|
...item,
|
|
466
466
|
key: item.id,
|
|
467
|
-
label: item.title
|
|
467
|
+
label: item.title ?? idToTitle(item.id),
|
|
468
468
|
children: /* @__PURE__ */ jsx(
|
|
469
469
|
DescriptionItemContent,
|
|
470
470
|
{
|
|
@@ -484,7 +484,7 @@ function isOptionsProps(item) {
|
|
|
484
484
|
return item && Array.isArray(item.options);
|
|
485
485
|
}
|
|
486
486
|
function processProps(propsCopy, config) {
|
|
487
|
-
|
|
487
|
+
propsCopy.title = propsCopy.title ?? idToTitle(propsCopy.id);
|
|
488
488
|
if (!propsCopy.label && propsCopy.label !== false)
|
|
489
489
|
propsCopy.label = propsCopy.title;
|
|
490
490
|
if (!propsCopy.name) propsCopy.name = propsCopy.id;
|
|
@@ -1029,7 +1029,7 @@ function Table(props) {
|
|
|
1029
1029
|
for (const item of items) {
|
|
1030
1030
|
if (!item.key) item.key = item.id;
|
|
1031
1031
|
if (!item.dataIndex) item.dataIndex = item.id;
|
|
1032
|
-
|
|
1032
|
+
item.title = item.title ?? idToTitle(item.id);
|
|
1033
1033
|
if (!item.type) item.type = "string";
|
|
1034
1034
|
if (item.options?.length) {
|
|
1035
1035
|
item.options = transferOptions(item.options);
|
|
@@ -1531,8 +1531,8 @@ function Tabs(props) {
|
|
|
1531
1531
|
...props,
|
|
1532
1532
|
items: props.items.filter(Boolean).map((i) => ({
|
|
1533
1533
|
...i,
|
|
1534
|
-
key: i.key
|
|
1535
|
-
label: i.label
|
|
1534
|
+
key: i.key ?? i.id,
|
|
1535
|
+
label: i.label ?? i.title ?? i.id
|
|
1536
1536
|
}))
|
|
1537
1537
|
}
|
|
1538
1538
|
);
|
|
@@ -1561,4 +1561,4 @@ function useThemeToken() {
|
|
|
1561
1561
|
return config.token;
|
|
1562
1562
|
}
|
|
1563
1563
|
|
|
1564
|
-
export { App, Blank, ConfigContext, ConfigProvider, Description, Drawer, ErrorBoundary, FaasDataWrapper, Form, FormItem, Link, Loading, Modal, PageNotFound, Routes, Table, Tabs, Title, cloneUnionFaasItemElement, transferOptions, transferValue,
|
|
1564
|
+
export { App, Blank, ConfigContext, ConfigProvider, Description, Drawer, ErrorBoundary, FaasDataWrapper, Form, FormItem, Link, Loading, Modal, PageNotFound, Routes, Table, Tabs, Title, cloneUnionFaasItemElement, idToTitle, transferOptions, transferValue, useApp, useConfigContext, useDrawer, useModal, useThemeToken, withFaasData };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/ant-design",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.7.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dist"
|
|
31
31
|
],
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@faasjs/react": "6.
|
|
33
|
+
"@faasjs/react": "6.7.0",
|
|
34
34
|
"antd": "*",
|
|
35
35
|
"@ant-design/icons": "*",
|
|
36
36
|
"lodash-es": "*",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/lodash-es": "*",
|
|
43
|
-
"@faasjs/react": "6.
|
|
43
|
+
"@faasjs/react": "6.7.0",
|
|
44
44
|
"antd": "*",
|
|
45
45
|
"@ant-design/icons": "*",
|
|
46
46
|
"lodash-es": "*",
|