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,147 +1,193 @@
|
|
|
1
1
|
import Icon from "../icon";
|
|
2
|
-
import resize from
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import resize from "../directives/resize";
|
|
3
|
+
import { ChevronUp } from "kui-icons";
|
|
4
|
+
import { withInstall } from '../utils/vue'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
name:
|
|
6
|
+
const Carousel = {
|
|
7
|
+
name: "Carousel",
|
|
8
8
|
directives: { resize },
|
|
9
9
|
props: {
|
|
10
10
|
value: { type: Number, default: 0 },
|
|
11
|
-
loop: Boolean,
|
|
11
|
+
loop: { type: Boolean, default: true },
|
|
12
12
|
autoplay: Boolean,
|
|
13
13
|
delay: { type: Number, default: 3000 },
|
|
14
14
|
vertical: Boolean,
|
|
15
|
-
dots: { type: Boolean, default: true }
|
|
15
|
+
dots: { type: Boolean, default: true },
|
|
16
|
+
},
|
|
17
|
+
provide() {
|
|
18
|
+
return {
|
|
19
|
+
Carousel: this,
|
|
20
|
+
};
|
|
16
21
|
},
|
|
17
22
|
data() {
|
|
18
23
|
return {
|
|
19
24
|
currentIndex: this.value,
|
|
20
|
-
|
|
25
|
+
posIndex: this.loop ? this.value + 1 : this.value,
|
|
26
|
+
autoTimer: null,
|
|
21
27
|
width: 0,
|
|
22
28
|
height: 0,
|
|
23
29
|
animate: this.value > 0 ? false : true,
|
|
24
|
-
resizing: false,
|
|
25
30
|
playing: false,
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
provide() {
|
|
29
|
-
return {
|
|
30
|
-
Carousel: this
|
|
31
|
-
}
|
|
31
|
+
};
|
|
32
32
|
},
|
|
33
33
|
watch: {
|
|
34
|
-
value(
|
|
35
|
-
this.currentIndex =
|
|
34
|
+
value(nv) {
|
|
35
|
+
this.currentIndex = nv;
|
|
36
36
|
},
|
|
37
37
|
},
|
|
38
|
+
mounted() {
|
|
39
|
+
this.$nextTick(() => {
|
|
40
|
+
this.resize();
|
|
41
|
+
this.autoToPlay();
|
|
42
|
+
});
|
|
43
|
+
},
|
|
38
44
|
beforeDestroy() {
|
|
39
|
-
clearInterval(this.
|
|
45
|
+
clearInterval(this.autoTimer);
|
|
40
46
|
},
|
|
41
47
|
methods: {
|
|
42
48
|
next() {
|
|
43
|
-
this.
|
|
49
|
+
this.toSwitch("right");
|
|
44
50
|
},
|
|
45
51
|
prev() {
|
|
46
|
-
this.
|
|
52
|
+
this.toSwitch("left");
|
|
53
|
+
},
|
|
54
|
+
goTo(index) {
|
|
55
|
+
clearInterval(this.autoTimer);
|
|
56
|
+
this.animate = true;
|
|
57
|
+
this.currentIndex = index;
|
|
58
|
+
this.posIndex = this.loop ? index + 1 : index;
|
|
59
|
+
this.$emit("input", index);
|
|
60
|
+
this.autoToPlay();
|
|
47
61
|
},
|
|
48
62
|
autoToPlay() {
|
|
49
|
-
|
|
50
|
-
this.
|
|
51
|
-
|
|
63
|
+
if (!this.autoplay) return;
|
|
64
|
+
clearInterval(this.autoTimer);
|
|
65
|
+
this.autoTimer = setInterval(() => {
|
|
66
|
+
this.change("right");
|
|
52
67
|
}, parseInt(this.delay));
|
|
53
68
|
},
|
|
54
|
-
|
|
69
|
+
toSwitch(type) {
|
|
70
|
+
clearInterval(this.autoTimer);
|
|
55
71
|
if (this.playing) return;
|
|
56
|
-
this.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
this.playing = true;
|
|
73
|
+
this.change(type);
|
|
74
|
+
},
|
|
75
|
+
change(type) {
|
|
76
|
+
this.animate = true;
|
|
77
|
+
|
|
78
|
+
const children = this.$slots.default || [];
|
|
79
|
+
const total = this.loop ? children.length + 2 : children.length;
|
|
80
|
+
let index = this.posIndex;
|
|
81
|
+
let nextCurrent = this.currentIndex;
|
|
82
|
+
|
|
83
|
+
if (type === "right") {
|
|
84
|
+
index = (index + 1) % total;
|
|
85
|
+
if (this.loop) nextCurrent = (nextCurrent + 1) % children.length;
|
|
86
|
+
else nextCurrent = index;
|
|
87
|
+
} else if (type === "left") {
|
|
88
|
+
index = (index - 1 + total) % total;
|
|
89
|
+
if (this.loop) nextCurrent = (nextCurrent - 1 + children.length) % children.length;
|
|
90
|
+
else nextCurrent = index;
|
|
72
91
|
}
|
|
73
|
-
|
|
74
|
-
this.
|
|
92
|
+
|
|
93
|
+
this.posIndex = index;
|
|
94
|
+
this.currentIndex = nextCurrent;
|
|
95
|
+
this.$emit("input", this.currentIndex);
|
|
96
|
+
|
|
75
97
|
setTimeout(() => {
|
|
76
|
-
this.playing = false
|
|
77
|
-
|
|
98
|
+
this.playing = false;
|
|
99
|
+
if (this.loop) {
|
|
100
|
+
const count = children.length + 2;
|
|
101
|
+
if (this.posIndex === count - 1) {
|
|
102
|
+
this.animate = false;
|
|
103
|
+
this.posIndex = 1;
|
|
104
|
+
}
|
|
105
|
+
if (this.posIndex === 0) {
|
|
106
|
+
this.animate = false;
|
|
107
|
+
this.posIndex = count - 2;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}, 501);
|
|
111
|
+
this.autoToPlay();
|
|
78
112
|
},
|
|
79
113
|
resize() {
|
|
80
|
-
this.animate = false
|
|
81
|
-
|
|
82
|
-
this.width =
|
|
83
|
-
this.height =
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
mounted() {
|
|
88
|
-
this.$nextTick(e => {
|
|
89
|
-
this.resize()
|
|
90
|
-
this.autoplay && this.autoToPlay()
|
|
91
|
-
})
|
|
114
|
+
this.animate = false;
|
|
115
|
+
const el = this.$el;
|
|
116
|
+
this.width = el.offsetWidth;
|
|
117
|
+
this.height = el.offsetHeight;
|
|
118
|
+
},
|
|
92
119
|
},
|
|
93
120
|
render() {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
121
|
+
const children = this.$slots.default || [];
|
|
122
|
+
const { vertical } = this;
|
|
123
|
+
const first = children[0];
|
|
124
|
+
const last = children[children.length - 1];
|
|
125
|
+
const newChildren = this.loop ? [last, ...children, first] : children;
|
|
126
|
+
let index = Math.min(children.length - 1, this.currentIndex);
|
|
127
|
+
index = Math.max(0, index);
|
|
101
128
|
|
|
102
|
-
const
|
|
129
|
+
const classes = [
|
|
130
|
+
"k-carousel",
|
|
131
|
+
{
|
|
132
|
+
"k-carousel-vertical": vertical,
|
|
133
|
+
},
|
|
134
|
+
];
|
|
135
|
+
|
|
136
|
+
const dotsNode = this.dots ? (
|
|
103
137
|
<ul class="k-carousel-dots">
|
|
104
|
-
{
|
|
138
|
+
{children.map((x, i) => (
|
|
139
|
+
<li
|
|
140
|
+
class={{ "k-carousel-dots-active": index == i }}
|
|
141
|
+
onClick={() => this.goTo(i)}
|
|
142
|
+
></li>
|
|
143
|
+
))}
|
|
105
144
|
</ul>
|
|
106
|
-
)
|
|
145
|
+
) : null;
|
|
107
146
|
|
|
108
|
-
let offsetX = 0,
|
|
147
|
+
let offsetX = 0,
|
|
148
|
+
offsetY = 0;
|
|
109
149
|
if (!vertical) {
|
|
110
|
-
offsetX =
|
|
150
|
+
offsetX = this.posIndex * this.width;
|
|
111
151
|
} else {
|
|
112
|
-
offsetY =
|
|
152
|
+
offsetY = this.posIndex * this.height;
|
|
113
153
|
}
|
|
114
|
-
|
|
115
|
-
|
|
154
|
+
|
|
155
|
+
const wrapperCls = {
|
|
156
|
+
class: "k-carousel-wrapper",
|
|
116
157
|
style: {
|
|
117
|
-
transform: `
|
|
118
|
-
width: !vertical ?
|
|
119
|
-
height: vertical ?
|
|
120
|
-
transitionDuration: !this.animate ?
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
158
|
+
transform: `translate3d(-${offsetX}px,-${offsetY}px,0)`,
|
|
159
|
+
width: !vertical ? newChildren.length * this.width + "px" : "",
|
|
160
|
+
height: vertical ? newChildren.length * this.height + "px" : "",
|
|
161
|
+
transitionDuration: !this.animate ? "0s" : "",
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const arrowLeft = (
|
|
166
|
+
<span class="k-carousel-arrow-left" onClick={() => this.toSwitch("left")}>
|
|
167
|
+
<Icon type={ChevronUp} />
|
|
168
|
+
</span>
|
|
169
|
+
);
|
|
170
|
+
const arrowRight = (
|
|
171
|
+
<span class="k-carousel-arrow-right" onClick={() => this.toSwitch("right")}>
|
|
172
|
+
<Icon type={ChevronUp} />
|
|
173
|
+
</span>
|
|
174
|
+
);
|
|
175
|
+
|
|
129
176
|
const props = {
|
|
130
177
|
class: classes,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
178
|
+
onMouseenter: () => clearInterval(this.autoTimer),
|
|
179
|
+
onMouseleave: () => {
|
|
180
|
+
this.autoplay && this.autoToPlay();
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
|
|
137
184
|
return (
|
|
138
185
|
<div v-resize={this.resize} {...props}>
|
|
139
|
-
<div {...
|
|
140
|
-
{childs}
|
|
141
|
-
</div>
|
|
186
|
+
<div {...wrapperCls}>{newChildren}</div>
|
|
142
187
|
{!vertical ? [arrowLeft, arrowRight] : null}
|
|
143
|
-
{
|
|
144
|
-
</div
|
|
145
|
-
)
|
|
146
|
-
}
|
|
147
|
-
}
|
|
188
|
+
{dotsNode}
|
|
189
|
+
</div>
|
|
190
|
+
);
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
export default withInstall(Carousel);
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
},
|
|
1
|
+
import { withInstall } from '../utils/vue'
|
|
2
|
+
const CarouselItem = {
|
|
3
|
+
name: "CarouselItem",
|
|
4
|
+
inject: { "Carousel": {} },
|
|
6
5
|
render() {
|
|
7
|
-
let width, height
|
|
8
|
-
|
|
9
|
-
width
|
|
10
|
-
height
|
|
11
|
-
}
|
|
12
|
-
let styles = { width: `${width}px`, height: `${height}px` }
|
|
6
|
+
let { width = 0, height = 0 } = this.Carousel;
|
|
7
|
+
const styles = {
|
|
8
|
+
width: width + "px",
|
|
9
|
+
height: height + "px",
|
|
10
|
+
};
|
|
13
11
|
return (
|
|
14
12
|
<div class="k-carousel-item" style={styles}>
|
|
15
13
|
{this.$slots.default}
|
|
16
14
|
</div>
|
|
17
|
-
)
|
|
18
|
-
}
|
|
19
|
-
}
|
|
15
|
+
);
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export default withInstall(CarouselItem);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { hasProp } from '../
|
|
1
|
+
import { hasProp } from '../utils/element'
|
|
2
2
|
import Icon from '../icon'
|
|
3
3
|
import { Checkmark } from 'kui-icons'
|
|
4
|
-
|
|
4
|
+
import { withInstall } from '../utils/vue'
|
|
5
|
+
const Checkbox = {
|
|
5
6
|
name: "Checkbox",
|
|
6
7
|
props: {
|
|
7
8
|
value: [String, Number, Boolean],
|
|
@@ -58,7 +59,7 @@ export default {
|
|
|
58
59
|
checked = isChecked
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
|
-
const
|
|
62
|
+
const classes = ["k-checkbox", {
|
|
62
63
|
["k-checkbox-disabled"]: disabled,
|
|
63
64
|
["k-checkbox-checked"]: checked && !indeterminate,
|
|
64
65
|
["k-checkbox-indeterminate"]: indeterminate,
|
|
@@ -70,7 +71,7 @@ export default {
|
|
|
70
71
|
let inner = checked ? <Icon type={Checkmark} strokeWidth={60} /> : null
|
|
71
72
|
const labelNode = label || $slots.default
|
|
72
73
|
return (
|
|
73
|
-
<label class={
|
|
74
|
+
<label class={classes} onClick={e => e.stopPropagation()}>
|
|
74
75
|
<span class="k-checkbox-symbol">
|
|
75
76
|
<input type="checkbox" class="k-checkbox-input" checked={checked} disabled={disabled} onChange={change} />
|
|
76
77
|
<span class="k-checkbox-inner">{inner}</span>
|
|
@@ -80,3 +81,4 @@ export default {
|
|
|
80
81
|
)
|
|
81
82
|
}
|
|
82
83
|
}
|
|
84
|
+
export default withInstall(Checkbox);
|
|
@@ -5,14 +5,12 @@
|
|
|
5
5
|
|
|
6
6
|
```vue
|
|
7
7
|
<template>
|
|
8
|
-
<Space>
|
|
8
|
+
<Space wrap vertical>
|
|
9
9
|
<Checkbox disabled>disabled</Checkbox>
|
|
10
10
|
<Checkbox disabled
|
|
11
11
|
:checked="true">disabled</Checkbox>
|
|
12
12
|
<Checkbox indeterminate
|
|
13
13
|
disabled>indeterminate</Checkbox>
|
|
14
|
-
<br />
|
|
15
|
-
<br />
|
|
16
14
|
<Checkbox :disabled="disabled"
|
|
17
15
|
v-model="checked">Checkbox</Checkbox>
|
|
18
16
|
<Button @click="checked=!checked"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Checkbox from './checkbox';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { getChildren } from '../utils/element'
|
|
3
|
+
import { withInstall } from '../utils/vue'
|
|
4
|
+
const CheckboxGroup = {
|
|
4
5
|
name: "CheckboxGroup",
|
|
5
6
|
props: {
|
|
6
7
|
disabled: Boolean,
|
|
@@ -39,7 +40,7 @@ export default {
|
|
|
39
40
|
},
|
|
40
41
|
render() {
|
|
41
42
|
const { options, $slots, direction, size } = this
|
|
42
|
-
let childs =
|
|
43
|
+
let childs = getChildren($slots.default)
|
|
43
44
|
if (options && options.length) {
|
|
44
45
|
childs = options.map(option => (
|
|
45
46
|
<Checkbox
|
|
@@ -54,3 +55,5 @@ export default {
|
|
|
54
55
|
return (<div class={['k-checkbox-group', { 'k-checkbox-group-vertical': direction == 'vertical' }]}>{childs}</div>)
|
|
55
56
|
}
|
|
56
57
|
}
|
|
58
|
+
|
|
59
|
+
export default withInstall(CheckboxGroup)
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import cloneVNode from '../
|
|
3
|
-
|
|
1
|
+
import { getChildren, hasProp } from '../utils/element'
|
|
2
|
+
import cloneVNode from '../utils/clone'
|
|
3
|
+
import { withInstall } from '../utils/vue'
|
|
4
|
+
const Collapse = {
|
|
4
5
|
name: 'Collapse',
|
|
5
6
|
props: {
|
|
6
7
|
value: Array,
|
|
7
|
-
|
|
8
|
+
accordion: Boolean,
|
|
8
9
|
sample: Boolean
|
|
9
10
|
},
|
|
10
11
|
provide() {
|
|
@@ -30,9 +31,9 @@ export default {
|
|
|
30
31
|
let index = value.indexOf(key)
|
|
31
32
|
|
|
32
33
|
if (index >= 0) {
|
|
33
|
-
this.
|
|
34
|
+
this.accordion ? value = [] : value.splice(index, 1)
|
|
34
35
|
} else {
|
|
35
|
-
this.
|
|
36
|
+
this.accordion ? value = [key] : value.push(key)
|
|
36
37
|
}
|
|
37
38
|
this.currentValue = value
|
|
38
39
|
this.$emit('change', key)
|
|
@@ -41,14 +42,15 @@ export default {
|
|
|
41
42
|
},
|
|
42
43
|
render() {
|
|
43
44
|
const classes = ['k-collapse', {
|
|
44
|
-
['k-
|
|
45
|
+
['k-collapse-sample']: this.sample
|
|
45
46
|
}]
|
|
46
|
-
const
|
|
47
|
+
const children = getChildren(this.$slots.default)
|
|
47
48
|
return (<div class={classes}>{
|
|
48
|
-
|
|
49
|
-
let
|
|
50
|
-
return cloneVNode(child, { props: {
|
|
49
|
+
children.map((child) => {
|
|
50
|
+
let active = this.currentValue.indexOf(child.key) >= 0
|
|
51
|
+
return cloneVNode(child, { props: { active } })
|
|
51
52
|
})
|
|
52
53
|
}</div>)
|
|
53
54
|
}
|
|
54
|
-
}
|
|
55
|
+
}
|
|
56
|
+
export default withInstall(Collapse)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<cn>
|
|
2
2
|
#### 手风琴
|
|
3
|
-
设置 `
|
|
3
|
+
设置 `accordion` 只允许同时展开一个面板
|
|
4
4
|
</cn>
|
|
5
5
|
|
|
6
6
|
```vue
|
|
7
7
|
<template>
|
|
8
8
|
<div class="demo-collapse">
|
|
9
|
-
<Collapse :value="['1']"
|
|
9
|
+
<Collapse :value="['1']" accordion>
|
|
10
10
|
<Panel title="Panel title" key="1">
|
|
11
11
|
<div>{{text}}</div>
|
|
12
12
|
</Panel>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import Info from './info.md'
|
|
3
3
|
import Base from './base.md'
|
|
4
|
-
import
|
|
4
|
+
import Accordion from './accordion.md'
|
|
5
5
|
import Nesting from './nesting.md'
|
|
6
6
|
import Sample from './sample.md'
|
|
7
7
|
import Extra from './extra.md'
|
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
<div>
|
|
13
13
|
<Info />
|
|
14
14
|
<Base />
|
|
15
|
-
<
|
|
15
|
+
<Accordion />
|
|
16
16
|
<Nesting />
|
|
17
17
|
<Extra />
|
|
18
18
|
<Sample />
|
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import Icon from "../icon";
|
|
2
|
-
import {
|
|
2
|
+
import { getTransitionProp } from '../base/transition'
|
|
3
3
|
import { ChevronUp } from 'kui-icons'
|
|
4
|
-
|
|
4
|
+
import { withInstall } from '../utils/vue'
|
|
5
|
+
|
|
6
|
+
const Panel = {
|
|
5
7
|
name: 'Panel',
|
|
6
8
|
props: {
|
|
7
9
|
title: String,
|
|
8
|
-
|
|
10
|
+
active: Boolean
|
|
9
11
|
},
|
|
10
12
|
inject: {
|
|
11
13
|
Collapse: { default: null }
|
|
12
14
|
},
|
|
13
15
|
watch: {
|
|
14
|
-
|
|
16
|
+
active(value) {
|
|
15
17
|
this.rendered = true
|
|
16
18
|
this.$nextTick(() => this.visible = value)
|
|
17
19
|
}
|
|
18
20
|
},
|
|
19
21
|
data() {
|
|
20
22
|
return {
|
|
21
|
-
visible: this.
|
|
22
|
-
rendered: this.
|
|
23
|
+
visible: this.active,
|
|
24
|
+
rendered: this.active == true
|
|
23
25
|
}
|
|
24
26
|
},
|
|
25
27
|
methods: {
|
|
@@ -29,8 +31,8 @@ export default {
|
|
|
29
31
|
}
|
|
30
32
|
},
|
|
31
33
|
renderPanel() {
|
|
32
|
-
const
|
|
33
|
-
return this.rendered ? <transition {...
|
|
34
|
+
const props = getTransitionProp('k-collapse-slide')
|
|
35
|
+
return this.rendered ? <transition {...props}>
|
|
34
36
|
<div class="k-collapse-content" v-show={this.visible}>
|
|
35
37
|
<div class="k-collapse-content-box">
|
|
36
38
|
{this.$slots.default}
|
|
@@ -40,14 +42,9 @@ export default {
|
|
|
40
42
|
}
|
|
41
43
|
},
|
|
42
44
|
render() {
|
|
43
|
-
|
|
44
|
-
// let actived = false
|
|
45
|
-
let { Collapse, actived, $vnode, $slots } = this
|
|
46
|
-
// if (Collapse) {
|
|
47
|
-
// actived = Collapse.currentValue.indexOf($vnode.key) >= 0
|
|
48
|
-
// }
|
|
45
|
+
let { active, $slots } = this
|
|
49
46
|
const classes = ['k-collapse-item', {
|
|
50
|
-
['k-collapse-item-active']:
|
|
47
|
+
['k-collapse-item-active']: active
|
|
51
48
|
}]
|
|
52
49
|
return (
|
|
53
50
|
<div class={classes}>
|
|
@@ -60,4 +57,6 @@ export default {
|
|
|
60
57
|
</div >
|
|
61
58
|
)
|
|
62
59
|
}
|
|
63
|
-
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default withInstall(Panel)
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
.k-
|
|
51
|
+
.k-collapse-sample {
|
|
52
52
|
border: none;
|
|
53
53
|
background: none;
|
|
54
54
|
.k-collapse-item {
|
|
@@ -64,12 +64,12 @@
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
.k-
|
|
67
|
+
.k-collapse-slide-enter-active {
|
|
68
68
|
animation: slide 0.3s ease-in-out;
|
|
69
69
|
animation-fill-mode: both;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
.k-
|
|
72
|
+
.k-collapse-slide-leave-active {
|
|
73
73
|
animation: slide 0.3s ease-in-out reverse;
|
|
74
74
|
animation-fill-mode: both;
|
|
75
75
|
}
|