@mezzanine-ui/react 0.14.10 → 0.15.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/Accordion/Accordion.js +2 -1
- package/Accordion/AccordionDetails.js +1 -1
- package/Accordion/AccordionSummary.js +4 -2
- package/Accordion/index.d.ts +1 -1
- package/Alert/index.d.ts +2 -2
- package/AppBar/AppBar.js +1 -3
- package/AppBar/index.d.ts +4 -4
- package/Badge/index.d.ts +1 -1
- package/Button/Button.js +1 -1
- package/Button/ButtonGroup.js +1 -1
- package/Button/IconButton.js +1 -1
- package/Button/index.d.ts +2 -2
- package/Calendar/Calendar.js +9 -1
- package/Calendar/CalendarContext.js +3 -3
- package/Calendar/CalendarDays.js +12 -5
- package/Calendar/CalendarMonths.js +13 -3
- package/Calendar/CalendarWeeks.js +16 -8
- package/Calendar/CalendarYears.js +15 -4
- package/Calendar/index.d.ts +7 -7
- package/Calendar/useCalendarControlModifiers.js +4 -13
- package/Calendar/useCalendarControls.js +1 -1
- package/Calendar/useCalendarModeStack.js +1 -1
- package/Card/Card.d.ts +1 -1
- package/Card/Card.js +5 -5
- package/Card/CardActions.js +1 -1
- package/Card/index.d.ts +2 -2
- package/Checkbox/CheckAll.js +1 -1
- package/Checkbox/Checkbox.js +4 -4
- package/Checkbox/CheckboxGroup.js +3 -1
- package/Checkbox/index.d.ts +3 -3
- package/ConfirmActions/ConfirmActions.js +1 -1
- package/ConfirmActions/index.d.ts +1 -1
- package/DatePicker/DatePicker.js +3 -7
- package/DatePicker/DatePickerCalendar.js +6 -2
- package/DatePicker/index.d.ts +1 -1
- package/DateRangePicker/DateRangePicker.js +7 -10
- package/DateRangePicker/DateRangePickerCalendar.js +9 -3
- package/DateRangePicker/index.d.ts +2 -2
- package/DateRangePicker/useDateRangeCalendarControls.js +6 -18
- package/DateRangePicker/useDateRangePickerValue.js +1 -1
- package/DateTimePicker/DateTimePicker.js +2 -2
- package/DateTimePicker/index.d.ts +1 -1
- package/Drawer/index.d.ts +1 -1
- package/Dropdown/Dropdown.js +2 -10
- package/Dropdown/index.d.ts +1 -1
- package/Empty/index.d.ts +1 -1
- package/Form/FormMessage.js +1 -1
- package/Form/useAutoCompleteValueControl.js +4 -8
- package/Form/useCheckboxControlValue.d.ts +1 -1
- package/Form/useControlValueState.js +1 -1
- package/Form/useCustomControlValue.d.ts +1 -1
- package/Form/useInputControlValue.d.ts +1 -1
- package/Form/useInputControlValue.js +1 -1
- package/Form/useInputWithClearControlValue.d.ts +1 -1
- package/Form/useInputWithClearControlValue.js +2 -6
- package/Form/useInputWithTagsModeValue.js +5 -8
- package/Form/useRadioControlValue.d.ts +1 -1
- package/Form/useSelectValueControl.js +1 -4
- package/Form/useSwitchControlValue.d.ts +1 -1
- package/Icon/index.d.ts +1 -1
- package/Input/Input.d.ts +4 -4
- package/Input/Input.js +3 -3
- package/Input/index.d.ts +1 -1
- package/Loading/index.d.ts +1 -1
- package/Menu/Menu.js +1 -1
- package/Menu/MenuDivider.js +1 -1
- package/Menu/index.d.ts +1 -1
- package/Message/Message.d.ts +1 -1
- package/Message/Message.js +19 -9
- package/Message/index.d.ts +2 -2
- package/Modal/ModalActions.js +1 -1
- package/Modal/index.d.ts +7 -7
- package/Navigation/Navigation.js +3 -4
- package/Navigation/NavigationItem.js +2 -2
- package/Navigation/NavigationSubMenu.js +4 -7
- package/Navigation/index.d.ts +1 -1
- package/Notification/Notification.js +14 -10
- package/Notification/index.d.ts +2 -2
- package/Notifier/NotifierManager.js +1 -1
- package/Overlay/index.d.ts +1 -1
- package/Pagination/Pagination.d.ts +2 -2
- package/Pagination/PaginationJumper.js +1 -1
- package/Pagination/PaginationPageSize.js +6 -4
- package/Pagination/index.d.ts +4 -4
- package/Pagination/usePagination.js +20 -7
- package/Picker/PickerTrigger.d.ts +3 -3
- package/Picker/index.d.ts +3 -3
- package/Picker/usePickerValue.js +7 -3
- package/Popconfirm/Popconfirm.js +1 -1
- package/Popconfirm/index.d.ts +1 -1
- package/Popover/Popover.js +1 -6
- package/Popover/index.d.ts +1 -1
- package/Popper/Popper.js +1 -1
- package/Portal/Portal.js +2 -4
- package/Portal/index.d.ts +1 -1
- package/Progress/Progress.js +7 -5
- package/Progress/index.d.ts +1 -1
- package/Provider/ConfigProvider.js +1 -1
- package/Provider/index.d.ts +4 -4
- package/Radio/Radio.js +4 -4
- package/Radio/RadioGroup.js +2 -1
- package/Radio/index.d.ts +2 -2
- package/Select/AutoComplete.js +4 -8
- package/Select/Option.js +1 -1
- package/Select/Select.js +3 -7
- package/Select/SelectTriggerTags.js +1 -1
- package/Select/TreeSelect.js +1 -4
- package/Select/index.d.ts +5 -5
- package/Select/useSelectTriggerTags.js +1 -1
- package/Skeleton/Skeleton.js +5 -1
- package/Slider/Slider.js +13 -9
- package/Slider/useSlider.js +57 -50
- package/Stepper/Step.js +4 -2
- package/Stepper/index.d.ts +2 -2
- package/Switch/Switch.js +1 -1
- package/Switch/index.d.ts +1 -1
- package/Table/Table.d.ts +25 -25
- package/Table/Table.js +52 -49
- package/Table/TableBody.js +12 -6
- package/Table/TableBodyRow.js +22 -22
- package/Table/TableCell.js +3 -2
- package/Table/TableExpandedTable.js +9 -7
- package/Table/TableHeader.js +11 -9
- package/Table/draggable/useTableDraggable.js +2 -1
- package/Table/editable/TableEditRenderWrapper.js +2 -2
- package/Table/index.d.ts +5 -5
- package/Table/pagination/TablePagination.js +2 -2
- package/Table/pagination/useTablePagination.d.ts +1 -1
- package/Table/pagination/useTablePagination.js +2 -2
- package/Table/refresh/TableRefresh.js +2 -5
- package/Table/rowSelection/TableRowSelection.js +12 -9
- package/Table/rowSelection/useTableRowSelection.d.ts +1 -1
- package/Table/rowSelection/useTableRowSelection.js +3 -5
- package/Table/sorting/TableSortingIcon.js +2 -2
- package/Table/sorting/useTableSorting.d.ts +1 -1
- package/Table/sorting/useTableSorting.js +11 -5
- package/Table/useTableFetchMore.d.ts +1 -1
- package/Table/useTableFetchMore.js +1 -1
- package/Table/useTableLoading.d.ts +1 -1
- package/Table/useTableLoading.js +1 -1
- package/Table/useTableScroll.js +33 -19
- package/Tabs/index.d.ts +3 -3
- package/Tag/Tag.js +1 -1
- package/Tag/index.d.ts +2 -2
- package/TextField/TextField.js +8 -7
- package/TextField/index.d.ts +1 -1
- package/TextField/useTextFieldControl.js +1 -1
- package/Textarea/Textarea.js +2 -2
- package/TimePanel/index.d.ts +1 -1
- package/TimePicker/TimePicker.js +2 -2
- package/TimePicker/index.d.ts +1 -1
- package/Tooltip/Tooltip.d.ts +1 -1
- package/Tooltip/Tooltip.js +6 -5
- package/Tooltip/index.d.ts +1 -1
- package/Tooltip/useDelayMouseEnterLeave.js +1 -1
- package/Transition/Collapse.js +3 -1
- package/Transition/Fade.js +9 -8
- package/Transition/Grow.js +16 -12
- package/Transition/SlideFade.js +9 -8
- package/Transition/Zoom.js +9 -8
- package/Transition/getTransitionStyleProps.js +1 -1
- package/Transition/index.d.ts +4 -4
- package/Transition/useSetNodeTransition.d.ts +4 -1
- package/Transition/useSetNodeTransition.js +1 -1
- package/Tree/Tree.js +12 -4
- package/Tree/TreeNode.js +17 -11
- package/Tree/TreeNodeList.js +1 -3
- package/Tree/getTreeNodeEntities.js +9 -6
- package/Tree/index.d.ts +2 -2
- package/Tree/traverseTree.js +1 -1
- package/Typography/Typography.js +1 -3
- package/Typography/index.d.ts +1 -1
- package/Upload/UploadInput.js +1 -1
- package/Upload/UploadPicture.d.ts +11 -11
- package/Upload/UploadPictureBlock.js +2 -2
- package/Upload/UploadPictureWall.d.ts +14 -14
- package/Upload/UploadPictureWall.js +17 -5
- package/Upload/UploadResult.js +2 -2
- package/Upload/index.d.ts +3 -3
- package/_internal/InputCheck/InputCheck.js +1 -1
- package/_internal/InputCheck/index.d.ts +1 -1
- package/_internal/InputTriggerPopper/index.d.ts +1 -1
- package/_internal/SlideFadeOverlay/SlideFadeOverlay.js +3 -8
- package/_internal/SlideFadeOverlay/index.d.ts +1 -1
- package/hooks/useIsomorphicLayoutEffect.js +3 -1
- package/index.d.ts +18 -18
- package/index.js +1 -0
- package/package.json +7 -7
- package/utils/get-scrollbar-width.d.ts +1 -1
- package/utils/get-scrollbar-width.js +6 -1
- package/utils/scroll-lock.js +2 -2
|
@@ -4,12 +4,12 @@ import { TableComponentContext } from '../TableContext.js';
|
|
|
4
4
|
|
|
5
5
|
function TableEditRenderWrapper({ children, dataIndex, editable, rowData, setCellProps, ...rest }) {
|
|
6
6
|
var _a;
|
|
7
|
-
const { bodyCell: BodyCell
|
|
7
|
+
const { bodyCell: BodyCell } = useContext(TableComponentContext) || {};
|
|
8
8
|
const customProps = (_a = setCellProps === null || setCellProps === void 0 ? void 0 : setCellProps(rowData)) !== null && _a !== void 0 ? _a : {};
|
|
9
9
|
if (typeof BodyCell === 'function') {
|
|
10
10
|
return (jsx(BodyCell, { ...customProps, ...rest, dataIndex: dataIndex, editable: editable, rowData: rowData, children: children }));
|
|
11
11
|
}
|
|
12
|
-
return
|
|
12
|
+
return jsx(Fragment, { children: children });
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export { TableEditRenderWrapper as default };
|
package/Table/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { TableProps, default
|
|
1
|
+
export { TableProps, default } from './Table';
|
|
2
2
|
export { TableRefreshProps, default as TableRefresh, } from './refresh/TableRefresh';
|
|
3
|
-
export { TableCellProps, default as TableCell
|
|
4
|
-
export { EditableBodyCellProps
|
|
5
|
-
export { useTableDraggable
|
|
3
|
+
export { TableCellProps, default as TableCell } from './TableCell';
|
|
4
|
+
export { EditableBodyCellProps } from './editable/TableEditRenderWrapper';
|
|
5
|
+
export { useTableDraggable } from './draggable/useTableDraggable';
|
|
6
6
|
export { useTableRowSelection, SELECTED_ALL_KEY, } from './rowSelection/useTableRowSelection';
|
|
7
|
-
export { default as useTableScroll
|
|
7
|
+
export { default as useTableScroll } from './useTableScroll';
|
|
@@ -9,7 +9,7 @@ import cx from 'clsx';
|
|
|
9
9
|
const TablePagination = forwardRef(function TablePagination(props, ref) {
|
|
10
10
|
var _a;
|
|
11
11
|
const { className, bodyRef, ...rest } = props;
|
|
12
|
-
const { pagination
|
|
12
|
+
const { pagination } = useContext(TableContext) || {};
|
|
13
13
|
const { current: currentPageProp, onChange: onChangePageProp, total, options: paginationOptions = {}, } = pagination || {};
|
|
14
14
|
const [currentPage, setCurrentPage] = useTablePagination({
|
|
15
15
|
bodyRef,
|
|
@@ -17,7 +17,7 @@ const TablePagination = forwardRef(function TablePagination(props, ref) {
|
|
|
17
17
|
onChange: onChangePageProp,
|
|
18
18
|
});
|
|
19
19
|
const { boundaryCount, className: paginationClassName, disabled, hideNextButton, hidePreviousButton, jumperButtonText, jumperHintText, jumperInputPlaceholder, onChangePageSize, pageSize: pageSizeProp, pageSizeLabel, pageSizeOptions, pageSizeUnit, renderPageSizeOptionName, renderPaginationSummary, showJumper, showPageSizeOptions, siblingCount, } = paginationOptions;
|
|
20
|
-
const currentStartCount =
|
|
20
|
+
const currentStartCount = pageSizeProp * (currentPage - 1) + 1;
|
|
21
21
|
const currentEndCount = Math.min(pageSizeProp * currentPage, total);
|
|
22
22
|
return (jsxs("div", { ...rest, ref: ref, className: cx(tableClasses.pagination, className), children: [jsx("span", { className: tableClasses.paginationIndicator, children: (_a = renderPaginationSummary === null || renderPaginationSummary === void 0 ? void 0 : renderPaginationSummary(currentStartCount, currentEndCount)) !== null && _a !== void 0 ? _a : `目前顯示 ${currentStartCount} - ${currentEndCount} 筆,共 ${total} 筆資料` }), jsx("div", { className: tableClasses.paginationActions, children: jsx(Pagination, { boundaryCount: boundaryCount, buttonText: jumperButtonText, className: paginationClassName, current: currentPage, disabled: disabled, hideNextButton: hideNextButton, hidePreviousButton: hidePreviousButton, hintText: jumperHintText, inputPlaceholder: jumperInputPlaceholder, onChange: setCurrentPage, onChangePageSize: onChangePageSize, pageSize: pageSizeProp, pageSizeLabel: pageSizeLabel, pageSizeOptions: pageSizeOptions, pageSizeUnit: pageSizeUnit, renderPageSizeOptionName: renderPageSizeOptionName, showJumper: showJumper, showPageSizeOptions: showPageSizeOptions, siblingCount: siblingCount, total: total }) })] }));
|
|
23
23
|
});
|
|
@@ -5,4 +5,4 @@ export interface UseTablePagination {
|
|
|
5
5
|
current?: TablePagination['current'];
|
|
6
6
|
onChange?: TablePagination['onChange'];
|
|
7
7
|
}
|
|
8
|
-
export declare function useTablePagination(props: UseTablePagination): readonly [number, (c: number) =>
|
|
8
|
+
export declare function useTablePagination(props: UseTablePagination): readonly [number, (c: number) => void];
|
|
@@ -5,8 +5,8 @@ import { TableContext } from '../TableContext.js';
|
|
|
5
5
|
|
|
6
6
|
const equalityFn = (a, b) => a === b;
|
|
7
7
|
function useTablePagination(props) {
|
|
8
|
-
const { bodyRef, current: currentProp, onChange: onChangeProp
|
|
9
|
-
const { sorting
|
|
8
|
+
const { bodyRef, current: currentProp, onChange: onChangeProp } = props;
|
|
9
|
+
const { sorting } = useContext(TableContext) || {};
|
|
10
10
|
const [current, setCurrent] = useControlValueState({
|
|
11
11
|
defaultValue: 1,
|
|
12
12
|
equalityFn,
|
|
@@ -8,15 +8,12 @@ import Icon from '../../Icon/Icon.js';
|
|
|
8
8
|
|
|
9
9
|
const TableRefresh = forwardRef(function TableRefresh(props, ref) {
|
|
10
10
|
const { className, children, onClick, ...rest } = props;
|
|
11
|
-
const { setLoading
|
|
11
|
+
const { setLoading } = useContext(TableContext) || {};
|
|
12
12
|
const onRefreshClicked = useCallback((e) => {
|
|
13
13
|
e.stopPropagation();
|
|
14
14
|
setLoading === null || setLoading === void 0 ? void 0 : setLoading(true);
|
|
15
15
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
16
|
-
}, [
|
|
17
|
-
onClick,
|
|
18
|
-
setLoading,
|
|
19
|
-
]);
|
|
16
|
+
}, [onClick, setLoading]);
|
|
20
17
|
return (jsx("div", { ref: ref, className: tableClasses.refresh, ...rest, children: jsx(Button, { onClick: onRefreshClicked, prefix: jsx(Icon, { icon: ResetIcon }), children: children || '重新整理' }) }));
|
|
21
18
|
});
|
|
22
19
|
var TableRefresh$1 = TableRefresh;
|
|
@@ -15,8 +15,8 @@ import cx from 'clsx';
|
|
|
15
15
|
const TableRowSelection = forwardRef(function TableRowSelection(props, ref) {
|
|
16
16
|
var _a, _b, _c;
|
|
17
17
|
const { rowKey, setChecked, showDropdownIcon, ...rest } = props;
|
|
18
|
-
const { rowSelection, expanding
|
|
19
|
-
const { dataSource = []
|
|
18
|
+
const { rowSelection, expanding } = useContext(TableContext) || {};
|
|
19
|
+
const { dataSource = [] } = useContext(TableDataContext) || {};
|
|
20
20
|
/** checkbox methods/state */
|
|
21
21
|
const onSelected = useCallback(() => {
|
|
22
22
|
rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.onChange(rowKey);
|
|
@@ -30,15 +30,18 @@ const TableRowSelection = forwardRef(function TableRowSelection(props, ref) {
|
|
|
30
30
|
if (selectedRowKeys.length === validDataSource.length)
|
|
31
31
|
return 'all';
|
|
32
32
|
return 'indeterminate';
|
|
33
|
-
}, [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
}, [
|
|
34
|
+
rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys,
|
|
35
|
+
rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.disabledRowKeys,
|
|
36
|
+
dataSource,
|
|
37
|
+
]);
|
|
38
|
+
const selfChecked = useMemo(() => { var _a; return ((_a = rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) !== null && _a !== void 0 ? _a : []).some((key) => key === rowKey); }, [rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys, rowKey]);
|
|
38
39
|
/** checkbox props */
|
|
39
40
|
const isHeaderCheckbox = rowKey === SELECTED_ALL_KEY;
|
|
40
41
|
const checked = isHeaderCheckbox ? checkboxStatus === 'all' : selfChecked;
|
|
41
|
-
const indeterminate = isHeaderCheckbox
|
|
42
|
+
const indeterminate = isHeaderCheckbox
|
|
43
|
+
? checkboxStatus === 'indeterminate'
|
|
44
|
+
: false;
|
|
42
45
|
const name = isHeaderCheckbox ? '選擇全部' : '選擇';
|
|
43
46
|
/** parent callbacks */
|
|
44
47
|
useEffect(() => {
|
|
@@ -71,7 +74,7 @@ const TableRowSelection = forwardRef(function TableRowSelection(props, ref) {
|
|
|
71
74
|
(_a = action.onClick) === null || _a === void 0 ? void 0 : _a.call(action, rowSelection.selectedRowKeys);
|
|
72
75
|
toggleOpen(false);
|
|
73
76
|
};
|
|
74
|
-
const actionMenu = (jsx(Menu, { size: "medium", children: ((_a = rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.actions) !== null && _a !== void 0 ? _a : []).map((
|
|
77
|
+
const actionMenu = (jsx(Menu, { size: "medium", children: ((_a = rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.actions) !== null && _a !== void 0 ? _a : []).map((action) => (jsx(MenuItem, { className: action.className, onClick: (evt) => onMenuItemClicked(evt, action), children: action.text }, action.key))) }));
|
|
75
78
|
return (jsxs("div", { ref: ref, ...rest, className: tableClasses.selections, style: hiddenIconWithExpandableStyle.host, children: [jsx(Checkbox, { checked: checked, disabled: ((_b = rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.disabledRowKeys) === null || _b === void 0 ? void 0 : _b.length)
|
|
76
79
|
? rowSelection.disabledRowKeys.includes(rowKey)
|
|
77
80
|
: false, indeterminate: indeterminate, inputProps: {
|
|
@@ -3,4 +3,4 @@ export declare const SELECTED_ALL_KEY = "MZN-TABLE-ROW-SELECTION-ALL";
|
|
|
3
3
|
export interface UseTableRowSelection extends Omit<TableRowSelection, 'actions'> {
|
|
4
4
|
dataSource: TableDataSource[];
|
|
5
5
|
}
|
|
6
|
-
export declare function useTableRowSelection(props: UseTableRowSelection): readonly [string[], (v: string) =>
|
|
6
|
+
export declare function useTableRowSelection(props: UseTableRowSelection): readonly [string[], (v: string) => void];
|
|
@@ -5,7 +5,8 @@ import { useLastCallback } from '../../hooks/useLastCallback.js';
|
|
|
5
5
|
const equalityFn = (a, b) => {
|
|
6
6
|
const sortedA = a.sort();
|
|
7
7
|
const sortedB = b.sort();
|
|
8
|
-
return sortedA.length === sortedB.length &&
|
|
8
|
+
return (sortedA.length === sortedB.length &&
|
|
9
|
+
sortedA.every((v, idx) => v === sortedB[idx]));
|
|
9
10
|
};
|
|
10
11
|
const SELECTED_ALL_KEY = 'MZN-TABLE-ROW-SELECTION-ALL';
|
|
11
12
|
function useTableRowSelection(props) {
|
|
@@ -38,10 +39,7 @@ function useTableRowSelection(props) {
|
|
|
38
39
|
];
|
|
39
40
|
}
|
|
40
41
|
else {
|
|
41
|
-
nextSelectedRowKey = [
|
|
42
|
-
...selectedRowKey,
|
|
43
|
-
rowKey,
|
|
44
|
-
];
|
|
42
|
+
nextSelectedRowKey = [...selectedRowKey, rowKey];
|
|
45
43
|
}
|
|
46
44
|
}
|
|
47
45
|
setSelectedRowKey(nextSelectedRowKey);
|
|
@@ -9,8 +9,8 @@ import cx from 'clsx';
|
|
|
9
9
|
const TableSortingIcon = forwardRef(function TableSortingIcon(props, ref) {
|
|
10
10
|
const { className, column, ...rest } = props;
|
|
11
11
|
const uniqueId = useMemo(() => `${crypto.getRandomValues(new Uint32Array(5))[0]}`, []);
|
|
12
|
-
const { sorting
|
|
13
|
-
const { key = uniqueId
|
|
12
|
+
const { sorting } = useContext(TableContext) || {};
|
|
13
|
+
const { key = uniqueId } = column;
|
|
14
14
|
/** styling */
|
|
15
15
|
const currentType = (key === (sorting === null || sorting === void 0 ? void 0 : sorting.sortedOn) ? sorting.sortedType : 'none');
|
|
16
16
|
const currentIconStyle = useMemo(() => ({
|
|
@@ -3,7 +3,7 @@ export interface UseTableSorting {
|
|
|
3
3
|
dataSource: TableDataSource[];
|
|
4
4
|
}
|
|
5
5
|
export type SortedType = 'desc' | 'asc' | 'none';
|
|
6
|
-
export declare function useTableSorting(props: UseTableSorting): readonly [TableDataSource[], (v: Pick<TableColumn<TableRecord<unknown>>, "key" | "dataIndex" | "sorter" | "onSorted">) =>
|
|
6
|
+
export declare function useTableSorting(props: UseTableSorting): readonly [TableDataSource[], (v: Pick<TableColumn<TableRecord<unknown>>, "key" | "dataIndex" | "sorter" | "onSorted">) => void, {
|
|
7
7
|
readonly sortedOn: string;
|
|
8
8
|
readonly sortedType: SortedType;
|
|
9
9
|
readonly onResetAll: () => void;
|
|
@@ -37,7 +37,7 @@ const equalityFn = (a, b, deepCompare = false) => {
|
|
|
37
37
|
return false;
|
|
38
38
|
};
|
|
39
39
|
function useTableSorting(props) {
|
|
40
|
-
const { dataSource: dataSourceProp
|
|
40
|
+
const { dataSource: dataSourceProp } = props;
|
|
41
41
|
const [sortedOn, setSortedOn] = useState('');
|
|
42
42
|
const [sortedType, setSortedType] = useState('none');
|
|
43
43
|
const [dataSource, setDataSource] = useControlValueState({
|
|
@@ -52,7 +52,8 @@ function useTableSorting(props) {
|
|
|
52
52
|
* @NOTE 條件1: 如果一開始就有傳入值,則直接同步 dataSource
|
|
53
53
|
* @NOTE 條件2: 深度比較舊 dataSourceProp 跟新的是否有不同,如果有則同步
|
|
54
54
|
*/
|
|
55
|
-
if (!dataSource.length ||
|
|
55
|
+
if (!dataSource.length ||
|
|
56
|
+
!equalityFn(prevDataSourceProps, dataSourceProp, true)) {
|
|
56
57
|
setDataSource(dataSourceProp);
|
|
57
58
|
}
|
|
58
59
|
}, [prevDataSourceProps, dataSourceProp]);
|
|
@@ -91,9 +92,10 @@ function useTableSorting(props) {
|
|
|
91
92
|
if (typeof sorter === 'function') {
|
|
92
93
|
console.warn('When using a `sorter` function, please provide the `dataIndex` to make sure it worked as expected.');
|
|
93
94
|
// sort by given sorter
|
|
94
|
-
newSource = newSource.sort((a, b) =>
|
|
95
|
+
newSource = newSource.sort((a, b) =>
|
|
95
96
|
// reverse result when sorted type is ascending
|
|
96
|
-
|
|
97
|
+
sorter(get(a, dataIndex || ''), get(b, dataIndex || '')) *
|
|
98
|
+
(nextSortedType === 'asc' ? -1 : 1));
|
|
97
99
|
}
|
|
98
100
|
// map back the data source
|
|
99
101
|
onMappingSources(newSource);
|
|
@@ -108,7 +110,11 @@ function useTableSorting(props) {
|
|
|
108
110
|
}
|
|
109
111
|
}
|
|
110
112
|
});
|
|
111
|
-
return [
|
|
113
|
+
return [
|
|
114
|
+
dataSource,
|
|
115
|
+
onChange,
|
|
116
|
+
{ sortedOn, sortedType, onResetAll, setDataSource },
|
|
117
|
+
];
|
|
112
118
|
}
|
|
113
119
|
|
|
114
120
|
export { useTableSorting };
|
|
@@ -4,7 +4,7 @@ export interface UseTableFetchMore extends TableFetchMore {
|
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
}
|
|
6
6
|
export declare function useTableFetchMore(props: UseTableFetchMore): {
|
|
7
|
-
readonly fetchMore: (() =>
|
|
7
|
+
readonly fetchMore: (() => void) | undefined;
|
|
8
8
|
readonly isFetching: boolean;
|
|
9
9
|
readonly isReachEnd: boolean;
|
|
10
10
|
};
|
|
@@ -31,7 +31,7 @@ function useTableFetchMore(props) {
|
|
|
31
31
|
if (isReachEnd)
|
|
32
32
|
onFetching(false);
|
|
33
33
|
});
|
|
34
|
-
const fetchMore =
|
|
34
|
+
const fetchMore = callbackProp && !disabled ? onFetchMore : undefined;
|
|
35
35
|
/** check source length and reset states */
|
|
36
36
|
const prevSourceLength = usePreviousValue(dataSource.length);
|
|
37
37
|
const currentSourceLength = useMemo(() => dataSource.length, [dataSource.length]);
|
|
@@ -2,4 +2,4 @@ export declare const SELECTED_ALL_KEY = "MZN-TABLE-ROW-SELECTION-ALL";
|
|
|
2
2
|
export interface UseTableLoading {
|
|
3
3
|
loading?: boolean;
|
|
4
4
|
}
|
|
5
|
-
export declare function useTableLoading(props: UseTableLoading): readonly [boolean, (l: boolean) =>
|
|
5
|
+
export declare function useTableLoading(props: UseTableLoading): readonly [boolean, (l: boolean) => void];
|
package/Table/useTableLoading.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useLastCallback } from '../hooks/useLastCallback.js';
|
|
|
3
3
|
|
|
4
4
|
const equalityFn = (a, b) => a === b;
|
|
5
5
|
function useTableLoading(props) {
|
|
6
|
-
const { loading: loadingProp
|
|
6
|
+
const { loading: loadingProp } = props;
|
|
7
7
|
const [loading, setLoading] = useControlValueState({
|
|
8
8
|
defaultValue: false,
|
|
9
9
|
equalityFn,
|
package/Table/useTableScroll.js
CHANGED
|
@@ -32,7 +32,7 @@ const defaultScrollBarStyle = {
|
|
|
32
32
|
backgroundColor: 'transparent',
|
|
33
33
|
};
|
|
34
34
|
function useTableScroll(props) {
|
|
35
|
-
const { onFetchMore, loading, scrollBarSize = 4
|
|
35
|
+
const { onFetchMore, loading, scrollBarSize = 4 } = props;
|
|
36
36
|
const scrollRef = useRef(null);
|
|
37
37
|
const tableRef = useRef(null);
|
|
38
38
|
const scrollBarTrackRef = useRef(null);
|
|
@@ -46,10 +46,11 @@ function useTableScroll(props) {
|
|
|
46
46
|
/** @NOTE Scroll bar 高度為可視區域的百分比 */
|
|
47
47
|
if (!scrollRef.current)
|
|
48
48
|
return;
|
|
49
|
-
const { scrollHeight, clientHeight: tableHeight
|
|
49
|
+
const { scrollHeight, clientHeight: tableHeight } = scrollRef.current;
|
|
50
50
|
const bodyHeight = scrollHeight - HEADER_DEFAULT_HEIGHT;
|
|
51
51
|
const viewAreaHeight = tableHeight - HEADER_DEFAULT_HEIGHT;
|
|
52
|
-
const nextHeight = Math.max((viewAreaHeight -
|
|
52
|
+
const nextHeight = Math.max((viewAreaHeight - SCROLL_BAR_MAX_END_SPACING * 2) *
|
|
53
|
+
(viewAreaHeight / bodyHeight), tableHeight / 10);
|
|
53
54
|
setScrollBarHeight(nextHeight);
|
|
54
55
|
}, []);
|
|
55
56
|
/** display/hide scroll bar */
|
|
@@ -71,10 +72,12 @@ function useTableScroll(props) {
|
|
|
71
72
|
}, SCROLL_BAR_DISPLAY_TIMES);
|
|
72
73
|
}, []);
|
|
73
74
|
const onDisplayScrollBar = useCallback(() => {
|
|
74
|
-
if (!scrollBarRef.current ||
|
|
75
|
+
if (!scrollBarRef.current ||
|
|
76
|
+
!scrollRef.current ||
|
|
77
|
+
!scrollBarTrackRef.current)
|
|
75
78
|
return;
|
|
76
79
|
/** 觸控螢幕不需要 scroll bar */
|
|
77
|
-
const isTouchEnabled =
|
|
80
|
+
const isTouchEnabled = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
|
|
78
81
|
/** firefox 的滾軸只能同時顯示 or 取消,所以乾脆就用原生的(除非能單獨關掉直向的滾軸,只顯示橫向的才行) */
|
|
79
82
|
const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
|
80
83
|
if (isTouchEnabled || isFirefox)
|
|
@@ -91,7 +94,8 @@ function useTableScroll(props) {
|
|
|
91
94
|
/** scroll bar style reset when mouse leave */
|
|
92
95
|
const onScrollBarLeave = useCallback(() => {
|
|
93
96
|
if (scrollBarRef.current) {
|
|
94
|
-
scrollBarRef.current.childNodes[0].style.width =
|
|
97
|
+
scrollBarRef.current.childNodes[0].style.width =
|
|
98
|
+
`${scrollBarSize}px`;
|
|
95
99
|
}
|
|
96
100
|
resetPointerOffset();
|
|
97
101
|
}, []);
|
|
@@ -127,12 +131,12 @@ function useTableScroll(props) {
|
|
|
127
131
|
return;
|
|
128
132
|
/** 游標在滾軸上長按並移動 */
|
|
129
133
|
function onMouseMove({ clientY }) {
|
|
130
|
-
const { scrollHeight, clientHeight: tableHeight
|
|
134
|
+
const { scrollHeight, clientHeight: tableHeight } = body;
|
|
131
135
|
if (!pointerOffset)
|
|
132
136
|
return;
|
|
133
137
|
// keep scroll bar display when moving
|
|
134
138
|
window.requestAnimationFrame(onDisplayScrollBar);
|
|
135
|
-
const { top: tableTop
|
|
139
|
+
const { top: tableTop } = body.getBoundingClientRect();
|
|
136
140
|
/** Table 最大滾動距離 */
|
|
137
141
|
const maxScrollDistance = scrollHeight - tableHeight;
|
|
138
142
|
/** 游標在 scroll bar 上的位置 */
|
|
@@ -145,20 +149,21 @@ function useTableScroll(props) {
|
|
|
145
149
|
const clampScrollBarTop = Math.min(Math.max(scrollBarCurrentPosition, 0), // min boundary
|
|
146
150
|
maxScrollBarDistance);
|
|
147
151
|
scrollBar.style.setProperty('transform', `translate3d(0, ${clampScrollBarTop}px, 0)`);
|
|
148
|
-
body.scrollTop =
|
|
152
|
+
body.scrollTop =
|
|
153
|
+
(clampScrollBarTop * maxScrollDistance) / maxScrollBarDistance;
|
|
149
154
|
}
|
|
150
155
|
/** 在滾軸滑軌上點擊,直接滾動到指定位置上 */
|
|
151
156
|
function onMouseClick({ clientY }) {
|
|
152
157
|
if (!scrollBar)
|
|
153
158
|
return;
|
|
154
|
-
const { scrollHeight, clientHeight: tableHeight
|
|
159
|
+
const { scrollHeight, clientHeight: tableHeight } = body;
|
|
155
160
|
// keep scroll bar display when moving
|
|
156
161
|
window.requestAnimationFrame(onDisplayScrollBar);
|
|
157
|
-
const { top: tableTop
|
|
162
|
+
const { top: tableTop } = body.getBoundingClientRect();
|
|
158
163
|
/** Table 最大滾動距離 */
|
|
159
164
|
const maxScrollDistance = scrollHeight - tableHeight;
|
|
160
165
|
/** 游標在 Track 上的位置 */
|
|
161
|
-
const scrollBarCurrentPosition = clientY - (tableTop + HEADER_DEFAULT_HEIGHT) -
|
|
166
|
+
const scrollBarCurrentPosition = clientY - (tableTop + HEADER_DEFAULT_HEIGHT) - scrollBarHeight / 2;
|
|
162
167
|
/** 可視區域高度 */
|
|
163
168
|
const viewAreaHeight = tableHeight - HEADER_DEFAULT_HEIGHT;
|
|
164
169
|
/** 最大滑動距離 */
|
|
@@ -167,7 +172,8 @@ function useTableScroll(props) {
|
|
|
167
172
|
const clampScrollBarTop = Math.min(Math.max(scrollBarCurrentPosition, 0), // min boundary
|
|
168
173
|
maxScrollBarDistance);
|
|
169
174
|
scrollBar.style.setProperty('transform', `translate3d(0, ${clampScrollBarTop}px, 0)`);
|
|
170
|
-
body.scrollTop =
|
|
175
|
+
body.scrollTop =
|
|
176
|
+
(clampScrollBarTop * maxScrollDistance) / maxScrollBarDistance;
|
|
171
177
|
}
|
|
172
178
|
/** 游標移動到滾軸/滑軌上方時 */
|
|
173
179
|
function onMouseOver() {
|
|
@@ -199,7 +205,8 @@ function useTableScroll(props) {
|
|
|
199
205
|
/** scroll bar fatter when mouse enter */
|
|
200
206
|
const onScrollBarEnter = useCallback(() => {
|
|
201
207
|
if (scrollBarRef.current) {
|
|
202
|
-
scrollBarRef.current.childNodes[0].style.width =
|
|
208
|
+
scrollBarRef.current.childNodes[0].style.width =
|
|
209
|
+
`${scrollBarSize + 6}px`;
|
|
203
210
|
}
|
|
204
211
|
}, []);
|
|
205
212
|
/** scroll table directly */
|
|
@@ -210,7 +217,7 @@ function useTableScroll(props) {
|
|
|
210
217
|
if (scrollBarRef.current && !pointerOffset) {
|
|
211
218
|
const bodyHeight = scrollHeight - HEADER_DEFAULT_HEIGHT;
|
|
212
219
|
const viewAreaHeight = tableHeight - HEADER_DEFAULT_HEIGHT;
|
|
213
|
-
const distance = Math.max(
|
|
220
|
+
const distance = Math.max(viewAreaHeight * Math.max(scrollTop / bodyHeight, 0), 0);
|
|
214
221
|
scrollBarRef.current.style.transform = `translate3d(0, ${distance}px, 0)`;
|
|
215
222
|
}
|
|
216
223
|
if (scrollBarTrackRef.current) {
|
|
@@ -229,23 +236,30 @@ function useTableScroll(props) {
|
|
|
229
236
|
if (loading)
|
|
230
237
|
return;
|
|
231
238
|
if (scrollRef.current) {
|
|
232
|
-
const { clientHeight, scrollTop, scrollHeight
|
|
239
|
+
const { clientHeight, scrollTop, scrollHeight } = scrollRef.current;
|
|
233
240
|
/** 如果不需要滾動,則不需要觸發 */
|
|
234
241
|
if (clientHeight >= scrollHeight)
|
|
235
242
|
return;
|
|
236
243
|
window.requestAnimationFrame(onDisplayScrollBar);
|
|
237
244
|
/** @Note safari specific bug fix for scroll bouncing */
|
|
238
|
-
const belowBottom = scrollTop >
|
|
245
|
+
const belowBottom = scrollTop > scrollHeight - clientHeight;
|
|
239
246
|
if (belowBottom)
|
|
240
247
|
return;
|
|
241
248
|
window.requestAnimationFrame(setScrollBarTop);
|
|
242
249
|
/** trigger fetchMore when scrolling */
|
|
243
|
-
if (
|
|
250
|
+
if (scrollHeight - (scrollTop + clientHeight) <
|
|
251
|
+
FETCH_MORE_TRIGGER_AT_BOTTOM) {
|
|
244
252
|
onFetchMore === null || onFetchMore === void 0 ? void 0 : onFetchMore();
|
|
245
253
|
}
|
|
246
254
|
}
|
|
247
255
|
window.requestAnimationFrame(onHideScrollBar);
|
|
248
|
-
}, [
|
|
256
|
+
}, [
|
|
257
|
+
loading,
|
|
258
|
+
setScrollBarTop,
|
|
259
|
+
onDisplayScrollBar,
|
|
260
|
+
onFetchMore,
|
|
261
|
+
onHideScrollBar,
|
|
262
|
+
]);
|
|
249
263
|
const scrollBarStyle = useMemo(() => ({
|
|
250
264
|
...defaultScrollBarStyle,
|
|
251
265
|
height: `${scrollBarHeight}px`,
|
package/Tabs/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { TabProps, default as Tab
|
|
2
|
-
export { TabPaneProps, default as TabPane
|
|
3
|
-
export { TabsChild, TabsProps, default
|
|
1
|
+
export { TabProps, default as Tab } from './Tab';
|
|
2
|
+
export { TabPaneProps, default as TabPane } from './TabPane';
|
|
3
|
+
export { TabsChild, TabsProps, default } from './Tabs';
|
package/Tag/Tag.js
CHANGED
|
@@ -10,7 +10,7 @@ import cx from 'clsx';
|
|
|
10
10
|
* The react component for `mezzanine` tag.
|
|
11
11
|
*/
|
|
12
12
|
const Tag = forwardRef(function Tag(props, ref) {
|
|
13
|
-
const { size: globalSize
|
|
13
|
+
const { size: globalSize } = useContext(MezzanineConfig);
|
|
14
14
|
const { children, className, closable = false, disabled = false, onClose, size = globalSize, ...rest } = props;
|
|
15
15
|
return (jsxs("span", { ...rest, ref: ref, "aria-disabled": disabled, className: cx(tagClasses.host, tagClasses.size(size), {
|
|
16
16
|
[tagClasses.disabled]: disabled,
|
package/Tag/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { TagSize
|
|
2
|
-
export { TagProps, default
|
|
1
|
+
export type { TagSize } from '@mezzanine-ui/core/tag';
|
|
2
|
+
export { TagProps, default } from './Tag';
|
package/TextField/TextField.js
CHANGED
|
@@ -11,9 +11,9 @@ import cx from 'clsx';
|
|
|
11
11
|
* The react component for `mezzanine` input.
|
|
12
12
|
*/
|
|
13
13
|
const TextField = forwardRef(function TextField(props, ref) {
|
|
14
|
-
const { size: globalSize
|
|
14
|
+
const { size: globalSize } = useContext(MezzanineConfig);
|
|
15
15
|
const { active = false, children, className, clearable = false, disabled = false, error = false, fullWidth, onClear, onClick: onClickProps, onKeyDown: onKeyDownProps, prefix, role: roleProp, size = globalSize, suffix, suffixActionIcon, ...rest } = props;
|
|
16
|
-
const { role, onClick, onKeyDown
|
|
16
|
+
const { role, onClick, onKeyDown } = useTextFieldControl({
|
|
17
17
|
onClick: onClickProps,
|
|
18
18
|
onKeyDown: onKeyDownProps,
|
|
19
19
|
});
|
|
@@ -30,11 +30,12 @@ const TextField = forwardRef(function TextField(props, ref) {
|
|
|
30
30
|
[textFieldClasses.fullWidth]: fullWidth,
|
|
31
31
|
[textFieldClasses.withPrefix]: prefix,
|
|
32
32
|
[textFieldClasses.withSuffix]: suffix || suffixActionIcon,
|
|
33
|
-
}, className), children: [prefix && jsx("div", { className: textFieldClasses.prefix, children: prefix }), children, suffix && jsx("div", { className: textFieldClasses.suffix, children: suffix }), suffixActionIcon &&
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
}, className), children: [prefix && jsx("div", { className: textFieldClasses.prefix, children: prefix }), children, suffix && jsx("div", { className: textFieldClasses.suffix, children: suffix }), suffixActionIcon &&
|
|
34
|
+
cloneElement(suffixActionIcon, {
|
|
35
|
+
className: cx(textFieldClasses.actionIcon, suffixActionIcon.props.className),
|
|
36
|
+
role: 'button',
|
|
37
|
+
tabIndex: -1,
|
|
38
|
+
}), clearable && (jsx(Icon, { className: textFieldClasses.clearIcon, icon: TimesIcon, onClick: (event) => {
|
|
38
39
|
if (!disabled && onClear) {
|
|
39
40
|
onClear(event);
|
|
40
41
|
}
|
package/TextField/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { TextFieldSize
|
|
1
|
+
export type { TextFieldSize } from '@mezzanine-ui/core/text-field';
|
|
2
2
|
export { TextFieldProps, default } from './TextField';
|
package/Textarea/Textarea.js
CHANGED
|
@@ -12,11 +12,11 @@ import cx from 'clsx';
|
|
|
12
12
|
* The react component for `mezzanine` textarea.
|
|
13
13
|
*/
|
|
14
14
|
const Textarea = forwardRef(function Textarea(props, ref) {
|
|
15
|
-
const { size: globalSize
|
|
15
|
+
const { size: globalSize } = useContext(MezzanineConfig);
|
|
16
16
|
const { disabled: disabledFromFormControl, fullWidth: fullWidthFromFormControl, required: requiredFromFormControl, severity, } = useContext(FormControlContext) || {};
|
|
17
17
|
const { className, clearable = false, defaultValue, disabled = disabledFromFormControl || false, error = severity === 'error' || false, fullWidth = fullWidthFromFormControl || false, maxLength, onChange: onChangeProp, placeholder, readOnly = false, required = requiredFromFormControl || false, rows, size = globalSize, textareaRef: textareaRefProp, textareaProps, value: valueProp, } = props;
|
|
18
18
|
const textareaRef = useRef(null);
|
|
19
|
-
const [value, onChange, onClear
|
|
19
|
+
const [value, onChange, onClear] = useInputWithClearControlValue({
|
|
20
20
|
defaultValue,
|
|
21
21
|
onChange: onChangeProp,
|
|
22
22
|
ref: textareaRef,
|
package/TimePanel/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { TimePanelActionProps, default as TimePanelAction, } from './TimePanelAction';
|
|
2
2
|
export { TimePanelColumnProps, default as TimePanelColumn, } from './TimePanelColumn';
|
|
3
|
-
export { TimePanelProps, default
|
|
3
|
+
export { TimePanelProps, default } from './TimePanel';
|
package/TimePicker/TimePicker.js
CHANGED
|
@@ -16,7 +16,7 @@ import { FormControlContext } from '../Form/FormControlContext.js';
|
|
|
16
16
|
*/
|
|
17
17
|
const TimePicker = forwardRef(function TimePicker(props, ref) {
|
|
18
18
|
const { disabled: disabledFromFormControl, fullWidth: fullWidthFromFormControl, required: requiredFromFormControl, severity, } = useContext(FormControlContext) || {};
|
|
19
|
-
const { defaultTimeFormat
|
|
19
|
+
const { defaultTimeFormat } = useCalendarContext();
|
|
20
20
|
const { className, clearable = true, confirmText, defaultValue, disabled = disabledFromFormControl, error = severity === 'error' || false, format = defaultTimeFormat, fullWidth = fullWidthFromFormControl, hideHour, hideMinute, hideSecond, hourPrefix, hourStep, inputProps, minutePrefix, minuteStep, onChange: onChangeProp, onPanelToggle: onPanelToggleProp, placeholder, popperProps, prefix, readOnly, required = requiredFromFormControl, secondPrefix, secondStep, size: sizeProp, value: valueProp, } = props;
|
|
21
21
|
const { onBlur: onBlurProp, onKeyDown: onKeyDownProp, onFocus: onFocusProp, size: inputSize = format.length + 2, ...restInputProp } = inputProps || {};
|
|
22
22
|
const formats = useMemo(() => [format], [format]);
|
|
@@ -106,7 +106,7 @@ const TimePicker = forwardRef(function TimePicker(props, ref) {
|
|
|
106
106
|
}
|
|
107
107
|
onPanelToggle(!open);
|
|
108
108
|
};
|
|
109
|
-
const suffixActionIcon =
|
|
109
|
+
const suffixActionIcon = jsx(Icon, { icon: ClockIcon, onClick: onIconClick });
|
|
110
110
|
return (jsxs(Fragment, { children: [jsx(PickerTrigger, { ref: triggerComposedRef, className: className, clearable: clearable, disabled: disabled, error: error, fullWidth: fullWidth, inputProps: resolvedInputProps, inputRef: inputRef, onChange: onInputChange, onClear: onClear, placeholder: placeholder, prefix: prefix, readOnly: readOnly, required: required, size: sizeProp, suffixActionIcon: suffixActionIcon, value: inputValue }), jsx(TimePickerPanel, { ref: panelRef, anchor: anchorRef, confirmText: confirmText, hideHour: hideHour, hideMinute: hideMinute, hideSecond: hideSecond, hourPrefix: hourPrefix, hourStep: hourStep, minutePrefix: minutePrefix, minuteStep: minuteStep, onChange: onChange, onConfirm: onConfirm, open: open, popperProps: popperProps, secondPrefix: secondPrefix, secondStep: secondStep, value: internalValue })] }));
|
|
111
111
|
});
|
|
112
112
|
var TimePicker$1 = TimePicker;
|
package/TimePicker/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { TimePickerPanelProps, default as TimePickerPanel, } from './TimePickerPanel';
|
|
2
|
-
export { TimePickerProps, default
|
|
2
|
+
export { TimePickerProps, default } from './TimePicker';
|
package/Tooltip/Tooltip.d.ts
CHANGED
package/Tooltip/Tooltip.js
CHANGED
|
@@ -20,7 +20,7 @@ const Tooltip = forwardRef(function Tooltip(props, ref) {
|
|
|
20
20
|
const { modifiers = [] } = options;
|
|
21
21
|
const tooltipRef = useRef(null);
|
|
22
22
|
const composedRef = useComposeRefs([ref, tooltipRef]);
|
|
23
|
-
const { anchor, onLeave, onPopperEnter, onTargetEnter, visible
|
|
23
|
+
const { anchor, onLeave, onPopperEnter, onTargetEnter, visible } = useDelayMouseEnterLeave({
|
|
24
24
|
mouseLeaveDelay,
|
|
25
25
|
});
|
|
26
26
|
/** tooltip shown only when title existed && visible is true */
|
|
@@ -28,10 +28,11 @@ const Tooltip = forwardRef(function Tooltip(props, ref) {
|
|
|
28
28
|
return (jsxs(Fragment, { children: [jsx(Popper, { ...rest, ref: composedRef, anchor: anchorProp || anchor, className: cx(tooltipClasses.host, className), onMouseEnter: onPopperEnter, onMouseLeave: onLeave, open: isTooltipVisible, options: {
|
|
29
29
|
...options,
|
|
30
30
|
modifiers: [...modifiers, offsetModifier],
|
|
31
|
-
}, children: title }), typeof children === 'function' &&
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
}, children: title }), typeof children === 'function' &&
|
|
32
|
+
children({
|
|
33
|
+
onMouseEnter: onTargetEnter,
|
|
34
|
+
onMouseLeave: onLeave,
|
|
35
|
+
})] }));
|
|
35
36
|
});
|
|
36
37
|
var Tooltip$1 = Tooltip;
|
|
37
38
|
|
package/Tooltip/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default, TooltipProps
|
|
1
|
+
export { default, TooltipProps } from './Tooltip';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState, useCallback } from 'react';
|
|
2
2
|
|
|
3
3
|
function useDelayMouseEnterLeave(opt) {
|
|
4
|
-
const { mouseLeaveDelay = 0.1
|
|
4
|
+
const { mouseLeaveDelay = 0.1 } = opt || {};
|
|
5
5
|
/** state that control tooltip visible/invisible */
|
|
6
6
|
const [visible, setVisible] = useState(false);
|
|
7
7
|
/** tooltip reference anchor */
|
package/Transition/Collapse.js
CHANGED
|
@@ -33,7 +33,9 @@ const Collapse = forwardRef(function Collapse(props, ref) {
|
|
|
33
33
|
const { autoTransitionDuration, addEndListener } = useAutoTransitionDuration(duration);
|
|
34
34
|
const nodeRef = useRef(null);
|
|
35
35
|
const wrapperRef = useRef(null);
|
|
36
|
-
const collapsedHeight = typeof collapsedHeightProp === 'number'
|
|
36
|
+
const collapsedHeight = typeof collapsedHeightProp === 'number'
|
|
37
|
+
? `${collapsedHeightProp}px`
|
|
38
|
+
: collapsedHeightProp;
|
|
37
39
|
const getWrapperHeight = () => { var _a; return ((_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight) || 0; };
|
|
38
40
|
const [setNodeTransition, resetNodeTransition] = useSetNodeTransition({
|
|
39
41
|
delay,
|