@mezzanine-ui/react 0.6.4
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.d.ts +24 -0
- package/Accordion/Accordion.js +32 -0
- package/Accordion/AccordionControlContext.d.ts +9 -0
- package/Accordion/AccordionControlContext.js +5 -0
- package/Accordion/AccordionDetails.d.ts +10 -0
- package/Accordion/AccordionDetails.js +25 -0
- package/Accordion/AccordionSummary.d.ts +19 -0
- package/Accordion/AccordionSummary.js +50 -0
- package/Accordion/index.d.ts +3 -0
- package/Accordion/index.js +3 -0
- package/Alert/Alert.d.ts +20 -0
- package/Alert/Alert.js +20 -0
- package/Alert/index.d.ts +2 -0
- package/Alert/index.js +1 -0
- package/AppBar/AppBar.d.ts +14 -0
- package/AppBar/AppBar.js +35 -0
- package/AppBar/AppBarBrand.d.ts +5 -0
- package/AppBar/AppBarBrand.js +11 -0
- package/AppBar/AppBarMain.d.ts +5 -0
- package/AppBar/AppBarMain.js +11 -0
- package/AppBar/AppBarSupport.d.ts +5 -0
- package/AppBar/AppBarSupport.js +11 -0
- package/AppBar/index.d.ts +4 -0
- package/AppBar/index.js +4 -0
- package/Badge/Badge.d.ts +19 -0
- package/Badge/Badge.js +27 -0
- package/Badge/BadgeContainer.d.ts +8 -0
- package/Badge/BadgeContainer.js +14 -0
- package/Badge/index.d.ts +2 -0
- package/Badge/index.js +2 -0
- package/Button/Button.d.ts +11 -0
- package/Button/Button.js +37 -0
- package/Button/ButtonGroup.d.ts +63 -0
- package/Button/ButtonGroup.js +35 -0
- package/Button/IconButton.d.ts +21 -0
- package/Button/IconButton.js +13 -0
- package/Button/index.d.ts +20 -0
- package/Button/index.js +8 -0
- package/Button/typings.d.ts +44 -0
- package/Calendar/Calendar.d.ts +69 -0
- package/Calendar/Calendar.js +53 -0
- package/Calendar/CalendarCell.d.ts +22 -0
- package/Calendar/CalendarCell.js +18 -0
- package/Calendar/CalendarContext.d.ts +22 -0
- package/Calendar/CalendarContext.js +27 -0
- package/Calendar/CalendarControls.d.ts +26 -0
- package/Calendar/CalendarControls.js +20 -0
- package/Calendar/CalendarDayOfWeek.d.ts +15 -0
- package/Calendar/CalendarDayOfWeek.js +18 -0
- package/Calendar/CalendarDays.d.ts +38 -0
- package/Calendar/CalendarDays.js +48 -0
- package/Calendar/CalendarMonths.d.ts +42 -0
- package/Calendar/CalendarMonths.js +30 -0
- package/Calendar/CalendarWeeks.d.ts +41 -0
- package/Calendar/CalendarWeeks.js +54 -0
- package/Calendar/CalendarYears.d.ts +40 -0
- package/Calendar/CalendarYears.js +34 -0
- package/Calendar/index.d.ts +12 -0
- package/Calendar/index.js +12 -0
- package/Calendar/useCalendarControlModifiers.d.ts +7 -0
- package/Calendar/useCalendarControlModifiers.js +26 -0
- package/Calendar/useCalendarControls.d.ts +13 -0
- package/Calendar/useCalendarControls.js +34 -0
- package/Calendar/useCalendarModeStack.d.ts +6 -0
- package/Calendar/useCalendarModeStack.js +15 -0
- package/Card/Card.d.ts +51 -0
- package/Card/Card.js +20 -0
- package/Card/CardActions.d.ts +34 -0
- package/Card/CardActions.js +16 -0
- package/Card/index.d.ts +2 -0
- package/Card/index.js +2 -0
- package/Checkbox/CheckAll.d.ts +13 -0
- package/Checkbox/CheckAll.js +36 -0
- package/Checkbox/Checkbox.d.ts +46 -0
- package/Checkbox/Checkbox.js +33 -0
- package/Checkbox/CheckboxGroup.d.ts +47 -0
- package/Checkbox/CheckboxGroup.js +36 -0
- package/Checkbox/CheckboxGroupContext.d.ts +9 -0
- package/Checkbox/CheckboxGroupContext.js +5 -0
- package/Checkbox/index.d.ts +4 -0
- package/Checkbox/index.js +3 -0
- package/ConfirmActions/ConfirmActions.d.ts +45 -0
- package/ConfirmActions/ConfirmActions.js +16 -0
- package/ConfirmActions/index.d.ts +1 -0
- package/ConfirmActions/index.js +1 -0
- package/DatePicker/DatePicker.d.ts +32 -0
- package/DatePicker/DatePicker.js +135 -0
- package/DatePicker/DatePickerCalendar.d.ts +32 -0
- package/DatePicker/DatePickerCalendar.js +61 -0
- package/DatePicker/index.d.ts +2 -0
- package/DatePicker/index.js +2 -0
- package/DateRangePicker/DateRangePicker.d.ts +38 -0
- package/DateRangePicker/DateRangePicker.js +187 -0
- package/DateRangePicker/DateRangePickerCalendar.d.ts +26 -0
- package/DateRangePicker/DateRangePickerCalendar.js +98 -0
- package/DateRangePicker/index.d.ts +4 -0
- package/DateRangePicker/index.js +4 -0
- package/DateRangePicker/useDateRangeCalendarControls.d.ts +15 -0
- package/DateRangePicker/useDateRangeCalendarControls.js +93 -0
- package/DateRangePicker/useDateRangePickerValue.d.ts +23 -0
- package/DateRangePicker/useDateRangePickerValue.js +87 -0
- package/DateTimePicker/DateTimePicker.d.ts +28 -0
- package/DateTimePicker/DateTimePicker.js +122 -0
- package/DateTimePicker/DateTimePickerPanel.d.ts +29 -0
- package/DateTimePicker/DateTimePickerPanel.js +51 -0
- package/DateTimePicker/index.d.ts +2 -0
- package/DateTimePicker/index.js +2 -0
- package/Drawer/Drawer.d.ts +18 -0
- package/Drawer/Drawer.js +34 -0
- package/Drawer/index.d.ts +2 -0
- package/Drawer/index.js +1 -0
- package/Dropdown/Dropdown.d.ts +25 -0
- package/Dropdown/Dropdown.js +60 -0
- package/Dropdown/index.d.ts +1 -0
- package/Dropdown/index.js +1 -0
- package/Empty/Empty.d.ts +18 -0
- package/Empty/Empty.js +16 -0
- package/Empty/index.d.ts +1 -0
- package/Empty/index.js +1 -0
- package/Form/FormControlContext.d.ts +9 -0
- package/Form/FormControlContext.js +5 -0
- package/Form/FormField.d.ts +27 -0
- package/Form/FormField.js +24 -0
- package/Form/FormLabel.d.ts +11 -0
- package/Form/FormLabel.js +17 -0
- package/Form/FormMessage.d.ts +8 -0
- package/Form/FormMessage.js +18 -0
- package/Form/index.d.ts +5 -0
- package/Form/index.js +4 -0
- package/Form/typings.d.ts +4 -0
- package/Form/useAutoCompleteValueControl.d.ts +23 -0
- package/Form/useAutoCompleteValueControl.js +58 -0
- package/Form/useCheckboxControlValue.d.ts +11 -0
- package/Form/useCheckboxControlValue.js +29 -0
- package/Form/useControlValueState.d.ts +7 -0
- package/Form/useControlValueState.js +15 -0
- package/Form/useCustomControlValue.d.ts +5 -0
- package/Form/useCustomControlValue.js +18 -0
- package/Form/useInputControlValue.d.ts +7 -0
- package/Form/useInputControlValue.js +24 -0
- package/Form/useInputWithClearControlValue.d.ts +6 -0
- package/Form/useInputWithClearControlValue.js +33 -0
- package/Form/useRadioControlValue.d.ts +11 -0
- package/Form/useRadioControlValue.js +24 -0
- package/Form/useSelectValueControl.d.ts +16 -0
- package/Form/useSelectValueControl.js +59 -0
- package/Form/useSwitchControlValue.d.ts +7 -0
- package/Form/useSwitchControlValue.js +24 -0
- package/Icon/Icon.d.ts +24 -0
- package/Icon/Icon.js +23 -0
- package/Icon/index.d.ts +3 -0
- package/Icon/index.js +1 -0
- package/Input/Input.d.ts +50 -0
- package/Input/Input.js +28 -0
- package/Input/index.d.ts +2 -0
- package/Input/index.js +1 -0
- package/LICENSE +21 -0
- package/Loading/Loading.d.ts +34 -0
- package/Loading/Loading.js +28 -0
- package/Loading/index.d.ts +1 -0
- package/Loading/index.js +1 -0
- package/Menu/Menu.d.ts +29 -0
- package/Menu/Menu.js +22 -0
- package/Menu/MenuDivider.d.ts +8 -0
- package/Menu/MenuDivider.js +14 -0
- package/Menu/MenuItem.d.ts +24 -0
- package/Menu/MenuItem.js +26 -0
- package/Menu/MenuItemGroup.d.ts +13 -0
- package/Menu/MenuItemGroup.js +15 -0
- package/Menu/index.d.ts +5 -0
- package/Menu/index.js +4 -0
- package/Message/Message.d.ts +33 -0
- package/Message/Message.js +59 -0
- package/Message/index.d.ts +2 -0
- package/Message/index.js +1 -0
- package/Modal/Modal.d.ts +42 -0
- package/Modal/Modal.js +75 -0
- package/Modal/ModalActions.d.ts +10 -0
- package/Modal/ModalActions.js +18 -0
- package/Modal/ModalBody.d.ts +8 -0
- package/Modal/ModalBody.js +14 -0
- package/Modal/ModalControl.d.ts +7 -0
- package/Modal/ModalControl.js +8 -0
- package/Modal/ModalFooter.d.ts +8 -0
- package/Modal/ModalFooter.js +14 -0
- package/Modal/ModalHeader.d.ts +20 -0
- package/Modal/ModalHeader.js +20 -0
- package/Modal/index.d.ts +6 -0
- package/Modal/index.js +5 -0
- package/Modal/useIsTopModal.d.ts +1 -0
- package/Modal/useIsTopModal.js +22 -0
- package/Navigation/Navigation.d.ts +29 -0
- package/Navigation/Navigation.js +48 -0
- package/Navigation/NavigationContext.d.ts +6 -0
- package/Navigation/NavigationContext.js +7 -0
- package/Navigation/NavigationItem.d.ts +31 -0
- package/Navigation/NavigationItem.js +22 -0
- package/Navigation/NavigationSubMenu.d.ts +17 -0
- package/Navigation/NavigationSubMenu.js +65 -0
- package/Navigation/index.d.ts +4 -0
- package/Navigation/index.js +4 -0
- package/Notification/Notification.d.ts +54 -0
- package/Notification/Notification.js +78 -0
- package/Notification/index.d.ts +2 -0
- package/Notification/index.js +1 -0
- package/Notifier/NotifierManager.d.ts +17 -0
- package/Notifier/NotifierManager.js +31 -0
- package/Notifier/createNotifier.d.ts +21 -0
- package/Notifier/createNotifier.js +67 -0
- package/Notifier/index.d.ts +2 -0
- package/Notifier/index.js +1 -0
- package/Notifier/typings.d.ts +28 -0
- package/Overlay/Overlay.d.ts +43 -0
- package/Overlay/Overlay.js +31 -0
- package/Overlay/index.d.ts +1 -0
- package/Overlay/index.js +1 -0
- package/PageFooter/PageFooter.d.ts +15 -0
- package/PageFooter/PageFooter.js +13 -0
- package/PageFooter/index.d.ts +1 -0
- package/PageFooter/index.js +1 -0
- package/Pagination/Pagination.d.ts +78 -0
- package/Pagination/Pagination.js +29 -0
- package/Pagination/PaginationItem.d.ts +27 -0
- package/Pagination/PaginationItem.js +25 -0
- package/Pagination/PaginationJumper.d.ts +38 -0
- package/Pagination/PaginationJumper.js +52 -0
- package/Pagination/index.d.ts +5 -0
- package/Pagination/index.js +4 -0
- package/Pagination/usePagination.d.ts +16 -0
- package/Pagination/usePagination.js +78 -0
- package/Picker/PickerTrigger.d.ts +40 -0
- package/Picker/PickerTrigger.js +15 -0
- package/Picker/RangePickerTrigger.d.ts +64 -0
- package/Picker/RangePickerTrigger.js +19 -0
- package/Picker/index.d.ts +7 -0
- package/Picker/index.js +7 -0
- package/Picker/usePickerDocumentEventClose.d.ts +10 -0
- package/Picker/usePickerDocumentEventClose.js +27 -0
- package/Picker/usePickerInputValue.d.ts +12 -0
- package/Picker/usePickerInputValue.js +24 -0
- package/Picker/usePickerValue.d.ts +21 -0
- package/Picker/usePickerValue.js +58 -0
- package/Picker/useRangePickerValue.d.ts +21 -0
- package/Picker/useRangePickerValue.js +94 -0
- package/Picker/useTabKeyClose.d.ts +2 -0
- package/Picker/useTabKeyClose.js +12 -0
- package/Popconfirm/Popconfirm.d.ts +16 -0
- package/Popconfirm/Popconfirm.js +15 -0
- package/Popconfirm/index.d.ts +1 -0
- package/Popconfirm/index.js +1 -0
- package/Popover/Popover.d.ts +23 -0
- package/Popover/Popover.js +45 -0
- package/Popover/index.d.ts +1 -0
- package/Popover/index.js +1 -0
- package/Popper/Popper.d.ts +32 -0
- package/Popper/Popper.js +30 -0
- package/Popper/index.d.ts +1 -0
- package/Popper/index.js +1 -0
- package/Portal/Portal.d.ts +20 -0
- package/Portal/Portal.js +22 -0
- package/Portal/index.d.ts +1 -0
- package/Portal/index.js +1 -0
- package/Progress/Progress.d.ts +59 -0
- package/Progress/Progress.js +32 -0
- package/Progress/index.d.ts +2 -0
- package/Progress/index.js +1 -0
- package/README.md +1 -0
- package/Radio/Radio.d.ts +41 -0
- package/Radio/Radio.js +31 -0
- package/Radio/RadioGroup.d.ts +47 -0
- package/Radio/RadioGroup.js +29 -0
- package/Radio/RadioGroupContext.d.ts +9 -0
- package/Radio/RadioGroupContext.js +5 -0
- package/Radio/index.d.ts +3 -0
- package/Radio/index.js +2 -0
- package/Select/AutoComplete.d.ts +75 -0
- package/Select/AutoComplete.js +108 -0
- package/Select/Option.d.ts +19 -0
- package/Select/Option.js +32 -0
- package/Select/Select.d.ts +57 -0
- package/Select/Select.js +145 -0
- package/Select/SelectControlContext.d.ts +3 -0
- package/Select/SelectControlContext.js +5 -0
- package/Select/SelectTrigger.d.ts +54 -0
- package/Select/SelectTrigger.js +27 -0
- package/Select/TreeSelect.d.ts +68 -0
- package/Select/TreeSelect.js +198 -0
- package/Select/index.d.ts +8 -0
- package/Select/index.js +7 -0
- package/Select/typings.d.ts +11 -0
- package/Skeleton/Skeleton.d.ts +22 -0
- package/Skeleton/Skeleton.js +14 -0
- package/Skeleton/index.d.ts +1 -0
- package/Skeleton/index.js +1 -0
- package/Slider/Slider.d.ts +51 -0
- package/Slider/Slider.js +172 -0
- package/Slider/index.d.ts +3 -0
- package/Slider/index.js +2 -0
- package/Slider/useSlider.d.ts +31 -0
- package/Slider/useSlider.js +104 -0
- package/Stepper/Step.d.ts +41 -0
- package/Stepper/Step.js +19 -0
- package/Stepper/Stepper.d.ts +19 -0
- package/Stepper/Stepper.js +33 -0
- package/Stepper/index.d.ts +2 -0
- package/Stepper/index.js +2 -0
- package/Switch/Switch.d.ts +43 -0
- package/Switch/Switch.js +29 -0
- package/Switch/index.d.ts +2 -0
- package/Switch/index.js +1 -0
- package/Table/Table.d.ts +79 -0
- package/Table/Table.js +111 -0
- package/Table/TableBody.d.ts +10 -0
- package/Table/TableBody.js +31 -0
- package/Table/TableBodyRow.d.ts +11 -0
- package/Table/TableBodyRow.js +63 -0
- package/Table/TableCell.d.ts +20 -0
- package/Table/TableCell.js +23 -0
- package/Table/TableContext.d.ts +46 -0
- package/Table/TableContext.js +7 -0
- package/Table/TableHeader.d.ts +3 -0
- package/Table/TableHeader.js +47 -0
- package/Table/editable/TableEditRenderWrapper.d.ts +8 -0
- package/Table/editable/TableEditRenderWrapper.js +15 -0
- package/Table/expandable/TableExpandable.d.ts +24 -0
- package/Table/expandable/TableExpandable.js +15 -0
- package/Table/index.d.ts +4 -0
- package/Table/index.js +3 -0
- package/Table/pagination/TablePagination.d.ts +10 -0
- package/Table/pagination/TablePagination.js +27 -0
- package/Table/pagination/useTablePagination.d.ts +16 -0
- package/Table/pagination/useTablePagination.js +49 -0
- package/Table/refresh/TableRefresh.d.ts +10 -0
- package/Table/refresh/TableRefresh.js +23 -0
- package/Table/rowSelection/TableRowSelection.d.ts +19 -0
- package/Table/rowSelection/TableRowSelection.js +86 -0
- package/Table/rowSelection/useTableRowSelection.d.ts +6 -0
- package/Table/rowSelection/useTableRowSelection.js +53 -0
- package/Table/sorting/TableSortingIcon.d.ts +11 -0
- package/Table/sorting/TableSortingIcon.js +28 -0
- package/Table/sorting/useTableSorting.d.ts +10 -0
- package/Table/sorting/useTableSorting.js +90 -0
- package/Table/useTableFetchMore.d.ts +10 -0
- package/Table/useTableFetchMore.js +50 -0
- package/Table/useTableLoading.d.ts +5 -0
- package/Table/useTableLoading.js +19 -0
- package/Table/useTableScroll.d.ts +272 -0
- package/Table/useTableScroll.js +170 -0
- package/Tabs/Tab.d.ts +19 -0
- package/Tabs/Tab.js +16 -0
- package/Tabs/TabPane.d.ts +14 -0
- package/Tabs/TabPane.js +18 -0
- package/Tabs/Tabs.d.ts +39 -0
- package/Tabs/Tabs.js +49 -0
- package/Tabs/index.d.ts +3 -0
- package/Tabs/index.js +3 -0
- package/Tabs/useTabsOverflow.d.ts +8 -0
- package/Tabs/useTabsOverflow.js +58 -0
- package/Tag/Tag.d.ts +29 -0
- package/Tag/Tag.js +23 -0
- package/Tag/index.d.ts +2 -0
- package/Tag/index.js +1 -0
- package/TextField/TextField.d.ts +54 -0
- package/TextField/TextField.js +39 -0
- package/TextField/index.d.ts +2 -0
- package/TextField/index.js +1 -0
- package/TextField/useTextFieldControl.d.ts +10 -0
- package/TextField/useTextFieldControl.js +15 -0
- package/Textarea/Textarea.d.ts +58 -0
- package/Textarea/Textarea.js +33 -0
- package/Textarea/index.d.ts +2 -0
- package/Textarea/index.js +1 -0
- package/TimePanel/TimePanel.d.ts +66 -0
- package/TimePanel/TimePanel.js +67 -0
- package/TimePanel/TimePanelAction.d.ts +18 -0
- package/TimePanel/TimePanelAction.js +15 -0
- package/TimePanel/TimePanelColumn.d.ts +37 -0
- package/TimePanel/TimePanelColumn.js +39 -0
- package/TimePanel/index.d.ts +3 -0
- package/TimePanel/index.js +3 -0
- package/TimePicker/TimePicker.d.ts +24 -0
- package/TimePicker/TimePicker.js +114 -0
- package/TimePicker/TimePickerPanel.d.ts +24 -0
- package/TimePicker/TimePickerPanel.js +14 -0
- package/TimePicker/index.d.ts +2 -0
- package/TimePicker/index.js +2 -0
- package/Tooltip/Tooltip.d.ts +25 -0
- package/Tooltip/Tooltip.js +37 -0
- package/Tooltip/index.d.ts +1 -0
- package/Tooltip/index.js +1 -0
- package/Tooltip/useDelayMouseEnterLeave.d.ts +12 -0
- package/Tooltip/useDelayMouseEnterLeave.js +41 -0
- package/Transition/Collapse.d.ts +15 -0
- package/Transition/Collapse.js +107 -0
- package/Transition/Fade.d.ts +8 -0
- package/Transition/Fade.js +84 -0
- package/Transition/Grow.d.ts +13 -0
- package/Transition/Grow.js +112 -0
- package/Transition/SlideFade.d.ts +15 -0
- package/Transition/SlideFade.js +93 -0
- package/Transition/Transition.d.ts +98 -0
- package/Transition/Transition.js +27 -0
- package/Transition/Zoom.d.ts +8 -0
- package/Transition/Zoom.js +84 -0
- package/Transition/getAutoSizeDuration.d.ts +1 -0
- package/Transition/getAutoSizeDuration.js +10 -0
- package/Transition/getTransitionStyleProps.d.ts +16 -0
- package/Transition/getTransitionStyleProps.js +25 -0
- package/Transition/index.d.ts +6 -0
- package/Transition/index.js +6 -0
- package/Transition/reflow.d.ts +4 -0
- package/Transition/reflow.js +9 -0
- package/Transition/useAutoTransitionDuration.d.ts +6 -0
- package/Transition/useAutoTransitionDuration.js +15 -0
- package/Transition/useSetNodeTransition.d.ts +7 -0
- package/Transition/useSetNodeTransition.js +35 -0
- package/Tree/Tree.d.ts +70 -0
- package/Tree/Tree.js +131 -0
- package/Tree/TreeNode.d.ts +41 -0
- package/Tree/TreeNode.js +41 -0
- package/Tree/TreeNodeList.d.ts +25 -0
- package/Tree/TreeNodeList.js +29 -0
- package/Tree/getTreeNodeEntities.d.ts +11 -0
- package/Tree/getTreeNodeEntities.js +86 -0
- package/Tree/index.d.ts +8 -0
- package/Tree/index.js +7 -0
- package/Tree/toggleValue.d.ts +4 -0
- package/Tree/toggleValue.js +19 -0
- package/Tree/traverseTree.d.ts +2 -0
- package/Tree/traverseTree.js +11 -0
- package/Tree/typings.d.ts +16 -0
- package/Tree/useTreeExpandedValue.d.ts +15 -0
- package/Tree/useTreeExpandedValue.js +32 -0
- package/Typography/Typography.d.ts +43 -0
- package/Typography/Typography.js +38 -0
- package/Typography/index.d.ts +11 -0
- package/Typography/index.js +2 -0
- package/Upload/UploadButton.d.ts +10 -0
- package/Upload/UploadButton.js +23 -0
- package/Upload/UploadInput.d.ts +21 -0
- package/Upload/UploadInput.js +22 -0
- package/Upload/UploadResult.d.ts +16 -0
- package/Upload/UploadResult.js +30 -0
- package/Upload/index.d.ts +3 -0
- package/Upload/index.js +2 -0
- package/_internal/InputCheck/InputCheck.d.ts +33 -0
- package/_internal/InputCheck/InputCheck.js +19 -0
- package/_internal/InputCheck/InputCheckGroup.d.ts +18 -0
- package/_internal/InputCheck/InputCheckGroup.js +14 -0
- package/_internal/InputCheck/index.d.ts +3 -0
- package/_internal/InputCheck/index.js +2 -0
- package/_internal/InputTriggerPopper/InputTriggerPopper.d.ts +18 -0
- package/_internal/InputTriggerPopper/InputTriggerPopper.js +44 -0
- package/_internal/InputTriggerPopper/index.d.ts +1 -0
- package/_internal/InputTriggerPopper/index.js +1 -0
- package/hooks/useClickAway.d.ts +5 -0
- package/hooks/useClickAway.js +23 -0
- package/hooks/useComposeRefs.d.ts +2 -0
- package/hooks/useComposeRefs.js +8 -0
- package/hooks/useDocumentEscapeKeyDown.d.ts +3 -0
- package/hooks/useDocumentEscapeKeyDown.js +20 -0
- package/hooks/useDocumentEvents.d.ts +5 -0
- package/hooks/useDocumentEvents.js +21 -0
- package/hooks/useDocumentTabKeyDown.d.ts +3 -0
- package/hooks/useDocumentTabKeyDown.js +19 -0
- package/hooks/useIsomorphicLayoutEffect.d.ts +2 -0
- package/hooks/useIsomorphicLayoutEffect.js +7 -0
- package/hooks/useLastCallback.d.ts +1 -0
- package/hooks/useLastCallback.js +11 -0
- package/hooks/useLastValue.d.ts +3 -0
- package/hooks/useLastValue.js +9 -0
- package/hooks/usePreviousValue.d.ts +1 -0
- package/hooks/usePreviousValue.js +11 -0
- package/hooks/useWindowWidth.d.ts +1 -0
- package/hooks/useWindowWidth.js +15 -0
- package/index.d.ts +100 -0
- package/index.js +148 -0
- package/package.json +61 -0
- package/utils/composeRefs.d.ts +21 -0
- package/utils/composeRefs.js +32 -0
- package/utils/cx.d.ts +1 -0
- package/utils/getElement.d.ts +3 -0
- package/utils/getElement.js +14 -0
- package/utils/jsx-types.d.ts +11 -0
- package/utils/rename-types.d.ts +5 -0
- package/utils/scroll-lock.d.ts +2 -0
- package/utils/scroll-lock.js +18 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useRef } from 'react';
|
|
3
|
+
import { tableClasses } from '@mezzanine-ui/core/table';
|
|
4
|
+
import Tooltip from '../Tooltip/Tooltip.js';
|
|
5
|
+
import cx from 'clsx';
|
|
6
|
+
|
|
7
|
+
const TableCell = forwardRef(function TableCell(props, ref) {
|
|
8
|
+
const { children, className, ellipsis = true, forceShownTooltipWhenHovered = false, role = 'gridcell', tooltipTitle, ...rest } = props;
|
|
9
|
+
const ellipsisRef = useRef(null);
|
|
10
|
+
return (jsx("div", Object.assign({ ref: ref }, rest, { className: cx(tableClasses.cell, className), role: role }, { children: ellipsis || forceShownTooltipWhenHovered ? (jsx(Tooltip, Object.assign({ title: `${tooltipTitle}`, options: {
|
|
11
|
+
placement: 'top-start',
|
|
12
|
+
} }, { children: ({ onMouseEnter, onMouseLeave }) => (jsx("div", Object.assign({ ref: ellipsisRef, className: ellipsis ? tableClasses.cellEllipsis : '', onMouseEnter: (e) => {
|
|
13
|
+
if (ellipsisRef.current) {
|
|
14
|
+
const { current: el } = ellipsisRef;
|
|
15
|
+
const isOverflow = forceShownTooltipWhenHovered || (el.scrollWidth > el.offsetWidth);
|
|
16
|
+
/** display tooltip only when content is overflow */
|
|
17
|
+
if (isOverflow)
|
|
18
|
+
onMouseEnter(e);
|
|
19
|
+
}
|
|
20
|
+
}, onMouseLeave: onMouseLeave }, { children: children }), void 0)) }), void 0)) : children }), void 0));
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export default TableCell;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TableRowSelection, TableColumn, TableExpandable, TablePagination, TableDataSource, TableRecord } from '@mezzanine-ui/core/table';
|
|
3
|
+
import { EmptyProps } from '../Empty';
|
|
4
|
+
/** typeof rowSelection */
|
|
5
|
+
export interface RowSelectionContext extends Pick<TableRowSelection, 'actions'> {
|
|
6
|
+
selectedRowKeys: string[];
|
|
7
|
+
onChange(v: string): void;
|
|
8
|
+
}
|
|
9
|
+
/** typeof sorting */
|
|
10
|
+
export interface SortingContext {
|
|
11
|
+
onSort(v: Pick<TableColumn<TableRecord<unknown>>, 'dataIndex' | 'sorter' | 'onSorted'>): void;
|
|
12
|
+
onResetAll(): void;
|
|
13
|
+
sortedOn: string;
|
|
14
|
+
sortedType: string;
|
|
15
|
+
}
|
|
16
|
+
/** typeof loading */
|
|
17
|
+
export interface LoadingContext {
|
|
18
|
+
setLoading(l: boolean): void;
|
|
19
|
+
}
|
|
20
|
+
/** typeof fetchMore */
|
|
21
|
+
export interface FetchMoreContext {
|
|
22
|
+
onFetchMore(): void;
|
|
23
|
+
isFetching: boolean;
|
|
24
|
+
isReachEnd: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface TableContextProps {
|
|
27
|
+
scrollBarSize?: number;
|
|
28
|
+
emptyProps?: EmptyProps;
|
|
29
|
+
rowSelection?: RowSelectionContext;
|
|
30
|
+
sorting?: SortingContext;
|
|
31
|
+
loading?: boolean;
|
|
32
|
+
setLoading?(l: boolean): void;
|
|
33
|
+
expanding?: TableExpandable<TableRecord<unknown>>;
|
|
34
|
+
fetchMore?: FetchMoreContext;
|
|
35
|
+
pagination?: TablePagination;
|
|
36
|
+
}
|
|
37
|
+
export declare const TableContext: import("react").Context<TableContextProps | null>;
|
|
38
|
+
export interface TableDataContextProps {
|
|
39
|
+
columns: TableColumn<TableRecord<unknown>>[];
|
|
40
|
+
dataSource: TableDataSource[];
|
|
41
|
+
}
|
|
42
|
+
export declare const TableDataContext: import("react").Context<TableDataContextProps | null>;
|
|
43
|
+
export interface TableComponentContextProps {
|
|
44
|
+
bodyCell?: any;
|
|
45
|
+
}
|
|
46
|
+
export declare const TableComponentContext: import("react").Context<TableComponentContextProps | null>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const TableHeader: import("react").ForwardRefExoticComponent<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
3
|
+
export default TableHeader;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useContext, useCallback } from 'react';
|
|
3
|
+
import { tableClasses } from '@mezzanine-ui/core/table';
|
|
4
|
+
import { TableContext, TableDataContext } from './TableContext.js';
|
|
5
|
+
import { SELECTED_ALL_KEY } from './rowSelection/useTableRowSelection.js';
|
|
6
|
+
import TableCell from './TableCell.js';
|
|
7
|
+
import TableRowSelection from './rowSelection/TableRowSelection.js';
|
|
8
|
+
import TableSortingIcon from './sorting/TableSortingIcon.js';
|
|
9
|
+
import TableExpandable from './expandable/TableExpandable.js';
|
|
10
|
+
import cx from 'clsx';
|
|
11
|
+
|
|
12
|
+
const TableHeader = forwardRef(function TableHeader(props, ref) {
|
|
13
|
+
const { className, ...rest } = props;
|
|
14
|
+
const { rowSelection, expanding, } = useContext(TableContext) || {};
|
|
15
|
+
const { columns, } = useContext(TableDataContext) || {};
|
|
16
|
+
/** styling */
|
|
17
|
+
const getColumnStyle = useCallback((column) => {
|
|
18
|
+
let style = {};
|
|
19
|
+
if (column.width) {
|
|
20
|
+
style = {
|
|
21
|
+
...style,
|
|
22
|
+
width: column.width,
|
|
23
|
+
maxWidth: column.width,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return style;
|
|
27
|
+
}, []);
|
|
28
|
+
const getCellStyle = useCallback((column) => {
|
|
29
|
+
let style = {};
|
|
30
|
+
if (column.align) {
|
|
31
|
+
style = {
|
|
32
|
+
...style,
|
|
33
|
+
justifyContent: column.align === 'center' ? column.align : `flex-${column.align}`,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return style;
|
|
37
|
+
}, []);
|
|
38
|
+
return (jsxs("div", Object.assign({ ref: ref }, rest, { className: cx(tableClasses.header, className), role: "rowgroup" }, { children: [rowSelection ? (jsx(TableRowSelection, { rowKey: SELECTED_ALL_KEY, showDropdownIcon: true }, void 0)) : null,
|
|
39
|
+
expanding && !rowSelection ? (jsx(TableExpandable, { showIcon: false }, void 0)) : null,
|
|
40
|
+
(columns !== null && columns !== void 0 ? columns : []).map((column) => {
|
|
41
|
+
var _a;
|
|
42
|
+
return (jsx("div", Object.assign({ className: cx(tableClasses.headerCellWrapper, column.headerClassName), style: getColumnStyle(column) }, { children: jsxs(TableCell, Object.assign({ ellipsis: false, role: "columnheader", style: getCellStyle(column) }, { children: [((_a = column.renderTitle) === null || _a === void 0 ? void 0 : _a.call(column, tableClasses)) || column.title,
|
|
43
|
+
typeof column.sorter === 'function' ? (jsx(TableSortingIcon, { column: column }, void 0)) : null] }), void 0) }), `${column.dataIndex}-${column.title}`));
|
|
44
|
+
})] }), void 0));
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export default TableHeader;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TableColumn, TableDataSource, TableRecord } from '@mezzanine-ui/core/table';
|
|
3
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../../utils/jsx-types';
|
|
4
|
+
export interface EditableBodyCellProps extends NativeElementPropsWithoutKeyAndRef<'div'>, TableColumn<TableRecord<unknown>> {
|
|
5
|
+
rowData: TableDataSource;
|
|
6
|
+
}
|
|
7
|
+
declare function TableEditRenderWrapper({ children, dataIndex, editable, rowData, setCellProps, ...rest }: EditableBodyCellProps): JSX.Element;
|
|
8
|
+
export default TableEditRenderWrapper;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useContext, Fragment } from 'react';
|
|
3
|
+
import { TableComponentContext } from '../TableContext.js';
|
|
4
|
+
|
|
5
|
+
function TableEditRenderWrapper({ children, dataIndex, editable, rowData, setCellProps, ...rest }) {
|
|
6
|
+
var _a;
|
|
7
|
+
const { bodyCell: BodyCell, } = useContext(TableComponentContext) || {};
|
|
8
|
+
const customProps = (_a = setCellProps === null || setCellProps === void 0 ? void 0 : setCellProps(rowData)) !== null && _a !== void 0 ? _a : {};
|
|
9
|
+
if (typeof BodyCell === 'function') {
|
|
10
|
+
return (jsx(BodyCell, Object.assign({}, customProps, rest, { dataIndex: dataIndex, editable: editable, rowData: rowData }, { children: children }), void 0));
|
|
11
|
+
}
|
|
12
|
+
return (jsx(Fragment, { children: children }, void 0));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default TableEditRenderWrapper;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../../utils/jsx-types';
|
|
3
|
+
export interface TableExpandableProps extends NativeElementPropsWithoutKeyAndRef<'div'> {
|
|
4
|
+
/**
|
|
5
|
+
* whether is expandable or not
|
|
6
|
+
* @default true
|
|
7
|
+
*/
|
|
8
|
+
expandable?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* whether is expanded or not
|
|
11
|
+
*/
|
|
12
|
+
expanded?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* toggle expanded
|
|
15
|
+
*/
|
|
16
|
+
setExpanded?(e: boolean): void;
|
|
17
|
+
/**
|
|
18
|
+
* show icon or not
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
showIcon?: boolean;
|
|
22
|
+
}
|
|
23
|
+
declare const TableExpandable: import("react").ForwardRefExoticComponent<TableExpandableProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
24
|
+
export default TableExpandable;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { tableClasses } from '@mezzanine-ui/core/table';
|
|
4
|
+
import { ChevronDownIcon } from '@mezzanine-ui/icons';
|
|
5
|
+
import Icon from '../../Icon/Icon.js';
|
|
6
|
+
import cx from 'clsx';
|
|
7
|
+
|
|
8
|
+
const TableExpandable = forwardRef(function TableExpandable(props, ref) {
|
|
9
|
+
const { className, expandable = true, expanded, setExpanded, showIcon = true, ...rest } = props;
|
|
10
|
+
return (jsx("div", Object.assign({}, rest, { ref: ref, className: cx(tableClasses.collapseAction, className) }, { children: jsx("div", Object.assign({ className: tableClasses.icon }, { children: showIcon ? (jsx(Icon, { className: cx(tableClasses.icon, {
|
|
11
|
+
[tableClasses.iconClickable]: expandable,
|
|
12
|
+
}), color: expandable ? 'primary' : 'disabled', icon: ChevronDownIcon, onClick: () => expandable && (setExpanded === null || setExpanded === void 0 ? void 0 : setExpanded(!expanded)), style: { transform: `rotate(${expanded ? '180deg' : '0'})` } }, void 0)) : null }), void 0) }), void 0));
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export default TableExpandable;
|
package/Table/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { TableProps, default, } from './Table';
|
|
2
|
+
export { TableRefreshProps, default as TableRefresh, } from './refresh/TableRefresh';
|
|
3
|
+
export { TableCellProps, default as TableCell, } from './TableCell';
|
|
4
|
+
export { EditableBodyCellProps, } from './editable/TableEditRenderWrapper';
|
package/Table/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../../utils/jsx-types';
|
|
3
|
+
export interface TablePaginationProps extends NativeElementPropsWithoutKeyAndRef<'div'> {
|
|
4
|
+
/**
|
|
5
|
+
* body scroll ref
|
|
6
|
+
*/
|
|
7
|
+
bodyRef: RefObject<HTMLDivElement>;
|
|
8
|
+
}
|
|
9
|
+
declare const TablePagination: import("react").ForwardRefExoticComponent<TablePaginationProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export default TablePagination;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useContext } from 'react';
|
|
3
|
+
import { tableClasses } from '@mezzanine-ui/core/table';
|
|
4
|
+
import { TableContext, TableDataContext } from '../TableContext.js';
|
|
5
|
+
import { useTablePagination } from './useTablePagination.js';
|
|
6
|
+
import Pagination from '../../Pagination/Pagination.js';
|
|
7
|
+
import cx from 'clsx';
|
|
8
|
+
|
|
9
|
+
const TablePagination = forwardRef(function TablePagination(props, ref) {
|
|
10
|
+
const { className, bodyRef, ...rest } = props;
|
|
11
|
+
const { pagination, } = useContext(TableContext) || {};
|
|
12
|
+
const { dataSource = [], } = useContext(TableDataContext) || {};
|
|
13
|
+
const [currentPage, setCurrentPage, options] = useTablePagination({
|
|
14
|
+
bodyRef,
|
|
15
|
+
current: pagination === null || pagination === void 0 ? void 0 : pagination.current,
|
|
16
|
+
dataSource,
|
|
17
|
+
onChange: pagination === null || pagination === void 0 ? void 0 : pagination.onChange,
|
|
18
|
+
options: pagination === null || pagination === void 0 ? void 0 : pagination.options,
|
|
19
|
+
total: pagination === null || pagination === void 0 ? void 0 : pagination.total,
|
|
20
|
+
});
|
|
21
|
+
const currentStartCount = (options.pageSize * (currentPage - 1)) + 1;
|
|
22
|
+
const currentEndCount = Math.min(options.pageSize * currentPage, options.total);
|
|
23
|
+
return (jsxs("div", Object.assign({}, rest, { ref: ref, className: cx(tableClasses.pagination, className) }, { children: [jsx("span", Object.assign({ className: tableClasses.paginationIndicator }, { children: `目前顯示 ${currentStartCount} - ${currentEndCount} 筆,共 ${options.total} 筆資料` }), void 0),
|
|
24
|
+
jsx("div", Object.assign({ className: tableClasses.paginationActions }, { children: jsx(Pagination, { boundaryCount: options.boundaryCount, className: options.className, current: currentPage, disabled: options.disabled, hideNextButton: options.hideNextButton, hidePreviousButton: options.hidePreviousButton, onChange: setCurrentPage, pageSize: options.pageSize, siblingCount: options.siblingCount, total: options.total }, void 0) }), void 0)] }), void 0));
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export default TablePagination;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { TablePagination, TableDataSource } from '@mezzanine-ui/core/table';
|
|
3
|
+
export interface UseTablePagination extends Omit<TablePagination, 'show'> {
|
|
4
|
+
bodyRef: RefObject<HTMLDivElement>;
|
|
5
|
+
dataSource: TableDataSource[];
|
|
6
|
+
}
|
|
7
|
+
export declare function useTablePagination(props: UseTablePagination): readonly [number, (c: number) => void, {
|
|
8
|
+
boundaryCount: number;
|
|
9
|
+
className: string | undefined;
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
hideNextButton: boolean;
|
|
12
|
+
hidePreviousButton: boolean;
|
|
13
|
+
pageSize: number;
|
|
14
|
+
siblingCount: number;
|
|
15
|
+
total: number;
|
|
16
|
+
}];
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useContext, useMemo } from 'react';
|
|
2
|
+
import { useControlValueState } from '../../Form/useControlValueState.js';
|
|
3
|
+
import { useLastCallback } from '../../hooks/useLastCallback.js';
|
|
4
|
+
import { TableContext } from '../TableContext.js';
|
|
5
|
+
|
|
6
|
+
const equalityFn = (a, b) => a === b;
|
|
7
|
+
function useTablePagination(props) {
|
|
8
|
+
const { bodyRef, current: currentProp, dataSource, onChange: onChangeProp, options: optionsProp, total: totalProp, } = props;
|
|
9
|
+
const { boundaryCount = 1, className, disabled = false, hideNextButton = false, hidePreviousButton = false, pageSize: pageSizeProp, siblingCount = 1, } = optionsProp || {};
|
|
10
|
+
const { sorting, } = useContext(TableContext) || {};
|
|
11
|
+
const [current, setCurrent] = useControlValueState({
|
|
12
|
+
defaultValue: 1,
|
|
13
|
+
equalityFn,
|
|
14
|
+
value: currentProp,
|
|
15
|
+
});
|
|
16
|
+
const onChange = useLastCallback((newCurrent) => {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
if (!equalityFn(current, newCurrent)) {
|
|
19
|
+
setCurrent(newCurrent);
|
|
20
|
+
/** reset body scroll position when page changed */
|
|
21
|
+
(_a = bodyRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo(0, 0);
|
|
22
|
+
/** reset sorting status */
|
|
23
|
+
(_b = sorting === null || sorting === void 0 ? void 0 : sorting.onResetAll) === null || _b === void 0 ? void 0 : _b.call(sorting);
|
|
24
|
+
}
|
|
25
|
+
onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(newCurrent);
|
|
26
|
+
});
|
|
27
|
+
const pageSize = useMemo(() => (pageSizeProp !== null && pageSizeProp !== void 0 ? pageSizeProp : dataSource.length), [pageSizeProp, dataSource.length]);
|
|
28
|
+
const total = useMemo(() => (totalProp !== null && totalProp !== void 0 ? totalProp : (dataSource.length / pageSize)), [totalProp, dataSource.length, pageSize]);
|
|
29
|
+
const defaultOptions = useMemo(() => ({
|
|
30
|
+
boundaryCount,
|
|
31
|
+
className,
|
|
32
|
+
disabled,
|
|
33
|
+
hideNextButton,
|
|
34
|
+
hidePreviousButton,
|
|
35
|
+
pageSize,
|
|
36
|
+
siblingCount,
|
|
37
|
+
total,
|
|
38
|
+
}), [
|
|
39
|
+
boundaryCount,
|
|
40
|
+
className,
|
|
41
|
+
disabled,
|
|
42
|
+
hideNextButton,
|
|
43
|
+
hidePreviousButton,
|
|
44
|
+
siblingCount,
|
|
45
|
+
]);
|
|
46
|
+
return [current, onChange, defaultOptions];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { useTablePagination };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MouseEvent } from 'react';
|
|
2
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../../utils/jsx-types';
|
|
3
|
+
export interface TableRefreshProps extends Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'onClick'> {
|
|
4
|
+
/**
|
|
5
|
+
* callback when button is clicked
|
|
6
|
+
*/
|
|
7
|
+
onClick?(e: MouseEvent): void;
|
|
8
|
+
}
|
|
9
|
+
declare const TableRefresh: import("react").ForwardRefExoticComponent<TableRefreshProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export default TableRefresh;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useContext, useCallback } from 'react';
|
|
3
|
+
import { tableClasses } from '@mezzanine-ui/core/table';
|
|
4
|
+
import { ResetIcon } from '@mezzanine-ui/icons';
|
|
5
|
+
import { TableContext } from '../TableContext.js';
|
|
6
|
+
import Button from '../../Button/Button.js';
|
|
7
|
+
import Icon from '../../Icon/Icon.js';
|
|
8
|
+
|
|
9
|
+
const TableRefresh = forwardRef(function TableRefresh(props, ref) {
|
|
10
|
+
const { className, children, onClick, ...rest } = props;
|
|
11
|
+
const { setLoading, } = useContext(TableContext) || {};
|
|
12
|
+
const onRefreshClicked = useCallback((e) => {
|
|
13
|
+
e.stopPropagation();
|
|
14
|
+
setLoading === null || setLoading === void 0 ? void 0 : setLoading(true);
|
|
15
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
16
|
+
}, [
|
|
17
|
+
onClick,
|
|
18
|
+
setLoading,
|
|
19
|
+
]);
|
|
20
|
+
return (jsx("div", Object.assign({ ref: ref, className: tableClasses.refresh }, rest, { children: jsx(Button, Object.assign({ onClick: onRefreshClicked, prefix: jsx(Icon, { icon: ResetIcon }, void 0) }, { children: children || '重新整理' }), void 0) }), void 0));
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export default TableRefresh;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../../utils/jsx-types';
|
|
3
|
+
export interface TableRowSelectionProps extends NativeElementPropsWithoutKeyAndRef<'div'> {
|
|
4
|
+
/**
|
|
5
|
+
* row key to control checkbox
|
|
6
|
+
*/
|
|
7
|
+
rowKey: string;
|
|
8
|
+
/**
|
|
9
|
+
* show dropdown icon or not
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
showDropdownIcon?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* function to get check status
|
|
15
|
+
*/
|
|
16
|
+
setChecked?(c: boolean): void;
|
|
17
|
+
}
|
|
18
|
+
declare const TableRowSelection: import("react").ForwardRefExoticComponent<TableRowSelectionProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
19
|
+
export default TableRowSelection;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useContext, useCallback, useMemo, useEffect, useState } from 'react';
|
|
3
|
+
import { tableClasses } from '@mezzanine-ui/core/table';
|
|
4
|
+
import { MoreVerticalIcon } from '@mezzanine-ui/icons';
|
|
5
|
+
import { TableContext, TableDataContext } from '../TableContext.js';
|
|
6
|
+
import { SELECTED_ALL_KEY } from './useTableRowSelection.js';
|
|
7
|
+
import Menu from '../../Menu/Menu.js';
|
|
8
|
+
import MenuItem from '../../Menu/MenuItem.js';
|
|
9
|
+
import Checkbox from '../../Checkbox/Checkbox.js';
|
|
10
|
+
import Dropdown from '../../Dropdown/Dropdown.js';
|
|
11
|
+
import Icon from '../../Icon/Icon.js';
|
|
12
|
+
import cx from 'clsx';
|
|
13
|
+
|
|
14
|
+
const TableRowSelection = forwardRef(function TableRowSelection(props, ref) {
|
|
15
|
+
var _a;
|
|
16
|
+
const { rowKey, setChecked, showDropdownIcon, ...rest } = props;
|
|
17
|
+
const { rowSelection, expanding, } = useContext(TableContext) || {};
|
|
18
|
+
const { dataSource = [], } = useContext(TableDataContext) || {};
|
|
19
|
+
/** checkbox methods/state */
|
|
20
|
+
const onSelected = useCallback(() => {
|
|
21
|
+
rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.onChange(rowKey);
|
|
22
|
+
}, [rowSelection, rowKey]);
|
|
23
|
+
const checkboxStatus = useMemo(() => {
|
|
24
|
+
var _a;
|
|
25
|
+
const selectedRowKeys = (_a = rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) !== null && _a !== void 0 ? _a : [];
|
|
26
|
+
if (!selectedRowKeys.length)
|
|
27
|
+
return 'none';
|
|
28
|
+
if (selectedRowKeys.length === dataSource.length)
|
|
29
|
+
return 'all';
|
|
30
|
+
return 'indeterminate';
|
|
31
|
+
}, [rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys, dataSource.length]);
|
|
32
|
+
const selfChecked = useMemo(() => {
|
|
33
|
+
var _a;
|
|
34
|
+
return (((_a = rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) !== null && _a !== void 0 ? _a : []).some((key) => key === rowKey));
|
|
35
|
+
}, [rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys, rowKey]);
|
|
36
|
+
/** checkbox props */
|
|
37
|
+
const isHeaderCheckbox = rowKey === SELECTED_ALL_KEY;
|
|
38
|
+
const checked = isHeaderCheckbox ? checkboxStatus === 'all' : selfChecked;
|
|
39
|
+
const indeterminate = isHeaderCheckbox ? checkboxStatus === 'indeterminate' : false;
|
|
40
|
+
const name = isHeaderCheckbox ? '選擇全部' : '選擇';
|
|
41
|
+
/** parent callbacks */
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
setChecked === null || setChecked === void 0 ? void 0 : setChecked(checked);
|
|
44
|
+
}, [checked, setChecked]);
|
|
45
|
+
/** If expandable icon existed, it will affect row selection styling (only when dropdown icon is hidden) */
|
|
46
|
+
const hiddenIconWithExpandableStyle = useMemo(() => {
|
|
47
|
+
if (!expanding || showDropdownIcon)
|
|
48
|
+
return {};
|
|
49
|
+
return {
|
|
50
|
+
host: {
|
|
51
|
+
paddingRight: 0,
|
|
52
|
+
},
|
|
53
|
+
icon: {
|
|
54
|
+
width: 0,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}, [showDropdownIcon, expanding]);
|
|
58
|
+
/** menu */
|
|
59
|
+
const [open, toggleOpen] = useState(false);
|
|
60
|
+
const isMenuAllowOpen = checked || indeterminate;
|
|
61
|
+
const onIconClicked = useCallback((evt) => {
|
|
62
|
+
evt.stopPropagation();
|
|
63
|
+
if (isMenuAllowOpen)
|
|
64
|
+
toggleOpen((prev) => !prev);
|
|
65
|
+
}, [isMenuAllowOpen]);
|
|
66
|
+
const onMenuItemClicked = (evt, action) => {
|
|
67
|
+
var _a;
|
|
68
|
+
evt.stopPropagation();
|
|
69
|
+
(_a = action.onClick) === null || _a === void 0 ? void 0 : _a.call(action, rowSelection.selectedRowKeys);
|
|
70
|
+
toggleOpen(false);
|
|
71
|
+
};
|
|
72
|
+
const actionMenu = (jsx(Menu, Object.assign({ size: "medium" }, { children: ((_a = rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.actions) !== null && _a !== void 0 ? _a : []).map(((action) => (jsx(MenuItem, Object.assign({ className: action.className, onClick: (evt) => onMenuItemClicked(evt, action) }, { children: action.text }), action.key)))) }), void 0));
|
|
73
|
+
return (jsxs("div", Object.assign({ ref: ref }, rest, { className: tableClasses.selections, style: hiddenIconWithExpandableStyle.host }, { children: [jsx(Checkbox, { checked: checked, disabled: false, indeterminate: indeterminate, inputProps: {
|
|
74
|
+
name,
|
|
75
|
+
}, onChange: onSelected, size: "medium" }, void 0),
|
|
76
|
+
jsx("div", Object.assign({ className: tableClasses.icon, style: hiddenIconWithExpandableStyle.icon }, { children: showDropdownIcon ? (jsx(Dropdown, Object.assign({ menu: actionMenu, onClose: () => toggleOpen(false), popperProps: {
|
|
77
|
+
open,
|
|
78
|
+
options: {
|
|
79
|
+
placement: 'bottom-start',
|
|
80
|
+
},
|
|
81
|
+
} }, { children: (dropdownRef) => (jsx(Icon, { ref: dropdownRef, className: cx(tableClasses.icon, {
|
|
82
|
+
[tableClasses.iconClickable]: isMenuAllowOpen,
|
|
83
|
+
}), color: isMenuAllowOpen ? 'primary' : 'disabled', icon: MoreVerticalIcon, onClick: onIconClicked }, void 0)) }), void 0)) : null }), void 0)] }), void 0));
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export default TableRowSelection;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TableRowSelection, TableDataSource } from '@mezzanine-ui/core/table';
|
|
2
|
+
export declare const SELECTED_ALL_KEY = "MZN-TABLE-ROW-SELECTION-ALL";
|
|
3
|
+
export interface UseTableRowSelection extends Omit<TableRowSelection, 'actions'> {
|
|
4
|
+
dataSource: TableDataSource[];
|
|
5
|
+
}
|
|
6
|
+
export declare function useTableRowSelection(props: UseTableRowSelection): readonly [string[], (v: string) => void];
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { useControlValueState } from '../../Form/useControlValueState.js';
|
|
2
|
+
import { useLastCallback } from '../../hooks/useLastCallback.js';
|
|
3
|
+
|
|
4
|
+
const equalityFn = (a, b) => {
|
|
5
|
+
const sortedA = a.sort();
|
|
6
|
+
const sortedB = b.sort();
|
|
7
|
+
return sortedA.length === sortedB.length && sortedA.every((v, idx) => v === sortedB[idx]);
|
|
8
|
+
};
|
|
9
|
+
const SELECTED_ALL_KEY = 'MZN-TABLE-ROW-SELECTION-ALL';
|
|
10
|
+
function useTableRowSelection(props) {
|
|
11
|
+
const { selectedRowKey: selectedRowKeyProp, onChange: onChangeProp, dataSource, } = props;
|
|
12
|
+
const [selectedRowKey, setSelectedRowKey] = useControlValueState({
|
|
13
|
+
defaultValue: [],
|
|
14
|
+
equalityFn,
|
|
15
|
+
value: selectedRowKeyProp,
|
|
16
|
+
});
|
|
17
|
+
const onChange = useLastCallback((rowKey) => {
|
|
18
|
+
if (!dataSource.length)
|
|
19
|
+
return;
|
|
20
|
+
const allSourceKeys = dataSource.map((source) => (source.key || source.id));
|
|
21
|
+
let nextSelectedRowKey = selectedRowKey;
|
|
22
|
+
if (rowKey === SELECTED_ALL_KEY) {
|
|
23
|
+
if (equalityFn(selectedRowKey, allSourceKeys)) {
|
|
24
|
+
nextSelectedRowKey = [];
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
nextSelectedRowKey = allSourceKeys;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
const existedRowKeyIdx = selectedRowKey.findIndex((key) => key === rowKey);
|
|
32
|
+
if (~existedRowKeyIdx) {
|
|
33
|
+
nextSelectedRowKey = [
|
|
34
|
+
...selectedRowKey.slice(0, existedRowKeyIdx),
|
|
35
|
+
...selectedRowKey.slice(existedRowKeyIdx + 1),
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
nextSelectedRowKey = [
|
|
40
|
+
...selectedRowKey,
|
|
41
|
+
rowKey,
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
setSelectedRowKey(nextSelectedRowKey);
|
|
46
|
+
if (onChangeProp) {
|
|
47
|
+
onChangeProp(nextSelectedRowKey);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return [selectedRowKey, onChange];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { SELECTED_ALL_KEY, useTableRowSelection };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TableColumn, TableRecord } from '@mezzanine-ui/core/table';
|
|
3
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../../utils/jsx-types';
|
|
4
|
+
export interface TableSortingIconProps extends NativeElementPropsWithoutKeyAndRef<'i'> {
|
|
5
|
+
/**
|
|
6
|
+
* current table column
|
|
7
|
+
*/
|
|
8
|
+
column: TableColumn<TableRecord<unknown>>;
|
|
9
|
+
}
|
|
10
|
+
declare const TableSortingIcon: import("react").ForwardRefExoticComponent<TableSortingIconProps & import("react").RefAttributes<HTMLElement>>;
|
|
11
|
+
export default TableSortingIcon;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useContext, useMemo } from 'react';
|
|
3
|
+
import { tableClasses } from '@mezzanine-ui/core/table';
|
|
4
|
+
import { ArrowRightIcon } from '@mezzanine-ui/icons';
|
|
5
|
+
import { TableContext } from '../TableContext.js';
|
|
6
|
+
import Icon from '../../Icon/Icon.js';
|
|
7
|
+
import cx from 'clsx';
|
|
8
|
+
|
|
9
|
+
const TableSortingIcon = forwardRef(function TableSortingIcon(props, ref) {
|
|
10
|
+
const { className, column, ...rest } = props;
|
|
11
|
+
const { sorting, } = useContext(TableContext) || {};
|
|
12
|
+
const { dataIndex, } = column;
|
|
13
|
+
/** styling */
|
|
14
|
+
const currentType = (dataIndex === (sorting === null || sorting === void 0 ? void 0 : sorting.sortedOn) ? sorting.sortedType : 'none');
|
|
15
|
+
const currentIconStyle = useMemo(() => ({
|
|
16
|
+
color: currentType === 'none' ? 'secondary' : 'primary',
|
|
17
|
+
style: {
|
|
18
|
+
transform: `rotate(${90 * (currentType === 'asc' ? -1 : 1)}deg)`,
|
|
19
|
+
},
|
|
20
|
+
}), [currentType]);
|
|
21
|
+
return (jsx(Icon, Object.assign({}, rest, { ref: ref, className: cx(tableClasses.icon, tableClasses.iconClickable, className), color: currentIconStyle.color, icon: ArrowRightIcon, onClick: (evt) => {
|
|
22
|
+
var _a;
|
|
23
|
+
evt.stopPropagation();
|
|
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 }), void 0));
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export default TableSortingIcon;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TableDataSource, TableColumn } from '@mezzanine-ui/core/table';
|
|
2
|
+
export interface UseTableSorting {
|
|
3
|
+
dataSource: TableDataSource[];
|
|
4
|
+
}
|
|
5
|
+
export declare type SortedType = 'desc' | 'asc' | 'none';
|
|
6
|
+
export declare function useTableSorting(props: UseTableSorting): readonly [TableDataSource[], (v: Pick<TableColumn<Record<string, unknown>>, "dataIndex" | "sorter" | "onSorted">) => void, {
|
|
7
|
+
readonly sortedOn: string;
|
|
8
|
+
readonly sortedType: SortedType;
|
|
9
|
+
readonly onResetAll: () => void;
|
|
10
|
+
}];
|