@faasjs/ant-design 8.0.0-beta.27 → 8.0.0-beta.29
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 -0
- package/dist/index.d.ts +17 -4
- package/dist/index.mjs +104 -108
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
- [Blank](functions/Blank.md)
|
|
7
7
|
- [cloneUnionFaasItemElement](functions/cloneUnionFaasItemElement.md)
|
|
8
8
|
- [ConfigProvider](functions/ConfigProvider.md)
|
|
9
|
+
- [createOnErrorHandler](functions/createOnErrorHandler.md)
|
|
9
10
|
- [Description](functions/Description.md)
|
|
10
11
|
- [ErrorBoundary](functions/ErrorBoundary.md)
|
|
11
12
|
- [faas](functions/faas.md)
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
- [Link](functions/Link.md)
|
|
18
19
|
- [Loading](functions/Loading.md)
|
|
19
20
|
- [PageNotFound](functions/PageNotFound.md)
|
|
21
|
+
- [renderDisplayValue](functions/renderDisplayValue.md)
|
|
20
22
|
- [Routes](functions/Routes.md)
|
|
21
23
|
- [Table](functions/Table.md)
|
|
22
24
|
- [Tabs](functions/Tabs.md)
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ import { NotificationInstance } from "antd/es/notification/interface.js";
|
|
|
19
19
|
|
|
20
20
|
//#region ../types/src/index.d.ts
|
|
21
21
|
/**
|
|
22
|
+
* # @faasjs/types
|
|
23
|
+
*
|
|
22
24
|
* Action Type definitions for FaasJS and cross backend and frontend.
|
|
23
25
|
*
|
|
24
26
|
* [](https://github.com/faasjs/faasjs/blob/main/packages/types/LICENSE)
|
|
@@ -57,7 +59,7 @@ type FaasActionPaths = Extract<keyof FaasActions, string>;
|
|
|
57
59
|
/**
|
|
58
60
|
* Union type accepted by action helpers when callers pass either an action path or inferred data shape.
|
|
59
61
|
*/
|
|
60
|
-
type FaasActionUnionType = Record<string,
|
|
62
|
+
type FaasActionUnionType = Record<string, unknown> | string;
|
|
61
63
|
/**
|
|
62
64
|
* Infer the action path type.
|
|
63
65
|
*
|
|
@@ -66,7 +68,7 @@ type FaasActionUnionType = Record<string, any> | string;
|
|
|
66
68
|
*
|
|
67
69
|
* @template T - Candidate action path type.
|
|
68
70
|
*/
|
|
69
|
-
type FaasAction<T =
|
|
71
|
+
type FaasAction<T = unknown> = T extends FaasActionPaths ? T : string;
|
|
70
72
|
//#endregion
|
|
71
73
|
//#region src/Loading/index.d.ts
|
|
72
74
|
/**
|
|
@@ -484,6 +486,9 @@ interface AppProps {
|
|
|
484
486
|
*/
|
|
485
487
|
faasConfigProviderProps?: Omit<ConfigProviderProps, 'children'> | false;
|
|
486
488
|
}
|
|
489
|
+
declare function createOnErrorHandler(messageApi: {
|
|
490
|
+
error: (message: string) => void;
|
|
491
|
+
}): (action: string) => (res: any) => Promise<void>;
|
|
487
492
|
/**
|
|
488
493
|
* Render the root provider shell for a FaasJS Ant Design application.
|
|
489
494
|
*
|
|
@@ -653,7 +658,7 @@ declare namespace FormItem {
|
|
|
653
658
|
};
|
|
654
659
|
}
|
|
655
660
|
//#endregion
|
|
656
|
-
//#region src/Table/
|
|
661
|
+
//#region src/Table/types.d.ts
|
|
657
662
|
/**
|
|
658
663
|
* Column definition used by the FaasJS Ant Design {@link Table} component.
|
|
659
664
|
*
|
|
@@ -737,6 +742,8 @@ type TableFaasDataResponse<T = any> = {
|
|
|
737
742
|
total: number;
|
|
738
743
|
};
|
|
739
744
|
};
|
|
745
|
+
//#endregion
|
|
746
|
+
//#region src/Table/table.d.ts
|
|
740
747
|
/**
|
|
741
748
|
* Render an Ant Design table from FaasJS item metadata.
|
|
742
749
|
*
|
|
@@ -774,6 +781,12 @@ type TableFaasDataResponse<T = any> = {
|
|
|
774
781
|
*/
|
|
775
782
|
declare function Table<T extends Record<string, any>, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): _$react_jsx_runtime0.JSX.Element;
|
|
776
783
|
//#endregion
|
|
784
|
+
//#region src/data/render.d.ts
|
|
785
|
+
declare function renderDisplayValue(type: FaasItemType, value: any, options?: {
|
|
786
|
+
label: string;
|
|
787
|
+
value?: string | number;
|
|
788
|
+
}[]): JSX.Element | string | number | boolean | null;
|
|
789
|
+
//#endregion
|
|
777
790
|
//#region src/data/index.d.ts
|
|
778
791
|
/**
|
|
779
792
|
* Supported built-in field types shared by form, table, and description components.
|
|
@@ -1560,4 +1573,4 @@ declare function useApp<NewT extends useAppProps = useAppProps>(this: void): Rea
|
|
|
1560
1573
|
*/
|
|
1561
1574
|
declare function useThemeToken(): GlobalToken;
|
|
1562
1575
|
//#endregion
|
|
1563
|
-
export { App, AppContext, AppProps, BaseItemProps, BaseOption, Blank, BlankProps, ConfigContext, ConfigProvider, ConfigProviderProps, Description, DescriptionItemContentProps, DescriptionItemProps, DescriptionProps, Drawer, DrawerProps, ErrorBoundary, type ErrorBoundaryProps, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, type ExtendFormItemProps, type ExtendFormTypeProps, ExtendTableItemProps, ExtendTableTypeProps, ExtendTypes, FaasDataInjection, FaasDataWrapper, FaasDataWrapperProps, type FaasDataWrapperRef, FaasItemProps, FaasItemType, FaasItemTypeValue, FaasReactClient, type FaasReactClientOptions, Form, FormFaasProps, FormItem, FormItemProps, FormProps, FormSubmitProps, Link, LinkProps, Loading, LoadingProps, Modal, ModalProps, PageNotFound, ResolvedTheme, Routes, RoutesProps, TabProps, Table, TableFaasDataParams, TableFaasDataResponse, TableItemProps, TableProps, Tabs, TabsProps, Title, TitleProps, UnionFaasItemElement, UnionFaasItemInjection, UnionFaasItemProps, UnionFaasItemRender, UnionScene, cloneUnionFaasItemElement, faas, idToTitle, lazy, setDrawerProps, setModalProps, transferOptions, transferValue, useApp, useAppProps, useConfigContext, useDrawer, useFaas, useModal, useThemeToken, withFaasData };
|
|
1576
|
+
export { App, AppContext, AppProps, BaseItemProps, BaseOption, Blank, BlankProps, ConfigContext, ConfigProvider, ConfigProviderProps, Description, DescriptionItemContentProps, DescriptionItemProps, DescriptionProps, Drawer, DrawerProps, ErrorBoundary, type ErrorBoundaryProps, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, type ExtendFormItemProps, type ExtendFormTypeProps, type ExtendTableItemProps, type ExtendTableTypeProps, ExtendTypes, FaasDataInjection, FaasDataWrapper, FaasDataWrapperProps, type FaasDataWrapperRef, FaasItemProps, FaasItemType, FaasItemTypeValue, FaasReactClient, type FaasReactClientOptions, Form, FormFaasProps, FormItem, FormItemProps, FormProps, FormSubmitProps, Link, LinkProps, Loading, LoadingProps, Modal, ModalProps, PageNotFound, ResolvedTheme, Routes, RoutesProps, TabProps, Table, type TableFaasDataParams, type TableFaasDataResponse, type TableItemProps, type TableProps, Tabs, TabsProps, Title, TitleProps, UnionFaasItemElement, UnionFaasItemInjection, UnionFaasItemProps, UnionFaasItemRender, UnionScene, cloneUnionFaasItemElement, createOnErrorHandler, faas, idToTitle, lazy, renderDisplayValue, setDrawerProps, setModalProps, transferOptions, transferValue, useApp, useAppProps, useConfigContext, useDrawer, useFaas, useModal, useThemeToken, withFaasData };
|
package/dist/index.mjs
CHANGED
|
@@ -4,8 +4,8 @@ import { BrowserRouter, Route, Routes as Routes$1, useLocation, useNavigate } fr
|
|
|
4
4
|
import { cloneDeep, defaultsDeep, isNil, uniqBy } from "lodash-es";
|
|
5
5
|
import { Suspense, cloneElement, createContext, createElement, isValidElement, lazy, useContext, useState } from "react";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { CheckOutlined, CloseOutlined, MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
|
|
8
7
|
import dayjs from "dayjs";
|
|
8
|
+
import { CheckOutlined, CloseOutlined, MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
|
|
9
9
|
//#region src/Loading/index.tsx
|
|
10
10
|
/**
|
|
11
11
|
* Render an Ant Design loading spinner with an optional content fallback.
|
|
@@ -523,11 +523,17 @@ function useApp() {
|
|
|
523
523
|
}
|
|
524
524
|
//#endregion
|
|
525
525
|
//#region src/App/index.tsx
|
|
526
|
+
function createOnErrorHandler(messageApi) {
|
|
527
|
+
return (action) => async (res) => {
|
|
528
|
+
if ("message" in res && res.toString().includes("AbortError")) return;
|
|
529
|
+
console.error(`[FaasJS][${action}]`, res);
|
|
530
|
+
messageApi.error("message" in res ? res.message : "Unknown error");
|
|
531
|
+
};
|
|
532
|
+
}
|
|
526
533
|
function RoutesApp(props) {
|
|
527
534
|
const location = useLocation();
|
|
528
535
|
const { drawerProps, setDrawerProps, modalProps, setModalProps } = useApp();
|
|
529
536
|
useEqualEffect(() => {
|
|
530
|
-
console.debug("location", location);
|
|
531
537
|
if (drawerProps.open) setDrawerProps({ open: false });
|
|
532
538
|
if (modalProps.open) setModalProps({ open: false });
|
|
533
539
|
}, [location]);
|
|
@@ -581,11 +587,7 @@ function App(props) {
|
|
|
581
587
|
children: /* @__PURE__ */ jsx(ConfigProvider, {
|
|
582
588
|
...props.faasConfigProviderProps,
|
|
583
589
|
faasClientOptions: {
|
|
584
|
-
onError: (
|
|
585
|
-
if ("message" in res && res.toString().includes("AbortError")) return;
|
|
586
|
-
console.error(`[FaasJS][${action}]`, res);
|
|
587
|
-
messageApi.error("message" in res ? res.message : "Unknown error");
|
|
588
|
-
},
|
|
590
|
+
onError: createOnErrorHandler(messageApi),
|
|
589
591
|
...props.faasConfigProviderProps ? props.faasConfigProviderProps.faasClientOptions : {}
|
|
590
592
|
},
|
|
591
593
|
children: /* @__PURE__ */ jsx(ErrorBoundary, {
|
|
@@ -634,6 +636,44 @@ function Blank(options) {
|
|
|
634
636
|
}) : options.value;
|
|
635
637
|
}
|
|
636
638
|
//#endregion
|
|
639
|
+
//#region src/data/render.tsx
|
|
640
|
+
function renderBooleanIcon(value) {
|
|
641
|
+
return value ? /* @__PURE__ */ jsx(CheckOutlined, { style: {
|
|
642
|
+
marginTop: "4px",
|
|
643
|
+
color: "#52c41a"
|
|
644
|
+
} }) : /* @__PURE__ */ jsx(CloseOutlined, { style: {
|
|
645
|
+
marginTop: "4px",
|
|
646
|
+
color: "#ff4d4f"
|
|
647
|
+
} });
|
|
648
|
+
}
|
|
649
|
+
function formatDateValue(value, type) {
|
|
650
|
+
return value.format(type === "date" ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm:ss");
|
|
651
|
+
}
|
|
652
|
+
function resolveOptionLabel(value, options) {
|
|
653
|
+
if (!options?.length) return value;
|
|
654
|
+
for (const option of options) if (option.value === value) return option.label ?? value;
|
|
655
|
+
return value;
|
|
656
|
+
}
|
|
657
|
+
function renderDisplayValue(type, value, options) {
|
|
658
|
+
if (value === null || value === void 0 || Array.isArray(value) && value.length === 0) return /* @__PURE__ */ jsx(Blank, {});
|
|
659
|
+
if (options?.length) {
|
|
660
|
+
if (type.endsWith("[]")) return /* @__PURE__ */ jsx(Fragment, { children: value.map((v) => resolveOptionLabel(v, options)).join(", ") });
|
|
661
|
+
if ([
|
|
662
|
+
"string",
|
|
663
|
+
"number",
|
|
664
|
+
"boolean"
|
|
665
|
+
].includes(type)) return /* @__PURE__ */ jsx(Fragment, { children: resolveOptionLabel(value, options) });
|
|
666
|
+
}
|
|
667
|
+
switch (type) {
|
|
668
|
+
case "string[]":
|
|
669
|
+
case "number[]": return /* @__PURE__ */ jsx(Fragment, { children: value.join(", ") });
|
|
670
|
+
case "boolean": return renderBooleanIcon(value);
|
|
671
|
+
case "time": return /* @__PURE__ */ jsx(Fragment, { children: formatDateValue(value, "time") });
|
|
672
|
+
case "date": return /* @__PURE__ */ jsx(Fragment, { children: formatDateValue(value, "date") });
|
|
673
|
+
default: return value;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
//#endregion
|
|
637
677
|
//#region src/data/index.ts
|
|
638
678
|
/**
|
|
639
679
|
* Convert a snake_case, kebab-case, or spaced identifier into a title-style label.
|
|
@@ -750,78 +790,50 @@ function cloneUnionFaasItemElement(element, props) {
|
|
|
750
790
|
//#endregion
|
|
751
791
|
//#region src/Description/index.tsx
|
|
752
792
|
function DescriptionItemContent(props) {
|
|
753
|
-
const
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
propsCopy.value = transferValue(propsCopy.item.type, propsCopy.value);
|
|
760
|
-
if (propsCopy.item.options && propsCopy.value !== null) {
|
|
761
|
-
if (propsCopy.item.type.endsWith("[]")) propsCopy.value = propsCopy.value.map((v) => propsCopy.item.options.find((option) => option.value === v)?.label || v);
|
|
762
|
-
else if ([
|
|
763
|
-
"string",
|
|
764
|
-
"number",
|
|
765
|
-
"boolean"
|
|
766
|
-
].includes(propsCopy.item.type)) propsCopy.value = props.item.options.find((option) => option.value === props.value)?.label || props.value;
|
|
767
|
-
}
|
|
768
|
-
setComputedProps(propsCopy);
|
|
769
|
-
}, [props]);
|
|
770
|
-
if (!computedProps) return null;
|
|
771
|
-
const itemType = computedProps.item.type ?? "string";
|
|
772
|
-
if (computedProps.item.descriptionChildren === null || computedProps.item.children === null || computedProps.item.descriptionRender === null || computedProps.item.render === null) return null;
|
|
773
|
-
const children = computedProps.item.descriptionChildren || computedProps.item.children;
|
|
793
|
+
const { item, value: rawValue, values, extendTypes } = props;
|
|
794
|
+
const type = item.type ?? "string";
|
|
795
|
+
const options = item.options?.length ? transferOptions(item.options) : void 0;
|
|
796
|
+
const value = transferValue(type, rawValue);
|
|
797
|
+
if (item.descriptionChildren === null || item.children === null || item.descriptionRender === null || item.render === null) return null;
|
|
798
|
+
const children = item.descriptionChildren || item.children;
|
|
774
799
|
if (children) return cloneUnionFaasItemElement(children, {
|
|
775
800
|
scene: "description",
|
|
776
|
-
value
|
|
777
|
-
values
|
|
801
|
+
value,
|
|
802
|
+
values,
|
|
778
803
|
index: 0
|
|
779
804
|
});
|
|
780
|
-
const render =
|
|
781
|
-
if (render) return /* @__PURE__ */ jsx(Fragment, { children: render(
|
|
782
|
-
if (
|
|
783
|
-
const extendType =
|
|
805
|
+
const render = item.descriptionRender || item.render;
|
|
806
|
+
if (render) return /* @__PURE__ */ jsx(Fragment, { children: render(value, values, 0, "description") });
|
|
807
|
+
if (extendTypes?.[type]) {
|
|
808
|
+
const extendType = extendTypes[type];
|
|
784
809
|
if (extendType.children) return cloneUnionFaasItemElement(extendType.children, {
|
|
785
810
|
scene: "description",
|
|
786
|
-
value
|
|
787
|
-
values
|
|
811
|
+
value,
|
|
812
|
+
values
|
|
788
813
|
});
|
|
789
|
-
if (extendType.render) return /* @__PURE__ */ jsx(Fragment, { children: extendType.render(
|
|
790
|
-
throw Error(`${
|
|
814
|
+
if (extendType.render) return /* @__PURE__ */ jsx(Fragment, { children: extendType.render(value, values, 0, "description") });
|
|
815
|
+
throw Error(`${type} requires children or render`);
|
|
791
816
|
}
|
|
792
|
-
if (
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
if (!computedProps.value) return /* @__PURE__ */ jsx(Blank, {});
|
|
808
|
-
return /* @__PURE__ */ jsx(Description, {
|
|
809
|
-
items: computedProps.item.object || [],
|
|
810
|
-
dataSource: computedProps.value,
|
|
817
|
+
if (type === "object") {
|
|
818
|
+
if (!value) return /* @__PURE__ */ jsx(Blank, {});
|
|
819
|
+
return /* @__PURE__ */ jsx(Description, {
|
|
820
|
+
items: item.object || [],
|
|
821
|
+
dataSource: value,
|
|
822
|
+
column: 1
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
if (type === "object[]") {
|
|
826
|
+
if (!value?.length) return /* @__PURE__ */ jsx(Blank, {});
|
|
827
|
+
return /* @__PURE__ */ jsx(Space, {
|
|
828
|
+
direction: "vertical",
|
|
829
|
+
children: value.map((v, index) => /* @__PURE__ */ jsx(Description, {
|
|
830
|
+
items: item.object || [],
|
|
831
|
+
dataSource: v,
|
|
811
832
|
column: 1
|
|
812
|
-
})
|
|
813
|
-
|
|
814
|
-
if (!computedProps.value?.length) return /* @__PURE__ */ jsx(Blank, {});
|
|
815
|
-
return /* @__PURE__ */ jsx(Space, {
|
|
816
|
-
direction: "vertical",
|
|
817
|
-
children: computedProps.value.map((value, index) => /* @__PURE__ */ jsx(Description, {
|
|
818
|
-
items: computedProps.item.object || [],
|
|
819
|
-
dataSource: value,
|
|
820
|
-
column: 1
|
|
821
|
-
}, index))
|
|
822
|
-
});
|
|
823
|
-
default: return computedProps.value || null;
|
|
833
|
+
}, index))
|
|
834
|
+
});
|
|
824
835
|
}
|
|
836
|
+
return /* @__PURE__ */ jsx(Fragment, { children: renderDisplayValue(type, value, options) });
|
|
825
837
|
}
|
|
826
838
|
DescriptionItemContent.displayName = "DescriptionItemContent";
|
|
827
839
|
/**
|
|
@@ -1337,7 +1349,6 @@ function Form(props) {
|
|
|
1337
1349
|
setAntdProps(propsCopy);
|
|
1338
1350
|
}, [props]);
|
|
1339
1351
|
const onValuesChange = useEqualCallback((changedValues, allValues) => {
|
|
1340
|
-
console.debug("Form:onValuesChange", changedValues, allValues);
|
|
1341
1352
|
if (props.onValuesChange) props.onValuesChange(changedValues, allValues);
|
|
1342
1353
|
if (!items.length) return;
|
|
1343
1354
|
for (const key in changedValues) {
|
|
@@ -1351,7 +1362,6 @@ function Form(props) {
|
|
|
1351
1362
|
]);
|
|
1352
1363
|
useEqualEffect(() => {
|
|
1353
1364
|
if (!initialValues) return;
|
|
1354
|
-
console.debug("Form:initialValues", initialValues);
|
|
1355
1365
|
form.setFieldsValue(initialValues);
|
|
1356
1366
|
setInitialValues(null);
|
|
1357
1367
|
}, [
|
|
@@ -1547,22 +1557,10 @@ function Routes(props) {
|
|
|
1547
1557
|
}, "*")] });
|
|
1548
1558
|
}
|
|
1549
1559
|
//#endregion
|
|
1550
|
-
//#region src/Table/
|
|
1560
|
+
//#region src/Table/utils.tsx
|
|
1551
1561
|
function processValue(item, value) {
|
|
1552
1562
|
const itemType = item.type ?? "string";
|
|
1553
|
-
|
|
1554
|
-
if (transferred === null || Array.isArray(transferred) && transferred.length === 0) return /* @__PURE__ */ jsx(Blank, {});
|
|
1555
|
-
if (item.options) {
|
|
1556
|
-
if (itemType.endsWith("[]")) return transferred.map((v) => item.options.find((option) => option.value === v)?.label || v).join(", ");
|
|
1557
|
-
if ([
|
|
1558
|
-
"string",
|
|
1559
|
-
"number",
|
|
1560
|
-
"boolean"
|
|
1561
|
-
].includes(itemType)) return item.options.find((option) => option.value === transferred)?.label || transferred;
|
|
1562
|
-
}
|
|
1563
|
-
if (itemType.endsWith("[]")) return transferred.join(", ");
|
|
1564
|
-
if (["date", "time"].includes(itemType)) return transferred.format(itemType === "date" ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm:ss");
|
|
1565
|
-
return transferred;
|
|
1563
|
+
return renderDisplayValue(itemType, transferValue(itemType, value), item.options);
|
|
1566
1564
|
}
|
|
1567
1565
|
function toTableFilters(options, includeBlank = false) {
|
|
1568
1566
|
const filters = options.map((option) => ({
|
|
@@ -1623,6 +1621,23 @@ function createTextSearchFilterDropdown(item, search, transformValue) {
|
|
|
1623
1621
|
}
|
|
1624
1622
|
});
|
|
1625
1623
|
}
|
|
1624
|
+
function applyFaasDataColumnOptions(columns, data) {
|
|
1625
|
+
if (!data?.options) return columns;
|
|
1626
|
+
let updated = false;
|
|
1627
|
+
const nextColumns = columns.map((column) => {
|
|
1628
|
+
if (!data.options?.[column.id]) return column;
|
|
1629
|
+
updated = true;
|
|
1630
|
+
const nextColumn = { ...column };
|
|
1631
|
+
nextColumn.options = transferOptions(data.options[column.id]);
|
|
1632
|
+
nextColumn.filters = toTableFilters(nextColumn.options, true);
|
|
1633
|
+
nextColumn.render = (value) => processValue(nextColumn, value);
|
|
1634
|
+
if (nextColumn.filterDropdown) delete nextColumn.filterDropdown;
|
|
1635
|
+
return nextColumn;
|
|
1636
|
+
});
|
|
1637
|
+
return updated ? nextColumns : columns;
|
|
1638
|
+
}
|
|
1639
|
+
//#endregion
|
|
1640
|
+
//#region src/Table/column-builder.tsx
|
|
1626
1641
|
function createTableColumns(items, options) {
|
|
1627
1642
|
const columns = cloneDeep(items).filter((item) => !(item.tableChildren === null || item.children === null || item.tableRender === null || item.render === null));
|
|
1628
1643
|
for (const item of columns) {
|
|
@@ -1717,13 +1732,7 @@ function createTableColumns(items, options) {
|
|
|
1717
1732
|
}
|
|
1718
1733
|
break;
|
|
1719
1734
|
case "boolean":
|
|
1720
|
-
if (!item.render) item.render = (value) =>
|
|
1721
|
-
marginTop: "4px",
|
|
1722
|
-
color: "#52c41a"
|
|
1723
|
-
} }) : /* @__PURE__ */ jsx(CloseOutlined, { style: {
|
|
1724
|
-
marginTop: "4px",
|
|
1725
|
-
color: "#ff4d4f"
|
|
1726
|
-
} });
|
|
1735
|
+
if (!item.render) item.render = (value) => renderDisplayValue("boolean", value);
|
|
1727
1736
|
if (item.filterDropdown !== false) {
|
|
1728
1737
|
if (typeof item.filterDropdown === "undefined") item.filterDropdown = ({ setSelectedKeys, selectedKeys, confirm: confirmFilter }) => /* @__PURE__ */ jsxs(Radio.Group, {
|
|
1729
1738
|
style: { padding: 8 },
|
|
@@ -1827,21 +1836,8 @@ function createTableColumns(items, options) {
|
|
|
1827
1836
|
}
|
|
1828
1837
|
return columns;
|
|
1829
1838
|
}
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
let updated = false;
|
|
1833
|
-
const nextColumns = columns.map((column) => {
|
|
1834
|
-
if (!data.options?.[column.id]) return column;
|
|
1835
|
-
updated = true;
|
|
1836
|
-
const nextColumn = { ...column };
|
|
1837
|
-
nextColumn.options = transferOptions(data.options[column.id]);
|
|
1838
|
-
nextColumn.filters = toTableFilters(nextColumn.options, true);
|
|
1839
|
-
nextColumn.render = (value) => processValue(nextColumn, value);
|
|
1840
|
-
if (nextColumn.filterDropdown) delete nextColumn.filterDropdown;
|
|
1841
|
-
return nextColumn;
|
|
1842
|
-
});
|
|
1843
|
-
return updated ? nextColumns : columns;
|
|
1844
|
-
}
|
|
1839
|
+
//#endregion
|
|
1840
|
+
//#region src/Table/table.tsx
|
|
1845
1841
|
/**
|
|
1846
1842
|
* Render an Ant Design table from FaasJS item metadata.
|
|
1847
1843
|
*
|
|
@@ -2055,4 +2051,4 @@ function useThemeToken() {
|
|
|
2055
2051
|
return theme.useToken().token;
|
|
2056
2052
|
}
|
|
2057
2053
|
//#endregion
|
|
2058
|
-
export { App, AppContext, Blank, ConfigContext, ConfigProvider, Description, Drawer, ErrorBoundary, FaasDataWrapper, FaasReactClient, Form, FormItem, Link, Loading, Modal, PageNotFound, Routes, Table, Tabs, Title, cloneUnionFaasItemElement, faas, idToTitle, lazy, transferOptions, transferValue, useApp, useConfigContext, useDrawer, useFaas, useModal, useThemeToken, withFaasData };
|
|
2054
|
+
export { App, AppContext, Blank, ConfigContext, ConfigProvider, Description, Drawer, ErrorBoundary, FaasDataWrapper, FaasReactClient, Form, FormItem, Link, Loading, Modal, PageNotFound, Routes, Table, Tabs, Title, cloneUnionFaasItemElement, createOnErrorHandler, faas, idToTitle, lazy, renderDisplayValue, transferOptions, transferValue, useApp, useConfigContext, useDrawer, useFaas, useModal, useThemeToken, withFaasData };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/ant-design",
|
|
3
|
-
"version": "8.0.0-beta.
|
|
3
|
+
"version": "8.0.0-beta.29",
|
|
4
4
|
"homepage": "https://faasjs.com/doc/ant-design",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/faasjs/faasjs/issues"
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@ant-design/icons": "*",
|
|
30
|
-
"@faasjs/react": ">=8.0.0-beta.
|
|
30
|
+
"@faasjs/react": ">=8.0.0-beta.29",
|
|
31
31
|
"@types/lodash-es": "*",
|
|
32
32
|
"@types/react": "^19.0.0",
|
|
33
33
|
"@types/react-dom": "^19.0.0",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@ant-design/icons": "*",
|
|
42
|
-
"@faasjs/react": ">=8.0.0-beta.
|
|
42
|
+
"@faasjs/react": ">=8.0.0-beta.29",
|
|
43
43
|
"antd": "^6.0.0",
|
|
44
44
|
"lodash-es": "*",
|
|
45
45
|
"react": "^19.0.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"react-router-dom": "*"
|
|
48
48
|
},
|
|
49
49
|
"engines": {
|
|
50
|
-
"node": ">=
|
|
50
|
+
"node": ">=26.0.0",
|
|
51
51
|
"npm": ">=11.0.0"
|
|
52
52
|
}
|
|
53
53
|
}
|