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
|
@@ -8,6 +8,7 @@ export declare type FormItemRuleValidatorParams = Parameters<NonNullable<RuleIte
|
|
|
8
8
|
export declare type FormItemRuleValidator = (...args: FormItemRuleValidatorParams) => boolean | Error | Error[] | Promise<void> | undefined;
|
|
9
9
|
export declare type FormItemRuleAsyncValidator = (...args: FormItemRuleValidatorParams) => Promise<void> | undefined;
|
|
10
10
|
export declare type FormItemRule = Omit<RuleItem, 'validator' | 'asyncValidator'> & {
|
|
11
|
+
key?: string;
|
|
11
12
|
trigger?: ValidationTrigger | string | Array<ValidationTrigger | string>;
|
|
12
13
|
validator?: FormItemRuleValidator;
|
|
13
14
|
asyncValidator?: FormItemRuleAsyncValidator;
|
|
@@ -15,10 +16,10 @@ export declare type FormItemRule = Omit<RuleItem, 'validator' | 'asyncValidator'
|
|
|
15
16
|
export interface FormItemValidateOptions {
|
|
16
17
|
trigger?: ValidationTrigger | string;
|
|
17
18
|
callback?: ValidateCallback;
|
|
18
|
-
shouldRuleBeApplied?:
|
|
19
|
+
shouldRuleBeApplied?: ShouldRuleBeApplied;
|
|
19
20
|
options?: ValidateOption;
|
|
20
21
|
}
|
|
21
|
-
export declare type FormItemInternalValidate = (trigger: ValidationTrigger | string | null | undefined, shouldRuleBeApplied?:
|
|
22
|
+
export declare type FormItemInternalValidate = (trigger: ValidationTrigger | string | null | undefined, shouldRuleBeApplied?: ShouldRuleBeApplied, options?: ValidateOption) => Promise<{
|
|
22
23
|
valid: boolean;
|
|
23
24
|
errors?: ValidateError[];
|
|
24
25
|
}>;
|
|
@@ -38,10 +39,10 @@ export declare type LabelAlign = 'left' | 'center' | 'right';
|
|
|
38
39
|
export declare type LabelPlacement = 'left' | 'top';
|
|
39
40
|
export declare type Size = 'small' | 'medium' | 'large';
|
|
40
41
|
export declare type ValidationTrigger = 'input' | 'change' | 'blur' | 'focus';
|
|
41
|
-
export declare type
|
|
42
|
+
export declare type ShouldRuleBeApplied = (rule: FormItemRule) => boolean;
|
|
42
43
|
export declare type ValidateCallback = (errors?: ValidateError[]) => void;
|
|
43
44
|
export declare type FormValidateCallback = (errors?: ValidateError[][]) => void;
|
|
44
|
-
export declare type FormValidate = (
|
|
45
|
+
export declare type FormValidate = (callback?: FormValidateCallback, shouldRuleBeApplied?: ShouldRuleBeApplied) => Promise<void>;
|
|
45
46
|
export declare type FormValidationError = ValidateError[];
|
|
46
47
|
export interface FormInst {
|
|
47
48
|
validate: FormValidate;
|
package/es/image/src/Image.d.ts
CHANGED
|
@@ -1,53 +1,50 @@
|
|
|
1
|
-
import { PropType } from 'vue';
|
|
1
|
+
import { PropType, ImgHTMLAttributes } from 'vue';
|
|
2
2
|
import { ExtractPublicPropTypes } from '../../_utils';
|
|
3
|
-
interface imgProps {
|
|
4
|
-
alt?: string;
|
|
5
|
-
crossorigin?: 'anonymous' | 'use-credentials' | '';
|
|
6
|
-
decoding?: 'async' | 'auto' | 'sync';
|
|
7
|
-
height?: number;
|
|
8
|
-
sizes?: string;
|
|
9
|
-
src?: string;
|
|
10
|
-
srcset?: string;
|
|
11
|
-
usemap?: string;
|
|
12
|
-
width?: number;
|
|
13
|
-
}
|
|
14
3
|
export interface ImageInst {
|
|
15
4
|
click: () => void;
|
|
16
5
|
}
|
|
17
6
|
declare const imageProps: {
|
|
18
7
|
alt: StringConstructor;
|
|
19
8
|
height: PropType<string | number>;
|
|
20
|
-
imgProps: PropType<
|
|
9
|
+
imgProps: PropType<ImgHTMLAttributes>;
|
|
21
10
|
objectFit: {
|
|
22
11
|
type: PropType<"fill" | "none" | "contain" | "cover" | "scale-down">;
|
|
23
12
|
default: string;
|
|
24
13
|
};
|
|
25
14
|
previewSrc: StringConstructor;
|
|
15
|
+
fallbackSrc: StringConstructor;
|
|
26
16
|
width: PropType<string | number>;
|
|
27
17
|
src: StringConstructor;
|
|
28
18
|
showToolbar: {
|
|
29
19
|
type: BooleanConstructor;
|
|
30
20
|
default: boolean;
|
|
31
21
|
};
|
|
22
|
+
previewDisabled: BooleanConstructor;
|
|
23
|
+
loadDescription: StringConstructor;
|
|
32
24
|
onError: PropType<(e: Event) => void>;
|
|
25
|
+
onLoad: PropType<(e: Event) => void>;
|
|
33
26
|
};
|
|
34
27
|
export declare type ImageProps = ExtractPublicPropTypes<typeof imageProps>;
|
|
35
28
|
declare const _default: import("vue").DefineComponent<{
|
|
36
29
|
alt: StringConstructor;
|
|
37
30
|
height: PropType<string | number>;
|
|
38
|
-
imgProps: PropType<
|
|
31
|
+
imgProps: PropType<ImgHTMLAttributes>;
|
|
39
32
|
objectFit: {
|
|
40
33
|
type: PropType<"fill" | "none" | "contain" | "cover" | "scale-down">;
|
|
41
34
|
default: string;
|
|
42
35
|
};
|
|
43
36
|
previewSrc: StringConstructor;
|
|
37
|
+
fallbackSrc: StringConstructor;
|
|
44
38
|
width: PropType<string | number>;
|
|
45
39
|
src: StringConstructor;
|
|
46
40
|
showToolbar: {
|
|
47
41
|
type: BooleanConstructor;
|
|
48
42
|
default: boolean;
|
|
49
43
|
};
|
|
44
|
+
previewDisabled: BooleanConstructor;
|
|
45
|
+
loadDescription: StringConstructor;
|
|
50
46
|
onError: PropType<(e: Event) => void>;
|
|
47
|
+
onLoad: PropType<(e: Event) => void>;
|
|
51
48
|
}, {
|
|
52
49
|
click: () => void;
|
|
53
50
|
mergedClsPrefix: import("vue").Ref<string> | import("vue").ComputedRef<string>;
|
|
@@ -58,30 +55,42 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
58
55
|
toggleShow: () => void;
|
|
59
56
|
} | null>;
|
|
60
57
|
imageRef: import("vue").Ref<HTMLImageElement | null>;
|
|
61
|
-
imgProps: import("vue").Ref<
|
|
58
|
+
imgProps: import("vue").Ref<ImgHTMLAttributes | undefined>;
|
|
59
|
+
showError: import("vue").Ref<boolean>;
|
|
60
|
+
mergedOnError: (e: Event) => void;
|
|
61
|
+
mergedOnLoad: (e: Event) => void;
|
|
62
62
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
63
63
|
alt?: unknown;
|
|
64
64
|
height?: unknown;
|
|
65
65
|
imgProps?: unknown;
|
|
66
66
|
objectFit?: unknown;
|
|
67
67
|
previewSrc?: unknown;
|
|
68
|
+
fallbackSrc?: unknown;
|
|
68
69
|
width?: unknown;
|
|
69
70
|
src?: unknown;
|
|
70
71
|
showToolbar?: unknown;
|
|
72
|
+
previewDisabled?: unknown;
|
|
73
|
+
loadDescription?: unknown;
|
|
71
74
|
onError?: unknown;
|
|
75
|
+
onLoad?: unknown;
|
|
72
76
|
} & {
|
|
73
77
|
objectFit: "fill" | "none" | "contain" | "cover" | "scale-down";
|
|
74
78
|
showToolbar: boolean;
|
|
79
|
+
previewDisabled: boolean;
|
|
75
80
|
} & {
|
|
76
81
|
onError?: ((e: Event) => void) | undefined;
|
|
77
82
|
height?: string | number | undefined;
|
|
78
83
|
width?: string | number | undefined;
|
|
84
|
+
onLoad?: ((e: Event) => void) | undefined;
|
|
79
85
|
alt?: string | undefined;
|
|
80
86
|
src?: string | undefined;
|
|
87
|
+
fallbackSrc?: string | undefined;
|
|
81
88
|
previewSrc?: string | undefined;
|
|
82
|
-
imgProps?:
|
|
89
|
+
imgProps?: ImgHTMLAttributes | undefined;
|
|
90
|
+
loadDescription?: string | undefined;
|
|
83
91
|
}>, {
|
|
84
92
|
objectFit: "fill" | "none" | "contain" | "cover" | "scale-down";
|
|
85
93
|
showToolbar: boolean;
|
|
94
|
+
previewDisabled: boolean;
|
|
86
95
|
}>;
|
|
87
96
|
export default _default;
|
package/es/image/src/Image.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, h, inject, ref, toRef,
|
|
1
|
+
import { defineComponent, h, inject, ref, toRef, watchEffect } from 'vue';
|
|
2
2
|
import NImagePreview from './ImagePreview';
|
|
3
3
|
import { imageGroupInjectionKey } from './ImageGroup';
|
|
4
4
|
import { useConfig } from '../../_mixins';
|
|
@@ -11,10 +11,14 @@ const imageProps = {
|
|
|
11
11
|
default: 'fill'
|
|
12
12
|
},
|
|
13
13
|
previewSrc: String,
|
|
14
|
+
fallbackSrc: String,
|
|
14
15
|
width: [String, Number],
|
|
15
16
|
src: String,
|
|
16
17
|
showToolbar: { type: Boolean, default: true },
|
|
17
|
-
|
|
18
|
+
previewDisabled: Boolean,
|
|
19
|
+
loadDescription: String,
|
|
20
|
+
onError: Function,
|
|
21
|
+
onLoad: Function
|
|
18
22
|
};
|
|
19
23
|
export default defineComponent({
|
|
20
24
|
name: 'Image',
|
|
@@ -22,12 +26,15 @@ export default defineComponent({
|
|
|
22
26
|
inheritAttrs: false,
|
|
23
27
|
setup(props) {
|
|
24
28
|
const imageRef = ref(null);
|
|
29
|
+
const showErrorRef = ref(false);
|
|
25
30
|
const imgPropsRef = toRef(props, 'imgProps');
|
|
26
31
|
const previewInstRef = ref(null);
|
|
27
32
|
const imageGroupHandle = inject(imageGroupInjectionKey, null);
|
|
28
33
|
const { mergedClsPrefixRef } = imageGroupHandle || useConfig(props);
|
|
29
34
|
const exposedMethods = {
|
|
30
35
|
click: () => {
|
|
36
|
+
if (props.previewDisabled || showErrorRef.value)
|
|
37
|
+
return;
|
|
31
38
|
const mergedPreviewSrc = props.previewSrc || props.src;
|
|
32
39
|
if (imageGroupHandle) {
|
|
33
40
|
imageGroupHandle.setPreviewSrc(mergedPreviewSrc);
|
|
@@ -43,17 +50,34 @@ export default defineComponent({
|
|
|
43
50
|
previewInst.toggleShow();
|
|
44
51
|
}
|
|
45
52
|
};
|
|
53
|
+
watchEffect(() => {
|
|
54
|
+
var _a;
|
|
55
|
+
void props.src;
|
|
56
|
+
void ((_a = props.imgProps) === null || _a === void 0 ? void 0 : _a.src);
|
|
57
|
+
showErrorRef.value = false;
|
|
58
|
+
});
|
|
46
59
|
return Object.assign({ mergedClsPrefix: mergedClsPrefixRef, groupId: imageGroupHandle === null || imageGroupHandle === void 0 ? void 0 : imageGroupHandle.groupId, previewInstRef,
|
|
47
|
-
imageRef, imgProps: imgPropsRef
|
|
60
|
+
imageRef, imgProps: imgPropsRef, showError: showErrorRef, mergedOnError: (e) => {
|
|
61
|
+
showErrorRef.value = true;
|
|
62
|
+
const { onError, imgProps: { onError: imgPropsOnError } = {} } = props;
|
|
63
|
+
onError === null || onError === void 0 ? void 0 : onError(e);
|
|
64
|
+
imgPropsOnError === null || imgPropsOnError === void 0 ? void 0 : imgPropsOnError(e);
|
|
65
|
+
}, mergedOnLoad: (e) => {
|
|
66
|
+
const { onLoad, imgProps: { onLoad: imgPropsOnLoad } = {} } = props;
|
|
67
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad(e);
|
|
68
|
+
imgPropsOnLoad === null || imgPropsOnLoad === void 0 ? void 0 : imgPropsOnLoad(e);
|
|
69
|
+
} }, exposedMethods);
|
|
48
70
|
},
|
|
49
71
|
render() {
|
|
50
|
-
const { mergedClsPrefix, imgProps = {} } = this;
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
72
|
+
const { mergedClsPrefix, imgProps = {}, $attrs } = this;
|
|
73
|
+
const imgNode = (h("img", Object.assign({}, imgProps, { class: [this.groupId, imgProps.class], ref: "imageRef", width: this.width || imgProps.width, height: this.height || imgProps.height, src: this.showError ? this.fallbackSrc : this.src || imgProps.src, alt: this.alt || imgProps.alt, "aria-label": this.alt || imgProps.alt, onClick: this.click, onError: this.mergedOnError, onLoad: this.mergedOnLoad, style: [imgProps.style || '', { objectFit: this.objectFit }], "data-error": this.showError, "data-preview-src": this.previewSrc || this.src })));
|
|
74
|
+
return (h("div", Object.assign({}, $attrs, { role: "none", class: [
|
|
75
|
+
$attrs.class,
|
|
76
|
+
`${mergedClsPrefix}-image`,
|
|
77
|
+
(this.previewDisabled || this.showError) &&
|
|
78
|
+
`${mergedClsPrefix}-image--preview-disabled`
|
|
79
|
+
] }), this.groupId ? (imgNode) : (h(NImagePreview, { clsPrefix: mergedClsPrefix, ref: "previewInstRef", showToolbar: this.showToolbar }, {
|
|
80
|
+
default: () => imgNode
|
|
81
|
+
}))));
|
|
58
82
|
}
|
|
59
83
|
});
|
|
@@ -12,7 +12,7 @@ export default defineComponent({
|
|
|
12
12
|
setup(props) {
|
|
13
13
|
let currentSrc;
|
|
14
14
|
const { mergedClsPrefixRef } = useConfig(props);
|
|
15
|
-
const groupId = createId()
|
|
15
|
+
const groupId = `c${createId()}`;
|
|
16
16
|
const vm = getCurrentInstance();
|
|
17
17
|
const setPreviewSrc = (src) => {
|
|
18
18
|
var _a;
|
|
@@ -24,7 +24,7 @@ export default defineComponent({
|
|
|
24
24
|
return;
|
|
25
25
|
const container = vm.proxy.$el.parentElement;
|
|
26
26
|
// use dom api since we can't get the correct order before all children are rendered
|
|
27
|
-
const imgs = container.
|
|
27
|
+
const imgs = container.querySelectorAll(`.${groupId}:not([data-error=true])`);
|
|
28
28
|
if (!imgs.length)
|
|
29
29
|
return;
|
|
30
30
|
const index = Array.from(imgs).findIndex((img) => img.dataset.previewSrc === currentSrc);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c, cB } from '../../../_utils/cssr';
|
|
1
|
+
import { c, cB, cNotM } from '../../../_utils/cssr';
|
|
2
2
|
import fadeInTransition from '../../../_styles/transitions/fade-in.cssr';
|
|
3
3
|
import fadeInzoomInTransiton from '../../../_styles/transitions/fade-in-scale-up.cssr'; // vars:
|
|
4
4
|
// --icon-color
|
|
@@ -54,9 +54,10 @@ export default c([c('body >', [cB('image-container', 'position: fixed;')]), cB('
|
|
|
54
54
|
transition: transform .3s var(--bezier);
|
|
55
55
|
`), cB('image', `
|
|
56
56
|
display: inline-flex;
|
|
57
|
-
cursor: pointer;
|
|
58
57
|
max-height: 100%;
|
|
59
58
|
max-width: 100%;
|
|
60
|
-
`, [
|
|
59
|
+
`, [cNotM('preview-disabled', `
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
`), c('img', `
|
|
61
62
|
border-radius: inherit;
|
|
62
63
|
`)])]);
|
package/es/input/src/Input.js
CHANGED
|
@@ -72,6 +72,7 @@ cE('input, textarea', `
|
|
|
72
72
|
text-decoration-color: var(--text-decoration-color);
|
|
73
73
|
color: var(--text-color);
|
|
74
74
|
caret-color: var(--caret-color);
|
|
75
|
+
background-color: transparent;
|
|
75
76
|
`, [c('&::placeholder', {
|
|
76
77
|
color: '#0000'
|
|
77
78
|
})]), cM('round', [cNotM('textarea', {
|
|
@@ -201,7 +202,7 @@ cM('pair', [cE('input-el, placeholder', {
|
|
|
201
202
|
border: 'var(--border-focus)',
|
|
202
203
|
boxShadow: 'var(--box-shadow-focus)'
|
|
203
204
|
})]), c('&:hover', [cE('state-border', {
|
|
204
|
-
border: 'var(--border-
|
|
205
|
+
border: 'var(--border-hover)'
|
|
205
206
|
})])]), cE('border, state-border', `
|
|
206
207
|
box-sizing: border-box;
|
|
207
208
|
position: absolute;
|
|
@@ -68,9 +68,9 @@ declare const inputNumberProps: {
|
|
|
68
68
|
fontSizeMedium: string;
|
|
69
69
|
fontSizeLarge: string;
|
|
70
70
|
opacityDisabled: string;
|
|
71
|
-
colorOpacitySecondary:
|
|
72
|
-
colorOpacitySecondaryHover:
|
|
73
|
-
colorOpacitySecondaryPressed:
|
|
71
|
+
colorOpacitySecondary: string;
|
|
72
|
+
colorOpacitySecondaryHover: string;
|
|
73
|
+
colorOpacitySecondaryPressed: string;
|
|
74
74
|
colorSecondary: string;
|
|
75
75
|
colorSecondaryHover: string;
|
|
76
76
|
colorSecondaryPressed: string;
|
|
@@ -336,9 +336,9 @@ declare const inputNumberProps: {
|
|
|
336
336
|
fontSizeMedium: string;
|
|
337
337
|
fontSizeLarge: string;
|
|
338
338
|
opacityDisabled: string;
|
|
339
|
-
colorOpacitySecondary:
|
|
340
|
-
colorOpacitySecondaryHover:
|
|
341
|
-
colorOpacitySecondaryPressed:
|
|
339
|
+
colorOpacitySecondary: string;
|
|
340
|
+
colorOpacitySecondaryHover: string;
|
|
341
|
+
colorOpacitySecondaryPressed: string;
|
|
342
342
|
colorSecondary: string;
|
|
343
343
|
colorSecondaryHover: string;
|
|
344
344
|
colorSecondaryPressed: string;
|
|
@@ -604,9 +604,9 @@ declare const inputNumberProps: {
|
|
|
604
604
|
fontSizeMedium: string;
|
|
605
605
|
fontSizeLarge: string;
|
|
606
606
|
opacityDisabled: string;
|
|
607
|
-
colorOpacitySecondary:
|
|
608
|
-
colorOpacitySecondaryHover:
|
|
609
|
-
colorOpacitySecondaryPressed:
|
|
607
|
+
colorOpacitySecondary: string;
|
|
608
|
+
colorOpacitySecondaryHover: string;
|
|
609
|
+
colorOpacitySecondaryPressed: string;
|
|
610
610
|
colorSecondary: string;
|
|
611
611
|
colorSecondaryHover: string;
|
|
612
612
|
colorSecondaryPressed: string;
|
|
@@ -924,9 +924,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
924
924
|
fontSizeMedium: string;
|
|
925
925
|
fontSizeLarge: string;
|
|
926
926
|
opacityDisabled: string;
|
|
927
|
-
colorOpacitySecondary:
|
|
928
|
-
colorOpacitySecondaryHover:
|
|
929
|
-
colorOpacitySecondaryPressed:
|
|
927
|
+
colorOpacitySecondary: string;
|
|
928
|
+
colorOpacitySecondaryHover: string;
|
|
929
|
+
colorOpacitySecondaryPressed: string;
|
|
930
930
|
colorSecondary: string;
|
|
931
931
|
colorSecondaryHover: string;
|
|
932
932
|
colorSecondaryPressed: string;
|
|
@@ -1192,9 +1192,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1192
1192
|
fontSizeMedium: string;
|
|
1193
1193
|
fontSizeLarge: string;
|
|
1194
1194
|
opacityDisabled: string;
|
|
1195
|
-
colorOpacitySecondary:
|
|
1196
|
-
colorOpacitySecondaryHover:
|
|
1197
|
-
colorOpacitySecondaryPressed:
|
|
1195
|
+
colorOpacitySecondary: string;
|
|
1196
|
+
colorOpacitySecondaryHover: string;
|
|
1197
|
+
colorOpacitySecondaryPressed: string;
|
|
1198
1198
|
colorSecondary: string;
|
|
1199
1199
|
colorSecondaryHover: string;
|
|
1200
1200
|
colorSecondaryPressed: string;
|
|
@@ -1460,9 +1460,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1460
1460
|
fontSizeMedium: string;
|
|
1461
1461
|
fontSizeLarge: string;
|
|
1462
1462
|
opacityDisabled: string;
|
|
1463
|
-
colorOpacitySecondary:
|
|
1464
|
-
colorOpacitySecondaryHover:
|
|
1465
|
-
colorOpacitySecondaryPressed:
|
|
1463
|
+
colorOpacitySecondary: string;
|
|
1464
|
+
colorOpacitySecondaryHover: string;
|
|
1465
|
+
colorOpacitySecondaryPressed: string;
|
|
1466
1466
|
colorSecondary: string;
|
|
1467
1467
|
colorSecondaryHover: string;
|
|
1468
1468
|
colorSecondaryPressed: string;
|
|
@@ -1870,9 +1870,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1870
1870
|
fontSizeMedium: string;
|
|
1871
1871
|
fontSizeLarge: string;
|
|
1872
1872
|
opacityDisabled: string;
|
|
1873
|
-
colorOpacitySecondary:
|
|
1874
|
-
colorOpacitySecondaryHover:
|
|
1875
|
-
colorOpacitySecondaryPressed:
|
|
1873
|
+
colorOpacitySecondary: string;
|
|
1874
|
+
colorOpacitySecondaryHover: string;
|
|
1875
|
+
colorOpacitySecondaryPressed: string;
|
|
1876
1876
|
colorSecondary: string;
|
|
1877
1877
|
colorSecondaryHover: string;
|
|
1878
1878
|
colorSecondaryPressed: string;
|
|
@@ -2208,9 +2208,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
2208
2208
|
fontSizeMedium: string;
|
|
2209
2209
|
fontSizeLarge: string;
|
|
2210
2210
|
opacityDisabled: string;
|
|
2211
|
-
colorOpacitySecondary:
|
|
2212
|
-
colorOpacitySecondaryHover:
|
|
2213
|
-
colorOpacitySecondaryPressed:
|
|
2211
|
+
colorOpacitySecondary: string;
|
|
2212
|
+
colorOpacitySecondaryHover: string;
|
|
2213
|
+
colorOpacitySecondaryPressed: string;
|
|
2214
2214
|
colorSecondary: string;
|
|
2215
2215
|
colorSecondaryHover: string;
|
|
2216
2216
|
colorSecondaryPressed: string;
|
|
@@ -2476,9 +2476,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
2476
2476
|
fontSizeMedium: string;
|
|
2477
2477
|
fontSizeLarge: string;
|
|
2478
2478
|
opacityDisabled: string;
|
|
2479
|
-
colorOpacitySecondary:
|
|
2480
|
-
colorOpacitySecondaryHover:
|
|
2481
|
-
colorOpacitySecondaryPressed:
|
|
2479
|
+
colorOpacitySecondary: string;
|
|
2480
|
+
colorOpacitySecondaryHover: string;
|
|
2481
|
+
colorOpacitySecondaryPressed: string;
|
|
2482
2482
|
colorSecondary: string;
|
|
2483
2483
|
colorSecondaryHover: string;
|
|
2484
2484
|
colorSecondaryPressed: string;
|
|
@@ -2744,9 +2744,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
2744
2744
|
fontSizeMedium: string;
|
|
2745
2745
|
fontSizeLarge: string;
|
|
2746
2746
|
opacityDisabled: string;
|
|
2747
|
-
colorOpacitySecondary:
|
|
2748
|
-
colorOpacitySecondaryHover:
|
|
2749
|
-
colorOpacitySecondaryPressed:
|
|
2747
|
+
colorOpacitySecondary: string;
|
|
2748
|
+
colorOpacitySecondaryHover: string;
|
|
2749
|
+
colorOpacitySecondaryPressed: string;
|
|
2750
2750
|
colorSecondary: string;
|
|
2751
2751
|
colorSecondaryHover: string;
|
|
2752
2752
|
colorSecondaryPressed: string;
|
|
@@ -8,7 +8,7 @@ import { NButton } from '../../button';
|
|
|
8
8
|
import { useTheme, useFormItem, useLocale, useConfig } from '../../_mixins';
|
|
9
9
|
import { warn, call } from '../../_utils';
|
|
10
10
|
import { inputNumberLight } from '../styles';
|
|
11
|
-
import { parse, validator, format, parseNumber } from './utils';
|
|
11
|
+
import { parse, validator, format, parseNumber, isWipValue } from './utils';
|
|
12
12
|
import style from './styles/input-number.cssr';
|
|
13
13
|
const inputNumberProps = Object.assign(Object.assign({}, useTheme.props), { placeholder: String, defaultValue: {
|
|
14
14
|
type: Number,
|
|
@@ -113,8 +113,11 @@ export default defineComponent({
|
|
|
113
113
|
nTriggerFormInput();
|
|
114
114
|
nTriggerFormChange();
|
|
115
115
|
};
|
|
116
|
-
const deriveValueFromDisplayedValue = (offset = 0, doUpdateIfValid = true,
|
|
116
|
+
const deriveValueFromDisplayedValue = (offset = 0, doUpdateIfValid = true, isInputing = false) => {
|
|
117
117
|
const { value: displayedValue } = displayedValueRef;
|
|
118
|
+
if (isInputing && isWipValue(displayedValue)) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
118
121
|
const parsedValue = parse(displayedValue);
|
|
119
122
|
if (parsedValue === null) {
|
|
120
123
|
if (doUpdateIfValid)
|
|
@@ -128,13 +131,13 @@ export default defineComponent({
|
|
|
128
131
|
const { value: mergedMax } = mergedMaxRef;
|
|
129
132
|
const { value: mergedMin } = mergedMinRef;
|
|
130
133
|
if (mergedMax !== null && nextValue > mergedMax) {
|
|
131
|
-
if (!doUpdateIfValid ||
|
|
134
|
+
if (!doUpdateIfValid || isInputing)
|
|
132
135
|
return false;
|
|
133
136
|
// if doUpdateIfValid=true, we try to make it a valid value
|
|
134
137
|
nextValue = mergedMax;
|
|
135
138
|
}
|
|
136
139
|
if (mergedMin !== null && nextValue < mergedMin) {
|
|
137
|
-
if (!doUpdateIfValid ||
|
|
140
|
+
if (!doUpdateIfValid || isInputing)
|
|
138
141
|
return false;
|
|
139
142
|
// if doUpdateIfValid=true, we try to make it a valid value
|
|
140
143
|
nextValue = mergedMin;
|
|
@@ -306,6 +309,7 @@ export default defineComponent({
|
|
|
306
309
|
else if (e.code === 'ArrowUp') {
|
|
307
310
|
if (props.keyboard.ArrowUp === false)
|
|
308
311
|
return;
|
|
312
|
+
e.preventDefault();
|
|
309
313
|
const value = deriveValueFromDisplayedValue();
|
|
310
314
|
if (value !== false) {
|
|
311
315
|
doAdd();
|
|
@@ -314,6 +318,7 @@ export default defineComponent({
|
|
|
314
318
|
else if (e.code === 'ArrowDown') {
|
|
315
319
|
if (props.keyboard.ArrowDown === false)
|
|
316
320
|
return;
|
|
321
|
+
e.preventDefault();
|
|
317
322
|
const value = deriveValueFromDisplayedValue();
|
|
318
323
|
if (value !== false) {
|
|
319
324
|
doMinus();
|
|
@@ -323,7 +328,7 @@ export default defineComponent({
|
|
|
323
328
|
function handleUpdateDisplayedValue(value) {
|
|
324
329
|
displayedValueRef.value = value;
|
|
325
330
|
if (props.updateValueOnInput) {
|
|
326
|
-
deriveValueFromDisplayedValue(0, true,
|
|
331
|
+
deriveValueFromDisplayedValue(0, true, true);
|
|
327
332
|
}
|
|
328
333
|
}
|
|
329
334
|
watch(mergedValueRef, () => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare function parse(value: string): number | null;
|
|
2
|
+
export declare function isWipValue(value: string): boolean;
|
|
2
3
|
export declare function validator(value: number | undefined | null): boolean;
|
|
3
4
|
export declare function format(value: number | undefined | null): string;
|
|
4
5
|
export declare function parseNumber(number: number | null | undefined | string): number | null;
|
|
@@ -8,6 +8,10 @@ export function parse(value) {
|
|
|
8
8
|
}
|
|
9
9
|
return Number(value);
|
|
10
10
|
}
|
|
11
|
+
// can be parsed to number but shouldn't be applied when inputing
|
|
12
|
+
export function isWipValue(value) {
|
|
13
|
+
return /^\d+\.$/.test(value) || /^\.\d+$/.test(value);
|
|
14
|
+
}
|
|
11
15
|
// string => boolean (expected, not implemented)
|
|
12
16
|
// number => boolean (legacy)
|
|
13
17
|
export function validator(value) {
|
|
@@ -20,9 +20,9 @@ declare const inputNumberLight: import("../../_mixins").Theme<"InputNumber", {
|
|
|
20
20
|
fontSizeMedium: string;
|
|
21
21
|
fontSizeLarge: string;
|
|
22
22
|
opacityDisabled: string;
|
|
23
|
-
colorOpacitySecondary:
|
|
24
|
-
colorOpacitySecondaryHover:
|
|
25
|
-
colorOpacitySecondaryPressed:
|
|
23
|
+
colorOpacitySecondary: string;
|
|
24
|
+
colorOpacitySecondaryHover: string;
|
|
25
|
+
colorOpacitySecondaryPressed: string;
|
|
26
26
|
colorSecondary: string;
|
|
27
27
|
colorSecondaryHover: string;
|
|
28
28
|
colorSecondaryPressed: string;
|
|
@@ -22,6 +22,11 @@ const deDE = {
|
|
|
22
22
|
yearFormat: 'yyyy',
|
|
23
23
|
monthFormat: 'MMM',
|
|
24
24
|
dayFormat: 'eeeeee',
|
|
25
|
+
yearTypeFormat: 'yyyy',
|
|
26
|
+
monthTypeFormat: 'MM-yyyy',
|
|
27
|
+
dateFormat: 'dd-MM-yyyy',
|
|
28
|
+
dateTimeFormat: 'dd-MM-yyyy HH:mm:ss',
|
|
29
|
+
quarterFormat: 'yyyy-qqq',
|
|
25
30
|
clear: 'Löschen',
|
|
26
31
|
now: 'Jetzt',
|
|
27
32
|
confirm: 'Bestätigen',
|
|
@@ -30,6 +35,9 @@ const deDE = {
|
|
|
30
35
|
datePlaceholder: 'Datum auswählen',
|
|
31
36
|
datetimePlaceholder: 'Datum und Uhrzeit auswählen',
|
|
32
37
|
monthPlaceholder: 'Monat auswählen',
|
|
38
|
+
// FIXME: translation needed
|
|
39
|
+
yearPlaceholder: 'Select Year',
|
|
40
|
+
quarterPlaceholder: 'Select Quarter',
|
|
33
41
|
startDatePlaceholder: 'Anfangsdatum',
|
|
34
42
|
endDatePlaceholder: 'Enddatum',
|
|
35
43
|
startDatetimePlaceholder: 'Anfangsdatum und Uhrzeit',
|
|
@@ -22,6 +22,11 @@ declare const enUS: {
|
|
|
22
22
|
yearFormat: string;
|
|
23
23
|
monthFormat: string;
|
|
24
24
|
dayFormat: string;
|
|
25
|
+
yearTypeFormat: string;
|
|
26
|
+
monthTypeFormat: string;
|
|
27
|
+
dateFormat: string;
|
|
28
|
+
dateTimeFormat: string;
|
|
29
|
+
quarterFormat: string;
|
|
25
30
|
clear: string;
|
|
26
31
|
now: string;
|
|
27
32
|
confirm: string;
|
|
@@ -30,6 +35,8 @@ declare const enUS: {
|
|
|
30
35
|
datePlaceholder: string;
|
|
31
36
|
datetimePlaceholder: string;
|
|
32
37
|
monthPlaceholder: string;
|
|
38
|
+
yearPlaceholder: string;
|
|
39
|
+
quarterPlaceholder: string;
|
|
33
40
|
startDatePlaceholder: string;
|
|
34
41
|
endDatePlaceholder: string;
|
|
35
42
|
startDatetimePlaceholder: string;
|
|
@@ -12,7 +12,7 @@ const enUS = {
|
|
|
12
12
|
Cascader: {
|
|
13
13
|
placeholder: 'Please Select',
|
|
14
14
|
loading: 'Loading',
|
|
15
|
-
loadingRequiredMessage: (label) => `Please load all ${label}'s
|
|
15
|
+
loadingRequiredMessage: (label) => `Please load all ${label}'s descendants before checking it.`
|
|
16
16
|
},
|
|
17
17
|
Time: {
|
|
18
18
|
dateFormat: 'yyyy-MM-dd',
|
|
@@ -22,6 +22,11 @@ const enUS = {
|
|
|
22
22
|
yearFormat: 'yyyy',
|
|
23
23
|
monthFormat: 'MMM',
|
|
24
24
|
dayFormat: 'eeeeee',
|
|
25
|
+
yearTypeFormat: 'yyyy',
|
|
26
|
+
monthTypeFormat: 'yyyy-MM',
|
|
27
|
+
dateFormat: 'yyyy-MM-dd',
|
|
28
|
+
dateTimeFormat: 'yyyy-MM-dd HH:mm:ss',
|
|
29
|
+
quarterFormat: 'yyyy-qqq',
|
|
25
30
|
clear: 'Clear',
|
|
26
31
|
now: 'Now',
|
|
27
32
|
confirm: 'Confirm',
|
|
@@ -30,6 +35,8 @@ const enUS = {
|
|
|
30
35
|
datePlaceholder: 'Select Date',
|
|
31
36
|
datetimePlaceholder: 'Select Date and Time',
|
|
32
37
|
monthPlaceholder: 'Select Month',
|
|
38
|
+
yearPlaceholder: 'Select Year',
|
|
39
|
+
quarterPlaceholder: 'Select Quarter',
|
|
33
40
|
startDatePlaceholder: 'Start Date',
|
|
34
41
|
endDatePlaceholder: 'End Date',
|
|
35
42
|
startDatetimePlaceholder: 'Start Date and Time',
|