vxe-pc-ui 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/button/src/button.js +3 -0
- package/es/carousel/index.js +12 -0
- package/es/carousel/src/carousel-item.js +100 -0
- package/es/carousel/src/carousel.js +418 -0
- package/es/carousel/src/util.js +17 -0
- package/es/carousel/style.css +185 -0
- package/es/carousel/style.min.css +1 -0
- package/es/carousel-item/index.js +12 -0
- package/es/carousel-item/style.css +0 -0
- package/es/carousel-item/style.min.css +0 -0
- package/es/checkbox/index.js +12 -0
- package/es/checkbox/src/checkbox.js +159 -0
- package/es/checkbox/src/group.js +154 -0
- package/es/checkbox/style.css +117 -0
- package/es/checkbox/style.min.css +1 -0
- package/es/checkbox-group/index.js +12 -0
- package/es/checkbox-group/style.css +0 -0
- package/es/checkbox-group/style.min.css +0 -0
- package/es/components.js +39 -39
- package/es/date-picker/src/date-picker.js +3 -0
- package/es/icon/style.css +1 -1
- package/es/icon-picker/index.js +12 -0
- package/es/icon-picker/src/icon-picker.js +668 -0
- package/es/icon-picker/style.css +207 -0
- package/es/icon-picker/style.min.css +1 -0
- package/es/input/index.js +12 -0
- package/es/input/src/input.js +2892 -0
- package/es/input/style.css +941 -0
- package/es/input/style.min.css +1 -0
- package/es/layout-footer/src/layout-footer.js +2 -1
- package/es/layout-header/src/layout-header.js +2 -1
- package/es/optgroup/index.js +12 -0
- package/es/optgroup/style.css +0 -0
- package/es/optgroup/style.min.css +0 -0
- package/es/option/index.js +12 -0
- package/es/option/style.css +0 -0
- package/es/option/style.min.css +0 -0
- package/es/pager/index.js +12 -0
- package/es/pager/src/pager.js +687 -0
- package/es/password-input/index.js +12 -0
- package/es/password-input/src/password-input.js +388 -0
- package/es/password-input/style.css +604 -0
- package/es/password-input/style.min.css +1 -0
- package/es/pulldown/src/pulldown.js +5 -1
- package/es/select/index.js +12 -0
- package/es/select/src/optgroup.js +90 -0
- package/es/select/src/option-info.js +16 -0
- package/es/select/src/option.js +86 -0
- package/es/select/src/select.js +1269 -0
- package/es/select/src/util.js +35 -0
- package/es/select/style.css +207 -0
- package/es/select/style.min.css +1 -0
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/tab-pane/index.js +12 -0
- package/es/tab-pane/style.css +0 -0
- package/es/tab-pane/style.min.css +0 -0
- package/es/tabs/index.js +12 -0
- package/es/tabs/src/tab-pane.js +119 -0
- package/es/tabs/src/tabs.js +593 -0
- package/es/tabs/src/util.js +17 -0
- package/es/tabs/style.css +342 -0
- package/es/tabs/style.min.css +1 -0
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-carousel/index.js +3 -0
- package/es/vxe-carousel/style.css +185 -0
- package/es/vxe-carousel/style.min.css +1 -0
- package/es/vxe-carousel-item/index.js +3 -0
- package/es/vxe-carousel-item/style.css +0 -0
- package/es/vxe-carousel-item/style.min.css +0 -0
- package/es/vxe-checkbox/index.js +3 -0
- package/es/vxe-checkbox/style.css +117 -0
- package/es/vxe-checkbox/style.min.css +1 -0
- package/es/vxe-checkbox-group/index.js +3 -0
- package/es/vxe-checkbox-group/style.css +0 -0
- package/es/vxe-checkbox-group/style.min.css +0 -0
- package/es/vxe-icon-picker/index.js +3 -0
- package/es/vxe-icon-picker/style.css +207 -0
- package/es/vxe-icon-picker/style.min.css +1 -0
- package/es/vxe-input/index.js +3 -0
- package/es/vxe-input/style.css +941 -0
- package/es/vxe-input/style.min.css +1 -0
- package/es/vxe-optgroup/index.js +3 -0
- package/es/vxe-optgroup/style.css +0 -0
- package/es/vxe-optgroup/style.min.css +0 -0
- package/es/vxe-option/index.js +3 -0
- package/es/vxe-option/style.css +0 -0
- package/es/vxe-option/style.min.css +0 -0
- package/es/vxe-password-input/index.js +3 -0
- package/es/vxe-password-input/style.css +604 -0
- package/es/vxe-password-input/style.min.css +1 -0
- package/es/vxe-select/index.js +3 -0
- package/es/vxe-select/style.css +207 -0
- package/es/vxe-select/style.min.css +1 -0
- package/es/vxe-tab-pane/index.js +3 -0
- package/es/vxe-tab-pane/style.css +0 -0
- package/es/vxe-tab-pane/style.min.css +0 -0
- package/es/vxe-tabs/index.js +3 -0
- package/es/vxe-tabs/style.css +342 -0
- package/es/vxe-tabs/style.min.css +1 -0
- package/lib/button/src/button.js +3 -0
- package/lib/button/src/button.min.js +1 -1
- package/lib/carousel/index.js +19 -0
- package/lib/carousel/index.min.js +1 -0
- package/lib/carousel/src/carousel-item.js +107 -0
- package/lib/carousel/src/carousel-item.min.js +1 -0
- package/lib/carousel/src/carousel.js +437 -0
- package/lib/carousel/src/carousel.min.js +1 -0
- package/lib/carousel/src/util.js +27 -0
- package/lib/carousel/src/util.min.js +1 -0
- package/lib/carousel/style/index.js +1 -0
- package/lib/carousel/style/style.css +185 -0
- package/lib/carousel/style/style.min.css +1 -0
- package/lib/carousel-item/index.js +19 -0
- package/lib/carousel-item/index.min.js +1 -0
- package/lib/carousel-item/style/index.js +1 -0
- package/lib/carousel-item/style/style.css +0 -0
- package/lib/carousel-item/style/style.min.css +0 -0
- package/lib/checkbox/index.js +19 -0
- package/lib/checkbox/index.min.js +1 -0
- package/lib/checkbox/src/checkbox.js +169 -0
- package/lib/checkbox/src/checkbox.min.js +1 -0
- package/lib/checkbox/src/group.js +164 -0
- package/lib/checkbox/src/group.min.js +1 -0
- package/lib/checkbox/style/index.js +1 -0
- package/lib/checkbox/style/style.css +117 -0
- package/lib/checkbox/style/style.min.css +1 -0
- package/lib/checkbox-group/index.js +19 -0
- package/lib/checkbox-group/index.min.js +1 -0
- package/lib/checkbox-group/style/index.js +1 -0
- package/lib/checkbox-group/style/style.css +0 -0
- package/lib/checkbox-group/style/style.min.css +0 -0
- package/lib/components.js +159 -60
- package/lib/components.min.js +1 -1
- package/lib/date-picker/src/date-picker.js +3 -0
- package/lib/date-picker/src/date-picker.min.js +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/icon-picker/index.js +19 -0
- package/lib/icon-picker/index.min.js +1 -0
- package/lib/icon-picker/src/icon-picker.js +646 -0
- package/lib/icon-picker/src/icon-picker.min.js +1 -0
- package/lib/icon-picker/style/index.js +1 -0
- package/lib/icon-picker/style/style.css +207 -0
- package/lib/icon-picker/style/style.min.css +1 -0
- package/lib/index.umd.js +15870 -7738
- package/lib/index.umd.min.js +1 -1
- package/lib/input/index.js +19 -0
- package/lib/input/index.min.js +1 -0
- package/lib/input/src/input.js +2897 -0
- package/lib/input/src/input.min.js +1 -0
- package/lib/input/style/index.js +1 -0
- package/lib/input/style/style.css +941 -0
- package/lib/input/style/style.min.css +1 -0
- package/lib/layout-footer/src/layout-footer.js +2 -1
- package/lib/layout-header/src/layout-header.js +2 -1
- package/lib/optgroup/index.js +19 -0
- package/lib/optgroup/index.min.js +1 -0
- package/lib/optgroup/style/index.js +1 -0
- package/lib/optgroup/style/style.css +0 -0
- package/lib/optgroup/style/style.min.css +0 -0
- package/lib/option/index.js +19 -0
- package/lib/option/index.min.js +1 -0
- package/lib/option/style/index.js +1 -0
- package/lib/option/style/style.css +0 -0
- package/lib/option/style/style.min.css +0 -0
- package/lib/pager/index.js +19 -0
- package/lib/pager/index.min.js +1 -0
- package/lib/pager/src/pager.js +714 -0
- package/lib/pager/src/pager.min.js +1 -0
- package/lib/password-input/index.js +19 -0
- package/lib/password-input/index.min.js +1 -0
- package/lib/password-input/src/password-input.js +398 -0
- package/lib/password-input/src/password-input.min.js +1 -0
- package/lib/password-input/style/index.js +1 -0
- package/lib/password-input/style/style.css +604 -0
- package/lib/password-input/style/style.min.css +1 -0
- package/lib/pulldown/src/pulldown.js +5 -1
- package/lib/pulldown/src/pulldown.min.js +1 -1
- package/lib/select/index.js +19 -0
- package/lib/select/index.min.js +1 -0
- package/lib/select/src/optgroup.js +97 -0
- package/lib/select/src/optgroup.min.js +1 -0
- package/lib/select/src/option-info.js +33 -0
- package/lib/select/src/option-info.min.js +1 -0
- package/lib/select/src/option.js +93 -0
- package/lib/select/src/option.min.js +1 -0
- package/lib/select/src/select.js +1315 -0
- package/lib/select/src/select.min.js +1 -0
- package/lib/select/src/util.js +50 -0
- package/lib/select/src/util.min.js +1 -0
- package/lib/select/style/index.js +1 -0
- package/lib/select/style/style.css +207 -0
- package/lib/select/style/style.min.css +1 -0
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/tab-pane/index.js +19 -0
- package/lib/tab-pane/index.min.js +1 -0
- package/lib/tab-pane/style/index.js +1 -0
- package/lib/tab-pane/style/style.css +0 -0
- package/lib/tab-pane/style/style.min.css +0 -0
- package/lib/tabs/index.js +19 -0
- package/lib/tabs/index.min.js +1 -0
- package/lib/tabs/src/tab-pane.js +128 -0
- package/lib/tabs/src/tab-pane.min.js +1 -0
- package/lib/tabs/src/tabs.js +630 -0
- package/lib/tabs/src/tabs.min.js +1 -0
- package/lib/tabs/src/util.js +29 -0
- package/lib/tabs/src/util.min.js +1 -0
- package/lib/tabs/style/index.js +1 -0
- package/lib/tabs/style/style.css +342 -0
- package/lib/tabs/style/style.min.css +1 -0
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-carousel/index.js +23 -0
- package/lib/vxe-carousel/index.min.js +1 -0
- package/lib/vxe-carousel/style/index.js +1 -0
- package/lib/vxe-carousel/style/style.css +185 -0
- package/lib/vxe-carousel/style/style.min.css +1 -0
- package/lib/vxe-carousel-item/index.js +23 -0
- package/lib/vxe-carousel-item/index.min.js +1 -0
- package/lib/vxe-carousel-item/style/index.js +1 -0
- package/lib/vxe-carousel-item/style/style.css +0 -0
- package/lib/vxe-carousel-item/style/style.min.css +0 -0
- package/lib/vxe-checkbox/index.js +23 -0
- package/lib/vxe-checkbox/index.min.js +1 -0
- package/lib/vxe-checkbox/style/index.js +1 -0
- package/lib/vxe-checkbox/style/style.css +117 -0
- package/lib/vxe-checkbox/style/style.min.css +1 -0
- package/lib/vxe-checkbox-group/index.js +23 -0
- package/lib/vxe-checkbox-group/index.min.js +1 -0
- package/lib/vxe-checkbox-group/style/index.js +1 -0
- package/lib/vxe-checkbox-group/style/style.css +0 -0
- package/lib/vxe-checkbox-group/style/style.min.css +0 -0
- package/lib/vxe-icon-picker/index.js +23 -0
- package/lib/vxe-icon-picker/index.min.js +1 -0
- package/lib/vxe-icon-picker/style/index.js +1 -0
- package/lib/vxe-icon-picker/style/style.css +207 -0
- package/lib/vxe-icon-picker/style/style.min.css +1 -0
- package/lib/vxe-input/index.js +23 -0
- package/lib/vxe-input/index.min.js +1 -0
- package/lib/vxe-input/style/index.js +1 -0
- package/lib/vxe-input/style/style.css +941 -0
- package/lib/vxe-input/style/style.min.css +1 -0
- package/lib/vxe-optgroup/index.js +23 -0
- package/lib/vxe-optgroup/index.min.js +1 -0
- package/lib/vxe-optgroup/style/index.js +1 -0
- package/lib/vxe-optgroup/style/style.css +0 -0
- package/lib/vxe-optgroup/style/style.min.css +0 -0
- package/lib/vxe-option/index.js +23 -0
- package/lib/vxe-option/index.min.js +1 -0
- package/lib/vxe-option/style/index.js +1 -0
- package/lib/vxe-option/style/style.css +0 -0
- package/lib/vxe-option/style/style.min.css +0 -0
- package/lib/vxe-password-input/index.js +23 -0
- package/lib/vxe-password-input/index.min.js +1 -0
- package/lib/vxe-password-input/style/index.js +1 -0
- package/lib/vxe-password-input/style/style.css +604 -0
- package/lib/vxe-password-input/style/style.min.css +1 -0
- package/lib/vxe-select/index.js +23 -0
- package/lib/vxe-select/index.min.js +1 -0
- package/lib/vxe-select/style/index.js +1 -0
- package/lib/vxe-select/style/style.css +207 -0
- package/lib/vxe-select/style/style.min.css +1 -0
- package/lib/vxe-tab-pane/index.js +23 -0
- package/lib/vxe-tab-pane/index.min.js +1 -0
- package/lib/vxe-tab-pane/style/index.js +1 -0
- package/lib/vxe-tab-pane/style/style.css +0 -0
- package/lib/vxe-tab-pane/style/style.min.css +0 -0
- package/lib/vxe-tabs/index.js +23 -0
- package/lib/vxe-tabs/index.min.js +1 -0
- package/lib/vxe-tabs/style/index.js +1 -0
- package/lib/vxe-tabs/style/style.css +342 -0
- package/lib/vxe-tabs/style/style.min.css +1 -0
- package/package.json +1 -1
- package/packages/button/src/button.ts +3 -0
- package/packages/carousel/index.ts +16 -0
- package/packages/carousel/src/carousel-item.ts +114 -0
- package/packages/carousel/src/carousel.ts +449 -0
- package/packages/carousel/src/util.ts +21 -0
- package/packages/carousel-item/index.ts +16 -0
- package/packages/checkbox/index.ts +16 -0
- package/packages/checkbox/src/checkbox.ts +176 -0
- package/packages/checkbox/src/group.ts +178 -0
- package/packages/checkbox-group/index.ts +16 -0
- package/packages/components.ts +39 -39
- package/packages/date-picker/src/date-picker.ts +3 -0
- package/packages/icon-picker/index.ts +16 -0
- package/packages/icon-picker/src/icon-picker.ts +711 -0
- package/packages/input/index.ts +16 -0
- package/packages/input/src/input.ts +2995 -0
- package/packages/layout-footer/src/layout-footer.ts +4 -3
- package/packages/layout-header/src/layout-header.ts +2 -1
- package/packages/optgroup/index.ts +16 -0
- package/packages/option/index.ts +16 -0
- package/packages/pager/index.ts +16 -0
- package/packages/pager/src/pager.ts +743 -0
- package/packages/password-input/index.ts +16 -0
- package/packages/password-input/src/password-input.ts +427 -0
- package/packages/pulldown/src/pulldown.ts +5 -1
- package/packages/select/index.ts +16 -0
- package/packages/select/src/optgroup.ts +107 -0
- package/packages/select/src/option-info.ts +20 -0
- package/packages/select/src/option.ts +103 -0
- package/packages/select/src/select.ts +1325 -0
- package/packages/select/src/util.ts +46 -0
- package/packages/tab-pane/index.ts +16 -0
- package/packages/tabs/index.ts +16 -0
- package/packages/tabs/src/tab-pane.ts +136 -0
- package/packages/tabs/src/tabs.ts +630 -0
- package/packages/tabs/src/util.ts +21 -0
- package/types/components/carousel.d.ts +5 -0
- package/types/components/icon-picker.d.ts +4 -0
- package/types/components/input.d.ts +9 -1
- package/types/components/optgroup.d.ts +10 -4
- package/types/components/tabs.d.ts +4 -0
- /package/es/icon/style/{iconfont.1725630285930.ttf → iconfont.1725723159302.ttf} +0 -0
- /package/es/icon/style/{iconfont.1725630285930.woff → iconfont.1725723159302.woff} +0 -0
- /package/es/icon/style/{iconfont.1725630285930.woff2 → iconfont.1725723159302.woff2} +0 -0
- /package/es/{iconfont.1725630285930.ttf → iconfont.1725723159302.ttf} +0 -0
- /package/es/{iconfont.1725630285930.woff → iconfont.1725723159302.woff} +0 -0
- /package/es/{iconfont.1725630285930.woff2 → iconfont.1725723159302.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1725630285930.ttf → iconfont.1725723159302.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1725630285930.woff → iconfont.1725723159302.woff} +0 -0
- /package/lib/icon/style/{iconfont.1725630285930.woff2 → iconfont.1725723159302.woff2} +0 -0
- /package/lib/{iconfont.1725630285930.ttf → iconfont.1725723159302.ttf} +0 -0
- /package/lib/{iconfont.1725630285930.woff → iconfont.1725723159302.woff} +0 -0
- /package/lib/{iconfont.1725630285930.woff2 → iconfont.1725723159302.woff2} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.VxeCarousel=exports.Carousel=void 0;var _core=require("@vxe-ui/core"),_carousel=_interopRequireDefault(require("./src/carousel")),_dynamics=require("../dynamics");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var VxeCarousel=exports.VxeCarousel=Object.assign({},_carousel.default,{install:function(e){e.component(_carousel.default.name,_carousel.default)}}),Carousel=(_dynamics.dynamicApp.use(VxeCarousel),_core.VxeUI.component(_carousel.default),exports.Carousel=VxeCarousel),_default=exports.default=VxeCarousel;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _comp = require("../../ui/src/comp");
|
|
8
|
+
var _xeUtils = _interopRequireDefault(require("xe-utils"));
|
|
9
|
+
var _ui = require("../../ui");
|
|
10
|
+
var _util = require("./util");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
13
|
+
name: 'VxeCarouselItem',
|
|
14
|
+
mixins: [_ui.globalMixins.sizeMixin],
|
|
15
|
+
props: {
|
|
16
|
+
name: [String, Number],
|
|
17
|
+
className: String,
|
|
18
|
+
url: String
|
|
19
|
+
},
|
|
20
|
+
inject: {
|
|
21
|
+
$xeCarousel: {
|
|
22
|
+
default: null
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
data: function data() {
|
|
26
|
+
var xID = _xeUtils.default.uniqueId();
|
|
27
|
+
var reactData = {
|
|
28
|
+
currentDate: null
|
|
29
|
+
};
|
|
30
|
+
var itemConfig = {
|
|
31
|
+
id: xID,
|
|
32
|
+
name: '',
|
|
33
|
+
url: '',
|
|
34
|
+
className: '',
|
|
35
|
+
slots: {}
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
xID: xID,
|
|
39
|
+
reactData: reactData,
|
|
40
|
+
itemConfig: itemConfig
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
computed: Object.assign({}, {}),
|
|
44
|
+
methods: {
|
|
45
|
+
//
|
|
46
|
+
// Method
|
|
47
|
+
//
|
|
48
|
+
dispatchEvent: function dispatchEvent(type, params, evnt) {
|
|
49
|
+
var $xeCarouselItem = this;
|
|
50
|
+
$xeCarouselItem.$emit(type, (0, _ui.createEvent)(evnt, {
|
|
51
|
+
$carouselItem: $xeCarouselItem
|
|
52
|
+
}, params));
|
|
53
|
+
},
|
|
54
|
+
//
|
|
55
|
+
// Render
|
|
56
|
+
//
|
|
57
|
+
renderVN: function renderVN(h) {
|
|
58
|
+
return h('div', {
|
|
59
|
+
ref: 'refElem'
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
watch: {
|
|
64
|
+
name: function name(val) {
|
|
65
|
+
var $xeCarouselItem = this;
|
|
66
|
+
var itemConfig = $xeCarouselItem.itemConfig;
|
|
67
|
+
itemConfig.name = val;
|
|
68
|
+
},
|
|
69
|
+
url: function url(val) {
|
|
70
|
+
var $xeCarouselItem = this;
|
|
71
|
+
var itemConfig = $xeCarouselItem.itemConfig;
|
|
72
|
+
itemConfig.url = val;
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
created: function created() {
|
|
76
|
+
var $xeCarouselItem = this;
|
|
77
|
+
var props = $xeCarouselItem;
|
|
78
|
+
var slots = $xeCarouselItem.$scopedSlots;
|
|
79
|
+
var itemConfig = $xeCarouselItem.itemConfig;
|
|
80
|
+
Object.assign(itemConfig, {
|
|
81
|
+
name: props.name,
|
|
82
|
+
url: props.url,
|
|
83
|
+
className: props.className,
|
|
84
|
+
slots: slots
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
mounted: function mounted() {
|
|
88
|
+
var $xeCarouselItem = this;
|
|
89
|
+
var itemConfig = $xeCarouselItem.itemConfig;
|
|
90
|
+
var $xeCarousel = $xeCarouselItem.$xeCarousel;
|
|
91
|
+
var elem = $xeCarouselItem.$refs.refElem;
|
|
92
|
+
if ($xeCarousel && elem) {
|
|
93
|
+
(0, _util.assembleCarouselItem)($xeCarousel, elem, itemConfig);
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
beforeDestroy: function beforeDestroy() {
|
|
97
|
+
var $xeCarouselItem = this;
|
|
98
|
+
var itemConfig = $xeCarouselItem.itemConfig;
|
|
99
|
+
var $xeCarousel = $xeCarouselItem.$xeCarousel;
|
|
100
|
+
if ($xeCarousel) {
|
|
101
|
+
(0, _util.destroyCarouselItem)($xeCarousel, itemConfig);
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
render: function render(h) {
|
|
105
|
+
return this.renderVN(h);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _comp=require("../../ui/src/comp"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_util=require("./util");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeCarouselItem",mixins:[_ui.globalMixins.sizeMixin],props:{name:[String,Number],className:String,url:String},inject:{$xeCarousel:{default:null}},data:function(){var e=_xeUtils.default.uniqueId();return{xID:e,reactData:{currentDate:null},itemConfig:{id:e,name:"",url:"",className:"",slots:{}}}},computed:Object.assign({},{}),methods:{dispatchEvent:function(e,t,i){this.$emit(e,(0,_ui.createEvent)(i,{$carouselItem:this},t))},renderVN:function(e){return e("div",{ref:"refElem"})}},watch:{name:function(e){this.itemConfig.name=e},url:function(e){this.itemConfig.url=e}},created:function(){var e=this,t=e.$scopedSlots;Object.assign(e.itemConfig,{name:e.name,url:e.url,className:e.className,slots:t})},mounted:function(){var e=this,t=e.itemConfig,i=e.$xeCarousel,e=e.$refs.refElem;i&&e&&(0,_util.assembleCarouselItem)(i,e,t)},beforeDestroy:function(){var e=this.itemConfig,t=this.$xeCarousel;t&&(0,_util.destroyCarouselItem)(t,e)},render:function(e){return this.renderVN(e)}});
|
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _comp = require("../../ui/src/comp");
|
|
8
|
+
var _xeUtils = _interopRequireDefault(require("xe-utils"));
|
|
9
|
+
var _ui = require("../../ui");
|
|
10
|
+
var _vn = require("../../ui/src/vn");
|
|
11
|
+
var _dom = require("../..//ui/src/dom");
|
|
12
|
+
var _loading = _interopRequireDefault(require("../../loading/src/loading"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
var _default2 = exports.default = (0, _comp.defineVxeComponent)({
|
|
15
|
+
name: 'VxeCarousel',
|
|
16
|
+
mixins: [_ui.globalMixins.sizeMixin],
|
|
17
|
+
props: {
|
|
18
|
+
value: [String, Number],
|
|
19
|
+
options: Array,
|
|
20
|
+
loading: Boolean,
|
|
21
|
+
height: {
|
|
22
|
+
type: [Number, String],
|
|
23
|
+
default: function _default() {
|
|
24
|
+
return (0, _ui.getConfig)().carousel.height;
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
width: {
|
|
28
|
+
type: [Number, String],
|
|
29
|
+
default: function _default() {
|
|
30
|
+
return (0, _ui.getConfig)().carousel.width;
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
autoPlay: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: function _default() {
|
|
36
|
+
return (0, _ui.getConfig)().carousel.autoPlay;
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
interval: {
|
|
40
|
+
type: [Number, String],
|
|
41
|
+
default: function _default() {
|
|
42
|
+
return (0, _ui.getConfig)().carousel.interval;
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
loop: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: function _default() {
|
|
48
|
+
return (0, _ui.getConfig)().carousel.loop;
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
vertical: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: function _default() {
|
|
54
|
+
return (0, _ui.getConfig)().carousel.vertical;
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
showIndicators: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: function _default() {
|
|
60
|
+
return (0, _ui.getConfig)().carousel.showIndicators;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
data: function data() {
|
|
65
|
+
var xID = _xeUtils.default.uniqueId();
|
|
66
|
+
var reactData = {
|
|
67
|
+
activeName: '',
|
|
68
|
+
staticItems: [],
|
|
69
|
+
itemWidth: 0,
|
|
70
|
+
itemHeight: 0
|
|
71
|
+
};
|
|
72
|
+
var internalData = {
|
|
73
|
+
apTimeout: undefined,
|
|
74
|
+
stopFlag: false
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
xID: xID,
|
|
78
|
+
reactData: reactData,
|
|
79
|
+
internalData: internalData
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
provide: function provide() {
|
|
83
|
+
var $xeCarousel = this;
|
|
84
|
+
return {
|
|
85
|
+
$xeCarousel: $xeCarousel
|
|
86
|
+
};
|
|
87
|
+
},
|
|
88
|
+
computed: Object.assign(Object.assign({}, {}), {
|
|
89
|
+
computeListStyle: function computeListStyle() {
|
|
90
|
+
var $xeCarousel = this;
|
|
91
|
+
var props = $xeCarousel;
|
|
92
|
+
var reactData = $xeCarousel.reactData;
|
|
93
|
+
var vertical = props.vertical,
|
|
94
|
+
options = props.options;
|
|
95
|
+
var activeName = reactData.activeName,
|
|
96
|
+
itemWidth = reactData.itemWidth,
|
|
97
|
+
itemHeight = reactData.itemHeight,
|
|
98
|
+
staticItems = reactData.staticItems;
|
|
99
|
+
var list = (staticItems && staticItems.length ? staticItems : options) || [];
|
|
100
|
+
var activeIndex = Math.max(0, _xeUtils.default.findIndexOf(list, function (item) {
|
|
101
|
+
return item.name === activeName;
|
|
102
|
+
}));
|
|
103
|
+
var stys = {};
|
|
104
|
+
if (vertical) {
|
|
105
|
+
stys.transform = "translateY(-".concat(activeIndex * itemHeight, "px)");
|
|
106
|
+
} else {
|
|
107
|
+
stys.width = "".concat(itemWidth * list.length, "px");
|
|
108
|
+
stys.transform = "translateX(-".concat(activeIndex * itemWidth, "px)");
|
|
109
|
+
}
|
|
110
|
+
return stys;
|
|
111
|
+
}
|
|
112
|
+
}),
|
|
113
|
+
methods: {
|
|
114
|
+
//
|
|
115
|
+
// Method
|
|
116
|
+
//
|
|
117
|
+
dispatchEvent: function dispatchEvent(type, params, evnt) {
|
|
118
|
+
var $xeCarousel = this;
|
|
119
|
+
$xeCarousel.$emit(type, (0, _ui.createEvent)(evnt, {
|
|
120
|
+
$carousel: $xeCarousel
|
|
121
|
+
}, params));
|
|
122
|
+
},
|
|
123
|
+
prev: function prev() {
|
|
124
|
+
var $xeCarousel = this;
|
|
125
|
+
if ($xeCarousel.handlePrevNext(false)) {
|
|
126
|
+
$xeCarousel.handleAutoPlay();
|
|
127
|
+
}
|
|
128
|
+
return $xeCarousel.$nextTick();
|
|
129
|
+
},
|
|
130
|
+
next: function next() {
|
|
131
|
+
var $xeCarousel = this;
|
|
132
|
+
if ($xeCarousel.handlePrevNext(true)) {
|
|
133
|
+
$xeCarousel.handleAutoPlay();
|
|
134
|
+
}
|
|
135
|
+
return $xeCarousel.$nextTick();
|
|
136
|
+
},
|
|
137
|
+
updateStyle: function updateStyle() {
|
|
138
|
+
var $xeCarousel = this;
|
|
139
|
+
var reactData = $xeCarousel.reactData;
|
|
140
|
+
$xeCarousel.$nextTick(function () {
|
|
141
|
+
var wrapperElem = $xeCarousel.$refs.refWrapperElem;
|
|
142
|
+
if (wrapperElem) {
|
|
143
|
+
reactData.itemWidth = wrapperElem.clientWidth;
|
|
144
|
+
reactData.itemHeight = wrapperElem.clientHeight;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
},
|
|
148
|
+
clickItemEvent: function clickItemEvent(evnt, item) {
|
|
149
|
+
var $xeCarousel = this;
|
|
150
|
+
var reactData = $xeCarousel.reactData;
|
|
151
|
+
var value = item.name;
|
|
152
|
+
reactData.activeName = item.name;
|
|
153
|
+
$xeCarousel.$emit('input', value);
|
|
154
|
+
$xeCarousel.$emit('change', {
|
|
155
|
+
value: value
|
|
156
|
+
}, evnt);
|
|
157
|
+
$xeCarousel.updateStyle();
|
|
158
|
+
},
|
|
159
|
+
initDefaultActive: function initDefaultActive(list) {
|
|
160
|
+
var $xeCarousel = this;
|
|
161
|
+
var props = $xeCarousel;
|
|
162
|
+
var reactData = $xeCarousel.reactData;
|
|
163
|
+
var activeName = null;
|
|
164
|
+
if (list && list.length) {
|
|
165
|
+
var validVal = false;
|
|
166
|
+
activeName = props.value;
|
|
167
|
+
list.forEach(function (item) {
|
|
168
|
+
if (activeName === item.name) {
|
|
169
|
+
validVal = true;
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
if (!validVal) {
|
|
173
|
+
activeName = list[0].name;
|
|
174
|
+
$xeCarousel.$emit('input', activeName);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
reactData.activeName = activeName;
|
|
178
|
+
},
|
|
179
|
+
handlePrevNext: function handlePrevNext(isNext) {
|
|
180
|
+
var $xeCarousel = this;
|
|
181
|
+
var props = $xeCarousel;
|
|
182
|
+
var reactData = $xeCarousel.reactData;
|
|
183
|
+
var options = props.options,
|
|
184
|
+
loop = props.loop;
|
|
185
|
+
var activeName = reactData.activeName,
|
|
186
|
+
staticItems = reactData.staticItems;
|
|
187
|
+
var list = (staticItems && staticItems.length ? staticItems : options) || [];
|
|
188
|
+
var index = Math.max(0, _xeUtils.default.findIndexOf(list, function (item) {
|
|
189
|
+
return item.name === activeName;
|
|
190
|
+
}));
|
|
191
|
+
if (index > -1) {
|
|
192
|
+
var item = null;
|
|
193
|
+
if (isNext) {
|
|
194
|
+
if (index < list.length - 1) {
|
|
195
|
+
item = list[index + 1];
|
|
196
|
+
} else {
|
|
197
|
+
if (loop) {
|
|
198
|
+
item = list[0];
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
} else {
|
|
202
|
+
if (index > 0) {
|
|
203
|
+
item = list[index - 1];
|
|
204
|
+
} else {
|
|
205
|
+
if (loop) {
|
|
206
|
+
item = list[list.length - 1];
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (item) {
|
|
211
|
+
var name = item.name;
|
|
212
|
+
var value = name;
|
|
213
|
+
reactData.activeName = name;
|
|
214
|
+
$xeCarousel.$emit('input', value);
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return false;
|
|
219
|
+
},
|
|
220
|
+
prevEvent: function prevEvent(evnt) {
|
|
221
|
+
var $xeCarousel = this;
|
|
222
|
+
var reactData = $xeCarousel.reactData;
|
|
223
|
+
if ($xeCarousel.handlePrevNext(false)) {
|
|
224
|
+
var value = reactData.activeName;
|
|
225
|
+
$xeCarousel.$emit('change', {
|
|
226
|
+
value: value
|
|
227
|
+
}, evnt);
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
nextEvent: function nextEvent(evnt) {
|
|
231
|
+
var $xeCarousel = this;
|
|
232
|
+
var reactData = $xeCarousel.reactData;
|
|
233
|
+
if ($xeCarousel.handlePrevNext(true)) {
|
|
234
|
+
var value = reactData.activeName;
|
|
235
|
+
$xeCarousel.$emit('change', {
|
|
236
|
+
value: value
|
|
237
|
+
}, evnt);
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
stopAutoPlay: function stopAutoPlay() {
|
|
241
|
+
var $xeCarousel = this;
|
|
242
|
+
var internalData = $xeCarousel.internalData;
|
|
243
|
+
var apTimeout = internalData.apTimeout;
|
|
244
|
+
internalData.stopFlag = true;
|
|
245
|
+
if (apTimeout) {
|
|
246
|
+
clearTimeout(apTimeout);
|
|
247
|
+
internalData.apTimeout = undefined;
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
handleAutoPlay: function handleAutoPlay() {
|
|
251
|
+
var $xeCarousel = this;
|
|
252
|
+
var props = $xeCarousel;
|
|
253
|
+
var internalData = $xeCarousel.internalData;
|
|
254
|
+
var autoPlay = props.autoPlay,
|
|
255
|
+
interval = props.interval;
|
|
256
|
+
var stopFlag = internalData.stopFlag;
|
|
257
|
+
$xeCarousel.stopAutoPlay();
|
|
258
|
+
if (autoPlay) {
|
|
259
|
+
internalData.stopFlag = false;
|
|
260
|
+
internalData.apTimeout = setTimeout(function () {
|
|
261
|
+
if (!stopFlag) {
|
|
262
|
+
$xeCarousel.handlePrevNext(true);
|
|
263
|
+
}
|
|
264
|
+
}, _xeUtils.default.toNumber(interval) || 300);
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
mouseenterEvent: function mouseenterEvent() {
|
|
268
|
+
var $xeCarousel = this;
|
|
269
|
+
$xeCarousel.stopAutoPlay();
|
|
270
|
+
},
|
|
271
|
+
mouseleaveEvent: function mouseleaveEvent() {
|
|
272
|
+
var $xeCarousel = this;
|
|
273
|
+
$xeCarousel.handleAutoPlay();
|
|
274
|
+
},
|
|
275
|
+
callSlot: function callSlot(slotFunc, params) {
|
|
276
|
+
var $xeCarousel = this;
|
|
277
|
+
var slots = $xeCarousel.$scopedSlots;
|
|
278
|
+
if (slotFunc) {
|
|
279
|
+
if (_xeUtils.default.isString(slotFunc)) {
|
|
280
|
+
slotFunc = slots[slotFunc] || null;
|
|
281
|
+
}
|
|
282
|
+
if (_xeUtils.default.isFunction(slotFunc)) {
|
|
283
|
+
return (0, _vn.getSlotVNs)(slotFunc(params));
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return [];
|
|
287
|
+
},
|
|
288
|
+
//
|
|
289
|
+
// Render
|
|
290
|
+
//
|
|
291
|
+
renderItemWrapper: function renderItemWrapper(h, list) {
|
|
292
|
+
var $xeCarousel = this;
|
|
293
|
+
var props = $xeCarousel;
|
|
294
|
+
var reactData = $xeCarousel.reactData;
|
|
295
|
+
var height = props.height;
|
|
296
|
+
var activeName = reactData.activeName;
|
|
297
|
+
var listStyle = $xeCarousel.computeListStyle;
|
|
298
|
+
return h('div', {
|
|
299
|
+
class: 'vxe-carousel--list',
|
|
300
|
+
style: listStyle
|
|
301
|
+
}, list.map(function (item) {
|
|
302
|
+
var name = item.name,
|
|
303
|
+
url = item.url,
|
|
304
|
+
slots = item.slots;
|
|
305
|
+
var defaultSlot = slots ? slots.default : null;
|
|
306
|
+
return h('div', {
|
|
307
|
+
key: "".concat(name),
|
|
308
|
+
class: ['vxe-carousel--item-inner', {
|
|
309
|
+
'is--active': activeName === name
|
|
310
|
+
}],
|
|
311
|
+
style: height ? {
|
|
312
|
+
height: (0, _dom.toCssUnit)(height)
|
|
313
|
+
} : {}
|
|
314
|
+
}, defaultSlot ? $xeCarousel.callSlot(defaultSlot, {}) : [h('img', {
|
|
315
|
+
class: 'vxe-carousel--item-img',
|
|
316
|
+
attrs: {
|
|
317
|
+
src: url
|
|
318
|
+
}
|
|
319
|
+
})]);
|
|
320
|
+
}));
|
|
321
|
+
},
|
|
322
|
+
renderIndicators: function renderIndicators(h, list) {
|
|
323
|
+
var $xeCarousel = this;
|
|
324
|
+
var reactData = $xeCarousel.reactData;
|
|
325
|
+
var activeName = reactData.activeName;
|
|
326
|
+
return h('div', {
|
|
327
|
+
class: 'vxe-carousel--indicators'
|
|
328
|
+
}, list.map(function (item) {
|
|
329
|
+
var name = item.name;
|
|
330
|
+
return h('div', {
|
|
331
|
+
key: "".concat(name),
|
|
332
|
+
class: ['vxe-carousel--indicators-item', {
|
|
333
|
+
'is--active': activeName === name
|
|
334
|
+
}],
|
|
335
|
+
on: {
|
|
336
|
+
click: function click(evnt) {
|
|
337
|
+
$xeCarousel.clickItemEvent(evnt, item);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
}));
|
|
342
|
+
},
|
|
343
|
+
renderVN: function renderVN(h) {
|
|
344
|
+
var $xeCarousel = this;
|
|
345
|
+
var props = $xeCarousel;
|
|
346
|
+
var slots = $xeCarousel.$scopedSlots;
|
|
347
|
+
var reactData = $xeCarousel.reactData;
|
|
348
|
+
var loading = props.loading,
|
|
349
|
+
height = props.height,
|
|
350
|
+
width = props.width,
|
|
351
|
+
showIndicators = props.showIndicators,
|
|
352
|
+
vertical = props.vertical,
|
|
353
|
+
options = props.options;
|
|
354
|
+
var staticItems = reactData.staticItems;
|
|
355
|
+
var defaultSlot = slots.default;
|
|
356
|
+
var list = (staticItems && staticItems.length ? staticItems : options) || [];
|
|
357
|
+
return h('div', {
|
|
358
|
+
ref: 'refElem',
|
|
359
|
+
class: ['vxe-carousel', "is--".concat(vertical ? 'vertical' : 'horizontal')],
|
|
360
|
+
style: width ? {
|
|
361
|
+
width: (0, _dom.toCssUnit)(width)
|
|
362
|
+
} : {},
|
|
363
|
+
on: {
|
|
364
|
+
mouseenter: $xeCarousel.mouseenterEvent,
|
|
365
|
+
mouseleave: $xeCarousel.mouseleaveEvent
|
|
366
|
+
}
|
|
367
|
+
}, [h('div', {
|
|
368
|
+
class: 'vxe-carousel--slots'
|
|
369
|
+
}, defaultSlot ? defaultSlot({}) : []), h('div', {
|
|
370
|
+
ref: 'refWrapperElem',
|
|
371
|
+
class: 'vxe-carousel--item-wrapper',
|
|
372
|
+
style: height ? {
|
|
373
|
+
height: (0, _dom.toCssUnit)(height)
|
|
374
|
+
} : {}
|
|
375
|
+
}, [$xeCarousel.renderItemWrapper(h, list)]), showIndicators ? $xeCarousel.renderIndicators(h, list) : (0, _ui.renderEmptyElement)($xeCarousel), h('div', {
|
|
376
|
+
class: 'vxe-carousel--btn-wrapper'
|
|
377
|
+
}, [h('div', {
|
|
378
|
+
class: 'vxe-carousel--previous-btn',
|
|
379
|
+
on: {
|
|
380
|
+
click: $xeCarousel.prevEvent
|
|
381
|
+
}
|
|
382
|
+
}, [h('i', {
|
|
383
|
+
class: vertical ? (0, _ui.getIcon)().CAROUSEL_VERTICAL_PREVIOUS : (0, _ui.getIcon)().CAROUSEL_HORIZONTAL_PREVIOUS
|
|
384
|
+
})]), h('div', {
|
|
385
|
+
class: 'vxe-carousel--next-btn',
|
|
386
|
+
on: {
|
|
387
|
+
click: $xeCarousel.nextEvent
|
|
388
|
+
}
|
|
389
|
+
}, [h('i', {
|
|
390
|
+
class: vertical ? (0, _ui.getIcon)().CAROUSEL_VERTICAL_NEXT : (0, _ui.getIcon)().CAROUSEL_HORIZONTAL_NEXT
|
|
391
|
+
})])]),
|
|
392
|
+
/**
|
|
393
|
+
* 加载中
|
|
394
|
+
*/
|
|
395
|
+
h(_loading.default, {
|
|
396
|
+
class: 'vxe-carousel--loading',
|
|
397
|
+
props: {
|
|
398
|
+
value: loading
|
|
399
|
+
}
|
|
400
|
+
})]);
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
watch: {
|
|
404
|
+
options: function options() {
|
|
405
|
+
var $xeCarousel = this;
|
|
406
|
+
var props = $xeCarousel;
|
|
407
|
+
$xeCarousel.initDefaultActive(props.options);
|
|
408
|
+
},
|
|
409
|
+
'reactData.staticItems': function reactDataStaticItems() {
|
|
410
|
+
var $xeCarousel = this;
|
|
411
|
+
var reactData = $xeCarousel.reactData;
|
|
412
|
+
$xeCarousel.initDefaultActive(reactData.staticItems);
|
|
413
|
+
},
|
|
414
|
+
autoPlay: function autoPlay() {
|
|
415
|
+
var $xeCarousel = this;
|
|
416
|
+
$xeCarousel.handleAutoPlay();
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
created: function created() {
|
|
420
|
+
var $xeCarousel = this;
|
|
421
|
+
var props = $xeCarousel;
|
|
422
|
+
var reactData = $xeCarousel.reactData;
|
|
423
|
+
$xeCarousel.initDefaultActive(reactData.staticItems.length ? reactData.staticItems : props.options);
|
|
424
|
+
},
|
|
425
|
+
mounted: function mounted() {
|
|
426
|
+
var $xeCarousel = this;
|
|
427
|
+
$xeCarousel.handleAutoPlay();
|
|
428
|
+
$xeCarousel.updateStyle();
|
|
429
|
+
},
|
|
430
|
+
beforeDestroy: function beforeDestroy() {
|
|
431
|
+
var $xeCarousel = this;
|
|
432
|
+
$xeCarousel.stopAutoPlay();
|
|
433
|
+
},
|
|
434
|
+
render: function render(h) {
|
|
435
|
+
return this.renderVN(h);
|
|
436
|
+
}
|
|
437
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _comp=require("../../ui/src/comp"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_vn=require("../../ui/src/vn"),_dom=require("../..//ui/src/dom"),_loading=_interopRequireDefault(require("../../loading/src/loading"));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}var _default2=exports.default=(0,_comp.defineVxeComponent)({name:"VxeCarousel",mixins:[_ui.globalMixins.sizeMixin],props:{value:[String,Number],options:Array,loading:Boolean,height:{type:[Number,String],default:function(){return(0,_ui.getConfig)().carousel.height}},width:{type:[Number,String],default:function(){return(0,_ui.getConfig)().carousel.width}},autoPlay:{type:Boolean,default:function(){return(0,_ui.getConfig)().carousel.autoPlay}},interval:{type:[Number,String],default:function(){return(0,_ui.getConfig)().carousel.interval}},loop:{type:Boolean,default:function(){return(0,_ui.getConfig)().carousel.loop}},vertical:{type:Boolean,default:function(){return(0,_ui.getConfig)().carousel.vertical}},showIndicators:{type:Boolean,default:function(){return(0,_ui.getConfig)().carousel.showIndicators}}},data:function(){return{xID:_xeUtils.default.uniqueId(),reactData:{activeName:"",staticItems:[],itemWidth:0,itemHeight:0},internalData:{apTimeout:void 0,stopFlag:!1}}},provide:function(){return{$xeCarousel:this}},computed:Object.assign(Object.assign({},{}),{computeListStyle:function(){var t=this.reactData,e=this.vertical,i=this.options,a=t.activeName,n=t.itemWidth,r=t.itemHeight,t=t.staticItems,t=(t&&t.length?t:i)||[],i=Math.max(0,_xeUtils.default.findIndexOf(t,function(t){return t.name===a})),o={};return e?o.transform="translateY(-".concat(i*r,"px)"):(o.width="".concat(n*t.length,"px"),o.transform="translateX(-".concat(i*n,"px)")),o}}),methods:{dispatchEvent:function(t,e,i){this.$emit(t,(0,_ui.createEvent)(i,{$carousel:this},e))},prev:function(){var t=this;return t.handlePrevNext(!1)&&t.handleAutoPlay(),t.$nextTick()},next:function(){var t=this;return t.handlePrevNext(!0)&&t.handleAutoPlay(),t.$nextTick()},updateStyle:function(){var e=this,i=e.reactData;e.$nextTick(function(){var t=e.$refs.refWrapperElem;t&&(i.itemWidth=t.clientWidth,i.itemHeight=t.clientHeight)})},clickItemEvent:function(t,e){var i=this,a=i.reactData,n=e.name;a.activeName=e.name,i.$emit("input",n),i.$emit("change",{value:n},t),i.updateStyle()},initDefaultActive:function(t){var e,i=this,a=i.reactData,n=null;t&&t.length&&(e=!1,n=i.value,t.forEach(function(t){n===t.name&&(e=!0)}),e||(n=t[0].name,i.$emit("input",n))),a.activeName=n},handlePrevNext:function(t){var e=this.reactData,i=this.options,a=this.loop,n=e.activeName,r=e.staticItems,r=(r&&r.length?r:i)||[],i=Math.max(0,_xeUtils.default.findIndexOf(r,function(t){return t.name===n}));if(-1<i){var o=null;if(t?i<r.length-1?o=r[i+1]:a&&(o=r[0]):0<i?o=r[i-1]:a&&(o=r[r.length-1]),o)return t=o.name,e.activeName=t,this.$emit("input",t),!0}return!1},prevEvent:function(t){var e=this.reactData;this.handlePrevNext(!1)&&(e=e.activeName,this.$emit("change",{value:e},t))},nextEvent:function(t){var e=this.reactData;this.handlePrevNext(!0)&&(e=e.activeName,this.$emit("change",{value:e},t))},stopAutoPlay:function(){var t=this.internalData,e=t.apTimeout;t.stopFlag=!0,e&&(clearTimeout(e),t.apTimeout=void 0)},handleAutoPlay:function(){var t=this,e=t.internalData,i=t.autoPlay,a=t.interval,n=e.stopFlag;t.stopAutoPlay(),i&&(e.stopFlag=!1,e.apTimeout=setTimeout(function(){n||t.handlePrevNext(!0)},_xeUtils.default.toNumber(a)||300))},mouseenterEvent:function(){this.stopAutoPlay()},mouseleaveEvent:function(){this.handleAutoPlay()},callSlot:function(t,e){var i=this.$scopedSlots;return t&&(_xeUtils.default.isString(t)&&(t=i[t]||null),_xeUtils.default.isFunction(t))?(0,_vn.getSlotVNs)(t(e)):[]},renderItemWrapper:function(a,t){var n=this,e=n.reactData,r=n.height,o=e.activeName;return a("div",{class:"vxe-carousel--list",style:n.computeListStyle},t.map(function(t){var e=t.name,i=t.url,t=t.slots,t=t?t.default:null;return a("div",{key:"".concat(e),class:["vxe-carousel--item-inner",{"is--active":o===e}],style:r?{height:(0,_dom.toCssUnit)(r)}:{}},t?n.callSlot(t,{}):[a("img",{class:"vxe-carousel--item-img",attrs:{src:i}})])}))},renderIndicators:function(i,t){var a=this,n=a.reactData.activeName;return i("div",{class:"vxe-carousel--indicators"},t.map(function(e){var t=e.name;return i("div",{key:"".concat(t),class:["vxe-carousel--indicators-item",{"is--active":n===t}],on:{click:function(t){a.clickItemEvent(t,e)}}})}))},renderVN:function(t){var e=this,i=e.$scopedSlots,a=e.loading,n=e.height,r=e.width,o=e.showIndicators,u=e.vertical,s=e.reactData.staticItems,i=i.default,s=(s&&s.length?s:e.options)||[];return t("div",{ref:"refElem",class:["vxe-carousel","is--".concat(u?"vertical":"horizontal")],style:r?{width:(0,_dom.toCssUnit)(r)}:{},on:{mouseenter:e.mouseenterEvent,mouseleave:e.mouseleaveEvent}},[t("div",{class:"vxe-carousel--slots"},i?i({}):[]),t("div",{ref:"refWrapperElem",class:"vxe-carousel--item-wrapper",style:n?{height:(0,_dom.toCssUnit)(n)}:{}},[e.renderItemWrapper(t,s)]),o?e.renderIndicators(t,s):(0,_ui.renderEmptyElement)(e),t("div",{class:"vxe-carousel--btn-wrapper"},[t("div",{class:"vxe-carousel--previous-btn",on:{click:e.prevEvent}},[t("i",{class:u?(0,_ui.getIcon)().CAROUSEL_VERTICAL_PREVIOUS:(0,_ui.getIcon)().CAROUSEL_HORIZONTAL_PREVIOUS})]),t("div",{class:"vxe-carousel--next-btn",on:{click:e.nextEvent}},[t("i",{class:u?(0,_ui.getIcon)().CAROUSEL_VERTICAL_NEXT:(0,_ui.getIcon)().CAROUSEL_HORIZONTAL_NEXT})])]),t(_loading.default,{class:"vxe-carousel--loading",props:{value:a}})])}},watch:{options:function(){this.initDefaultActive(this.options)},"reactData.staticItems":function(){var t=this.reactData;this.initDefaultActive(t.staticItems)},autoPlay:function(){this.handleAutoPlay()}},created:function(){var t=this.reactData;this.initDefaultActive(t.staticItems.length?t.staticItems:this.options)},mounted:function(){this.handleAutoPlay(),this.updateStyle()},beforeDestroy:function(){this.stopAutoPlay()},render:function(t){return this.renderVN(t)}});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.assembleCarouselItem = assembleCarouselItem;
|
|
7
|
+
exports.destroyCarouselItem = destroyCarouselItem;
|
|
8
|
+
var _xeUtils = _interopRequireDefault(require("xe-utils"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
function assembleCarouselItem($xeCarousel, elem, itemConfig) {
|
|
11
|
+
var staticItems = $xeCarousel.reactData.staticItems;
|
|
12
|
+
var parentElem = elem.parentNode;
|
|
13
|
+
if (parentElem) {
|
|
14
|
+
staticItems.splice(_xeUtils.default.arrayIndexOf(parentElem.children, elem), 0, itemConfig);
|
|
15
|
+
}
|
|
16
|
+
$xeCarousel.reactData.staticItems = staticItems.slice(0);
|
|
17
|
+
}
|
|
18
|
+
function destroyCarouselItem($xeCarousel, itemConfig) {
|
|
19
|
+
var staticItems = $xeCarousel.reactData.staticItems;
|
|
20
|
+
var index = _xeUtils.default.findIndexOf(staticItems, function (item) {
|
|
21
|
+
return item.id === itemConfig.id;
|
|
22
|
+
});
|
|
23
|
+
if (index > -1) {
|
|
24
|
+
staticItems.splice(index, 1);
|
|
25
|
+
}
|
|
26
|
+
$xeCarousel.reactData.staticItems = staticItems.slice(0);
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.assembleCarouselItem=assembleCarouselItem,exports.destroyCarouselItem=destroyCarouselItem;var _xeUtils=_interopRequireDefault(require("xe-utils"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function assembleCarouselItem(e,t,a){var s=e.reactData.staticItems,r=t.parentNode;r&&s.splice(_xeUtils.default.arrayIndexOf(r.children,t),0,a),e.reactData.staticItems=s.slice(0)}function destroyCarouselItem(e,t){var a=e.reactData.staticItems,s=_xeUtils.default.findIndexOf(a,function(e){return e.id===t.id});-1<s&&a.splice(s,1),e.reactData.staticItems=a.slice(0)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require('./style.css')
|