fis-component 0.1.19 → 0.1.21
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/cjs/index.js +28 -12
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/src/components/Collapse/Collapse.stories.d.ts +1 -0
- package/dist/cjs/types/src/components/Pagination/Pagination.stories.d.ts +11 -0
- package/dist/cjs/types/src/components/Pagination/index.d.ts +3 -0
- package/dist/cjs/types/src/components/Table/Table/Table.stories.d.ts +2 -1
- package/dist/cjs/types/src/components/Table/Table/index.d.ts +3 -2
- package/dist/cjs/types/src/index.d.ts +2 -0
- package/dist/esm/index.js +28 -12
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/src/components/Collapse/Collapse.stories.d.ts +1 -0
- package/dist/esm/types/src/components/Pagination/Pagination.stories.d.ts +11 -0
- package/dist/esm/types/src/components/Pagination/index.d.ts +3 -0
- package/dist/esm/types/src/components/Table/Table/Table.stories.d.ts +2 -1
- package/dist/esm/types/src/components/Table/Table/index.d.ts +3 -2
- package/dist/esm/types/src/index.d.ts +2 -0
- package/dist/index.d.ts +7 -3
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import FISCollapse from ".";
|
|
|
3
3
|
declare const _default: Meta<typeof FISCollapse>;
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const Default: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import(".").CustomCollapseProps>;
|
|
6
|
+
export declare const TitleOnly: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import(".").CustomCollapseProps>;
|
|
6
7
|
export declare const MultiplePanels: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import(".").CustomCollapseProps>;
|
|
7
8
|
export declare const StartIconPosition: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import(".").CustomCollapseProps>;
|
|
8
9
|
export declare const LargeSize: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import(".").CustomCollapseProps>;
|
|
@@ -40,6 +40,17 @@ declare const meta: {
|
|
|
40
40
|
defaultValue: boolean;
|
|
41
41
|
description: string;
|
|
42
42
|
};
|
|
43
|
+
scrollToFirstRowOnChange: {
|
|
44
|
+
control: {
|
|
45
|
+
type: "boolean";
|
|
46
|
+
};
|
|
47
|
+
defaultValue: boolean;
|
|
48
|
+
description: string;
|
|
49
|
+
};
|
|
50
|
+
tableRef: {
|
|
51
|
+
control: false;
|
|
52
|
+
description: string;
|
|
53
|
+
};
|
|
43
54
|
onIconPageRecordClick: {
|
|
44
55
|
action: string;
|
|
45
56
|
description: string;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { PaginationProps as AntdPaginationProps } from "antd";
|
|
3
|
+
import type { FISTableRef } from "../Table/Table";
|
|
3
4
|
export interface PaginationProps extends AntdPaginationProps {
|
|
4
5
|
minimize?: boolean;
|
|
5
6
|
recordCounted?: boolean;
|
|
7
|
+
scrollToFirstRowOnChange?: boolean;
|
|
8
|
+
tableRef?: React.RefObject<FISTableRef>;
|
|
6
9
|
onIconPageRecordClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
7
10
|
}
|
|
8
11
|
declare const FISPagination: React.FC<PaginationProps>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { StoryObj } from "@storybook/react";
|
|
2
2
|
declare const meta: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: import("react").ForwardRefExoticComponent<import(".").TableProps & import("react").RefAttributes<
|
|
4
|
+
component: import("react").ForwardRefExoticComponent<import(".").TableProps & import("react").RefAttributes<import("rc-table").Reference>>;
|
|
5
5
|
tags: string[];
|
|
6
6
|
args: {
|
|
7
7
|
className: string;
|
|
@@ -38,3 +38,4 @@ type Story = StoryObj<typeof meta>;
|
|
|
38
38
|
export declare const Default: Story;
|
|
39
39
|
export declare const RowSelection: () => import("react/jsx-runtime").JSX.Element;
|
|
40
40
|
export declare const CompactOperations: () => import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
export declare const WithPagination: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { TableProps as AntdTableProps } from "antd";
|
|
1
|
+
import { Table, TableProps as AntdTableProps } from "antd";
|
|
2
2
|
export interface TableProps extends Omit<AntdTableProps<any>, "columns" | "dataSource"> {
|
|
3
3
|
className?: string;
|
|
4
4
|
dataSource: AntdTableProps<any>["dataSource"];
|
|
5
5
|
columns: AntdTableProps<any>["columns"];
|
|
6
6
|
verticalHeader?: "top" | "bottom" | "center";
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
export type FISTableRef = React.ElementRef<typeof Table>;
|
|
9
|
+
declare const FISTable: import("react").ForwardRefExoticComponent<TableProps & import("react").RefAttributes<import("rc-table").Reference>>;
|
|
9
10
|
export default FISTable;
|
|
@@ -33,6 +33,7 @@ export { default as FISChipButton } from "./components/ChipButton";
|
|
|
33
33
|
export { default as FISInputTime } from "./components/Input/InputTime";
|
|
34
34
|
export { default as FISInputDate } from "./components/Input/InputDate";
|
|
35
35
|
export { default as FISTable } from "./components/Table/Table";
|
|
36
|
+
export type { FISTableRef, TableProps as FISTableProps, } from "./components/Table/Table";
|
|
36
37
|
export { default as FISTableHeaderCell } from "./components/Table/HeaderCell";
|
|
37
38
|
export { default as FISTableCell } from "./components/Table/ColumnCell";
|
|
38
39
|
export { default as FISSorter } from "./components/Table/Sorter/FISSorter";
|
|
@@ -46,4 +47,5 @@ export { default as FISSelectItem } from "./components/SelectItem";
|
|
|
46
47
|
export { default as useNotification } from "./components/Notification/useNotification";
|
|
47
48
|
export { default as useToast } from "./components/Toast/useToast";
|
|
48
49
|
export { default as FISPagination } from "./components/Pagination";
|
|
50
|
+
export type { PaginationProps as FISPaginationProps, } from "./components/Pagination";
|
|
49
51
|
export { default as FISText } from "./components/Text";
|
package/dist/esm/index.js
CHANGED
|
@@ -69847,10 +69847,10 @@ const FISCollapse = ({ className, collapseSize = "sm", expandIconPosition = "sta
|
|
|
69847
69847
|
});
|
|
69848
69848
|
}
|
|
69849
69849
|
};
|
|
69850
|
-
const renderHeader = (item, isActive) => {
|
|
69850
|
+
const renderHeader = (item, isActive, hasContent) => {
|
|
69851
69851
|
const { title, description, badge, leftIcon, customHeader } = item;
|
|
69852
69852
|
const handleClick = (e) => {
|
|
69853
|
-
if (collapsible === "disabled")
|
|
69853
|
+
if (!hasContent || collapsible === "disabled")
|
|
69854
69854
|
return;
|
|
69855
69855
|
e.stopPropagation();
|
|
69856
69856
|
handleToggle(item.key);
|
|
@@ -69858,9 +69858,13 @@ const FISCollapse = ({ className, collapseSize = "sm", expandIconPosition = "sta
|
|
|
69858
69858
|
const iconComponent = (jsx(DivIconWrapperSC, { "$collapseSize": collapseSize, className: isActive ? "open" : "", onClick: collapsible === "icon" ? handleClick : undefined, style: {
|
|
69859
69859
|
cursor: collapsible === "disabled" ? "not-allowed" : "pointer",
|
|
69860
69860
|
}, children: jsx(CaretIcon, {}) }));
|
|
69861
|
-
return (jsx("div", { onClick: collapsible === "header" ? handleClick : undefined, style: {
|
|
69862
|
-
cursor:
|
|
69863
|
-
|
|
69861
|
+
return (jsx("div", { onClick: hasContent && collapsible === "header" ? handleClick : undefined, style: {
|
|
69862
|
+
cursor: hasContent
|
|
69863
|
+
? collapsible === "disabled"
|
|
69864
|
+
? "not-allowed"
|
|
69865
|
+
: "pointer"
|
|
69866
|
+
: "default",
|
|
69867
|
+
}, children: customHeader ? (jsxs(DivCustomHeaderSC, { "$collapseSize": collapseSize, children: [hasContent && expandIconPosition === "start" && iconComponent, jsx(DivCustomSC, { children: customHeader }), hasContent && expandIconPosition === "end" && iconComponent] })) : (jsxs(DivHeaderSC, { "$collapseSize": collapseSize, children: [jsxs(DivLeftSC, { "$collapseSize": collapseSize, children: [hasContent && expandIconPosition === "start" && iconComponent, leftIcon && (jsx(DivLeftIconSC, { "$collapseSize": collapseSize, children: leftIcon })), jsxs(DivContentSC, { children: [jsx(PTitleSC, { "$collapseSize": collapseSize, children: title }), description && (jsx(SpanDescriptionSC, { children: description }))] })] }), badge && (jsx(FISBadge, { size: badgeSize, label: badge, color: "neutral-light", disabled: collapsible === "disabled" })), hasContent && expandIconPosition === "end" && iconComponent] })) }));
|
|
69864
69868
|
};
|
|
69865
69869
|
return (jsx(DivContainerSC$3, { className: className, children: jsx(StyledCollapse, { ...rest, "$collapseSize": collapseSize, ghost: true, bordered: false, activeKey: activeKeys, expandIcon: () => null, expandIconPosition: expandIconPosition, collapsible: collapsible, onChange: (keys) => {
|
|
69866
69870
|
if (collapsible === "disabled")
|
|
@@ -69873,8 +69877,9 @@ const FISCollapse = ({ className, collapseSize = "sm", expandIconPosition = "sta
|
|
|
69873
69877
|
setActiveKeys(Array.isArray(keys) ? keys : [keys]);
|
|
69874
69878
|
}
|
|
69875
69879
|
}, children: items.map((item) => {
|
|
69876
|
-
const
|
|
69877
|
-
|
|
69880
|
+
const hasContent = Children.count(item.children) > 0;
|
|
69881
|
+
const isActive = hasContent && isActiveKey(item.key);
|
|
69882
|
+
return (jsxs(Fragment$1, { children: [jsx(Collapse.Panel, { header: renderHeader(item, isActive, hasContent), showArrow: false, collapsible: hasContent ? collapsible : "icon", children: jsx(DivBodySC, { "$collapseSize": collapseSize, children: item.children }) }, item.key), jsx(FISDivider, {})] }, item.key));
|
|
69878
69883
|
}) }) }));
|
|
69879
69884
|
};
|
|
69880
69885
|
|
|
@@ -75924,7 +75929,13 @@ const SpanTotalSC = styled.span `
|
|
|
75924
75929
|
`;
|
|
75925
75930
|
|
|
75926
75931
|
const LIMIT_DEFAULT = 10;
|
|
75927
|
-
const FISPagination = ({ pageSize = LIMIT_DEFAULT, current = 1, total = 0, minimize, recordCounted, onIconPageRecordClick, showTotal, ...rest }) => {
|
|
75932
|
+
const FISPagination = ({ pageSize = LIMIT_DEFAULT, current = 1, total = 0, minimize, recordCounted, scrollToFirstRowOnChange = true, tableRef, onIconPageRecordClick, showTotal, onChange, onShowSizeChange, ...rest }) => {
|
|
75933
|
+
const scrollToFirstRow = () => {
|
|
75934
|
+
if (scrollToFirstRowOnChange) {
|
|
75935
|
+
tableRef?.current?.scrollTo({ top: 0 });
|
|
75936
|
+
tableRef?.current?.nativeElement.scrollIntoView({ block: "start" });
|
|
75937
|
+
}
|
|
75938
|
+
};
|
|
75928
75939
|
const rangeRecords = useMemo$1(() => {
|
|
75929
75940
|
return [
|
|
75930
75941
|
(current - 1) * pageSize + 1,
|
|
@@ -75956,7 +75967,10 @@ const FISPagination = ({ pageSize = LIMIT_DEFAULT, current = 1, total = 0, minim
|
|
|
75956
75967
|
}
|
|
75957
75968
|
return originalElement;
|
|
75958
75969
|
};
|
|
75959
|
-
return (jsxs(DivPaginationContainer, { children: [jsx(SpanTotalSC, { children: showTotal ? showTotal(total, rangeRecords) : defaultShowTotal }), jsxs(DivPaginationContent, { children: [jsx(PaginationAntdSC, { ...mergedProps, "$minimize": Boolean(minimize), showSizeChanger: false, itemRender: itemRender
|
|
75970
|
+
return (jsxs(DivPaginationContainer, { children: [jsx(SpanTotalSC, { children: showTotal ? showTotal(total, rangeRecords) : defaultShowTotal }), jsxs(DivPaginationContent, { children: [jsx(PaginationAntdSC, { ...mergedProps, "$minimize": Boolean(minimize), showSizeChanger: false, itemRender: itemRender, onChange: (page, size) => {
|
|
75971
|
+
onChange?.(page, size);
|
|
75972
|
+
scrollToFirstRow();
|
|
75973
|
+
} }), jsx(FISSelect, { style: { width: "100px" }, size: "xs", options: [
|
|
75960
75974
|
{
|
|
75961
75975
|
groupLabel: "",
|
|
75962
75976
|
items: (rest.pageSizeOptions || [10, 20, 50, 100]).map((size) => ({
|
|
@@ -75965,9 +75979,11 @@ const FISPagination = ({ pageSize = LIMIT_DEFAULT, current = 1, total = 0, minim
|
|
|
75965
75979
|
})),
|
|
75966
75980
|
},
|
|
75967
75981
|
], value: String(pageSize), multi: false, onChange: (value) => {
|
|
75968
|
-
|
|
75969
|
-
|
|
75970
|
-
|
|
75982
|
+
const nextPageSize = Number(value);
|
|
75983
|
+
const nextCurrent = Math.min(current, Math.max(1, Math.ceil(total / nextPageSize)));
|
|
75984
|
+
onShowSizeChange?.(nextCurrent, nextPageSize);
|
|
75985
|
+
onChange?.(nextCurrent, nextPageSize);
|
|
75986
|
+
scrollToFirstRow();
|
|
75971
75987
|
} })] })] }));
|
|
75972
75988
|
};
|
|
75973
75989
|
|