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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"hb-rate.js","mappings":";;AAAA,MAAM,OAAO,GAAG,47MAA47M,CAAC;AAC78M,qBAAe,OAAO;;MCUT,IAAI;;;;;;;;;;IAIU,UAAU,GAAW,CAAC,CAAC;;;;;IAMxC,GAAG,GAAW,CAAC,CAAC;;;;;IAMhB,QAAQ,GAAY,KAAK,CAAC;;;;;IAM1B,SAAS,GAAY,KAAK,CAAC;;;;;IAM3B,QAAQ,GAAY,KAAK,CAAC;;;;;IAM1B,SAAS,GAAY,KAAK,CAAC;;;;;IAM3B,QAAQ,GAAY,KAAK,CAAC;;;;IA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GAAG,MAAM,IAAI,MAAM,CAAC;YAElC,QACE,YACE,KAAK,EAAE;oBACL,eAAe,EAAE,IAAI;oBACrB,uBAAuB,EAAE,QAAQ;oBACjC,qBAAqB,EAAE,MAAM;iBAC9B,EACD,YAAY,EAAE,MAAM,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAChD,YAAY,EAAE,IAAI,CAAC,gBAAgB,EACnC,OAAO,EAAE,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,IAE5C,IAAI,CAAC,SAAS,KACb,YACE,KAAK,EAAE;oBACL,eAAe,EAAE,IAAI;oBACrB,uBAAuB,EAAE,MAAM;iBAChC,EACD,OAAO,EAAE,CAAC,CAAC;oBACT,CAAC,CAAC,eAAe,EAAE,CAAC;oBACpB,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;iBAC/B,aAGI,CACR,EACD,YAAM,KAAK,EAAC,eAAe,iBAAa,MAAM,aAAS,CAClD,EACP;SACH,CAAC,EACD,IAAI,CAAC,SAAS,KACb,6DAAM,KAAK,EAAC,eAAe,IAAE,IAAI,CAAC,YAAY,EAAE,CAAQ,CACzD,EACA,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,EAAE,KAC9B,6DAAM,KAAK,EAAC,eAAe,IAAE,IAAI,CAAC,OAAO,EAAE,CAAQ,CACpD,CACG,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/Rate/rate.css?tag=hb-rate&encapsulation=shadow","src/components/Rate/Rate.tsx"],"sourcesContent":[":host {\n display: inline-block;\n --hb-rate-font-size: 20px;\n --hb-rate-color: var(--hb-color-warning, #e6a23c);\n --hb-rate-void-color: var(--hb-color-text-placeholder, #c0c4cc);\n}\n\n.hb-rate {\n display: inline-block;\n height: var(--hb-rate-font-size);\n line-height: var(--hb-rate-font-size);\n vertical-align: middle;\n}\n\n.hb-rate__item {\n position: relative;\n display: inline-block;\n font-size: var(--hb-rate-font-size);\n margin-right: 6px;\n color: var(--hb-rate-void-color);\n cursor: pointer;\n transition: transform 0.2s;\n}\n\n.hb-rate__item:hover {\n transform: scale(1.1);\n}\n\n.hb-rate__item--active {\n color: var(--hb-rate-color);\n}\n\n.hb-rate__icon {\n display: block;\n}\n\n.hb-rate__half {\n position: absolute;\n left: 0;\n top: 0;\n width: 50%;\n overflow: hidden;\n color: var(--hb-rate-void-color);\n}\n\n.hb-rate__half--active {\n color: var(--hb-rate-color);\n}\n\n.hb-rate__text {\n margin-left: 8px;\n font-size: 14px;\n color: var(--hb-color-text-regular, #606266);\n vertical-align: middle;\n}\n\n","import { Component, h, Prop, Event, EventEmitter, State, Watch } from '@stencil/core';\n\n/**\n * Rate 评分组件\n * 评分组件\n */\n@Component({\n tag: 'hb-rate',\n styleUrl: 'rate.css',\n shadow: true,\n})\nexport class Rate {\n /**\n * 绑定值\n */\n @Prop({ mutable: true }) modelValue: number = 0;\n\n /**\n * 最大分值\n * @default 5\n */\n @Prop() max: number = 5;\n\n /**\n * 是否禁用\n * @default false\n */\n @Prop() disabled: boolean = false;\n\n /**\n * 是否允许半选\n * @default false\n */\n @Prop() allowHalf: boolean = false;\n\n /**\n * 只读\n * @default false\n */\n @Prop() readonly: boolean = false;\n\n /**\n * 是否显示分数\n * @default false\n */\n @Prop() showScore: boolean = false;\n\n /**\n * 是否显示文本\n * @default false\n */\n @Prop() showText: boolean = false;\n\n /**\n * 辅助文字数组\n */\n @Prop() texts?: string[];\n\n /**\n * 分数显示模板\n */\n @Prop() scoreTemplate?: string;\n\n @State() hoverValue: number = 0;\n @State() currentValue: number = 0;\n\n /**\n * 值改变事件\n */\n @Event() hbChange: EventEmitter<number>;\n\n componentDidLoad() {\n this.currentValue = this.modelValue;\n }\n\n @Watch('modelValue')\n handleValueChange() {\n this.currentValue = this.modelValue;\n }\n\n private handleClick = (value: number, isHalf: boolean) => {\n if (this.disabled || this.readonly) return;\n\n const newValue = isHalf && this.allowHalf ? value - 0.5 : value;\n this.currentValue = newValue;\n this.modelValue = newValue;\n this.hoverValue = 0;\n this.hbChange.emit(newValue);\n };\n\n /**\n * 键盘调节评分(对齐 WAI-ARIA slider / antd Rate):\n * - ArrowRight/ArrowUp:增加(allowHalf 时步进 0.5,否则 1)\n * - ArrowLeft/ArrowDown:减少\n * - Home:归 0;End:满分\n */\n private handleKeydown = (e: KeyboardEvent) => {\n if (this.disabled || this.readonly) return;\n const step = this.allowHalf ? 0.5 : 1;\n let next: number | null = null;\n switch (e.key) {\n case 'ArrowRight':\n case 'ArrowUp':\n next = this.currentValue + step;\n break;\n case 'ArrowLeft':\n case 'ArrowDown':\n next = this.currentValue - step;\n break;\n case 'Home':\n next = 0;\n break;\n case 'End':\n next = this.max;\n break;\n default:\n return;\n }\n e.preventDefault();\n if (next === null) return;\n // 夹取到 [0, max],且按 step 对齐\n const clamped = Math.max(0, Math.min(next, this.max));\n // 修正浮点:allowHalf 时保留一位小数\n const snapped = this.allowHalf ? Math.round(clamped * 2) / 2 : Math.round(clamped);\n if (snapped === this.currentValue) return;\n this.currentValue = snapped;\n this.modelValue = snapped;\n this.hbChange.emit(snapped);\n };\n\n private handleMouseEnter = (value: number) => {\n if (this.disabled || this.readonly) return;\n this.hoverValue = value;\n };\n\n private handleMouseLeave = () => {\n if (this.disabled || this.readonly) return;\n this.hoverValue = 0;\n };\n\n private getDisplayValue(): number {\n return this.hoverValue || this.currentValue;\n }\n\n private getText(): string {\n const value = Math.ceil(this.currentValue);\n if (this.texts && this.texts[value - 1]) {\n return this.texts[value - 1];\n }\n return '';\n }\n\n private getScoreText(): string {\n if (this.scoreTemplate) {\n return this.scoreTemplate.replace('{value}', String(this.currentValue));\n }\n return `${this.currentValue} / ${this.max}`;\n }\n\n render() {\n const displayValue = this.getDisplayValue();\n const stars = Array.from({ length: this.max }, (_, i) => i + 1);\n\n return (\n <div\n class=\"hb-rate\"\n role=\"slider\"\n tabindex={this.disabled || this.readonly ? -1 : 0}\n aria-valuemin={0}\n aria-valuemax={this.max}\n aria-valuenow={this.currentValue}\n aria-valuetext={this.scoreTemplate ? this.getScoreText() : `${this.currentValue} 分`}\n aria-orientation=\"horizontal\"\n aria-disabled={this.disabled ? 'true' : 'false'}\n aria-readonly={this.readonly ? 'true' : 'false'}\n onKeyDown={this.handleKeydown}\n >\n {stars.map((value) => {\n const isFull = displayValue >= value;\n const isHalf = this.allowHalf && displayValue >= value - 0.5 && displayValue < value;\n const isActive = isFull || isHalf;\n\n return (\n <span\n class={{\n 'hb-rate__item': true,\n 'hb-rate__item--active': isActive,\n 'hb-rate__item--half': isHalf,\n }}\n onMouseEnter={() => this.handleMouseEnter(value)}\n onMouseLeave={this.handleMouseLeave}\n onClick={() => this.handleClick(value, false)}\n >\n {this.allowHalf && (\n <span\n class={{\n 'hb-rate__half': true,\n 'hb-rate__half--active': isHalf,\n }}\n onClick={(e) => {\n e.stopPropagation();\n this.handleClick(value, true);\n }}\n >\n ★\n </span>\n )}\n <span class=\"hb-rate__icon\" aria-hidden=\"true\">★</span>\n </span>\n );\n })}\n {this.showScore && (\n <span class=\"hb-rate__text\">{this.getScoreText()}</span>\n )}\n {this.showText && this.getText() && (\n <span class=\"hb-rate__text\">{this.getText()}</span>\n )}\n </div>\n );\n }\n}\n\n"],"version":3}
|
|
1
|
+
{"file":"hb-rate.js","mappings":";;AAAA,MAAM,OAAO,GAAG,47MAA47M,CAAC;AAC78M,qBAAe,OAAO;;MCUT,IAAI;;;;;;;;;;IAIU,UAAU,GAAW,CAAC,CAAC;;;;;IAMxC,GAAG,GAAW,CAAC,CAAC;;;;;IAMhB,QAAQ,GAAY,KAAK,CAAC;;;;;IAM1B,SAAS,GAAY,KAAK,CAAC;;;;;IAM3B,QAAQ,GAAY,KAAK,CAAC;;;;;IAM1B,SAAS,GAAY,KAAK,CAAC;;;;;IAM3B,QAAQ,GAAY,KAAK,CAAC;;;;IAK1B,KAAK,CAAY;;;;IAKjB,aAAa,CAAU;IAEt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,EAAE;oBACL,eAAe,EAAE,IAAI;oBACrB,uBAAuB,EAAE,QAAQ;oBACjC,qBAAqB,EAAE,MAAM;iBAC9B,EACD,YAAY,EAAE,MAAM,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAChD,YAAY,EAAE,IAAI,CAAC,gBAAgB,EACnC,OAAO,EAAE,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,IAE5C,IAAI,CAAC,SAAS,KACb,YACE,KAAK,EAAE;oBACL,eAAe,EAAE,IAAI;oBACrB,uBAAuB,EAAE,MAAM;iBAChC,EACD,OAAO,EAAE,CAAC;oBACR,CAAC,CAAC,eAAe,EAAE,CAAC;oBACpB,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;iBAC/B,aAGI,CACR,EACD,YAAM,KAAK,EAAC,eAAe,iBAAa,MAAM,aAEvC,CACF,EACP;SACH,CAAC,EACD,IAAI,CAAC,SAAS,IAAI,6DAAM,KAAK,EAAC,eAAe,IAAE,IAAI,CAAC,YAAY,EAAE,CAAQ,EAC1E,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,EAAE,IAAI,6DAAM,KAAK,EAAC,eAAe,IAAE,IAAI,CAAC,OAAO,EAAE,CAAQ,CACnF,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/Rate/rate.css?tag=hb-rate&encapsulation=shadow","src/components/Rate/Rate.tsx"],"sourcesContent":[":host {\n display: inline-block;\n --hb-rate-font-size: 20px;\n --hb-rate-color: var(--hb-color-warning, #e6a23c);\n --hb-rate-void-color: var(--hb-color-text-placeholder, #c0c4cc);\n}\n\n.hb-rate {\n display: inline-block;\n height: var(--hb-rate-font-size);\n line-height: var(--hb-rate-font-size);\n vertical-align: middle;\n}\n\n.hb-rate__item {\n position: relative;\n display: inline-block;\n font-size: var(--hb-rate-font-size);\n margin-right: 6px;\n color: var(--hb-rate-void-color);\n cursor: pointer;\n transition: transform 0.2s;\n}\n\n.hb-rate__item:hover {\n transform: scale(1.1);\n}\n\n.hb-rate__item--active {\n color: var(--hb-rate-color);\n}\n\n.hb-rate__icon {\n display: block;\n}\n\n.hb-rate__half {\n position: absolute;\n left: 0;\n top: 0;\n width: 50%;\n overflow: hidden;\n color: var(--hb-rate-void-color);\n}\n\n.hb-rate__half--active {\n color: var(--hb-rate-color);\n}\n\n.hb-rate__text {\n margin-left: 8px;\n font-size: 14px;\n color: var(--hb-color-text-regular, #606266);\n vertical-align: middle;\n}\n\n","import { Component, h, Prop, Event, EventEmitter, State, Watch } from '@stencil/core';\n\n/**\n * Rate 评分组件\n * 评分组件\n */\n@Component({\n tag: 'hb-rate',\n styleUrl: 'rate.css',\n shadow: true,\n})\nexport class Rate {\n /**\n * 绑定值\n */\n @Prop({ mutable: true }) modelValue: number = 0;\n\n /**\n * 最大分值\n * @default 5\n */\n @Prop() max: number = 5;\n\n /**\n * 是否禁用\n * @default false\n */\n @Prop() disabled: boolean = false;\n\n /**\n * 是否允许半选\n * @default false\n */\n @Prop() allowHalf: boolean = false;\n\n /**\n * 只读\n * @default false\n */\n @Prop() readonly: boolean = false;\n\n /**\n * 是否显示分数\n * @default false\n */\n @Prop() showScore: boolean = false;\n\n /**\n * 是否显示文本\n * @default false\n */\n @Prop() showText: boolean = false;\n\n /**\n * 辅助文字数组\n */\n @Prop() texts?: string[];\n\n /**\n * 分数显示模板\n */\n @Prop() scoreTemplate?: string;\n\n @State() hoverValue: number = 0;\n @State() currentValue: number = 0;\n\n /**\n * 值改变事件\n */\n @Event() hbChange: EventEmitter<number>;\n\n componentDidLoad() {\n this.currentValue = this.modelValue;\n }\n\n @Watch('modelValue')\n handleValueChange() {\n this.currentValue = this.modelValue;\n }\n\n private handleClick = (value: number, isHalf: boolean) => {\n if (this.disabled || this.readonly) return;\n\n const newValue = isHalf && this.allowHalf ? value - 0.5 : value;\n this.currentValue = newValue;\n this.modelValue = newValue;\n this.hoverValue = 0;\n this.hbChange.emit(newValue);\n };\n\n /**\n * 键盘调节评分(对齐 WAI-ARIA slider / antd Rate):\n * - ArrowRight/ArrowUp:增加(allowHalf 时步进 0.5,否则 1)\n * - ArrowLeft/ArrowDown:减少\n * - Home:归 0;End:满分\n */\n private handleKeydown = (e: KeyboardEvent) => {\n if (this.disabled || this.readonly) return;\n const step = this.allowHalf ? 0.5 : 1;\n let next: number | null = null;\n switch (e.key) {\n case 'ArrowRight':\n case 'ArrowUp':\n next = this.currentValue + step;\n break;\n case 'ArrowLeft':\n case 'ArrowDown':\n next = this.currentValue - step;\n break;\n case 'Home':\n next = 0;\n break;\n case 'End':\n next = this.max;\n break;\n default:\n return;\n }\n e.preventDefault();\n if (next === null) return;\n // 夹取到 [0, max],且按 step 对齐\n const clamped = Math.max(0, Math.min(next, this.max));\n // 修正浮点:allowHalf 时保留一位小数\n const snapped = this.allowHalf ? Math.round(clamped * 2) / 2 : Math.round(clamped);\n if (snapped === this.currentValue) return;\n this.currentValue = snapped;\n this.modelValue = snapped;\n this.hbChange.emit(snapped);\n };\n\n private handleMouseEnter = (value: number) => {\n if (this.disabled || this.readonly) return;\n this.hoverValue = value;\n };\n\n private handleMouseLeave = () => {\n if (this.disabled || this.readonly) return;\n this.hoverValue = 0;\n };\n\n private getDisplayValue(): number {\n return this.hoverValue || this.currentValue;\n }\n\n private getText(): string {\n const value = Math.ceil(this.currentValue);\n if (this.texts && this.texts[value - 1]) {\n return this.texts[value - 1];\n }\n return '';\n }\n\n private getScoreText(): string {\n if (this.scoreTemplate) {\n return this.scoreTemplate.replace('{value}', String(this.currentValue));\n }\n return `${this.currentValue} / ${this.max}`;\n }\n\n render() {\n const displayValue = this.getDisplayValue();\n const stars = Array.from({ length: this.max }, (_, i) => i + 1);\n\n return (\n <div\n class=\"hb-rate\"\n role=\"slider\"\n tabindex={this.disabled || this.readonly ? -1 : 0}\n aria-valuemin={0}\n aria-valuemax={this.max}\n aria-valuenow={this.currentValue}\n aria-valuetext={this.scoreTemplate ? this.getScoreText() : `${this.currentValue} 分`}\n aria-orientation=\"horizontal\"\n aria-disabled={this.disabled ? 'true' : 'false'}\n aria-readonly={this.readonly ? 'true' : 'false'}\n onKeyDown={this.handleKeydown}\n >\n {stars.map(value => {\n const isFull = displayValue >= value;\n const isHalf = this.allowHalf && displayValue >= value - 0.5 && displayValue < value;\n const isActive = isFull || isHalf;\n\n return (\n <span\n class={{\n 'hb-rate__item': true,\n 'hb-rate__item--active': isActive,\n 'hb-rate__item--half': isHalf,\n }}\n onMouseEnter={() => this.handleMouseEnter(value)}\n onMouseLeave={this.handleMouseLeave}\n onClick={() => this.handleClick(value, false)}\n >\n {this.allowHalf && (\n <span\n class={{\n 'hb-rate__half': true,\n 'hb-rate__half--active': isHalf,\n }}\n onClick={e => {\n e.stopPropagation();\n this.handleClick(value, true);\n }}\n >\n ★\n </span>\n )}\n <span class=\"hb-rate__icon\" aria-hidden=\"true\">\n ★\n </span>\n </span>\n );\n })}\n {this.showScore && <span class=\"hb-rate__text\">{this.getScoreText()}</span>}\n {this.showText && this.getText() && <span class=\"hb-rate__text\">{this.getText()}</span>}\n </div>\n );\n }\n}\n"],"version":3}
|
|
@@ -39,13 +39,13 @@ const Row = /*@__PURE__*/ proxyCustomElement(class Row extends H {
|
|
|
39
39
|
render() {
|
|
40
40
|
const gutter = this.getGutterValue();
|
|
41
41
|
const Tag = this.tag;
|
|
42
|
-
return (h(Tag, { key: '
|
|
42
|
+
return (h(Tag, { key: '24c61b29b302f92a1f24ffe7e1efcc82e5f2694d', class: {
|
|
43
43
|
'hb-row': true,
|
|
44
44
|
[`hb-row--justify-${this.justify}`]: true,
|
|
45
45
|
[`hb-row--align-${this.align}`]: true,
|
|
46
46
|
}, style: {
|
|
47
47
|
'--hb-row-gutter': gutter ? `${gutter}px` : '0',
|
|
48
|
-
} }, h("slot", { key: '
|
|
48
|
+
} }, h("slot", { key: '2f5c9b147cafb4d408b7dfbab0dc7ca5141c97e5' })));
|
|
49
49
|
}
|
|
50
50
|
static get style() { return HbRowStyle0; }
|
|
51
51
|
}, [1, "hb-row", {
|
|
@@ -105,9 +105,7 @@ const Scrollbar = /*@__PURE__*/ proxyCustomElement(class Scrollbar extends H {
|
|
|
105
105
|
if (this.wrapRef) {
|
|
106
106
|
this.wrapRef.addEventListener('scroll', this.handleScroll);
|
|
107
107
|
}
|
|
108
|
-
|
|
109
|
-
this.thumbRef.addEventListener('mousedown', this.handleThumbMouseDown);
|
|
110
|
-
}
|
|
108
|
+
// thumb 的 mousedown 绑定放在 ref 回调里(thumb 是条件渲染,componentDidLoad 时可能尚未存在)。
|
|
111
109
|
document.addEventListener('mousemove', this.handleMouseMove);
|
|
112
110
|
document.addEventListener('mouseup', this.handleMouseUp);
|
|
113
111
|
}
|
|
@@ -180,9 +178,11 @@ const Scrollbar = /*@__PURE__*/ proxyCustomElement(class Scrollbar extends H {
|
|
|
180
178
|
if (this.native) {
|
|
181
179
|
return (h("div", { class: "hb-scrollbar hb-scrollbar--native", style: style }, h("div", { class: "hb-scrollbar__wrap" }, h("div", { class: "hb-scrollbar__view" }, h("slot", null)))));
|
|
182
180
|
}
|
|
183
|
-
return (h("div", { class: "hb-scrollbar", style: style }, h("div", { class: "hb-scrollbar__wrap", ref:
|
|
181
|
+
return (h("div", { class: "hb-scrollbar", style: style }, h("div", { class: "hb-scrollbar__wrap", ref: el => (this.wrapRef = el), onScroll: this.handleScroll }, h("div", { class: "hb-scrollbar__view" }, h("slot", null))), this.scrollbarVisible && !this.native && (h("div", { class: "hb-scrollbar__bar hb-scrollbar__bar--vertical" }, h("div", { class: "hb-scrollbar__thumb", ref: el => {
|
|
182
|
+
// L5:thumb 是条件渲染(scrollbarVisible && !native),
|
|
183
|
+
// 在 ref 回调里绑定 mousedown,确保 thumb 出现时即绑定。
|
|
184
184
|
this.thumbRef = el;
|
|
185
|
-
if (el
|
|
185
|
+
if (el) {
|
|
186
186
|
el.addEventListener('mousedown', this.handleThumbMouseDown);
|
|
187
187
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AAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;SAC5B;QACD,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;SAClC;QAED,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,QACE,WACE,KAAK,EAAC,mCAAmC,EACzC,KAAK,EAAE,KAAK,IAEZ,WAAK,KAAK,EAAC,oBAAoB,IAC7B,WAAK,KAAK,EAAC,oBAAoB,IAC7B,eAAa,CACT,CACF,CACF,EACN;SACH;QAED,QACE,WAAK,KAAK,EAAC,cAAc,EAAC,KAAK,EAAE,KAAK,IACpC,WACE,KAAK,EAAC,oBAAoB,EAC1B,GAAG,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC,EAChC,QAAQ,EAAE,IAAI,CAAC,YAAY,IAE3B,WAAK,KAAK,EAAC,oBAAoB,IAC7B,eAAa,CACT,CACF,EACL,IAAI,CAAC,gBAAgB,IAAI,CAAC,IAAI,CAAC,MAAM,KACpC,WAAK,KAAK,EAAC,+CAA+C,IACxD,WACE,KAAK,EAAC,qBAAqB,EAC3B,GAAG,EAAE,CAAC,EAAE;gBACN,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;gBACnB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;oBACtB,EAAE,CAAC,gBAAgB,CAAC,WAAW,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;iBAC7D;aACF,EACD,KAAK,EAAE;gBACL,MAAM,EAAE,GAAG,IAAI,CAAC,WAAW,IAAI;gBAC/B,SAAS,EAAE,cAAc,IAAI,CAAC,QAAQ,KAAK;aAC5C,GACI,CACH,CACP,CACG,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/Scrollbar/scrollbar.css?tag=hb-scrollbar&encapsulation=shadow","src/components/Scrollbar/Scrollbar.tsx"],"sourcesContent":[":host {\n display: block;\n --hb-scrollbar-bg-color: var(--hb-fill-color-light, #f5f7fa);\n --hb-scrollbar-thumb-color: var(--hb-fill-color, #c0c4cc);\n --hb-scrollbar-thumb-hover-color: var(--hb-fill-color-dark, #a0a4ac);\n}\n\n.hb-scrollbar {\n position: relative;\n height: 100%;\n overflow: hidden;\n}\n\n.hb-scrollbar__wrap {\n overflow: auto;\n height: 100%;\n scrollbar-width: thin;\n scrollbar-color: var(--hb-scrollbar-thumb-color) var(--hb-scrollbar-bg-color);\n}\n\n.hb-scrollbar__wrap::-webkit-scrollbar {\n width: 6px;\n height: 6px;\n}\n\n.hb-scrollbar__wrap::-webkit-scrollbar-track {\n background: var(--hb-scrollbar-bg-color);\n border-radius: 3px;\n}\n\n.hb-scrollbar__wrap::-webkit-scrollbar-thumb {\n background: var(--hb-scrollbar-thumb-color);\n border-radius: 3px;\n}\n\n.hb-scrollbar__wrap::-webkit-scrollbar-thumb:hover {\n background: var(--hb-scrollbar-thumb-hover-color);\n}\n\n.hb-scrollbar--native .hb-scrollbar__wrap {\n overflow-y: auto;\n}\n\n.hb-scrollbar__view {\n width: 100%;\n}\n\n.hb-scrollbar__bar {\n position: absolute;\n right: 2px;\n bottom: 2px;\n z-index: 1;\n border-radius: 4px;\n opacity: 0;\n transition: opacity 0.12s ease-out;\n}\n\n.hb-scrollbar:hover .hb-scrollbar__bar {\n opacity: 1;\n}\n\n.hb-scrollbar__bar--vertical {\n width: 6px;\n top: 2px;\n}\n\n.hb-scrollbar__bar--vertical > div {\n width: 100%;\n}\n\n.hb-scrollbar__thumb {\n position: relative;\n display: block;\n width: 100%;\n height: 0;\n cursor: pointer;\n border-radius: inherit;\n background-color: var(--hb-scrollbar-thumb-color);\n transition: background-color 0.3s;\n}\n\n.hb-scrollbar__thumb:hover {\n background-color: var(--hb-scrollbar-thumb-hover-color);\n}\n\n","import { Component, h, Prop, Element, State, Watch, Event, EventEmitter, Method } from '@stencil/core';\n\n/**\n * Scrollbar 滚动条组件\n * 用于替换浏览器原生滚动条\n */\n@Component({\n tag: 'hb-scrollbar',\n styleUrl: 'scrollbar.css',\n shadow: true,\n})\nexport class Scrollbar {\n @Element() el: HTMLElement;\n\n /**\n * 滚动条高度\n */\n @Prop() height?: string;\n\n /**\n * 滚动条最大高度\n */\n @Prop() maxHeight?: string;\n\n /**\n * 是否总是显示滚动条\n * @default false\n */\n @Prop() always: boolean = false;\n\n /**\n * 是否显示原生滚动条\n * @default false\n */\n @Prop() native: boolean = false;\n\n /**\n * 滚动条的最小尺寸\n * @default 20\n */\n @Prop() minSize: number = 20;\n\n /**\n * 滚动事件\n */\n @Event() hbScroll: EventEmitter<{ scrollTop: number; scrollLeft: number }>;\n\n @State() scrollbarVisible: boolean = false;\n @State() thumbHeight: number = 0;\n @State() thumbTop: number = 0;\n\n private wrapRef?: HTMLDivElement;\n private thumbRef?: HTMLDivElement;\n private resizeObserver?: ResizeObserver;\n private isDragging: boolean = false;\n private startY: number = 0;\n private startScrollTop: number = 0;\n\n componentDidLoad() {\n if (!this.native) {\n this.initScrollbar();\n }\n }\n\n disconnectedCallback() {\n if (this.resizeObserver) {\n this.resizeObserver.disconnect();\n }\n this.removeEventListeners();\n }\n\n @Watch('height')\n @Watch('maxHeight')\n handleSizeChange() {\n this.updateScrollbar();\n }\n\n /**\n * 设置滚动条位置\n */\n @Method()\n async setScrollTop(top: number) {\n if (this.wrapRef) {\n this.wrapRef.scrollTop = top;\n this.updateScrollbar();\n }\n }\n\n /**\n * 设置滚动条位置\n */\n @Method()\n async setScrollLeft(left: number) {\n if (this.wrapRef) {\n this.wrapRef.scrollLeft = left;\n this.updateScrollbar();\n }\n }\n\n /**\n * 获取滚动条位置\n */\n @Method()\n async getScrollTop(): Promise<number> {\n return this.wrapRef?.scrollTop || 0;\n }\n\n /**\n * 获取滚动条位置\n */\n @Method()\n async getScrollLeft(): Promise<number> {\n return this.wrapRef?.scrollLeft || 0;\n }\n\n private initScrollbar() {\n if (!this.wrapRef) return;\n\n this.resizeObserver = new ResizeObserver(() => {\n this.updateScrollbar();\n });\n\n this.resizeObserver.observe(this.wrapRef);\n this.addEventListeners();\n this.updateScrollbar();\n }\n\n private addEventListeners() {\n if (this.wrapRef) {\n this.wrapRef.addEventListener('scroll', this.handleScroll);\n }\n if (this.thumbRef) {\n this.thumbRef.addEventListener('mousedown', this.handleThumbMouseDown);\n }\n document.addEventListener('mousemove', this.handleMouseMove);\n document.addEventListener('mouseup', this.handleMouseUp);\n }\n\n private removeEventListeners() {\n if (this.wrapRef) {\n this.wrapRef.removeEventListener('scroll', this.handleScroll);\n }\n if (this.thumbRef) {\n this.thumbRef.removeEventListener('mousedown', this.handleThumbMouseDown);\n }\n document.removeEventListener('mousemove', this.handleMouseMove);\n document.removeEventListener('mouseup', this.handleMouseUp);\n }\n\n private updateScrollbar() {\n if (!this.wrapRef) return;\n\n const wrapHeight = this.wrapRef.clientHeight;\n const scrollHeight = this.wrapRef.scrollHeight;\n const scrollTop = this.wrapRef.scrollTop;\n\n const hasScroll = scrollHeight > wrapHeight;\n this.scrollbarVisible = hasScroll || this.always;\n\n if (hasScroll && this.thumbRef) {\n const thumbHeight = Math.max(\n this.minSize,\n (wrapHeight / scrollHeight) * wrapHeight\n );\n const maxThumbTop = wrapHeight - thumbHeight;\n const thumbTop = (scrollTop / (scrollHeight - wrapHeight)) * maxThumbTop;\n\n this.thumbHeight = thumbHeight;\n this.thumbTop = Math.max(0, Math.min(maxThumbTop, thumbTop));\n }\n }\n\n private handleScroll = () => {\n this.updateScrollbar();\n if (this.wrapRef) {\n this.hbScroll.emit({\n scrollTop: this.wrapRef.scrollTop,\n scrollLeft: this.wrapRef.scrollLeft,\n });\n }\n };\n\n private handleThumbMouseDown = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n this.isDragging = true;\n this.startY = e.clientY;\n this.startScrollTop = this.wrapRef?.scrollTop || 0;\n };\n\n private handleMouseMove = (e: MouseEvent) => {\n if (!this.isDragging || !this.wrapRef) return;\n\n const deltaY = e.clientY - this.startY;\n const wrapHeight = this.wrapRef.clientHeight;\n const scrollHeight = this.wrapRef.scrollHeight;\n const maxScrollTop = scrollHeight - wrapHeight;\n const thumbHeight = this.thumbHeight;\n const maxThumbTop = wrapHeight - thumbHeight;\n\n const scrollDelta = (deltaY / maxThumbTop) * maxScrollTop;\n const newScrollTop = Math.max(0, Math.min(maxScrollTop, this.startScrollTop + scrollDelta));\n\n this.wrapRef.scrollTop = newScrollTop;\n };\n\n private handleMouseUp = () => {\n this.isDragging = false;\n };\n\n render() {\n const style: any = {};\n if (this.height) {\n style.height = this.height;\n }\n if (this.maxHeight) {\n style.maxHeight = this.maxHeight;\n }\n\n if (this.native) {\n return (\n <div\n class=\"hb-scrollbar hb-scrollbar--native\"\n style={style}\n >\n <div class=\"hb-scrollbar__wrap\">\n <div class=\"hb-scrollbar__view\">\n <slot></slot>\n </div>\n </div>\n </div>\n );\n }\n\n return (\n <div class=\"hb-scrollbar\" style={style}>\n <div\n class=\"hb-scrollbar__wrap\"\n ref={(el) => (this.wrapRef = el)}\n onScroll={this.handleScroll}\n >\n <div class=\"hb-scrollbar__view\">\n <slot></slot>\n </div>\n </div>\n {this.scrollbarVisible && !this.native && (\n <div class=\"hb-scrollbar__bar hb-scrollbar__bar--vertical\">\n <div\n class=\"hb-scrollbar__thumb\"\n ref={(el) => {\n this.thumbRef = el;\n if (el && !this.native) {\n el.addEventListener('mousedown', this.handleThumbMouseDown);\n }\n }}\n style={{\n height: `${this.thumbHeight}px`,\n transform: `translateY(${this.thumbTop}px)`,\n }}\n ></div>\n </div>\n )}\n </div>\n );\n }\n}\n\n"],"version":3}
|
|
1
|
+
{"file":"hb-scrollbar.js","mappings":";;AAAA,MAAM,YAAY,GAAG,q8OAAq8O,CAAC;AAC39O,0BAAe,YAAY;;MCUd,SAAS;;;;;;;;;;;IAMZ,MAAM,CAAU;;;;IAKhB,SAAS,CAAU;;;;;IAMnB,MAAM,GAAY,KAAK,CAAC;;;;;IAMx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AE,KAAK,IACpC,WAAK,KAAK,EAAC,oBAAoB,EAAC,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,YAAY,IACzF,WAAK,KAAK,EAAC,oBAAoB,IAC7B,eAAa,CACT,CACF,EACL,IAAI,CAAC,gBAAgB,IAAI,CAAC,IAAI,CAAC,MAAM,KACpC,WAAK,KAAK,EAAC,+CAA+C,IACxD,WACE,KAAK,EAAC,qBAAqB,EAC3B,GAAG,EAAE,EAAE;;;gBAGL,IAAI,CAAC,QAAQ,GAAG,EAAgC,CAAC;gBACjD,IAAI,EAAE,EAAE;oBACN,EAAE,CAAC,gBAAgB,CAAC,WAAW,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;iBAC7D;aACF,EACD,KAAK,EAAE;gBACL,MAAM,EAAE,GAAG,IAAI,CAAC,WAAW,IAAI;gBAC/B,SAAS,EAAE,cAAc,IAAI,CAAC,QAAQ,KAAK;aAC5C,GACI,CACH,CACP,CACG,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/Scrollbar/scrollbar.css?tag=hb-scrollbar&encapsulation=shadow","src/components/Scrollbar/Scrollbar.tsx"],"sourcesContent":[":host {\n display: block;\n --hb-scrollbar-bg-color: var(--hb-fill-color-light, #f5f7fa);\n --hb-scrollbar-thumb-color: var(--hb-fill-color, #c0c4cc);\n --hb-scrollbar-thumb-hover-color: var(--hb-fill-color-dark, #a0a4ac);\n}\n\n.hb-scrollbar {\n position: relative;\n height: 100%;\n overflow: hidden;\n}\n\n.hb-scrollbar__wrap {\n overflow: auto;\n height: 100%;\n scrollbar-width: thin;\n scrollbar-color: var(--hb-scrollbar-thumb-color) var(--hb-scrollbar-bg-color);\n}\n\n.hb-scrollbar__wrap::-webkit-scrollbar {\n width: 6px;\n height: 6px;\n}\n\n.hb-scrollbar__wrap::-webkit-scrollbar-track {\n background: var(--hb-scrollbar-bg-color);\n border-radius: 3px;\n}\n\n.hb-scrollbar__wrap::-webkit-scrollbar-thumb {\n background: var(--hb-scrollbar-thumb-color);\n border-radius: 3px;\n}\n\n.hb-scrollbar__wrap::-webkit-scrollbar-thumb:hover {\n background: var(--hb-scrollbar-thumb-hover-color);\n}\n\n.hb-scrollbar--native .hb-scrollbar__wrap {\n overflow-y: auto;\n}\n\n.hb-scrollbar__view {\n width: 100%;\n}\n\n.hb-scrollbar__bar {\n position: absolute;\n right: 2px;\n bottom: 2px;\n z-index: 1;\n border-radius: 4px;\n opacity: 0;\n transition: opacity 0.12s ease-out;\n}\n\n.hb-scrollbar:hover .hb-scrollbar__bar {\n opacity: 1;\n}\n\n.hb-scrollbar__bar--vertical {\n width: 6px;\n top: 2px;\n}\n\n.hb-scrollbar__bar--vertical > div {\n width: 100%;\n}\n\n.hb-scrollbar__thumb {\n position: relative;\n display: block;\n width: 100%;\n height: 0;\n cursor: pointer;\n border-radius: inherit;\n background-color: var(--hb-scrollbar-thumb-color);\n transition: background-color 0.3s;\n}\n\n.hb-scrollbar__thumb:hover {\n background-color: var(--hb-scrollbar-thumb-hover-color);\n}\n\n","import { Component, h, Prop, Element, State, Watch, Event, EventEmitter, Method } from '@stencil/core';\n\n/**\n * Scrollbar 滚动条组件\n * 用于替换浏览器原生滚动条\n */\n@Component({\n tag: 'hb-scrollbar',\n styleUrl: 'scrollbar.css',\n shadow: true,\n})\nexport class Scrollbar {\n @Element() el: HTMLElement;\n\n /**\n * 滚动条高度\n */\n @Prop() height?: string;\n\n /**\n * 滚动条最大高度\n */\n @Prop() maxHeight?: string;\n\n /**\n * 是否总是显示滚动条\n * @default false\n */\n @Prop() always: boolean = false;\n\n /**\n * 是否显示原生滚动条\n * @default false\n */\n @Prop() native: boolean = false;\n\n /**\n * 滚动条的最小尺寸\n * @default 20\n */\n @Prop() minSize: number = 20;\n\n /**\n * 滚动事件\n */\n @Event() hbScroll: EventEmitter<{ scrollTop: number; scrollLeft: number }>;\n\n @State() scrollbarVisible: boolean = false;\n @State() thumbHeight: number = 0;\n @State() thumbTop: number = 0;\n\n private wrapRef?: HTMLDivElement;\n private thumbRef?: HTMLDivElement;\n private resizeObserver?: ResizeObserver;\n private isDragging: boolean = false;\n private startY: number = 0;\n private startScrollTop: number = 0;\n\n componentDidLoad() {\n if (!this.native) {\n this.initScrollbar();\n }\n }\n\n disconnectedCallback() {\n if (this.resizeObserver) {\n this.resizeObserver.disconnect();\n }\n this.removeEventListeners();\n }\n\n @Watch('height')\n @Watch('maxHeight')\n handleSizeChange() {\n this.updateScrollbar();\n }\n\n /**\n * 设置滚动条位置\n */\n @Method()\n async setScrollTop(top: number) {\n if (this.wrapRef) {\n this.wrapRef.scrollTop = top;\n this.updateScrollbar();\n }\n }\n\n /**\n * 设置滚动条位置\n */\n @Method()\n async setScrollLeft(left: number) {\n if (this.wrapRef) {\n this.wrapRef.scrollLeft = left;\n this.updateScrollbar();\n }\n }\n\n /**\n * 获取滚动条位置\n */\n @Method()\n async getScrollTop(): Promise<number> {\n return this.wrapRef?.scrollTop || 0;\n }\n\n /**\n * 获取滚动条位置\n */\n @Method()\n async getScrollLeft(): Promise<number> {\n return this.wrapRef?.scrollLeft || 0;\n }\n\n private initScrollbar() {\n if (!this.wrapRef) return;\n\n this.resizeObserver = new ResizeObserver(() => {\n this.updateScrollbar();\n });\n\n this.resizeObserver.observe(this.wrapRef);\n this.addEventListeners();\n this.updateScrollbar();\n }\n\n private addEventListeners() {\n if (this.wrapRef) {\n this.wrapRef.addEventListener('scroll', this.handleScroll);\n }\n // thumb 的 mousedown 绑定放在 ref 回调里(thumb 是条件渲染,componentDidLoad 时可能尚未存在)。\n document.addEventListener('mousemove', this.handleMouseMove);\n document.addEventListener('mouseup', this.handleMouseUp);\n }\n\n private removeEventListeners() {\n if (this.wrapRef) {\n this.wrapRef.removeEventListener('scroll', this.handleScroll);\n }\n if (this.thumbRef) {\n this.thumbRef.removeEventListener('mousedown', this.handleThumbMouseDown);\n }\n document.removeEventListener('mousemove', this.handleMouseMove);\n document.removeEventListener('mouseup', this.handleMouseUp);\n }\n\n private updateScrollbar() {\n if (!this.wrapRef) return;\n\n const wrapHeight = this.wrapRef.clientHeight;\n const scrollHeight = this.wrapRef.scrollHeight;\n const scrollTop = this.wrapRef.scrollTop;\n\n const hasScroll = scrollHeight > wrapHeight;\n this.scrollbarVisible = hasScroll || this.always;\n\n if (hasScroll && this.thumbRef) {\n const thumbHeight = Math.max(this.minSize, (wrapHeight / scrollHeight) * wrapHeight);\n const maxThumbTop = wrapHeight - thumbHeight;\n const thumbTop = (scrollTop / (scrollHeight - wrapHeight)) * maxThumbTop;\n\n this.thumbHeight = thumbHeight;\n this.thumbTop = Math.max(0, Math.min(maxThumbTop, thumbTop));\n }\n }\n\n private handleScroll = () => {\n this.updateScrollbar();\n if (this.wrapRef) {\n this.hbScroll.emit({\n scrollTop: this.wrapRef.scrollTop,\n scrollLeft: this.wrapRef.scrollLeft,\n });\n }\n };\n\n private handleThumbMouseDown = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n this.isDragging = true;\n this.startY = e.clientY;\n this.startScrollTop = this.wrapRef?.scrollTop || 0;\n };\n\n private handleMouseMove = (e: MouseEvent) => {\n if (!this.isDragging || !this.wrapRef) return;\n\n const deltaY = e.clientY - this.startY;\n const wrapHeight = this.wrapRef.clientHeight;\n const scrollHeight = this.wrapRef.scrollHeight;\n const maxScrollTop = scrollHeight - wrapHeight;\n const thumbHeight = this.thumbHeight;\n const maxThumbTop = wrapHeight - thumbHeight;\n\n const scrollDelta = (deltaY / maxThumbTop) * maxScrollTop;\n const newScrollTop = Math.max(0, Math.min(maxScrollTop, this.startScrollTop + scrollDelta));\n\n this.wrapRef.scrollTop = newScrollTop;\n };\n\n private handleMouseUp = () => {\n this.isDragging = false;\n };\n\n render() {\n const style: any = {};\n if (this.height) {\n style.height = this.height;\n }\n if (this.maxHeight) {\n style.maxHeight = this.maxHeight;\n }\n\n if (this.native) {\n return (\n <div class=\"hb-scrollbar hb-scrollbar--native\" style={style}>\n <div class=\"hb-scrollbar__wrap\">\n <div class=\"hb-scrollbar__view\">\n <slot></slot>\n </div>\n </div>\n </div>\n );\n }\n\n return (\n <div class=\"hb-scrollbar\" style={style}>\n <div class=\"hb-scrollbar__wrap\" ref={el => (this.wrapRef = el)} onScroll={this.handleScroll}>\n <div class=\"hb-scrollbar__view\">\n <slot></slot>\n </div>\n </div>\n {this.scrollbarVisible && !this.native && (\n <div class=\"hb-scrollbar__bar hb-scrollbar__bar--vertical\">\n <div\n class=\"hb-scrollbar__thumb\"\n ref={el => {\n // L5:thumb 是条件渲染(scrollbarVisible && !native),\n // 在 ref 回调里绑定 mousedown,确保 thumb 出现时即绑定。\n this.thumbRef = el as HTMLDivElement | undefined;\n if (el) {\n el.addEventListener('mousedown', this.handleThumbMouseDown);\n }\n }}\n style={{\n height: `${this.thumbHeight}px`,\n transform: `translateY(${this.thumbTop}px)`,\n }}\n ></div>\n </div>\n )}\n </div>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, c as createEvent, h } from './p-1407a5e8.js';
|
|
2
|
-
import { h as handleListKeyboard } from './p-
|
|
2
|
+
import { h as handleListKeyboard } from './p-00aa34c8.js';
|
|
3
3
|
|
|
4
4
|
const segmentedCss = "/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:host,:root{--font-sans:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,::backdrop,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}::file-selector-button{appearance:button;background-color:#0000;border:0 solid;border-radius:0;box-sizing:border-box;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;margin:0;margin-inline-end:4px;opacity:1;padding:0}:host,html{-webkit-text-size-adjust:100%;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);line-height:1.5;tab-size:4;-webkit-tap-highlight-color:transparent}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}button,input,optgroup,select,textarea{background-color:#0000;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex;padding-block:0}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.block{display:block}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}} /*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{}@layer base{}@layer components;:host{display:block}.hb-segmented{background:var(--hb-color-fill);border-radius:var(--hb-border-radius-base);box-sizing:border-box;display:inline-flex;padding:2px}.hb-segmented--block{display:flex;width:100%}.hb-segmented__items{display:inline-flex;gap:2px;width:100%}.hb-segmented--large .hb-segmented__item{font-size:var(--hb-font-size-base);padding:6px 18px}.hb-segmented--default .hb-segmented__item{font-size:var(--hb-font-size-sm);padding:4px 14px}.hb-segmented--small .hb-segmented__item{font-size:var(--hb-font-size-xs);padding:2px 10px}.hb-segmented__item{align-items:center;background:0 0;border:none;border-radius:var(--hb-border-radius-sm);color:var(--hb-color-text);cursor:pointer;display:inline-flex;flex:1;font-family:inherit;justify-content:center;line-height:1.5;transition:background .2s,color .2s;white-space:nowrap}.hb-segmented__item:hover:not(.hb-segmented__item--active):not(.hb-segmented__item--disabled){background:var(--hb-color-fill-secondary)}.hb-segmented__item--active{background:var(--hb-color-bg-container);box-shadow:0 2px 8px #00000014;color:var(--hb-color-primary);font-weight:500}.hb-segmented__item--disabled{color:var(--hb-color-text-disabled);cursor:not-allowed}.hb-segmented__item-label{pointer-events:none}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}";
|
|
5
5
|
const HbSegmentedStyle0 = segmentedCss;
|
|
@@ -26,6 +26,14 @@ const Segmented = /*@__PURE__*/ proxyCustomElement(class Segmented extends H {
|
|
|
26
26
|
componentWillLoad() {
|
|
27
27
|
this.syncActiveIndex();
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* 受控同步:父组件后续修改 modelValue 时,重新计算 activeIndex。
|
|
31
|
+
* 修复 B3——修复前 activeIndex 仅在 componentWillLoad 算一次,
|
|
32
|
+
* 导致受控用法下 roving tabindex 与键盘导航依赖的 activeIndex 失同步。
|
|
33
|
+
*/
|
|
34
|
+
handleModelValueChange() {
|
|
35
|
+
this.syncActiveIndex();
|
|
36
|
+
}
|
|
29
37
|
syncActiveIndex() {
|
|
30
38
|
this.activeIndex = this.options.findIndex(o => o.value === this.modelValue);
|
|
31
39
|
}
|
|
@@ -55,7 +63,7 @@ const Segmented = /*@__PURE__*/ proxyCustomElement(class Segmented extends H {
|
|
|
55
63
|
}
|
|
56
64
|
};
|
|
57
65
|
render() {
|
|
58
|
-
return (h("div", { key: '
|
|
66
|
+
return (h("div", { key: '9622d7e18536e3ad05523ee71c39370f731643c6', class: { 'hb-segmented': true, [`hb-segmented--${this.size}`]: true, 'hb-segmented--block': this.block }, role: "radiogroup", onKeyDown: this.handleKeydown }, h("div", { key: '9305a866572f038282c9bbf12ba38bf3561d2b86', class: "hb-segmented__items" }, this.options.map((option, index) => {
|
|
59
67
|
const checked = option.value === this.modelValue;
|
|
60
68
|
// roving tabindex:仅选中项(或未选中时首个启用项)可达 Tab
|
|
61
69
|
const isFirstEnabled = this.options.findIndex(o => !o.disabled) === index;
|
|
@@ -67,6 +75,9 @@ const Segmented = /*@__PURE__*/ proxyCustomElement(class Segmented extends H {
|
|
|
67
75
|
}, disabled: !!option.disabled, role: "radio", "aria-checked": checked ? 'true' : 'false', tabindex: option.disabled ? -1 : tabindex, onClick: () => this.handleSelect(option) }, h("span", { class: "hb-segmented__item-label" }, option.label)));
|
|
68
76
|
}))));
|
|
69
77
|
}
|
|
78
|
+
static get watchers() { return {
|
|
79
|
+
"modelValue": ["handleModelValueChange"]
|
|
80
|
+
}; }
|
|
70
81
|
static get style() { return HbSegmentedStyle0; }
|
|
71
82
|
}, [1, "hb-segmented", {
|
|
72
83
|
"modelValue": [1025, "model-value"],
|
|
@@ -74,6 +85,8 @@ const Segmented = /*@__PURE__*/ proxyCustomElement(class Segmented extends H {
|
|
|
74
85
|
"size": [1],
|
|
75
86
|
"options": [16],
|
|
76
87
|
"activeIndex": [32]
|
|
88
|
+
}, undefined, {
|
|
89
|
+
"modelValue": ["handleModelValueChange"]
|
|
77
90
|
}]);
|
|
78
91
|
function defineCustomElement$1() {
|
|
79
92
|
if (typeof customElements === "undefined") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"hb-segmented.js","mappings":";;;AAAA,MAAM,YAAY,GAAG,i2NAAi2N,CAAC;AACv3N,0BAAe,YAAY;;MCYd,SAAS;;;;;;;;;IAIK,UAAU,GAAW,EAAE,CAAC;;IAGzC,KAAK,GAAY,KAAK,CAAC;;IAGvB,IAAI,GAAkC,SAAS,CAAC;;IAGhD,OAAO,GAAsB,EAAE,CAAC;IAE/B,WAAW,GAAW,CAAC,CAAC,CAAC;;IAGzB,QAAQ,CAAuB;IAExC,iBAAiB;QACf,IAAI,CAAC,eAAe,EAAE,CAAC;KACxB;IAEO,eAAe;QACrB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,UAAU,CAAC,CAAC;KAC7E;IAEO,YAAY,GAAG,CAAC,MAAuB;QAC7C,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC,UAAU;YAAE,OAAO;QAChE,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC;QAC/B,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,KAA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AAM,CAAC,KAAK,CAAQ,CACrD,EACT;SACH,CAAC,CACE,CACF,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/Segmented/segmented.css?tag=hb-segmented&encapsulation=shadow","src/components/Segmented/Segmented.tsx"],"sourcesContent":[":host { display: block; }\n.hb-segmented {\n display: inline-flex;\n padding: 2px;\n background: var(--hb-color-fill);\n border-radius: var(--hb-border-radius-base);\n box-sizing: border-box;\n}\n.hb-segmented--block { display: flex; width: 100%; }\n.hb-segmented__items { display: inline-flex; gap: 2px; width: 100%; }\n\n/* 尺寸 */\n.hb-segmented--large .hb-segmented__item { padding: 6px 18px; font-size: var(--hb-font-size-base); }\n.hb-segmented--default .hb-segmented__item { padding: 4px 14px; font-size: var(--hb-font-size-sm); }\n.hb-segmented--small .hb-segmented__item { padding: 2px 10px; font-size: var(--hb-font-size-xs); }\n\n.hb-segmented__item {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border: none;\n background: transparent;\n color: var(--hb-color-text);\n cursor: pointer;\n border-radius: var(--hb-border-radius-sm);\n transition: background 0.2s, color 0.2s;\n white-space: nowrap;\n flex: 1;\n line-height: 1.5;\n font-family: inherit;\n}\n.hb-segmented__item:hover:not(.hb-segmented__item--active):not(.hb-segmented__item--disabled) {\n background: var(--hb-color-fill-secondary);\n}\n/* 高亮滑块背景 */\n.hb-segmented__item--active {\n background: var(--hb-color-bg-container);\n color: var(--hb-color-primary);\n font-weight: 500;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);\n}\n.hb-segmented__item--disabled {\n color: var(--hb-color-text-disabled);\n cursor: not-allowed;\n}\n.hb-segmented__item-label { pointer-events: none; }\n","import { Component, h, Prop, Event, EventEmitter, State, Element, Watch } from '@stencil/core';\nimport { handleListKeyboard } from '../../utils/a11y';\n\n/**\n * Segmented 分段控制器组件\n * 类似 iOS 分段控件,选中项有高亮滑块背景。\n *\n * 无障碍(对齐 WAI-ARIA radiogroup / antd Segmented):\n * - 容器 role=radiogroup\n * - 选项 role=radio + aria-checked + tabindex(仅选中项 tabindex=0,roving)\n * - 键盘:←→ 在选项间移动并选中、Home/End 跳首尾\n */\n@Component({ tag: 'hb-segmented', styleUrl: 'segmented.css', shadow: true })\nexport class Segmented {\n @Element() el: HTMLElement;\n\n /** 当前选中值 */\n @Prop({ mutable: true }) modelValue: string = '';\n\n /** 是否撑满宽度 */\n @Prop() block: boolean = false;\n\n /** 尺寸 */\n @Prop() size: 'large' | 'default' | 'small' = 'default';\n\n /** 选项数组 */\n @Prop() options: SegmentedOption[] = [];\n\n @State() activeIndex: number = -1;\n\n /** 选中值变化事件 */\n @Event() hbChange: EventEmitter<string>;\n\n componentWillLoad() {\n this.syncActiveIndex();\n }\n\n /**\n * 受控同步:父组件后续修改 modelValue 时,重新计算 activeIndex。\n * 修复 B3——修复前 activeIndex 仅在 componentWillLoad 算一次,\n * 导致受控用法下 roving tabindex 与键盘导航依赖的 activeIndex 失同步。\n */\n @Watch('modelValue')\n handleModelValueChange() {\n this.syncActiveIndex();\n }\n\n private syncActiveIndex() {\n this.activeIndex = this.options.findIndex(o => o.value === this.modelValue);\n }\n\n private handleSelect = (option: SegmentedOption) => {\n if (option.disabled || option.value === this.modelValue) return;\n this.modelValue = option.value;\n this.syncActiveIndex();\n this.hbChange.emit(option.value);\n };\n\n /** 键盘导航:radiogroup 模式,←→/Home/End 移动并选中(跳过禁用项) */\n private handleKeydown = (e: KeyboardEvent) => {\n const enabled = this.options.map((o, i) => ({ o, i })).filter(x => !x.o.disabled);\n if (enabled.length === 0) return;\n const enabledIndices = enabled.map(x => x.i);\n // 在启用项索引空间内做导航\n const action = handleListKeyboard(e, {\n activeIndex: enabledIndices.indexOf(this.activeIndex),\n itemCount: enabled.length,\n loop: true,\n });\n if (action.type === 'navigate') {\n e.preventDefault();\n const targetIdx = enabledIndices[action.index];\n this.handleSelect(this.options[targetIdx]);\n }\n };\n\n render() {\n return (\n <div class={{ 'hb-segmented': true, [`hb-segmented--${this.size}`]: true, 'hb-segmented--block': this.block }} role=\"radiogroup\" onKeyDown={this.handleKeydown}>\n <div class=\"hb-segmented__items\">\n {this.options.map((option, index) => {\n const checked = option.value === this.modelValue;\n // roving tabindex:仅选中项(或未选中时首个启用项)可达 Tab\n const isFirstEnabled = this.options.findIndex(o => !o.disabled) === index;\n const tabindex = checked || (this.activeIndex < 0 && isFirstEnabled) ? 0 : -1;\n return (\n <button\n type=\"button\"\n class={{\n 'hb-segmented__item': true,\n 'hb-segmented__item--active': checked,\n 'hb-segmented__item--disabled': !!option.disabled,\n }}\n disabled={!!option.disabled}\n role=\"radio\"\n aria-checked={checked ? 'true' : 'false'}\n tabindex={option.disabled ? -1 : tabindex}\n onClick={() => this.handleSelect(option)}\n >\n <span class=\"hb-segmented__item-label\">{option.label}</span>\n </button>\n );\n })}\n </div>\n </div>\n );\n }\n}\n\nexport interface SegmentedOption {\n value: string;\n label: string;\n disabled?: boolean;\n}\n"],"version":3}
|
|
@@ -1,8 +1,47 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, c as createEvent, h } from './p-1407a5e8.js';
|
|
2
2
|
import { c as createClickOutsideHandler } from './p-4ef5a884.js';
|
|
3
|
-
import { h as handleListKeyboard } from './p-
|
|
3
|
+
import { a as activationClickHandler, h as handleListKeyboard } from './p-00aa34c8.js';
|
|
4
4
|
|
|
5
|
-
const selectCss = "/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:host,:root{--font-sans:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,::backdrop,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}::file-selector-button{appearance:button;background-color:#0000;border:0 solid;border-radius:0;box-sizing:border-box;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;margin:0;margin-inline-end:4px;opacity:1;padding:0}:host,html{-webkit-text-size-adjust:100%;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);line-height:1.5;tab-size:4;-webkit-tap-highlight-color:transparent}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}button,input,optgroup,select,textarea{background-color:#0000;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex;padding-block:0}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}} /*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{}@layer base{}@layer components;:host{--hb-select-font-size:14px;--hb-select-height:32px;--hb-select-border-color:var(--hb-border-color,#dcdfe6);--hb-select-border-color-hover:var(--hb-color-primary);--hb-select-bg-color:var(--hb-color-white,#fff);--hb-select-text-color:var(--hb-color-text-regular,#606266);--hb-select-placeholder-color:var(--hb-color-text-placeholder,#c0c4cc);display:inline-block;position:relative}.hb-select{display:inline-block;position:relative;width:240px}.hb-select__input-wrapper{position:relative}.hb-select__input,.hb-select__input-wrapper{cursor:pointer;display:inline-block;width:100%}.hb-select__input{background-color:var(--hb-select-bg-color);border:1px solid var(--hb-select-border-color);border-radius:4px;box-sizing:border-box;color:var(--hb-select-text-color);font-size:var(--hb-select-font-size);height:var(--hb-select-height);line-height:var(--hb-select-height);outline:none;padding:0 30px 0 15px;transition:border-color .2s cubic-bezier(.645,.045,.355,1)}.hb-select__input::placeholder{color:var(--hb-select-placeholder-color)}.hb-select__input:focus,.hb-select__input:hover:not(:disabled){border-color:var(--hb-select-border-color-hover)}.hb-select__tags{align-items:center;background-color:var(--hb-select-bg-color);border:1px solid var(--hb-select-border-color);border-radius:4px;display:flex;flex-wrap:wrap;min-height:var(--hb-select-height);padding:0 30px 0 5px}.hb-select__tag{align-items:center;background-color:var(--hb-fill-color-light,#f0f2f5);border:1px solid var(--hb-border-color-lighter,#e4e7ed);border-radius:4px;color:var(--hb-color-text-regular,#606266);display:inline-flex;font-size:12px;height:24px;margin:2px 0 2px 6px;padding:0 8px}.hb-select__tag-text{margin-right:4px}.hb-select__tag-close{align-items:center;color:var(--hb-color-text-placeholder,#c0c4cc);cursor:pointer;display:inline-flex;height:12px;justify-content:center;transition:color .2s;width:12px}.hb-select__tag-close svg{height:100%;width:100%}.hb-select__tag-close:hover{color:var(--hb-color-text-regular,#606266)}.hb-select__suffix{align-items:center;color:var(--hb-select-text-color);display:flex;position:absolute;right:8px;top:50%;transform:translateY(-50%)}.hb-select__clear{align-items:center;color:var(--hb-select-placeholder-color);cursor:pointer;display:inline-flex;height:14px;justify-content:center;margin-right:8px;transition:color .2s;width:14px}.hb-select__clear svg{height:100%;width:100%}.hb-select__clear:hover{color:var(--hb-select-text-color)}.hb-select__arrow{align-items:center;color:var(--hb-select-placeholder-color);display:inline-flex;height:12px;justify-content:center;transition:transform .3s;width:12px}.hb-select__arrow svg{height:100%;width:100%}.hb-select--open .hb-select__arrow{transform:rotate(180deg)}.hb-select__dropdown{background-color:var(--hb-select-bg-color);border:1px solid var(--hb-select-border-color);border-radius:4px;box-shadow:0 2px 12px #0000001a;left:0;margin-top:4px;max-height:300px;min-width:100%;overflow-y:auto;position:absolute;top:100%;z-index:1000}.hb-select__menu{list-style:none;margin:0;padding:6px 0}.hb-select__menu-item{align-items:center;color:var(--hb-select-text-color);cursor:pointer;display:flex;font-size:var(--hb-select-font-size);padding:8px 20px;transition:background-color .2s}.hb-select__menu-item:hover:not(.hb-select__menu-item--disabled):not(.hb-select__menu-item--divided){background-color:var(--hb-fill-color-light,#f5f7fa)}.hb-select__menu-item--selected{color:var(--hb-color-primary);font-weight:600}.hb-select__menu-item--disabled{color:var(--hb-color-text-disabled,#c0c4cc);cursor:not-allowed}.hb-select__menu-item--divided{border-top:1px solid var(--hb-border-color-lighter,#e4e7ed);margin-top:6px;padding-top:6px}.hb-select__menu-item--empty{color:var(--hb-select-placeholder-color);cursor:default}.hb-select__menu-item-checkbox{align-items:center;color:var(--hb-color-primary,#1677ff);display:inline-flex;height:14px;justify-content:center;margin-right:8px;width:14px}.hb-select__menu-item-checkbox svg{height:100%;width:100%}.hb-select__menu-item--create{color:var(--hb-color-primary,#1677ff);font-weight:500}.hb-select__menu-item--create:hover{background-color:var(--hb-color-primary-bg,#e6f4ff)}.hb-select__menu-item-label{flex:1}.hb-select--small{font-size:12px}.hb-select--small .hb-select__input{font-size:12px;height:24px;line-height:24px;padding:0 25px 0 12px}.hb-select--large{font-size:16px}.hb-select--large .hb-select__input{font-size:16px;height:40px;line-height:40px;padding:0 35px 0 18px}.hb-select--disabled{cursor:not-allowed}.hb-select--disabled .hb-select__input{background-color:var(--hb-fill-color-light,#f5f7fa);border-color:var(--hb-select-border-color);color:var(--hb-color-text-disabled,#c0c4cc);cursor:not-allowed}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}";
|
|
5
|
+
/**
|
|
6
|
+
* 通用虚拟滚动工具(V1,包2)。
|
|
7
|
+
*
|
|
8
|
+
* 从 Table 的虚拟滚动逻辑提取,供 Select/Cascader/Tree/TreeSelect/Menu 复用。
|
|
9
|
+
* 仅渲染「可见窗口 + 上下缓冲」范围的项,而非全量列表——1000+ 选项时 DOM 节点数恒定。
|
|
10
|
+
*
|
|
11
|
+
* 用法(组件内):
|
|
12
|
+
* 1. 维护 scrollTop state(onScroll 回调更新)
|
|
13
|
+
* 2. 调 getVirtualRange({ total, itemHeight, viewportHeight, scrollTop, buffer }) 得 [start, end)
|
|
14
|
+
* 3. 仅渲染 list.slice(start, end),用 getOffsetTop(start, itemHeight) 撑出顶部空白
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* 计算可见窗口 [startIndex, endIndex)。
|
|
18
|
+
* startIndex 夹到 [0, total),endIndex 夹到 [0, total]。
|
|
19
|
+
*/
|
|
20
|
+
function getVirtualRange(opts) {
|
|
21
|
+
const { total, viewportHeight, scrollTop, buffer = 5 } = opts;
|
|
22
|
+
if (total <= 0)
|
|
23
|
+
return { startIndex: 0, endIndex: 0 };
|
|
24
|
+
const itemHeight = opts.itemHeight > 0 ? opts.itemHeight : 1;
|
|
25
|
+
let startIndex = Math.floor(scrollTop / itemHeight) - buffer;
|
|
26
|
+
if (startIndex < 0)
|
|
27
|
+
startIndex = 0;
|
|
28
|
+
let endIndex = Math.ceil((scrollTop + viewportHeight) / itemHeight) + buffer;
|
|
29
|
+
if (endIndex > total)
|
|
30
|
+
endIndex = total;
|
|
31
|
+
return { startIndex, endIndex };
|
|
32
|
+
}
|
|
33
|
+
/** 撑出顶部空白高度(px),用于偏移可见窗口到正确滚动位置。 */
|
|
34
|
+
function getOffsetTop(startIndex, itemHeight) {
|
|
35
|
+
const h = itemHeight > 0 ? itemHeight : 1;
|
|
36
|
+
return startIndex * h;
|
|
37
|
+
}
|
|
38
|
+
/** 容器总高度(px),用于撑出滚动条。 */
|
|
39
|
+
function getTotalHeight(total, itemHeight) {
|
|
40
|
+
const h = itemHeight > 0 ? itemHeight : 1;
|
|
41
|
+
return total * h;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const selectCss = "/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:host,:root{--font-sans:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,::backdrop,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}::file-selector-button{appearance:button;background-color:#0000;border:0 solid;border-radius:0;box-sizing:border-box;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;margin:0;margin-inline-end:4px;opacity:1;padding:0}:host,html{-webkit-text-size-adjust:100%;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);line-height:1.5;tab-size:4;-webkit-tap-highlight-color:transparent}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}button,input,optgroup,select,textarea{background-color:#0000;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex;padding-block:0}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.relative{position:relative}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}} /*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{}@layer base{}@layer components;:host{--hb-select-font-size:14px;--hb-select-height:32px;--hb-select-border-color:var(--hb-border-color,#dcdfe6);--hb-select-border-color-hover:var(--hb-color-primary);--hb-select-bg-color:var(--hb-color-white,#fff);--hb-select-text-color:var(--hb-color-text-regular,#606266);--hb-select-placeholder-color:var(--hb-color-text-placeholder,#c0c4cc);display:inline-block;position:relative}.hb-select{display:inline-block;position:relative;width:240px}.hb-select__input-wrapper{position:relative}.hb-select__input,.hb-select__input-wrapper{cursor:pointer;display:inline-block;width:100%}.hb-select__input{background-color:var(--hb-select-bg-color);border:1px solid var(--hb-select-border-color);border-radius:4px;box-sizing:border-box;color:var(--hb-select-text-color);font-size:var(--hb-select-font-size);height:var(--hb-select-height);line-height:var(--hb-select-height);outline:none;padding:0 30px 0 15px;transition:border-color .2s cubic-bezier(.645,.045,.355,1)}.hb-select__input::placeholder{color:var(--hb-select-placeholder-color)}.hb-select__input:focus,.hb-select__input:hover:not(:disabled){border-color:var(--hb-select-border-color-hover)}.hb-select__tags{align-items:center;background-color:var(--hb-select-bg-color);border:1px solid var(--hb-select-border-color);border-radius:4px;display:flex;flex-wrap:wrap;min-height:var(--hb-select-height);padding:0 30px 0 5px}.hb-select__tag{align-items:center;background-color:var(--hb-fill-color-light,#f0f2f5);border:1px solid var(--hb-border-color-lighter,#e4e7ed);border-radius:4px;color:var(--hb-color-text-regular,#606266);display:inline-flex;font-size:12px;height:24px;margin:2px 0 2px 6px;padding:0 8px}.hb-select__tag-text{margin-right:4px}.hb-select__tag-close{align-items:center;color:var(--hb-color-text-placeholder,#c0c4cc);cursor:pointer;display:inline-flex;height:12px;justify-content:center;transition:color .2s;width:12px}.hb-select__tag-close svg{height:100%;width:100%}.hb-select__tag-close:hover{color:var(--hb-color-text-regular,#606266)}.hb-select__suffix{align-items:center;color:var(--hb-select-text-color);display:flex;position:absolute;right:8px;top:50%;transform:translateY(-50%)}.hb-select__clear{align-items:center;color:var(--hb-select-placeholder-color);cursor:pointer;display:inline-flex;height:14px;justify-content:center;margin-right:8px;transition:color .2s;width:14px}.hb-select__clear svg{height:100%;width:100%}.hb-select__clear:hover{color:var(--hb-select-text-color)}.hb-select__arrow{align-items:center;color:var(--hb-select-placeholder-color);display:inline-flex;height:12px;justify-content:center;transition:transform .3s;width:12px}.hb-select__arrow svg{height:100%;width:100%}.hb-select--open .hb-select__arrow{transform:rotate(180deg)}.hb-select__dropdown{background-color:var(--hb-select-bg-color);border:1px solid var(--hb-select-border-color);border-radius:4px;box-shadow:0 2px 12px #0000001a;left:0;margin-top:4px;max-height:300px;min-width:100%;overflow-y:auto;position:absolute;top:100%;z-index:1000}.hb-select__menu{list-style:none;margin:0;padding:6px 0}.hb-select__menu-item{align-items:center;color:var(--hb-select-text-color);cursor:pointer;display:flex;font-size:var(--hb-select-font-size);padding:8px 20px;transition:background-color .2s}.hb-select__menu-item:hover:not(.hb-select__menu-item--disabled):not(.hb-select__menu-item--divided){background-color:var(--hb-fill-color-light,#f5f7fa)}.hb-select__menu-item--selected{color:var(--hb-color-primary);font-weight:600}.hb-select__menu-item--disabled{color:var(--hb-color-text-disabled,#c0c4cc);cursor:not-allowed}.hb-select__menu-item--divided{border-top:1px solid var(--hb-border-color-lighter,#e4e7ed);margin-top:6px;padding-top:6px}.hb-select__menu-item--empty{color:var(--hb-select-placeholder-color);cursor:default}.hb-select__menu-item-checkbox{align-items:center;color:var(--hb-color-primary,#1677ff);display:inline-flex;height:14px;justify-content:center;margin-right:8px;width:14px}.hb-select__menu-item-checkbox svg{height:100%;width:100%}.hb-select__menu-item--create{color:var(--hb-color-primary,#1677ff);font-weight:500}.hb-select__menu-item--create:hover{background-color:var(--hb-color-primary-bg,#e6f4ff)}.hb-select__menu-item-label{flex:1}.hb-select--small{font-size:12px}.hb-select--small .hb-select__input{font-size:12px;height:24px;line-height:24px;padding:0 25px 0 12px}.hb-select--large{font-size:16px}.hb-select--large .hb-select__input{font-size:16px;height:40px;line-height:40px;padding:0 35px 0 18px}.hb-select--disabled{cursor:not-allowed}.hb-select--disabled .hb-select__input{background-color:var(--hb-fill-color-light,#f5f7fa);border-color:var(--hb-select-border-color);color:var(--hb-color-text-disabled,#c0c4cc);cursor:not-allowed}@property --tw-rotate-x{syntax:\"*\";inherits:false}@property --tw-rotate-y{syntax:\"*\";inherits:false}@property --tw-rotate-z{syntax:\"*\";inherits:false}@property --tw-skew-x{syntax:\"*\";inherits:false}@property --tw-skew-y{syntax:\"*\";inherits:false}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}";
|
|
6
45
|
const HbSelectStyle0 = selectCss;
|
|
7
46
|
|
|
8
47
|
const Select = /*@__PURE__*/ proxyCustomElement(class Select extends H {
|
|
@@ -73,12 +112,37 @@ const Select = /*@__PURE__*/ proxyCustomElement(class Select extends H {
|
|
|
73
112
|
* 多选时最多显示多少个tag
|
|
74
113
|
*/
|
|
75
114
|
maxCollapseTags;
|
|
115
|
+
/**
|
|
116
|
+
* V1:是否开启虚拟滚动(1000+ 选项时推荐)。默认 false。
|
|
117
|
+
* 开启后下拉仅渲染可见窗口内的选项,DOM 节点数恒定。
|
|
118
|
+
*/
|
|
119
|
+
virtual = false;
|
|
120
|
+
/**
|
|
121
|
+
* V1:下拉最大高度(px)。virtual=true 时必填(定义视口高度)。默认 256。
|
|
122
|
+
*/
|
|
123
|
+
dropdownMaxHeight = 256;
|
|
124
|
+
/**
|
|
125
|
+
* V1:虚拟滚动每项预估高度(px)。默认 34。
|
|
126
|
+
*/
|
|
127
|
+
virtualItemHeight = 34;
|
|
76
128
|
isOpen = false;
|
|
77
129
|
inputValue = '';
|
|
78
130
|
searchValue = '';
|
|
79
131
|
filteredOptions = [];
|
|
80
132
|
/** 键盘高亮的选项索引(-1 表示无) */
|
|
81
133
|
activeOptionIndex = -1;
|
|
134
|
+
/** V1:下拉滚动位置(px),驱动虚拟滚动可见窗口重算 */
|
|
135
|
+
dropdownScrollTop = 0;
|
|
136
|
+
/** V1:下拉滚动回调 */
|
|
137
|
+
handleDropdownScroll = (e) => {
|
|
138
|
+
const target = e.target;
|
|
139
|
+
this.dropdownScrollTop = target.scrollTop;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* O4:实例级稳定 id,用于 combobox 的 aria-controls / aria-activedescendant 关联,
|
|
143
|
+
* 让读屏在键盘导航时播报当前高亮项。
|
|
144
|
+
*/
|
|
145
|
+
listboxId = `hb-select-listbox-${Math.random().toString(36).slice(2, 11)}`;
|
|
82
146
|
/**
|
|
83
147
|
* 值改变事件
|
|
84
148
|
*/
|
|
@@ -90,13 +154,19 @@ const Select = /*@__PURE__*/ proxyCustomElement(class Select extends H {
|
|
|
90
154
|
clickOutside = createClickOutsideHandler({
|
|
91
155
|
host: null,
|
|
92
156
|
isOpen: () => this.isOpen,
|
|
93
|
-
onClose: () => {
|
|
157
|
+
onClose: () => {
|
|
158
|
+
this.isOpen = false;
|
|
159
|
+
this.hbVisibleChange.emit(false);
|
|
160
|
+
},
|
|
94
161
|
});
|
|
95
162
|
componentDidLoad() {
|
|
96
163
|
this.clickOutside = createClickOutsideHandler({
|
|
97
164
|
host: this.el,
|
|
98
165
|
isOpen: () => this.isOpen,
|
|
99
|
-
onClose: () => {
|
|
166
|
+
onClose: () => {
|
|
167
|
+
this.isOpen = false;
|
|
168
|
+
this.hbVisibleChange.emit(false);
|
|
169
|
+
},
|
|
100
170
|
});
|
|
101
171
|
this.clickOutside.connect();
|
|
102
172
|
this.updateInputValue();
|
|
@@ -150,8 +220,7 @@ const Select = /*@__PURE__*/ proxyCustomElement(class Select extends H {
|
|
|
150
220
|
const displayOptions = this.filterable ? this.filteredOptions : this.options;
|
|
151
221
|
if (!this.isOpen) {
|
|
152
222
|
// 关闭态:Enter / Space / 方向键 展开
|
|
153
|
-
if (e.key === 'Enter' || e.key === ' ' || e.key === 'Spacebar' ||
|
|
154
|
-
e.key === 'ArrowDown' || e.key === 'ArrowUp') {
|
|
223
|
+
if (e.key === 'Enter' || e.key === ' ' || e.key === 'Spacebar' || e.key === 'ArrowDown' || e.key === 'ArrowUp') {
|
|
155
224
|
e.preventDefault();
|
|
156
225
|
this.isOpen = true;
|
|
157
226
|
this.activeOptionIndex = -1;
|
|
@@ -264,28 +333,40 @@ const Select = /*@__PURE__*/ proxyCustomElement(class Select extends H {
|
|
|
264
333
|
this.updateInputValue();
|
|
265
334
|
this.hbChange.emit(this.modelValue);
|
|
266
335
|
};
|
|
336
|
+
/** 渲染单个选项 <li>(普通 + 虚拟滚动共用,V1 提取) */
|
|
337
|
+
renderOption(option, index) {
|
|
338
|
+
return (h("li", { id: `${this.listboxId}-opt-${index}`, class: {
|
|
339
|
+
'hb-select__menu-item': true,
|
|
340
|
+
'hb-select__menu-item--selected': this.isSelected(option),
|
|
341
|
+
'hb-select__menu-item--disabled': option.disabled,
|
|
342
|
+
'hb-select__menu-item--divided': option.divided,
|
|
343
|
+
'hb-select__menu-item--active': index === this.activeOptionIndex,
|
|
344
|
+
}, style: this.virtual ? { height: `${this.virtualItemHeight}px` } : undefined, role: "option", "aria-selected": this.isSelected(option) ? 'true' : 'false', "aria-disabled": option.disabled ? 'true' : undefined, onClick: () => this.handleSelect(option) }, this.multiple && (h("span", { class: "hb-select__menu-item-checkbox", "aria-hidden": "true" }, this.isSelected(option) ? (h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": 3, "stroke-linecap": "round", "stroke-linejoin": "round" }, h("path", { d: "M5 12l5 5L20 7" }))) : null)), h("span", { class: "hb-select__menu-item-label" }, option.label)));
|
|
345
|
+
}
|
|
267
346
|
render() {
|
|
268
347
|
const displayOptions = this.filterable ? this.filteredOptions : this.options;
|
|
269
|
-
const showClear = this.clearable && this.modelValue !== undefined &&
|
|
270
|
-
|
|
271
|
-
return (h("div", { key: 'dded29eec6498d2f1e64ecdfac47b3a38827d0b1', class: {
|
|
348
|
+
const showClear = this.clearable && this.modelValue !== undefined && (this.multiple ? this.modelValue.length > 0 : true);
|
|
349
|
+
return (h("div", { key: '711a2660ec0ff788a027b7097a64f74ee535ae58', class: {
|
|
272
350
|
'hb-select': true,
|
|
273
351
|
'hb-select--open': this.isOpen,
|
|
274
352
|
'hb-select--disabled': this.disabled,
|
|
275
353
|
[`hb-select--${this.size}`]: true,
|
|
276
|
-
}, "aria-haspopup": "listbox", "aria-expanded": this.isOpen ? 'true' : 'false' }, h("div", { key: '
|
|
354
|
+
}, role: "combobox", "aria-haspopup": "listbox", "aria-expanded": this.isOpen ? 'true' : 'false', "aria-controls": this.isOpen ? this.listboxId : undefined, "aria-activedescendant": this.isOpen && this.activeOptionIndex >= 0 ? `${this.listboxId}-opt-${this.activeOptionIndex}` : undefined }, h("div", { key: '7719c10931fd36306a7bc302b167c43a782158bd', class: "hb-select__input-wrapper", onClick: this.handleInputClick, onKeyDown: this.handleWrapperKeydown }, this.multiple && Array.isArray(this.modelValue) && this.modelValue.length > 0 ? (h("div", { class: "hb-select__tags" }, this.modelValue.slice(0, this.collapseTags && this.maxCollapseTags ? this.maxCollapseTags : undefined).map(val => {
|
|
277
355
|
const option = this.options.find(opt => opt.value === val);
|
|
278
|
-
return (h("span", { class: "hb-select__tag" }, h("span", { class: "hb-select__tag-text" }, option ? option.label : val), h("span", { class: "hb-select__tag-close", role: "button", "aria-label": "\u79FB\u9664\u6807\u7B7E", onClick:
|
|
356
|
+
return (h("span", { class: "hb-select__tag" }, h("span", { class: "hb-select__tag-text" }, option ? option.label : val), h("span", { class: "hb-select__tag-close", role: "button", "aria-label": "\u79FB\u9664\u6807\u7B7E", tabIndex: 0, onClick: e => {
|
|
279
357
|
e.stopPropagation();
|
|
280
358
|
this.handleSelect(option || { value: val, label: String(val) });
|
|
281
|
-
} }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": 2, "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M6 6l12 12M18 6L6 18" })))));
|
|
282
|
-
}), this.collapseTags && this.maxCollapseTags && this.modelValue.length > this.maxCollapseTags && (h("span", { class: "hb-select__tag" }, h("span", { class: "hb-select__tag-text" }, "+", this.modelValue.length - this.maxCollapseTags))))) : (h("input", { type: "text", class: "hb-select__input", placeholder: this.placeholder, value: this.filterable && this.isOpen ? this.searchValue : this.inputValue, disabled: this.disabled, readonly: !this.filterable || !this.isOpen, onInput: this.handleSearch, "aria-haspopup": "listbox", "aria-expanded": this.isOpen ? 'true' : 'false', role: "combobox" })), h("span", { key: '
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
359
|
+
}, onKeyDown: activationClickHandler }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": 2, "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M6 6l12 12M18 6L6 18" })))));
|
|
360
|
+
}), this.collapseTags && this.maxCollapseTags && this.modelValue.length > this.maxCollapseTags && (h("span", { class: "hb-select__tag" }, h("span", { class: "hb-select__tag-text" }, "+", this.modelValue.length - this.maxCollapseTags))))) : (h("input", { type: "text", class: "hb-select__input", placeholder: this.placeholder, value: this.filterable && this.isOpen ? this.searchValue : this.inputValue, disabled: this.disabled, readonly: !this.filterable || !this.isOpen, onInput: this.handleSearch, "aria-haspopup": "listbox", "aria-expanded": this.isOpen ? 'true' : 'false', role: "combobox" })), h("span", { key: 'a9dc4ecd508bb6828296cf2a9465ab5c24595573', class: "hb-select__suffix" }, showClear && (h("span", { key: 'cde7a95063f12c03844303681a3a95da1f5aaa66', class: "hb-select__clear", role: "button", "aria-label": "\u6E05\u7A7A", tabIndex: 0, onClick: this.handleClear, onKeyDown: activationClickHandler }, h("svg", { key: 'a9abef626a4a3da495afffe7e562fb557a26f8e7', viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": 2, "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { key: 'a95c9113f3c7ef741dc9a8111576827571668ecf', d: "M6 6l12 12M18 6L6 18" })))), h("span", { key: '184023640706c01ed18854cb5b1975f9def18dc4', class: "hb-select__arrow", "aria-hidden": "true" }, h("svg", { key: '14fec9c7d46ad1d22ddf07de502aedabe8b19b18', viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": 2, "stroke-linecap": "round", "stroke-linejoin": "round" }, h("path", { key: 'd280de7e1545be150238126b65f6c37e499bb83a', d: "M6 9l6 6 6-6" }))))), this.isOpen && (h("div", { key: 'e9a10e24e49095535c232ec39be458780789fde4', class: "hb-select__dropdown" }, h("ul", { key: '874854750698dcb2346cbd3a965ba0e500b5bafc', class: "hb-select__menu", role: "listbox", id: this.listboxId,
|
|
361
|
+
// V1:虚拟滚动时滚动容器限高 + onScroll 更新可见窗口
|
|
362
|
+
style: this.virtual ? { maxHeight: `${this.dropdownMaxHeight}px`, overflowY: 'auto' } : undefined, onScroll: this.virtual ? this.handleDropdownScroll : undefined }, this.createOption && (h("li", { key: '5ca5a633a0d69ddb1ba065bb08d947d663b774ac', class: { 'hb-select__menu-item': true, 'hb-select__menu-item--create': true }, role: "option", "aria-selected": "false", onClick: this.handleCreate }, h("span", { key: 'f986194f0456c910bba2447603505edce6cb6e60', class: "hb-select__menu-item-label" }, "\u521B\u5EFA\u300C", this.createOption.label, "\u300D"))), displayOptions.length === 0 && !this.createOption ? (h("li", { class: "hb-select__menu-item hb-select__menu-item--empty", "aria-disabled": "true" }, "\u65E0\u6570\u636E")) : this.virtual ? (
|
|
363
|
+
// V1:虚拟滚动——仅渲染可见窗口 + 顶部撑高 spacer
|
|
364
|
+
h("div", { style: { height: `${getTotalHeight(displayOptions.length, this.virtualItemHeight)}px`, position: 'relative' } }, h("div", { style: { transform: `translateY(${getOffsetTop(getVirtualRange({ total: displayOptions.length, itemHeight: this.virtualItemHeight, viewportHeight: this.dropdownMaxHeight, scrollTop: this.dropdownScrollTop }).startIndex, this.virtualItemHeight)}px)` } }, displayOptions
|
|
365
|
+
.slice(getVirtualRange({ total: displayOptions.length, itemHeight: this.virtualItemHeight, viewportHeight: this.dropdownMaxHeight, scrollTop: this.dropdownScrollTop }).startIndex, getVirtualRange({ total: displayOptions.length, itemHeight: this.virtualItemHeight, viewportHeight: this.dropdownMaxHeight, scrollTop: this.dropdownScrollTop }).endIndex)
|
|
366
|
+
.map((option, i) => {
|
|
367
|
+
const absIndex = getVirtualRange({ total: displayOptions.length, itemHeight: this.virtualItemHeight, viewportHeight: this.dropdownMaxHeight, scrollTop: this.dropdownScrollTop }).startIndex + i;
|
|
368
|
+
return this.renderOption(option, absIndex);
|
|
369
|
+
})))) : (displayOptions.map((option, index) => this.renderOption(option, index))))))));
|
|
289
370
|
}
|
|
290
371
|
static get watchers() { return {
|
|
291
372
|
"modelValue": ["handleValueChange"],
|
|
@@ -306,11 +387,15 @@ const Select = /*@__PURE__*/ proxyCustomElement(class Select extends H {
|
|
|
306
387
|
"allowCreate": [4, "allow-create"],
|
|
307
388
|
"collapseTags": [4, "collapse-tags"],
|
|
308
389
|
"maxCollapseTags": [2, "max-collapse-tags"],
|
|
390
|
+
"virtual": [4],
|
|
391
|
+
"dropdownMaxHeight": [2, "dropdown-max-height"],
|
|
392
|
+
"virtualItemHeight": [2, "virtual-item-height"],
|
|
309
393
|
"isOpen": [32],
|
|
310
394
|
"inputValue": [32],
|
|
311
395
|
"searchValue": [32],
|
|
312
396
|
"filteredOptions": [32],
|
|
313
|
-
"activeOptionIndex": [32]
|
|
397
|
+
"activeOptionIndex": [32],
|
|
398
|
+
"dropdownScrollTop": [32]
|
|
314
399
|
}, undefined, {
|
|
315
400
|
"modelValue": ["handleValueChange"],
|
|
316
401
|
"options": ["handleOptionsChange"]
|