框架源码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

437 lines
13 KiB

4 years ago
  1. module.exports =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  38. /******/ __webpack_require__.d = function(exports, name, getter) {
  39. /******/ if(!__webpack_require__.o(exports, name)) {
  40. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41. /******/ }
  42. /******/ };
  43. /******/
  44. /******/ // define __esModule on exports
  45. /******/ __webpack_require__.r = function(exports) {
  46. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48. /******/ }
  49. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  50. /******/ };
  51. /******/
  52. /******/ // create a fake namespace object
  53. /******/ // mode & 1: value is a module id, require it
  54. /******/ // mode & 2: merge all properties of value into the ns
  55. /******/ // mode & 4: return value when already ns object
  56. /******/ // mode & 8|1: behave like require
  57. /******/ __webpack_require__.t = function(value, mode) {
  58. /******/ if(mode & 1) value = __webpack_require__(value);
  59. /******/ if(mode & 8) return value;
  60. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61. /******/ var ns = Object.create(null);
  62. /******/ __webpack_require__.r(ns);
  63. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65. /******/ return ns;
  66. /******/ };
  67. /******/
  68. /******/ // getDefaultExport function for compatibility with non-harmony modules
  69. /******/ __webpack_require__.n = function(module) {
  70. /******/ var getter = module && module.__esModule ?
  71. /******/ function getDefault() { return module['default']; } :
  72. /******/ function getModuleExports() { return module; };
  73. /******/ __webpack_require__.d(getter, 'a', getter);
  74. /******/ return getter;
  75. /******/ };
  76. /******/
  77. /******/ // Object.prototype.hasOwnProperty.call
  78. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79. /******/
  80. /******/ // __webpack_public_path__
  81. /******/ __webpack_require__.p = "/dist/";
  82. /******/
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = 561);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ 10:
  90. /***/ (function(module, exports) {
  91. module.exports = require("tis-ui/lib/utils/util");
  92. /***/ }),
  93. /***/ 2:
  94. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  95. "use strict";
  96. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
  97. /* globals __VUE_SSR_CONTEXT__ */
  98. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  99. // This module is a runtime utility for cleaner component module output and will
  100. // be included in the final webpack user bundle.
  101. function normalizeComponent (
  102. scriptExports,
  103. render,
  104. staticRenderFns,
  105. functionalTemplate,
  106. injectStyles,
  107. scopeId,
  108. moduleIdentifier, /* server only */
  109. shadowMode /* vue-cli only */
  110. ) {
  111. // Vue.extend constructor export interop
  112. var options = typeof scriptExports === 'function'
  113. ? scriptExports.options
  114. : scriptExports
  115. // render functions
  116. if (render) {
  117. options.render = render
  118. options.staticRenderFns = staticRenderFns
  119. options._compiled = true
  120. }
  121. // functional template
  122. if (functionalTemplate) {
  123. options.functional = true
  124. }
  125. // scopedId
  126. if (scopeId) {
  127. options._scopeId = 'data-v-' + scopeId
  128. }
  129. var hook
  130. if (moduleIdentifier) { // server build
  131. hook = function (context) {
  132. // 2.3 injection
  133. context =
  134. context || // cached call
  135. (this.$vnode && this.$vnode.ssrContext) || // stateful
  136. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  137. // 2.2 with runInNewContext: true
  138. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  139. context = __VUE_SSR_CONTEXT__
  140. }
  141. // inject component styles
  142. if (injectStyles) {
  143. injectStyles.call(this, context)
  144. }
  145. // register component module identifier for async chunk inferrence
  146. if (context && context._registeredComponents) {
  147. context._registeredComponents.add(moduleIdentifier)
  148. }
  149. }
  150. // used by ssr in case component is cached and beforeCreate
  151. // never gets called
  152. options._ssrRegister = hook
  153. } else if (injectStyles) {
  154. hook = shadowMode
  155. ? function () {
  156. injectStyles.call(
  157. this,
  158. (options.functional ? this.parent : this).$root.$options.shadowRoot
  159. )
  160. }
  161. : injectStyles
  162. }
  163. if (hook) {
  164. if (options.functional) {
  165. // for template-only hot-reload because in that case the render fn doesn't
  166. // go through the normalizer
  167. options._injectStyles = hook
  168. // register for functional component in vue file
  169. var originalRender = options.render
  170. options.render = function renderWithStyleInjection (h, context) {
  171. hook.call(context)
  172. return originalRender(h, context)
  173. }
  174. } else {
  175. // inject component registration as beforeCreate hook
  176. var existing = options.beforeCreate
  177. options.beforeCreate = existing
  178. ? [].concat(existing, hook)
  179. : [hook]
  180. }
  181. }
  182. return {
  183. exports: scriptExports,
  184. options: options
  185. }
  186. }
  187. /***/ }),
  188. /***/ 561:
  189. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  190. "use strict";
  191. // ESM COMPAT FLAG
  192. __webpack_require__.r(__webpack_exports__);
  193. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/carousel/src/item.vue?vue&type=template&id=1801ae19&
  194. var render = function() {
  195. var _vm = this
  196. var _h = _vm.$createElement
  197. var _c = _vm._self._c || _h
  198. return _c(
  199. "div",
  200. {
  201. directives: [
  202. {
  203. name: "show",
  204. rawName: "v-show",
  205. value: _vm.ready,
  206. expression: "ready"
  207. }
  208. ],
  209. staticClass: "el-carousel__item",
  210. class: {
  211. "is-active": _vm.active,
  212. "el-carousel__item--card": _vm.$parent.type === "card",
  213. "is-in-stage": _vm.inStage,
  214. "is-hover": _vm.hover,
  215. "is-animating": _vm.animating
  216. },
  217. style: _vm.itemStyle,
  218. on: { click: _vm.handleItemClick }
  219. },
  220. [
  221. _vm.$parent.type === "card"
  222. ? _c("div", {
  223. directives: [
  224. {
  225. name: "show",
  226. rawName: "v-show",
  227. value: !_vm.active,
  228. expression: "!active"
  229. }
  230. ],
  231. staticClass: "el-carousel__mask"
  232. })
  233. : _vm._e(),
  234. _vm._t("default")
  235. ],
  236. 2
  237. )
  238. }
  239. var staticRenderFns = []
  240. render._withStripped = true
  241. // CONCATENATED MODULE: ./packages/carousel/src/item.vue?vue&type=template&id=1801ae19&
  242. // EXTERNAL MODULE: external "tis-ui/lib/utils/util"
  243. var util_ = __webpack_require__(10);
  244. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/carousel/src/item.vue?vue&type=script&lang=js&
  245. //
  246. //
  247. //
  248. //
  249. //
  250. //
  251. //
  252. //
  253. //
  254. //
  255. //
  256. //
  257. //
  258. //
  259. //
  260. //
  261. //
  262. //
  263. //
  264. //
  265. //
  266. //
  267. var CARD_SCALE = 0.83;
  268. /* harmony default export */ var itemvue_type_script_lang_js_ = ({
  269. name: 'TisCarouselItem',
  270. props: {
  271. name: String,
  272. label: {
  273. type: [String, Number],
  274. default: ''
  275. }
  276. },
  277. data: function data() {
  278. return {
  279. hover: false,
  280. translate: 0,
  281. scale: 1,
  282. active: false,
  283. ready: false,
  284. inStage: false,
  285. animating: false
  286. };
  287. },
  288. methods: {
  289. processIndex: function processIndex(index, activeIndex, length) {
  290. if (activeIndex === 0 && index === length - 1) {
  291. return -1;
  292. } else if (activeIndex === length - 1 && index === 0) {
  293. return length;
  294. } else if (index < activeIndex - 1 && activeIndex - index >= length / 2) {
  295. return length + 1;
  296. } else if (index > activeIndex + 1 && index - activeIndex >= length / 2) {
  297. return -2;
  298. }
  299. return index;
  300. },
  301. calcCardTranslate: function calcCardTranslate(index, activeIndex) {
  302. var parentWidth = this.$parent.$el.offsetWidth;
  303. if (this.inStage) {
  304. return parentWidth * ((2 - CARD_SCALE) * (index - activeIndex) + 1) / 4;
  305. } else if (index < activeIndex) {
  306. return -(1 + CARD_SCALE) * parentWidth / 4;
  307. } else {
  308. return (3 + CARD_SCALE) * parentWidth / 4;
  309. }
  310. },
  311. calcTranslate: function calcTranslate(index, activeIndex, isVertical) {
  312. var distance = this.$parent.$el[isVertical ? 'offsetHeight' : 'offsetWidth'];
  313. return distance * (index - activeIndex);
  314. },
  315. translateItem: function translateItem(index, activeIndex, oldIndex) {
  316. var parentType = this.$parent.type;
  317. var parentDirection = this.parentDirection;
  318. var length = this.$parent.items.length;
  319. if (parentType !== 'card' && oldIndex !== undefined) {
  320. this.animating = index === activeIndex || index === oldIndex;
  321. }
  322. if (index !== activeIndex && length > 2 && this.$parent.loop) {
  323. index = this.processIndex(index, activeIndex, length);
  324. }
  325. if (parentType === 'card') {
  326. if (parentDirection === 'vertical') {
  327. console.warn('[Element Warn][Carousel]vertical direction is not supported in card mode');
  328. }
  329. this.inStage = Math.round(Math.abs(index - activeIndex)) <= 1;
  330. this.active = index === activeIndex;
  331. this.translate = this.calcCardTranslate(index, activeIndex);
  332. this.scale = this.active ? 1 : CARD_SCALE;
  333. } else {
  334. this.active = index === activeIndex;
  335. var isVertical = parentDirection === 'vertical';
  336. this.translate = this.calcTranslate(index, activeIndex, isVertical);
  337. }
  338. this.ready = true;
  339. },
  340. handleItemClick: function handleItemClick() {
  341. var parent = this.$parent;
  342. if (parent && parent.type === 'card') {
  343. var index = parent.items.indexOf(this);
  344. parent.setActiveItem(index);
  345. }
  346. }
  347. },
  348. computed: {
  349. parentDirection: function parentDirection() {
  350. return this.$parent.direction;
  351. },
  352. itemStyle: function itemStyle() {
  353. var translateType = this.parentDirection === 'vertical' ? 'translateY' : 'translateX';
  354. var value = translateType + '(' + this.translate + 'px) scale(' + this.scale + ')';
  355. var style = {
  356. transform: value
  357. };
  358. return Object(util_["autoprefixer"])(style);
  359. }
  360. },
  361. created: function created() {
  362. this.$parent && this.$parent.updateItems();
  363. },
  364. destroyed: function destroyed() {
  365. this.$parent && this.$parent.updateItems();
  366. }
  367. });
  368. // CONCATENATED MODULE: ./packages/carousel/src/item.vue?vue&type=script&lang=js&
  369. /* harmony default export */ var src_itemvue_type_script_lang_js_ = (itemvue_type_script_lang_js_);
  370. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  371. var componentNormalizer = __webpack_require__(2);
  372. // CONCATENATED MODULE: ./packages/carousel/src/item.vue
  373. /* normalize component */
  374. var component = Object(componentNormalizer["a" /* default */])(
  375. src_itemvue_type_script_lang_js_,
  376. render,
  377. staticRenderFns,
  378. false,
  379. null,
  380. null,
  381. null
  382. )
  383. /* hot reload */
  384. if (false) { var api; }
  385. component.options.__file = "packages/carousel/src/item.vue"
  386. /* harmony default export */ var item = (component.exports);
  387. // CONCATENATED MODULE: ./packages/carousel-item/index.js
  388. /* istanbul ignore next */
  389. item.install = function (Vue) {
  390. Vue.component(item.name, item);
  391. };
  392. /* harmony default export */ var carousel_item = __webpack_exports__["default"] = (item);
  393. /***/ })
  394. /******/ });