ant-design-vue/components/vc-slick/inner-slider.jsx

754 lines
23 KiB
Vue
Raw Normal View History

import debounce from 'lodash-es/debounce';
import ResizeObserver from 'resize-observer-polyfill';
import classnames from '../_util/classNames';
import BaseMixin from '../_util/BaseMixin';
2019-01-12 11:33:27 +08:00
import defaultProps from './default-props';
import initialState from './initial-state';
2018-07-20 16:13:21 +08:00
import {
getOnDemandLazySlides,
extractObject,
initializedState,
getHeight,
canGoNext,
slideHandler,
changeSlide,
keyHandler,
swipeStart,
swipeMove,
swipeEnd,
getPreClones,
getPostClones,
getTrackLeft,
getTrackCSS,
2019-01-12 11:33:27 +08:00
} from './utils/innerSliderUtils';
import Track from './track';
import Dots from './dots';
import { PrevArrow, NextArrow } from './arrows';
import supportsPassive from '../_util/supportsPassive';
2018-07-20 16:13:21 +08:00
2019-01-12 11:33:27 +08:00
function noop() {}
2018-07-20 16:13:21 +08:00
export default {
2020-07-20 16:29:46 +08:00
name: 'InnerSlider',
3.0 ready (#4523) * refactor: transfer、tooltip (#4306) * refactor(transfer): use composition api (#4135) * refactor(transfer): use composition api * fix: remove console * refactor(tooltip): use composition api (#4059) * refactor(tooltip): use composition api * chore: useConfigInject * fix: remove useless * style: format code * refactor: transfer * refactor: tooltip Co-authored-by: ajuner <106791576@qq.com> * Refactor mentions (#4341) * refactor(mentions): use compositionAPI (#4313) * refactor: mentions * refactor: mentions Co-authored-by: ajuner <106791576@qq.com> * Refactor progress (#4358) * fix: timepicker error border not show #4331 * fix(UploadDragger): fix UploadDrager no export (#4334) * refactor(switch): support customize checked value #4329 (#4332) * refactor(switch): support customize checked value #4329 * test: add test case * refactor: update props name * refactor: update ts * refactor: optimize * style: uncheckedValue to unCheckedValue * test: update snap * feat: udpate switch ts * docs: remove ie11 * fix: tree-select throw error when use slot title * fix: TypeScript definition of Table interface for typescript 4.3.5 (#4353) * fix type for typescript 4.3.5 * Update interface.ts close #4296 * fix: dropdown submenu style error #4351 close #4351 * fix(notification): 完善notification类型 (#4346) * refactor(progress): use composition API (#4355) * refactor(progress): use composition API * refactor(vc-progress): update * refactor: progress * refactor: progress * fix: timepicker error border not show #4331 * fix(UploadDragger): fix UploadDrager no export (#4334) * refactor(switch): support customize checked value #4329 (#4332) * refactor(switch): support customize checked value #4329 * test: add test case * refactor: update props name * refactor: update ts * refactor: optimize * style: uncheckedValue to unCheckedValue * test: update snap * feat: udpate switch ts * docs: remove ie11 * fix: tree-select throw error when use slot title * fix: TypeScript definition of Table interface for typescript 4.3.5 (#4353) * fix type for typescript 4.3.5 * Update interface.ts close #4296 * fix: dropdown submenu style error #4351 close #4351 * fix(notification): 完善notification类型 (#4346) * refactor(progress): use composition API (#4355) * refactor(progress): use composition API * refactor(vc-progress): update * refactor: progress * refactor: progress Co-authored-by: Jarvis <35361626+fanhaoyuan@users.noreply.github.com> Co-authored-by: John <John60676@qq.com> Co-authored-by: 艾斯特洛 <axetroy.dev@gmail.com> Co-authored-by: zanllp <qc@zanllp.cn> * docs: add changelog * refactor: tree * refactor: tree * style: lint * refactor: tree * 热factor: tree * refactor: tree * refactor: tree * refactor: tree * refactor: directory tree * refactor: tree * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * style: lint format * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * fix: upload ts error * fix: update tree title render & switchIcon * test: update tree test * feat: add VirtualScroll tree * refactor: datePicker & calendar & trigger (#4522) * style: update * test: update calendar test * test: update test * test: update test * refactor: slider * feat: update slider css * refactor: slider to ts * refactor: slider to ts * perf: update default itemHeight * test: update * fix: uddate ts type * fix: update skeleton * fix: update skeleton * refactor: update vc-pagination * refactor: pagination * refactor: timeline * refactor: steps * refactor: collapse * refactor: collapse * refactor: popconfirm * refactor: popover * refactor: dropdown * doc: merge doc * chore: vite for dev (#4602) * style: js to jsx * doc: add site * style: lint * style: format ts type * doc: update * style: format code * style: format site * doc: update * style: dmeo * style: format scripts * chore: remove sub-modules * chore: update vite * site: add site build * test: update snap * doc(select): add tip (#4606) * refactor: table (#4641) * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * fix: column not pass to cell * doc: uppate table * fix: update bodyCell headerCell * doc: remove examples * refactor: table * fix: table title not work * fix: table selection * fix: table checkStrictly * refactor: table * fix: table template error * feat: table support summary * test: update snap * perf: table * docs(table): fix ajax demo (#4639) * test: update table * refactor: remove old table * doc: update table doc * doc: update doc * doc: update select * doc: update summary Co-authored-by: John <John60676@qq.com> * doc: update doc * fix: menu arrow not work * test: update * doc: add next site * style: format * doc: update * doc: update site script * fix: expand icon not fixed * feat: use renderSlot * test: update table snap * feat: confirm support reactively * feat: configProvider.config * feat: message support configprovider.config * feat: notification support configprovider.config * doc: update doc * fix: typescript compile error * style: add import eslint * doc: update demo * chore: set transpileOnly true * style: fix eslint error * test: update snap * doc: update * test: mock date * test: update snap * chore: remove gulp-typescript (#4675) * feat: V3 form (#4678) * chore: update husky * perf: update formItem * perf: useInjectFormItemContext * fix: table ts error * doc: add Customized Form Controls demo * feat: export useInjectFormItemContext * doc: update form doc * doc: update doc * doc: update doc * feat: autocomplete support option slot * doc: update * feat: add form item rest * style: remove omit.js * refactor: autocomplete * doc: add changelog to site * doc: update site anchor * doc: update doc layout * test: update table test * doc: update * chore: udpate gulp script * chore: udpate gulp script * doc: add changelog * doc: update * test: ignore some test wait vue-test-utils * fix: form id error #4582 close #4582 * doc: add select Responsive demo * doc: remove temp doc Co-authored-by: ajuner <106791576@qq.com> Co-authored-by: Jarvis <35361626+fanhaoyuan@users.noreply.github.com> Co-authored-by: John <John60676@qq.com> Co-authored-by: 艾斯特洛 <axetroy.dev@gmail.com> Co-authored-by: zanllp <qc@zanllp.cn> Co-authored-by: Amour1688 <lcz_1996@foxmail.com>
2021-09-25 16:51:32 +08:00
mixins: [BaseMixin],
2020-07-20 16:29:46 +08:00
inheritAttrs: false,
2018-07-20 16:13:21 +08:00
props: {
...defaultProps,
},
2019-01-12 11:33:27 +08:00
data() {
this.preProps = { ...this.$props };
this.list = null;
this.track = null;
this.callbackTimers = [];
this.clickable = true;
this.debouncedResize = null;
const ssrState = this.ssrInit();
2018-07-20 16:13:21 +08:00
return {
...initialState,
currentSlide: this.initialSlide,
slideCount: this.children.length,
...ssrState,
2019-01-12 11:33:27 +08:00
};
2018-07-20 16:13:21 +08:00
},
3.0 ready (#4523) * refactor: transfer、tooltip (#4306) * refactor(transfer): use composition api (#4135) * refactor(transfer): use composition api * fix: remove console * refactor(tooltip): use composition api (#4059) * refactor(tooltip): use composition api * chore: useConfigInject * fix: remove useless * style: format code * refactor: transfer * refactor: tooltip Co-authored-by: ajuner <106791576@qq.com> * Refactor mentions (#4341) * refactor(mentions): use compositionAPI (#4313) * refactor: mentions * refactor: mentions Co-authored-by: ajuner <106791576@qq.com> * Refactor progress (#4358) * fix: timepicker error border not show #4331 * fix(UploadDragger): fix UploadDrager no export (#4334) * refactor(switch): support customize checked value #4329 (#4332) * refactor(switch): support customize checked value #4329 * test: add test case * refactor: update props name * refactor: update ts * refactor: optimize * style: uncheckedValue to unCheckedValue * test: update snap * feat: udpate switch ts * docs: remove ie11 * fix: tree-select throw error when use slot title * fix: TypeScript definition of Table interface for typescript 4.3.5 (#4353) * fix type for typescript 4.3.5 * Update interface.ts close #4296 * fix: dropdown submenu style error #4351 close #4351 * fix(notification): 完善notification类型 (#4346) * refactor(progress): use composition API (#4355) * refactor(progress): use composition API * refactor(vc-progress): update * refactor: progress * refactor: progress * fix: timepicker error border not show #4331 * fix(UploadDragger): fix UploadDrager no export (#4334) * refactor(switch): support customize checked value #4329 (#4332) * refactor(switch): support customize checked value #4329 * test: add test case * refactor: update props name * refactor: update ts * refactor: optimize * style: uncheckedValue to unCheckedValue * test: update snap * feat: udpate switch ts * docs: remove ie11 * fix: tree-select throw error when use slot title * fix: TypeScript definition of Table interface for typescript 4.3.5 (#4353) * fix type for typescript 4.3.5 * Update interface.ts close #4296 * fix: dropdown submenu style error #4351 close #4351 * fix(notification): 完善notification类型 (#4346) * refactor(progress): use composition API (#4355) * refactor(progress): use composition API * refactor(vc-progress): update * refactor: progress * refactor: progress Co-authored-by: Jarvis <35361626+fanhaoyuan@users.noreply.github.com> Co-authored-by: John <John60676@qq.com> Co-authored-by: 艾斯特洛 <axetroy.dev@gmail.com> Co-authored-by: zanllp <qc@zanllp.cn> * docs: add changelog * refactor: tree * refactor: tree * style: lint * refactor: tree * 热factor: tree * refactor: tree * refactor: tree * refactor: tree * refactor: directory tree * refactor: tree * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * style: lint format * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * fix: upload ts error * fix: update tree title render & switchIcon * test: update tree test * feat: add VirtualScroll tree * refactor: datePicker & calendar & trigger (#4522) * style: update * test: update calendar test * test: update test * test: update test * refactor: slider * feat: update slider css * refactor: slider to ts * refactor: slider to ts * perf: update default itemHeight * test: update * fix: uddate ts type * fix: update skeleton * fix: update skeleton * refactor: update vc-pagination * refactor: pagination * refactor: timeline * refactor: steps * refactor: collapse * refactor: collapse * refactor: popconfirm * refactor: popover * refactor: dropdown * doc: merge doc * chore: vite for dev (#4602) * style: js to jsx * doc: add site * style: lint * style: format ts type * doc: update * style: format code * style: format site * doc: update * style: dmeo * style: format scripts * chore: remove sub-modules * chore: update vite * site: add site build * test: update snap * doc(select): add tip (#4606) * refactor: table (#4641) * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * fix: column not pass to cell * doc: uppate table * fix: update bodyCell headerCell * doc: remove examples * refactor: table * fix: table title not work * fix: table selection * fix: table checkStrictly * refactor: table * fix: table template error * feat: table support summary * test: update snap * perf: table * docs(table): fix ajax demo (#4639) * test: update table * refactor: remove old table * doc: update table doc * doc: update doc * doc: update select * doc: update summary Co-authored-by: John <John60676@qq.com> * doc: update doc * fix: menu arrow not work * test: update * doc: add next site * style: format * doc: update * doc: update site script * fix: expand icon not fixed * feat: use renderSlot * test: update table snap * feat: confirm support reactively * feat: configProvider.config * feat: message support configprovider.config * feat: notification support configprovider.config * doc: update doc * fix: typescript compile error * style: add import eslint * doc: update demo * chore: set transpileOnly true * style: fix eslint error * test: update snap * doc: update * test: mock date * test: update snap * chore: remove gulp-typescript (#4675) * feat: V3 form (#4678) * chore: update husky * perf: update formItem * perf: useInjectFormItemContext * fix: table ts error * doc: add Customized Form Controls demo * feat: export useInjectFormItemContext * doc: update form doc * doc: update doc * doc: update doc * feat: autocomplete support option slot * doc: update * feat: add form item rest * style: remove omit.js * refactor: autocomplete * doc: add changelog to site * doc: update site anchor * doc: update doc layout * test: update table test * doc: update * chore: udpate gulp script * chore: udpate gulp script * doc: add changelog * doc: update * test: ignore some test wait vue-test-utils * fix: form id error #4582 close #4582 * doc: add select Responsive demo * doc: remove temp doc Co-authored-by: ajuner <106791576@qq.com> Co-authored-by: Jarvis <35361626+fanhaoyuan@users.noreply.github.com> Co-authored-by: John <John60676@qq.com> Co-authored-by: 艾斯特洛 <axetroy.dev@gmail.com> Co-authored-by: zanllp <qc@zanllp.cn> Co-authored-by: Amour1688 <lcz_1996@foxmail.com>
2021-09-25 16:51:32 +08:00
watch: {
__propsSymbol__() {
const nextProps = this.$props;
const spec = {
listRef: this.list,
trackRef: this.track,
...nextProps,
...this.$data,
};
let setTrackStyle = false;
for (const key of Object.keys(this.preProps)) {
if (!nextProps.hasOwnProperty(key)) {
setTrackStyle = true;
break;
}
if (
typeof nextProps[key] === 'object' ||
typeof nextProps[key] === 'function' ||
typeof nextProps[key] === 'symbol'
) {
continue;
}
if (nextProps[key] !== this.preProps[key]) {
setTrackStyle = true;
break;
}
}
this.updateState(spec, setTrackStyle, () => {
if (this.currentSlide >= nextProps.children.length) {
this.changeSlide({
message: 'index',
index: nextProps.children.length - nextProps.slidesToShow,
currentSlide: this.currentSlide,
});
}
if (!this.preProps.autoplay && nextProps.autoplay) {
this.handleAutoPlay('playing');
} else if (nextProps.autoplay) {
3.0 ready (#4523) * refactor: transfer、tooltip (#4306) * refactor(transfer): use composition api (#4135) * refactor(transfer): use composition api * fix: remove console * refactor(tooltip): use composition api (#4059) * refactor(tooltip): use composition api * chore: useConfigInject * fix: remove useless * style: format code * refactor: transfer * refactor: tooltip Co-authored-by: ajuner <106791576@qq.com> * Refactor mentions (#4341) * refactor(mentions): use compositionAPI (#4313) * refactor: mentions * refactor: mentions Co-authored-by: ajuner <106791576@qq.com> * Refactor progress (#4358) * fix: timepicker error border not show #4331 * fix(UploadDragger): fix UploadDrager no export (#4334) * refactor(switch): support customize checked value #4329 (#4332) * refactor(switch): support customize checked value #4329 * test: add test case * refactor: update props name * refactor: update ts * refactor: optimize * style: uncheckedValue to unCheckedValue * test: update snap * feat: udpate switch ts * docs: remove ie11 * fix: tree-select throw error when use slot title * fix: TypeScript definition of Table interface for typescript 4.3.5 (#4353) * fix type for typescript 4.3.5 * Update interface.ts close #4296 * fix: dropdown submenu style error #4351 close #4351 * fix(notification): 完善notification类型 (#4346) * refactor(progress): use composition API (#4355) * refactor(progress): use composition API * refactor(vc-progress): update * refactor: progress * refactor: progress * fix: timepicker error border not show #4331 * fix(UploadDragger): fix UploadDrager no export (#4334) * refactor(switch): support customize checked value #4329 (#4332) * refactor(switch): support customize checked value #4329 * test: add test case * refactor: update props name * refactor: update ts * refactor: optimize * style: uncheckedValue to unCheckedValue * test: update snap * feat: udpate switch ts * docs: remove ie11 * fix: tree-select throw error when use slot title * fix: TypeScript definition of Table interface for typescript 4.3.5 (#4353) * fix type for typescript 4.3.5 * Update interface.ts close #4296 * fix: dropdown submenu style error #4351 close #4351 * fix(notification): 完善notification类型 (#4346) * refactor(progress): use composition API (#4355) * refactor(progress): use composition API * refactor(vc-progress): update * refactor: progress * refactor: progress Co-authored-by: Jarvis <35361626+fanhaoyuan@users.noreply.github.com> Co-authored-by: John <John60676@qq.com> Co-authored-by: 艾斯特洛 <axetroy.dev@gmail.com> Co-authored-by: zanllp <qc@zanllp.cn> * docs: add changelog * refactor: tree * refactor: tree * style: lint * refactor: tree * 热factor: tree * refactor: tree * refactor: tree * refactor: tree * refactor: directory tree * refactor: tree * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * style: lint format * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * fix: upload ts error * fix: update tree title render & switchIcon * test: update tree test * feat: add VirtualScroll tree * refactor: datePicker & calendar & trigger (#4522) * style: update * test: update calendar test * test: update test * test: update test * refactor: slider * feat: update slider css * refactor: slider to ts * refactor: slider to ts * perf: update default itemHeight * test: update * fix: uddate ts type * fix: update skeleton * fix: update skeleton * refactor: update vc-pagination * refactor: pagination * refactor: timeline * refactor: steps * refactor: collapse * refactor: collapse * refactor: popconfirm * refactor: popover * refactor: dropdown * doc: merge doc * chore: vite for dev (#4602) * style: js to jsx * doc: add site * style: lint * style: format ts type * doc: update * style: format code * style: format site * doc: update * style: dmeo * style: format scripts * chore: remove sub-modules * chore: update vite * site: add site build * test: update snap * doc(select): add tip (#4606) * refactor: table (#4641) * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * fix: column not pass to cell * doc: uppate table * fix: update bodyCell headerCell * doc: remove examples * refactor: table * fix: table title not work * fix: table selection * fix: table checkStrictly * refactor: table * fix: table template error * feat: table support summary * test: update snap * perf: table * docs(table): fix ajax demo (#4639) * test: update table * refactor: remove old table * doc: update table doc * doc: update doc * doc: update select * doc: update summary Co-authored-by: John <John60676@qq.com> * doc: update doc * fix: menu arrow not work * test: update * doc: add next site * style: format * doc: update * doc: update site script * fix: expand icon not fixed * feat: use renderSlot * test: update table snap * feat: confirm support reactively * feat: configProvider.config * feat: message support configprovider.config * feat: notification support configprovider.config * doc: update doc * fix: typescript compile error * style: add import eslint * doc: update demo * chore: set transpileOnly true * style: fix eslint error * test: update snap * doc: update * test: mock date * test: update snap * chore: remove gulp-typescript (#4675) * feat: V3 form (#4678) * chore: update husky * perf: update formItem * perf: useInjectFormItemContext * fix: table ts error * doc: add Customized Form Controls demo * feat: export useInjectFormItemContext * doc: update form doc * doc: update doc * doc: update doc * feat: autocomplete support option slot * doc: update * feat: add form item rest * style: remove omit.js * refactor: autocomplete * doc: add changelog to site * doc: update site anchor * doc: update doc layout * test: update table test * doc: update * chore: udpate gulp script * chore: udpate gulp script * doc: add changelog * doc: update * test: ignore some test wait vue-test-utils * fix: form id error #4582 close #4582 * doc: add select Responsive demo * doc: remove temp doc Co-authored-by: ajuner <106791576@qq.com> Co-authored-by: Jarvis <35361626+fanhaoyuan@users.noreply.github.com> Co-authored-by: John <John60676@qq.com> Co-authored-by: 艾斯特洛 <axetroy.dev@gmail.com> Co-authored-by: zanllp <qc@zanllp.cn> Co-authored-by: Amour1688 <lcz_1996@foxmail.com>
2021-09-25 16:51:32 +08:00
this.handleAutoPlay('update');
} else {
this.pause('paused');
}
});
this.preProps = { ...nextProps };
},
},
mounted() {
3.0 ready (#4523) * refactor: transfer、tooltip (#4306) * refactor(transfer): use composition api (#4135) * refactor(transfer): use composition api * fix: remove console * refactor(tooltip): use composition api (#4059) * refactor(tooltip): use composition api * chore: useConfigInject * fix: remove useless * style: format code * refactor: transfer * refactor: tooltip Co-authored-by: ajuner <106791576@qq.com> * Refactor mentions (#4341) * refactor(mentions): use compositionAPI (#4313) * refactor: mentions * refactor: mentions Co-authored-by: ajuner <106791576@qq.com> * Refactor progress (#4358) * fix: timepicker error border not show #4331 * fix(UploadDragger): fix UploadDrager no export (#4334) * refactor(switch): support customize checked value #4329 (#4332) * refactor(switch): support customize checked value #4329 * test: add test case * refactor: update props name * refactor: update ts * refactor: optimize * style: uncheckedValue to unCheckedValue * test: update snap * feat: udpate switch ts * docs: remove ie11 * fix: tree-select throw error when use slot title * fix: TypeScript definition of Table interface for typescript 4.3.5 (#4353) * fix type for typescript 4.3.5 * Update interface.ts close #4296 * fix: dropdown submenu style error #4351 close #4351 * fix(notification): 完善notification类型 (#4346) * refactor(progress): use composition API (#4355) * refactor(progress): use composition API * refactor(vc-progress): update * refactor: progress * refactor: progress * fix: timepicker error border not show #4331 * fix(UploadDragger): fix UploadDrager no export (#4334) * refactor(switch): support customize checked value #4329 (#4332) * refactor(switch): support customize checked value #4329 * test: add test case * refactor: update props name * refactor: update ts * refactor: optimize * style: uncheckedValue to unCheckedValue * test: update snap * feat: udpate switch ts * docs: remove ie11 * fix: tree-select throw error when use slot title * fix: TypeScript definition of Table interface for typescript 4.3.5 (#4353) * fix type for typescript 4.3.5 * Update interface.ts close #4296 * fix: dropdown submenu style error #4351 close #4351 * fix(notification): 完善notification类型 (#4346) * refactor(progress): use composition API (#4355) * refactor(progress): use composition API * refactor(vc-progress): update * refactor: progress * refactor: progress Co-authored-by: Jarvis <35361626+fanhaoyuan@users.noreply.github.com> Co-authored-by: John <John60676@qq.com> Co-authored-by: 艾斯特洛 <axetroy.dev@gmail.com> Co-authored-by: zanllp <qc@zanllp.cn> * docs: add changelog * refactor: tree * refactor: tree * style: lint * refactor: tree * 热factor: tree * refactor: tree * refactor: tree * refactor: tree * refactor: directory tree * refactor: tree * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * style: lint format * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * fix: upload ts error * fix: update tree title render & switchIcon * test: update tree test * feat: add VirtualScroll tree * refactor: datePicker & calendar & trigger (#4522) * style: update * test: update calendar test * test: update test * test: update test * refactor: slider * feat: update slider css * refactor: slider to ts * refactor: slider to ts * perf: update default itemHeight * test: update * fix: uddate ts type * fix: update skeleton * fix: update skeleton * refactor: update vc-pagination * refactor: pagination * refactor: timeline * refactor: steps * refactor: collapse * refactor: collapse * refactor: popconfirm * refactor: popover * refactor: dropdown * doc: merge doc * chore: vite for dev (#4602) * style: js to jsx * doc: add site * style: lint * style: format ts type * doc: update * style: format code * style: format site * doc: update * style: dmeo * style: format scripts * chore: remove sub-modules * chore: update vite * site: add site build * test: update snap * doc(select): add tip (#4606) * refactor: table (#4641) * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * fix: column not pass to cell * doc: uppate table * fix: update bodyCell headerCell * doc: remove examples * refactor: table * fix: table title not work * fix: table selection * fix: table checkStrictly * refactor: table * fix: table template error * feat: table support summary * test: update snap * perf: table * docs(table): fix ajax demo (#4639) * test: update table * refactor: remove old table * doc: update table doc * doc: update doc * doc: update select * doc: update summary Co-authored-by: John <John60676@qq.com> * doc: update doc * fix: menu arrow not work * test: update * doc: add next site * style: format * doc: update * doc: update site script * fix: expand icon not fixed * feat: use renderSlot * test: update table snap * feat: confirm support reactively * feat: configProvider.config * feat: message support configprovider.config * feat: notification support configprovider.config * doc: update doc * fix: typescript compile error * style: add import eslint * doc: update demo * chore: set transpileOnly true * style: fix eslint error * test: update snap * doc: update * test: mock date * test: update snap * chore: remove gulp-typescript (#4675) * feat: V3 form (#4678) * chore: update husky * perf: update formItem * perf: useInjectFormItemContext * fix: table ts error * doc: add Customized Form Controls demo * feat: export useInjectFormItemContext * doc: update form doc * doc: update doc * doc: update doc * feat: autocomplete support option slot * doc: update * feat: add form item rest * style: remove omit.js * refactor: autocomplete * doc: add changelog to site * doc: update site anchor * doc: update doc layout * test: update table test * doc: update * chore: udpate gulp script * chore: udpate gulp script * doc: add changelog * doc: update * test: ignore some test wait vue-test-utils * fix: form id error #4582 close #4582 * doc: add select Responsive demo * doc: remove temp doc Co-authored-by: ajuner <106791576@qq.com> Co-authored-by: Jarvis <35361626+fanhaoyuan@users.noreply.github.com> Co-authored-by: John <John60676@qq.com> Co-authored-by: 艾斯特洛 <axetroy.dev@gmail.com> Co-authored-by: zanllp <qc@zanllp.cn> Co-authored-by: Amour1688 <lcz_1996@foxmail.com>
2021-09-25 16:51:32 +08:00
this.__emit('init');
if (this.lazyLoad) {
const slidesToLoad = getOnDemandLazySlides({
...this.$props,
...this.$data,
});
if (slidesToLoad.length > 0) {
this.setState(prevState => ({
lazyLoadedList: prevState.lazyLoadedList.concat(slidesToLoad),
}));
this.__emit('lazyLoad', slidesToLoad);
}
}
this.$nextTick(() => {
const spec = {
listRef: this.list,
trackRef: this.track,
children: this.children,
...this.$props,
};
this.updateState(spec, true, () => {
this.adaptHeight();
this.autoplay && this.handleAutoPlay('playing');
3.0 ready (#4523) * refactor: transfer、tooltip (#4306) * refactor(transfer): use composition api (#4135) * refactor(transfer): use composition api * fix: remove console * refactor(tooltip): use composition api (#4059) * refactor(tooltip): use composition api * chore: useConfigInject * fix: remove useless * style: format code * refactor: transfer * refactor: tooltip Co-authored-by: ajuner <106791576@qq.com> * Refactor mentions (#4341) * refactor(mentions): use compositionAPI (#4313) * refactor: mentions * refactor: mentions Co-authored-by: ajuner <106791576@qq.com> * Refactor progress (#4358) * fix: timepicker error border not show #4331 * fix(UploadDragger): fix UploadDrager no export (#4334) * refactor(switch): support customize checked value #4329 (#4332) * refactor(switch): support customize checked value #4329 * test: add test case * refactor: update props name * refactor: update ts * refactor: optimize * style: uncheckedValue to unCheckedValue * test: update snap * feat: udpate switch ts * docs: remove ie11 * fix: tree-select throw error when use slot title * fix: TypeScript definition of Table interface for typescript 4.3.5 (#4353) * fix type for typescript 4.3.5 * Update interface.ts close #4296 * fix: dropdown submenu style error #4351 close #4351 * fix(notification): 完善notification类型 (#4346) * refactor(progress): use composition API (#4355) * refactor(progress): use composition API * refactor(vc-progress): update * refactor: progress * refactor: progress * fix: timepicker error border not show #4331 * fix(UploadDragger): fix UploadDrager no export (#4334) * refactor(switch): support customize checked value #4329 (#4332) * refactor(switch): support customize checked value #4329 * test: add test case * refactor: update props name * refactor: update ts * refactor: optimize * style: uncheckedValue to unCheckedValue * test: update snap * feat: udpate switch ts * docs: remove ie11 * fix: tree-select throw error when use slot title * fix: TypeScript definition of Table interface for typescript 4.3.5 (#4353) * fix type for typescript 4.3.5 * Update interface.ts close #4296 * fix: dropdown submenu style error #4351 close #4351 * fix(notification): 完善notification类型 (#4346) * refactor(progress): use composition API (#4355) * refactor(progress): use composition API * refactor(vc-progress): update * refactor: progress * refactor: progress Co-authored-by: Jarvis <35361626+fanhaoyuan@users.noreply.github.com> Co-authored-by: John <John60676@qq.com> Co-authored-by: 艾斯特洛 <axetroy.dev@gmail.com> Co-authored-by: zanllp <qc@zanllp.cn> * docs: add changelog * refactor: tree * refactor: tree * style: lint * refactor: tree * 热factor: tree * refactor: tree * refactor: tree * refactor: tree * refactor: directory tree * refactor: tree * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * style: lint format * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * fix: upload ts error * fix: update tree title render & switchIcon * test: update tree test * feat: add VirtualScroll tree * refactor: datePicker & calendar & trigger (#4522) * style: update * test: update calendar test * test: update test * test: update test * refactor: slider * feat: update slider css * refactor: slider to ts * refactor: slider to ts * perf: update default itemHeight * test: update * fix: uddate ts type * fix: update skeleton * fix: update skeleton * refactor: update vc-pagination * refactor: pagination * refactor: timeline * refactor: steps * refactor: collapse * refactor: collapse * refactor: popconfirm * refactor: popover * refactor: dropdown * doc: merge doc * chore: vite for dev (#4602) * style: js to jsx * doc: add site * style: lint * style: format ts type * doc: update * style: format code * style: format site * doc: update * style: dmeo * style: format scripts * chore: remove sub-modules * chore: update vite * site: add site build * test: update snap * doc(select): add tip (#4606) * refactor: table (#4641) * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * fix: column not pass to cell * doc: uppate table * fix: update bodyCell headerCell * doc: remove examples * refactor: table * fix: table title not work * fix: table selection * fix: table checkStrictly * refactor: table * fix: table template error * feat: table support summary * test: update snap * perf: table * docs(table): fix ajax demo (#4639) * test: update table * refactor: remove old table * doc: update table doc * doc: update doc * doc: update select * doc: update summary Co-authored-by: John <John60676@qq.com> * doc: update doc * fix: menu arrow not work * test: update * doc: add next site * style: format * doc: update * doc: update site script * fix: expand icon not fixed * feat: use renderSlot * test: update table snap * feat: confirm support reactively * feat: configProvider.config * feat: message support configprovider.config * feat: notification support configprovider.config * doc: update doc * fix: typescript compile error * style: add import eslint * doc: update demo * chore: set transpileOnly true * style: fix eslint error * test: update snap * doc: update * test: mock date * test: update snap * chore: remove gulp-typescript (#4675) * feat: V3 form (#4678) * chore: update husky * perf: update formItem * perf: useInjectFormItemContext * fix: table ts error * doc: add Customized Form Controls demo * feat: export useInjectFormItemContext * doc: update form doc * doc: update doc * doc: update doc * feat: autocomplete support option slot * doc: update * feat: add form item rest * style: remove omit.js * refactor: autocomplete * doc: add changelog to site * doc: update site anchor * doc: update doc layout * test: update table test * doc: update * chore: udpate gulp script * chore: udpate gulp script * doc: add changelog * doc: update * test: ignore some test wait vue-test-utils * fix: form id error #4582 close #4582 * doc: add select Responsive demo * doc: remove temp doc Co-authored-by: ajuner <106791576@qq.com> Co-authored-by: Jarvis <35361626+fanhaoyuan@users.noreply.github.com> Co-authored-by: John <John60676@qq.com> Co-authored-by: 艾斯特洛 <axetroy.dev@gmail.com> Co-authored-by: zanllp <qc@zanllp.cn> Co-authored-by: Amour1688 <lcz_1996@foxmail.com>
2021-09-25 16:51:32 +08:00
});
if (this.lazyLoad === 'progressive') {
this.lazyLoadTimer = setInterval(this.progressiveLazyLoad, 1000);
}
this.ro = new ResizeObserver(() => {
if (this.animating) {
this.onWindowResized(false); // don't set trackStyle hence don't break animation
this.callbackTimers.push(setTimeout(() => this.onWindowResized(), this.speed));
} else {
this.onWindowResized();
}
});
this.ro.observe(this.list);
document.querySelectorAll &&
Array.prototype.forEach.call(document.querySelectorAll('.slick-slide'), slide => {
slide.onfocus = this.$props.pauseOnFocus ? this.onSlideFocus : null;
slide.onblur = this.$props.pauseOnFocus ? this.onSlideBlur : null;
});
3.0 ready (#4523) * refactor: transfer、tooltip (#4306) * refactor(transfer): use composition api (#4135) * refactor(transfer): use composition api * fix: remove console * refactor(tooltip): use composition api (#4059) * refactor(tooltip): use composition api * chore: useConfigInject * fix: remove useless * style: format code * refactor: transfer * refactor: tooltip Co-authored-by: ajuner <106791576@qq.com> * Refactor mentions (#4341) * refactor(mentions): use compositionAPI (#4313) * refactor: mentions * refactor: mentions Co-authored-by: ajuner <106791576@qq.com> * Refactor progress (#4358) * fix: timepicker error border not show #4331 * fix(UploadDragger): fix UploadDrager no export (#4334) * refactor(switch): support customize checked value #4329 (#4332) * refactor(switch): support customize checked value #4329 * test: add test case * refactor: update props name * refactor: update ts * refactor: optimize * style: uncheckedValue to unCheckedValue * test: update snap * feat: udpate switch ts * docs: remove ie11 * fix: tree-select throw error when use slot title * fix: TypeScript definition of Table interface for typescript 4.3.5 (#4353) * fix type for typescript 4.3.5 * Update interface.ts close #4296 * fix: dropdown submenu style error #4351 close #4351 * fix(notification): 完善notification类型 (#4346) * refactor(progress): use composition API (#4355) * refactor(progress): use composition API * refactor(vc-progress): update * refactor: progress * refactor: progress * fix: timepicker error border not show #4331 * fix(UploadDragger): fix UploadDrager no export (#4334) * refactor(switch): support customize checked value #4329 (#4332) * refactor(switch): support customize checked value #4329 * test: add test case * refactor: update props name * refactor: update ts * refactor: optimize * style: uncheckedValue to unCheckedValue * test: update snap * feat: udpate switch ts * docs: remove ie11 * fix: tree-select throw error when use slot title * fix: TypeScript definition of Table interface for typescript 4.3.5 (#4353) * fix type for typescript 4.3.5 * Update interface.ts close #4296 * fix: dropdown submenu style error #4351 close #4351 * fix(notification): 完善notification类型 (#4346) * refactor(progress): use composition API (#4355) * refactor(progress): use composition API * refactor(vc-progress): update * refactor: progress * refactor: progress Co-authored-by: Jarvis <35361626+fanhaoyuan@users.noreply.github.com> Co-authored-by: John <John60676@qq.com> Co-authored-by: 艾斯特洛 <axetroy.dev@gmail.com> Co-authored-by: zanllp <qc@zanllp.cn> * docs: add changelog * refactor: tree * refactor: tree * style: lint * refactor: tree * 热factor: tree * refactor: tree * refactor: tree * refactor: tree * refactor: directory tree * refactor: tree * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * style: lint format * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * fix: upload ts error * fix: update tree title render & switchIcon * test: update tree test * feat: add VirtualScroll tree * refactor: datePicker & calendar & trigger (#4522) * style: update * test: update calendar test * test: update test * test: update test * refactor: slider * feat: update slider css * refactor: slider to ts * refactor: slider to ts * perf: update default itemHeight * test: update * fix: uddate ts type * fix: update skeleton * fix: update skeleton * refactor: update vc-pagination * refactor: pagination * refactor: timeline * refactor: steps * refactor: collapse * refactor: collapse * refactor: popconfirm * refactor: popover * refactor: dropdown * doc: merge doc * chore: vite for dev (#4602) * style: js to jsx * doc: add site * style: lint * style: format ts type * doc: update * style: format code * style: format site * doc: update * style: dmeo * style: format scripts * chore: remove sub-modules * chore: update vite * site: add site build * test: update snap * doc(select): add tip (#4606) * refactor: table (#4641) * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * fix: column not pass to cell * doc: uppate table * fix: update bodyCell headerCell * doc: remove examples * refactor: table * fix: table title not work * fix: table selection * fix: table checkStrictly * refactor: table * fix: table template error * feat: table support summary * test: update snap * perf: table * docs(table): fix ajax demo (#4639) * test: update table * refactor: remove old table * doc: update table doc * doc: update doc * doc: update select * doc: update summary Co-authored-by: John <John60676@qq.com> * doc: update doc * fix: menu arrow not work * test: update * doc: add next site * style: format * doc: update * doc: update site script * fix: expand icon not fixed * feat: use renderSlot * test: update table snap * feat: confirm support reactively * feat: configProvider.config * feat: message support configprovider.config * feat: notification support configprovider.config * doc: update doc * fix: typescript compile error * style: add import eslint * doc: update demo * chore: set transpileOnly true * style: fix eslint error * test: update snap * doc: update * test: mock date * test: update snap * chore: remove gulp-typescript (#4675) * feat: V3 form (#4678) * chore: update husky * perf: update formItem * perf: useInjectFormItemContext * fix: table ts error * doc: add Customized Form Controls demo * feat: export useInjectFormItemContext * doc: update form doc * doc: update doc * doc: update doc * feat: autocomplete support option slot * doc: update * feat: add form item rest * style: remove omit.js * refactor: autocomplete * doc: add changelog to site * doc: update site anchor * doc: update doc layout * test: update table test * doc: update * chore: udpate gulp script * chore: udpate gulp script * doc: add changelog * doc: update * test: ignore some test wait vue-test-utils * fix: form id error #4582 close #4582 * doc: add select Responsive demo * doc: remove temp doc Co-authored-by: ajuner <106791576@qq.com> Co-authored-by: Jarvis <35361626+fanhaoyuan@users.noreply.github.com> Co-authored-by: John <John60676@qq.com> Co-authored-by: 艾斯特洛 <axetroy.dev@gmail.com> Co-authored-by: zanllp <qc@zanllp.cn> Co-authored-by: Amour1688 <lcz_1996@foxmail.com>
2021-09-25 16:51:32 +08:00
if (window.addEventListener) {
window.addEventListener('resize', this.onWindowResized);
} else {
window.attachEvent('onresize', this.onWindowResized);
}
});
},
beforeUnmount() {
if (this.animationEndCallback) {
clearTimeout(this.animationEndCallback);
}
if (this.lazyLoadTimer) {
clearInterval(this.lazyLoadTimer);
}
if (this.callbackTimers.length) {
this.callbackTimers.forEach(timer => clearTimeout(timer));
this.callbackTimers = [];
}
if (window.addEventListener) {
window.removeEventListener('resize', this.onWindowResized);
} else {
window.detachEvent('onresize', this.onWindowResized);
}
if (this.autoplayTimer) {
clearInterval(this.autoplayTimer);
}
this.ro?.disconnect();
3.0 ready (#4523) * refactor: transfer、tooltip (#4306) * refactor(transfer): use composition api (#4135) * refactor(transfer): use composition api * fix: remove console * refactor(tooltip): use composition api (#4059) * refactor(tooltip): use composition api * chore: useConfigInject * fix: remove useless * style: format code * refactor: transfer * refactor: tooltip Co-authored-by: ajuner <106791576@qq.com> * Refactor mentions (#4341) * refactor(mentions): use compositionAPI (#4313) * refactor: mentions * refactor: mentions Co-authored-by: ajuner <106791576@qq.com> * Refactor progress (#4358) * fix: timepicker error border not show #4331 * fix(UploadDragger): fix UploadDrager no export (#4334) * refactor(switch): support customize checked value #4329 (#4332) * refactor(switch): support customize checked value #4329 * test: add test case * refactor: update props name * refactor: update ts * refactor: optimize * style: uncheckedValue to unCheckedValue * test: update snap * feat: udpate switch ts * docs: remove ie11 * fix: tree-select throw error when use slot title * fix: TypeScript definition of Table interface for typescript 4.3.5 (#4353) * fix type for typescript 4.3.5 * Update interface.ts close #4296 * fix: dropdown submenu style error #4351 close #4351 * fix(notification): 完善notification类型 (#4346) * refactor(progress): use composition API (#4355) * refactor(progress): use composition API * refactor(vc-progress): update * refactor: progress * refactor: progress * fix: timepicker error border not show #4331 * fix(UploadDragger): fix UploadDrager no export (#4334) * refactor(switch): support customize checked value #4329 (#4332) * refactor(switch): support customize checked value #4329 * test: add test case * refactor: update props name * refactor: update ts * refactor: optimize * style: uncheckedValue to unCheckedValue * test: update snap * feat: udpate switch ts * docs: remove ie11 * fix: tree-select throw error when use slot title * fix: TypeScript definition of Table interface for typescript 4.3.5 (#4353) * fix type for typescript 4.3.5 * Update interface.ts close #4296 * fix: dropdown submenu style error #4351 close #4351 * fix(notification): 完善notification类型 (#4346) * refactor(progress): use composition API (#4355) * refactor(progress): use composition API * refactor(vc-progress): update * refactor: progress * refactor: progress Co-authored-by: Jarvis <35361626+fanhaoyuan@users.noreply.github.com> Co-authored-by: John <John60676@qq.com> Co-authored-by: 艾斯特洛 <axetroy.dev@gmail.com> Co-authored-by: zanllp <qc@zanllp.cn> * docs: add changelog * refactor: tree * refactor: tree * style: lint * refactor: tree * 热factor: tree * refactor: tree * refactor: tree * refactor: tree * refactor: directory tree * refactor: tree * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * style: lint format * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * refactor: tree-select * fix: upload ts error * fix: update tree title render & switchIcon * test: update tree test * feat: add VirtualScroll tree * refactor: datePicker & calendar & trigger (#4522) * style: update * test: update calendar test * test: update test * test: update test * refactor: slider * feat: update slider css * refactor: slider to ts * refactor: slider to ts * perf: update default itemHeight * test: update * fix: uddate ts type * fix: update skeleton * fix: update skeleton * refactor: update vc-pagination * refactor: pagination * refactor: timeline * refactor: steps * refactor: collapse * refactor: collapse * refactor: popconfirm * refactor: popover * refactor: dropdown * doc: merge doc * chore: vite for dev (#4602) * style: js to jsx * doc: add site * style: lint * style: format ts type * doc: update * style: format code * style: format site * doc: update * style: dmeo * style: format scripts * chore: remove sub-modules * chore: update vite * site: add site build * test: update snap * doc(select): add tip (#4606) * refactor: table (#4641) * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * refactor: table * fix: column not pass to cell * doc: uppate table * fix: update bodyCell headerCell * doc: remove examples * refactor: table * fix: table title not work * fix: table selection * fix: table checkStrictly * refactor: table * fix: table template error * feat: table support summary * test: update snap * perf: table * docs(table): fix ajax demo (#4639) * test: update table * refactor: remove old table * doc: update table doc * doc: update doc * doc: update select * doc: update summary Co-authored-by: John <John60676@qq.com> * doc: update doc * fix: menu arrow not work * test: update * doc: add next site * style: format * doc: update * doc: update site script * fix: expand icon not fixed * feat: use renderSlot * test: update table snap * feat: confirm support reactively * feat: configProvider.config * feat: message support configprovider.config * feat: notification support configprovider.config * doc: update doc * fix: typescript compile error * style: add import eslint * doc: update demo * chore: set transpileOnly true * style: fix eslint error * test: update snap * doc: update * test: mock date * test: update snap * chore: remove gulp-typescript (#4675) * feat: V3 form (#4678) * chore: update husky * perf: update formItem * perf: useInjectFormItemContext * fix: table ts error * doc: add Customized Form Controls demo * feat: export useInjectFormItemContext * doc: update form doc * doc: update doc * doc: update doc * feat: autocomplete support option slot * doc: update * feat: add form item rest * style: remove omit.js * refactor: autocomplete * doc: add changelog to site * doc: update site anchor * doc: update doc layout * test: update table test * doc: update * chore: udpate gulp script * chore: udpate gulp script * doc: add changelog * doc: update * test: ignore some test wait vue-test-utils * fix: form id error #4582 close #4582 * doc: add select Responsive demo * doc: remove temp doc Co-authored-by: ajuner <106791576@qq.com> Co-authored-by: Jarvis <35361626+fanhaoyuan@users.noreply.github.com> Co-authored-by: John <John60676@qq.com> Co-authored-by: 艾斯特洛 <axetroy.dev@gmail.com> Co-authored-by: zanllp <qc@zanllp.cn> Co-authored-by: Amour1688 <lcz_1996@foxmail.com>
2021-09-25 16:51:32 +08:00
},
updated() {
this.checkImagesLoad();
this.__emit('reInit');
if (this.lazyLoad) {
const slidesToLoad = getOnDemandLazySlides({
...this.$props,
...this.$data,
});
if (slidesToLoad.length > 0) {
this.setState(prevState => ({
lazyLoadedList: prevState.lazyLoadedList.concat(slidesToLoad),
}));
this.__emit('lazyLoad');
}
}
// if (this.props.onLazyLoad) {
// this.props.onLazyLoad([leftMostSlide])
// }
this.adaptHeight();
},
2018-07-20 16:13:21 +08:00
methods: {
2019-01-12 11:33:27 +08:00
listRefHandler(ref) {
this.list = ref;
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
trackRefHandler(ref) {
this.track = ref;
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
adaptHeight() {
2018-07-20 16:13:21 +08:00
if (this.adaptiveHeight && this.list) {
2019-01-12 11:33:27 +08:00
const elem = this.list.querySelector(`[data-index="${this.currentSlide}"]`);
this.list.style.height = getHeight(elem) + 'px';
2018-07-20 16:13:21 +08:00
}
},
2019-01-12 11:33:27 +08:00
onWindowResized(setTrackStyle) {
if (this.debouncedResize) this.debouncedResize.cancel();
this.debouncedResize = debounce(() => this.resizeWindow(setTrackStyle), 50);
this.debouncedResize();
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
resizeWindow(setTrackStyle = true) {
const isTrackMounted = Boolean(this.track);
if (!isTrackMounted) return;
2018-07-20 16:13:21 +08:00
const spec = {
listRef: this.list,
trackRef: this.track,
children: this.children,
...this.$props,
...this.$data,
2019-01-12 11:33:27 +08:00
};
2018-07-20 16:13:21 +08:00
this.updateState(spec, setTrackStyle, () => {
if (this.autoplay) {
2019-01-12 11:33:27 +08:00
this.handleAutoPlay('update');
2018-07-20 16:13:21 +08:00
} else {
2019-01-12 11:33:27 +08:00
this.pause('paused');
2018-07-20 16:13:21 +08:00
}
2019-01-12 11:33:27 +08:00
});
2018-07-20 16:13:21 +08:00
// animating state should be cleared while resizing, otherwise autoplay stops working
this.setState({
animating: false,
2019-01-12 11:33:27 +08:00
});
clearTimeout(this.animationEndCallback);
delete this.animationEndCallback;
},
updateState(spec, setTrackStyle, callback) {
const updatedState = initializedState(spec);
spec = { ...spec, ...updatedState, slideIndex: updatedState.currentSlide };
const targetLeft = getTrackLeft(spec);
spec = { ...spec, left: targetLeft };
const trackStyle = getTrackCSS(spec);
if (setTrackStyle || this.children.length !== spec.children.length) {
updatedState['trackStyle'] = trackStyle;
}
this.setState(updatedState, callback);
},
ssrInit() {
const children = this.children;
2018-07-20 16:13:21 +08:00
if (this.variableWidth) {
2019-01-12 11:33:27 +08:00
let trackWidth = 0;
let trackLeft = 0;
const childrenWidths = [];
2018-07-20 16:13:21 +08:00
const preClones = getPreClones({
...this.$props,
...this.$data,
slideCount: children.length,
2019-01-12 11:33:27 +08:00
});
2018-07-20 16:13:21 +08:00
const postClones = getPostClones({
...this.$props,
...this.$data,
slideCount: children.length,
2019-01-12 11:33:27 +08:00
});
2018-07-20 16:13:21 +08:00
children.forEach(child => {
const childWidth = child.props.style?.width?.split('px')[0] || 0;
2019-01-12 11:33:27 +08:00
childrenWidths.push(childWidth);
trackWidth += childWidth;
});
2018-07-20 16:13:21 +08:00
for (let i = 0; i < preClones; i++) {
2019-01-12 11:33:27 +08:00
trackLeft += childrenWidths[childrenWidths.length - 1 - i];
trackWidth += childrenWidths[childrenWidths.length - 1 - i];
2018-07-20 16:13:21 +08:00
}
for (let i = 0; i < postClones; i++) {
2019-01-12 11:33:27 +08:00
trackWidth += childrenWidths[i];
2018-07-20 16:13:21 +08:00
}
for (let i = 0; i < this.currentSlide; i++) {
2019-01-12 11:33:27 +08:00
trackLeft += childrenWidths[i];
2018-07-20 16:13:21 +08:00
}
const trackStyle = {
width: trackWidth + 'px',
left: -trackLeft + 'px',
2019-01-12 11:33:27 +08:00
};
2018-07-20 16:13:21 +08:00
if (this.centerMode) {
2019-01-12 11:33:27 +08:00
const currentWidth = `${childrenWidths[this.currentSlide]}px`;
trackStyle.left = `calc(${trackStyle.left} + (100% - ${currentWidth}) / 2 ) `;
2018-07-20 16:13:21 +08:00
}
return {
2018-07-20 16:13:21 +08:00
trackStyle,
};
2019-01-12 11:33:27 +08:00
}
const childrenCount = children.length;
const spec = { ...this.$props, ...this.$data, slideCount: childrenCount };
const slideCount = getPreClones(spec) + getPostClones(spec) + childrenCount;
const trackWidth = (100 / this.slidesToShow) * slideCount;
const slideWidth = 100 / slideCount;
let trackLeft = (-slideWidth * (getPreClones(spec) + this.currentSlide) * trackWidth) / 100;
2018-07-20 16:13:21 +08:00
if (this.centerMode) {
2019-01-12 11:33:27 +08:00
trackLeft += (100 - (slideWidth * trackWidth) / 100) / 2;
2018-07-20 16:13:21 +08:00
}
const trackStyle = {
width: trackWidth + '%',
left: trackLeft + '%',
2019-01-12 11:33:27 +08:00
};
return {
2018-07-20 16:13:21 +08:00
slideWidth: slideWidth + '%',
trackStyle,
};
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
checkImagesLoad() {
let images =
(this.list &&
this.list.querySelectorAll &&
this.list.querySelectorAll('.slick-slide img')) ||
[];
2019-01-12 11:33:27 +08:00
const imagesCount = images.length;
let loadedCount = 0;
2018-07-20 16:13:21 +08:00
Array.prototype.forEach.call(images, image => {
2019-01-12 11:33:27 +08:00
const handler = () => ++loadedCount && loadedCount >= imagesCount && this.onWindowResized();
2018-07-20 16:13:21 +08:00
if (!image.onclick) {
2019-01-12 11:33:27 +08:00
image.onclick = () => image.parentNode.focus();
2018-07-20 16:13:21 +08:00
} else {
2019-01-12 11:33:27 +08:00
const prevClickHandler = image.onclick;
2018-07-20 16:13:21 +08:00
image.onclick = () => {
2019-01-12 11:33:27 +08:00
prevClickHandler();
image.parentNode.focus();
};
2018-07-20 16:13:21 +08:00
}
if (!image.onload) {
if (this.$props.lazyLoad) {
image.onload = () => {
2019-01-12 11:33:27 +08:00
this.adaptHeight();
this.callbackTimers.push(setTimeout(this.onWindowResized, this.speed));
};
2018-07-20 16:13:21 +08:00
} else {
2019-01-12 11:33:27 +08:00
image.onload = handler;
2018-07-20 16:13:21 +08:00
image.onerror = () => {
2019-01-12 11:33:27 +08:00
handler();
2020-07-24 14:23:14 +08:00
this.__emit('lazyLoadError');
2019-01-12 11:33:27 +08:00
};
2018-07-20 16:13:21 +08:00
}
}
2019-01-12 11:33:27 +08:00
});
},
progressiveLazyLoad() {
const slidesToLoad = [];
const spec = { ...this.$props, ...this.$data };
for (let index = this.currentSlide; index < this.slideCount + getPostClones(spec); index++) {
2018-07-20 16:13:21 +08:00
if (this.lazyLoadedList.indexOf(index) < 0) {
2019-01-12 11:33:27 +08:00
slidesToLoad.push(index);
break;
2018-07-20 16:13:21 +08:00
}
}
2019-01-12 11:33:27 +08:00
for (let index = this.currentSlide - 1; index >= -getPreClones(spec); index--) {
2018-07-20 16:13:21 +08:00
if (this.lazyLoadedList.indexOf(index) < 0) {
2019-01-12 11:33:27 +08:00
slidesToLoad.push(index);
break;
2018-07-20 16:13:21 +08:00
}
}
if (slidesToLoad.length > 0) {
this.setState(state => ({
lazyLoadedList: state.lazyLoadedList.concat(slidesToLoad),
2019-01-12 11:33:27 +08:00
}));
2020-07-24 14:23:14 +08:00
this.__emit('lazyLoad', slidesToLoad);
2018-07-20 16:13:21 +08:00
} else {
if (this.lazyLoadTimer) {
2019-01-12 11:33:27 +08:00
clearInterval(this.lazyLoadTimer);
delete this.lazyLoadTimer;
2018-07-20 16:13:21 +08:00
}
}
},
2019-01-12 11:33:27 +08:00
slideHandler(index, dontAnimate = false) {
const { asNavFor, currentSlide, beforeChange, speed, afterChange } = this.$props;
2018-07-20 16:13:21 +08:00
const { state, nextState } = slideHandler({
index,
...this.$props,
...this.$data,
trackRef: this.track,
useCSS: this.useCSS && !dontAnimate,
2019-01-12 11:33:27 +08:00
});
if (!state) return;
beforeChange && beforeChange(currentSlide, state.currentSlide);
2018-07-20 16:13:21 +08:00
const slidesToLoad = state.lazyLoadedList.filter(
2019-01-12 11:33:27 +08:00
value => this.lazyLoadedList.indexOf(value) < 0,
);
2020-07-20 16:29:46 +08:00
if (this.$attrs.onLazyLoad && slidesToLoad.length > 0) {
2020-07-24 14:23:14 +08:00
this.__emit('lazyLoad', slidesToLoad);
2018-07-20 16:13:21 +08:00
}
if (!this.$props.waitForAnimate && this.animationEndCallback) {
clearTimeout(this.animationEndCallback);
afterChange && afterChange(currentSlide);
delete this.animationEndCallback;
}
2018-07-20 16:13:21 +08:00
this.setState(state, () => {
if (asNavFor && this.asNavForIndex !== index) {
this.asNavForIndex = index;
2019-01-12 11:33:27 +08:00
asNavFor.innerSlider.slideHandler(index);
}
2019-01-12 11:33:27 +08:00
if (!nextState) return;
2018-07-20 16:13:21 +08:00
this.animationEndCallback = setTimeout(() => {
2019-01-12 11:33:27 +08:00
const { animating, ...firstBatch } = nextState;
2018-07-20 16:13:21 +08:00
this.setState(firstBatch, () => {
2019-01-12 11:33:27 +08:00
this.callbackTimers.push(setTimeout(() => this.setState({ animating }), 10));
afterChange && afterChange(state.currentSlide);
delete this.animationEndCallback;
});
}, speed);
});
},
changeSlide(options, dontAnimate = false) {
const spec = { ...this.$props, ...this.$data };
const targetSlide = changeSlide(spec, options);
if (targetSlide !== 0 && !targetSlide) return;
2018-07-20 16:13:21 +08:00
if (dontAnimate === true) {
2019-01-12 11:33:27 +08:00
this.slideHandler(targetSlide, dontAnimate);
2018-07-20 16:13:21 +08:00
} else {
2019-01-12 11:33:27 +08:00
this.slideHandler(targetSlide);
2018-07-20 16:13:21 +08:00
}
this.$props.autoplay && this.handleAutoPlay('update');
if (this.$props.focusOnSelect) {
const nodes = this.list.querySelectorAll('.slick-current');
nodes[0] && nodes[0].focus();
}
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
clickHandler(e) {
2018-07-20 16:13:21 +08:00
if (this.clickable === false) {
2019-01-12 11:33:27 +08:00
e.stopPropagation();
e.preventDefault();
2018-07-20 16:13:21 +08:00
}
2019-01-12 11:33:27 +08:00
this.clickable = true;
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
keyHandler(e) {
const dir = keyHandler(e, this.accessibility, this.rtl);
dir !== '' && this.changeSlide({ message: dir });
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
selectHandler(options) {
this.changeSlide(options);
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
disableBodyScroll() {
2018-07-20 16:13:21 +08:00
const preventDefault = e => {
2019-01-12 11:33:27 +08:00
e = e || window.event;
if (e.preventDefault) e.preventDefault();
e.returnValue = false;
};
window.ontouchmove = preventDefault;
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
enableBodyScroll() {
window.ontouchmove = null;
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
swipeStart(e) {
2018-07-20 16:13:21 +08:00
if (this.verticalSwiping) {
2019-01-12 11:33:27 +08:00
this.disableBodyScroll();
2018-07-20 16:13:21 +08:00
}
2019-01-12 11:33:27 +08:00
const state = swipeStart(e, this.swipe, this.draggable);
state !== '' && this.setState(state);
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
swipeMove(e) {
2018-07-20 16:13:21 +08:00
const state = swipeMove(e, {
...this.$props,
...this.$data,
trackRef: this.track,
listRef: this.list,
slideIndex: this.currentSlide,
2019-01-12 11:33:27 +08:00
});
if (!state) return;
2018-07-20 16:13:21 +08:00
if (state['swiping']) {
2019-01-12 11:33:27 +08:00
this.clickable = false;
2018-07-20 16:13:21 +08:00
}
2019-01-12 11:33:27 +08:00
this.setState(state);
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
swipeEnd(e) {
2018-07-20 16:13:21 +08:00
const state = swipeEnd(e, {
...this.$props,
...this.$data,
trackRef: this.track,
listRef: this.list,
slideIndex: this.currentSlide,
2019-01-12 11:33:27 +08:00
});
if (!state) return;
const triggerSlideHandler = state['triggerSlideHandler'];
delete state['triggerSlideHandler'];
this.setState(state);
if (triggerSlideHandler === undefined) return;
this.slideHandler(triggerSlideHandler);
2018-07-20 16:13:21 +08:00
if (this.$props.verticalSwiping) {
2019-01-12 11:33:27 +08:00
this.enableBodyScroll();
2018-07-20 16:13:21 +08:00
}
},
touchEnd(e) {
this.swipeEnd(e);
this.clickable = true;
},
2019-01-12 11:33:27 +08:00
slickPrev() {
2018-07-20 16:13:21 +08:00
// this and fellow methods are wrapped in setTimeout
// to make sure initialize setState has happened before
// any of such methods are called
2019-01-12 11:33:27 +08:00
this.callbackTimers.push(setTimeout(() => this.changeSlide({ message: 'previous' }), 0));
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
slickNext() {
this.callbackTimers.push(setTimeout(() => this.changeSlide({ message: 'next' }), 0));
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
slickGoTo(slide, dontAnimate = false) {
slide = Number(slide);
if (isNaN(slide)) return '';
2018-07-20 16:13:21 +08:00
this.callbackTimers.push(
setTimeout(
() =>
this.changeSlide(
{
message: 'index',
index: slide,
currentSlide: this.currentSlide,
},
2019-01-12 11:33:27 +08:00
dontAnimate,
2018-07-20 16:13:21 +08:00
),
2019-01-12 11:33:27 +08:00
0,
),
);
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
play() {
let nextIndex;
2018-07-20 16:13:21 +08:00
if (this.rtl) {
2019-01-12 11:33:27 +08:00
nextIndex = this.currentSlide - this.slidesToScroll;
2018-07-20 16:13:21 +08:00
} else {
if (canGoNext({ ...this.$props, ...this.$data })) {
2019-01-12 11:33:27 +08:00
nextIndex = this.currentSlide + this.slidesToScroll;
2018-07-20 16:13:21 +08:00
} else {
2019-01-12 11:33:27 +08:00
return false;
2018-07-20 16:13:21 +08:00
}
}
2019-01-12 11:33:27 +08:00
this.slideHandler(nextIndex);
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
handleAutoPlay(playType) {
2018-07-20 16:13:21 +08:00
if (this.autoplayTimer) {
2019-01-12 11:33:27 +08:00
clearInterval(this.autoplayTimer);
2018-07-20 16:13:21 +08:00
}
2019-01-12 11:33:27 +08:00
const autoplaying = this.autoplaying;
2018-07-20 16:13:21 +08:00
if (playType === 'update') {
2019-01-12 11:33:27 +08:00
if (autoplaying === 'hovered' || autoplaying === 'focused' || autoplaying === 'paused') {
return;
2018-07-20 16:13:21 +08:00
}
} else if (playType === 'leave') {
if (autoplaying === 'paused' || autoplaying === 'focused') {
2019-01-12 11:33:27 +08:00
return;
2018-07-20 16:13:21 +08:00
}
} else if (playType === 'blur') {
if (autoplaying === 'paused' || autoplaying === 'hovered') {
2019-01-12 11:33:27 +08:00
return;
2018-07-20 16:13:21 +08:00
}
}
2019-01-12 11:33:27 +08:00
this.autoplayTimer = setInterval(this.play, this.autoplaySpeed + 50);
this.setState({ autoplaying: 'playing' });
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
pause(pauseType) {
2018-07-20 16:13:21 +08:00
if (this.autoplayTimer) {
2019-01-12 11:33:27 +08:00
clearInterval(this.autoplayTimer);
this.autoplayTimer = null;
2018-07-20 16:13:21 +08:00
}
2019-01-12 11:33:27 +08:00
const autoplaying = this.autoplaying;
2018-07-20 16:13:21 +08:00
if (pauseType === 'paused') {
2019-01-12 11:33:27 +08:00
this.setState({ autoplaying: 'paused' });
2018-07-20 16:13:21 +08:00
} else if (pauseType === 'focused') {
if (autoplaying === 'hovered' || autoplaying === 'playing') {
2019-01-12 11:33:27 +08:00
this.setState({ autoplaying: 'focused' });
2018-07-20 16:13:21 +08:00
}
} else {
// pauseType is 'hovered'
if (autoplaying === 'playing') {
2019-01-12 11:33:27 +08:00
this.setState({ autoplaying: 'hovered' });
2018-07-20 16:13:21 +08:00
}
}
},
2019-01-12 11:33:27 +08:00
onDotsOver() {
this.autoplay && this.pause('hovered');
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
onDotsLeave() {
this.autoplay && this.autoplaying === 'hovered' && this.handleAutoPlay('leave');
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
onTrackOver() {
this.autoplay && this.pause('hovered');
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
onTrackLeave() {
this.autoplay && this.autoplaying === 'hovered' && this.handleAutoPlay('leave');
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
onSlideFocus() {
this.autoplay && this.pause('focused');
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
onSlideBlur() {
this.autoplay && this.autoplaying === 'focused' && this.handleAutoPlay('blur');
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
customPaging({ i }) {
return <button>{i + 1}</button>;
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
appendDots({ dots }) {
return <ul style={{ display: 'block' }}>{dots}</ul>;
2018-07-20 16:13:21 +08:00
},
},
2019-01-12 11:33:27 +08:00
render() {
2020-07-20 16:29:46 +08:00
const className = classnames('slick-slider', this.$attrs.class, {
2018-07-20 16:13:21 +08:00
'slick-vertical': this.vertical,
'slick-initialized': true,
2019-01-12 11:33:27 +08:00
});
const spec = { ...this.$props, ...this.$data };
2018-07-20 16:13:21 +08:00
let trackProps = extractObject(spec, [
'fade',
'cssEase',
'speed',
'infinite',
'centerMode',
'focusOnSelect',
'currentSlide',
'lazyLoad',
'lazyLoadedList',
'rtl',
'slideWidth',
'slideHeight',
'listHeight',
'vertical',
'slidesToShow',
'slidesToScroll',
'slideCount',
'trackStyle',
'variableWidth',
'unslick',
'centerPadding',
'targetSlide',
'useCSS',
2019-01-12 11:33:27 +08:00
]);
const { pauseOnHover } = this.$props;
2018-07-20 16:13:21 +08:00
trackProps = {
2020-07-20 16:29:46 +08:00
...trackProps,
focusOnSelect: this.focusOnSelect && this.clickable ? this.selectHandler : null,
2020-07-20 16:29:46 +08:00
ref: this.trackRefHandler,
onMouseleave: pauseOnHover ? this.onTrackLeave : noop,
onMouseover: pauseOnHover ? this.onTrackOver : noop,
2019-01-12 11:33:27 +08:00
};
2018-07-20 16:13:21 +08:00
2019-01-12 11:33:27 +08:00
let dots;
if (this.dots === true && this.slideCount >= this.slidesToShow) {
2018-07-20 16:13:21 +08:00
let dotProps = extractObject(spec, [
'dotsClass',
'slideCount',
'slidesToShow',
'currentSlide',
'slidesToScroll',
'clickHandler',
'children',
'infinite',
'appendDots',
2019-01-12 11:33:27 +08:00
]);
dotProps.customPaging = this.customPaging;
dotProps.appendDots = this.appendDots;
2020-07-20 16:29:46 +08:00
const { customPaging, appendDots } = this.$slots;
2018-07-20 16:13:21 +08:00
if (customPaging) {
2019-01-12 11:33:27 +08:00
dotProps.customPaging = customPaging;
2018-07-20 16:13:21 +08:00
}
if (appendDots) {
2019-01-12 11:33:27 +08:00
dotProps.appendDots = appendDots;
2018-07-20 16:13:21 +08:00
}
2019-01-12 11:33:27 +08:00
const { pauseOnDotsHover } = this.$props;
2018-07-20 16:13:21 +08:00
dotProps = {
2020-07-20 16:29:46 +08:00
...dotProps,
clickHandler: this.changeSlide,
onMouseover: pauseOnDotsHover ? this.onDotsOver : noop,
onMouseleave: pauseOnDotsHover ? this.onDotsLeave : noop,
2019-01-12 11:33:27 +08:00
};
dots = <Dots {...dotProps} />;
2018-07-20 16:13:21 +08:00
}
2019-01-12 11:33:27 +08:00
let prevArrow, nextArrow;
2018-07-20 16:13:21 +08:00
const arrowProps = extractObject(spec, [
'infinite',
'centerMode',
'currentSlide',
'slideCount',
'slidesToShow',
2019-01-12 11:33:27 +08:00
]);
arrowProps.clickHandler = this.changeSlide;
2020-07-20 16:29:46 +08:00
const { prevArrow: prevArrowCustom, nextArrow: nextArrowCustom } = this.$slots;
2018-07-20 16:13:21 +08:00
if (prevArrowCustom) {
2019-01-12 11:33:27 +08:00
arrowProps.prevArrow = prevArrowCustom;
2018-07-20 16:13:21 +08:00
}
if (nextArrowCustom) {
2019-01-12 11:33:27 +08:00
arrowProps.nextArrow = nextArrowCustom;
2018-07-20 16:13:21 +08:00
}
if (this.arrows) {
2020-07-20 16:29:46 +08:00
prevArrow = <PrevArrow {...arrowProps} />;
nextArrow = <NextArrow {...arrowProps} />;
2018-07-20 16:13:21 +08:00
}
2019-01-12 11:33:27 +08:00
let verticalHeightStyle = null;
2018-07-20 16:13:21 +08:00
if (this.vertical) {
verticalHeightStyle = {
height: typeof this.listHeight === 'number' ? `${this.listHeight}px` : this.listHeight,
2019-01-12 11:33:27 +08:00
};
2018-07-20 16:13:21 +08:00
}
2019-01-12 11:33:27 +08:00
let centerPaddingStyle = null;
2018-07-20 16:13:21 +08:00
if (this.vertical === false) {
if (this.centerMode === true) {
centerPaddingStyle = {
padding: '0px ' + this.centerPadding,
2019-01-12 11:33:27 +08:00
};
2018-07-20 16:13:21 +08:00
}
} else {
if (this.centerMode === true) {
centerPaddingStyle = {
padding: this.centerPadding + ' 0px',
2019-01-12 11:33:27 +08:00
};
2018-07-20 16:13:21 +08:00
}
}
2019-01-12 11:33:27 +08:00
const listStyle = { ...verticalHeightStyle, ...centerPaddingStyle };
const touchMove = this.touchMove;
2018-07-20 16:13:21 +08:00
let listProps = {
2020-07-20 16:29:46 +08:00
ref: this.listRefHandler,
2018-07-20 16:13:21 +08:00
class: 'slick-list',
style: listStyle,
2020-07-20 16:29:46 +08:00
onClick: this.clickHandler,
onMousedown: touchMove ? this.swipeStart : noop,
onMousemove: this.dragging && touchMove ? this.swipeMove : noop,
onMouseup: touchMove ? this.swipeEnd : noop,
onMouseleave: this.dragging && touchMove ? this.swipeEnd : noop,
2021-07-23 10:10:39 +08:00
[supportsPassive ? 'onTouchstartPassive' : 'onTouchstart']: touchMove
? this.swipeStart
: noop,
[supportsPassive ? 'onTouchmovePassive' : 'onTouchmove']:
this.dragging && touchMove ? this.swipeMove : noop,
onTouchend: touchMove ? this.touchEnd : noop,
2020-07-20 16:29:46 +08:00
onTouchcancel: this.dragging && touchMove ? this.swipeEnd : noop,
onKeydown: this.accessibility ? this.keyHandler : noop,
2019-01-12 11:33:27 +08:00
};
2018-07-20 16:13:21 +08:00
let innerSliderProps = {
class: className,
dir: 'ltr',
style: this.$attrs.style,
2019-01-12 11:33:27 +08:00
};
2018-07-20 16:13:21 +08:00
if (this.unslick) {
listProps = {
class: 'slick-list',
2020-07-20 16:29:46 +08:00
ref: this.listRefHandler,
2019-01-12 11:33:27 +08:00
};
innerSliderProps = { class: className };
2018-07-20 16:13:21 +08:00
}
return (
<div {...innerSliderProps}>
{!this.unslick ? prevArrow : ''}
<div {...listProps}>
2019-01-12 11:33:27 +08:00
<Track {...trackProps}>{this.children}</Track>
2018-07-20 16:13:21 +08:00
</div>
{!this.unslick ? nextArrow : ''}
{!this.unslick ? dots : ''}
</div>
2019-01-12 11:33:27 +08:00
);
2018-07-20 16:13:21 +08:00
},
2019-01-12 11:33:27 +08:00
};