naive-ui 2.21.2 → 2.22.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/es/_internal/close/src/styles/index.cssr.js +6 -5
- package/es/_internal/scrollbar/src/ScrollBar.d.ts +15 -0
- package/es/_internal/scrollbar/src/ScrollBar.js +13 -7
- package/es/_internal/selection/src/Selection.js +11 -9
- package/es/_internal/selection/src/styles/index.cssr.js +6 -2
- package/es/alert/src/Alert.d.ts +20 -20
- package/es/alert/src/Alert.js +22 -22
- package/es/alert/src/styles/index.cssr.js +45 -45
- package/es/anchor/src/AnchorAdapter.js +12 -12
- package/es/anchor/src/styles/index.cssr.js +41 -41
- package/es/avatar/src/Avatar.d.ts +5 -3
- package/es/avatar/src/Avatar.js +7 -5
- package/es/avatar/src/styles/index.cssr.js +3 -5
- package/es/button/src/Button.d.ts +60 -60
- package/es/button/src/Button.js +107 -106
- package/es/button/src/styles/button.cssr.js +83 -80
- package/es/button/styles/dark.js +3 -3
- package/es/button/styles/light.d.ts +3 -3
- package/es/button/styles/light.js +1 -1
- package/es/calendar/src/Calendar.d.ts +37 -30
- package/es/calendar/styles/light.d.ts +3 -3
- package/es/cascader/src/Cascader.d.ts +135 -0
- package/es/cascader/src/Cascader.js +2 -4
- package/es/cascader/src/CascaderMenu.d.ts +345 -0
- package/es/cascader/src/CascaderMenu.js +6 -5
- package/es/cascader/src/CascaderOption.d.ts +18 -0
- package/es/cascader/src/CascaderSelectMenu.d.ts +18 -0
- package/es/cascader/src/CascaderSubmenu.d.ts +18 -0
- package/es/cascader/styles/dark.js +3 -1
- package/es/cascader/styles/light.d.ts +13 -0
- package/es/cascader/styles/light.js +3 -1
- package/es/color-picker/src/ColorInputUnit.d.ts +3 -3
- package/es/color-picker/src/ColorPicker.d.ts +27 -27
- package/es/color-picker/styles/light.d.ts +3 -3
- package/es/config-provider/src/ConfigProvider.d.ts +21 -0
- package/es/data-table/src/DataTable.d.ts +30 -30
- package/es/data-table/src/DataTable.js +7 -14
- package/es/data-table/src/HeaderButton/FilterButton.d.ts +3 -3
- package/es/data-table/src/HeaderButton/FilterMenu.d.ts +3 -3
- package/es/data-table/src/MainTable.js +2 -3
- package/es/data-table/src/TableParts/Body.d.ts +18 -7
- package/es/data-table/src/TableParts/Body.js +80 -28
- package/es/data-table/src/TableParts/Cell.d.ts +6 -6
- package/es/data-table/src/TableParts/Header.d.ts +3 -3
- package/es/data-table/src/TableParts/Header.js +1 -1
- package/es/data-table/src/interface.d.ts +4 -1
- package/es/data-table/src/styles/index.cssr.js +9 -12
- package/es/data-table/src/use-check.js +6 -2
- package/es/data-table/src/use-scroll.d.ts +2 -0
- package/es/data-table/src/use-scroll.js +34 -4
- package/es/data-table/src/use-table-data.js +4 -1
- package/es/data-table/styles/_common.js +1 -1
- package/es/data-table/styles/light.d.ts +3 -3
- package/es/date-picker/src/DatePicker.d.ts +94 -69
- package/es/date-picker/src/DatePicker.js +47 -20
- package/es/date-picker/src/config.d.ts +1 -9
- package/es/date-picker/src/config.js +0 -8
- package/es/date-picker/src/interface.d.ts +2 -1
- package/es/date-picker/src/panel/date.d.ts +23 -10
- package/es/date-picker/src/panel/date.js +2 -2
- package/es/date-picker/src/panel/daterange.d.ts +21 -9
- package/es/date-picker/src/panel/daterange.js +2 -2
- package/es/date-picker/src/panel/datetime.d.ts +23 -16
- package/es/date-picker/src/panel/datetime.js +2 -2
- package/es/date-picker/src/panel/datetimerange.d.ts +21 -9
- package/es/date-picker/src/panel/datetimerange.js +2 -2
- package/es/date-picker/src/panel/month.d.ts +27 -20
- package/es/date-picker/src/panel/month.js +23 -12
- package/es/date-picker/src/panel/use-calendar.d.ts +25 -43
- package/es/date-picker/src/panel/use-calendar.js +35 -18
- package/es/date-picker/src/panel/use-dual-calendar.d.ts +21 -40
- package/es/date-picker/src/panel/use-dual-calendar.js +23 -8
- package/es/date-picker/src/panel/use-panel-common.d.ts +21 -36
- package/es/date-picker/src/panel/use-panel-common.js +2 -2
- package/es/date-picker/src/utils.d.ts +19 -3
- package/es/date-picker/src/utils.js +40 -5
- package/es/date-picker/styles/_common.d.ts +2 -0
- package/es/date-picker/styles/_common.js +3 -1
- package/es/date-picker/styles/light.d.ts +10 -6
- package/es/dialog/src/Dialog.d.ts +21 -21
- package/es/dialog/src/styles/index.cssr.js +1 -0
- package/es/dialog/styles/light.d.ts +3 -3
- package/es/dynamic-input/src/DynamicInput.d.ts +30 -30
- package/es/dynamic-input/src/InputPreset.d.ts +3 -3
- package/es/dynamic-input/src/PairPreset.d.ts +3 -3
- package/es/dynamic-input/styles/light.d.ts +3 -3
- package/es/dynamic-tags/src/DynamicTags.d.ts +30 -30
- package/es/dynamic-tags/styles/light.d.ts +3 -3
- package/es/element/index.d.ts +1 -0
- package/es/element/index.js +1 -0
- package/es/form/src/interface.d.ts +5 -4
- package/es/image/src/Image.d.ts +25 -16
- package/es/image/src/Image.js +35 -11
- package/es/image/src/ImageGroup.js +2 -2
- package/es/image/src/styles/index.cssr.js +4 -3
- package/es/input/src/Input.js +2 -0
- package/es/input/src/styles/input.cssr.js +2 -1
- package/es/input-number/src/InputNumber.d.ts +30 -30
- package/es/input-number/src/InputNumber.js +10 -5
- package/es/input-number/src/utils.d.ts +1 -0
- package/es/input-number/src/utils.js +4 -0
- package/es/input-number/styles/light.d.ts +3 -3
- package/es/locales/common/deDE.js +8 -0
- package/es/locales/common/enUS.d.ts +7 -0
- package/es/locales/common/enUS.js +8 -1
- package/es/locales/common/frFR.d.ts +3 -0
- package/es/locales/common/frFR.js +101 -0
- package/es/locales/common/idID.d.ts +2 -93
- package/es/locales/common/idID.js +8 -0
- package/es/locales/common/jaJP.js +8 -0
- package/es/locales/common/nbNO.js +8 -0
- package/es/locales/common/ruRU.js +8 -0
- package/es/locales/common/ukUA.js +8 -0
- package/es/locales/common/zhCN.js +7 -0
- package/es/locales/common/zhTW.d.ts +3 -0
- package/es/locales/common/zhTW.js +100 -0
- package/es/locales/date/frFR.d.ts +3 -0
- package/es/locales/date/frFR.js +6 -0
- package/es/locales/date/idID.d.ts +1 -6
- package/es/locales/date/zhTW.d.ts +3 -0
- package/es/locales/date/zhTW.js +6 -0
- package/es/locales/index.d.ts +4 -0
- package/es/locales/index.js +4 -0
- package/es/modal/src/BodyWrapper.d.ts +6 -6
- package/es/modal/src/Modal.d.ts +36 -36
- package/es/modal/styles/light.d.ts +3 -3
- package/es/page-header/src/PageHeader.js +3 -3
- package/es/page-header/src/styles/index.cssr.js +2 -4
- package/es/popconfirm/src/Popconfirm.d.ts +30 -30
- package/es/popconfirm/styles/light.d.ts +3 -3
- package/es/popover/src/Popover.js +4 -1
- package/es/popover/src/PopoverBody.js +3 -3
- package/es/popselect/src/Popselect.d.ts +2 -11
- package/es/popselect/src/Popselect.js +2 -2
- package/es/popselect/src/PopselectPanel.d.ts +3 -11
- package/es/popselect/src/PopselectPanel.js +17 -11
- package/es/radio/src/Radio.js +3 -3
- package/es/radio/src/RadioButton.js +4 -5
- package/es/radio/src/styles/radio-group.cssr.js +8 -4
- package/es/radio/src/styles/radio.cssr.js +8 -4
- package/es/radio/src/use-radio.d.ts +0 -3
- package/es/radio/src/use-radio.js +1 -26
- package/es/switch/src/Switch.d.ts +16 -1
- package/es/switch/src/Switch.js +17 -4
- package/es/switch/src/styles/index.cssr.js +1 -1
- package/es/tabs/src/styles/index.cssr.js +1 -0
- package/es/tag/src/styles/index.cssr.js +1 -1
- package/es/theme-editor/src/ThemeEditor.js +9 -2
- package/es/time-picker/src/Panel.d.ts +3 -3
- package/es/time-picker/src/TimePicker.d.ts +30 -30
- package/es/time-picker/styles/light.d.ts +3 -3
- package/es/transfer/src/Transfer.d.ts +30 -30
- package/es/transfer/src/TransferFilter.d.ts +3 -3
- package/es/transfer/src/TransferList.d.ts +3 -3
- package/es/transfer/src/TransferListItem.d.ts +3 -3
- package/es/transfer/styles/light.d.ts +3 -3
- package/es/tree/src/Tree.d.ts +8 -4
- package/es/tree/src/Tree.js +32 -6
- package/es/tree-select/src/TreeSelect.d.ts +38 -1
- package/es/tree-select/src/TreeSelect.js +25 -10
- package/es/tree-select/src/styles/index.cssr.js +11 -2
- package/es/tree-select/styles/light.d.ts +6 -0
- package/es/tree-select/styles/light.js +5 -2
- package/es/upload/src/Upload.d.ts +41 -30
- package/es/upload/src/Upload.js +33 -23
- package/es/upload/src/UploadFile.d.ts +4 -4
- package/es/upload/src/UploadFileList.js +4 -2
- package/es/upload/src/UploadProgress.d.ts +3 -3
- package/es/upload/src/interface.d.ts +1 -0
- package/es/upload/src/styles/index.cssr.js +2 -3
- package/es/upload/styles/light.d.ts +3 -3
- package/es/version.d.ts +1 -1
- package/es/version.js +1 -1
- package/lib/_internal/close/src/styles/index.cssr.js +6 -5
- package/lib/_internal/scrollbar/src/ScrollBar.d.ts +15 -0
- package/lib/_internal/scrollbar/src/ScrollBar.js +13 -7
- package/lib/_internal/selection/src/Selection.js +11 -9
- package/lib/_internal/selection/src/styles/index.cssr.js +6 -2
- package/lib/alert/src/Alert.d.ts +20 -20
- package/lib/alert/src/Alert.js +22 -22
- package/lib/alert/src/styles/index.cssr.js +45 -45
- package/lib/anchor/src/AnchorAdapter.js +12 -12
- package/lib/anchor/src/styles/index.cssr.js +41 -41
- package/lib/avatar/src/Avatar.d.ts +5 -3
- package/lib/avatar/src/Avatar.js +7 -5
- package/lib/avatar/src/styles/index.cssr.js +3 -5
- package/lib/button/src/Button.d.ts +60 -60
- package/lib/button/src/Button.js +107 -106
- package/lib/button/src/styles/button.cssr.js +83 -80
- package/lib/button/styles/dark.js +3 -3
- package/lib/button/styles/light.d.ts +3 -3
- package/lib/button/styles/light.js +1 -1
- package/lib/calendar/src/Calendar.d.ts +37 -30
- package/lib/calendar/styles/light.d.ts +3 -3
- package/lib/cascader/src/Cascader.d.ts +135 -0
- package/lib/cascader/src/Cascader.js +2 -4
- package/lib/cascader/src/CascaderMenu.d.ts +345 -0
- package/lib/cascader/src/CascaderMenu.js +6 -5
- package/lib/cascader/src/CascaderOption.d.ts +18 -0
- package/lib/cascader/src/CascaderSelectMenu.d.ts +18 -0
- package/lib/cascader/src/CascaderSubmenu.d.ts +18 -0
- package/lib/cascader/styles/dark.js +3 -1
- package/lib/cascader/styles/light.d.ts +13 -0
- package/lib/cascader/styles/light.js +3 -1
- package/lib/color-picker/src/ColorInputUnit.d.ts +3 -3
- package/lib/color-picker/src/ColorPicker.d.ts +27 -27
- package/lib/color-picker/styles/light.d.ts +3 -3
- package/lib/config-provider/src/ConfigProvider.d.ts +21 -0
- package/lib/data-table/src/DataTable.d.ts +30 -30
- package/lib/data-table/src/DataTable.js +6 -13
- package/lib/data-table/src/HeaderButton/FilterButton.d.ts +3 -3
- package/lib/data-table/src/HeaderButton/FilterMenu.d.ts +3 -3
- package/lib/data-table/src/MainTable.js +1 -2
- package/lib/data-table/src/TableParts/Body.d.ts +18 -7
- package/lib/data-table/src/TableParts/Body.js +78 -26
- package/lib/data-table/src/TableParts/Cell.d.ts +6 -6
- package/lib/data-table/src/TableParts/Header.d.ts +3 -3
- package/lib/data-table/src/TableParts/Header.js +1 -1
- package/lib/data-table/src/interface.d.ts +4 -1
- package/lib/data-table/src/styles/index.cssr.js +9 -12
- package/lib/data-table/src/use-check.js +6 -2
- package/lib/data-table/src/use-scroll.d.ts +2 -0
- package/lib/data-table/src/use-scroll.js +34 -4
- package/lib/data-table/src/use-table-data.js +4 -1
- package/lib/data-table/styles/_common.js +1 -1
- package/lib/data-table/styles/light.d.ts +3 -3
- package/lib/date-picker/src/DatePicker.d.ts +94 -69
- package/lib/date-picker/src/DatePicker.js +46 -19
- package/lib/date-picker/src/config.d.ts +1 -9
- package/lib/date-picker/src/config.js +1 -9
- package/lib/date-picker/src/interface.d.ts +2 -1
- package/lib/date-picker/src/panel/date.d.ts +23 -10
- package/lib/date-picker/src/panel/date.js +1 -1
- package/lib/date-picker/src/panel/daterange.d.ts +21 -9
- package/lib/date-picker/src/panel/daterange.js +1 -1
- package/lib/date-picker/src/panel/datetime.d.ts +23 -16
- package/lib/date-picker/src/panel/datetime.js +1 -1
- package/lib/date-picker/src/panel/datetimerange.d.ts +21 -9
- package/lib/date-picker/src/panel/datetimerange.js +2 -2
- package/lib/date-picker/src/panel/month.d.ts +27 -20
- package/lib/date-picker/src/panel/month.js +23 -12
- package/lib/date-picker/src/panel/use-calendar.d.ts +25 -43
- package/lib/date-picker/src/panel/use-calendar.js +34 -16
- package/lib/date-picker/src/panel/use-dual-calendar.d.ts +21 -40
- package/lib/date-picker/src/panel/use-dual-calendar.js +22 -6
- package/lib/date-picker/src/panel/use-panel-common.d.ts +21 -36
- package/lib/date-picker/src/panel/use-panel-common.js +3 -2
- package/lib/date-picker/src/utils.d.ts +19 -3
- package/lib/date-picker/src/utils.js +41 -4
- package/lib/date-picker/styles/_common.d.ts +2 -0
- package/lib/date-picker/styles/_common.js +3 -1
- package/lib/date-picker/styles/light.d.ts +10 -6
- package/lib/dialog/src/Dialog.d.ts +21 -21
- package/lib/dialog/src/styles/index.cssr.js +1 -0
- package/lib/dialog/styles/light.d.ts +3 -3
- package/lib/dynamic-input/src/DynamicInput.d.ts +30 -30
- package/lib/dynamic-input/src/InputPreset.d.ts +3 -3
- package/lib/dynamic-input/src/PairPreset.d.ts +3 -3
- package/lib/dynamic-input/styles/light.d.ts +3 -3
- package/lib/dynamic-tags/src/DynamicTags.d.ts +30 -30
- package/lib/dynamic-tags/styles/light.d.ts +3 -3
- package/lib/element/index.d.ts +1 -0
- package/lib/element/index.js +3 -1
- package/lib/form/src/interface.d.ts +5 -4
- package/lib/image/src/Image.d.ts +25 -16
- package/lib/image/src/Image.js +34 -10
- package/lib/image/src/ImageGroup.js +2 -2
- package/lib/image/src/styles/index.cssr.js +3 -2
- package/lib/input/src/Input.js +2 -0
- package/lib/input/src/styles/input.cssr.js +2 -1
- package/lib/input-number/src/InputNumber.d.ts +30 -30
- package/lib/input-number/src/InputNumber.js +9 -4
- package/lib/input-number/src/utils.d.ts +1 -0
- package/lib/input-number/src/utils.js +6 -1
- package/lib/input-number/styles/light.d.ts +3 -3
- package/lib/locales/common/deDE.js +8 -0
- package/lib/locales/common/enUS.d.ts +7 -0
- package/lib/locales/common/enUS.js +8 -1
- package/lib/locales/common/frFR.d.ts +3 -0
- package/lib/locales/common/frFR.js +103 -0
- package/lib/locales/common/idID.d.ts +2 -93
- package/lib/locales/common/idID.js +8 -0
- package/lib/locales/common/jaJP.js +8 -0
- package/lib/locales/common/nbNO.js +8 -0
- package/lib/locales/common/ruRU.js +8 -0
- package/lib/locales/common/ukUA.js +8 -0
- package/lib/locales/common/zhCN.js +7 -0
- package/lib/locales/common/zhTW.d.ts +3 -0
- package/lib/locales/common/zhTW.js +102 -0
- package/lib/locales/date/frFR.d.ts +3 -0
- package/lib/locales/date/frFR.js +11 -0
- package/lib/locales/date/idID.d.ts +1 -6
- package/lib/locales/date/zhTW.d.ts +3 -0
- package/lib/locales/date/zhTW.js +11 -0
- package/lib/locales/index.d.ts +4 -0
- package/lib/locales/index.js +9 -1
- package/lib/modal/src/BodyWrapper.d.ts +6 -6
- package/lib/modal/src/Modal.d.ts +36 -36
- package/lib/modal/styles/light.d.ts +3 -3
- package/lib/page-header/src/PageHeader.js +3 -3
- package/lib/page-header/src/styles/index.cssr.js +2 -4
- package/lib/popconfirm/src/Popconfirm.d.ts +30 -30
- package/lib/popconfirm/styles/light.d.ts +3 -3
- package/lib/popover/src/Popover.js +4 -1
- package/lib/popover/src/PopoverBody.js +3 -3
- package/lib/popselect/src/Popselect.d.ts +2 -11
- package/lib/popselect/src/Popselect.js +2 -2
- package/lib/popselect/src/PopselectPanel.d.ts +3 -11
- package/lib/popselect/src/PopselectPanel.js +16 -10
- package/lib/radio/src/Radio.js +3 -3
- package/lib/radio/src/RadioButton.js +4 -5
- package/lib/radio/src/styles/radio-group.cssr.js +8 -4
- package/lib/radio/src/styles/radio.cssr.js +8 -4
- package/lib/radio/src/use-radio.d.ts +0 -3
- package/lib/radio/src/use-radio.js +1 -26
- package/lib/switch/src/Switch.d.ts +16 -1
- package/lib/switch/src/Switch.js +17 -4
- package/lib/switch/src/styles/index.cssr.js +1 -1
- package/lib/tabs/src/styles/index.cssr.js +1 -0
- package/lib/tag/src/styles/index.cssr.js +1 -1
- package/lib/theme-editor/src/ThemeEditor.js +9 -2
- package/lib/time-picker/src/Panel.d.ts +3 -3
- package/lib/time-picker/src/TimePicker.d.ts +30 -30
- package/lib/time-picker/styles/light.d.ts +3 -3
- package/lib/transfer/src/Transfer.d.ts +30 -30
- package/lib/transfer/src/TransferFilter.d.ts +3 -3
- package/lib/transfer/src/TransferList.d.ts +3 -3
- package/lib/transfer/src/TransferListItem.d.ts +3 -3
- package/lib/transfer/styles/light.d.ts +3 -3
- package/lib/tree/src/Tree.d.ts +8 -4
- package/lib/tree/src/Tree.js +32 -6
- package/lib/tree-select/src/TreeSelect.d.ts +38 -1
- package/lib/tree-select/src/TreeSelect.js +24 -9
- package/lib/tree-select/src/styles/index.cssr.js +11 -2
- package/lib/tree-select/styles/light.d.ts +6 -0
- package/lib/tree-select/styles/light.js +5 -2
- package/lib/upload/src/Upload.d.ts +41 -30
- package/lib/upload/src/Upload.js +33 -23
- package/lib/upload/src/UploadFile.d.ts +4 -4
- package/lib/upload/src/UploadFileList.js +4 -2
- package/lib/upload/src/UploadProgress.d.ts +3 -3
- package/lib/upload/src/interface.d.ts +1 -0
- package/lib/upload/src/styles/index.cssr.js +2 -3
- package/lib/upload/styles/light.d.ts +3 -3
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +5 -4
- package/web-types.json +99 -7
package/es/tree/src/Tree.js
CHANGED
|
@@ -97,7 +97,7 @@ const treeProps = Object.assign(Object.assign(Object.assign(Object.assign({}, us
|
|
|
97
97
|
}, animated: {
|
|
98
98
|
type: Boolean,
|
|
99
99
|
default: true
|
|
100
|
-
}, virtualScroll: Boolean, renderLabel: Function, renderPrefix: Function, renderSuffix: Function, onDragenter: [Function, Array], onDragleave: [Function, Array], onDragend: [Function, Array], onDragstart: [Function, Array], onDragover: [Function, Array], onDrop: [Function, Array], onUpdateCheckedKeys: [Function, Array], 'onUpdate:checkedKeys': [Function, Array], onUpdateSelectedKeys: [Function, Array], 'onUpdate:selectedKeys': [Function, Array] }), treeSharedProps), {
|
|
100
|
+
}, virtualScroll: Boolean, watchProps: Array, renderLabel: Function, renderPrefix: Function, renderSuffix: Function, onDragenter: [Function, Array], onDragleave: [Function, Array], onDragend: [Function, Array], onDragstart: [Function, Array], onDragover: [Function, Array], onDrop: [Function, Array], onUpdateCheckedKeys: [Function, Array], 'onUpdate:checkedKeys': [Function, Array], onUpdateSelectedKeys: [Function, Array], 'onUpdate:selectedKeys': [Function, Array] }), treeSharedProps), {
|
|
101
101
|
// internal props for tree-select
|
|
102
102
|
internalScrollable: Boolean, internalScrollablePadding: String,
|
|
103
103
|
// use it to do check
|
|
@@ -138,7 +138,16 @@ export default defineComponent({
|
|
|
138
138
|
const dataTreeMateRef = props.internalDataTreeMate
|
|
139
139
|
? toRef(props, 'internalDataTreeMate')
|
|
140
140
|
: displayTreeMateRef;
|
|
141
|
-
const
|
|
141
|
+
const { watchProps } = props;
|
|
142
|
+
const uncontrolledCheckedKeysRef = ref([]);
|
|
143
|
+
if (watchProps === null || watchProps === void 0 ? void 0 : watchProps.includes('defaultCheckedKeys')) {
|
|
144
|
+
watchEffect(() => {
|
|
145
|
+
uncontrolledCheckedKeysRef.value = props.defaultCheckedKeys;
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
uncontrolledCheckedKeysRef.value = props.defaultCheckedKeys;
|
|
150
|
+
}
|
|
142
151
|
const controlledCheckedKeysRef = toRef(props, 'checkedKeys');
|
|
143
152
|
const mergedCheckedKeysRef = useMergedState(controlledCheckedKeysRef, uncontrolledCheckedKeysRef);
|
|
144
153
|
const checkedStatusRef = computed(() => {
|
|
@@ -157,12 +166,29 @@ export default defineComponent({
|
|
|
157
166
|
return indeterminateKeys;
|
|
158
167
|
return checkedStatusRef.value.indeterminateKeys;
|
|
159
168
|
});
|
|
160
|
-
const uncontrolledSelectedKeysRef = ref(
|
|
169
|
+
const uncontrolledSelectedKeysRef = ref([]);
|
|
170
|
+
if (watchProps === null || watchProps === void 0 ? void 0 : watchProps.includes('defaultSelectedKeys')) {
|
|
171
|
+
watchEffect(() => {
|
|
172
|
+
uncontrolledSelectedKeysRef.value = props.defaultSelectedKeys;
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
uncontrolledSelectedKeysRef.value = props.defaultSelectedKeys;
|
|
177
|
+
}
|
|
161
178
|
const controlledSelectedKeysRef = toRef(props, 'selectedKeys');
|
|
162
179
|
const mergedSelectedKeysRef = useMergedState(controlledSelectedKeysRef, uncontrolledSelectedKeysRef);
|
|
163
|
-
const uncontrolledExpandedKeysRef = ref(
|
|
164
|
-
|
|
165
|
-
|
|
180
|
+
const uncontrolledExpandedKeysRef = ref([]);
|
|
181
|
+
const initUncontrolledExpandedKeys = () => {
|
|
182
|
+
uncontrolledExpandedKeysRef.value = props.defaultExpandAll
|
|
183
|
+
? dataTreeMateRef.value.getNonLeafKeys()
|
|
184
|
+
: props.defaultExpandedKeys;
|
|
185
|
+
};
|
|
186
|
+
if (watchProps === null || watchProps === void 0 ? void 0 : watchProps.includes('defaultExpandedKeys')) {
|
|
187
|
+
watchEffect(initUncontrolledExpandedKeys);
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
initUncontrolledExpandedKeys();
|
|
191
|
+
}
|
|
166
192
|
const controlledExpandedKeysRef = toRef(props, 'expandedKeys');
|
|
167
193
|
const mergedExpandedKeysRef = useMergedState(controlledExpandedKeysRef, uncontrolledExpandedKeysRef);
|
|
168
194
|
const fNodesRef = computed(() => displayTreeMateRef.value.getFlattenedNodes(mergedExpandedKeysRef.value));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PropType } from 'vue';
|
|
1
|
+
import { PropType, HTMLAttributes } from 'vue';
|
|
2
2
|
import { FollowerPlacement } from 'vueuc';
|
|
3
3
|
import { CheckStrategy } from 'treemate';
|
|
4
4
|
import { Key } from '../../tree/src/interface';
|
|
@@ -94,6 +94,7 @@ declare const props: {
|
|
|
94
94
|
type: PropType<string | boolean | HTMLElement>;
|
|
95
95
|
default: undefined;
|
|
96
96
|
};
|
|
97
|
+
readonly menuProps: PropType<HTMLAttributes>;
|
|
97
98
|
readonly virtualScroll: {
|
|
98
99
|
readonly type: BooleanConstructor;
|
|
99
100
|
readonly default: true;
|
|
@@ -104,6 +105,9 @@ declare const props: {
|
|
|
104
105
|
menuBoxShadow: string;
|
|
105
106
|
menuBorderRadius: string;
|
|
106
107
|
menuHeight: string;
|
|
108
|
+
actionDividerColor: string;
|
|
109
|
+
actionTextColor: string;
|
|
110
|
+
actionPadding: string;
|
|
107
111
|
}, {
|
|
108
112
|
Tree: import("../../_mixins").Theme<"Tree", {
|
|
109
113
|
fontSize: string;
|
|
@@ -238,6 +242,9 @@ declare const props: {
|
|
|
238
242
|
menuBoxShadow: string;
|
|
239
243
|
menuBorderRadius: string;
|
|
240
244
|
menuHeight: string;
|
|
245
|
+
actionDividerColor: string;
|
|
246
|
+
actionTextColor: string;
|
|
247
|
+
actionPadding: string;
|
|
241
248
|
}, {
|
|
242
249
|
Tree: import("../../_mixins").Theme<"Tree", {
|
|
243
250
|
fontSize: string;
|
|
@@ -372,6 +379,9 @@ declare const props: {
|
|
|
372
379
|
menuBoxShadow: string;
|
|
373
380
|
menuBorderRadius: string;
|
|
374
381
|
menuHeight: string;
|
|
382
|
+
actionDividerColor: string;
|
|
383
|
+
actionTextColor: string;
|
|
384
|
+
actionPadding: string;
|
|
375
385
|
}, {
|
|
376
386
|
Tree: import("../../_mixins").Theme<"Tree", {
|
|
377
387
|
fontSize: string;
|
|
@@ -591,6 +601,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
591
601
|
type: PropType<string | boolean | HTMLElement>;
|
|
592
602
|
default: undefined;
|
|
593
603
|
};
|
|
604
|
+
readonly menuProps: PropType<HTMLAttributes>;
|
|
594
605
|
readonly virtualScroll: {
|
|
595
606
|
readonly type: BooleanConstructor;
|
|
596
607
|
readonly default: true;
|
|
@@ -601,6 +612,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
601
612
|
menuBoxShadow: string;
|
|
602
613
|
menuBorderRadius: string;
|
|
603
614
|
menuHeight: string;
|
|
615
|
+
actionDividerColor: string;
|
|
616
|
+
actionTextColor: string;
|
|
617
|
+
actionPadding: string;
|
|
604
618
|
}, {
|
|
605
619
|
Tree: import("../../_mixins").Theme<"Tree", {
|
|
606
620
|
fontSize: string;
|
|
@@ -735,6 +749,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
735
749
|
menuBoxShadow: string;
|
|
736
750
|
menuBorderRadius: string;
|
|
737
751
|
menuHeight: string;
|
|
752
|
+
actionDividerColor: string;
|
|
753
|
+
actionTextColor: string;
|
|
754
|
+
actionPadding: string;
|
|
738
755
|
}, {
|
|
739
756
|
Tree: import("../../_mixins").Theme<"Tree", {
|
|
740
757
|
fontSize: string;
|
|
@@ -869,6 +886,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
869
886
|
menuBoxShadow: string;
|
|
870
887
|
menuBorderRadius: string;
|
|
871
888
|
menuHeight: string;
|
|
889
|
+
actionDividerColor: string;
|
|
890
|
+
actionTextColor: string;
|
|
891
|
+
actionPadding: string;
|
|
872
892
|
}, {
|
|
873
893
|
Tree: import("../../_mixins").Theme<"Tree", {
|
|
874
894
|
fontSize: string;
|
|
@@ -1060,6 +1080,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1060
1080
|
'--menu-color': string;
|
|
1061
1081
|
'--menu-height': string;
|
|
1062
1082
|
'--bezier': string;
|
|
1083
|
+
'--action-padding': string;
|
|
1084
|
+
'--action-text-color': string;
|
|
1085
|
+
'--action-divider-color': string;
|
|
1063
1086
|
}>;
|
|
1064
1087
|
mergedTheme: import("vue").ComputedRef<{
|
|
1065
1088
|
common: {
|
|
@@ -1171,6 +1194,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1171
1194
|
menuBoxShadow: string;
|
|
1172
1195
|
menuBorderRadius: string;
|
|
1173
1196
|
menuHeight: string;
|
|
1197
|
+
actionDividerColor: string;
|
|
1198
|
+
actionTextColor: string;
|
|
1199
|
+
actionPadding: string;
|
|
1174
1200
|
};
|
|
1175
1201
|
peers: {
|
|
1176
1202
|
Tree: import("../../_mixins").Theme<"Tree", {
|
|
@@ -1403,6 +1429,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1403
1429
|
readonly size?: unknown;
|
|
1404
1430
|
readonly value?: unknown;
|
|
1405
1431
|
readonly to?: unknown;
|
|
1432
|
+
readonly menuProps?: unknown;
|
|
1406
1433
|
readonly virtualScroll?: unknown;
|
|
1407
1434
|
readonly theme?: unknown;
|
|
1408
1435
|
readonly themeOverrides?: unknown;
|
|
@@ -1444,6 +1471,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1444
1471
|
menuBoxShadow: string;
|
|
1445
1472
|
menuBorderRadius: string;
|
|
1446
1473
|
menuHeight: string;
|
|
1474
|
+
actionDividerColor: string;
|
|
1475
|
+
actionTextColor: string;
|
|
1476
|
+
actionPadding: string;
|
|
1447
1477
|
}, {
|
|
1448
1478
|
Tree: import("../../_mixins").Theme<"Tree", {
|
|
1449
1479
|
fontSize: string;
|
|
@@ -1578,6 +1608,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1578
1608
|
menuBoxShadow: string;
|
|
1579
1609
|
menuBorderRadius: string;
|
|
1580
1610
|
menuHeight: string;
|
|
1611
|
+
actionDividerColor: string;
|
|
1612
|
+
actionTextColor: string;
|
|
1613
|
+
actionPadding: string;
|
|
1581
1614
|
}, {
|
|
1582
1615
|
Tree: import("../../_mixins").Theme<"Tree", {
|
|
1583
1616
|
fontSize: string;
|
|
@@ -1712,6 +1745,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1712
1745
|
menuBoxShadow: string;
|
|
1713
1746
|
menuBorderRadius: string;
|
|
1714
1747
|
menuHeight: string;
|
|
1748
|
+
actionDividerColor: string;
|
|
1749
|
+
actionTextColor: string;
|
|
1750
|
+
actionPadding: string;
|
|
1715
1751
|
}, {
|
|
1716
1752
|
Tree: import("../../_mixins").Theme<"Tree", {
|
|
1717
1753
|
fontSize: string;
|
|
@@ -1843,6 +1879,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1843
1879
|
"onUpdate:show"?: MaybeArray<(show: boolean) => void> | undefined;
|
|
1844
1880
|
onUpdateShow?: MaybeArray<(show: boolean) => void> | undefined;
|
|
1845
1881
|
maxTagCount?: number | "responsive" | undefined;
|
|
1882
|
+
menuProps?: HTMLAttributes | undefined;
|
|
1846
1883
|
"onUpdate:value"?: MaybeArray<OnUpdateValue> | undefined;
|
|
1847
1884
|
onUpdateValue?: MaybeArray<OnUpdateValue> | undefined;
|
|
1848
1885
|
leafOnly?: boolean | undefined;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { h, defineComponent, ref, toRef, Transition, withDirectives, computed, provide, watch, nextTick, watchEffect } from 'vue';
|
|
1
|
+
import { h, defineComponent, ref, toRef, Transition, withDirectives, computed, provide, watch, nextTick, watchEffect, renderSlot } from 'vue';
|
|
2
2
|
import { VBinder, VFollower, VTarget } from 'vueuc';
|
|
3
3
|
import { useIsMounted, useMergedState } from 'vooks';
|
|
4
4
|
import { clickoutside } from 'vdirs';
|
|
5
5
|
import { createTreeMate } from 'treemate';
|
|
6
|
+
import { happensIn } from 'seemly';
|
|
6
7
|
import { createTreeMateOptions, treeSharedProps } from '../../tree/src/Tree';
|
|
7
8
|
import { NInternalSelection, NBaseFocusDetector } from '../../_internal';
|
|
8
9
|
import { NTree } from '../../tree';
|
|
@@ -40,7 +41,7 @@ const props = Object.assign(Object.assign(Object.assign(Object.assign({}, useThe
|
|
|
40
41
|
}, show: {
|
|
41
42
|
type: Boolean,
|
|
42
43
|
default: undefined
|
|
43
|
-
}, size: String, value: [String, Number, Array], to: useAdjustedTo.propTo, virtualScroll: {
|
|
44
|
+
}, size: String, value: [String, Number, Array], to: useAdjustedTo.propTo, menuProps: Object, virtualScroll: {
|
|
44
45
|
type: Boolean,
|
|
45
46
|
default: true
|
|
46
47
|
} }), treeSharedProps), { onBlur: Function, onFocus: Function, onUpdateShow: [Function, Array], onUpdateValue: [Function, Array], 'onUpdate:value': [Function, Array], 'onUpdate:show': [Function, Array],
|
|
@@ -437,7 +438,8 @@ export default defineComponent({
|
|
|
437
438
|
function handleMenuMousedown(e) {
|
|
438
439
|
// If there's an action slot later, we need to check if mousedown happens
|
|
439
440
|
// in action panel
|
|
440
|
-
e
|
|
441
|
+
if (!happensIn(e, 'action'))
|
|
442
|
+
e.preventDefault();
|
|
441
443
|
}
|
|
442
444
|
provide(treeSelectInjectionKey, {
|
|
443
445
|
pendingNodeKeyRef
|
|
@@ -514,20 +516,23 @@ export default defineComponent({
|
|
|
514
516
|
handleTabOut,
|
|
515
517
|
handleMenuMousedown,
|
|
516
518
|
cssVars: computed(() => {
|
|
517
|
-
const { common: { cubicBezierEaseInOut }, self: { menuBoxShadow, menuBorderRadius, menuColor, menuHeight } } = themeRef.value;
|
|
519
|
+
const { common: { cubicBezierEaseInOut }, self: { menuBoxShadow, menuBorderRadius, menuColor, menuHeight, actionPadding, actionDividerColor, actionTextColor } } = themeRef.value;
|
|
518
520
|
return {
|
|
519
521
|
'--menu-box-shadow': menuBoxShadow,
|
|
520
522
|
'--menu-border-radius': menuBorderRadius,
|
|
521
523
|
'--menu-color': menuColor,
|
|
522
524
|
'--menu-height': menuHeight,
|
|
523
|
-
'--bezier': cubicBezierEaseInOut
|
|
525
|
+
'--bezier': cubicBezierEaseInOut,
|
|
526
|
+
'--action-padding': actionPadding,
|
|
527
|
+
'--action-text-color': actionTextColor,
|
|
528
|
+
'--action-divider-color': actionDividerColor
|
|
524
529
|
};
|
|
525
530
|
}),
|
|
526
531
|
mergedTheme: themeRef
|
|
527
532
|
};
|
|
528
533
|
},
|
|
529
534
|
render() {
|
|
530
|
-
const { mergedTheme, mergedClsPrefix } = this;
|
|
535
|
+
const { mergedTheme, mergedClsPrefix, $slots } = this;
|
|
531
536
|
return (h("div", { class: `${mergedClsPrefix}-tree-select` },
|
|
532
537
|
h(VBinder, null, {
|
|
533
538
|
default: () => [
|
|
@@ -539,11 +544,21 @@ export default defineComponent({
|
|
|
539
544
|
default: () => {
|
|
540
545
|
if (!this.mergedShow)
|
|
541
546
|
return null;
|
|
542
|
-
const { mergedClsPrefix, filteredTreeInfo, checkable, multiple } = this;
|
|
543
|
-
return withDirectives(h("div", {
|
|
547
|
+
const { mergedClsPrefix, filteredTreeInfo, checkable, multiple, menuProps } = this;
|
|
548
|
+
return withDirectives(h("div", Object.assign({}, menuProps, { class: [
|
|
549
|
+
`${mergedClsPrefix}-tree-select-menu`,
|
|
550
|
+
menuProps === null || menuProps === void 0 ? void 0 : menuProps.class
|
|
551
|
+
], ref: "menuElRef", style: [
|
|
552
|
+
(menuProps === null || menuProps === void 0 ? void 0 : menuProps.style) || '',
|
|
553
|
+
this.cssVars
|
|
554
|
+
], tabindex: 0, onMousedown: this.handleMenuMousedown, onKeyup: this.handleKeyup, onKeydown: this.handleKeydown, onFocusin: this.handleMenuFocusin, onFocusout: this.handleMenuFocusout }),
|
|
544
555
|
filteredTreeInfo.filteredTree.length ? (h(NTree, { ref: "treeInstRef", blockLine: true, animated: false, data: filteredTreeInfo.filteredTree, cancelable: multiple, labelField: this.labelField, theme: mergedTheme.peers.Tree, themeOverrides: mergedTheme.peerOverrides.Tree, defaultExpandAll: this.defaultExpandAll, defaultExpandedKeys: this.defaultExpandedKeys, expandedKeys: this.mergedExpandedKeys, checkedKeys: this.treeCheckedKeys, selectedKeys: this.treeSelectedKeys, checkable: checkable, checkStrategy: this.checkStrategy, cascade: this.mergedCascade, leafOnly: this.leafOnly, multiple: this.multiple, virtualScroll: this.consistentMenuWidth &&
|
|
545
|
-
this.virtualScroll, internalDataTreeMate: this.dataTreeMate, internalDisplayTreeMate: this.displayTreeMate, internalHighlightKeySet: filteredTreeInfo.highlightKeySet, internalUnifySelectCheck: true, internalScrollable: true, internalScrollablePadding: this.menuPadding, internalFocusable: false, internalCheckboxFocusable: false, onUpdateCheckedKeys: this.handleUpdateCheckedKeys, onUpdateIndeterminateKeys: this.handleUpdateIndeterminateKeys, onUpdateExpandedKeys: this.doUpdateExpandedKeys })) : (h("div", { class: `${mergedClsPrefix}-tree-select-menu__empty` },
|
|
546
|
-
h(NEmpty, { theme: mergedTheme.peers.Empty, themeOverrides: mergedTheme.peerOverrides.Empty })
|
|
556
|
+
this.virtualScroll, internalDataTreeMate: this.dataTreeMate, internalDisplayTreeMate: this.displayTreeMate, internalHighlightKeySet: filteredTreeInfo.highlightKeySet, internalUnifySelectCheck: true, internalScrollable: true, internalScrollablePadding: this.menuPadding, internalFocusable: false, internalCheckboxFocusable: false, onUpdateCheckedKeys: this.handleUpdateCheckedKeys, onUpdateIndeterminateKeys: this.handleUpdateIndeterminateKeys, onUpdateExpandedKeys: this.doUpdateExpandedKeys })) : (h("div", { class: `${mergedClsPrefix}-tree-select-menu__empty` }, renderSlot($slots, 'empty', undefined, () => [
|
|
557
|
+
h(NEmpty, { theme: mergedTheme.peers.Empty, themeOverrides: mergedTheme.peerOverrides.Empty })
|
|
558
|
+
]))),
|
|
559
|
+
$slots.action && (h("div", { class: `${mergedClsPrefix}-tree-select-menu__action`, "data-action": true }, {
|
|
560
|
+
default: $slots.action
|
|
561
|
+
})),
|
|
547
562
|
h(NBaseFocusDetector, { onFocus: this.handleTabOut })), [[clickoutside, this.handleMenuClickoutside]]);
|
|
548
563
|
}
|
|
549
564
|
}))
|
|
@@ -5,6 +5,9 @@ import { c, cB, cE } from '../../../_utils/cssr'; // vars:
|
|
|
5
5
|
// --menu-border-radius
|
|
6
6
|
// --menu-box-shadow
|
|
7
7
|
// --menu-color
|
|
8
|
+
// --action-padding
|
|
9
|
+
// --action-text-color
|
|
10
|
+
// --action-divider-color
|
|
8
11
|
|
|
9
12
|
export default c([cB('tree-select', `
|
|
10
13
|
z-index: auto;
|
|
@@ -15,15 +18,21 @@ export default c([cB('tree-select', `
|
|
|
15
18
|
position: relative;
|
|
16
19
|
overflow: hidden;
|
|
17
20
|
margin: 4px 0;
|
|
18
|
-
max-height: var(--menu-height);
|
|
19
21
|
transition: box-shadow .3s var(--bezier), background-color .3s var(--bezier);
|
|
20
22
|
border-radius: var(--menu-border-radius);
|
|
21
23
|
box-shadow: var(--menu-box-shadow);
|
|
22
24
|
background-color: var(--menu-color);
|
|
23
25
|
outline: none;
|
|
24
|
-
`, [cB('tree', 'max-height:
|
|
26
|
+
`, [cB('tree', 'max-height: var(--menu-height);'), cE('empty', `
|
|
25
27
|
display: flex;
|
|
26
28
|
padding: 12px 32px;
|
|
27
29
|
flex: 1;
|
|
28
30
|
justify-content: center;
|
|
31
|
+
`), cE('action', `
|
|
32
|
+
padding: var(--action-padding);
|
|
33
|
+
transition:
|
|
34
|
+
color .3s var(--bezier);
|
|
35
|
+
border-color .3s var(--bezier);
|
|
36
|
+
border-top: 1px solid var(--action-divider-color);
|
|
37
|
+
color: var(--action-text-color);
|
|
29
38
|
`), fadeInScaleUpTransition()])]);
|
|
@@ -5,6 +5,9 @@ export declare const self: (vars: ThemeCommonVars) => {
|
|
|
5
5
|
menuBoxShadow: string;
|
|
6
6
|
menuBorderRadius: string;
|
|
7
7
|
menuHeight: string;
|
|
8
|
+
actionDividerColor: string;
|
|
9
|
+
actionTextColor: string;
|
|
10
|
+
actionPadding: string;
|
|
8
11
|
};
|
|
9
12
|
export declare type TreeSelectThemeVars = ReturnType<typeof self>;
|
|
10
13
|
declare const treeSelectLight: import("../../_mixins/use-theme").Theme<"TreeSelect", {
|
|
@@ -13,6 +16,9 @@ declare const treeSelectLight: import("../../_mixins/use-theme").Theme<"TreeSele
|
|
|
13
16
|
menuBoxShadow: string;
|
|
14
17
|
menuBorderRadius: string;
|
|
15
18
|
menuHeight: string;
|
|
19
|
+
actionDividerColor: string;
|
|
20
|
+
actionTextColor: string;
|
|
21
|
+
actionPadding: string;
|
|
16
22
|
}, {
|
|
17
23
|
Tree: import("../../_mixins/use-theme").Theme<"Tree", {
|
|
18
24
|
fontSize: string;
|
|
@@ -4,13 +4,16 @@ import { treeLight } from '../../tree/styles';
|
|
|
4
4
|
import { emptyLight } from '../../empty/styles';
|
|
5
5
|
import { internalSelectionLight } from '../../_internal/selection/styles';
|
|
6
6
|
export const self = (vars) => {
|
|
7
|
-
const { popoverColor, boxShadow2, borderRadius, heightMedium } = vars;
|
|
7
|
+
const { popoverColor, boxShadow2, borderRadius, heightMedium, dividerColor, textColor2 } = vars;
|
|
8
8
|
return {
|
|
9
9
|
menuPadding: '4px',
|
|
10
10
|
menuColor: popoverColor,
|
|
11
11
|
menuBoxShadow: boxShadow2,
|
|
12
12
|
menuBorderRadius: borderRadius,
|
|
13
|
-
menuHeight: `calc(${heightMedium} * 7.6)
|
|
13
|
+
menuHeight: `calc(${heightMedium} * 7.6)`,
|
|
14
|
+
actionDividerColor: dividerColor,
|
|
15
|
+
actionTextColor: textColor2,
|
|
16
|
+
actionPadding: '8px 12px'
|
|
14
17
|
};
|
|
15
18
|
};
|
|
16
19
|
const treeSelectLight = createTheme({
|
|
@@ -68,6 +68,10 @@ declare const uploadProps: {
|
|
|
68
68
|
readonly createThumbnailUrl: PropType<CreateThumbnailUrl>;
|
|
69
69
|
readonly abstract: BooleanConstructor;
|
|
70
70
|
readonly max: NumberConstructor;
|
|
71
|
+
readonly showTrigger: {
|
|
72
|
+
readonly type: BooleanConstructor;
|
|
73
|
+
readonly default: true;
|
|
74
|
+
};
|
|
71
75
|
readonly theme: PropType<import("../../_mixins").Theme<"Upload", {
|
|
72
76
|
fontSize: string;
|
|
73
77
|
lineHeight: string;
|
|
@@ -99,9 +103,9 @@ declare const uploadProps: {
|
|
|
99
103
|
fontSizeMedium: string;
|
|
100
104
|
fontSizeLarge: string;
|
|
101
105
|
opacityDisabled: string;
|
|
102
|
-
colorOpacitySecondary:
|
|
103
|
-
colorOpacitySecondaryHover:
|
|
104
|
-
colorOpacitySecondaryPressed:
|
|
106
|
+
colorOpacitySecondary: string;
|
|
107
|
+
colorOpacitySecondaryHover: string;
|
|
108
|
+
colorOpacitySecondaryPressed: string;
|
|
105
109
|
colorSecondary: string;
|
|
106
110
|
colorSecondaryHover: string;
|
|
107
111
|
colorSecondaryPressed: string;
|
|
@@ -344,9 +348,9 @@ declare const uploadProps: {
|
|
|
344
348
|
fontSizeMedium: string;
|
|
345
349
|
fontSizeLarge: string;
|
|
346
350
|
opacityDisabled: string;
|
|
347
|
-
colorOpacitySecondary:
|
|
348
|
-
colorOpacitySecondaryHover:
|
|
349
|
-
colorOpacitySecondaryPressed:
|
|
351
|
+
colorOpacitySecondary: string;
|
|
352
|
+
colorOpacitySecondaryHover: string;
|
|
353
|
+
colorOpacitySecondaryPressed: string;
|
|
350
354
|
colorSecondary: string;
|
|
351
355
|
colorSecondaryHover: string;
|
|
352
356
|
colorSecondaryPressed: string;
|
|
@@ -589,9 +593,9 @@ declare const uploadProps: {
|
|
|
589
593
|
fontSizeMedium: string;
|
|
590
594
|
fontSizeLarge: string;
|
|
591
595
|
opacityDisabled: string;
|
|
592
|
-
colorOpacitySecondary:
|
|
593
|
-
colorOpacitySecondaryHover:
|
|
594
|
-
colorOpacitySecondaryPressed:
|
|
596
|
+
colorOpacitySecondary: string;
|
|
597
|
+
colorOpacitySecondaryHover: string;
|
|
598
|
+
colorOpacitySecondaryPressed: string;
|
|
595
599
|
colorSecondary: string;
|
|
596
600
|
colorSecondaryHover: string;
|
|
597
601
|
colorSecondaryPressed: string;
|
|
@@ -872,6 +876,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
872
876
|
readonly createThumbnailUrl: PropType<CreateThumbnailUrl>;
|
|
873
877
|
readonly abstract: BooleanConstructor;
|
|
874
878
|
readonly max: NumberConstructor;
|
|
879
|
+
readonly showTrigger: {
|
|
880
|
+
readonly type: BooleanConstructor;
|
|
881
|
+
readonly default: true;
|
|
882
|
+
};
|
|
875
883
|
readonly theme: PropType<import("../../_mixins").Theme<"Upload", {
|
|
876
884
|
fontSize: string;
|
|
877
885
|
lineHeight: string;
|
|
@@ -903,9 +911,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
903
911
|
fontSizeMedium: string;
|
|
904
912
|
fontSizeLarge: string;
|
|
905
913
|
opacityDisabled: string;
|
|
906
|
-
colorOpacitySecondary:
|
|
907
|
-
colorOpacitySecondaryHover:
|
|
908
|
-
colorOpacitySecondaryPressed:
|
|
914
|
+
colorOpacitySecondary: string;
|
|
915
|
+
colorOpacitySecondaryHover: string;
|
|
916
|
+
colorOpacitySecondaryPressed: string;
|
|
909
917
|
colorSecondary: string;
|
|
910
918
|
colorSecondaryHover: string;
|
|
911
919
|
colorSecondaryPressed: string;
|
|
@@ -1148,9 +1156,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1148
1156
|
fontSizeMedium: string;
|
|
1149
1157
|
fontSizeLarge: string;
|
|
1150
1158
|
opacityDisabled: string;
|
|
1151
|
-
colorOpacitySecondary:
|
|
1152
|
-
colorOpacitySecondaryHover:
|
|
1153
|
-
colorOpacitySecondaryPressed:
|
|
1159
|
+
colorOpacitySecondary: string;
|
|
1160
|
+
colorOpacitySecondaryHover: string;
|
|
1161
|
+
colorOpacitySecondaryPressed: string;
|
|
1154
1162
|
colorSecondary: string;
|
|
1155
1163
|
colorSecondaryHover: string;
|
|
1156
1164
|
colorSecondaryPressed: string;
|
|
@@ -1393,9 +1401,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1393
1401
|
fontSizeMedium: string;
|
|
1394
1402
|
fontSizeLarge: string;
|
|
1395
1403
|
opacityDisabled: string;
|
|
1396
|
-
colorOpacitySecondary:
|
|
1397
|
-
colorOpacitySecondaryHover:
|
|
1398
|
-
colorOpacitySecondaryPressed:
|
|
1404
|
+
colorOpacitySecondary: string;
|
|
1405
|
+
colorOpacitySecondaryHover: string;
|
|
1406
|
+
colorOpacitySecondaryPressed: string;
|
|
1399
1407
|
colorSecondary: string;
|
|
1400
1408
|
colorSecondaryHover: string;
|
|
1401
1409
|
colorSecondaryPressed: string;
|
|
@@ -1751,9 +1759,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1751
1759
|
fontSizeMedium: string;
|
|
1752
1760
|
fontSizeLarge: string;
|
|
1753
1761
|
opacityDisabled: string;
|
|
1754
|
-
colorOpacitySecondary:
|
|
1755
|
-
colorOpacitySecondaryHover:
|
|
1756
|
-
colorOpacitySecondaryPressed:
|
|
1762
|
+
colorOpacitySecondary: string;
|
|
1763
|
+
colorOpacitySecondaryHover: string;
|
|
1764
|
+
colorOpacitySecondaryPressed: string;
|
|
1757
1765
|
colorSecondary: string;
|
|
1758
1766
|
colorSecondaryHover: string;
|
|
1759
1767
|
colorSecondaryPressed: string;
|
|
@@ -2014,6 +2022,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
2014
2022
|
readonly createThumbnailUrl?: unknown;
|
|
2015
2023
|
readonly abstract?: unknown;
|
|
2016
2024
|
readonly max?: unknown;
|
|
2025
|
+
readonly showTrigger?: unknown;
|
|
2017
2026
|
readonly theme?: unknown;
|
|
2018
2027
|
readonly themeOverrides?: unknown;
|
|
2019
2028
|
readonly builtinThemeOverrides?: unknown;
|
|
@@ -2022,6 +2031,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
2022
2031
|
abstract: boolean;
|
|
2023
2032
|
name: string;
|
|
2024
2033
|
multiple: boolean;
|
|
2034
|
+
showTrigger: boolean;
|
|
2025
2035
|
listType: listType;
|
|
2026
2036
|
showCancelButton: boolean;
|
|
2027
2037
|
showRemoveButton: boolean;
|
|
@@ -2071,9 +2081,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
2071
2081
|
fontSizeMedium: string;
|
|
2072
2082
|
fontSizeLarge: string;
|
|
2073
2083
|
opacityDisabled: string;
|
|
2074
|
-
colorOpacitySecondary:
|
|
2075
|
-
colorOpacitySecondaryHover:
|
|
2076
|
-
colorOpacitySecondaryPressed:
|
|
2084
|
+
colorOpacitySecondary: string;
|
|
2085
|
+
colorOpacitySecondaryHover: string;
|
|
2086
|
+
colorOpacitySecondaryPressed: string;
|
|
2077
2087
|
colorSecondary: string;
|
|
2078
2088
|
colorSecondaryHover: string;
|
|
2079
2089
|
colorSecondaryPressed: string;
|
|
@@ -2316,9 +2326,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
2316
2326
|
fontSizeMedium: string;
|
|
2317
2327
|
fontSizeLarge: string;
|
|
2318
2328
|
opacityDisabled: string;
|
|
2319
|
-
colorOpacitySecondary:
|
|
2320
|
-
colorOpacitySecondaryHover:
|
|
2321
|
-
colorOpacitySecondaryPressed:
|
|
2329
|
+
colorOpacitySecondary: string;
|
|
2330
|
+
colorOpacitySecondaryHover: string;
|
|
2331
|
+
colorOpacitySecondaryPressed: string;
|
|
2322
2332
|
colorSecondary: string;
|
|
2323
2333
|
colorSecondaryHover: string;
|
|
2324
2334
|
colorSecondaryPressed: string;
|
|
@@ -2561,9 +2571,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
2561
2571
|
fontSizeMedium: string;
|
|
2562
2572
|
fontSizeLarge: string;
|
|
2563
2573
|
opacityDisabled: string;
|
|
2564
|
-
colorOpacitySecondary:
|
|
2565
|
-
colorOpacitySecondaryHover:
|
|
2566
|
-
colorOpacitySecondaryPressed:
|
|
2574
|
+
colorOpacitySecondary: string;
|
|
2575
|
+
colorOpacitySecondaryHover: string;
|
|
2576
|
+
colorOpacitySecondaryPressed: string;
|
|
2567
2577
|
colorSecondary: string;
|
|
2568
2578
|
colorSecondaryHover: string;
|
|
2569
2579
|
colorSecondaryPressed: string;
|
|
@@ -2792,6 +2802,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
2792
2802
|
name: string;
|
|
2793
2803
|
multiple: boolean;
|
|
2794
2804
|
disabled: boolean | undefined;
|
|
2805
|
+
showTrigger: boolean;
|
|
2795
2806
|
listType: listType;
|
|
2796
2807
|
showCancelButton: boolean;
|
|
2797
2808
|
showRemoveButton: boolean;
|
package/es/upload/src/Upload.js
CHANGED
|
@@ -25,19 +25,33 @@ import NUploadFileList from './UploadFileList';
|
|
|
25
25
|
function createXhrHandlers(inst, file, XHR) {
|
|
26
26
|
const { doChange, XhrMap } = inst;
|
|
27
27
|
let percentage = 0;
|
|
28
|
+
function handleXHRError(e) {
|
|
29
|
+
const fileAfterChange = Object.assign({}, file, {
|
|
30
|
+
status: 'error',
|
|
31
|
+
percentage
|
|
32
|
+
});
|
|
33
|
+
XhrMap.delete(file.id);
|
|
34
|
+
doChange(fileAfterChange, e);
|
|
35
|
+
}
|
|
36
|
+
function handleXHRLoad(e) {
|
|
37
|
+
var _a;
|
|
38
|
+
if (XHR.status !== 200) {
|
|
39
|
+
handleXHRError(e);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
let fileAfterChange = Object.assign({}, file, {
|
|
43
|
+
status: 'finished',
|
|
44
|
+
percentage,
|
|
45
|
+
file: null
|
|
46
|
+
});
|
|
47
|
+
XhrMap.delete(file.id);
|
|
48
|
+
fileAfterChange =
|
|
49
|
+
((_a = inst.onFinish) === null || _a === void 0 ? void 0 : _a.call(inst, { file: fileAfterChange, event: e })) || fileAfterChange;
|
|
50
|
+
doChange(fileAfterChange, e);
|
|
51
|
+
}
|
|
28
52
|
return {
|
|
29
|
-
handleXHRLoad
|
|
30
|
-
|
|
31
|
-
let fileAfterChange = Object.assign({}, file, {
|
|
32
|
-
status: 'finished',
|
|
33
|
-
percentage,
|
|
34
|
-
file: null
|
|
35
|
-
});
|
|
36
|
-
XhrMap.delete(file.id);
|
|
37
|
-
fileAfterChange =
|
|
38
|
-
((_a = inst.onFinish) === null || _a === void 0 ? void 0 : _a.call(inst, { file: fileAfterChange, event: e })) || fileAfterChange;
|
|
39
|
-
doChange(fileAfterChange, e);
|
|
40
|
-
},
|
|
53
|
+
handleXHRLoad,
|
|
54
|
+
handleXHRError,
|
|
41
55
|
handleXHRAbort(e) {
|
|
42
56
|
const fileAfterChange = Object.assign({}, file, {
|
|
43
57
|
status: 'removed',
|
|
@@ -47,14 +61,6 @@ function createXhrHandlers(inst, file, XHR) {
|
|
|
47
61
|
XhrMap.delete(file.id);
|
|
48
62
|
doChange(fileAfterChange, e);
|
|
49
63
|
},
|
|
50
|
-
handleXHRError(e) {
|
|
51
|
-
const fileAfterChange = Object.assign({}, file, {
|
|
52
|
-
status: 'error',
|
|
53
|
-
percentage
|
|
54
|
-
});
|
|
55
|
-
XhrMap.delete(file.id);
|
|
56
|
-
doChange(fileAfterChange, e);
|
|
57
|
-
},
|
|
58
64
|
handleXHRProgress(e) {
|
|
59
65
|
const fileAfterChange = Object.assign({}, file, {
|
|
60
66
|
status: 'uploading'
|
|
@@ -197,7 +203,10 @@ const uploadProps = Object.assign(Object.assign({}, useTheme.props), { name: {
|
|
|
197
203
|
}, listType: {
|
|
198
204
|
type: String,
|
|
199
205
|
default: 'text'
|
|
200
|
-
}, onPreview: Function, createThumbnailUrl: Function, abstract: Boolean, max: Number
|
|
206
|
+
}, onPreview: Function, createThumbnailUrl: Function, abstract: Boolean, max: Number, showTrigger: {
|
|
207
|
+
type: Boolean,
|
|
208
|
+
default: true
|
|
209
|
+
} });
|
|
201
210
|
export default defineComponent({
|
|
202
211
|
name: 'Upload',
|
|
203
212
|
props: uploadProps,
|
|
@@ -416,7 +425,8 @@ export default defineComponent({
|
|
|
416
425
|
maxReachedRef,
|
|
417
426
|
fileListStyleRef: toRef(props, 'fileListStyle'),
|
|
418
427
|
abstractRef: toRef(props, 'abstract'),
|
|
419
|
-
cssVarsRef
|
|
428
|
+
cssVarsRef,
|
|
429
|
+
showTriggerRef: toRef(props, 'showTrigger')
|
|
420
430
|
});
|
|
421
431
|
const exposedMethods = {
|
|
422
432
|
submit,
|
|
@@ -443,7 +453,7 @@ export default defineComponent({
|
|
|
443
453
|
this.dragOver && `${mergedClsPrefix}-upload--drag-over`
|
|
444
454
|
], style: this.cssVars },
|
|
445
455
|
inputNode,
|
|
446
|
-
this.listType !== 'image-card' && (h(NUploadTrigger, null, $slots)),
|
|
456
|
+
this.showTrigger && this.listType !== 'image-card' && (h(NUploadTrigger, null, $slots)),
|
|
447
457
|
this.showFileList && h(NUploadFileList, null, $slots)));
|
|
448
458
|
}
|
|
449
459
|
});
|
|
@@ -150,9 +150,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
150
150
|
fontSizeMedium: string;
|
|
151
151
|
fontSizeLarge: string;
|
|
152
152
|
opacityDisabled: string;
|
|
153
|
-
colorOpacitySecondary:
|
|
154
|
-
colorOpacitySecondaryHover:
|
|
155
|
-
colorOpacitySecondaryPressed:
|
|
153
|
+
colorOpacitySecondary: string;
|
|
154
|
+
colorOpacitySecondaryHover: string;
|
|
155
|
+
colorOpacitySecondaryPressed: string;
|
|
156
156
|
colorSecondary: string;
|
|
157
157
|
colorSecondaryHover: string;
|
|
158
158
|
colorSecondaryPressed: string;
|
|
@@ -219,7 +219,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
219
219
|
colorHoverInfo: string;
|
|
220
220
|
colorPressedInfo: string;
|
|
221
221
|
colorFocusInfo: string;
|
|
222
|
-
colorDisabledInfo: string;
|
|
222
|
+
colorDisabledInfo: string;
|
|
223
223
|
textColorInfo: string;
|
|
224
224
|
textColorHoverInfo: string;
|
|
225
225
|
textColorPressedInfo: string;
|