naive-ui 2.30.3 → 2.30.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1385 -901
- package/dist/index.prod.js +2 -2
- package/es/_internal/scrollbar/src/Scrollbar.js +5 -17
- package/es/_internal/select-menu/src/SelectGroupHeader.d.ts +1 -0
- package/es/_internal/select-menu/src/SelectGroupHeader.js +5 -3
- package/es/_internal/select-menu/src/SelectMenu.d.ts +3 -3
- package/es/_internal/select-menu/src/SelectMenu.js +6 -8
- package/es/_internal/select-menu/src/SelectOption.d.ts +1 -0
- package/es/_internal/select-menu/src/SelectOption.js +11 -5
- package/es/_internal/select-menu/src/interface.d.ts +3 -1
- package/es/_internal/selection/src/Selection.d.ts +0 -2
- package/es/_internal/selection/src/Selection.js +2 -2
- package/es/_mixins/use-theme.js +1 -1
- package/es/_utils/composable/index.d.ts +3 -5
- package/es/_utils/composable/index.js +3 -111
- package/es/_utils/composable/use-collection.d.ts +4 -0
- package/es/_utils/composable/use-collection.js +87 -0
- package/es/_utils/composable/use-deferred-true.d.ts +2 -0
- package/es/_utils/composable/use-deferred-true.js +25 -0
- package/es/_utils/composable/use-reactivated.d.ts +3 -0
- package/es/_utils/composable/use-reactivated.js +20 -0
- package/es/_utils/event/index.d.ts +2 -0
- package/es/_utils/event/index.js +7 -0
- package/es/_utils/index.d.ts +2 -1
- package/es/_utils/index.js +2 -1
- package/es/_utils/vue/index.d.ts +1 -0
- package/es/_utils/vue/index.js +1 -0
- package/es/_utils/vue/merge-handlers.d.ts +1 -0
- package/es/_utils/vue/merge-handlers.js +15 -0
- package/es/button/src/Button.js +7 -2
- package/es/cascader/src/Cascader.d.ts +2 -3
- package/es/cascader/src/Cascader.js +26 -22
- package/es/cascader/src/CascaderMenu.d.ts +2 -2
- package/es/cascader/src/CascaderMenu.js +2 -4
- package/es/data-table/src/DataTable.d.ts +787 -0
- package/es/data-table/src/DataTable.js +7 -3
- package/es/data-table/src/HeaderButton/FilterButton.d.ts +142 -0
- package/es/data-table/src/HeaderButton/FilterMenu.d.ts +142 -0
- package/es/data-table/src/MainTable.d.ts +2 -0
- package/es/data-table/src/MainTable.js +5 -1
- package/es/data-table/src/TableParts/Body.d.ts +143 -0
- package/es/data-table/src/TableParts/Body.js +11 -2
- package/es/data-table/src/TableParts/Cell.d.ts +284 -0
- package/es/data-table/src/TableParts/Header.d.ts +143 -0
- package/es/data-table/src/TableParts/Header.js +6 -2
- package/es/data-table/src/interface.d.ts +9 -5
- package/es/data-table/src/use-expand.d.ts +5 -3
- package/es/data-table/src/use-expand.js +22 -2
- package/es/data-table/src/utils.d.ts +2 -2
- package/es/data-table/src/utils.js +10 -8
- package/es/data-table/styles/light.d.ts +71 -0
- package/es/date-picker/src/DatePicker.d.ts +2 -1
- package/es/date-picker/src/DatePicker.js +20 -9
- package/es/date-picker/src/panel/month.js +3 -2
- package/es/drawer/src/Drawer.d.ts +1 -1
- package/es/drawer/src/Drawer.js +3 -3
- package/es/drawer/src/DrawerBodyWrapper.d.ts +2 -2
- package/es/dropdown/src/Dropdown.d.ts +4 -0
- package/es/dynamic-tags/src/DynamicTags.js +1 -1
- package/es/input/src/Input.d.ts +6 -3
- package/es/input/src/Input.js +56 -31
- package/es/input/src/utils.d.ts +7 -1
- package/es/input/src/utils.js +57 -2
- package/es/layout/src/Layout.d.ts +3 -1
- package/es/layout/src/Layout.js +22 -4
- package/es/layout/src/LayoutContent.d.ts +1 -0
- package/es/layout/src/LayoutSider.d.ts +1 -0
- package/es/layout/src/LayoutSider.js +22 -3
- package/es/menu/src/Menu.d.ts +1 -1
- package/es/modal/src/BodyWrapper.d.ts +2 -2
- package/es/modal/src/Modal.js +2 -2
- package/es/pagination/src/Pagination.d.ts +806 -20
- package/es/pagination/src/Pagination.js +115 -52
- package/es/pagination/src/interface.d.ts +2 -2
- package/es/pagination/src/styles/index.cssr.js +12 -10
- package/es/pagination/src/utils.d.ts +15 -5
- package/es/pagination/src/utils.js +117 -50
- package/es/pagination/styles/dark.js +3 -1
- package/es/pagination/styles/light.d.ts +71 -0
- package/es/pagination/styles/light.js +3 -1
- package/es/popconfirm/src/Popconfirm.d.ts +4 -0
- package/es/popover/src/Popover.d.ts +5 -0
- package/es/popover/src/Popover.js +1 -0
- package/es/popover/src/PopoverBody.d.ts +4 -0
- package/es/popover/src/PopoverBody.js +18 -10
- package/es/popselect/src/Popselect.d.ts +24 -0
- package/es/popselect/src/Popselect.js +12 -7
- package/es/popselect/src/PopselectPanel.d.ts +22 -2
- package/es/popselect/src/PopselectPanel.js +12 -1
- package/es/select/src/Select.d.ts +1 -1
- package/es/select/src/Select.js +5 -2
- package/es/slider/src/Slider.d.ts +1 -1
- package/es/slider/src/Slider.js +13 -5
- package/es/slider/src/styles/index.cssr.js +26 -31
- package/es/time-picker/src/TimePicker.d.ts +2 -1
- package/es/time-picker/src/TimePicker.js +18 -8
- package/es/tooltip/src/Tooltip.d.ts +4 -0
- package/es/tree/src/Tree.d.ts +2 -3
- package/es/tree/src/Tree.js +6 -8
- package/es/tree/src/TreeNode.js +4 -1
- package/es/tree/src/interface.d.ts +0 -1
- package/es/tree/src/keyboard.d.ts +0 -1
- package/es/tree/src/keyboard.js +6 -9
- package/es/tree-select/src/TreeSelect.d.ts +1 -3
- package/es/tree-select/src/TreeSelect.js +14 -16
- package/es/upload/src/UploadDragger.js +2 -2
- package/es/upload/src/UploadFile.d.ts +2 -2
- package/es/upload/src/UploadFile.js +9 -4
- package/es/upload/src/UploadTrigger.js +4 -3
- package/es/upload/src/styles/index.cssr.js +2 -2
- package/es/upload/src/utils.js +1 -15
- package/es/version.d.ts +1 -1
- package/es/version.js +1 -1
- package/lib/_internal/scrollbar/src/Scrollbar.js +4 -16
- package/lib/_internal/select-menu/src/SelectGroupHeader.d.ts +1 -0
- package/lib/_internal/select-menu/src/SelectGroupHeader.js +5 -3
- package/lib/_internal/select-menu/src/SelectMenu.d.ts +3 -3
- package/lib/_internal/select-menu/src/SelectMenu.js +5 -7
- package/lib/_internal/select-menu/src/SelectOption.d.ts +1 -0
- package/lib/_internal/select-menu/src/SelectOption.js +10 -4
- package/lib/_internal/select-menu/src/interface.d.ts +3 -1
- package/lib/_internal/selection/src/Selection.d.ts +0 -2
- package/lib/_internal/selection/src/Selection.js +2 -2
- package/lib/_mixins/use-theme.js +1 -1
- package/lib/_utils/composable/index.d.ts +3 -5
- package/lib/_utils/composable/index.js +9 -116
- package/lib/_utils/composable/use-collection.d.ts +4 -0
- package/lib/_utils/composable/use-collection.js +93 -0
- package/lib/_utils/composable/use-deferred-true.d.ts +2 -0
- package/lib/_utils/composable/use-deferred-true.js +29 -0
- package/lib/_utils/composable/use-reactivated.d.ts +3 -0
- package/lib/_utils/composable/use-reactivated.js +24 -0
- package/lib/_utils/event/index.d.ts +2 -0
- package/lib/_utils/event/index.js +12 -0
- package/lib/_utils/index.d.ts +2 -1
- package/lib/_utils/index.js +5 -1
- package/lib/_utils/vue/index.d.ts +1 -0
- package/lib/_utils/vue/index.js +3 -1
- package/lib/_utils/vue/merge-handlers.d.ts +1 -0
- package/lib/_utils/vue/merge-handlers.js +19 -0
- package/lib/button/src/Button.js +7 -2
- package/lib/cascader/src/Cascader.d.ts +2 -3
- package/lib/cascader/src/Cascader.js +25 -21
- package/lib/cascader/src/CascaderMenu.d.ts +2 -2
- package/lib/cascader/src/CascaderMenu.js +2 -4
- package/lib/data-table/src/DataTable.d.ts +787 -0
- package/lib/data-table/src/DataTable.js +7 -3
- package/lib/data-table/src/HeaderButton/FilterButton.d.ts +142 -0
- package/lib/data-table/src/HeaderButton/FilterMenu.d.ts +142 -0
- package/lib/data-table/src/MainTable.d.ts +2 -0
- package/lib/data-table/src/MainTable.js +5 -1
- package/lib/data-table/src/TableParts/Body.d.ts +143 -0
- package/lib/data-table/src/TableParts/Body.js +11 -2
- package/lib/data-table/src/TableParts/Cell.d.ts +284 -0
- package/lib/data-table/src/TableParts/Header.d.ts +143 -0
- package/lib/data-table/src/TableParts/Header.js +6 -2
- package/lib/data-table/src/interface.d.ts +9 -5
- package/lib/data-table/src/use-expand.d.ts +5 -3
- package/lib/data-table/src/use-expand.js +22 -2
- package/lib/data-table/src/utils.d.ts +2 -2
- package/lib/data-table/src/utils.js +11 -9
- package/lib/data-table/styles/light.d.ts +71 -0
- package/lib/date-picker/src/DatePicker.d.ts +2 -1
- package/lib/date-picker/src/DatePicker.js +19 -8
- package/lib/date-picker/src/panel/month.js +3 -2
- package/lib/drawer/src/Drawer.d.ts +1 -1
- package/lib/drawer/src/Drawer.js +2 -2
- package/lib/drawer/src/DrawerBodyWrapper.d.ts +2 -2
- package/lib/dropdown/src/Dropdown.d.ts +4 -0
- package/lib/dynamic-tags/src/DynamicTags.js +1 -1
- package/lib/input/src/Input.d.ts +6 -3
- package/lib/input/src/Input.js +55 -30
- package/lib/input/src/utils.d.ts +7 -1
- package/lib/input/src/utils.js +60 -4
- package/lib/layout/src/Layout.d.ts +3 -1
- package/lib/layout/src/Layout.js +22 -4
- package/lib/layout/src/LayoutContent.d.ts +1 -0
- package/lib/layout/src/LayoutSider.d.ts +1 -0
- package/lib/layout/src/LayoutSider.js +21 -2
- package/lib/menu/src/Menu.d.ts +1 -1
- package/lib/modal/src/BodyWrapper.d.ts +2 -2
- package/lib/modal/src/Modal.js +1 -1
- package/lib/pagination/src/Pagination.d.ts +806 -20
- package/lib/pagination/src/Pagination.js +114 -51
- package/lib/pagination/src/interface.d.ts +2 -2
- package/lib/pagination/src/styles/index.cssr.js +13 -11
- package/lib/pagination/src/utils.d.ts +15 -5
- package/lib/pagination/src/utils.js +118 -53
- package/lib/pagination/styles/dark.js +6 -4
- package/lib/pagination/styles/light.d.ts +71 -0
- package/lib/pagination/styles/light.js +6 -4
- package/lib/popconfirm/src/Popconfirm.d.ts +4 -0
- package/lib/popover/src/Popover.d.ts +5 -0
- package/lib/popover/src/Popover.js +1 -0
- package/lib/popover/src/PopoverBody.d.ts +4 -0
- package/lib/popover/src/PopoverBody.js +18 -10
- package/lib/popselect/src/Popselect.d.ts +24 -0
- package/lib/popselect/src/Popselect.js +10 -5
- package/lib/popselect/src/PopselectPanel.d.ts +22 -2
- package/lib/popselect/src/PopselectPanel.js +12 -1
- package/lib/select/src/Select.d.ts +1 -1
- package/lib/select/src/Select.js +4 -1
- package/lib/slider/src/Slider.d.ts +1 -1
- package/lib/slider/src/Slider.js +12 -4
- package/lib/slider/src/styles/index.cssr.js +26 -31
- package/lib/time-picker/src/TimePicker.d.ts +2 -1
- package/lib/time-picker/src/TimePicker.js +17 -7
- package/lib/tooltip/src/Tooltip.d.ts +4 -0
- package/lib/tree/src/Tree.d.ts +2 -3
- package/lib/tree/src/Tree.js +6 -8
- package/lib/tree/src/TreeNode.js +4 -1
- package/lib/tree/src/interface.d.ts +0 -1
- package/lib/tree/src/keyboard.d.ts +0 -1
- package/lib/tree/src/keyboard.js +6 -9
- package/lib/tree-select/src/TreeSelect.d.ts +1 -3
- package/lib/tree-select/src/TreeSelect.js +13 -15
- package/lib/upload/src/UploadDragger.js +2 -2
- package/lib/upload/src/UploadFile.d.ts +2 -2
- package/lib/upload/src/UploadFile.js +9 -4
- package/lib/upload/src/UploadTrigger.js +3 -2
- package/lib/upload/src/styles/index.cssr.js +2 -2
- package/lib/upload/src/utils.js +1 -15
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
- package/web-types.json +37 -1
|
@@ -626,6 +626,77 @@ declare const dataTableLight: import("../../_mixins").Theme<"DataTable", {
|
|
|
626
626
|
paddingLarge: string;
|
|
627
627
|
clearSize: string;
|
|
628
628
|
}, any>;
|
|
629
|
+
Popselect: import("../../_mixins").Theme<"Popselect", {
|
|
630
|
+
menuBoxShadow: string;
|
|
631
|
+
}, {
|
|
632
|
+
Popover: import("../../_mixins").Theme<"Popover", {
|
|
633
|
+
fontSize: string;
|
|
634
|
+
borderRadius: string;
|
|
635
|
+
color: string;
|
|
636
|
+
dividerColor: string;
|
|
637
|
+
textColor: string;
|
|
638
|
+
boxShadow: string;
|
|
639
|
+
space: string;
|
|
640
|
+
spaceArrow: string;
|
|
641
|
+
arrowOffset: string;
|
|
642
|
+
arrowOffsetVertical: string;
|
|
643
|
+
arrowHeight: string;
|
|
644
|
+
padding: string;
|
|
645
|
+
}, any>;
|
|
646
|
+
InternalSelectMenu: import("../../_mixins").Theme<"InternalSelectMenu", {
|
|
647
|
+
optionFontSizeSmall: string;
|
|
648
|
+
optionFontSizeMedium: string;
|
|
649
|
+
optionFontSizeLarge: string;
|
|
650
|
+
optionFontSizeHuge: string;
|
|
651
|
+
optionHeightSmall: string;
|
|
652
|
+
optionHeightMedium: string;
|
|
653
|
+
optionHeightLarge: string;
|
|
654
|
+
optionHeightHuge: string;
|
|
655
|
+
borderRadius: string;
|
|
656
|
+
color: string;
|
|
657
|
+
groupHeaderTextColor: string;
|
|
658
|
+
actionDividerColor: string;
|
|
659
|
+
optionTextColor: string;
|
|
660
|
+
optionTextColorPressed: string;
|
|
661
|
+
optionTextColorDisabled: string;
|
|
662
|
+
optionTextColorActive: string;
|
|
663
|
+
optionOpacityDisabled: string;
|
|
664
|
+
optionCheckColor: string;
|
|
665
|
+
optionColorPending: string;
|
|
666
|
+
optionColorActive: string;
|
|
667
|
+
optionColorActivePending: string;
|
|
668
|
+
actionTextColor: string;
|
|
669
|
+
loadingColor: string;
|
|
670
|
+
height: string;
|
|
671
|
+
paddingSmall: string;
|
|
672
|
+
paddingMedium: string;
|
|
673
|
+
paddingLarge: string;
|
|
674
|
+
paddingHuge: string;
|
|
675
|
+
optionPaddingSmall: string;
|
|
676
|
+
optionPaddingMedium: string;
|
|
677
|
+
optionPaddingLarge: string;
|
|
678
|
+
optionPaddingHuge: string;
|
|
679
|
+
loadingSize: string;
|
|
680
|
+
}, {
|
|
681
|
+
Scrollbar: import("../../_mixins").Theme<"Scrollbar", {
|
|
682
|
+
color: string;
|
|
683
|
+
colorHover: string;
|
|
684
|
+
}, any>;
|
|
685
|
+
Empty: import("../../_mixins").Theme<"Empty", {
|
|
686
|
+
fontSizeSmall: string;
|
|
687
|
+
fontSizeMedium: string;
|
|
688
|
+
fontSizeLarge: string;
|
|
689
|
+
fontSizeHuge: string;
|
|
690
|
+
textColor: string;
|
|
691
|
+
iconColor: string;
|
|
692
|
+
extraTextColor: string;
|
|
693
|
+
iconSizeSmall: string;
|
|
694
|
+
iconSizeMedium: string;
|
|
695
|
+
iconSizeLarge: string;
|
|
696
|
+
iconSizeHuge: string;
|
|
697
|
+
}, any>;
|
|
698
|
+
}>;
|
|
699
|
+
}>;
|
|
629
700
|
}>;
|
|
630
701
|
Scrollbar: import("../../_mixins").Theme<"Scrollbar", {
|
|
631
702
|
color: string;
|
|
@@ -3948,8 +3948,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
3948
3948
|
isValueInvalid: import("vue").ComputedRef<boolean>;
|
|
3949
3949
|
isStartValueInvalid: import("vue").ComputedRef<boolean>;
|
|
3950
3950
|
isEndValueInvalid: import("vue").ComputedRef<boolean>;
|
|
3951
|
+
handleInputKeydown: (e: KeyboardEvent) => void;
|
|
3951
3952
|
handleClickOutside: (e: MouseEvent) => void;
|
|
3952
|
-
|
|
3953
|
+
handleKeydown: (e: KeyboardEvent) => void;
|
|
3953
3954
|
handleClear: () => void;
|
|
3954
3955
|
handlePanelClear: () => void;
|
|
3955
3956
|
handleTriggerClick: (e: MouseEvent) => void;
|
|
@@ -307,11 +307,14 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
307
307
|
(0, _utils_1.call)(onUpdateShow, show);
|
|
308
308
|
uncontrolledShowRef.value = show;
|
|
309
309
|
}
|
|
310
|
-
function
|
|
310
|
+
function handleKeydown(e) {
|
|
311
311
|
if (e.key === 'Escape') {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
312
|
+
if (mergedShowRef.value) {
|
|
313
|
+
(0, _utils_1.markEventEffectPerformed)(e);
|
|
314
|
+
closeCalendar({
|
|
315
|
+
returnFocus: true
|
|
316
|
+
});
|
|
317
|
+
}
|
|
315
318
|
}
|
|
316
319
|
// We need to handle the conflict with normal date value input
|
|
317
320
|
// const { value: mergedValue } = mergedValueRef
|
|
@@ -320,6 +323,12 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
320
323
|
// doUpdateValue(nextValue)
|
|
321
324
|
// }
|
|
322
325
|
}
|
|
326
|
+
function handleInputKeydown(e) {
|
|
327
|
+
if (e.key === 'Escape' && mergedShowRef.value) {
|
|
328
|
+
(0, _utils_1.markEventEffectPerformed)(e);
|
|
329
|
+
// closeCalendar will be called in handleDeactivated
|
|
330
|
+
}
|
|
331
|
+
}
|
|
323
332
|
function handleClear() {
|
|
324
333
|
var _a;
|
|
325
334
|
doUpdateShow(false);
|
|
@@ -600,8 +609,9 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
600
609
|
: undefined;
|
|
601
610
|
return Object.assign(Object.assign({}, exposedMethods), { mergedStatus: mergedStatusRef, mergedClsPrefix: mergedClsPrefixRef, mergedBordered: mergedBorderedRef, namespace: namespaceRef, uncontrolledValue: uncontrolledValueRef, pendingValue: pendingValueRef, panelInstRef,
|
|
602
611
|
triggerElRef,
|
|
603
|
-
inputInstRef, isMounted: (0, vooks_1.useIsMounted)(), displayTime: singleInputValueRef, displayStartTime: rangeStartInputValueRef, displayEndTime: rangeEndInputValueRef, mergedShow: mergedShowRef, adjustedTo: (0, _utils_1.useAdjustedTo)(props), isRange: isRangeRef, localizedStartPlaceholder: localizedStartPlaceholderRef, localizedEndPlaceholder: localizedEndPlaceholderRef, mergedSize: mergedSizeRef, mergedDisabled: mergedDisabledRef, localizedPlacehoder: localizedPlacehoderRef, isValueInvalid: uniVaidation.isValueInvalidRef, isStartValueInvalid: dualValidation.isStartValueInvalidRef, isEndValueInvalid: dualValidation.isEndValueInvalidRef,
|
|
604
|
-
|
|
612
|
+
inputInstRef, isMounted: (0, vooks_1.useIsMounted)(), displayTime: singleInputValueRef, displayStartTime: rangeStartInputValueRef, displayEndTime: rangeEndInputValueRef, mergedShow: mergedShowRef, adjustedTo: (0, _utils_1.useAdjustedTo)(props), isRange: isRangeRef, localizedStartPlaceholder: localizedStartPlaceholderRef, localizedEndPlaceholder: localizedEndPlaceholderRef, mergedSize: mergedSizeRef, mergedDisabled: mergedDisabledRef, localizedPlacehoder: localizedPlacehoderRef, isValueInvalid: uniVaidation.isValueInvalidRef, isStartValueInvalid: dualValidation.isStartValueInvalidRef, isEndValueInvalid: dualValidation.isEndValueInvalidRef, handleInputKeydown,
|
|
613
|
+
handleClickOutside,
|
|
614
|
+
handleKeydown,
|
|
605
615
|
handleClear,
|
|
606
616
|
handlePanelClear,
|
|
607
617
|
handleTriggerClick,
|
|
@@ -623,7 +633,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
623
633
|
onTabOut: this.handlePanelTabOut,
|
|
624
634
|
onClose: this.handlePanelClose,
|
|
625
635
|
onClear: this.handlePanelClear,
|
|
626
|
-
onKeydown: this.
|
|
636
|
+
onKeydown: this.handleKeydown,
|
|
627
637
|
onConfirm: this.handlePanelConfirm,
|
|
628
638
|
ref: 'panelInstRef',
|
|
629
639
|
value: this.pendingValue,
|
|
@@ -653,6 +663,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
653
663
|
clearable,
|
|
654
664
|
onClear: this.handleClear,
|
|
655
665
|
onClick: this.handleTriggerClick,
|
|
666
|
+
onKeydown: this.handleInputKeydown,
|
|
656
667
|
onActivate: this.handleInputActivate,
|
|
657
668
|
onDeactivate: this.handleInputDeactivate,
|
|
658
669
|
onFocus: this.handleInputFocus,
|
|
@@ -663,7 +674,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
663
674
|
this.mergedDisabled && `${mergedClsPrefix}-date-picker--disabled`,
|
|
664
675
|
this.isRange && `${mergedClsPrefix}-date-picker--range`,
|
|
665
676
|
this.triggerThemeClass
|
|
666
|
-
], style: this.triggerCssVars, onKeydown: this.
|
|
677
|
+
], style: this.triggerCssVars, onKeydown: this.handleKeydown },
|
|
667
678
|
(0, vue_1.h)(vueuc_1.VBinder, null, {
|
|
668
679
|
default: () => [
|
|
669
680
|
(0, vue_1.h)(vueuc_1.VTarget, null, {
|
|
@@ -32,6 +32,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
32
32
|
return `Q ${item.dateObject.quarter}`;
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
+
const { useAsQuickJump } = props;
|
|
35
36
|
const renderItem = (item, i, mergedClsPrefix) => {
|
|
36
37
|
const { mergedIsDateDisabled, handleDateClick, handleQuickMonthClick } = useCalendarRef;
|
|
37
38
|
return ((0, vue_1.h)("div", { "data-n-date": true, key: i, class: [
|
|
@@ -39,10 +40,10 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
39
40
|
{
|
|
40
41
|
[`${mergedClsPrefix}-date-panel-month-calendar__picker-col-item--current`]: item.isCurrent,
|
|
41
42
|
[`${mergedClsPrefix}-date-panel-month-calendar__picker-col-item--selected`]: item.selected,
|
|
42
|
-
[`${mergedClsPrefix}-date-panel-month-calendar__picker-col-item--disabled`]: mergedIsDateDisabled(item.ts)
|
|
43
|
+
[`${mergedClsPrefix}-date-panel-month-calendar__picker-col-item--disabled`]: !useAsQuickJump && mergedIsDateDisabled(item.ts)
|
|
43
44
|
}
|
|
44
45
|
], onClick: () => {
|
|
45
|
-
|
|
46
|
+
useAsQuickJump
|
|
46
47
|
? handleQuickMonthClick(item, (value) => props.onUpdateValue(value, false))
|
|
47
48
|
: handleDateClick(item);
|
|
48
49
|
} }, getRenderContent(item)));
|
|
@@ -295,7 +295,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
295
295
|
namespace: import("vue").ComputedRef<string | undefined>;
|
|
296
296
|
mergedBodyStyle: import("vue").ComputedRef<(string | CSSProperties)[]>;
|
|
297
297
|
handleMaskClick: (e: MouseEvent) => void;
|
|
298
|
-
handleEsc: () => void;
|
|
298
|
+
handleEsc: (e: KeyboardEvent) => void;
|
|
299
299
|
mergedTheme: import("vue").ComputedRef<{
|
|
300
300
|
common: {
|
|
301
301
|
baseColor: string;
|
package/lib/drawer/src/Drawer.js
CHANGED
|
@@ -108,10 +108,10 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
108
108
|
onMaskClick(e);
|
|
109
109
|
}
|
|
110
110
|
const isComposingRef = (0, _utils_1.useIsComposing)();
|
|
111
|
-
function handleEsc() {
|
|
111
|
+
function handleEsc(e) {
|
|
112
112
|
var _a;
|
|
113
113
|
(_a = props.onEsc) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
114
|
-
if (props.closeOnEsc) {
|
|
114
|
+
if (props.show && props.closeOnEsc && (0, _utils_1.eventEffectNotPerformed)(e)) {
|
|
115
115
|
!isComposingRef.value && doUpdateShow(false);
|
|
116
116
|
}
|
|
117
117
|
}
|
|
@@ -36,7 +36,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
36
36
|
onClickoutside: PropType<(e: MouseEvent) => void>;
|
|
37
37
|
onAfterLeave: PropType<() => void>;
|
|
38
38
|
onAfterEnter: PropType<() => void>;
|
|
39
|
-
onEsc: PropType<() => void>;
|
|
39
|
+
onEsc: PropType<(e: KeyboardEvent) => void>;
|
|
40
40
|
}, {
|
|
41
41
|
bodyRef: import("vue").Ref<HTMLElement | null>;
|
|
42
42
|
mergedClsPrefix: import("vue").Ref<string>;
|
|
@@ -222,7 +222,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
222
222
|
onClickoutside: PropType<(e: MouseEvent) => void>;
|
|
223
223
|
onAfterLeave: PropType<() => void>;
|
|
224
224
|
onAfterEnter: PropType<() => void>;
|
|
225
|
-
onEsc: PropType<() => void>;
|
|
225
|
+
onEsc: PropType<(e: KeyboardEvent) => void>;
|
|
226
226
|
}>>, {
|
|
227
227
|
show: boolean | undefined;
|
|
228
228
|
autoFocus: boolean;
|
|
@@ -323,6 +323,7 @@ declare const dropdownProps: {
|
|
|
323
323
|
readonly onClickoutside: PropType<(e: MouseEvent) => void>;
|
|
324
324
|
readonly 'onUpdate:show': PropType<MaybeArray<(value: boolean) => void>>;
|
|
325
325
|
readonly onUpdateShow: PropType<MaybeArray<(value: boolean) => void>>;
|
|
326
|
+
readonly internalDeactivateImmediately: BooleanConstructor;
|
|
326
327
|
readonly internalSyncTargetWithParent: BooleanConstructor;
|
|
327
328
|
readonly internalInheritedEventHandlers: {
|
|
328
329
|
type: PropType<import("../../popover/src/Popover").TriggerEventHandlers[]>;
|
|
@@ -646,6 +647,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
646
647
|
readonly onClickoutside: PropType<(e: MouseEvent) => void>;
|
|
647
648
|
readonly 'onUpdate:show': PropType<MaybeArray<(value: boolean) => void>>;
|
|
648
649
|
readonly onUpdateShow: PropType<MaybeArray<(value: boolean) => void>>;
|
|
650
|
+
readonly internalDeactivateImmediately: BooleanConstructor;
|
|
649
651
|
readonly internalSyncTargetWithParent: BooleanConstructor;
|
|
650
652
|
readonly internalInheritedEventHandlers: {
|
|
651
653
|
type: PropType<import("../../popover/src/Popover").TriggerEventHandlers[]>;
|
|
@@ -1160,6 +1162,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1160
1162
|
readonly onClickoutside: PropType<(e: MouseEvent) => void>;
|
|
1161
1163
|
readonly 'onUpdate:show': PropType<MaybeArray<(value: boolean) => void>>;
|
|
1162
1164
|
readonly onUpdateShow: PropType<MaybeArray<(value: boolean) => void>>;
|
|
1165
|
+
readonly internalDeactivateImmediately: BooleanConstructor;
|
|
1163
1166
|
readonly internalSyncTargetWithParent: BooleanConstructor;
|
|
1164
1167
|
readonly internalInheritedEventHandlers: {
|
|
1165
1168
|
type: PropType<import("../../popover/src/Popover").TriggerEventHandlers[]>;
|
|
@@ -1199,6 +1202,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1199
1202
|
readonly arrowPointToCenter: boolean;
|
|
1200
1203
|
readonly displayDirective: "show" | "if";
|
|
1201
1204
|
readonly keepAliveOnHover: boolean;
|
|
1205
|
+
readonly internalDeactivateImmediately: boolean;
|
|
1202
1206
|
readonly animated: boolean;
|
|
1203
1207
|
readonly internalTrapFocus: boolean;
|
|
1204
1208
|
readonly defaultShow: boolean;
|
|
@@ -92,7 +92,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
92
92
|
const nextValue = externalValue !== null && externalValue !== void 0 ? externalValue : inputValueRef.value;
|
|
93
93
|
if (nextValue) {
|
|
94
94
|
const tags = mergedValueRef.value.slice(0);
|
|
95
|
-
tags.push(nextValue);
|
|
95
|
+
tags.push(props.onCreate(nextValue));
|
|
96
96
|
doChange(tags);
|
|
97
97
|
}
|
|
98
98
|
showInputRef.value = false;
|
package/lib/input/src/Input.d.ts
CHANGED
|
@@ -61,6 +61,7 @@ declare const inputProps: {
|
|
|
61
61
|
type: BooleanConstructor;
|
|
62
62
|
default: undefined;
|
|
63
63
|
};
|
|
64
|
+
allowInput: PropType<(value: string) => boolean>;
|
|
64
65
|
onMousedown: PropType<(e: MouseEvent) => void>;
|
|
65
66
|
onKeydown: PropType<(e: KeyboardEvent) => void>;
|
|
66
67
|
onKeyup: PropType<(e: KeyboardEvent) => void>;
|
|
@@ -330,6 +331,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
330
331
|
type: BooleanConstructor;
|
|
331
332
|
default: undefined;
|
|
332
333
|
};
|
|
334
|
+
allowInput: PropType<(value: string) => boolean>;
|
|
333
335
|
onMousedown: PropType<(e: MouseEvent) => void>;
|
|
334
336
|
onKeydown: PropType<(e: KeyboardEvent) => void>;
|
|
335
337
|
onKeyup: PropType<(e: KeyboardEvent) => void>;
|
|
@@ -587,7 +589,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
587
589
|
handleCompositionEnd: (e: CompositionEvent) => void;
|
|
588
590
|
handleInput: (e: InputEvent | CompositionEvent | Event, index?: 0 | 1, event?: string) => void;
|
|
589
591
|
handleInputBlur: (e: FocusEvent) => void;
|
|
590
|
-
handleInputFocus: (e: FocusEvent) => void;
|
|
592
|
+
handleInputFocus: (e: FocusEvent, index: number) => void;
|
|
591
593
|
handleWrapperBlur: (e: FocusEvent) => void;
|
|
592
594
|
handleWrapperFocus: (e: FocusEvent) => void;
|
|
593
595
|
handleMouseEnter: () => void;
|
|
@@ -598,7 +600,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
598
600
|
handleClear: (e: MouseEvent) => void;
|
|
599
601
|
handlePasswordToggleClick: () => void;
|
|
600
602
|
handlePasswordToggleMousedown: (e: MouseEvent) => void;
|
|
601
|
-
|
|
603
|
+
handleWrapperKeydown: (e: KeyboardEvent) => void;
|
|
602
604
|
handleTextAreaMirrorResize: () => void;
|
|
603
605
|
getTextareaScrollContainer: () => HTMLTextAreaElement | null;
|
|
604
606
|
mergedTheme: import("vue").ComputedRef<{
|
|
@@ -655,7 +657,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
655
657
|
scrollbarWidth: string;
|
|
656
658
|
scrollbarHeight: string;
|
|
657
659
|
scrollbarBorderRadius: string;
|
|
658
|
-
progressRailColor: string;
|
|
660
|
+
progressRailColor: string;
|
|
659
661
|
railColor: string;
|
|
660
662
|
popoverColor: string;
|
|
661
663
|
tableColor: string;
|
|
@@ -887,6 +889,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
887
889
|
type: BooleanConstructor;
|
|
888
890
|
default: undefined;
|
|
889
891
|
};
|
|
892
|
+
allowInput: PropType<(value: string) => boolean>;
|
|
890
893
|
onMousedown: PropType<(e: MouseEvent) => void>;
|
|
891
894
|
onKeydown: PropType<(e: KeyboardEvent) => void>;
|
|
892
895
|
onKeyup: PropType<(e: KeyboardEvent) => void>;
|
package/lib/input/src/Input.js
CHANGED
|
@@ -9,6 +9,7 @@ const seemly_1 = require("seemly");
|
|
|
9
9
|
const vueuc_1 = require("vueuc");
|
|
10
10
|
const evtd_1 = require("evtd");
|
|
11
11
|
const icons_1 = require("../../_internal/icons");
|
|
12
|
+
const use_rtl_1 = __importDefault(require("../../_mixins/use-rtl"));
|
|
12
13
|
const _internal_1 = require("../../_internal");
|
|
13
14
|
const _mixins_1 = require("../../_mixins");
|
|
14
15
|
const _utils_1 = require("../../_utils");
|
|
@@ -17,7 +18,6 @@ const interface_1 = require("./interface");
|
|
|
17
18
|
const utils_1 = require("./utils");
|
|
18
19
|
const WordCount_1 = __importDefault(require("./WordCount"));
|
|
19
20
|
const input_cssr_1 = __importDefault(require("./styles/input.cssr"));
|
|
20
|
-
const use_rtl_1 = __importDefault(require("../../_mixins/use-rtl"));
|
|
21
21
|
const inputProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props), { bordered: {
|
|
22
22
|
type: Boolean,
|
|
23
23
|
default: undefined
|
|
@@ -48,7 +48,7 @@ const inputProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props), {
|
|
|
48
48
|
}, showCount: Boolean, loading: {
|
|
49
49
|
type: Boolean,
|
|
50
50
|
default: undefined
|
|
51
|
-
}, onMousedown: Function, onKeydown: Function, onKeyup: Function, onInput: [Function, Array], onFocus: [Function, Array], onBlur: [Function, Array], onClick: [Function, Array], onChange: [Function, Array], onClear: [Function, Array], status: String, 'onUpdate:value': [Function, Array], onUpdateValue: [Function, Array],
|
|
51
|
+
}, allowInput: Function, onMousedown: Function, onKeydown: Function, onKeyup: Function, onInput: [Function, Array], onFocus: [Function, Array], onBlur: [Function, Array], onClick: [Function, Array], onChange: [Function, Array], onClear: [Function, Array], status: String, 'onUpdate:value': [Function, Array], onUpdateValue: [Function, Array],
|
|
52
52
|
/** private */
|
|
53
53
|
textDecoration: [String, Array], attrSize: {
|
|
54
54
|
type: Number,
|
|
@@ -76,6 +76,8 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
76
76
|
const inputMirrorElRef = (0, vue_1.ref)(null);
|
|
77
77
|
const inputElRef = (0, vue_1.ref)(null);
|
|
78
78
|
const inputEl2Ref = (0, vue_1.ref)(null);
|
|
79
|
+
const currentFocusedInputRef = (0, vue_1.ref)(null);
|
|
80
|
+
const focusedInputCursorControl = (0, utils_1.useCursor)(currentFocusedInputRef);
|
|
79
81
|
const textareaScrollbarInstRef = (0, vue_1.ref)(null);
|
|
80
82
|
// local
|
|
81
83
|
const { localeRef } = (0, _mixins_1.useLocale)('Input');
|
|
@@ -116,8 +118,8 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
116
118
|
const { value: mergedValue } = mergedValueRef;
|
|
117
119
|
const { value: mergedPlaceholder } = mergedPlaceholderRef;
|
|
118
120
|
return (!isComposing &&
|
|
119
|
-
((0, utils_1.
|
|
120
|
-
(Array.isArray(mergedValue) && (0, utils_1.
|
|
121
|
+
((0, utils_1.isEmptyInputValue)(mergedValue) ||
|
|
122
|
+
(Array.isArray(mergedValue) && (0, utils_1.isEmptyInputValue)(mergedValue[0]))) &&
|
|
121
123
|
mergedPlaceholder[0]);
|
|
122
124
|
});
|
|
123
125
|
const showPlaceholder2Ref = (0, vue_1.computed)(() => {
|
|
@@ -126,8 +128,8 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
126
128
|
const { value: mergedPlaceholder } = mergedPlaceholderRef;
|
|
127
129
|
return (!isComposing &&
|
|
128
130
|
mergedPlaceholder[1] &&
|
|
129
|
-
((0, utils_1.
|
|
130
|
-
(Array.isArray(mergedValue) && (0, utils_1.
|
|
131
|
+
((0, utils_1.isEmptyInputValue)(mergedValue) ||
|
|
132
|
+
(Array.isArray(mergedValue) && (0, utils_1.isEmptyInputValue)(mergedValue[1]))));
|
|
131
133
|
});
|
|
132
134
|
// focus
|
|
133
135
|
const mergedFocusRef = (0, vooks_1.useMemo)(() => {
|
|
@@ -325,24 +327,37 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
325
327
|
syncSource = targetValue;
|
|
326
328
|
if (isComposingRef.value)
|
|
327
329
|
return;
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
let { value } = mergedValueRef;
|
|
334
|
-
if (!Array.isArray(value)) {
|
|
335
|
-
value = ['', ''];
|
|
330
|
+
focusedInputCursorControl.recordCursor();
|
|
331
|
+
const isIncomingValueValid = allowInput(targetValue);
|
|
332
|
+
if (isIncomingValueValid) {
|
|
333
|
+
if (!props.pair) {
|
|
334
|
+
event === 'input' ? doUpdateValue(targetValue) : doChange(targetValue);
|
|
336
335
|
}
|
|
337
336
|
else {
|
|
338
|
-
value =
|
|
337
|
+
let { value } = mergedValueRef;
|
|
338
|
+
if (!Array.isArray(value)) {
|
|
339
|
+
value = ['', ''];
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
value = [value[0], value[1]];
|
|
343
|
+
}
|
|
344
|
+
value[index] = targetValue;
|
|
345
|
+
event === 'input' ? doUpdateValue(value) : doChange(value);
|
|
339
346
|
}
|
|
340
|
-
value[index] = changedValue;
|
|
341
|
-
event === 'input' ? doUpdateValue(value) : doChange(value);
|
|
342
347
|
}
|
|
343
348
|
// force update to sync input's view with value
|
|
344
349
|
// if not set, after input, input value won't sync with dom input value
|
|
345
350
|
vm.$forceUpdate();
|
|
351
|
+
if (!isIncomingValueValid) {
|
|
352
|
+
void (0, vue_1.nextTick)(focusedInputCursorControl.restoreCursor);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
function allowInput(value) {
|
|
356
|
+
const { allowInput } = props;
|
|
357
|
+
if (typeof allowInput === 'function') {
|
|
358
|
+
return allowInput(value);
|
|
359
|
+
}
|
|
360
|
+
return true;
|
|
346
361
|
}
|
|
347
362
|
function handleInputBlur(e) {
|
|
348
363
|
doUpdateValueBlur(e);
|
|
@@ -356,13 +371,23 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
356
371
|
activatedRef.value = false;
|
|
357
372
|
}
|
|
358
373
|
dealWithEvent(e, 'blur');
|
|
374
|
+
currentFocusedInputRef.value = null;
|
|
359
375
|
}
|
|
360
|
-
function handleInputFocus(e) {
|
|
376
|
+
function handleInputFocus(e, index) {
|
|
361
377
|
doUpdateValueFocus(e);
|
|
362
378
|
focusedRef.value = true;
|
|
363
379
|
activatedRef.value = true;
|
|
364
380
|
doActivate();
|
|
365
381
|
dealWithEvent(e, 'focus');
|
|
382
|
+
if (index === 0) {
|
|
383
|
+
currentFocusedInputRef.value = inputElRef.value;
|
|
384
|
+
}
|
|
385
|
+
else if (index === 1) {
|
|
386
|
+
currentFocusedInputRef.value = inputEl2Ref.value;
|
|
387
|
+
}
|
|
388
|
+
else if (index === 2) {
|
|
389
|
+
currentFocusedInputRef.value = textareaElRef.value;
|
|
390
|
+
}
|
|
366
391
|
}
|
|
367
392
|
function handleWrapperBlur(e) {
|
|
368
393
|
if (props.passivelyActivated) {
|
|
@@ -482,25 +507,25 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
482
507
|
};
|
|
483
508
|
(0, evtd_1.on)('mouseup', document, hidePassword);
|
|
484
509
|
}
|
|
485
|
-
function
|
|
510
|
+
function handleWrapperKeydown(e) {
|
|
486
511
|
var _a;
|
|
487
512
|
(_a = props.onKeydown) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
488
513
|
switch (e.key) {
|
|
489
514
|
case 'Escape':
|
|
490
|
-
|
|
515
|
+
handleWrapperKeydownEsc();
|
|
491
516
|
break;
|
|
492
517
|
case 'Enter':
|
|
493
|
-
|
|
518
|
+
handleWrapperKeydownEnter(e);
|
|
494
519
|
break;
|
|
495
520
|
}
|
|
496
521
|
}
|
|
497
|
-
function
|
|
522
|
+
function handleWrapperKeydownEnter(e) {
|
|
498
523
|
var _a, _b;
|
|
499
524
|
if (props.passivelyActivated) {
|
|
500
525
|
const { value: focused } = activatedRef;
|
|
501
526
|
if (focused) {
|
|
502
527
|
if (props.internalDeactivateOnEnter) {
|
|
503
|
-
|
|
528
|
+
handleWrapperKeydownEsc();
|
|
504
529
|
}
|
|
505
530
|
return;
|
|
506
531
|
}
|
|
@@ -513,7 +538,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
513
538
|
}
|
|
514
539
|
}
|
|
515
540
|
}
|
|
516
|
-
function
|
|
541
|
+
function handleWrapperKeydownEsc() {
|
|
517
542
|
if (props.passivelyActivated) {
|
|
518
543
|
activatedRef.value = false;
|
|
519
544
|
void (0, vue_1.nextTick)(() => {
|
|
@@ -558,7 +583,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
558
583
|
const { value: wrapperEl } = wrapperElRef;
|
|
559
584
|
if ((wrapperEl === null || wrapperEl === void 0 ? void 0 : wrapperEl.contains(document.activeElement)) &&
|
|
560
585
|
wrapperEl !== document.activeElement) {
|
|
561
|
-
|
|
586
|
+
handleWrapperKeydownEsc();
|
|
562
587
|
}
|
|
563
588
|
}
|
|
564
589
|
function syncMirror(value) {
|
|
@@ -731,7 +756,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
731
756
|
handleClear,
|
|
732
757
|
handlePasswordToggleClick,
|
|
733
758
|
handlePasswordToggleMousedown,
|
|
734
|
-
|
|
759
|
+
handleWrapperKeydown,
|
|
735
760
|
handleTextAreaMirrorResize, getTextareaScrollContainer: () => {
|
|
736
761
|
return textareaElRef.value;
|
|
737
762
|
}, mergedTheme: themeRef, cssVars: inlineThemeDisabled ? undefined : cssVarsRef, themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass, onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender });
|
|
@@ -758,7 +783,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
758
783
|
}
|
|
759
784
|
], style: this.cssVars, tabindex: !this.mergedDisabled && this.passivelyActivated && !this.activated
|
|
760
785
|
? 0
|
|
761
|
-
: undefined, onFocus: this.handleWrapperFocus, onBlur: this.handleWrapperBlur, onClick: this.handleClick, onMousedown: this.handleMouseDown, onMouseenter: this.handleMouseEnter, onMouseleave: this.handleMouseLeave, onCompositionstart: this.handleCompositionStart, onCompositionend: this.handleCompositionEnd, onKeyup: this.onKeyup, onKeydown: this.
|
|
786
|
+
: undefined, onFocus: this.handleWrapperFocus, onBlur: this.handleWrapperBlur, onClick: this.handleClick, onMousedown: this.handleMouseDown, onMouseenter: this.handleMouseEnter, onMouseleave: this.handleMouseLeave, onCompositionstart: this.handleCompositionStart, onCompositionend: this.handleCompositionEnd, onKeyup: this.onKeyup, onKeydown: this.handleWrapperKeydown },
|
|
762
787
|
(0, vue_1.h)("div", { class: `${mergedClsPrefix}-input-wrapper` },
|
|
763
788
|
(0, _utils_1.resolveWrappedSlot)($slots.prefix, (children) => children && ((0, vue_1.h)("div", { class: `${mergedClsPrefix}-input__prefix` }, children))),
|
|
764
789
|
this.type === 'textarea' ? ((0, vue_1.h)(_internal_1.NScrollbar, { ref: "textareaScrollbarInstRef", class: `${mergedClsPrefix}-input__textarea`, container: this.getTextareaScrollContainer, triggerDisplayManually: true, useUnifiedContainer: true }, {
|
|
@@ -780,7 +805,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
780
805
|
this.textDecorationStyle[0],
|
|
781
806
|
(_b = this.inputProps) === null || _b === void 0 ? void 0 : _b.style,
|
|
782
807
|
scrollContainerWidthStyle
|
|
783
|
-
], onBlur: this.handleInputBlur, onFocus: this.handleInputFocus, onInput: this.handleInput, onChange: this.handleChange, onScroll: this.handleTextAreaScroll })),
|
|
808
|
+
], onBlur: this.handleInputBlur, onFocus: (e) => this.handleInputFocus(e, 2), onInput: this.handleInput, onChange: this.handleChange, onScroll: this.handleTextAreaScroll })),
|
|
784
809
|
this.showPlaceholder1 ? ((0, vue_1.h)("div", { class: `${mergedClsPrefix}-input__placeholder`, style: [
|
|
785
810
|
this.placeholderStyle,
|
|
786
811
|
scrollContainerWidthStyle
|
|
@@ -802,7 +827,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
802
827
|
(_b = this.inputProps) === null || _b === void 0 ? void 0 : _b.style
|
|
803
828
|
], tabindex: this.passivelyActivated && !this.activated ? -1 : undefined, placeholder: this.mergedPlaceholder[0], disabled: this.mergedDisabled, maxlength: this.maxlength, minlength: this.minlength, value: Array.isArray(this.mergedValue)
|
|
804
829
|
? this.mergedValue[0]
|
|
805
|
-
: this.mergedValue, readonly: this.readonly, autofocus: this.autofocus, size: this.attrSize, onBlur: this.handleInputBlur, onFocus: this.handleInputFocus, onInput: (e) => this.handleInput(e, 0), onChange: (e) => this.handleChange(e, 0) })),
|
|
830
|
+
: this.mergedValue, readonly: this.readonly, autofocus: this.autofocus, size: this.attrSize, onBlur: this.handleInputBlur, onFocus: (e) => this.handleInputFocus(e, 0), onInput: (e) => this.handleInput(e, 0), onChange: (e) => this.handleChange(e, 0) })),
|
|
806
831
|
this.showPlaceholder1 ? ((0, vue_1.h)("div", { class: `${mergedClsPrefix}-input__placeholder` },
|
|
807
832
|
(0, vue_1.h)("span", null, this.mergedPlaceholder[0]))) : null,
|
|
808
833
|
this.autosize ? ((0, vue_1.h)("div", { class: `${mergedClsPrefix}-input__input-mirror`, key: "mirror", ref: "inputMirrorElRef" }, "\u00A0")) : null)),
|
|
@@ -839,7 +864,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
839
864
|
(0, vue_1.h)("div", { class: `${mergedClsPrefix}-input__input` },
|
|
840
865
|
(0, vue_1.h)("input", { ref: "inputEl2Ref", type: this.type, class: `${mergedClsPrefix}-input__input-el`, tabindex: this.passivelyActivated && !this.activated ? -1 : undefined, placeholder: this.mergedPlaceholder[1], disabled: this.mergedDisabled, maxlength: this.maxlength, minlength: this.minlength, value: Array.isArray(this.mergedValue)
|
|
841
866
|
? this.mergedValue[1]
|
|
842
|
-
: undefined, readonly: this.readonly, style: this.textDecorationStyle[1], onBlur: this.handleInputBlur, onFocus: this.handleInputFocus, onInput: (e) => this.handleInput(e, 1), onChange: (e) => this.handleChange(e, 1) }),
|
|
867
|
+
: undefined, readonly: this.readonly, style: this.textDecorationStyle[1], onBlur: this.handleInputBlur, onFocus: (e) => this.handleInputFocus(e, 1), onInput: (e) => this.handleInput(e, 1), onChange: (e) => this.handleChange(e, 1) }),
|
|
843
868
|
this.showPlaceholder2 ? ((0, vue_1.h)("div", { class: `${mergedClsPrefix}-input__placeholder` },
|
|
844
869
|
(0, vue_1.h)("span", null, this.mergedPlaceholder[1]))) : null),
|
|
845
870
|
(0, _utils_1.resolveWrappedSlot)($slots.suffix, (children) => {
|
package/lib/input/src/utils.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
1
2
|
export declare function len(s: string): number;
|
|
2
|
-
export declare function
|
|
3
|
+
export declare function isEmptyInputValue(value: unknown): boolean;
|
|
4
|
+
export interface UseCursorControl {
|
|
5
|
+
recordCursor: () => void;
|
|
6
|
+
restoreCursor: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function useCursor(inputElRef: Ref<HTMLInputElement | HTMLTextAreaElement | null>): UseCursorControl;
|
package/lib/input/src/utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.useCursor = exports.isEmptyInputValue = exports.len = void 0;
|
|
4
|
+
const vue_1 = require("vue");
|
|
4
5
|
function len(s) {
|
|
5
6
|
let count = 0;
|
|
6
7
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -10,7 +11,62 @@ function len(s) {
|
|
|
10
11
|
return count;
|
|
11
12
|
}
|
|
12
13
|
exports.len = len;
|
|
13
|
-
function
|
|
14
|
-
return
|
|
14
|
+
function isEmptyInputValue(value) {
|
|
15
|
+
return value === '' || value == null;
|
|
15
16
|
}
|
|
16
|
-
exports.
|
|
17
|
+
exports.isEmptyInputValue = isEmptyInputValue;
|
|
18
|
+
function useCursor(inputElRef) {
|
|
19
|
+
const selectionRef = (0, vue_1.ref)(null);
|
|
20
|
+
function recordCursor() {
|
|
21
|
+
const { value: input } = inputElRef;
|
|
22
|
+
if (!input || !input.focus) {
|
|
23
|
+
reset();
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const { selectionStart, selectionEnd, value } = input;
|
|
27
|
+
if (selectionStart == null || selectionEnd == null) {
|
|
28
|
+
reset();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
selectionRef.value = {
|
|
32
|
+
start: selectionStart,
|
|
33
|
+
end: selectionEnd,
|
|
34
|
+
beforeText: value.slice(0, selectionStart),
|
|
35
|
+
afterText: value.slice(selectionEnd)
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function restoreCursor() {
|
|
39
|
+
var _a;
|
|
40
|
+
const { value: selection } = selectionRef;
|
|
41
|
+
const { value: inputEl } = inputElRef;
|
|
42
|
+
if (!selection || !inputEl) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const { value } = inputEl;
|
|
46
|
+
const { start, beforeText, afterText } = selection;
|
|
47
|
+
let startPos = value.length;
|
|
48
|
+
if (value.endsWith(afterText)) {
|
|
49
|
+
startPos = value.length - afterText.length;
|
|
50
|
+
}
|
|
51
|
+
else if (value.startsWith(beforeText)) {
|
|
52
|
+
startPos = beforeText.length;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
const beforeLastChar = beforeText[start - 1];
|
|
56
|
+
const newIndex = value.indexOf(beforeLastChar, start - 1);
|
|
57
|
+
if (newIndex !== -1) {
|
|
58
|
+
startPos = newIndex + 1;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
(_a = inputEl.setSelectionRange) === null || _a === void 0 ? void 0 : _a.call(inputEl, startPos, startPos);
|
|
62
|
+
}
|
|
63
|
+
function reset() {
|
|
64
|
+
selectionRef.value = null;
|
|
65
|
+
}
|
|
66
|
+
(0, vue_1.watch)(inputElRef, reset);
|
|
67
|
+
return {
|
|
68
|
+
recordCursor,
|
|
69
|
+
restoreCursor
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
exports.useCursor = useCursor;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PropType, CSSProperties, ExtractPropTypes } from 'vue';
|
|
2
2
|
import type { ScrollbarProps } from '../../_internal';
|
|
3
|
-
import { ExtractPublicPropTypes } from '../../_utils';
|
|
3
|
+
import type { ExtractPublicPropTypes } from '../../_utils';
|
|
4
4
|
declare const layoutProps: {
|
|
5
5
|
readonly embedded: BooleanConstructor;
|
|
6
6
|
readonly position: {
|
|
@@ -319,6 +319,7 @@ export declare function createLayoutComponent(isContent: boolean): import("vue")
|
|
|
319
319
|
} | undefined;
|
|
320
320
|
};
|
|
321
321
|
}>;
|
|
322
|
+
handleNativeElScroll: (e: Event) => void;
|
|
322
323
|
cssVars: import("vue").ComputedRef<{
|
|
323
324
|
'--n-bezier': string;
|
|
324
325
|
'--n-color': string;
|
|
@@ -718,6 +719,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
718
719
|
} | undefined;
|
|
719
720
|
};
|
|
720
721
|
}>;
|
|
722
|
+
handleNativeElScroll: (e: Event) => void;
|
|
721
723
|
cssVars: import("vue").ComputedRef<{
|
|
722
724
|
'--n-bezier': string;
|
|
723
725
|
'--n-color': string;
|