kui-vue 3.4.9 → 3.5.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/LICENSE +1 -1
- package/components/affix/affix.jsx +42 -42
- package/components/alert/alert.jsx +12 -7
- package/components/avatar/AvatarGroup.jsx +8 -5
- package/components/avatar/avatar.jsx +10 -7
- package/components/avatar/demo/base.md +1 -0
- package/components/avatar/demo/info.md +2 -5
- package/components/backtop/backtop.jsx +39 -32
- package/components/badge/badge.jsx +7 -7
- package/components/badge/demo/color.md +0 -1
- package/components/badge/styles/index.less +0 -4
- package/components/base/{collapse.js → collapse.jsx} +2 -7
- package/components/base/drop.jsx +181 -195
- package/components/base/input.jsx +27 -46
- package/components/base/pop.jsx +21 -17
- package/components/base/transition.js +1 -4
- package/components/breadcrumb/breadcrumb.jsx +6 -3
- package/components/breadcrumb/breadcrumbItem.jsx +4 -2
- package/components/breadcrumb/styles/index.less +1 -1
- package/components/button/button.jsx +95 -56
- package/components/button/buttonGroup.jsx +5 -3
- package/components/button/demo/base.md +3 -3
- package/components/button/demo/block.md +1 -1
- package/components/button/demo/color.md +30 -0
- package/components/button/demo/disabled.md +2 -2
- package/components/button/demo/index.vue +4 -4
- package/components/button/demo/light.md +8 -8
- package/components/button/demo/loading.md +10 -7
- package/components/button/demo/outline.md +22 -0
- package/components/button/demo/size.md +3 -4
- package/components/button/demo/with-icon.md +5 -5
- package/components/button/styles/index.less +269 -44
- package/components/card/card.jsx +4 -2
- package/components/carousel/carousel.jsx +143 -97
- package/components/carousel/carouselItem.jsx +13 -14
- package/components/carousel/styles/index.less +1 -1
- package/components/checkbox/checkbox.jsx +6 -4
- package/components/checkbox/demo/disabled.md +1 -3
- package/components/checkbox/group.jsx +6 -3
- package/components/collapse/collapse.jsx +14 -12
- package/components/collapse/demo/{accrodion.md → accordion.md} +2 -2
- package/components/collapse/demo/index.vue +2 -2
- package/components/collapse/panel.jsx +15 -16
- package/components/collapse/styles/index.less +3 -3
- package/components/colorPicker/alpha.jsx +107 -0
- package/components/colorPicker/colorpicker.jsx +177 -384
- package/components/colorPicker/demo/base.md +1 -3
- package/components/colorPicker/demo/customTriggle.md +34 -0
- package/components/colorPicker/demo/disabled.md +22 -0
- package/components/colorPicker/demo/disabledAlpha.md +20 -0
- package/components/colorPicker/demo/index.vue +11 -5
- package/components/colorPicker/demo/mode.md +16 -18
- package/components/colorPicker/demo/placement.md +25 -0
- package/components/colorPicker/demo/{colors.md → presets.md} +2 -2
- package/components/colorPicker/demo/size.md +14 -13
- package/components/colorPicker/hue.jsx +114 -0
- package/components/colorPicker/index.md +11 -11
- package/components/colorPicker/mode.jsx +176 -0
- package/components/colorPicker/paint.jsx +126 -0
- package/components/colorPicker/presets.jsx +69 -0
- package/components/colorPicker/styles/index.less +144 -46
- package/components/components.js +155 -0
- package/components/const/var.js +3 -0
- package/components/datePicker/datecalendar.jsx +34 -34
- package/components/datePicker/datepicker.jsx +24 -23
- package/components/datePicker/styles/calendar.less +3 -3
- package/components/descriptions/descriptions.jsx +12 -8
- package/components/descriptions/descriptionsItem.jsx +5 -2
- package/components/divider/divider.jsx +4 -2
- package/components/drawer/drawer.jsx +74 -69
- package/components/dropdown/dropdown.jsx +5 -2
- package/components/dropdown/styles/index.less +14 -3
- package/components/empty/empty.jsx +5 -5
- package/components/flex/demo/align.md +1 -1
- package/components/flex/demo/size.md +1 -1
- package/components/flex/flex.jsx +12 -4
- package/components/form/demo/length.md +1 -1
- package/components/form/demo/valid.md +1 -1
- package/components/form/form.jsx +9 -8
- package/components/form/formitem.jsx +14 -11
- package/components/grid/col.jsx +5 -2
- package/components/grid/row.jsx +11 -8
- package/components/icon/demo/base.md +8 -7
- package/components/icon/demo/index.vue +3 -1
- package/components/icon/demo/info.md +1 -38
- package/components/icon/demo/search.vue +16 -15
- package/components/icon/demo/use.md +30 -0
- package/components/icon/icon.jsx +5 -2
- package/components/image/group.jsx +4 -2
- package/components/image/image.jsx +16 -13
- package/components/image/index.js +6 -9
- package/components/image/{instance.js → instance.jsx} +6 -6
- package/components/image/preview.jsx +219 -195
- package/components/image/styles/index.less +1 -1
- package/components/index.js +36 -142
- package/components/input/input.jsx +6 -4
- package/components/input/inputGroup.jsx +16 -14
- package/components/input/textarea.jsx +16 -7
- package/components/inputNumber/demo/base.md +16 -8
- package/components/inputNumber/demo/format.md +7 -19
- package/components/inputNumber/demo/size.md +2 -6
- package/components/inputNumber/inputNumber.jsx +112 -104
- package/components/inputNumber/styles/index.less +47 -11
- package/components/layout/demo/base.md +11 -6
- package/components/layout/demo/layout1.md +82 -63
- package/components/layout/demo/layout2.md +93 -56
- package/components/layout/demo/layout3.md +95 -53
- package/components/layout/demo/layout4.md +97 -45
- package/components/layout/demo/layout5.md +81 -80
- package/components/layout/index.js +0 -4
- package/components/layout/layout.jsx +3 -2
- package/components/loading/demo/info.md +3 -3
- package/components/loading/{index.js → index.jsx} +29 -24
- package/components/locale/index.js +27 -69
- package/components/locale/lang/de.js +1 -1
- package/components/locale/lang/el.js +1 -1
- package/components/locale/lang/en.js +1 -1
- package/components/locale/lang/fr.js +2 -2
- package/components/locale/lang/it.js +1 -1
- package/components/locale/lang/ja.js +1 -1
- package/components/locale/lang/ko.js +1 -1
- package/components/locale/lang/ru.js +1 -1
- package/components/locale/lang/th.js +1 -1
- package/components/locale/lang/ua.js +1 -1
- package/components/locale/lang/vi.js +1 -1
- package/components/locale/lang/zh-CN.js +1 -1
- package/components/locale/lang/zh-TW.js +1 -1
- package/components/menu/demo/index.vue +2 -2
- package/components/menu/menu.jsx +6 -3
- package/components/menu/menudivider.jsx +5 -3
- package/components/menu/menugroup.jsx +4 -2
- package/components/menu/menuitem.jsx +6 -4
- package/components/menu/styles/index.less +88 -20
- package/components/menu/submenu.jsx +11 -28
- package/components/message/group.jsx +31 -28
- package/components/message/index.js +2 -2
- package/components/modal/demo/index.vue +2 -3
- package/components/modal/demo/info.md +5 -4
- package/components/modal/index.js +5 -7
- package/components/modal/modal.jsx +116 -121
- package/components/notice/index.js +2 -1
- package/components/page/page.jsx +15 -12
- package/components/page/styles/index.less +4 -4
- package/components/popconfirm/popconfirm.jsx +9 -8
- package/components/popconfirm/styles/index.less +15 -8
- package/components/poptip/poptip.jsx +7 -6
- package/components/poptip/styles/index.less +10 -4
- package/components/progress/progress.jsx +11 -8
- package/components/radio/button.jsx +4 -1
- package/components/radio/demo/button.md +1 -2
- package/components/radio/group.jsx +10 -19
- package/components/radio/radio.jsx +7 -9
- package/components/radio/styles/index.less +1 -1
- package/components/rate/rate.jsx +7 -10
- package/components/select/demo/base.md +5 -2
- package/components/select/demo/info.md +3 -1
- package/components/select/demo/multiple.md +1 -1
- package/components/select/demo/theme.md +0 -5
- package/components/select/index.md +4 -0
- package/components/select/option.jsx +8 -5
- package/components/select/select.jsx +70 -43
- package/components/select/styles/index.less +7 -13
- package/components/skeleton/demo/items.md +3 -3
- package/components/skeleton/skeleton.jsx +6 -2
- package/components/skeleton/skeletonAvatar.jsx +6 -2
- package/components/skeleton/skeletonButton.jsx +6 -2
- package/components/skeleton/skeletonImage.jsx +6 -2
- package/components/skeleton/skeletonText.jsx +6 -2
- package/components/slider/slider.jsx +15 -11
- package/components/slider/thumb.jsx +9 -8
- package/components/space/demo/align.md +5 -6
- package/components/space/demo/size.md +8 -8
- package/components/space/space.jsx +19 -17
- package/components/spin/demo/container.md +10 -10
- package/components/spin/spin.jsx +5 -2
- package/components/styles/color.less +57 -37
- package/components/styles/sys.less +31 -0
- package/components/styles/var.less +40 -11
- package/components/switch/styles/index.less +2 -2
- package/components/switch/switch.jsx +11 -8
- package/components/table/demo/edit.md +4 -4
- package/components/table/demo/expand.md +1 -2
- package/components/table/demo/filter.md +1 -1
- package/components/table/extend.jsx +172 -157
- package/components/table/styles/index.less +2 -1
- package/components/table/table.jsx +8 -6
- package/components/tabs/demo/base.md +6 -6
- package/components/tabs/demo/card.md +6 -6
- package/components/tabs/demo/centered.md +6 -6
- package/components/tabs/demo/closable.md +3 -3
- package/components/tabs/demo/disabled.md +6 -6
- package/components/tabs/demo/extra.md +6 -6
- package/components/tabs/demo/icon.md +4 -4
- package/components/tabs/demo/index.vue +3 -4
- package/components/tabs/demo/sample.md +6 -6
- package/components/tabs/index.js +2 -2
- package/components/tabs/index.md +1 -1
- package/components/tabs/styles/index.less +47 -9
- package/components/tabs/tabpanel.jsx +28 -0
- package/components/tabs/tabs.jsx +198 -151
- package/components/tag/demo/color.md +0 -1
- package/components/tag/styles/index.less +0 -6
- package/components/tag/tag.jsx +6 -3
- package/components/timeline/timeline.jsx +3 -1
- package/components/timeline/timelineitem.jsx +5 -2
- package/components/tooltip/demo/color.md +2 -3
- package/components/tooltip/styles/index.less +15 -26
- package/components/tooltip/tooltip.jsx +8 -6
- package/components/tree/demo/directory.md +3 -3
- package/components/tree/node.jsx +39 -50
- package/components/tree/styles/index.less +3 -3
- package/components/tree/tree.jsx +18 -28
- package/components/treeselect/styles/index.less +1 -1
- package/components/treeselect/treeselect.jsx +21 -22
- package/components/upload/demo/form.md +1 -1
- package/components/upload/upload.jsx +13 -27
- package/components/{_tool → utils}/animate.js +1 -1
- package/components/{_tool → utils}/clone.js +2 -2
- package/components/utils/color.js +5 -0
- package/components/{_tool/utils.js → utils/element.js} +8 -5
- package/components/utils/number.js +81 -0
- package/components/utils/theme.js +62 -0
- package/components/utils/vue.js +7 -0
- package/dist/k-ui.cjs.js +7 -0
- package/dist/k-ui.css +6 -7
- package/dist/k-ui.d.ts +162 -0
- package/dist/k-ui.esm.js +7 -0
- package/dist/k-ui.umd.js +7 -0
- package/dist/locale/de.js +5 -7
- package/dist/locale/el.js +5 -7
- package/dist/locale/en.js +5 -7
- package/dist/locale/fr.js +5 -7
- package/dist/locale/it.js +5 -7
- package/dist/locale/ja.js +5 -7
- package/dist/locale/ko.js +5 -7
- package/dist/locale/ru.js +5 -7
- package/dist/locale/th.js +5 -7
- package/dist/locale/ua.js +5 -7
- package/dist/locale/vi.js +5 -7
- package/dist/locale/zh-CN.js +7 -0
- package/dist/locale/zh-TW.js +7 -0
- package/package.json +54 -22
- package/readme.md +105 -0
- package/test/i18n@8.x.html +65 -0
- package/types/affix/Affix.d.ts +17 -0
- package/types/alert/Alert.d.ts +18 -0
- package/types/anchor/Anchor.d.ts +16 -0
- package/types/anchor/Link.d.ts +15 -0
- package/types/avatar/Avatar.d.ts +17 -0
- package/types/avatar/AvatarGroup.d.ts +15 -0
- package/types/backtop/BackTop.d.ts +16 -0
- package/types/badge/Badge.d.ts +20 -0
- package/types/base/BasePop.d.ts +24 -0
- package/types/base/Collapse.d.ts +15 -0
- package/types/base/Drop.d.ts +27 -0
- package/types/base/baseInput.d.ts +32 -0
- package/types/base/input.d.ts +32 -0
- package/types/base/pop.d.ts +36 -0
- package/types/breadcrumb/Breadcrumb.d.ts +11 -0
- package/types/breadcrumb/BreadcrumbItem.d.ts +17 -0
- package/types/button/Button.d.ts +27 -0
- package/types/button/ButtonGroup.d.ts +15 -0
- package/types/card/Card.d.ts +16 -0
- package/types/carousel/Carousel.d.ts +22 -0
- package/types/carousel/CarouselItem.d.ts +11 -0
- package/types/checkbox/Checkbox.d.ts +19 -0
- package/types/checkbox/CheckboxGroup.d.ts +20 -0
- package/types/collapse/Collapse.d.ts +15 -0
- package/types/collapse/Panel.d.ts +14 -0
- package/types/colorPicker/Alpha.d.ts +13 -0
- package/types/colorPicker/ColorPicker.d.ts +26 -0
- package/types/colorPicker/Hue.d.ts +13 -0
- package/types/colorPicker/Mode.d.ts +15 -0
- package/types/colorPicker/Paint.d.ts +14 -0
- package/types/colorPicker/Presets.d.ts +15 -0
- package/types/datePicker/DateCalendar.d.ts +27 -0
- package/types/datePicker/DatePicker.d.ts +36 -0
- package/types/descriptions/Descriptions.d.ts +21 -0
- package/types/descriptions/DescriptionsItem.d.ts +18 -0
- package/types/divider/Divider.d.ts +18 -0
- package/types/drawer/Drawer.d.ts +35 -0
- package/types/dropdown/Dropdown.d.ts +21 -0
- package/types/empty/Empty.d.ts +15 -0
- package/types/flex/Flex.d.ts +17 -0
- package/types/form/Form.d.ts +25 -0
- package/types/form/FormItem.d.ts +17 -0
- package/types/grid/Col.d.ts +15 -0
- package/types/grid/Row.d.ts +17 -0
- package/types/icon/Icon.d.ts +17 -0
- package/types/image/ImageGroup.d.ts +11 -0
- package/types/image/ImagePreview.d.ts +24 -0
- package/types/image/KImage.d.ts +21 -0
- package/types/image/imageProps.d.ts +19 -0
- package/types/image/instance.d.ts +19 -0
- package/types/index.d.ts +188 -0
- package/types/input/Input.d.ts +31 -0
- package/types/input/InputGroup.d.ts +17 -0
- package/types/input/TextArea.d.ts +16 -0
- package/types/inputNumber/InputNumber.d.ts +33 -0
- package/types/layout/layout.d.ts +13 -0
- package/types/layout/prop.d.ts +13 -0
- package/types/loading/Loading.d.ts +11 -0
- package/types/menu/Menu.d.ts +21 -0
- package/types/menu/MenuDivider.d.ts +11 -0
- package/types/menu/MenuGroup.d.ts +13 -0
- package/types/menu/MenuItem.d.ts +15 -0
- package/types/menu/SubMenu.d.ts +15 -0
- package/types/menu/show.d.ts +15 -0
- package/types/message/group.d.ts +13 -0
- package/types/message/inner.d.ts +24 -0
- package/types/modal/Modal.d.ts +31 -0
- package/types/page/Page.d.ts +26 -0
- package/types/popconfirm/Popconfirm.d.ts +21 -0
- package/types/poptip/Poptip.d.ts +22 -0
- package/types/progress/Progress.d.ts +33 -0
- package/types/radio/Radio.d.ts +19 -0
- package/types/radio/RadioButton.d.ts +18 -0
- package/types/radio/RadioGroup.d.ts +23 -0
- package/types/rate/Rate.d.ts +26 -0
- package/types/rate/Star.d.ts +22 -0
- package/types/select/Option.d.ts +15 -0
- package/types/select/Select.d.ts +38 -0
- package/types/skeleton/Skeleton.d.ts +21 -0
- package/types/skeleton/SkeletonAvatar.d.ts +19 -0
- package/types/skeleton/SkeletonButton.d.ts +20 -0
- package/types/skeleton/SkeletonImage.d.ts +18 -0
- package/types/skeleton/SkeletonText.d.ts +18 -0
- package/types/slider/Slider.d.ts +29 -0
- package/types/slider/thumb.d.ts +24 -0
- package/types/space/Space.d.ts +18 -0
- package/types/spin/Spin.d.ts +20 -0
- package/types/switch/KSwitch.d.ts +20 -0
- package/types/switch/Switch.d.ts +20 -0
- package/types/table/ExtendTable.d.ts +21 -0
- package/types/table/Table.d.ts +24 -0
- package/types/table/extend.d.ts +21 -0
- package/types/tabs/TabPanel.d.ts +17 -0
- package/types/tabs/Tabs.d.ts +18 -0
- package/types/tag/Tag.d.ts +18 -0
- package/types/timeline/TimeLine.d.ts +14 -0
- package/types/timeline/TimeLineItem.d.ts +16 -0
- package/types/tooltip/Tooltip.d.ts +23 -0
- package/types/tree/Tree.d.ts +28 -0
- package/types/tree/TreeNode.d.ts +17 -0
- package/types/treeselect/TreeSelect.d.ts +41 -0
- package/types/upload/Upload.d.ts +39 -0
- package/README.md +0 -106
- package/components/_tool/directives.js +0 -31
- package/components/_tool/number.js +0 -177
- package/components/bin/index.js +0 -3
- package/components/button/demo/normal.md +0 -41
- package/components/button/demo/solid.md +0 -16
- package/components/colorPicker/canvasHelper.js +0 -274
- package/components/colorPicker/demo/shape.md +0 -36
- package/components/tabs/tabpane.jsx +0 -25
- package/dist/k-ui.js +0 -9
- package/dist/locale/zhCN.js +0 -9
- package/dist/locale/zhTW.js +0 -9
- package/test/i18n@6.x.html +0 -52
- /package/components/{_tool → directives}/outsiteclick.js +0 -0
- /package/components/{_tool → directives}/resize.js +0 -0
- /package/components/{_tool → directives}/scroll.js +0 -0
- /package/components/{_tool → directives}/transfer.js +0 -0
- /package/components/menu/demo/{accrodion.md → accordion.md} +0 -0
- /package/components/modal/demo/{confrim.md → confirm.md} +0 -0
- /package/components/{_tool → utils}/docClick.js +0 -0
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import BaseInput from '../base/input'
|
|
2
2
|
import Icon from '../icon'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
add,
|
|
5
|
+
subtract,
|
|
6
|
+
toFixed,
|
|
7
|
+
isValidNumber,
|
|
8
|
+
isEmpty,
|
|
9
|
+
} from "../utils/number";
|
|
4
10
|
import { ChevronUp } from 'kui-icons'
|
|
5
|
-
|
|
11
|
+
import { withInstall } from '../utils/vue'
|
|
12
|
+
const InputNumber = {
|
|
13
|
+
name: "InputNumber",
|
|
6
14
|
props: {
|
|
7
15
|
value: [Array, Number, String],
|
|
8
16
|
min: { type: Number },
|
|
9
17
|
max: { type: Number },
|
|
10
18
|
disabled: Boolean,
|
|
11
|
-
clearable: Boolean,
|
|
12
19
|
readonly: Boolean,
|
|
13
20
|
formatter: Function,
|
|
14
21
|
parser: Function,
|
|
@@ -17,6 +24,7 @@ export default {
|
|
|
17
24
|
suffix: String,
|
|
18
25
|
prefix: String,
|
|
19
26
|
controls: { type: Boolean, default: true },
|
|
27
|
+
keyboard: { type: Boolean, default: true },
|
|
20
28
|
step: {
|
|
21
29
|
type: Number,
|
|
22
30
|
default: 1,
|
|
@@ -29,118 +37,116 @@ export default {
|
|
|
29
37
|
},
|
|
30
38
|
watch: {
|
|
31
39
|
value(v) {
|
|
32
|
-
|
|
33
|
-
v = this.formatter(v + '')
|
|
34
|
-
}
|
|
35
|
-
this.defaultValue = v //this.getVal(v)
|
|
36
|
-
// console.log('watch', this.defaultValue)
|
|
40
|
+
this.initValue(v)
|
|
37
41
|
}
|
|
38
42
|
},
|
|
39
43
|
data() {
|
|
40
44
|
return {
|
|
41
|
-
|
|
45
|
+
inputValue: '',
|
|
46
|
+
outputValue: '',
|
|
42
47
|
}
|
|
43
48
|
},
|
|
49
|
+
mounted() {
|
|
50
|
+
this.initValue(this.value)
|
|
51
|
+
},
|
|
44
52
|
methods: {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
53
|
+
initValue(v) {
|
|
54
|
+
const { input, output } = this.getValue(v, false);
|
|
55
|
+
|
|
56
|
+
this.inputValue = input;
|
|
57
|
+
this.outputValue = output;
|
|
58
|
+
},
|
|
59
|
+
getValue(v, edge) {
|
|
60
|
+
let input = "";
|
|
61
|
+
let output = "";
|
|
62
|
+
|
|
63
|
+
let { min, max, precision, formatter, parser } = this;
|
|
64
|
+
|
|
65
|
+
if (!isValidNumber(v)) {
|
|
66
|
+
if (isEmpty(v)) {
|
|
67
|
+
input = "";
|
|
68
|
+
output = "";
|
|
69
|
+
} else {
|
|
70
|
+
input = String(v);
|
|
71
|
+
output = formatter ? parser?.(String(v)) || v : String(v);
|
|
63
72
|
}
|
|
64
|
-
if (v === '') return ''
|
|
65
|
-
v = toNumber(v + '')
|
|
66
73
|
} else {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (max !== undefined && v >= max) v = max
|
|
72
|
-
else if (min !== undefined && v <= min) v = min
|
|
73
|
-
|
|
74
|
-
if (precision > 0) {
|
|
75
|
-
v = round(v, precision)
|
|
74
|
+
input = String(v);
|
|
75
|
+
output = v;
|
|
76
76
|
}
|
|
77
|
-
|
|
78
77
|
if (formatter) {
|
|
79
|
-
|
|
78
|
+
const value = parser?.(String(input)) || input;
|
|
79
|
+
input = formatter(String(value));
|
|
80
80
|
}
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
if (edge) {
|
|
82
|
+
if (precision > 0) {
|
|
83
|
+
output = toFixed(output, precision);
|
|
84
|
+
}
|
|
85
|
+
if (output > max) {
|
|
86
|
+
output = max;
|
|
87
|
+
input = formatter?.(String(max)) || max;
|
|
88
|
+
} else if (output < min) {
|
|
89
|
+
output = min;
|
|
90
|
+
input = formatter?.(String(min)) || min;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// console.log(`origin: ${v}`, `input: ${input}`, `output: ${output}`);
|
|
94
|
+
return { input, output };
|
|
83
95
|
},
|
|
84
|
-
|
|
96
|
+
calcValue(e, isUp) {
|
|
97
|
+
let { outputValue } = this
|
|
85
98
|
if (this.disabled) return;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (parser) {
|
|
91
|
-
v = parser(v + '')
|
|
92
|
-
}
|
|
93
|
-
v = up == 1 ? plus(v, step) : minus(v, step)
|
|
94
|
-
|
|
95
|
-
let a = this.getVal(v)
|
|
96
|
-
|
|
97
|
-
// console.log('a', a)
|
|
98
|
-
|
|
99
|
-
this.defaultValue = a + ''
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (parser) {
|
|
103
|
-
a = parser(a)
|
|
99
|
+
const { step } = this;
|
|
100
|
+
if (!isValidNumber(outputValue) || isEmpty(outputValue)) {
|
|
101
|
+
outputValue = 0;
|
|
104
102
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
let value =
|
|
104
|
+
isUp == 1
|
|
105
|
+
? add(String(outputValue), String(step))
|
|
106
|
+
: subtract(String(outputValue), String(step));
|
|
107
|
+
const { input, output } = this.getValue(value, true);
|
|
108
|
+
|
|
109
|
+
this.inputValue = input;
|
|
110
|
+
this.outputValue = output;
|
|
111
|
+
e.preventDefault();
|
|
112
|
+
|
|
113
|
+
this.$emit("input", output);
|
|
114
|
+
this.$emit("change", { target: { value: output } });
|
|
109
115
|
},
|
|
110
|
-
change(x) {
|
|
111
|
-
let { formatter, parser } = this
|
|
112
|
-
let input = x + '', output = x;
|
|
113
116
|
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
onKeyDown(e) {
|
|
118
|
+
if (!this.keyboard) return;
|
|
119
|
+
if (e.key === "ArrowUp") {
|
|
120
|
+
this.calcValue(e, 1);
|
|
121
|
+
} else if (e.key === "ArrowDown") {
|
|
122
|
+
this.calcValue(e, 0);
|
|
116
123
|
}
|
|
117
|
-
// if (formatter) {
|
|
118
|
-
// x = formatter(x + '')
|
|
119
|
-
// }
|
|
120
|
-
this.defaultValue = input
|
|
121
|
-
|
|
122
|
-
// output = toNumber(output + '')
|
|
123
|
-
|
|
124
|
-
this.$emit('input', output)
|
|
125
|
-
this.$emit('change', output)
|
|
126
124
|
},
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
125
|
+
onUpdate(e) {
|
|
126
|
+
const v = e.target.value;
|
|
127
|
+
const { input, output } = this.getValue(v, false);
|
|
128
|
+
// console.log("update", `origin: ${v}`, `input: ${input}`, `output: ${output}`);
|
|
129
|
+
this.inputValue = input;
|
|
130
|
+
e.target.value = input;
|
|
131
|
+
|
|
132
|
+
if (!isValidNumber(output) && !isEmpty(v)) {
|
|
133
|
+
return;
|
|
135
134
|
}
|
|
136
|
-
|
|
137
|
-
if (output
|
|
138
|
-
|
|
135
|
+
const { max, min } = this;
|
|
136
|
+
if ((output && output > max) || (output && output < min)) {
|
|
137
|
+
return;
|
|
139
138
|
}
|
|
139
|
+
this.outputValue = output;
|
|
140
|
+
this.$emit("input", output);
|
|
141
|
+
e.preventDefault?.();
|
|
142
|
+
},
|
|
143
|
+
blurHandle(e) {
|
|
144
|
+
const { input, output } = this.getValue(this.outputValue, true);
|
|
140
145
|
|
|
141
|
-
this
|
|
142
|
-
this
|
|
143
|
-
this.$emit(
|
|
146
|
+
this.inputValue = input;
|
|
147
|
+
this.outputValue = output;
|
|
148
|
+
this.$emit("input", output);
|
|
149
|
+
this.$emit("blur", e);
|
|
144
150
|
}
|
|
145
151
|
},
|
|
146
152
|
provide() {
|
|
@@ -149,33 +155,35 @@ export default {
|
|
|
149
155
|
}
|
|
150
156
|
},
|
|
151
157
|
render() {
|
|
152
|
-
let {
|
|
158
|
+
let { controls } = this
|
|
153
159
|
const props = {
|
|
154
160
|
props: {
|
|
155
161
|
...this.$props,
|
|
156
162
|
inputType: 'input-number',
|
|
157
|
-
value:
|
|
163
|
+
value: this.inputValue
|
|
158
164
|
},
|
|
159
165
|
attrs: { ...this.$attrs },
|
|
160
166
|
on: {
|
|
161
167
|
...this.$listeners,
|
|
162
|
-
'input': (e) => this.
|
|
168
|
+
'input': (e) => this.onUpdate({ target: { value: e } }),
|
|
163
169
|
'blur': (e) => this.blurHandle(e),
|
|
170
|
+
'keydown': (e) => this.onKeyDown(e),
|
|
164
171
|
// 'change': (e) => this.change(e),
|
|
165
172
|
},
|
|
166
173
|
}
|
|
167
|
-
const { suffix } = this
|
|
168
|
-
const suffixNode = this.$slots.suffix || (suffix ? <div class="k-input-number-suffix">{suffix}</div> : null)
|
|
174
|
+
// const { suffix } = this
|
|
175
|
+
// const suffixNode = this.$slots.suffix || (suffix ? <div class="k-input-number-suffix">{suffix}</div> : null)
|
|
169
176
|
return <BaseInput {...props}>
|
|
170
|
-
<template slot="suffix">
|
|
177
|
+
{/* <template slot="suffix">
|
|
171
178
|
{suffixNode}
|
|
172
|
-
</template>
|
|
173
|
-
<template slot='
|
|
179
|
+
</template> */}
|
|
180
|
+
<template slot='controls'>
|
|
174
181
|
{controls ? <div class="k-input-number-controls">
|
|
175
|
-
<span class="k-input-number-control" onClick={() => this.
|
|
176
|
-
<span class="k-input-number-control" onClick={this.
|
|
182
|
+
<span class="k-input-number-control" onClick={(e) => this.calcValue(e, 1)}><Icon type={ChevronUp} /></span>
|
|
183
|
+
<span class="k-input-number-control" onClick={(e) => this.calcValue(e)}><Icon type={ChevronUp} /></span>
|
|
177
184
|
</div> : null}
|
|
178
185
|
</template>
|
|
179
186
|
</BaseInput>
|
|
180
187
|
}
|
|
181
|
-
}
|
|
188
|
+
}
|
|
189
|
+
export default withInstall(InputNumber)
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
position: relative;
|
|
5
5
|
display: inline-flex;
|
|
6
6
|
// flex-shrink: 0;
|
|
7
|
-
max-width: 100%;
|
|
8
|
-
min-width: 0;
|
|
7
|
+
// max-width: 100%;
|
|
8
|
+
// min-width: 0;
|
|
9
9
|
width: 100%;
|
|
10
10
|
color: var(--kui-color-font);
|
|
11
11
|
align-items: center;
|
|
@@ -14,14 +14,16 @@
|
|
|
14
14
|
background-color: var(--kui-color-back);
|
|
15
15
|
transition: all .3s ease-in-out;
|
|
16
16
|
box-sizing: border-box;
|
|
17
|
-
gap:
|
|
18
|
-
padding:
|
|
17
|
+
gap: var(--kui-padding-inline);
|
|
18
|
+
padding-left: var(--kui-padding-inline);;
|
|
19
|
+
overflow: hidden;
|
|
19
20
|
|
|
20
|
-
&:hover {
|
|
21
|
+
&:hover:not(.k-input-number-disabled) {
|
|
21
22
|
border-color: var(--kui-color-main);
|
|
22
23
|
|
|
23
24
|
.k-input-number-controls {
|
|
24
25
|
opacity: 1;
|
|
26
|
+
width: 20px;
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
29
|
|
|
@@ -30,16 +32,24 @@
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
.k-input-number-controls {
|
|
33
|
-
|
|
35
|
+
transition: all .15s ease-in-out;
|
|
36
|
+
user-select: none;
|
|
37
|
+
// position: absolute;
|
|
38
|
+
// right: 0;
|
|
39
|
+
// top: 0;
|
|
40
|
+
// width: 20px;
|
|
34
41
|
display: flex;
|
|
35
42
|
flex-direction: column;
|
|
36
43
|
color: var(--kui-color-icon);
|
|
37
44
|
border-left: 1px solid var(--kui-color-border);
|
|
45
|
+
background-color: var(--kui-color-back);
|
|
38
46
|
font-size: 11px;
|
|
39
47
|
justify-content: center;
|
|
40
48
|
align-items: center;
|
|
41
49
|
height: 30px;
|
|
42
50
|
opacity: 0;
|
|
51
|
+
width: 0;
|
|
52
|
+
overflow: hidden;
|
|
43
53
|
}
|
|
44
54
|
|
|
45
55
|
.k-input-number-control {
|
|
@@ -57,7 +67,7 @@
|
|
|
57
67
|
|
|
58
68
|
&:active {
|
|
59
69
|
color: var(--kui-color-main);
|
|
60
|
-
background-color: var(--kui-color-
|
|
70
|
+
background-color: var(--kui-color-active);
|
|
61
71
|
}
|
|
62
72
|
|
|
63
73
|
&:first-child {
|
|
@@ -112,8 +122,32 @@
|
|
|
112
122
|
}
|
|
113
123
|
}
|
|
114
124
|
|
|
115
|
-
.k-input-number
|
|
116
|
-
|
|
125
|
+
.k-input-number[single] {
|
|
126
|
+
height: 32px;
|
|
127
|
+
width: auto;
|
|
128
|
+
padding-right: var(--kui-padding-inline);
|
|
129
|
+
|
|
130
|
+
&:hover {
|
|
131
|
+
border-color: var(--kui-color-main);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
&:focus {
|
|
135
|
+
outline: none;
|
|
136
|
+
border-color: var(--kui-color-main);
|
|
137
|
+
box-shadow: 0 0 0 2px var(--kui-color-main-90);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.k-input-number-sm[single] {
|
|
142
|
+
height: 24px;
|
|
143
|
+
font-size: 12px;
|
|
144
|
+
padding-right: var(--kui-padding-inline-sm);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.k-input-number-lg[single] {
|
|
148
|
+
height: 40px;
|
|
149
|
+
font-size: 16px;
|
|
150
|
+
padding-right: var(--kui-padding-inline-lg);
|
|
117
151
|
}
|
|
118
152
|
|
|
119
153
|
.k-input-number-suffix,
|
|
@@ -148,8 +182,8 @@
|
|
|
148
182
|
}
|
|
149
183
|
|
|
150
184
|
.k-input-number-sm {
|
|
151
|
-
gap:
|
|
152
|
-
padding:
|
|
185
|
+
gap: var(--kui-padding-inline-sm);
|
|
186
|
+
padding-left: var(--kui-padding-inline-sm);
|
|
153
187
|
|
|
154
188
|
.k-input-number-controls {
|
|
155
189
|
height: 22px;
|
|
@@ -177,6 +211,8 @@
|
|
|
177
211
|
}
|
|
178
212
|
|
|
179
213
|
.k-input-number-lg {
|
|
214
|
+
gap: var(--kui-padding-inline-lg);
|
|
215
|
+
padding-left: var(--kui-padding-inline-lg);
|
|
180
216
|
.k-input-number-controls {
|
|
181
217
|
height: 38px;
|
|
182
218
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
```vue
|
|
7
7
|
<template>
|
|
8
|
-
<
|
|
8
|
+
<Flex class="demo-k-layout" size="small" wrap>
|
|
9
9
|
<Layout>
|
|
10
10
|
<Header>Header</Header>
|
|
11
11
|
<Content>Content</Content>
|
|
@@ -35,21 +35,26 @@
|
|
|
35
35
|
<Footer>Footer</Footer>
|
|
36
36
|
</Layout>
|
|
37
37
|
</Layout>
|
|
38
|
-
</
|
|
38
|
+
</Flex>
|
|
39
39
|
</template>
|
|
40
40
|
<style scoped>
|
|
41
41
|
.demo-k-layout {
|
|
42
42
|
text-align: center;
|
|
43
43
|
}
|
|
44
44
|
.demo-k-layout >.k-layout {
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
color: #fff;
|
|
46
|
+
min-width: calc(50% - 8px);
|
|
47
|
+
border-radius: 10px;
|
|
48
|
+
overflow: hidden;
|
|
47
49
|
}
|
|
48
|
-
.demo-k-layout .k-layout-
|
|
50
|
+
.demo-k-layout .k-layout-header {
|
|
49
51
|
background-color: var(--kui-color-main-60);
|
|
50
52
|
height:64px;
|
|
51
53
|
line-height:64px;
|
|
52
54
|
}
|
|
55
|
+
.demo-k-layout .k-layout-footer {
|
|
56
|
+
background-color: var(--kui-color-main-60);
|
|
57
|
+
}
|
|
53
58
|
.demo-k-layout .k-layout-content {
|
|
54
59
|
min-height: 120px;
|
|
55
60
|
line-height: 120px;
|
|
@@ -58,7 +63,7 @@
|
|
|
58
63
|
.demo-k-layout .k-layout-sider {
|
|
59
64
|
line-height: 120px;
|
|
60
65
|
background-color: var(--kui-color-main-10);
|
|
61
|
-
width:
|
|
66
|
+
width:30%;
|
|
62
67
|
}
|
|
63
68
|
</style>
|
|
64
69
|
```
|
|
@@ -8,45 +8,36 @@
|
|
|
8
8
|
<div class="k-demo-layout">
|
|
9
9
|
<Layout class="layout-back">
|
|
10
10
|
<Header class="demo-header">
|
|
11
|
-
<Row type="flex" align="middle">
|
|
11
|
+
<Row type="flex" align="middle" class="demo-top-nav">
|
|
12
12
|
<Col style="width:194px">
|
|
13
|
-
<
|
|
14
|
-
<Icon :type="LogoKui" size="30" class="logo"/>
|
|
13
|
+
<a class="logo-box" href="">
|
|
14
|
+
<Icon :type="LogoKui" size="30" class="logo" />
|
|
15
15
|
K UIKIT
|
|
16
|
-
</
|
|
16
|
+
</a>
|
|
17
17
|
</Col>
|
|
18
18
|
<Col flex="1">
|
|
19
|
-
<
|
|
19
|
+
<Menu mode="horizontal" :value="['t1']" class="demo-top-menu">
|
|
20
|
+
<MenuItem key="t1">首页</MenuItem>
|
|
21
|
+
<MenuItem key="t2">新闻</MenuItem>
|
|
22
|
+
<MenuItem key="t3">知识库</MenuItem>
|
|
23
|
+
</Menu>
|
|
20
24
|
</Col>
|
|
21
25
|
<Col>
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
</
|
|
25
|
-
<Button type="link">帮助文档</Button>
|
|
26
|
-
<Button :icon="NotificationsOutline" theme="normal"/>
|
|
27
|
-
<Avatar style="background:#3a95ff" :size="40">K</Avatar>
|
|
26
|
+
<Space>
|
|
27
|
+
<Avatar style="background:#3a95ff" :size="20">Q</Avatar>
|
|
28
|
+
</Space>
|
|
28
29
|
</Col>
|
|
29
30
|
</Row>
|
|
30
31
|
</Header>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<Breadcrumb class="nav">
|
|
41
|
-
<BreadcrumbItem>Home</BreadcrumbItem>
|
|
42
|
-
<BreadcrumbItem>List</BreadcrumbItem>
|
|
43
|
-
<BreadcrumbItem>App</BreadcrumbItem>
|
|
44
|
-
</Breadcrumb>
|
|
45
|
-
<Content class="demo-back">
|
|
46
|
-
Content
|
|
47
|
-
</Content>
|
|
48
|
-
</Layout>
|
|
49
|
-
</Layout>
|
|
32
|
+
<Content class="k-demo-main">
|
|
33
|
+
<Breadcrumb class="nav">
|
|
34
|
+
<BreadcrumbItem>Home</BreadcrumbItem>
|
|
35
|
+
<BreadcrumbItem>List</BreadcrumbItem>
|
|
36
|
+
<BreadcrumbItem>App</BreadcrumbItem>
|
|
37
|
+
</Breadcrumb>
|
|
38
|
+
<Content class="demo-back">Conent</Content>
|
|
39
|
+
</Content>
|
|
40
|
+
<Footer style="background:transparent;">KUI ©2025 Created by chuchur</Footer>
|
|
50
41
|
</Layout>
|
|
51
42
|
</div>
|
|
52
43
|
</template>
|
|
@@ -60,41 +51,69 @@ export default{
|
|
|
60
51
|
}
|
|
61
52
|
}
|
|
62
53
|
</script>
|
|
54
|
+
|
|
63
55
|
<style scoped lang="less">
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
56
|
+
.k-demo-layout {
|
|
57
|
+
background: var(--kui-color-back);
|
|
58
|
+
|
|
59
|
+
.demo-header {
|
|
60
|
+
padding: 0 50px 0;
|
|
61
|
+
background-color: var(--kui-color-main-90);
|
|
62
|
+
height: 60px;
|
|
63
|
+
align-items: center;
|
|
64
|
+
display: flex;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.demo-top-nav {
|
|
68
|
+
flex: 1;
|
|
69
|
+
}
|
|
70
|
+
|
|
70
71
|
.logo-box {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
z-index:801;
|
|
72
|
+
position: relative;
|
|
73
|
+
z-index: 801;
|
|
74
74
|
box-sizing: border-box;
|
|
75
|
-
display:flex;
|
|
76
|
-
align-items:center;
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
|
|
78
|
+
.logo {
|
|
79
|
+
margin-right: 8px;
|
|
79
80
|
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.layout-back {
|
|
84
|
+
background-color: #86868625;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.demo-back {
|
|
88
|
+
background-color: var(--kui-color-back);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.demo-top-menu {
|
|
92
|
+
border: none;
|
|
93
|
+
background-color: transparent;
|
|
94
|
+
|
|
95
|
+
.k-menu-item {
|
|
96
|
+
min-height: 60px;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.k-demo-main {
|
|
101
|
+
padding: 0 50px;
|
|
102
|
+
|
|
103
|
+
.nav {
|
|
104
|
+
padding: 16px 0;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.k-layout-content {
|
|
108
|
+
padding: 24px;
|
|
109
|
+
min-height: 300px;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.k-layout-footer {
|
|
114
|
+
text-align: center;
|
|
115
|
+
color: #999;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
</style>
|
|
100
119
|
```
|