kui-vue 3.4.8 → 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 +247 -237
- 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 +53 -20
- 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
package/LICENSE
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
|
+
import resize from "../directives/resize";
|
|
2
|
+
import { withInstall } from "../utils/vue";
|
|
1
3
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// function getStyle(el, attr) {
|
|
5
|
-
// if (el.currentStyle) {
|
|
6
|
-
// return el.currentStyle[attr];
|
|
7
|
-
// } else {
|
|
8
|
-
// return getComputedStyle(el, false)[attr];
|
|
9
|
-
// }
|
|
10
|
-
// }
|
|
11
|
-
|
|
12
|
-
export default {
|
|
13
|
-
name: 'Affix',
|
|
4
|
+
const Affix = {
|
|
5
|
+
name: "Affix",
|
|
14
6
|
directives: { resize },
|
|
15
7
|
props: {
|
|
16
8
|
offsetTop: { type: Number, default: 0 },
|
|
17
9
|
offsetBottom: Number,
|
|
18
|
-
target: {
|
|
10
|
+
target: {
|
|
11
|
+
type: Function,
|
|
12
|
+
default: () => {
|
|
13
|
+
return window;
|
|
14
|
+
},
|
|
15
|
+
},
|
|
19
16
|
},
|
|
20
17
|
data() {
|
|
21
18
|
return {
|
|
@@ -23,65 +20,67 @@ export default {
|
|
|
23
20
|
width: 0,
|
|
24
21
|
height: 0,
|
|
25
22
|
offsetTopValue: 0,
|
|
26
|
-
}
|
|
23
|
+
};
|
|
27
24
|
},
|
|
28
|
-
|
|
25
|
+
beforeDestroy() {
|
|
29
26
|
if (this.target() == window) {
|
|
30
|
-
|
|
27
|
+
window.removeEventListener("scroll", this.updatePosition);
|
|
31
28
|
}
|
|
32
29
|
},
|
|
33
30
|
mounted() {
|
|
34
|
-
let target = this.target()
|
|
35
|
-
if (target &&
|
|
36
|
-
target.addEventListener(
|
|
31
|
+
let target = this.target();
|
|
32
|
+
if (target && typeof window !== "undefined") {
|
|
33
|
+
target.addEventListener("scroll", this.updatePosition);
|
|
37
34
|
}
|
|
38
35
|
},
|
|
39
36
|
methods: {
|
|
40
|
-
updatePosition(
|
|
41
|
-
let { offsetBottom, offsetTop, $refs } = this
|
|
42
|
-
let target = this.target()
|
|
37
|
+
updatePosition() {
|
|
38
|
+
let { offsetBottom, offsetTop, $refs } = this;
|
|
39
|
+
let target = this.target();
|
|
43
40
|
if (!$refs.blob || !target) return;
|
|
44
41
|
|
|
45
42
|
let rect = $refs.blob.getBoundingClientRect();
|
|
46
|
-
let container =
|
|
43
|
+
let container = target != window && target != document ? target.getBoundingClientRect() : { top: 0, bottom: document.documentElement.clientHeight };
|
|
47
44
|
|
|
48
|
-
let hasbottom = typeof offsetBottom ==
|
|
49
|
-
let fx = hasbottom ? container.bottom - rect.bottom >= offsetBottom : rect.top - container.top <= offsetTop
|
|
45
|
+
let hasbottom = typeof offsetBottom == "number" && offsetBottom >= 0;
|
|
46
|
+
let fx = hasbottom ? container.bottom - rect.bottom >= offsetBottom : rect.top - container.top <= offsetTop;
|
|
50
47
|
|
|
51
48
|
if (!fx) {
|
|
52
|
-
this.offsetTopValue = rect.top
|
|
49
|
+
this.offsetTopValue = rect.top;
|
|
53
50
|
if (target == window || target == document) {
|
|
54
51
|
if (this.offsetTopValue > offsetTop && !hasbottom) {
|
|
55
|
-
this.offsetTopValue = offsetTop
|
|
52
|
+
this.offsetTopValue = offsetTop;
|
|
56
53
|
}
|
|
57
54
|
if (hasbottom && container.bottom - rect.bottom < offsetBottom) {
|
|
58
|
-
this.offsetTopValue = container.bottom - offsetBottom - rect.height
|
|
55
|
+
this.offsetTopValue = container.bottom - offsetBottom - rect.height;
|
|
59
56
|
}
|
|
60
57
|
} else {
|
|
61
58
|
//todo:
|
|
62
59
|
}
|
|
63
60
|
}
|
|
64
61
|
if (this.fixed != fx) {
|
|
65
|
-
this.fixed = fx
|
|
66
|
-
this.width = rect.width
|
|
67
|
-
this.height = rect.height
|
|
68
|
-
this.$emit(
|
|
62
|
+
this.fixed = fx;
|
|
63
|
+
this.width = rect.width;
|
|
64
|
+
this.height = rect.height;
|
|
65
|
+
this.$emit("change", this.fixed);
|
|
69
66
|
}
|
|
70
|
-
}
|
|
67
|
+
},
|
|
71
68
|
},
|
|
72
69
|
render() {
|
|
73
|
-
let blobStyle = null,
|
|
70
|
+
let blobStyle = null,
|
|
71
|
+
fixedStyle = null,
|
|
72
|
+
classes = null;
|
|
74
73
|
if (this.fixed) {
|
|
75
74
|
blobStyle = {
|
|
76
75
|
width: `${this.width}px`,
|
|
77
|
-
height: `${this.height}px
|
|
78
|
-
}
|
|
76
|
+
height: `${this.height}px`,
|
|
77
|
+
};
|
|
79
78
|
fixedStyle = {
|
|
80
79
|
width: `${this.width}px`,
|
|
81
80
|
height: `${this.height}px`,
|
|
82
|
-
top: `${this.offsetTopValue}px
|
|
83
|
-
}
|
|
84
|
-
classes = { [
|
|
81
|
+
top: `${this.offsetTopValue}px`,
|
|
82
|
+
};
|
|
83
|
+
classes = { ["k-affix"]: this.fixed };
|
|
85
84
|
}
|
|
86
85
|
|
|
87
86
|
return (
|
|
@@ -90,6 +89,7 @@ export default {
|
|
|
90
89
|
{this.$slots.default}
|
|
91
90
|
</div>
|
|
92
91
|
</div>
|
|
93
|
-
)
|
|
94
|
-
}
|
|
95
|
-
}
|
|
92
|
+
);
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
export default withInstall(Affix)
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
2
1
|
import Icon from "../icon";
|
|
3
2
|
import {
|
|
4
3
|
InformationCircle, CloseCircle,
|
|
5
4
|
CheckmarkCircle, AlertCircle, Close
|
|
6
5
|
} from 'kui-icons'
|
|
7
|
-
import {
|
|
8
|
-
|
|
6
|
+
import { getTransitionProp } from '../base/transition'
|
|
7
|
+
import { withInstall } from "../utils/vue";
|
|
8
|
+
const Alert = {
|
|
9
9
|
name: "Alert",
|
|
10
10
|
props: {
|
|
11
|
-
type: {
|
|
11
|
+
type: {
|
|
12
|
+
type: String, default: "warning",
|
|
13
|
+
validator: (val) => ['info', 'success', 'warning', 'error'].includes(val)
|
|
14
|
+
},
|
|
12
15
|
closable: Boolean,
|
|
13
16
|
showIcon: Boolean,
|
|
14
17
|
message: String,
|
|
@@ -46,9 +49,9 @@ export default {
|
|
|
46
49
|
const closeIcon = closable ? <Icon class="k-alert-close" type={Close} onClick={close} /> : null
|
|
47
50
|
description = <div class="k-alert-description">{description}</div>
|
|
48
51
|
const msg = <div class="k-alert-message">{(message || $slots.default)}</div>
|
|
49
|
-
const
|
|
52
|
+
const props = getTransitionProp('k-alert-slide')
|
|
50
53
|
return (
|
|
51
|
-
<transition {...
|
|
54
|
+
<transition {...props} name='k-alert-slide'>
|
|
52
55
|
<div class={classes} v-show={!closed}>
|
|
53
56
|
{iconNode}
|
|
54
57
|
{msg}
|
|
@@ -58,4 +61,6 @@ export default {
|
|
|
58
61
|
</transition >
|
|
59
62
|
)
|
|
60
63
|
}
|
|
61
|
-
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export default withInstall(Alert);
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import cloneVNode from '../
|
|
3
|
-
|
|
1
|
+
import { getChildren } from '../utils/element'
|
|
2
|
+
import cloneVNode from '../utils/clone'
|
|
3
|
+
import { withInstall } from '../utils/vue'
|
|
4
|
+
const AvatarGroup = {
|
|
5
|
+
name: 'AvatarGroup',
|
|
4
6
|
props: {
|
|
5
7
|
maxCount: Number,
|
|
6
8
|
shape: String,
|
|
7
9
|
size: [String, Number]
|
|
8
10
|
},
|
|
9
11
|
render() {
|
|
10
|
-
let child =
|
|
12
|
+
let child = getChildren(this.$slots.default)
|
|
11
13
|
let { shape, size } = this
|
|
12
14
|
return (
|
|
13
15
|
<div class="k-avatar-group">
|
|
@@ -19,4 +21,5 @@ export default {
|
|
|
19
21
|
</div>
|
|
20
22
|
)
|
|
21
23
|
}
|
|
22
|
-
}
|
|
24
|
+
}
|
|
25
|
+
export default withInstall(AvatarGroup)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import Icon from '../icon'
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { getChildren } from '../utils/element'
|
|
3
|
+
import { withInstall } from '../utils/vue'
|
|
4
|
+
const Avatar = {
|
|
5
|
+
name: 'Avatar',
|
|
4
6
|
props: {
|
|
5
7
|
icon: [String, Array],
|
|
6
8
|
shape: { type: String, },
|
|
@@ -12,10 +14,10 @@ export default {
|
|
|
12
14
|
src: String
|
|
13
15
|
},
|
|
14
16
|
updated() {
|
|
15
|
-
this.
|
|
17
|
+
this.updateSize()
|
|
16
18
|
},
|
|
17
19
|
methods: {
|
|
18
|
-
|
|
20
|
+
updateSize() {
|
|
19
21
|
let inner = this.$refs.inner
|
|
20
22
|
if (inner) {
|
|
21
23
|
let scale = 1, max = this.$el.offsetWidth - 8;
|
|
@@ -26,7 +28,7 @@ export default {
|
|
|
26
28
|
}
|
|
27
29
|
},
|
|
28
30
|
mounted() {
|
|
29
|
-
this.
|
|
31
|
+
this.updateSize()
|
|
30
32
|
},
|
|
31
33
|
render() {
|
|
32
34
|
let { size, shape, src, icon } = this
|
|
@@ -39,7 +41,7 @@ export default {
|
|
|
39
41
|
fontSize: `${size / 2}px`,
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
|
-
let child =
|
|
44
|
+
let child = getChildren(this.$slots.default)
|
|
43
45
|
let hasIcon = child.filter(x => (x.componentOptions || {}).tag == 'Icon').length
|
|
44
46
|
let text = child.filter(x => !x.context).length == child.length
|
|
45
47
|
|
|
@@ -67,4 +69,5 @@ export default {
|
|
|
67
69
|
}
|
|
68
70
|
</div >
|
|
69
71
|
}
|
|
70
|
-
}
|
|
72
|
+
}
|
|
73
|
+
export default withInstall(Avatar)
|
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
|
|
2
1
|
import Icon from "../icon";
|
|
3
|
-
import scroll from "../
|
|
2
|
+
import scroll from "../directives/scroll";
|
|
4
3
|
import { ArrowUp } from "kui-icons";
|
|
5
|
-
|
|
4
|
+
import { withInstall } from "../utils/vue";
|
|
5
|
+
|
|
6
|
+
const BackTop = {
|
|
6
7
|
name: "BackTop",
|
|
7
8
|
directives: { scroll },
|
|
8
9
|
props: {
|
|
9
10
|
height: { type: [String, Number], default: 100 },
|
|
10
11
|
right: [String, Number],
|
|
11
|
-
bottom: [String, Number]
|
|
12
|
+
bottom: [String, Number],
|
|
12
13
|
},
|
|
13
14
|
data() {
|
|
14
15
|
return {
|
|
15
16
|
timer: null,
|
|
16
|
-
visible: false
|
|
17
|
+
visible: false,
|
|
17
18
|
};
|
|
18
19
|
},
|
|
19
20
|
methods: {
|
|
20
21
|
scroll() {
|
|
21
|
-
|
|
22
|
+
const top =
|
|
23
|
+
document.body.scrollTop ||
|
|
24
|
+
document.documentElement.scrollTop ||
|
|
25
|
+
window.scrollY;
|
|
22
26
|
this.visible = top >= this.height;
|
|
23
27
|
},
|
|
24
28
|
handle(e) {
|
|
@@ -28,46 +32,49 @@ export default {
|
|
|
28
32
|
}
|
|
29
33
|
let height = 80;
|
|
30
34
|
this.timer = setInterval(() => {
|
|
31
|
-
|
|
35
|
+
const oTop =
|
|
36
|
+
document.body.scrollTop ||
|
|
37
|
+
document.documentElement.scrollTop ||
|
|
38
|
+
window.scrollY;
|
|
32
39
|
if (oTop > 0) {
|
|
33
|
-
document.body.scrollTop = document.documentElement.scrollTop =
|
|
34
|
-
|
|
35
|
-
this.scroll()
|
|
40
|
+
document.body.scrollTop = document.documentElement.scrollTop =
|
|
41
|
+
oTop - height;
|
|
42
|
+
this.scroll();
|
|
36
43
|
} else {
|
|
37
44
|
clearInterval(this.timer);
|
|
38
45
|
}
|
|
39
46
|
if (height <= 15) height = 15;
|
|
40
47
|
else height -= 1;
|
|
41
48
|
}, 10);
|
|
42
|
-
|
|
43
|
-
// cancelAnimationFrame(this.timer);
|
|
44
|
-
// let _this = this
|
|
45
|
-
// this.timer = requestAnimationFrame(function fn() {
|
|
46
|
-
// var oTop = document.body.scrollTop || document.documentElement.scrollTop;
|
|
47
|
-
// if (oTop > 0) {
|
|
48
|
-
// document.body.scrollTop = document.documentElement.scrollTop = oTop - 150;
|
|
49
|
-
// _this.timer = requestAnimationFrame(fn);
|
|
50
|
-
// } else {
|
|
51
|
-
// cancelAnimationFrame(_this.timer);
|
|
52
|
-
// }
|
|
53
|
-
// });
|
|
54
|
-
}
|
|
49
|
+
},
|
|
55
50
|
},
|
|
56
51
|
render() {
|
|
57
|
-
let child = this.$slots.default
|
|
52
|
+
let child = this.$slots.default;
|
|
58
53
|
if (!child) {
|
|
59
|
-
child =
|
|
54
|
+
child = (
|
|
55
|
+
<div class="k-backtop-content">
|
|
56
|
+
<Icon type={ArrowUp} />
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
60
59
|
}
|
|
61
60
|
const styles = {
|
|
62
|
-
bottom:
|
|
63
|
-
left:
|
|
64
|
-
}
|
|
61
|
+
bottom: this.bottom + "px",
|
|
62
|
+
left: this.right + "px",
|
|
63
|
+
};
|
|
65
64
|
return (
|
|
66
65
|
<transition name="k-backtop-fade">
|
|
67
|
-
<div
|
|
66
|
+
<div
|
|
67
|
+
class="k-backtop"
|
|
68
|
+
onClick={this.handle}
|
|
69
|
+
v-show={this.visible}
|
|
70
|
+
v-scroll={this.scroll}
|
|
71
|
+
style={styles}
|
|
72
|
+
>
|
|
68
73
|
{child}
|
|
69
74
|
</div>
|
|
70
75
|
</transition>
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
};
|
|
76
|
+
);
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export default withInstall(BackTop);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { withInstall } from '../utils/vue';
|
|
2
|
+
import { getChildren } from '../utils/element'
|
|
3
|
+
const Badge = {
|
|
3
4
|
name: "Badge",
|
|
4
5
|
props: {
|
|
5
6
|
count: [String, Number],
|
|
@@ -7,9 +8,6 @@ export default {
|
|
|
7
8
|
color: String,
|
|
8
9
|
status: {
|
|
9
10
|
type: String,
|
|
10
|
-
// validator: (value) => {
|
|
11
|
-
// ['default', 'success', 'error', 'warning'].indexOf(value) > -1
|
|
12
|
-
// },
|
|
13
11
|
default: 'default'
|
|
14
12
|
},
|
|
15
13
|
text: String,
|
|
@@ -18,8 +16,8 @@ export default {
|
|
|
18
16
|
render() {
|
|
19
17
|
const { $slots, maxCount, count, dot, color, status, text } = this
|
|
20
18
|
let innerText = null, statusNode = [];
|
|
21
|
-
const child =
|
|
22
|
-
|
|
19
|
+
const child = getChildren($slots.default)
|
|
20
|
+
|
|
23
21
|
if (typeof count === 'number' && count !== 0) {
|
|
24
22
|
innerText = count > maxCount ? maxCount + '+' : count
|
|
25
23
|
} else if (typeof count === 'string') {
|
|
@@ -58,3 +56,5 @@ export default {
|
|
|
58
56
|
)
|
|
59
57
|
}
|
|
60
58
|
};
|
|
59
|
+
|
|
60
|
+
export default withInstall(Badge);
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
//给需要的 元素加上 css transition: height .2s ease-in-out;
|
|
3
|
-
//by chuchur
|
|
4
|
-
|
|
5
|
-
// https://cn.vuejs.org/v2/guide/render-function.html#函数式组件
|
|
6
|
-
import { getTranstionProp } from './transition'
|
|
1
|
+
import { getTransitionProp } from './transition'
|
|
7
2
|
export default {
|
|
8
3
|
name: 'Collapse',
|
|
9
4
|
props: {
|
|
@@ -14,7 +9,7 @@ export default {
|
|
|
14
9
|
render() {
|
|
15
10
|
let { name, $slots, collapse } = this
|
|
16
11
|
let child = $slots.default || $slots.content;
|
|
17
|
-
const props = collapse ?
|
|
12
|
+
const props = collapse ? getTransitionProp(name) : { name }
|
|
18
13
|
return (<transition {...props} name={name}>{child}</transition>)
|
|
19
14
|
}
|
|
20
15
|
}
|