huibo-ui 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{a11y-802de67a.js → a11y-4385c871.js} +17 -2
- package/dist/cjs/a11y-4385c871.js.map +1 -0
- package/dist/cjs/{date-helpers-1ffddc59.js → date-helpers-c05ef385.js} +5 -16
- package/dist/cjs/date-helpers-c05ef385.js.map +1 -0
- package/dist/cjs/hb-alert.cjs.entry.js +2 -1
- package/dist/cjs/hb-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-calendar.cjs.entry.js +2 -2
- package/dist/cjs/hb-calendar.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-cascader.cjs.entry.js +48 -12
- package/dist/cjs/hb-cascader.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-checkbox-group.cjs.entry.js +12 -8
- package/dist/cjs/hb-checkbox-group.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-checkbox.cjs.entry.js +9 -4
- package/dist/cjs/hb-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-collapse-item.cjs.entry.js +13 -4
- package/dist/cjs/hb-collapse-item.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-collapse.cjs.entry.js +20 -15
- package/dist/cjs/hb-collapse.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-color-picker.cjs.entry.js +22 -19
- package/dist/cjs/hb-color-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-date-picker-pane.cjs.entry.js +1 -1
- package/dist/cjs/hb-date-picker.cjs.entry.js +13 -10
- package/dist/cjs/hb-date-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-date-range-picker.cjs.entry.js +1 -1
- package/dist/cjs/hb-date-time-picker.cjs.entry.js +1 -1
- package/dist/cjs/hb-descriptions.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-dialog.cjs.entry.js +51 -12
- package/dist/cjs/hb-dialog.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-drawer.cjs.entry.js +34 -4
- package/dist/cjs/hb-drawer.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-dropdown.cjs.entry.js +27 -15
- package/dist/cjs/hb-dropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-empty.cjs.entry.js +1 -1
- package/dist/cjs/hb-float-button.cjs.entry.js +2 -2
- package/dist/cjs/hb-form-item.cjs.entry.js +67 -16
- package/dist/cjs/hb-form-item.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-form.cjs.entry.js +115 -7
- package/dist/cjs/hb-form.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-image-preview.cjs.entry.js +1 -1
- package/dist/cjs/hb-image-preview.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-image.cjs.entry.js +21 -3
- package/dist/cjs/hb-image.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-input-number.cjs.entry.js +7 -7
- package/dist/cjs/hb-input-number.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-input-tag.cjs.entry.js +2 -2
- package/dist/cjs/hb-input.cjs.entry.js +3 -2
- package/dist/cjs/hb-input.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-layout.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-link.cjs.entry.js +2 -2
- package/dist/cjs/hb-loading.cjs.entry.js +2 -2
- package/dist/cjs/hb-menu-item.cjs.entry.js +14 -5
- package/dist/cjs/hb-menu-item.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-menu.cjs.entry.js +2 -2
- package/dist/cjs/hb-message.cjs.entry.js +13 -4
- package/dist/cjs/hb-message.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-page-header.cjs.entry.js +1 -1
- package/dist/cjs/hb-pagination.cjs.entry.js +8 -5
- package/dist/cjs/hb-pagination.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-popconfirm.cjs.entry.js +27 -8
- package/dist/cjs/hb-popconfirm.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-popover.cjs.entry.js +26 -14
- package/dist/cjs/hb-popover.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-progress.cjs.entry.js +1 -1
- package/dist/cjs/hb-radio.cjs.entry.js +8 -3
- package/dist/cjs/hb-radio.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-rate.cjs.entry.js +3 -3
- package/dist/cjs/hb-rate.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-row.cjs.entry.js +2 -2
- package/dist/cjs/hb-scrollbar.cjs.entry.js +5 -5
- package/dist/cjs/hb-scrollbar.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-segmented.cjs.entry.js +13 -2
- package/dist/cjs/hb-segmented.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-select.cjs.entry.js +100 -19
- package/dist/cjs/hb-select.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-slider.cjs.entry.js +6 -12
- package/dist/cjs/hb-slider.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-space.cjs.entry.js +2 -2
- package/dist/cjs/hb-statistic.cjs.entry.js +1 -1
- package/dist/cjs/hb-step.cjs.entry.js +1 -1
- package/dist/cjs/hb-steps.cjs.entry.js +3 -3
- package/dist/cjs/hb-steps.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-sub-menu.cjs.entry.js +5 -5
- package/dist/cjs/hb-switch.cjs.entry.js +3 -3
- package/dist/cjs/hb-switch.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-tab-pane.cjs.entry.js +1 -1
- package/dist/cjs/hb-table.cjs.entry.js +218 -41
- package/dist/cjs/hb-table.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-tabs.cjs.entry.js +31 -10
- package/dist/cjs/hb-tabs.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-tag.cjs.entry.js +3 -2
- package/dist/cjs/hb-tag.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-text.cjs.entry.js +2 -2
- package/dist/cjs/hb-time-picker.cjs.entry.js +14 -9
- package/dist/cjs/hb-time-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-time-select.cjs.entry.js +13 -4
- package/dist/cjs/hb-time-select.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-tooltip.cjs.entry.js +30 -10
- package/dist/cjs/hb-tooltip.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-tree-select.cjs.entry.js +125 -10
- package/dist/cjs/hb-tree-select.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-tree.cjs.entry.js +145 -12
- package/dist/cjs/hb-tree.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-watermark.cjs.entry.js +19 -11
- package/dist/cjs/hb-watermark.cjs.entry.js.map +1 -1
- package/dist/cjs/huibo-ui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/transition-59f1da0f.js +34 -0
- package/dist/cjs/transition-59f1da0f.js.map +1 -0
- package/dist/collection/components/Alert/Alert.js +2 -1
- package/dist/collection/components/Alert/Alert.js.map +1 -1
- package/dist/collection/components/Calendar/Calendar.js +2 -2
- package/dist/collection/components/Calendar/Calendar.js.map +1 -1
- package/dist/collection/components/Cascader/Cascader.js +47 -11
- package/dist/collection/components/Cascader/Cascader.js.map +1 -1
- package/dist/collection/components/Checkbox/Checkbox.js +9 -4
- package/dist/collection/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/collection/components/Checkbox/CheckboxGroup.js +12 -8
- package/dist/collection/components/Checkbox/CheckboxGroup.js.map +1 -1
- package/dist/collection/components/Collapse/Collapse.js +20 -15
- package/dist/collection/components/Collapse/Collapse.js.map +1 -1
- package/dist/collection/components/Collapse/CollapseItem.js +33 -4
- package/dist/collection/components/Collapse/CollapseItem.js.map +1 -1
- package/dist/collection/components/ColorPicker/ColorPicker.js +22 -19
- package/dist/collection/components/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/collection/components/ColorPicker/color-picker.css +8 -3
- package/dist/collection/components/DatePicker/DatePicker.js +12 -9
- package/dist/collection/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/collection/components/DatePicker/date-picker.css +3 -2
- package/dist/collection/components/Descriptions/descriptions.css +30 -10
- package/dist/collection/components/Dialog/Dialog.js +54 -10
- package/dist/collection/components/Dialog/Dialog.js.map +1 -1
- package/dist/collection/components/Dialog/dialog.css +57 -11
- package/dist/collection/components/Drawer/Drawer.js +34 -3
- package/dist/collection/components/Drawer/Drawer.js.map +1 -1
- package/dist/collection/components/Drawer/drawer.css +207 -17
- package/dist/collection/components/Dropdown/Dropdown.js +28 -13
- package/dist/collection/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/collection/components/Dropdown/dropdown.css +24 -2
- package/dist/collection/components/Empty/Empty.js +1 -1
- package/dist/collection/components/FloatButton/FloatButton.js +2 -2
- package/dist/collection/components/Form/Form.js +217 -9
- package/dist/collection/components/Form/Form.js.map +1 -1
- package/dist/collection/components/Form/FormItem.js +126 -18
- package/dist/collection/components/Form/FormItem.js.map +1 -1
- package/dist/collection/components/Form/form-item.css +8 -2
- package/dist/collection/components/Image/Image.js +24 -3
- package/dist/collection/components/Image/Image.js.map +1 -1
- package/dist/collection/components/ImagePreview/ImagePreview.js +1 -1
- package/dist/collection/components/ImagePreview/ImagePreview.js.map +1 -1
- package/dist/collection/components/Input/Input.js +3 -2
- package/dist/collection/components/Input/Input.js.map +1 -1
- package/dist/collection/components/Input/input.css +1 -2
- package/dist/collection/components/InputNumber/InputNumber.js +6 -6
- package/dist/collection/components/InputNumber/InputNumber.js.map +1 -1
- package/dist/collection/components/InputNumber/input-number.css +11 -1
- package/dist/collection/components/InputTag/InputTag.js +2 -2
- package/dist/collection/components/Layout/Layout.js.map +1 -1
- package/dist/collection/components/Layout/Row.js +2 -2
- package/dist/collection/components/Layout/layout.css +1713 -576
- package/dist/collection/components/Link/Link.js +2 -2
- package/dist/collection/components/Loading/Loading.js +2 -2
- package/dist/collection/components/Menu/Menu.js +2 -2
- package/dist/collection/components/Menu/MenuItem.js +34 -5
- package/dist/collection/components/Menu/MenuItem.js.map +1 -1
- package/dist/collection/components/Menu/SubMenu.js +4 -4
- package/dist/collection/components/Message/Message.js +13 -4
- package/dist/collection/components/Message/Message.js.map +1 -1
- package/dist/collection/components/PageHeader/PageHeader.js +1 -1
- package/dist/collection/components/Pagination/Pagination.js +8 -5
- package/dist/collection/components/Pagination/Pagination.js.map +1 -1
- package/dist/collection/components/Popconfirm/Popconfirm.js +28 -6
- package/dist/collection/components/Popconfirm/Popconfirm.js.map +1 -1
- package/dist/collection/components/Popconfirm/popconfirm.css +80 -16
- package/dist/collection/components/Popover/Popover.js +27 -12
- package/dist/collection/components/Popover/Popover.js.map +1 -1
- package/dist/collection/components/Popover/popover.css +49 -8
- package/dist/collection/components/Progress/Progress.js +1 -1
- package/dist/collection/components/Radio/Radio.js +8 -3
- package/dist/collection/components/Radio/Radio.js.map +1 -1
- package/dist/collection/components/Rate/Rate.js +3 -3
- package/dist/collection/components/Rate/Rate.js.map +1 -1
- package/dist/collection/components/Scrollbar/Scrollbar.js +5 -5
- package/dist/collection/components/Scrollbar/Scrollbar.js.map +1 -1
- package/dist/collection/components/Segmented/Segmented.js +15 -1
- package/dist/collection/components/Segmented/Segmented.js.map +1 -1
- package/dist/collection/components/Select/Select.js +123 -19
- package/dist/collection/components/Select/Select.js.map +1 -1
- package/dist/collection/components/Select/select.css +0 -1
- package/dist/collection/components/Slider/Slider.js +6 -12
- package/dist/collection/components/Slider/Slider.js.map +1 -1
- package/dist/collection/components/Slider/slider.css +0 -1
- package/dist/collection/components/Space/Space.js +2 -2
- package/dist/collection/components/Statistic/Statistic.js +1 -1
- package/dist/collection/components/Steps/Step.js +1 -1
- package/dist/collection/components/Steps/Steps.js +2 -2
- package/dist/collection/components/Steps/Steps.js.map +1 -1
- package/dist/collection/components/Switch/Switch.js +3 -3
- package/dist/collection/components/Switch/Switch.js.map +1 -1
- package/dist/collection/components/Switch/switch.css +3 -2
- package/dist/collection/components/Table/Table.js +296 -41
- package/dist/collection/components/Table/Table.js.map +1 -1
- package/dist/collection/components/Table/table.css +6 -2
- package/dist/collection/components/Tabs/TabPane.js +1 -1
- package/dist/collection/components/Tabs/Tabs.js +31 -10
- package/dist/collection/components/Tabs/Tabs.js.map +1 -1
- package/dist/collection/components/Tag/Tag.js +3 -2
- package/dist/collection/components/Tag/Tag.js.map +1 -1
- package/dist/collection/components/Text/Text.js +2 -2
- package/dist/collection/components/TimePicker/TimePicker.js +14 -9
- package/dist/collection/components/TimePicker/TimePicker.js.map +1 -1
- package/dist/collection/components/TimeSelect/TimeSelect.js +13 -4
- package/dist/collection/components/TimeSelect/TimeSelect.js.map +1 -1
- package/dist/collection/components/Tooltip/Tooltip.js +31 -8
- package/dist/collection/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/collection/components/Tooltip/tooltip.css +24 -2
- package/dist/collection/components/Tree/Tree.js +147 -13
- package/dist/collection/components/Tree/Tree.js.map +1 -1
- package/dist/collection/components/TreeSelect/TreeSelect.js +130 -11
- package/dist/collection/components/TreeSelect/TreeSelect.js.map +1 -1
- package/dist/collection/components/Watermark/Watermark.js +19 -11
- package/dist/collection/components/Watermark/Watermark.js.map +1 -1
- package/dist/collection/utils/a11y.js +15 -1
- package/dist/collection/utils/a11y.js.map +1 -1
- package/dist/collection/utils/date-helpers.js +4 -15
- package/dist/collection/utils/date-helpers.js.map +1 -1
- package/dist/collection/utils/transition.js +29 -0
- package/dist/collection/utils/transition.js.map +1 -0
- package/dist/collection/utils/virtual-scroll.js +39 -0
- package/dist/collection/utils/virtual-scroll.js.map +1 -0
- package/dist/components/hb-alert.js +2 -1
- package/dist/components/hb-alert.js.map +1 -1
- package/dist/components/hb-calendar.js +2 -2
- package/dist/components/hb-calendar.js.map +1 -1
- package/dist/components/hb-cascader.js +48 -12
- package/dist/components/hb-cascader.js.map +1 -1
- package/dist/components/hb-checkbox-group.js +12 -8
- package/dist/components/hb-checkbox-group.js.map +1 -1
- package/dist/components/hb-checkbox.js +9 -4
- package/dist/components/hb-checkbox.js.map +1 -1
- package/dist/components/hb-collapse-item.js +14 -4
- package/dist/components/hb-collapse-item.js.map +1 -1
- package/dist/components/hb-collapse.js +20 -15
- package/dist/components/hb-collapse.js.map +1 -1
- package/dist/components/hb-color-picker.js +22 -19
- package/dist/components/hb-color-picker.js.map +1 -1
- package/dist/components/hb-date-picker-pane.js +1 -1
- package/dist/components/hb-date-picker.js +13 -10
- package/dist/components/hb-date-picker.js.map +1 -1
- package/dist/components/hb-date-range-picker.js +1 -1
- package/dist/components/hb-date-time-picker.js +1 -1
- package/dist/components/hb-descriptions.js.map +1 -1
- package/dist/components/hb-dialog.js +53 -13
- package/dist/components/hb-dialog.js.map +1 -1
- package/dist/components/hb-drawer.js +36 -5
- package/dist/components/hb-drawer.js.map +1 -1
- package/dist/components/hb-dropdown.js +28 -15
- package/dist/components/hb-dropdown.js.map +1 -1
- package/dist/components/hb-empty.js +1 -1
- package/dist/components/hb-float-button.js +2 -2
- package/dist/components/hb-form-item.js +70 -16
- package/dist/components/hb-form-item.js.map +1 -1
- package/dist/components/hb-form.js +120 -7
- package/dist/components/hb-form.js.map +1 -1
- package/dist/components/hb-image-preview.js +1 -1
- package/dist/components/hb-image-preview.js.map +1 -1
- package/dist/components/hb-image.js +23 -3
- package/dist/components/hb-image.js.map +1 -1
- package/dist/components/hb-input-number.js +7 -7
- package/dist/components/hb-input-number.js.map +1 -1
- package/dist/components/hb-input-tag.js +2 -2
- package/dist/components/hb-input.js +3 -2
- package/dist/components/hb-input.js.map +1 -1
- package/dist/components/hb-layout.js.map +1 -1
- package/dist/components/hb-link.js +2 -2
- package/dist/components/hb-loading.js +2 -2
- package/dist/components/hb-menu-item.js +15 -5
- package/dist/components/hb-menu-item.js.map +1 -1
- package/dist/components/hb-menu.js +2 -2
- package/dist/components/hb-message.js +13 -4
- package/dist/components/hb-message.js.map +1 -1
- package/dist/components/hb-page-header.js +1 -1
- package/dist/components/hb-pagination.js +8 -5
- package/dist/components/hb-pagination.js.map +1 -1
- package/dist/components/hb-popconfirm.js +28 -8
- package/dist/components/hb-popconfirm.js.map +1 -1
- package/dist/components/hb-popover.js +27 -14
- package/dist/components/hb-popover.js.map +1 -1
- package/dist/components/hb-progress.js +1 -1
- package/dist/components/hb-radio.js +8 -3
- package/dist/components/hb-radio.js.map +1 -1
- package/dist/components/hb-rate.js +3 -3
- package/dist/components/hb-rate.js.map +1 -1
- package/dist/components/hb-row.js +2 -2
- package/dist/components/hb-scrollbar.js +5 -5
- package/dist/components/hb-scrollbar.js.map +1 -1
- package/dist/components/hb-segmented.js +15 -2
- package/dist/components/hb-segmented.js.map +1 -1
- package/dist/components/hb-select.js +105 -20
- package/dist/components/hb-select.js.map +1 -1
- package/dist/components/hb-slider.js +6 -12
- package/dist/components/hb-slider.js.map +1 -1
- package/dist/components/hb-space.js +2 -2
- package/dist/components/hb-statistic.js +1 -1
- package/dist/components/hb-step.js +1 -1
- package/dist/components/hb-steps.js +3 -3
- package/dist/components/hb-steps.js.map +1 -1
- package/dist/components/hb-sub-menu.js +5 -5
- package/dist/components/hb-switch.js +3 -3
- package/dist/components/hb-switch.js.map +1 -1
- package/dist/components/hb-tab-pane.js +1 -1
- package/dist/components/hb-table.js +226 -43
- package/dist/components/hb-table.js.map +1 -1
- package/dist/components/hb-tabs.js +31 -10
- package/dist/components/hb-tabs.js.map +1 -1
- package/dist/components/hb-tag.js +3 -2
- package/dist/components/hb-tag.js.map +1 -1
- package/dist/components/hb-text.js +2 -2
- package/dist/components/hb-time-picker.js +14 -9
- package/dist/components/hb-time-picker.js.map +1 -1
- package/dist/components/hb-time-select.js +13 -4
- package/dist/components/hb-time-select.js.map +1 -1
- package/dist/components/hb-tooltip.js +31 -10
- package/dist/components/hb-tooltip.js.map +1 -1
- package/dist/components/hb-tree-select.js +129 -11
- package/dist/components/hb-tree-select.js.map +1 -1
- package/dist/components/hb-tree.js +147 -13
- package/dist/components/hb-tree.js.map +1 -1
- package/dist/components/hb-watermark.js +19 -11
- package/dist/components/hb-watermark.js.map +1 -1
- package/dist/{esm/a11y-f9ab2964.js → components/p-00aa34c8.js} +17 -3
- package/dist/components/p-00aa34c8.js.map +1 -0
- package/dist/components/{p-08b4005c.js → p-e0876aca.js} +5 -16
- package/dist/components/p-e0876aca.js.map +1 -0
- package/dist/components/p-fad66d69.js +32 -0
- package/dist/components/p-fad66d69.js.map +1 -0
- package/dist/{components/p-cc0aeb50.js → esm/a11y-e4cde5b0.js} +17 -3
- package/dist/esm/a11y-e4cde5b0.js.map +1 -0
- package/dist/esm/{date-helpers-44507189.js → date-helpers-259ed2f1.js} +5 -16
- package/dist/esm/date-helpers-259ed2f1.js.map +1 -0
- package/dist/esm/hb-alert.entry.js +2 -1
- package/dist/esm/hb-alert.entry.js.map +1 -1
- package/dist/esm/hb-calendar.entry.js +2 -2
- package/dist/esm/hb-calendar.entry.js.map +1 -1
- package/dist/esm/hb-cascader.entry.js +48 -12
- package/dist/esm/hb-cascader.entry.js.map +1 -1
- package/dist/esm/hb-checkbox-group.entry.js +12 -8
- package/dist/esm/hb-checkbox-group.entry.js.map +1 -1
- package/dist/esm/hb-checkbox.entry.js +9 -4
- package/dist/esm/hb-checkbox.entry.js.map +1 -1
- package/dist/esm/hb-collapse-item.entry.js +13 -4
- package/dist/esm/hb-collapse-item.entry.js.map +1 -1
- package/dist/esm/hb-collapse.entry.js +20 -15
- package/dist/esm/hb-collapse.entry.js.map +1 -1
- package/dist/esm/hb-color-picker.entry.js +22 -19
- package/dist/esm/hb-color-picker.entry.js.map +1 -1
- package/dist/esm/hb-date-picker-pane.entry.js +1 -1
- package/dist/esm/hb-date-picker.entry.js +13 -10
- package/dist/esm/hb-date-picker.entry.js.map +1 -1
- package/dist/esm/hb-date-range-picker.entry.js +1 -1
- package/dist/esm/hb-date-time-picker.entry.js +1 -1
- package/dist/esm/hb-descriptions.entry.js.map +1 -1
- package/dist/esm/hb-dialog.entry.js +51 -12
- package/dist/esm/hb-dialog.entry.js.map +1 -1
- package/dist/esm/hb-drawer.entry.js +34 -4
- package/dist/esm/hb-drawer.entry.js.map +1 -1
- package/dist/esm/hb-dropdown.entry.js +27 -15
- package/dist/esm/hb-dropdown.entry.js.map +1 -1
- package/dist/esm/hb-empty.entry.js +1 -1
- package/dist/esm/hb-float-button.entry.js +2 -2
- package/dist/esm/hb-form-item.entry.js +67 -16
- package/dist/esm/hb-form-item.entry.js.map +1 -1
- package/dist/esm/hb-form.entry.js +115 -7
- package/dist/esm/hb-form.entry.js.map +1 -1
- package/dist/esm/hb-image-preview.entry.js +1 -1
- package/dist/esm/hb-image-preview.entry.js.map +1 -1
- package/dist/esm/hb-image.entry.js +21 -3
- package/dist/esm/hb-image.entry.js.map +1 -1
- package/dist/esm/hb-input-number.entry.js +7 -7
- package/dist/esm/hb-input-number.entry.js.map +1 -1
- package/dist/esm/hb-input-tag.entry.js +2 -2
- package/dist/esm/hb-input.entry.js +3 -2
- package/dist/esm/hb-input.entry.js.map +1 -1
- package/dist/esm/hb-layout.entry.js.map +1 -1
- package/dist/esm/hb-link.entry.js +2 -2
- package/dist/esm/hb-loading.entry.js +2 -2
- package/dist/esm/hb-menu-item.entry.js +14 -5
- package/dist/esm/hb-menu-item.entry.js.map +1 -1
- package/dist/esm/hb-menu.entry.js +2 -2
- package/dist/esm/hb-message.entry.js +13 -4
- package/dist/esm/hb-message.entry.js.map +1 -1
- package/dist/esm/hb-page-header.entry.js +1 -1
- package/dist/esm/hb-pagination.entry.js +8 -5
- package/dist/esm/hb-pagination.entry.js.map +1 -1
- package/dist/esm/hb-popconfirm.entry.js +27 -8
- package/dist/esm/hb-popconfirm.entry.js.map +1 -1
- package/dist/esm/hb-popover.entry.js +26 -14
- package/dist/esm/hb-popover.entry.js.map +1 -1
- package/dist/esm/hb-progress.entry.js +1 -1
- package/dist/esm/hb-radio.entry.js +8 -3
- package/dist/esm/hb-radio.entry.js.map +1 -1
- package/dist/esm/hb-rate.entry.js +3 -3
- package/dist/esm/hb-rate.entry.js.map +1 -1
- package/dist/esm/hb-row.entry.js +2 -2
- package/dist/esm/hb-scrollbar.entry.js +5 -5
- package/dist/esm/hb-scrollbar.entry.js.map +1 -1
- package/dist/esm/hb-segmented.entry.js +13 -2
- package/dist/esm/hb-segmented.entry.js.map +1 -1
- package/dist/esm/hb-select.entry.js +100 -19
- package/dist/esm/hb-select.entry.js.map +1 -1
- package/dist/esm/hb-slider.entry.js +6 -12
- package/dist/esm/hb-slider.entry.js.map +1 -1
- package/dist/esm/hb-space.entry.js +2 -2
- package/dist/esm/hb-statistic.entry.js +1 -1
- package/dist/esm/hb-step.entry.js +1 -1
- package/dist/esm/hb-steps.entry.js +3 -3
- package/dist/esm/hb-steps.entry.js.map +1 -1
- package/dist/esm/hb-sub-menu.entry.js +5 -5
- package/dist/esm/hb-switch.entry.js +3 -3
- package/dist/esm/hb-switch.entry.js.map +1 -1
- package/dist/esm/hb-tab-pane.entry.js +1 -1
- package/dist/esm/hb-table.entry.js +218 -41
- package/dist/esm/hb-table.entry.js.map +1 -1
- package/dist/esm/hb-tabs.entry.js +31 -10
- package/dist/esm/hb-tabs.entry.js.map +1 -1
- package/dist/esm/hb-tag.entry.js +3 -2
- package/dist/esm/hb-tag.entry.js.map +1 -1
- package/dist/esm/hb-text.entry.js +2 -2
- package/dist/esm/hb-time-picker.entry.js +14 -9
- package/dist/esm/hb-time-picker.entry.js.map +1 -1
- package/dist/esm/hb-time-select.entry.js +13 -4
- package/dist/esm/hb-time-select.entry.js.map +1 -1
- package/dist/esm/hb-tooltip.entry.js +30 -10
- package/dist/esm/hb-tooltip.entry.js.map +1 -1
- package/dist/esm/hb-tree-select.entry.js +125 -10
- package/dist/esm/hb-tree-select.entry.js.map +1 -1
- package/dist/esm/hb-tree.entry.js +145 -12
- package/dist/esm/hb-tree.entry.js.map +1 -1
- package/dist/esm/hb-watermark.entry.js +19 -11
- package/dist/esm/hb-watermark.entry.js.map +1 -1
- package/dist/esm/huibo-ui.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/transition-4295d789.js +32 -0
- package/dist/esm/transition-4295d789.js.map +1 -0
- package/dist/huibo-ui/huibo-ui.esm.js +1 -1
- package/dist/huibo-ui/huibo-ui.esm.js.map +1 -1
- package/dist/huibo-ui/p-00aa34c8.js +2 -0
- package/dist/huibo-ui/p-00aa34c8.js.map +1 -0
- package/dist/huibo-ui/p-0cc1e3f3.entry.js +2 -0
- package/dist/huibo-ui/p-0cc1e3f3.entry.js.map +1 -0
- package/dist/huibo-ui/{p-678b4212.entry.js → p-0ddae4e9.entry.js} +2 -2
- package/dist/huibo-ui/p-10f6c184.entry.js.map +1 -1
- package/dist/huibo-ui/{p-f4336be9.entry.js → p-14c3b47b.entry.js} +2 -2
- package/dist/huibo-ui/{p-c50ad398.entry.js → p-193efdc0.entry.js} +2 -2
- package/dist/huibo-ui/{p-735bceef.entry.js → p-1b98152b.entry.js} +2 -2
- package/dist/huibo-ui/p-1b98152b.entry.js.map +1 -0
- package/dist/huibo-ui/p-1f6d0adb.entry.js +2 -0
- package/dist/huibo-ui/p-1f6d0adb.entry.js.map +1 -0
- package/dist/huibo-ui/{p-0d4b2997.entry.js → p-2bcda1bb.entry.js} +2 -2
- package/dist/huibo-ui/{p-b8d87f7e.entry.js → p-2ca9796a.entry.js} +2 -2
- package/dist/huibo-ui/p-2ca9796a.entry.js.map +1 -0
- package/dist/huibo-ui/{p-c80f8ace.entry.js → p-2cf5bf20.entry.js} +2 -2
- package/dist/huibo-ui/p-2cf5bf20.entry.js.map +1 -0
- package/dist/huibo-ui/{p-7da14d7c.entry.js → p-3042f986.entry.js} +2 -2
- package/dist/huibo-ui/{p-e039155d.entry.js → p-3dacb26b.entry.js} +2 -2
- package/dist/huibo-ui/{p-a084b8e5.entry.js → p-412ff618.entry.js} +2 -2
- package/dist/huibo-ui/p-4148d875.entry.js +2 -0
- package/dist/huibo-ui/p-4148d875.entry.js.map +1 -0
- package/dist/huibo-ui/{p-6beb5b81.entry.js → p-415295f3.entry.js} +2 -2
- package/dist/huibo-ui/p-415295f3.entry.js.map +1 -0
- package/dist/huibo-ui/p-494e6c25.entry.js +2 -0
- package/dist/huibo-ui/p-494e6c25.entry.js.map +1 -0
- package/dist/huibo-ui/p-4d87d7f4.entry.js +2 -0
- package/dist/huibo-ui/p-4d87d7f4.entry.js.map +1 -0
- package/dist/huibo-ui/p-5e253c15.entry.js +2 -0
- package/dist/huibo-ui/p-5e253c15.entry.js.map +1 -0
- package/dist/huibo-ui/p-63d68c61.entry.js +2 -0
- package/dist/huibo-ui/p-63d68c61.entry.js.map +1 -0
- package/dist/huibo-ui/{p-ccd09d5a.entry.js → p-6518c435.entry.js} +2 -2
- package/dist/huibo-ui/{p-1f8db37a.entry.js → p-687d8dff.entry.js} +2 -2
- package/dist/huibo-ui/p-687d8dff.entry.js.map +1 -0
- package/dist/huibo-ui/p-688460ce.entry.js +2 -0
- package/dist/huibo-ui/p-688460ce.entry.js.map +1 -0
- package/dist/huibo-ui/p-69bb1dd9.entry.js +2 -0
- package/dist/huibo-ui/p-69bb1dd9.entry.js.map +1 -0
- package/dist/huibo-ui/{p-2811e603.entry.js → p-6bfe1954.entry.js} +2 -2
- package/dist/huibo-ui/p-6bfe1954.entry.js.map +1 -0
- package/dist/huibo-ui/{p-e5cbfa9e.entry.js → p-6c23fbd1.entry.js} +2 -2
- package/dist/huibo-ui/p-6c23fbd1.entry.js.map +1 -0
- package/dist/huibo-ui/p-6c8cf248.entry.js.map +1 -1
- package/dist/huibo-ui/p-6efed295.entry.js +2 -0
- package/dist/huibo-ui/p-6efed295.entry.js.map +1 -0
- package/dist/huibo-ui/p-7a38b3e2.entry.js +2 -0
- package/dist/huibo-ui/p-7a38b3e2.entry.js.map +1 -0
- package/dist/huibo-ui/{p-cad57c2d.entry.js → p-7a682c56.entry.js} +2 -2
- package/dist/huibo-ui/{p-a8996d22.entry.js → p-815fc943.entry.js} +2 -2
- package/dist/huibo-ui/{p-af74667d.entry.js → p-89be7973.entry.js} +2 -2
- package/dist/huibo-ui/p-8a202bc5.entry.js.map +1 -1
- package/dist/huibo-ui/{p-213b9de7.entry.js → p-8c4415ed.entry.js} +2 -2
- package/dist/huibo-ui/p-8c4415ed.entry.js.map +1 -0
- package/dist/huibo-ui/{p-8fdbd17c.entry.js → p-950e7465.entry.js} +2 -2
- package/dist/huibo-ui/{p-ab9cf0e4.entry.js → p-96cecd21.entry.js} +2 -2
- package/dist/huibo-ui/p-96cecd21.entry.js.map +1 -0
- package/dist/huibo-ui/{p-2b4556ff.entry.js → p-98b513cd.entry.js} +2 -2
- package/dist/huibo-ui/p-98b513cd.entry.js.map +1 -0
- package/dist/huibo-ui/{p-89ea1141.entry.js → p-ac45291c.entry.js} +2 -2
- package/dist/huibo-ui/{p-e10fcfbe.entry.js → p-b105cf76.entry.js} +2 -2
- package/dist/huibo-ui/p-b105cf76.entry.js.map +1 -0
- package/dist/huibo-ui/{p-9a5406f0.entry.js → p-b38802b0.entry.js} +2 -2
- package/dist/huibo-ui/{p-9a5406f0.entry.js.map → p-b38802b0.entry.js.map} +1 -1
- package/dist/huibo-ui/{p-ea74fcae.entry.js → p-b3fd12c7.entry.js} +2 -2
- package/dist/huibo-ui/p-b3fd12c7.entry.js.map +1 -0
- package/dist/huibo-ui/p-b5ea18ba.entry.js +2 -0
- package/dist/huibo-ui/p-b5ea18ba.entry.js.map +1 -0
- package/dist/huibo-ui/{p-41d9c846.entry.js → p-b6afe81e.entry.js} +2 -2
- package/dist/huibo-ui/p-b7900dee.entry.js +2 -0
- package/dist/huibo-ui/p-b7900dee.entry.js.map +1 -0
- package/dist/huibo-ui/p-b8c83751.entry.js +2 -0
- package/dist/huibo-ui/p-b8c83751.entry.js.map +1 -0
- package/dist/huibo-ui/p-c7713947.entry.js +2 -0
- package/dist/huibo-ui/p-c7713947.entry.js.map +1 -0
- package/dist/huibo-ui/{p-33de6878.entry.js → p-c869842c.entry.js} +2 -2
- package/dist/huibo-ui/p-c869842c.entry.js.map +1 -0
- package/dist/huibo-ui/p-c8e917db.entry.js.map +1 -1
- package/dist/huibo-ui/p-cb66dbef.entry.js +2 -0
- package/dist/huibo-ui/p-cb66dbef.entry.js.map +1 -0
- package/dist/huibo-ui/p-cde83f76.entry.js +2 -0
- package/dist/huibo-ui/p-cde83f76.entry.js.map +1 -0
- package/dist/huibo-ui/{p-f5969181.entry.js → p-dd9c6459.entry.js} +2 -2
- package/dist/huibo-ui/{p-08b4005c.js → p-e0876aca.js} +1 -1
- package/dist/huibo-ui/p-e0876aca.js.map +1 -0
- package/dist/huibo-ui/{p-aa5e5e02.entry.js → p-e1773c93.entry.js} +2 -2
- package/dist/huibo-ui/p-e1773c93.entry.js.map +1 -0
- package/dist/huibo-ui/{p-626b48f1.entry.js → p-e73c357f.entry.js} +2 -2
- package/dist/huibo-ui/p-e73c357f.entry.js.map +1 -0
- package/dist/huibo-ui/{p-60532a1f.entry.js → p-e7c73624.entry.js} +2 -2
- package/dist/huibo-ui/p-e7c73624.entry.js.map +1 -0
- package/dist/huibo-ui/{p-86bdc48a.entry.js → p-e8824b2c.entry.js} +2 -2
- package/dist/huibo-ui/p-e8824b2c.entry.js.map +1 -0
- package/dist/huibo-ui/{p-13010da2.entry.js → p-e9e7abca.entry.js} +2 -2
- package/dist/huibo-ui/{p-f6889710.entry.js → p-ea0823f3.entry.js} +2 -2
- package/dist/huibo-ui/p-ea0823f3.entry.js.map +1 -0
- package/dist/huibo-ui/{p-b468858e.entry.js → p-f1f2483f.entry.js} +2 -2
- package/dist/huibo-ui/p-f69599fa.entry.js +2 -0
- package/dist/huibo-ui/p-f69599fa.entry.js.map +1 -0
- package/dist/huibo-ui/p-fad66d69.js +2 -0
- package/dist/huibo-ui/p-fad66d69.js.map +1 -0
- package/dist/huibo-ui/{p-fd8301c6.entry.js → p-fd6831f9.entry.js} +2 -2
- package/dist/huibo-ui/p-ff6bc5cc.entry.js +2 -0
- package/dist/huibo-ui/p-ff6bc5cc.entry.js.map +1 -0
- package/dist/types/components/Cascader/Cascader.d.ts +12 -0
- package/dist/types/components/Checkbox/Checkbox.d.ts +5 -0
- package/dist/types/components/Checkbox/CheckboxGroup.d.ts +1 -0
- package/dist/types/components/Collapse/Collapse.d.ts +2 -0
- package/dist/types/components/Collapse/CollapseItem.d.ts +8 -1
- package/dist/types/components/Dialog/Dialog.d.ts +13 -1
- package/dist/types/components/Drawer/Drawer.d.ts +4 -0
- package/dist/types/components/Dropdown/Dropdown.d.ts +6 -2
- package/dist/types/components/Form/Form.d.ts +59 -0
- package/dist/types/components/Form/FormItem.d.ts +23 -0
- package/dist/types/components/Image/Image.d.ts +6 -0
- package/dist/types/components/Menu/MenuItem.d.ts +8 -1
- package/dist/types/components/Message/Message.d.ts +3 -0
- package/dist/types/components/Popconfirm/Popconfirm.d.ts +6 -2
- package/dist/types/components/Popover/Popover.d.ts +6 -1
- package/dist/types/components/Radio/Radio.d.ts +5 -0
- package/dist/types/components/Segmented/Segmented.d.ts +6 -0
- package/dist/types/components/Select/Select.d.ts +24 -0
- package/dist/types/components/Table/Table.d.ts +110 -9
- package/dist/types/components/Tabs/Tabs.d.ts +6 -0
- package/dist/types/components/Tooltip/Tooltip.d.ts +6 -0
- package/dist/types/components/Tree/Tree.d.ts +24 -0
- package/dist/types/components/TreeSelect/TreeSelect.d.ts +17 -0
- package/dist/types/components/Watermark/Watermark.d.ts +7 -1
- package/dist/types/components.d.ts +188 -6
- package/dist/types/utils/a11y.d.ts +9 -0
- package/dist/types/utils/transition.d.ts +27 -0
- package/dist/types/utils/virtual-scroll.d.ts +38 -0
- package/package.json +1 -1
- package/dist/cjs/a11y-802de67a.js.map +0 -1
- package/dist/cjs/date-helpers-1ffddc59.js.map +0 -1
- package/dist/components/p-08b4005c.js.map +0 -1
- package/dist/components/p-cc0aeb50.js.map +0 -1
- package/dist/esm/a11y-f9ab2964.js.map +0 -1
- package/dist/esm/date-helpers-44507189.js.map +0 -1
- package/dist/huibo-ui/p-08b4005c.js.map +0 -1
- package/dist/huibo-ui/p-1f8db37a.entry.js.map +0 -1
- package/dist/huibo-ui/p-213b9de7.entry.js.map +0 -1
- package/dist/huibo-ui/p-25fd7d5c.entry.js +0 -2
- package/dist/huibo-ui/p-25fd7d5c.entry.js.map +0 -1
- package/dist/huibo-ui/p-2811e603.entry.js.map +0 -1
- package/dist/huibo-ui/p-2943f5d0.entry.js +0 -2
- package/dist/huibo-ui/p-2943f5d0.entry.js.map +0 -1
- package/dist/huibo-ui/p-2b4556ff.entry.js.map +0 -1
- package/dist/huibo-ui/p-33de6878.entry.js.map +0 -1
- package/dist/huibo-ui/p-3807da71.entry.js +0 -2
- package/dist/huibo-ui/p-3807da71.entry.js.map +0 -1
- package/dist/huibo-ui/p-47ef7a86.entry.js +0 -2
- package/dist/huibo-ui/p-47ef7a86.entry.js.map +0 -1
- package/dist/huibo-ui/p-4d34e43e.entry.js +0 -2
- package/dist/huibo-ui/p-4d34e43e.entry.js.map +0 -1
- package/dist/huibo-ui/p-54aa2fd8.entry.js +0 -2
- package/dist/huibo-ui/p-54aa2fd8.entry.js.map +0 -1
- package/dist/huibo-ui/p-60532a1f.entry.js.map +0 -1
- package/dist/huibo-ui/p-626b48f1.entry.js.map +0 -1
- package/dist/huibo-ui/p-639f167d.entry.js +0 -2
- package/dist/huibo-ui/p-639f167d.entry.js.map +0 -1
- package/dist/huibo-ui/p-6beb5b81.entry.js.map +0 -1
- package/dist/huibo-ui/p-735bceef.entry.js.map +0 -1
- package/dist/huibo-ui/p-76519752.entry.js +0 -2
- package/dist/huibo-ui/p-76519752.entry.js.map +0 -1
- package/dist/huibo-ui/p-79af2efa.entry.js +0 -2
- package/dist/huibo-ui/p-79af2efa.entry.js.map +0 -1
- package/dist/huibo-ui/p-7f6975ad.entry.js +0 -2
- package/dist/huibo-ui/p-7f6975ad.entry.js.map +0 -1
- package/dist/huibo-ui/p-86bdc48a.entry.js.map +0 -1
- package/dist/huibo-ui/p-8a8443b8.entry.js +0 -2
- package/dist/huibo-ui/p-8a8443b8.entry.js.map +0 -1
- package/dist/huibo-ui/p-8fd788c9.entry.js +0 -2
- package/dist/huibo-ui/p-8fd788c9.entry.js.map +0 -1
- package/dist/huibo-ui/p-92521c31.entry.js +0 -2
- package/dist/huibo-ui/p-92521c31.entry.js.map +0 -1
- package/dist/huibo-ui/p-965d4d02.entry.js +0 -2
- package/dist/huibo-ui/p-965d4d02.entry.js.map +0 -1
- package/dist/huibo-ui/p-aa5e5e02.entry.js.map +0 -1
- package/dist/huibo-ui/p-ab9cf0e4.entry.js.map +0 -1
- package/dist/huibo-ui/p-b8d87f7e.entry.js.map +0 -1
- package/dist/huibo-ui/p-c6c91664.entry.js +0 -2
- package/dist/huibo-ui/p-c6c91664.entry.js.map +0 -1
- package/dist/huibo-ui/p-c80f8ace.entry.js.map +0 -1
- package/dist/huibo-ui/p-cc0aeb50.js +0 -2
- package/dist/huibo-ui/p-cc0aeb50.js.map +0 -1
- package/dist/huibo-ui/p-d79a15b1.entry.js +0 -2
- package/dist/huibo-ui/p-d79a15b1.entry.js.map +0 -1
- package/dist/huibo-ui/p-e10fcfbe.entry.js.map +0 -1
- package/dist/huibo-ui/p-e5cbfa9e.entry.js.map +0 -1
- package/dist/huibo-ui/p-ea74fcae.entry.js.map +0 -1
- package/dist/huibo-ui/p-edbda423.entry.js +0 -2
- package/dist/huibo-ui/p-edbda423.entry.js.map +0 -1
- package/dist/huibo-ui/p-f6889710.entry.js.map +0 -1
- package/dist/huibo-ui/p-f9bb5217.entry.js +0 -2
- package/dist/huibo-ui/p-f9bb5217.entry.js.map +0 -1
- package/dist/huibo-ui/p-fea20295.entry.js +0 -2
- package/dist/huibo-ui/p-fea20295.entry.js.map +0 -1
- /package/dist/huibo-ui/{p-678b4212.entry.js.map → p-0ddae4e9.entry.js.map} +0 -0
- /package/dist/huibo-ui/{p-f4336be9.entry.js.map → p-14c3b47b.entry.js.map} +0 -0
- /package/dist/huibo-ui/{p-c50ad398.entry.js.map → p-193efdc0.entry.js.map} +0 -0
- /package/dist/huibo-ui/{p-0d4b2997.entry.js.map → p-2bcda1bb.entry.js.map} +0 -0
- /package/dist/huibo-ui/{p-7da14d7c.entry.js.map → p-3042f986.entry.js.map} +0 -0
- /package/dist/huibo-ui/{p-e039155d.entry.js.map → p-3dacb26b.entry.js.map} +0 -0
- /package/dist/huibo-ui/{p-a084b8e5.entry.js.map → p-412ff618.entry.js.map} +0 -0
- /package/dist/huibo-ui/{p-ccd09d5a.entry.js.map → p-6518c435.entry.js.map} +0 -0
- /package/dist/huibo-ui/{p-cad57c2d.entry.js.map → p-7a682c56.entry.js.map} +0 -0
- /package/dist/huibo-ui/{p-a8996d22.entry.js.map → p-815fc943.entry.js.map} +0 -0
- /package/dist/huibo-ui/{p-af74667d.entry.js.map → p-89be7973.entry.js.map} +0 -0
- /package/dist/huibo-ui/{p-8fdbd17c.entry.js.map → p-950e7465.entry.js.map} +0 -0
- /package/dist/huibo-ui/{p-89ea1141.entry.js.map → p-ac45291c.entry.js.map} +0 -0
- /package/dist/huibo-ui/{p-41d9c846.entry.js.map → p-b6afe81e.entry.js.map} +0 -0
- /package/dist/huibo-ui/{p-f5969181.entry.js.map → p-dd9c6459.entry.js.map} +0 -0
- /package/dist/huibo-ui/{p-13010da2.entry.js.map → p-e9e7abca.entry.js.map} +0 -0
- /package/dist/huibo-ui/{p-b468858e.entry.js.map → p-f1f2483f.entry.js.map} +0 -0
- /package/dist/huibo-ui/{p-fd8301c6.entry.js.map → p-fd6831f9.entry.js.map} +0 -0
|
@@ -15,10 +15,18 @@ export class Drawer {
|
|
|
15
15
|
zIndex = 0;
|
|
16
16
|
panelRef;
|
|
17
17
|
trap;
|
|
18
|
+
/** 离场动画期内保留渲染 */
|
|
19
|
+
leaving = false;
|
|
20
|
+
leaveTimer;
|
|
18
21
|
hbOpen;
|
|
19
22
|
hbClose;
|
|
20
23
|
handleVisible(val) {
|
|
21
24
|
if (val) {
|
|
25
|
+
if (this.leaveTimer) {
|
|
26
|
+
clearTimeout(this.leaveTimer);
|
|
27
|
+
this.leaveTimer = undefined;
|
|
28
|
+
}
|
|
29
|
+
this.leaving = false;
|
|
22
30
|
this.zIndex = getNextZIndex();
|
|
23
31
|
this.zIndexState = this.zIndex;
|
|
24
32
|
if (this.modal)
|
|
@@ -31,6 +39,13 @@ export class Drawer {
|
|
|
31
39
|
unlockScroll();
|
|
32
40
|
this.hbClose.emit();
|
|
33
41
|
document.removeEventListener('keydown', this.handleKeyDown);
|
|
42
|
+
// 进入离场动画期,结束后真正卸载
|
|
43
|
+
this.leaving = true;
|
|
44
|
+
if (this.leaveTimer)
|
|
45
|
+
clearTimeout(this.leaveTimer);
|
|
46
|
+
this.leaveTimer = setTimeout(() => {
|
|
47
|
+
this.leaving = false;
|
|
48
|
+
}, 300);
|
|
34
49
|
}
|
|
35
50
|
}
|
|
36
51
|
componentDidRender() {
|
|
@@ -51,19 +66,34 @@ export class Drawer {
|
|
|
51
66
|
unlockScroll();
|
|
52
67
|
document.removeEventListener('keydown', this.handleKeyDown);
|
|
53
68
|
this.trap?.disconnect();
|
|
69
|
+
if (this.leaveTimer)
|
|
70
|
+
clearTimeout(this.leaveTimer);
|
|
54
71
|
}
|
|
55
72
|
handleKeyDown = (e) => {
|
|
56
73
|
if (this.closeOnPressEscape && e.key === 'Escape') {
|
|
57
74
|
this.close();
|
|
58
75
|
}
|
|
59
76
|
};
|
|
60
|
-
close = () => {
|
|
77
|
+
close = () => {
|
|
78
|
+
this.modelValue = false;
|
|
79
|
+
};
|
|
80
|
+
get shouldRender() {
|
|
81
|
+
return this.modelValue || this.leaving;
|
|
82
|
+
}
|
|
61
83
|
render() {
|
|
62
84
|
const dir = this.direction;
|
|
63
85
|
const isVertical = dir === 'ttb' || dir === 'btt';
|
|
64
86
|
const sizeStyle = isVertical ? { height: this.size } : { width: this.size };
|
|
65
87
|
const translateClass = `hb-drawer--${dir}`;
|
|
66
|
-
return (h("div", { key: '
|
|
88
|
+
return (h("div", { key: '1b19a23690272c043ad80a8f4ad01470ef1f6627', class: { 'hb-drawer-wrapper': true, 'hb-drawer-wrapper--visible': this.shouldRender } }, this.modal && (h("div", { key: '6f1492a485eeb634e59a50300be5ad8af6ebfdcb', class: {
|
|
89
|
+
'hb-drawer__overlay': true,
|
|
90
|
+
'hb-drawer__overlay--leaving': this.leaving,
|
|
91
|
+
}, style: { zIndex: String(this.zIndexState) }, onClick: () => this.closeOnClickModal && this.close() })), h("div", { key: '4276468b6d5c2bc8628ccefeafc0de7acf372931', ref: el => (this.panelRef = el), class: {
|
|
92
|
+
'hb-drawer': true,
|
|
93
|
+
[translateClass]: true,
|
|
94
|
+
'hb-drawer--visible': this.modelValue,
|
|
95
|
+
'hb-drawer--leaving': this.leaving,
|
|
96
|
+
}, style: { ...sizeStyle, zIndex: String(this.zIndexState + 1) }, role: "dialog", "aria-modal": "true", "aria-label": this.title || undefined, "aria-hidden": this.modelValue ? 'false' : 'true' }, h("div", { key: '66c7aa0843425292845c3a3c5841abaca233efd4', class: "hb-drawer__header" }, h("span", { key: '07226dc7437adb12e0d08ccf2259c6e470d4eea3', class: "hb-drawer__title" }, this.title), this.showClose && (h("button", { key: '2658edb09e334c02fa0218b414c354b4cbb20220', type: "button", class: "hb-drawer__close", "aria-label": "\u5173\u95ED", onClick: this.close }, h("svg", { key: '8ad5e5558c02fdb0271fa93d6fa279dee949d9f0', viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": 2, "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { key: 'ff3585922cdeb73e68dbf1755092ade914579506', d: "M6 6l12 12M18 6L6 18" }))))), h("div", { key: 'b64ddf86b2f5a0344b80e7fb729c19a2d6d6fe5c', class: "hb-drawer__body" }, h("slot", { key: '3e3904d5d149a765130eb5f59ac1d268d48c39f6' })))));
|
|
67
97
|
}
|
|
68
98
|
static get is() { return "hb-drawer"; }
|
|
69
99
|
static get encapsulation() { return "shadow"; }
|
|
@@ -243,7 +273,8 @@ export class Drawer {
|
|
|
243
273
|
}
|
|
244
274
|
static get states() {
|
|
245
275
|
return {
|
|
246
|
-
"zIndexState": {}
|
|
276
|
+
"zIndexState": {},
|
|
277
|
+
"leaving": {}
|
|
247
278
|
};
|
|
248
279
|
}
|
|
249
280
|
static get events() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../../../src/components/Drawer/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACpF,OAAO,EAAE,eAAe,EAAa,MAAM,kBAAkB,CAAC;AAG9D,MAAM,OAAO,MAAM;IACQ,UAAU,GAAY,KAAK,CAAC;IAC7C,KAAK,GAAW,EAAE,CAAC;IACnB,IAAI,GAAW,KAAK,CAAC;IACrB,SAAS,GAAkC,KAAK,CAAC;IACjD,iBAAiB,GAAY,IAAI,CAAC;IAClC,SAAS,GAAY,IAAI,CAAC;IAC1B,KAAK,GAAY,IAAI,CAAC;IAC9B,iBAAiB;IACT,kBAAkB,GAAY,IAAI,CAAC;IAC1B,WAAW,GAAW,CAAC,CAAC;IACjC,MAAM,GAAW,CAAC,CAAC;IACnB,QAAQ,CAAe;IACvB,IAAI,CAAa;
|
|
1
|
+
{"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../../../src/components/Drawer/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACpF,OAAO,EAAE,eAAe,EAAa,MAAM,kBAAkB,CAAC;AAG9D,MAAM,OAAO,MAAM;IACQ,UAAU,GAAY,KAAK,CAAC;IAC7C,KAAK,GAAW,EAAE,CAAC;IACnB,IAAI,GAAW,K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AAI,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;gBAE/C,4DAAK,KAAK,EAAC,mBAAmB;oBAC5B,6DAAM,KAAK,EAAC,kBAAkB,IAAE,IAAI,CAAC,KAAK,CAAQ;oBACjD,IAAI,CAAC,SAAS,IAAI,CACjB,+DAAQ,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,kBAAkB,gBAAY,cAAI,EAAC,OAAO,EAAE,IAAI,CAAC,KAAK;wBAChF,4DAAK,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAC,cAAc,kBAAe,CAAC,oBAAiB,OAAO,qBAAiB,OAAO,iBAAa,MAAM;4BAC3I,6DAAM,CAAC,EAAC,sBAAsB,GAAG,CAC7B,CACC,CACV,CACG;gBACN,4DAAK,KAAK,EAAC,iBAAiB;oBAC1B,8DAAQ,CACJ,CACF,CACF,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, Event, EventEmitter, Watch, State } from '@stencil/core';\nimport { lockScroll, unlockScroll, getNextZIndex } from '../../utils/popup-manager';\nimport { createFocusTrap, FocusTrap } from '../../utils/a11y';\n\n@Component({ tag: 'hb-drawer', styleUrl: 'drawer.css', shadow: true })\nexport class Drawer {\n @Prop({ mutable: true }) modelValue: boolean = false;\n @Prop() title: string = '';\n @Prop() size: string = '30%';\n @Prop() direction: 'ltr' | 'rtl' | 'ttb' | 'btt' = 'rtl';\n @Prop() closeOnClickModal: boolean = true;\n @Prop() showClose: boolean = true;\n @Prop() modal: boolean = true;\n /** 是否按 ESC 关闭 */\n @Prop() closeOnPressEscape: boolean = true;\n @State() private zIndexState: number = 0;\n private zIndex: number = 0;\n private panelRef?: HTMLElement;\n private trap?: FocusTrap;\n /** 离场动画期内保留渲染 */\n @State() private leaving: boolean = false;\n private leaveTimer?: ReturnType<typeof setTimeout>;\n\n @Event() hbOpen: EventEmitter<void>;\n @Event() hbClose: EventEmitter<void>;\n\n @Watch('modelValue')\n handleVisible(val: boolean) {\n if (val) {\n if (this.leaveTimer) {\n clearTimeout(this.leaveTimer);\n this.leaveTimer = undefined;\n }\n this.leaving = false;\n this.zIndex = getNextZIndex();\n this.zIndexState = this.zIndex;\n if (this.modal) lockScroll();\n this.hbOpen.emit();\n document.addEventListener('keydown', this.handleKeyDown);\n } else {\n if (this.modal) unlockScroll();\n this.hbClose.emit();\n document.removeEventListener('keydown', this.handleKeyDown);\n // 进入离场动画期,结束后真正卸载\n this.leaving = true;\n if (this.leaveTimer) clearTimeout(this.leaveTimer);\n this.leaveTimer = setTimeout(() => {\n this.leaving = false;\n }, 300);\n }\n }\n\n componentDidRender() {\n if (!this.panelRef) return;\n if (this.modelValue) {\n if (!this.trap) {\n this.trap = createFocusTrap({ container: this.panelRef });\n }\n this.trap.connect();\n } else {\n this.trap?.disconnect();\n }\n }\n\n disconnectedCallback() {\n if (this.modelValue && this.modal) unlockScroll();\n document.removeEventListener('keydown', this.handleKeyDown);\n this.trap?.disconnect();\n if (this.leaveTimer) clearTimeout(this.leaveTimer);\n }\n\n private handleKeyDown = (e: KeyboardEvent) => {\n if (this.closeOnPressEscape && e.key === 'Escape') {\n this.close();\n }\n };\n\n private close = () => {\n this.modelValue = false;\n };\n\n private get shouldRender(): boolean {\n return this.modelValue || this.leaving;\n }\n\n render() {\n const dir = this.direction;\n const isVertical = dir === 'ttb' || dir === 'btt';\n const sizeStyle = isVertical ? { height: this.size } : { width: this.size };\n const translateClass = `hb-drawer--${dir}`;\n\n return (\n <div class={{ 'hb-drawer-wrapper': true, 'hb-drawer-wrapper--visible': this.shouldRender }}>\n {this.modal && (\n <div\n class={{\n 'hb-drawer__overlay': true,\n 'hb-drawer__overlay--leaving': this.leaving,\n }}\n style={{ zIndex: String(this.zIndexState) }}\n onClick={() => this.closeOnClickModal && this.close()}\n />\n )}\n <div\n ref={el => (this.panelRef = el as HTMLElement)}\n class={{\n 'hb-drawer': true,\n [translateClass]: true,\n 'hb-drawer--visible': this.modelValue,\n 'hb-drawer--leaving': this.leaving,\n }}\n style={{ ...sizeStyle, zIndex: String(this.zIndexState + 1) }}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={this.title || undefined}\n aria-hidden={this.modelValue ? 'false' : 'true'}\n >\n <div class=\"hb-drawer__header\">\n <span class=\"hb-drawer__title\">{this.title}</span>\n {this.showClose && (\n <button type=\"button\" class=\"hb-drawer__close\" aria-label=\"关闭\" onClick={this.close}>\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width={2} stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path d=\"M6 6l12 12M18 6L6 18\" />\n </svg>\n </button>\n )}\n </div>\n <div class=\"hb-drawer__body\">\n <slot />\n </div>\n </div>\n </div>\n );\n }\n}\n"]}
|
|
@@ -1,18 +1,208 @@
|
|
|
1
|
-
:host {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
:host {
|
|
2
|
+
display: contents;
|
|
3
|
+
}
|
|
4
|
+
.hb-drawer-wrapper {
|
|
5
|
+
position: fixed;
|
|
6
|
+
top: 0;
|
|
7
|
+
left: 0;
|
|
8
|
+
right: 0;
|
|
9
|
+
bottom: 0;
|
|
10
|
+
pointer-events: none;
|
|
11
|
+
z-index: 1000;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* wrapper 默认不显示(modelValue=false 且离场结束时);打开/离场期都可见 */
|
|
15
|
+
.hb-drawer-wrapper:not(.hb-drawer-wrapper--visible) {
|
|
16
|
+
display: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.hb-drawer__overlay {
|
|
20
|
+
position: fixed;
|
|
21
|
+
top: 0;
|
|
22
|
+
left: 0;
|
|
23
|
+
right: 0;
|
|
24
|
+
bottom: 0;
|
|
25
|
+
background: var(--hb-color-bg-mask);
|
|
26
|
+
pointer-events: auto;
|
|
27
|
+
animation: hb-drawer-overlay-in 0.3s ease both;
|
|
28
|
+
}
|
|
29
|
+
.hb-drawer__overlay--leaving {
|
|
30
|
+
animation: hb-drawer-overlay-out 0.3s ease both;
|
|
31
|
+
}
|
|
32
|
+
@keyframes hb-drawer-overlay-in {
|
|
33
|
+
from {
|
|
34
|
+
opacity: 0;
|
|
35
|
+
}
|
|
36
|
+
to {
|
|
37
|
+
opacity: 1;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
@keyframes hb-drawer-overlay-out {
|
|
41
|
+
from {
|
|
42
|
+
opacity: 1;
|
|
43
|
+
}
|
|
44
|
+
to {
|
|
45
|
+
opacity: 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
4
49
|
.hb-drawer {
|
|
5
|
-
position: fixed;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
.hb-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
50
|
+
position: fixed;
|
|
51
|
+
background: var(--hb-color-bg-elevated);
|
|
52
|
+
box-shadow: var(--hb-box-shadow-lg);
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-direction: column;
|
|
55
|
+
pointer-events: auto;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* 四方向进场动画(从屏外滑入)。visible 时播放 in;leaving 时播放 out */
|
|
59
|
+
.hb-drawer--rtl {
|
|
60
|
+
top: 0;
|
|
61
|
+
right: 0;
|
|
62
|
+
bottom: 0;
|
|
63
|
+
}
|
|
64
|
+
.hb-drawer--ltr {
|
|
65
|
+
top: 0;
|
|
66
|
+
left: 0;
|
|
67
|
+
bottom: 0;
|
|
68
|
+
}
|
|
69
|
+
.hb-drawer--ttb {
|
|
70
|
+
left: 0;
|
|
71
|
+
right: 0;
|
|
72
|
+
top: 0;
|
|
73
|
+
}
|
|
74
|
+
.hb-drawer--btt {
|
|
75
|
+
left: 0;
|
|
76
|
+
right: 0;
|
|
77
|
+
bottom: 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.hb-drawer--visible.hb-drawer--rtl {
|
|
81
|
+
animation: hb-drawer-in-rtl 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
|
|
82
|
+
}
|
|
83
|
+
.hb-drawer--visible.hb-drawer--ltr {
|
|
84
|
+
animation: hb-drawer-in-ltr 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
|
|
85
|
+
}
|
|
86
|
+
.hb-drawer--visible.hb-drawer--ttb {
|
|
87
|
+
animation: hb-drawer-in-ttb 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
|
|
88
|
+
}
|
|
89
|
+
.hb-drawer--visible.hb-drawer--btt {
|
|
90
|
+
animation: hb-drawer-in-btt 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.hb-drawer--leaving.hb-drawer--rtl {
|
|
94
|
+
animation: hb-drawer-out-rtl 0.3s cubic-bezier(0.5, 0, 0.75, 0) both;
|
|
95
|
+
}
|
|
96
|
+
.hb-drawer--leaving.hb-drawer--ltr {
|
|
97
|
+
animation: hb-drawer-out-ltr 0.3s cubic-bezier(0.5, 0, 0.75, 0) both;
|
|
98
|
+
}
|
|
99
|
+
.hb-drawer--leaving.hb-drawer--ttb {
|
|
100
|
+
animation: hb-drawer-out-ttb 0.3s cubic-bezier(0.5, 0, 0.75, 0) both;
|
|
101
|
+
}
|
|
102
|
+
.hb-drawer--leaving.hb-drawer--btt {
|
|
103
|
+
animation: hb-drawer-out-btt 0.3s cubic-bezier(0.5, 0, 0.75, 0) both;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@keyframes hb-drawer-in-rtl {
|
|
107
|
+
from {
|
|
108
|
+
transform: translateX(100%);
|
|
109
|
+
}
|
|
110
|
+
to {
|
|
111
|
+
transform: translateX(0);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
@keyframes hb-drawer-out-rtl {
|
|
115
|
+
from {
|
|
116
|
+
transform: translateX(0);
|
|
117
|
+
}
|
|
118
|
+
to {
|
|
119
|
+
transform: translateX(100%);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
@keyframes hb-drawer-in-ltr {
|
|
123
|
+
from {
|
|
124
|
+
transform: translateX(-100%);
|
|
125
|
+
}
|
|
126
|
+
to {
|
|
127
|
+
transform: translateX(0);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
@keyframes hb-drawer-out-ltr {
|
|
131
|
+
from {
|
|
132
|
+
transform: translateX(0);
|
|
133
|
+
}
|
|
134
|
+
to {
|
|
135
|
+
transform: translateX(-100%);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
@keyframes hb-drawer-in-ttb {
|
|
139
|
+
from {
|
|
140
|
+
transform: translateY(-100%);
|
|
141
|
+
}
|
|
142
|
+
to {
|
|
143
|
+
transform: translateY(0);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
@keyframes hb-drawer-out-ttb {
|
|
147
|
+
from {
|
|
148
|
+
transform: translateY(0);
|
|
149
|
+
}
|
|
150
|
+
to {
|
|
151
|
+
transform: translateY(-100%);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
@keyframes hb-drawer-in-btt {
|
|
155
|
+
from {
|
|
156
|
+
transform: translateY(100%);
|
|
157
|
+
}
|
|
158
|
+
to {
|
|
159
|
+
transform: translateY(0);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
@keyframes hb-drawer-out-btt {
|
|
163
|
+
from {
|
|
164
|
+
transform: translateY(0);
|
|
165
|
+
}
|
|
166
|
+
to {
|
|
167
|
+
transform: translateY(100%);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.hb-drawer__header {
|
|
172
|
+
display: flex;
|
|
173
|
+
align-items: center;
|
|
174
|
+
justify-content: space-between;
|
|
175
|
+
padding: var(--hb-spacing-md) var(--hb-spacing-lg);
|
|
176
|
+
border-bottom: 1px solid var(--hb-color-border-secondary);
|
|
177
|
+
}
|
|
178
|
+
.hb-drawer__title {
|
|
179
|
+
font-size: var(--hb-font-size-lg);
|
|
180
|
+
font-weight: 600;
|
|
181
|
+
}
|
|
182
|
+
.hb-drawer__close {
|
|
183
|
+
border: none;
|
|
184
|
+
background: none;
|
|
185
|
+
cursor: pointer;
|
|
186
|
+
color: var(--hb-color-text-secondary);
|
|
187
|
+
width: 28px;
|
|
188
|
+
height: 28px;
|
|
189
|
+
border-radius: var(--hb-border-radius-sm);
|
|
190
|
+
display: flex;
|
|
191
|
+
align-items: center;
|
|
192
|
+
justify-content: center;
|
|
193
|
+
padding: 0;
|
|
194
|
+
transition: all var(--hb-transition-duration);
|
|
195
|
+
}
|
|
196
|
+
.hb-drawer__close svg {
|
|
197
|
+
width: 16px;
|
|
198
|
+
height: 16px;
|
|
199
|
+
}
|
|
200
|
+
.hb-drawer__close:hover {
|
|
201
|
+
background: var(--hb-color-fill-tertiary);
|
|
202
|
+
color: var(--hb-color-text-primary);
|
|
203
|
+
}
|
|
204
|
+
.hb-drawer__body {
|
|
205
|
+
flex: 1;
|
|
206
|
+
padding: var(--hb-spacing-lg);
|
|
207
|
+
overflow-y: auto;
|
|
208
|
+
}
|
|
@@ -2,6 +2,7 @@ import { h } from "@stencil/core";
|
|
|
2
2
|
import { createClickOutsideHandler } from "../../utils/click-outside";
|
|
3
3
|
import { getNextZIndex } from "../../utils/popup-manager";
|
|
4
4
|
import { handleListKeyboard, isActivationKey } from "../../utils/a11y";
|
|
5
|
+
import { createLeaveScheduler } from "../../utils/transition";
|
|
5
6
|
/**
|
|
6
7
|
* Dropdown 下拉菜单组件
|
|
7
8
|
* 将动作或菜单折叠到下拉菜单中。
|
|
@@ -10,6 +11,8 @@ import { handleListKeyboard, isActivationKey } from "../../utils/a11y";
|
|
|
10
11
|
* - 触发器 role=button + aria-haspopup=menu + aria-expanded
|
|
11
12
|
* - 菜单 role=menu,菜单项 role=menuitem + aria-disabled
|
|
12
13
|
* - 键盘:trigger 上 Enter/Space/↓ 打开;菜单内 ↑↓ 导航、Enter/Space 选中、Esc 关闭
|
|
14
|
+
*
|
|
15
|
+
* 进出场动画:用 leaving state 延迟卸载,让 fade-out 有机会播放。
|
|
13
16
|
*/
|
|
14
17
|
export class Dropdown {
|
|
15
18
|
el;
|
|
@@ -20,44 +23,54 @@ export class Dropdown {
|
|
|
20
23
|
/** 是否禁用 */
|
|
21
24
|
disabled = false;
|
|
22
25
|
isOpen = false;
|
|
26
|
+
/** 离场动画期(保留 DOM 让 fade-out 播完) */
|
|
27
|
+
leaving = false;
|
|
23
28
|
/** 键盘高亮项索引(-1 表示无) */
|
|
24
29
|
activeIndex = -1;
|
|
25
30
|
/** 命令事件 */
|
|
26
31
|
hbCommand;
|
|
32
|
+
leave = createLeaveScheduler(() => this.leaving, v => (this.leaving = v), 150);
|
|
27
33
|
clickOutside = createClickOutsideHandler({
|
|
28
34
|
host: null,
|
|
29
35
|
isOpen: () => this.isOpen,
|
|
30
|
-
onClose: () => {
|
|
36
|
+
onClose: () => {
|
|
37
|
+
this.close();
|
|
38
|
+
},
|
|
31
39
|
});
|
|
32
40
|
componentDidLoad() {
|
|
33
41
|
this.clickOutside = createClickOutsideHandler({
|
|
34
42
|
host: this.el,
|
|
35
43
|
isOpen: () => this.isOpen,
|
|
36
|
-
onClose: () => {
|
|
44
|
+
onClose: () => {
|
|
45
|
+
this.close();
|
|
46
|
+
},
|
|
37
47
|
});
|
|
38
|
-
// click 触发才需要外部点击关闭;hover 触发由 mouseenter/leave 控制
|
|
39
48
|
if (this.trigger === 'click') {
|
|
40
49
|
this.clickOutside.connect();
|
|
41
50
|
}
|
|
42
51
|
}
|
|
43
52
|
disconnectedCallback() {
|
|
44
53
|
this.clickOutside.disconnect();
|
|
54
|
+
this.leave.dispose();
|
|
45
55
|
}
|
|
46
56
|
open = () => {
|
|
47
57
|
if (this.disabled)
|
|
48
58
|
return;
|
|
59
|
+
this.leave.cancel(); // 中途又打开:取消挂起的离场
|
|
49
60
|
this.isOpen = true;
|
|
50
|
-
// 打开时默认高亮首个可选(非禁用)项,便于 Enter 直接选
|
|
51
61
|
this.activeIndex = this.items.findIndex(i => !i.disabled);
|
|
52
62
|
};
|
|
53
63
|
close = () => {
|
|
64
|
+
if (!this.isOpen && !this.leaving)
|
|
65
|
+
return;
|
|
54
66
|
this.isOpen = false;
|
|
55
67
|
this.activeIndex = -1;
|
|
68
|
+
this.leave.start();
|
|
56
69
|
};
|
|
57
70
|
show = () => {
|
|
58
71
|
if (this.disabled)
|
|
59
72
|
return;
|
|
60
|
-
this.
|
|
73
|
+
this.open();
|
|
61
74
|
};
|
|
62
75
|
hide = () => {
|
|
63
76
|
this.close();
|
|
@@ -76,18 +89,16 @@ export class Dropdown {
|
|
|
76
89
|
this.close();
|
|
77
90
|
this.hbCommand.emit(item.key);
|
|
78
91
|
};
|
|
79
|
-
/** 触发器键盘:Enter/Space/↓ 打开 */
|
|
80
92
|
handleTriggerKeydown = (e) => {
|
|
81
93
|
if (this.disabled)
|
|
82
94
|
return;
|
|
83
95
|
if (this.trigger === 'hover')
|
|
84
|
-
return;
|
|
96
|
+
return;
|
|
85
97
|
if (isActivationKey(e.key) || e.key === 'ArrowDown') {
|
|
86
98
|
e.preventDefault();
|
|
87
99
|
this.open();
|
|
88
100
|
}
|
|
89
101
|
};
|
|
90
|
-
/** 菜单键盘:↑↓ 导航、Enter/Space 选中、Esc 关闭、Home/End 跳首尾 */
|
|
91
102
|
handleMenuKeydown = (e) => {
|
|
92
103
|
const enabledCount = this.items.length;
|
|
93
104
|
const action = handleListKeyboard(e, {
|
|
@@ -98,7 +109,6 @@ export class Dropdown {
|
|
|
98
109
|
switch (action.type) {
|
|
99
110
|
case 'navigate':
|
|
100
111
|
e.preventDefault();
|
|
101
|
-
// 跳过禁用项:最多扫一圈
|
|
102
112
|
{
|
|
103
113
|
let idx = action.index;
|
|
104
114
|
for (let i = 0; i < enabledCount; i++) {
|
|
@@ -124,11 +134,15 @@ export class Dropdown {
|
|
|
124
134
|
break;
|
|
125
135
|
}
|
|
126
136
|
};
|
|
137
|
+
get shouldRender() {
|
|
138
|
+
return this.isOpen || this.leaving;
|
|
139
|
+
}
|
|
127
140
|
render() {
|
|
128
|
-
const triggerEvents = this.trigger === 'hover'
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
141
|
+
const triggerEvents = this.trigger === 'hover' ? { onMouseEnter: this.show, onMouseLeave: this.hide } : { onClick: this.toggle };
|
|
142
|
+
return (h("div", { key: '8855aa67978f0180ee22fa57d47d8a8530fcff59', class: "hb-dropdown", ...triggerEvents, onKeyDown: this.handleTriggerKeydown }, h("div", { key: 'f07514869b6c2fed33be57a882afbe3aad221f79', class: "hb-dropdown__trigger", role: "button", tabindex: this.disabled ? -1 : 0, "aria-haspopup": "menu", "aria-expanded": this.isOpen ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false' }, h("slot", { key: '077a8fdd63295eaeadda3124764dd51090a7019d' })), this.shouldRender && (h("div", { key: 'f17eba6ead1c841fdc97db4fc88c62937e6b7344', class: {
|
|
143
|
+
'hb-dropdown__menu': true,
|
|
144
|
+
'hb-dropdown__menu--leaving': this.leaving,
|
|
145
|
+
}, style: { zIndex: String(getNextZIndex()) }, role: "menu", onKeyDown: this.handleMenuKeydown }, this.items.map((item, index) => (h("div", { class: {
|
|
132
146
|
'hb-dropdown__item': true,
|
|
133
147
|
'hb-dropdown__item--disabled': item.disabled,
|
|
134
148
|
'hb-dropdown__item--divided': item.divided,
|
|
@@ -222,6 +236,7 @@ export class Dropdown {
|
|
|
222
236
|
static get states() {
|
|
223
237
|
return {
|
|
224
238
|
"isOpen": {},
|
|
239
|
+
"leaving": {},
|
|
225
240
|
"activeIndex": {}
|
|
226
241
|
};
|
|
227
242
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../../src/components/Dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AACxF,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAUvE;;;;;;;;GAQG;AAMH,MAAM,OAAO,QAAQ;IACR,EAAE,CAAc;IAE3B,UAAU;IACF,KAAK,GAAmB,EAAE,CAAC;IAEnC,WAAW;IACH,OAAO,GAAsB,OAAO,CAAC;IAE7C,WAAW;IACH,QAAQ,GAAY,KAAK,CAAC;IAEzB,MAAM,GAAY,KAAK,CAAC;IACjC,sBAAsB;IACb,WAAW,GAAW,CAAC,CAAC,CAAC;IAElC,WAAW;IACF,SAAS,CAAuB;IAEjC,YAAY,GAAG,yBAAyB,CAAC;QAC/C,IAAI,EAAE,IAAW;QACjB,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM;QACzB,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC;KACxC,CAAC,CAAC;IAEH,gBAAgB;QACd,IAAI,CAAC,YAAY,GAAG,yBAAyB,CAAC;YAC5C,IAAI,EAAE,IAAI,CAAC,EAAE;YACb,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM;YACzB,OAAO,EAAE,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,EAAC,MAAM,EACX,SAAS,EAAE,IAAI,CAAC,iBAAiB,IAEhC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAC/B,WACE,KAAK,EAAE;oBACL,mBAAmB,EAAE,IAAI;oBACzB,6BAA6B,EAAE,IAAI,CAAC,QAAQ;oBAC5C,4BAA4B,EAAE,IAAI,CAAC,OAAO;oBAC1C,2BAA2B,EAAE,IAAI,CAAC,MAAM;oBACxC,2BAA2B,EAAE,KAAK,KAAK,IAAI,CAAC,WAAW;iBACxD,EACD,IAAI,EAAC,UAAU,EACf,QAAQ,EAAE,CAAC,CAAC,mBACG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EACjD,YAAY,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ;oBAAE,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,EACrE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAErC,IAAI,CAAC,KAAK,CACP,CACP,CAAC,CACE,CACP,CACG,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Element, Event, EventEmitter } from '@stencil/core';\nimport { createClickOutsideHandler } from '../../utils/click-outside';\nimport { getNextZIndex } from '../../utils/popup-manager';\nimport { handleListKeyboard, isActivationKey } from '../../utils/a11y';\n\nexport interface DropdownItem {\n key: string;\n label: string;\n disabled?: boolean;\n divided?: boolean;\n danger?: boolean;\n}\n\n/**\n * Dropdown 下拉菜单组件\n * 将动作或菜单折叠到下拉菜单中。\n *\n * 无障碍(对齐 WAI-ARIA menu / antd):\n * - 触发器 role=button + aria-haspopup=menu + aria-expanded\n * - 菜单 role=menu,菜单项 role=menuitem + aria-disabled\n * - 键盘:trigger 上 Enter/Space/↓ 打开;菜单内 ↑↓ 导航、Enter/Space 选中、Esc 关闭\n */\n@Component({\n tag: 'hb-dropdown',\n styleUrl: 'dropdown.css',\n shadow: true,\n})\nexport class Dropdown {\n @Element() el: HTMLElement;\n\n /** 菜单项 */\n @Prop() items: DropdownItem[] = [];\n\n /** 触发方式 */\n @Prop() trigger: 'hover' | 'click' = 'hover';\n\n /** 是否禁用 */\n @Prop() disabled: boolean = false;\n\n @State() isOpen: boolean = false;\n /** 键盘高亮项索引(-1 表示无) */\n @State() activeIndex: number = -1;\n\n /** 命令事件 */\n @Event() hbCommand: EventEmitter<string>;\n\n private clickOutside = createClickOutsideHandler({\n host: null as any,\n isOpen: () => this.isOpen,\n onClose: () => { this.isOpen = false; },\n });\n\n componentDidLoad() {\n this.clickOutside = createClickOutsideHandler({\n host: this.el,\n isOpen: () => this.isOpen,\n onClose: () => { this.close(); },\n });\n // click 触发才需要外部点击关闭;hover 触发由 mouseenter/leave 控制\n if (this.trigger === 'click') {\n this.clickOutside.connect();\n }\n }\n\n disconnectedCallback() {\n this.clickOutside.disconnect();\n }\n\n private open = () => {\n if (this.disabled) return;\n this.isOpen = true;\n // 打开时默认高亮首个可选(非禁用)项,便于 Enter 直接选\n this.activeIndex = this.items.findIndex(i => !i.disabled);\n };\n\n private close = () => {\n this.isOpen = false;\n this.activeIndex = -1;\n };\n\n private show = () => {\n if (this.disabled) return;\n this.isOpen = true;\n };\n\n private hide = () => {\n this.close();\n };\n\n private toggle = () => {\n if (this.disabled) return;\n if (this.isOpen) this.close();\n else this.open();\n };\n\n private handleSelect = (item: DropdownItem) => {\n if (item.disabled) return;\n this.close();\n this.hbCommand.emit(item.key);\n };\n\n /** 触发器键盘:Enter/Space/↓ 打开 */\n private handleTriggerKeydown = (e: KeyboardEvent) => {\n if (this.disabled) return;\n if (this.trigger === 'hover') return; // hover 触发不需要键盘打开(focus 会展开见下)\n if (isActivationKey(e.key) || e.key === 'ArrowDown') {\n e.preventDefault();\n this.open();\n }\n };\n\n /** 菜单键盘:↑↓ 导航、Enter/Space 选中、Esc 关闭、Home/End 跳首尾 */\n private handleMenuKeydown = (e: KeyboardEvent) => {\n const enabledCount = this.items.length;\n const action = handleListKeyboard(e, {\n activeIndex: this.activeIndex,\n itemCount: enabledCount,\n loop: true,\n });\n switch (action.type) {\n case 'navigate':\n e.preventDefault();\n // 跳过禁用项:最多扫一圈\n {\n let idx = action.index;\n for (let i = 0; i < enabledCount; i++) {\n if (!this.items[idx]?.disabled) break;\n idx = (idx + 1) % enabledCount;\n }\n this.activeIndex = idx;\n }\n break;\n case 'select': {\n e.preventDefault();\n const item = this.items[action.index];\n if (item && !item.disabled) this.handleSelect(item);\n break;\n }\n case 'close':\n e.preventDefault();\n this.close();\n break;\n default:\n break;\n }\n };\n\n render() {\n const triggerEvents = this.trigger === 'hover'\n ? { onMouseEnter: this.show, onMouseLeave: this.hide }\n : { onClick: this.toggle };\n\n return (\n <div\n class=\"hb-dropdown\"\n {...triggerEvents}\n onKeyDown={this.handleTriggerKeydown}\n >\n <div\n class=\"hb-dropdown__trigger\"\n role=\"button\"\n tabindex={this.disabled ? -1 : 0}\n aria-haspopup=\"menu\"\n aria-expanded={this.isOpen ? 'true' : 'false'}\n aria-disabled={this.disabled ? 'true' : 'false'}\n >\n <slot />\n </div>\n {this.isOpen && (\n <div\n class=\"hb-dropdown__menu\"\n style={{ zIndex: String(getNextZIndex()) }}\n role=\"menu\"\n onKeyDown={this.handleMenuKeydown}\n >\n {this.items.map((item, index) => (\n <div\n class={{\n 'hb-dropdown__item': true,\n 'hb-dropdown__item--disabled': item.disabled,\n 'hb-dropdown__item--divided': item.divided,\n 'hb-dropdown__item--danger': item.danger,\n 'hb-dropdown__item--active': index === this.activeIndex,\n }}\n role=\"menuitem\"\n tabindex={-1}\n aria-disabled={item.disabled ? 'true' : undefined}\n onMouseEnter={() => { if (!item.disabled) this.activeIndex = index; }}\n onClick={() => this.handleSelect(item)}\n >\n {item.label}\n </div>\n ))}\n </div>\n )}\n </div>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../../src/components/Dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AACxF,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAU9D;;;;;;;;;;GAUG;AAMH,MAAM,OAAO,QAAQ;IACR,EAAE,CAAc;IAE3B,UAAU;IACF,KAAK,GAAmB,EAAE,CAAC;IAEnC,WAAW;IACH,OAAO,GAAsB,OAAO,CAAC;IAE7C,WAAW;IACH,QAAQ,GAAY,KAAK,CAAC;IAEzB,MAAM,GAAY,KAAK,CAAC;IACjC,kCAAkC;IACzB,OAAO,GAAY,KAAK,CAAC;IAClC,sBAAsB;IACb,WAAW,GAAW,CAAC,CAAC,CAAC;IAElC,WAAW;IACF,SAAS,CAAuB;IAEjC,KAAK,GAAG,oBAAoB,CAClC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAClB,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,EACvB,GAAG,CACJ,CAAC;IAEM,YAAY,GAAG,yBAAyB,CAAC;QAC/C,IAAI,EAAE,IAAW;QACjB,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM;QACzB,OAAO,EAAE,GAAG,EAAE;YACZ,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,CAAC;KACF,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AAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Element, Event, EventEmitter } from '@stencil/core';\nimport { createClickOutsideHandler } from '../../utils/click-outside';\nimport { getNextZIndex } from '../../utils/popup-manager';\nimport { handleListKeyboard, isActivationKey } from '../../utils/a11y';\nimport { createLeaveScheduler } from '../../utils/transition';\n\nexport interface DropdownItem {\n key: string;\n label: string;\n disabled?: boolean;\n divided?: boolean;\n danger?: boolean;\n}\n\n/**\n * Dropdown 下拉菜单组件\n * 将动作或菜单折叠到下拉菜单中。\n *\n * 无障碍(对齐 WAI-ARIA menu / antd):\n * - 触发器 role=button + aria-haspopup=menu + aria-expanded\n * - 菜单 role=menu,菜单项 role=menuitem + aria-disabled\n * - 键盘:trigger 上 Enter/Space/↓ 打开;菜单内 ↑↓ 导航、Enter/Space 选中、Esc 关闭\n *\n * 进出场动画:用 leaving state 延迟卸载,让 fade-out 有机会播放。\n */\n@Component({\n tag: 'hb-dropdown',\n styleUrl: 'dropdown.css',\n shadow: true,\n})\nexport class Dropdown {\n @Element() el: HTMLElement;\n\n /** 菜单项 */\n @Prop() items: DropdownItem[] = [];\n\n /** 触发方式 */\n @Prop() trigger: 'hover' | 'click' = 'hover';\n\n /** 是否禁用 */\n @Prop() disabled: boolean = false;\n\n @State() isOpen: boolean = false;\n /** 离场动画期(保留 DOM 让 fade-out 播完) */\n @State() leaving: boolean = false;\n /** 键盘高亮项索引(-1 表示无) */\n @State() activeIndex: number = -1;\n\n /** 命令事件 */\n @Event() hbCommand: EventEmitter<string>;\n\n private leave = createLeaveScheduler(\n () => this.leaving,\n v => (this.leaving = v),\n 150,\n );\n\n private clickOutside = createClickOutsideHandler({\n host: null as any,\n isOpen: () => this.isOpen,\n onClose: () => {\n this.close();\n },\n });\n\n componentDidLoad() {\n this.clickOutside = createClickOutsideHandler({\n host: this.el,\n isOpen: () => this.isOpen,\n onClose: () => {\n this.close();\n },\n });\n if (this.trigger === 'click') {\n this.clickOutside.connect();\n }\n }\n\n disconnectedCallback() {\n this.clickOutside.disconnect();\n this.leave.dispose();\n }\n\n private open = () => {\n if (this.disabled) return;\n this.leave.cancel(); // 中途又打开:取消挂起的离场\n this.isOpen = true;\n this.activeIndex = this.items.findIndex(i => !i.disabled);\n };\n\n private close = () => {\n if (!this.isOpen && !this.leaving) return;\n this.isOpen = false;\n this.activeIndex = -1;\n this.leave.start();\n };\n\n private show = () => {\n if (this.disabled) return;\n this.open();\n };\n\n private hide = () => {\n this.close();\n };\n\n private toggle = () => {\n if (this.disabled) return;\n if (this.isOpen) this.close();\n else this.open();\n };\n\n private handleSelect = (item: DropdownItem) => {\n if (item.disabled) return;\n this.close();\n this.hbCommand.emit(item.key);\n };\n\n private handleTriggerKeydown = (e: KeyboardEvent) => {\n if (this.disabled) return;\n if (this.trigger === 'hover') return;\n if (isActivationKey(e.key) || e.key === 'ArrowDown') {\n e.preventDefault();\n this.open();\n }\n };\n\n private handleMenuKeydown = (e: KeyboardEvent) => {\n const enabledCount = this.items.length;\n const action = handleListKeyboard(e, {\n activeIndex: this.activeIndex,\n itemCount: enabledCount,\n loop: true,\n });\n switch (action.type) {\n case 'navigate':\n e.preventDefault();\n {\n let idx = action.index;\n for (let i = 0; i < enabledCount; i++) {\n if (!this.items[idx]?.disabled) break;\n idx = (idx + 1) % enabledCount;\n }\n this.activeIndex = idx;\n }\n break;\n case 'select': {\n e.preventDefault();\n const item = this.items[action.index];\n if (item && !item.disabled) this.handleSelect(item);\n break;\n }\n case 'close':\n e.preventDefault();\n this.close();\n break;\n default:\n break;\n }\n };\n\n private get shouldRender(): boolean {\n return this.isOpen || this.leaving;\n }\n\n render() {\n const triggerEvents = this.trigger === 'hover' ? { onMouseEnter: this.show, onMouseLeave: this.hide } : { onClick: this.toggle };\n\n return (\n <div class=\"hb-dropdown\" {...triggerEvents} onKeyDown={this.handleTriggerKeydown}>\n <div\n class=\"hb-dropdown__trigger\"\n role=\"button\"\n tabindex={this.disabled ? -1 : 0}\n aria-haspopup=\"menu\"\n aria-expanded={this.isOpen ? 'true' : 'false'}\n aria-disabled={this.disabled ? 'true' : 'false'}\n >\n <slot />\n </div>\n {this.shouldRender && (\n <div\n class={{\n 'hb-dropdown__menu': true,\n 'hb-dropdown__menu--leaving': this.leaving,\n }}\n style={{ zIndex: String(getNextZIndex()) }}\n role=\"menu\"\n onKeyDown={this.handleMenuKeydown}\n >\n {this.items.map((item, index) => (\n <div\n class={{\n 'hb-dropdown__item': true,\n 'hb-dropdown__item--disabled': item.disabled,\n 'hb-dropdown__item--divided': item.divided,\n 'hb-dropdown__item--danger': item.danger,\n 'hb-dropdown__item--active': index === this.activeIndex,\n }}\n role=\"menuitem\"\n tabindex={-1}\n aria-disabled={item.disabled ? 'true' : undefined}\n onMouseEnter={() => {\n if (!item.disabled) this.activeIndex = index;\n }}\n onClick={() => this.handleSelect(item)}\n >\n {item.label}\n </div>\n ))}\n </div>\n )}\n </div>\n );\n }\n}\n"]}
|
|
@@ -58,6 +58,28 @@
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
@keyframes hb-dropdown-fade-in {
|
|
61
|
-
from {
|
|
62
|
-
|
|
61
|
+
from {
|
|
62
|
+
opacity: 0;
|
|
63
|
+
transform: translateY(-4px);
|
|
64
|
+
}
|
|
65
|
+
to {
|
|
66
|
+
opacity: 1;
|
|
67
|
+
transform: translateY(0);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* 离场动画 */
|
|
72
|
+
.hb-dropdown__menu--leaving {
|
|
73
|
+
animation: hb-dropdown-fade-out 0.15s ease-in forwards;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@keyframes hb-dropdown-fade-out {
|
|
77
|
+
from {
|
|
78
|
+
opacity: 1;
|
|
79
|
+
transform: translateY(0);
|
|
80
|
+
}
|
|
81
|
+
to {
|
|
82
|
+
opacity: 0;
|
|
83
|
+
transform: translateY(-4px);
|
|
84
|
+
}
|
|
63
85
|
}
|
|
@@ -3,7 +3,7 @@ export class Empty {
|
|
|
3
3
|
description = '暂无数据';
|
|
4
4
|
image;
|
|
5
5
|
render() {
|
|
6
|
-
return (h("div", { key: '
|
|
6
|
+
return (h("div", { key: '716385f61e4692d30d9ef0dab2671b4ee4a8381a', class: "hb-empty" }, h("div", { key: '39162ccfefa991ae63a59f585e7a91179b64523a', class: "hb-empty__image" }, this.image ? h("img", { src: this.image, alt: this.description }) : h("span", { class: "hb-empty__icon" }, "\uD83D\uDCED")), h("div", { key: '2ada1cc904ba094aaaf863d82ead88b81576590e', class: "hb-empty__description" }, this.description), h("div", { key: 'cb573d62ea4d81a66815a27be96617e0a3c3e470', class: "hb-empty__footer" }, h("slot", { key: '424ec328528ea66240ae4216e178bfc7f5ba2acd' }))));
|
|
7
7
|
}
|
|
8
8
|
static get is() { return "hb-empty"; }
|
|
9
9
|
static get encapsulation() { return "shadow"; }
|
|
@@ -35,11 +35,11 @@ export class FloatButton {
|
|
|
35
35
|
right: `${this.right}px`,
|
|
36
36
|
bottom: `${this.bottom}px`,
|
|
37
37
|
};
|
|
38
|
-
return (h("button", { key: '
|
|
38
|
+
return (h("button", { key: '1c3836a10620e871fd54fdcacab8ed447329203f', type: "button", class: {
|
|
39
39
|
'hb-float-button': true,
|
|
40
40
|
[`hb-float-button--${this.type}`]: true,
|
|
41
41
|
[`hb-float-button--${this.shape}`]: true,
|
|
42
|
-
}, style: style, onClick: this.handleClick }, this.icon && h("span", { key: '
|
|
42
|
+
}, style: style, onClick: this.handleClick }, this.icon && h("span", { key: 'f0eaa8a4e40805f1442a55ec6830e2ed7aa54299', class: "hb-float-button__icon" }, this.icon), this.description && h("span", { key: '8f276ce89d0ace7f26ad65bb0d41dc0a4e262a45', class: "hb-float-button__description" }, this.description), this.renderBadge()));
|
|
43
43
|
}
|
|
44
44
|
static get is() { return "hb-float-button"; }
|
|
45
45
|
static get encapsulation() { return "shadow"; }
|