@mezzanine-ui/react 0.9.2 → 0.10.2
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 +5 -4
- package/Accordion/AccordionDetails.js +2 -2
- package/Accordion/AccordionSummary.js +3 -4
- package/Alert/Alert.js +1 -3
- package/AppBar/AppBar.js +1 -1
- package/AppBar/AppBarBrand.d.ts +1 -1
- package/AppBar/AppBarBrand.js +1 -1
- package/AppBar/AppBarMain.d.ts +1 -1
- package/AppBar/AppBarMain.js +1 -1
- package/AppBar/AppBarSupport.d.ts +1 -1
- package/AppBar/AppBarSupport.js +1 -1
- package/Badge/Badge.js +2 -2
- package/Badge/BadgeContainer.d.ts +1 -1
- package/Badge/BadgeContainer.js +1 -1
- package/Button/Button.d.ts +2 -2
- package/Button/Button.js +7 -5
- package/Button/ButtonGroup.js +7 -5
- package/Button/IconButton.d.ts +3 -3
- package/Button/IconButton.js +1 -1
- package/Calendar/Calendar.js +9 -10
- package/Calendar/CalendarCell.js +2 -2
- package/Calendar/CalendarContext.d.ts +3 -3
- package/Calendar/CalendarContext.js +20 -12
- package/Calendar/CalendarControls.js +3 -3
- package/Calendar/CalendarDayOfWeek.js +1 -1
- package/Calendar/CalendarDays.js +4 -5
- package/Calendar/CalendarMonths.js +4 -4
- package/Calendar/CalendarWeeks.js +4 -5
- package/Calendar/CalendarYears.js +4 -4
- package/Calendar/useCalendarControls.d.ts +2 -3
- package/Card/Card.js +5 -5
- package/Card/CardActions.js +1 -2
- package/Checkbox/CheckAll.js +2 -2
- package/Checkbox/Checkbox.js +5 -3
- package/Checkbox/CheckboxGroup.js +5 -5
- package/ConfirmActions/ConfirmActions.js +1 -2
- package/DatePicker/DatePicker.js +2 -3
- package/DatePicker/DatePickerCalendar.js +1 -1
- package/DateRangePicker/DateRangePicker.js +2 -3
- package/DateRangePicker/DateRangePickerCalendar.js +3 -4
- package/DateRangePicker/useDateRangeCalendarControls.d.ts +1 -2
- package/DateRangePicker/useDateRangePickerValue.d.ts +12 -13
- package/DateTimePicker/DateTimePicker.js +2 -3
- package/DateTimePicker/DateTimePickerPanel.js +1 -3
- package/Drawer/Drawer.js +1 -1
- package/Dropdown/Dropdown.d.ts +1 -1
- package/Dropdown/Dropdown.js +2 -2
- package/Empty/Empty.js +3 -4
- package/Form/FormField.js +2 -2
- package/Form/FormLabel.js +1 -2
- package/Form/FormMessage.d.ts +1 -1
- package/Form/FormMessage.js +1 -1
- package/Form/useAutoCompleteValueControl.d.ts +30 -11
- package/Form/useAutoCompleteValueControl.js +71 -31
- package/Form/useInputWithTagsModeValue.js +2 -1
- package/Form/useSelectValueControl.d.ts +1 -1
- package/Icon/Icon.d.ts +4 -0
- package/Icon/Icon.js +4 -4
- package/Input/Input.d.ts +1 -1
- package/Input/Input.js +5 -4
- package/Loading/Loading.js +4 -5
- package/Menu/Menu.js +5 -3
- package/Menu/MenuDivider.d.ts +1 -1
- package/Menu/MenuDivider.js +1 -1
- package/Menu/MenuItem.js +2 -3
- package/Menu/MenuItemGroup.js +1 -2
- package/Message/Message.js +2 -3
- package/Modal/Modal.js +5 -5
- package/Modal/ModalActions.js +1 -1
- package/Modal/ModalBody.d.ts +1 -1
- package/Modal/ModalBody.js +1 -1
- package/Modal/ModalFooter.d.ts +1 -1
- package/Modal/ModalFooter.js +1 -1
- package/Modal/ModalHeader.js +2 -3
- package/Modal/useModalContainer.js +1 -1
- package/Navigation/Navigation.js +2 -2
- package/Navigation/NavigationItem.js +1 -1
- package/Navigation/NavigationSubMenu.js +3 -5
- package/Notification/Notification.js +2 -7
- package/Notifier/NotifierManager.js +1 -1
- package/Notifier/createNotifier.js +1 -1
- package/Overlay/Overlay.js +3 -3
- package/PageFooter/PageFooter.js +1 -2
- package/Pagination/Pagination.js +2 -3
- package/Pagination/PaginationItem.js +4 -4
- package/Pagination/PaginationJumper.js +2 -4
- package/Picker/PickerTrigger.d.ts +1 -1
- package/Picker/PickerTrigger.js +2 -2
- package/Picker/RangePickerTrigger.d.ts +1 -1
- package/Picker/RangePickerTrigger.js +2 -4
- package/Picker/usePickerInputValue.d.ts +2 -2
- package/Picker/usePickerValue.d.ts +6 -7
- package/Picker/useRangePickerValue.d.ts +9 -10
- package/Popconfirm/Popconfirm.js +1 -1
- package/Popover/Popover.js +2 -3
- package/Popper/Popper.js +2 -2
- package/Portal/Portal.js +1 -1
- package/Progress/Progress.js +9 -9
- package/Provider/ConfigProvider.d.ts +8 -0
- package/Provider/ConfigProvider.js +13 -0
- package/Provider/context.d.ts +6 -0
- package/Provider/context.js +7 -0
- package/Provider/index.d.ts +4 -0
- package/Provider/index.js +2 -0
- package/Radio/Radio.js +5 -3
- package/Radio/RadioGroup.js +5 -5
- package/Select/AutoComplete.d.ts +40 -14
- package/Select/AutoComplete.js +37 -28
- package/Select/Option.js +2 -2
- package/Select/Select.d.ts +2 -51
- package/Select/Select.js +15 -49
- package/Select/SelectTrigger.d.ts +8 -1
- package/Select/SelectTrigger.js +8 -12
- package/Select/SelectTriggerTags.d.ts +19 -0
- package/Select/SelectTriggerTags.js +33 -0
- package/Select/TreeSelect.js +3 -4
- package/Select/index.d.ts +1 -0
- package/Select/index.js +1 -0
- package/Select/useSelectTriggerTags.d.ts +19 -0
- package/Select/useSelectTriggerTags.js +61 -0
- package/Skeleton/Skeleton.js +1 -1
- package/Slider/Slider.d.ts +1 -1
- package/Slider/Slider.js +7 -11
- package/Stepper/Step.js +2 -2
- package/Stepper/Stepper.js +1 -1
- package/Switch/Switch.js +2 -3
- package/Table/Table.d.ts +1 -1
- package/Table/Table.js +3 -10
- package/Table/TableBody.js +2 -4
- package/Table/TableBodyRow.js +4 -7
- package/Table/TableCell.js +3 -3
- package/Table/TableExpandedTable.js +5 -6
- package/Table/TableHeader.d.ts +2 -1
- package/Table/TableHeader.js +3 -6
- package/Table/editable/TableEditRenderWrapper.js +2 -2
- package/Table/expandable/TableExpandable.js +2 -2
- package/Table/pagination/TablePagination.js +1 -2
- package/Table/refresh/TableRefresh.js +1 -1
- package/Table/rowSelection/TableRowSelection.js +5 -6
- package/Table/sorting/TableSortingIcon.js +2 -2
- package/Table/sorting/useTableSorting.d.ts +2 -2
- package/Table/useTableScroll.d.ts +178 -178
- package/Tabs/Tab.js +2 -2
- package/Tabs/TabPane.js +1 -1
- package/Tabs/Tabs.js +1 -3
- package/Tag/Tag.js +7 -6
- package/TextField/TextField.js +7 -5
- package/TextField/useTextFieldControl.d.ts +2 -2
- package/Textarea/Textarea.d.ts +1 -1
- package/Textarea/Textarea.js +5 -4
- package/TimePanel/TimePanel.js +1 -4
- package/TimePanel/TimePanelAction.js +1 -1
- package/TimePanel/TimePanelColumn.js +2 -5
- package/TimePicker/TimePicker.js +2 -3
- package/TimePicker/TimePickerPanel.js +1 -1
- package/Tooltip/Tooltip.js +3 -3
- package/Transition/Collapse.js +3 -2
- package/Transition/Fade.js +2 -2
- package/Transition/Grow.js +3 -2
- package/Transition/SlideFade.js +2 -2
- package/Transition/Transition.js +2 -2
- package/Transition/Zoom.js +2 -2
- package/Tree/Tree.js +1 -1
- package/Tree/TreeNode.js +9 -9
- package/Tree/TreeNodeList.js +5 -4
- package/Tree/getTreeNodeEntities.js +6 -3
- package/Typography/Typography.d.ts +2 -2
- package/Typography/Typography.js +2 -2
- package/Upload/UploadButton.js +2 -2
- package/Upload/UploadInput.js +1 -1
- package/Upload/UploadPicture.js +1 -1
- package/Upload/UploadPictureBlock.js +2 -8
- package/Upload/UploadPictureWall.d.ts +1 -1
- package/Upload/UploadPictureWall.js +1 -2
- package/Upload/UploadPictureWallItem.js +1 -1
- package/Upload/UploadResult.d.ts +19 -0
- package/Upload/UploadResult.js +6 -7
- package/_internal/InputCheck/InputCheck.js +2 -3
- package/_internal/InputCheck/InputCheckGroup.js +1 -1
- package/_internal/InputTriggerPopper/InputTriggerPopper.js +2 -2
- package/_internal/SlideFadeOverlay/SlideFadeOverlay.js +1 -1
- package/index.d.ts +3 -1
- package/index.js +3 -0
- package/package.json +12 -12
package/Skeleton/Skeleton.js
CHANGED
|
@@ -8,7 +8,7 @@ import cx from 'clsx';
|
|
|
8
8
|
*/
|
|
9
9
|
const Skeleton = forwardRef(function Skeleton(props, ref) {
|
|
10
10
|
const { className, height: skeletonHeight, style: skeletonStyle, type, width: skeletonWidth, ...rest } = props;
|
|
11
|
-
return (jsx("div",
|
|
11
|
+
return (jsx("div", { ...rest, ref: ref, className: cx(skeletonClasses.host, type === 'circle' && skeletonClasses.circle, className), style: { width: skeletonWidth, height: skeletonHeight, ...skeletonStyle }, ...rest }));
|
|
12
12
|
});
|
|
13
13
|
var Skeleton$1 = Skeleton;
|
|
14
14
|
|
package/Slider/Slider.d.ts
CHANGED
|
@@ -47,5 +47,5 @@ export declare type SliderProps = Omit<SliderComponentProps, 'innerRef'>;
|
|
|
47
47
|
* The outcome will be base on the type of given value.
|
|
48
48
|
* Notice that slider is a fully controlled component. Property value is always needed.
|
|
49
49
|
*/
|
|
50
|
-
declare const Slider: import("react").ForwardRefExoticComponent<
|
|
50
|
+
declare const Slider: import("react").ForwardRefExoticComponent<SliderProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
51
51
|
export default Slider;
|
package/Slider/Slider.js
CHANGED
|
@@ -20,9 +20,9 @@ function SliderComponent(props) {
|
|
|
20
20
|
...styleProp,
|
|
21
21
|
};
|
|
22
22
|
const shouldHaveInputHandlers = withInput && onChange && !disabled;
|
|
23
|
-
const getHandle = (handlerValue, index) => (jsx("div",
|
|
23
|
+
const getHandle = (handlerValue, index) => (jsx("div", { className: cx(sliderClasses.handlerPosition, index === 0 && sliderClasses.handlerStartPosition, index === 1 && sliderClasses.handlerEndPosition), children: jsx(Tooltip, { disablePortal: true, options: {
|
|
24
24
|
placement: 'top',
|
|
25
|
-
}, title: handlerValue.toString()
|
|
25
|
+
}, title: handlerValue.toString(), children: ({ onMouseEnter, onMouseLeave }) => (jsx("div", { className: cx(sliderClasses.handler, index === activeHandleIndex && sliderClasses.handlerActive), "aria-disabled": disabled, "aria-label": `Slider Handler ${index}`, "aria-valuemax": max, "aria-valuemin": min, "aria-valuenow": handlerValue, onFocus: () => { }, onMouseDown: (e) => handlePress(e, index), onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onTouchStart: (e) => handlePress(e, index), role: "slider", tabIndex: index })) }) }));
|
|
26
26
|
const inputSize = Math.max(min.toString().length, max.toString().length);
|
|
27
27
|
const [startInputValue, setStartInputValue] = useState(() => {
|
|
28
28
|
if (!isRangeSlider(value)) {
|
|
@@ -159,19 +159,15 @@ function SliderComponent(props) {
|
|
|
159
159
|
},
|
|
160
160
|
type: 'number',
|
|
161
161
|
};
|
|
162
|
-
return (jsxs("div",
|
|
162
|
+
return (jsxs("div", { ...rest, ref: innerRef, className: cx(sliderClasses.host, disabled && sliderClasses.disabled, className), style: style, children: [withInput && isRangeSlider(value) ? (jsx(Input, { className: sliderClasses.input, disabled: disabled, onChange: onStartInputChange, value: startInputValue, inputProps: {
|
|
163
163
|
...inputProps,
|
|
164
164
|
onKeyDown: onStartInputKeydown,
|
|
165
165
|
onBlur: onStartInputBlur,
|
|
166
|
-
} },
|
|
167
|
-
jsxs("div", Object.assign({ className: sliderClasses.controls }, { children: [jsx("div", { ref: railRef, className: sliderClasses.rail, role: "presentation", onMouseDown: handleClickTrackOrRail }, void 0),
|
|
168
|
-
jsx("div", { className: sliderClasses.track, role: "presentation", onMouseDown: handleClickTrackOrRail }, void 0),
|
|
169
|
-
isRangeSlider(value) ? (jsxs(Fragment, { children: [getHandle(value[0], 0), getHandle(value[1], 1)] }, void 0)) : getHandle(value, -1)] }), void 0),
|
|
170
|
-
withInput ? (jsx(Input, { className: sliderClasses.input, disabled: disabled, onChange: onEndInputChange, value: endInputValue, inputProps: {
|
|
166
|
+
} })) : null, jsxs("div", { className: sliderClasses.controls, children: [jsx("div", { ref: railRef, className: sliderClasses.rail, role: "presentation", onMouseDown: handleClickTrackOrRail }), jsx("div", { className: sliderClasses.track, role: "presentation", onMouseDown: handleClickTrackOrRail }), isRangeSlider(value) ? (jsxs(Fragment, { children: [getHandle(value[0], 0), getHandle(value[1], 1)] })) : getHandle(value, -1)] }), withInput ? (jsx(Input, { className: sliderClasses.input, disabled: disabled, onChange: onEndInputChange, value: endInputValue, inputProps: {
|
|
171
167
|
...inputProps,
|
|
172
168
|
onKeyDown: onEndInputKeydown,
|
|
173
169
|
onBlur: onEndInputBlur,
|
|
174
|
-
} }
|
|
170
|
+
} })) : null] }));
|
|
175
171
|
}
|
|
176
172
|
/**
|
|
177
173
|
* The react component for `mezzanine` slider.
|
|
@@ -180,9 +176,9 @@ function SliderComponent(props) {
|
|
|
180
176
|
*/
|
|
181
177
|
const Slider = forwardRef((props, ref) => {
|
|
182
178
|
if (isRangeSlider(props.value)) {
|
|
183
|
-
return (jsx(SliderComponent,
|
|
179
|
+
return (jsx(SliderComponent, { ...props, innerRef: ref }));
|
|
184
180
|
}
|
|
185
|
-
return (jsx(SliderComponent,
|
|
181
|
+
return (jsx(SliderComponent, { ...props, innerRef: ref }));
|
|
186
182
|
});
|
|
187
183
|
var Slider$1 = Slider;
|
|
188
184
|
|
package/Stepper/Step.js
CHANGED
|
@@ -12,8 +12,8 @@ import cx from 'clsx';
|
|
|
12
12
|
const Step = forwardRef(function Step(props, ref) {
|
|
13
13
|
const { active, children, className, completed, completedIconProps, disabled, index = -1, title, titleProps, ...rest } = props;
|
|
14
14
|
/** icon and step number */
|
|
15
|
-
const iconRender = (jsx(Typography,
|
|
16
|
-
return (jsxs("div",
|
|
15
|
+
const iconRender = (jsx(Typography, { className: stepClasses.iconBackground, variant: "button3", children: completed ? (jsx(Icon, { className: stepClasses.completedIcon, icon: CheckIcon, ...completedIconProps })) : index + 1 }));
|
|
16
|
+
return (jsxs("div", { className: cx(stepClasses.host, disabled && stepClasses.disabled, className), ref: ref, ...rest, children: [iconRender, /** title (optional) */ title && (jsx(Typography, { className: stepClasses.title, variant: "button2", ...titleProps, children: title })), children] }));
|
|
17
17
|
});
|
|
18
18
|
var Step$1 = Step;
|
|
19
19
|
|
package/Stepper/Stepper.js
CHANGED
|
@@ -27,7 +27,7 @@ const Stepper = forwardRef(function Stepper(props, ref) {
|
|
|
27
27
|
...step.props,
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
|
-
return (jsx("div",
|
|
30
|
+
return (jsx("div", { className: cx(stepperClasses.host, className), ref: ref, ...rest, children: stepsWithState }));
|
|
31
31
|
});
|
|
32
32
|
var Stepper$1 = Stepper;
|
|
33
33
|
|
package/Switch/Switch.js
CHANGED
|
@@ -18,12 +18,11 @@ const Switch = forwardRef(function Switch(props, ref) {
|
|
|
18
18
|
onChange: onChangeProp,
|
|
19
19
|
});
|
|
20
20
|
const disabled = loading || disabledProp;
|
|
21
|
-
return (jsxs("span",
|
|
21
|
+
return (jsxs("span", { ref: ref, ...rest, className: cx(switchClasses.host, {
|
|
22
22
|
[switchClasses.checked]: checked,
|
|
23
23
|
[switchClasses.disabled]: disabled,
|
|
24
24
|
[switchClasses.large]: size === 'large',
|
|
25
|
-
}, className)
|
|
26
|
-
jsx("input", Object.assign({}, inputProps, { "aria-checked": checked, "aria-disabled": disabled, checked: checked, className: switchClasses.input, disabled: disabled, onChange: onChange, type: "checkbox" }), void 0)] }), void 0));
|
|
25
|
+
}, className), children: [jsx("span", { className: switchClasses.control, children: loading && jsx(Icon, { icon: SwitchSpinnerIcon, spin: true }) }), jsx("input", { ...inputProps, "aria-checked": checked, "aria-disabled": disabled, checked: checked, className: switchClasses.input, disabled: disabled, onChange: onChange, type: "checkbox" })] }));
|
|
27
26
|
});
|
|
28
27
|
var Switch$1 = Switch;
|
|
29
28
|
|
package/Table/Table.d.ts
CHANGED
|
@@ -82,5 +82,5 @@ export interface TableWithPagination<T> extends TableBaseProps<T> {
|
|
|
82
82
|
fetchMore?: undefined;
|
|
83
83
|
}
|
|
84
84
|
export declare type TableProps<T> = TableWithFetchMore<T> | TableWithPagination<T>;
|
|
85
|
-
declare const Table: import("react").ForwardRefExoticComponent<
|
|
85
|
+
declare const Table: import("react").ForwardRefExoticComponent<TableProps<Record<string, unknown>> & import("react").RefAttributes<HTMLDivElement>>;
|
|
86
86
|
export default Table;
|
package/Table/Table.js
CHANGED
|
@@ -52,13 +52,9 @@ const Table = forwardRef(function Table(props, ref) {
|
|
|
52
52
|
/** Feature refresh */
|
|
53
53
|
const isRefreshShow = useMemo(() => {
|
|
54
54
|
var _a;
|
|
55
|
-
return (
|
|
55
|
+
return (
|
|
56
56
|
/** @default false */
|
|
57
|
-
refreshProp === null ||
|
|
58
|
-
/** @default false */
|
|
59
|
-
refreshProp === void 0 ? void 0 :
|
|
60
|
-
/** @default false */
|
|
61
|
-
refreshProp.show) !== null && _a !== void 0 ? _a : false);
|
|
57
|
+
(_a = refreshProp === null || refreshProp === void 0 ? void 0 : refreshProp.show) !== null && _a !== void 0 ? _a : false);
|
|
62
58
|
}, [refreshProp === null || refreshProp === void 0 ? void 0 : refreshProp.show]);
|
|
63
59
|
/** context */
|
|
64
60
|
const tableContextValue = useMemo(() => {
|
|
@@ -120,10 +116,7 @@ const Table = forwardRef(function Table(props, ref) {
|
|
|
120
116
|
const tableComponentContextValue = {
|
|
121
117
|
bodyCell: (_a = components === null || components === void 0 ? void 0 : components.body) === null || _a === void 0 ? void 0 : _a.cell,
|
|
122
118
|
};
|
|
123
|
-
return (jsx(Loading,
|
|
124
|
-
jsx(TableHeader, { className: headerClassName }, void 0),
|
|
125
|
-
jsx(TableBody, { ref: bodyRef, className: bodyClassName, rowClassName: bodyRowClassName }, void 0),
|
|
126
|
-
paginationProp ? (jsx(TablePagination, { bodyRef: bodyRef }, void 0)) : null] }), void 0) }), void 0) }), void 0) }), void 0) }), void 0));
|
|
119
|
+
return (jsx(Loading, { loading: loading, stretch: true, tip: "\u8CC7\u6599\u8F09\u5165\u4E2D...", children: jsx("div", { ref: ref, ...rest, className: cx(tableClasses.host, className), role: "grid", children: jsx(TableContext.Provider, { value: tableContextValue, children: jsx(TableDataContext.Provider, { value: tableDataContextValue, children: jsxs(TableComponentContext.Provider, { value: tableComponentContextValue, children: [isRefreshShow ? (jsx(TableRefresh, { onClick: refreshProp.onClick })) : null, jsx(TableHeader, { className: headerClassName }), jsx(TableBody, { ref: bodyRef, className: bodyClassName, rowClassName: bodyRowClassName }), paginationProp ? (jsx(TablePagination, { bodyRef: bodyRef })) : null] }) }) }) }) }));
|
|
127
120
|
});
|
|
128
121
|
var Table$1 = Table;
|
|
129
122
|
|
package/Table/TableBody.js
CHANGED
|
@@ -22,15 +22,13 @@ const TableBody = forwardRef(function TableBody(props, ref) {
|
|
|
22
22
|
const currentStartCount = (paginationOptions === null || paginationOptions === void 0 ? void 0 : paginationOptions.pageSize) && currentPage ? ((paginationOptions.pageSize) * (currentPage - 1)) : 0;
|
|
23
23
|
const currentEndCount = (paginationOptions === null || paginationOptions === void 0 ? void 0 : paginationOptions.pageSize) && currentPage && total ? (Math.min(((paginationOptions.pageSize) * currentPage), total)) : 0;
|
|
24
24
|
const currentDataSource = pagination && !disableAutoSlicing ? (dataSource.slice(currentStartCount, currentEndCount)) : dataSource;
|
|
25
|
-
return (jsxs("div",
|
|
26
|
-
(fetchMore === null || fetchMore === void 0 ? void 0 : fetchMore.isFetching) ? (jsx("div", Object.assign({ className: tableClasses.bodyFetchMore }, { children: jsx(Loading, { loading: true }, void 0) }), void 0)) : null,
|
|
27
|
-
jsx("div", Object.assign({ ref: scrollElement.ref, onMouseDown: scrollElement.onMouseDown, onMouseUp: scrollElement.onMouseUp, onMouseEnter: scrollElement.onMouseEnter, onMouseLeave: scrollElement.onMouseLeave, role: "button", style: scrollElement.style, tabIndex: -1 }, { children: jsx("div", { style: {
|
|
25
|
+
return (jsxs("div", { ...rest, ref: composedRefs, className: cx(tableClasses.body, className), onScroll: tableBody.onScroll, role: "rowgroup", children: [currentDataSource.length ? currentDataSource.map((rowData, index) => (jsx(TableBodyRow, { className: rowClassName, rowData: rowData, rowIndex: index }, (rowData.key || rowData.id)))) : (jsx(Empty, { ...restEmptyProps, className: cx(tableClasses.bodyEmpty, emptyComponentClassName), fullHeight: emptyComponentFullHeight, children: emptyComponentChildren })), (fetchMore === null || fetchMore === void 0 ? void 0 : fetchMore.isFetching) ? (jsx("div", { className: tableClasses.bodyFetchMore, children: jsx(Loading, { loading: true }) })) : null, jsx("div", { ref: scrollElement.ref, onMouseDown: scrollElement.onMouseDown, onMouseUp: scrollElement.onMouseUp, onMouseEnter: scrollElement.onMouseEnter, onMouseLeave: scrollElement.onMouseLeave, role: "button", style: scrollElement.style, tabIndex: -1, children: jsx("div", { style: {
|
|
28
26
|
width: `${scrollBarSize}px`,
|
|
29
27
|
height: '100%',
|
|
30
28
|
borderRadius: '10px',
|
|
31
29
|
backgroundColor: '#7d7d7d',
|
|
32
30
|
transition: '0.1s',
|
|
33
|
-
} }
|
|
31
|
+
} }) })] }));
|
|
34
32
|
});
|
|
35
33
|
var TableBody$1 = TableBody;
|
|
36
34
|
|
package/Table/TableBodyRow.js
CHANGED
|
@@ -27,17 +27,14 @@ const TableBodyRow = forwardRef(function TableBodyRow(props, ref) {
|
|
|
27
27
|
var _a, _b;
|
|
28
28
|
return ((_b = (_a = expanding === null || expanding === void 0 ? void 0 : expanding.expandedRowRender) === null || _a === void 0 ? void 0 : _a.call(expanding, rowData)) !== null && _b !== void 0 ? _b : null);
|
|
29
29
|
}, [expanding, rowData]);
|
|
30
|
-
return (jsxs(Fragment, { children: [jsxs("div",
|
|
30
|
+
return (jsxs(Fragment, { children: [jsxs("div", { ...rest, ref: ref, className: cx(tableClasses.bodyRow, {
|
|
31
31
|
[tableClasses.bodyRowHighlight]: selected || expanded,
|
|
32
|
-
}, className), role: "row"
|
|
33
|
-
expanding ? (jsx(TableExpandable, { expandable: isExpandable, expanded: expanded, role: "gridcell", setExpanded: setExpanded, onExpand: (status) => { var _a; return (_a = expanding.onExpand) === null || _a === void 0 ? void 0 : _a.call(expanding, rowData, status); } }, void 0)) : null,
|
|
34
|
-
(columns !== null && columns !== void 0 ? columns : []).map((column) => {
|
|
32
|
+
}, className), role: "row", children: [rowSelection ? (jsx(TableRowSelection, { role: "gridcell", rowKey: (rowData.key || rowData.id), setChecked: (status) => setSelected(status), showDropdownIcon: false })) : null, expanding ? (jsx(TableExpandable, { expandable: isExpandable, expanded: expanded, role: "gridcell", setExpanded: setExpanded, onExpand: (status) => { var _a; return (_a = expanding.onExpand) === null || _a === void 0 ? void 0 : _a.call(expanding, rowData, status); } })) : null, (columns !== null && columns !== void 0 ? columns : []).map((column) => {
|
|
35
33
|
var _a, _b, _c, _d;
|
|
36
34
|
const ellipsis = !!(get(rowData, column.dataIndex)) && ((_a = column.ellipsis) !== null && _a !== void 0 ? _a : true);
|
|
37
35
|
const tooltipTitle = ((_c = (_b = column.renderTooltipTitle) === null || _b === void 0 ? void 0 : _b.call(column, rowData)) !== null && _c !== void 0 ? _c : get(rowData, column.dataIndex));
|
|
38
|
-
return (jsx("div",
|
|
39
|
-
})] }),
|
|
40
|
-
renderedExpandedContent ? (jsx(Fragment$1, { children: typeof renderedExpandedContent === 'string' ? (jsx(AccordionDetails, Object.assign({ className: expanding.className, expanded: expanded }, { children: renderedExpandedContent }), void 0)) : (jsx(Fragment$1, { children: renderedExpandedContent.dataSource.length > 0 ? (jsx(AccordionDetails, Object.assign({ className: cx(expanding.className, tableClasses.bodyRowExpandedTableWrapper), expanded: expanded }, { children: jsx(TableExpandedTable, { renderedExpandedContent: renderedExpandedContent }, void 0) }), void 0)) : null }, void 0)) }, void 0)) : null] }, void 0));
|
|
36
|
+
return (jsx("div", { className: cx(tableClasses.bodyRowCellWrapper, column.bodyClassName), style: getColumnStyle(column), children: jsx(TableEditRenderWrapper, { ...column, rowData: rowData, children: jsx(TableCell, { ellipsis: ellipsis, forceShownTooltipWhenHovered: column.forceShownTooltipWhenHovered, style: getCellStyle(column), tooltipTitle: tooltipTitle, children: ((_d = column.render) === null || _d === void 0 ? void 0 : _d.call(column, column, rowData, rowIndex)) || get(rowData, column.dataIndex) }) }) }, `${column.dataIndex}-${column.title}`));
|
|
37
|
+
})] }), renderedExpandedContent ? (jsx(Fragment$1, { children: typeof renderedExpandedContent === 'string' ? (jsx(AccordionDetails, { className: expanding.className, expanded: expanded, children: renderedExpandedContent })) : (jsx(Fragment$1, { children: renderedExpandedContent.dataSource.length > 0 ? (jsx(AccordionDetails, { className: cx(expanding.className, tableClasses.bodyRowExpandedTableWrapper), expanded: expanded, children: jsx(TableExpandedTable, { renderedExpandedContent: renderedExpandedContent }) })) : null })) })) : null] }));
|
|
41
38
|
});
|
|
42
39
|
var TableBodyRow$1 = TableBodyRow;
|
|
43
40
|
|
package/Table/TableCell.js
CHANGED
|
@@ -7,9 +7,9 @@ import cx from 'clsx';
|
|
|
7
7
|
const TableCell = forwardRef(function TableCell(props, ref) {
|
|
8
8
|
const { children, className, ellipsis = true, forceShownTooltipWhenHovered = false, role = 'gridcell', tooltipTitle, ...rest } = props;
|
|
9
9
|
const ellipsisRef = useRef(null);
|
|
10
|
-
return (jsx("div",
|
|
10
|
+
return (jsx("div", { ref: ref, ...rest, className: cx(tableClasses.cell, className), role: role, children: ellipsis || forceShownTooltipWhenHovered ? (jsx(Tooltip, { title: `${tooltipTitle}`, options: {
|
|
11
11
|
placement: 'top-start',
|
|
12
|
-
}
|
|
12
|
+
}, children: ({ onMouseEnter, onMouseLeave }) => (jsx("div", { ref: ellipsisRef, className: ellipsis ? tableClasses.cellEllipsis : '', onMouseEnter: (e) => {
|
|
13
13
|
if (ellipsisRef.current) {
|
|
14
14
|
const { current: el } = ellipsisRef;
|
|
15
15
|
const isOverflow = forceShownTooltipWhenHovered || (el.scrollWidth > el.offsetWidth);
|
|
@@ -17,7 +17,7 @@ const TableCell = forwardRef(function TableCell(props, ref) {
|
|
|
17
17
|
if (isOverflow)
|
|
18
18
|
onMouseEnter(e);
|
|
19
19
|
}
|
|
20
|
-
}, onMouseLeave: onMouseLeave
|
|
20
|
+
}, onMouseLeave: onMouseLeave, children: children })) })) : children }));
|
|
21
21
|
});
|
|
22
22
|
var TableCell$1 = TableCell;
|
|
23
23
|
|
|
@@ -10,17 +10,16 @@ import cx from 'clsx';
|
|
|
10
10
|
const TableExpandedTable = forwardRef(function TableExpandedTable(props, ref) {
|
|
11
11
|
const { renderedExpandedContent, } = props;
|
|
12
12
|
const { columns, } = useContext(TableDataContext) || {};
|
|
13
|
-
return (jsx("div",
|
|
13
|
+
return (jsx("div", { className: tableClasses.bodyRowExpandedTable, children: renderedExpandedContent.dataSource.map((source, sourceIndex) => {
|
|
14
14
|
var _a;
|
|
15
|
-
return (jsxs("div",
|
|
16
|
-
((_a = (renderedExpandedContent.columns || columns)) !== null && _a !== void 0 ? _a : [])
|
|
15
|
+
return (jsxs("div", { ref: ref, className: cx(tableClasses.bodyRow, tableClasses.bodyRowExpandedTableRow, renderedExpandedContent.className), role: "row", children: [jsx(TableExpandable, { showIcon: false }), ((_a = (renderedExpandedContent.columns || columns)) !== null && _a !== void 0 ? _a : [])
|
|
17
16
|
.map((column, index) => {
|
|
18
17
|
var _a, _b, _c, _d;
|
|
19
18
|
const ellipsis = !!(get(source, column.dataIndex)) && ((_a = column.ellipsis) !== null && _a !== void 0 ? _a : true);
|
|
20
19
|
const tooltipTitle = ((_c = (_b = column.renderTooltipTitle) === null || _b === void 0 ? void 0 : _b.call(column, source)) !== null && _c !== void 0 ? _c : get(source, column.dataIndex));
|
|
21
|
-
return (jsx("div",
|
|
22
|
-
})] }
|
|
23
|
-
}) })
|
|
20
|
+
return (jsx("div", { className: cx(tableClasses.bodyRowCellWrapper, column.bodyClassName), style: getColumnStyle((columns !== null && columns !== void 0 ? columns : [])[index]), children: jsx(TableCell, { ellipsis: ellipsis, forceShownTooltipWhenHovered: column.forceShownTooltipWhenHovered, style: getCellStyle((columns !== null && columns !== void 0 ? columns : [])[index]), tooltipTitle: tooltipTitle || '', children: ((_d = column.render) === null || _d === void 0 ? void 0 : _d.call(column, column, source, sourceIndex)) || get(source, column.dataIndex) }) }, `${column.dataIndex}-${index}`));
|
|
21
|
+
})] }, (source.key || source.id)));
|
|
22
|
+
}) }));
|
|
24
23
|
});
|
|
25
24
|
var TableExpandedTable$1 = TableExpandedTable;
|
|
26
25
|
|
package/Table/TableHeader.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
+
declare const TableHeader: import("react").ForwardRefExoticComponent<NativeElementPropsWithoutKeyAndRef<"div"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
3
4
|
export default TableHeader;
|
package/Table/TableHeader.js
CHANGED
|
@@ -13,13 +13,10 @@ const TableHeader = forwardRef(function TableHeader(props, ref) {
|
|
|
13
13
|
const { className, ...rest } = props;
|
|
14
14
|
const { rowSelection, expanding, } = useContext(TableContext) || {};
|
|
15
15
|
const { columns, } = useContext(TableDataContext) || {};
|
|
16
|
-
return (jsxs("div",
|
|
17
|
-
expanding && !rowSelection ? (jsx(TableExpandable, { showIcon: false }, void 0)) : null,
|
|
18
|
-
(columns !== null && columns !== void 0 ? columns : []).map((column) => {
|
|
16
|
+
return (jsxs("div", { ref: ref, ...rest, className: cx(tableClasses.header, className), role: "rowgroup", children: [rowSelection ? (jsx(TableRowSelection, { rowKey: SELECTED_ALL_KEY, showDropdownIcon: true })) : null, expanding && !rowSelection ? (jsx(TableExpandable, { showIcon: false })) : null, (columns !== null && columns !== void 0 ? columns : []).map((column) => {
|
|
19
17
|
var _a;
|
|
20
|
-
return (jsx("div",
|
|
21
|
-
|
|
22
|
-
})] }), void 0));
|
|
18
|
+
return (jsx("div", { className: cx(tableClasses.headerCellWrapper, column.headerClassName), style: getColumnStyle(column), children: jsxs(TableCell, { ellipsis: false, role: "columnheader", style: getCellStyle(column), children: [((_a = column.renderTitle) === null || _a === void 0 ? void 0 : _a.call(column, tableClasses)) || column.title, typeof column.sorter === 'function' || typeof column.onSorted === 'function' ? (jsx(TableSortingIcon, { column: column })) : null] }) }, `${column.dataIndex}-${column.title}`));
|
|
19
|
+
})] }));
|
|
23
20
|
});
|
|
24
21
|
var TableHeader$1 = TableHeader;
|
|
25
22
|
|
|
@@ -7,9 +7,9 @@ function TableEditRenderWrapper({ children, dataIndex, editable, rowData, setCel
|
|
|
7
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
|
-
return (jsx(BodyCell,
|
|
10
|
+
return (jsx(BodyCell, { ...customProps, ...rest, dataIndex: dataIndex, editable: editable, rowData: rowData, children: children }));
|
|
11
11
|
}
|
|
12
|
-
return (jsx(Fragment, { children: children }
|
|
12
|
+
return (jsx(Fragment, { children: children }));
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export { TableEditRenderWrapper as default };
|
|
@@ -16,9 +16,9 @@ const TableExpandable = forwardRef(function TableExpandable(props, ref) {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
|
-
return (jsx("div",
|
|
19
|
+
return (jsx("div", { ...rest, ref: ref, className: cx(tableClasses.collapseAction, className), children: jsx("div", { className: tableClasses.icon, children: showIcon ? (jsx(Icon, { className: cx(tableClasses.icon, {
|
|
20
20
|
[tableClasses.iconClickable]: expandable,
|
|
21
|
-
}), color: expandable ? 'primary' : 'disabled', icon: ChevronDownIcon, onClick: onClick, style: { transform: `rotate(${expanded ? '180deg' : '0'})` } }
|
|
21
|
+
}), color: expandable ? 'primary' : 'disabled', icon: ChevronDownIcon, onClick: onClick, style: { transform: `rotate(${expanded ? '180deg' : '0'})` } })) : null }) }));
|
|
22
22
|
});
|
|
23
23
|
var TableExpandable$1 = TableExpandable;
|
|
24
24
|
|
|
@@ -18,8 +18,7 @@ const TablePagination = forwardRef(function TablePagination(props, ref) {
|
|
|
18
18
|
const { boundaryCount, className: paginationClassName, disabled, hideNextButton, hidePreviousButton, pageSize: pageSizeProp, siblingCount, } = paginationOptions;
|
|
19
19
|
const currentStartCount = (pageSizeProp * (currentPage - 1)) + 1;
|
|
20
20
|
const currentEndCount = Math.min(pageSizeProp * currentPage, total);
|
|
21
|
-
return (jsxs("div",
|
|
22
|
-
jsx("div", Object.assign({ className: tableClasses.paginationActions }, { children: jsx(Pagination, { boundaryCount: boundaryCount, className: paginationClassName, current: currentPage, disabled: disabled, hideNextButton: hideNextButton, hidePreviousButton: hidePreviousButton, onChange: setCurrentPage, pageSize: pageSizeProp, siblingCount: siblingCount, total: total }, void 0) }), void 0)] }), void 0));
|
|
21
|
+
return (jsxs("div", { ...rest, ref: ref, className: cx(tableClasses.pagination, className), children: [jsx("span", { className: tableClasses.paginationIndicator, children: `目前顯示 ${currentStartCount} - ${currentEndCount} 筆,共 ${total} 筆資料` }), jsx("div", { className: tableClasses.paginationActions, children: jsx(Pagination, { boundaryCount: boundaryCount, className: paginationClassName, current: currentPage, disabled: disabled, hideNextButton: hideNextButton, hidePreviousButton: hidePreviousButton, onChange: setCurrentPage, pageSize: pageSizeProp, siblingCount: siblingCount, total: total }) })] }));
|
|
23
22
|
});
|
|
24
23
|
var TablePagination$1 = TablePagination;
|
|
25
24
|
|
|
@@ -17,7 +17,7 @@ const TableRefresh = forwardRef(function TableRefresh(props, ref) {
|
|
|
17
17
|
onClick,
|
|
18
18
|
setLoading,
|
|
19
19
|
]);
|
|
20
|
-
return (jsx("div",
|
|
20
|
+
return (jsx("div", { ref: ref, className: tableClasses.refresh, ...rest, children: jsx(Button, { onClick: onRefreshClicked, prefix: jsx(Icon, { icon: ResetIcon }), children: children || '重新整理' }) }));
|
|
21
21
|
});
|
|
22
22
|
var TableRefresh$1 = TableRefresh;
|
|
23
23
|
|
|
@@ -69,18 +69,17 @@ const TableRowSelection = forwardRef(function TableRowSelection(props, ref) {
|
|
|
69
69
|
(_a = action.onClick) === null || _a === void 0 ? void 0 : _a.call(action, rowSelection.selectedRowKeys);
|
|
70
70
|
toggleOpen(false);
|
|
71
71
|
};
|
|
72
|
-
const actionMenu = (jsx(Menu,
|
|
73
|
-
return (jsxs("div",
|
|
72
|
+
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)))) }));
|
|
73
|
+
return (jsxs("div", { ref: ref, ...rest, className: tableClasses.selections, style: hiddenIconWithExpandableStyle.host, children: [jsx(Checkbox, { checked: checked, disabled: false, indeterminate: indeterminate, inputProps: {
|
|
74
74
|
name,
|
|
75
|
-
}, onChange: onSelected, size: "medium" },
|
|
76
|
-
jsx("div", Object.assign({ className: tableClasses.icon, style: hiddenIconWithExpandableStyle.icon }, { children: showDropdownIcon ? (jsx(Dropdown, Object.assign({ menu: actionMenu, onClose: () => toggleOpen(false), popperProps: {
|
|
75
|
+
}, onChange: onSelected, size: "medium" }), jsx("div", { className: tableClasses.icon, style: hiddenIconWithExpandableStyle.icon, children: showDropdownIcon ? (jsx(Dropdown, { menu: actionMenu, onClose: () => toggleOpen(false), popperProps: {
|
|
77
76
|
open,
|
|
78
77
|
options: {
|
|
79
78
|
placement: 'bottom-start',
|
|
80
79
|
},
|
|
81
|
-
}
|
|
80
|
+
}, children: (dropdownRef) => (jsx(Icon, { ref: dropdownRef, className: cx(tableClasses.icon, {
|
|
82
81
|
[tableClasses.iconClickable]: isMenuAllowOpen,
|
|
83
|
-
}), color: isMenuAllowOpen ? 'primary' : 'disabled', icon: MoreVerticalIcon, onClick: onIconClicked }
|
|
82
|
+
}), color: isMenuAllowOpen ? 'primary' : 'disabled', icon: MoreVerticalIcon, onClick: onIconClicked })) })) : null })] }));
|
|
84
83
|
});
|
|
85
84
|
var TableRowSelection$1 = TableRowSelection;
|
|
86
85
|
|
|
@@ -18,11 +18,11 @@ const TableSortingIcon = forwardRef(function TableSortingIcon(props, ref) {
|
|
|
18
18
|
transform: `rotate(${90 * (currentType === 'asc' ? -1 : 1)}deg)`,
|
|
19
19
|
},
|
|
20
20
|
}), [currentType]);
|
|
21
|
-
return (jsx(Icon,
|
|
21
|
+
return (jsx(Icon, { ...rest, ref: ref, className: cx(tableClasses.icon, tableClasses.iconClickable, className), color: currentIconStyle.color, icon: ArrowRightIcon, onClick: (evt) => {
|
|
22
22
|
var _a;
|
|
23
23
|
evt.stopPropagation();
|
|
24
24
|
(_a = sorting === null || sorting === void 0 ? void 0 : sorting.onSort) === null || _a === void 0 ? void 0 : _a.call(sorting, column);
|
|
25
|
-
}, style: currentIconStyle.style })
|
|
25
|
+
}, style: currentIconStyle.style }));
|
|
26
26
|
});
|
|
27
27
|
var TableSortingIcon$1 = TableSortingIcon;
|
|
28
28
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { TableDataSource, TableColumn } from '@mezzanine-ui/core/table';
|
|
1
|
+
import { TableDataSource, TableColumn, TableRecord } from '@mezzanine-ui/core/table';
|
|
2
2
|
export interface UseTableSorting {
|
|
3
3
|
dataSource: TableDataSource[];
|
|
4
4
|
}
|
|
5
5
|
export declare type SortedType = 'desc' | 'asc' | 'none';
|
|
6
|
-
export declare function useTableSorting(props: UseTableSorting): readonly [TableDataSource[], (v: Pick<TableColumn<
|
|
6
|
+
export declare function useTableSorting(props: UseTableSorting): readonly [TableDataSource[], (v: Pick<TableColumn<TableRecord<unknown>>, "dataIndex" | "sorter" | "onSorted">) => void, {
|
|
7
7
|
readonly sortedOn: string;
|
|
8
8
|
readonly sortedType: SortedType;
|
|
9
9
|
readonly onResetAll: () => void;
|