框架源码
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.

1779 lines
46 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 = 518);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ 123:
  90. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  91. "use strict";
  92. // ESM COMPAT FLAG
  93. __webpack_require__.r(__webpack_exports__);
  94. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/progress/src/progress.vue?vue&type=template&id=229ee406&
  95. var render = function() {
  96. var _vm = this
  97. var _h = _vm.$createElement
  98. var _c = _vm._self._c || _h
  99. return _c(
  100. "div",
  101. {
  102. staticClass: "el-progress",
  103. class: [
  104. "el-progress--" + _vm.type,
  105. _vm.status ? "is-" + _vm.status : "",
  106. {
  107. "el-progress--without-text": !_vm.showText,
  108. "el-progress--text-inside": _vm.textInside
  109. }
  110. ],
  111. attrs: {
  112. role: "progressbar",
  113. "aria-valuenow": _vm.percentage,
  114. "aria-valuemin": "0",
  115. "aria-valuemax": "100"
  116. }
  117. },
  118. [
  119. _vm.type === "line"
  120. ? _c("div", { staticClass: "el-progress-bar" }, [
  121. _c(
  122. "div",
  123. {
  124. staticClass: "el-progress-bar__outer",
  125. style: { height: _vm.strokeWidth + "px" }
  126. },
  127. [
  128. _c(
  129. "div",
  130. {
  131. staticClass: "el-progress-bar__inner",
  132. style: _vm.barStyle
  133. },
  134. [
  135. _vm.showText && _vm.textInside
  136. ? _c(
  137. "div",
  138. { staticClass: "el-progress-bar__innerText" },
  139. [_vm._v(_vm._s(_vm.content))]
  140. )
  141. : _vm._e()
  142. ]
  143. )
  144. ]
  145. )
  146. ])
  147. : _c(
  148. "div",
  149. {
  150. staticClass: "el-progress-circle",
  151. style: { height: _vm.width + "px", width: _vm.width + "px" }
  152. },
  153. [
  154. _c("svg", { attrs: { viewBox: "0 0 100 100" } }, [
  155. _c("path", {
  156. staticClass: "el-progress-circle__track",
  157. style: _vm.trailPathStyle,
  158. attrs: {
  159. d: _vm.trackPath,
  160. stroke: "#e5e9f2",
  161. "stroke-width": _vm.relativeStrokeWidth,
  162. fill: "none"
  163. }
  164. }),
  165. _c("path", {
  166. staticClass: "el-progress-circle__path",
  167. style: _vm.circlePathStyle,
  168. attrs: {
  169. d: _vm.trackPath,
  170. stroke: _vm.stroke,
  171. fill: "none",
  172. "stroke-linecap": _vm.strokeLinecap,
  173. "stroke-width": _vm.percentage ? _vm.relativeStrokeWidth : 0
  174. }
  175. })
  176. ])
  177. ]
  178. ),
  179. _vm.showText && !_vm.textInside
  180. ? _c(
  181. "div",
  182. {
  183. staticClass: "el-progress__text",
  184. style: { fontSize: _vm.progressTextSize + "px" }
  185. },
  186. [
  187. !_vm.status
  188. ? [_vm._v(_vm._s(_vm.content))]
  189. : _c("i", { class: _vm.iconClass })
  190. ],
  191. 2
  192. )
  193. : _vm._e()
  194. ]
  195. )
  196. }
  197. var staticRenderFns = []
  198. render._withStripped = true
  199. // CONCATENATED MODULE: ./packages/progress/src/progress.vue?vue&type=template&id=229ee406&
  200. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/progress/src/progress.vue?vue&type=script&lang=js&
  201. //
  202. //
  203. //
  204. //
  205. //
  206. //
  207. //
  208. //
  209. //
  210. //
  211. //
  212. //
  213. //
  214. //
  215. //
  216. //
  217. //
  218. //
  219. //
  220. //
  221. //
  222. //
  223. //
  224. //
  225. //
  226. //
  227. //
  228. //
  229. //
  230. //
  231. //
  232. //
  233. //
  234. //
  235. //
  236. //
  237. //
  238. //
  239. //
  240. //
  241. //
  242. //
  243. //
  244. //
  245. //
  246. //
  247. //
  248. //
  249. //
  250. //
  251. //
  252. //
  253. /* harmony default export */ var progressvue_type_script_lang_js_ = ({
  254. name: 'TisProgress',
  255. props: {
  256. type: {
  257. type: String,
  258. default: 'line',
  259. validator: function validator(val) {
  260. return ['line', 'circle', 'dashboard'].indexOf(val) > -1;
  261. }
  262. },
  263. percentage: {
  264. type: Number,
  265. default: 0,
  266. required: true,
  267. validator: function validator(val) {
  268. return val >= 0 && val <= 100;
  269. }
  270. },
  271. status: {
  272. type: String,
  273. validator: function validator(val) {
  274. return ['success', 'exception', 'warning'].indexOf(val) > -1;
  275. }
  276. },
  277. strokeWidth: {
  278. type: Number,
  279. default: 6
  280. },
  281. strokeLinecap: {
  282. type: String,
  283. default: 'round'
  284. },
  285. textInside: {
  286. type: Boolean,
  287. default: false
  288. },
  289. width: {
  290. type: Number,
  291. default: 126
  292. },
  293. showText: {
  294. type: Boolean,
  295. default: true
  296. },
  297. color: {
  298. type: [String, Array, Function],
  299. default: ''
  300. },
  301. format: Function
  302. },
  303. computed: {
  304. barStyle: function barStyle() {
  305. var style = {};
  306. style.width = this.percentage + '%';
  307. style.backgroundColor = this.getCurrentColor(this.percentage);
  308. return style;
  309. },
  310. relativeStrokeWidth: function relativeStrokeWidth() {
  311. return (this.strokeWidth / this.width * 100).toFixed(1);
  312. },
  313. radius: function radius() {
  314. if (this.type === 'circle' || this.type === 'dashboard') {
  315. return parseInt(50 - parseFloat(this.relativeStrokeWidth) / 2, 10);
  316. } else {
  317. return 0;
  318. }
  319. },
  320. trackPath: function trackPath() {
  321. var radius = this.radius;
  322. var isDashboard = this.type === 'dashboard';
  323. return '\n M 50 50\n m 0 ' + (isDashboard ? '' : '-') + radius + '\n a ' + radius + ' ' + radius + ' 0 1 1 0 ' + (isDashboard ? '-' : '') + radius * 2 + '\n a ' + radius + ' ' + radius + ' 0 1 1 0 ' + (isDashboard ? '' : '-') + radius * 2 + '\n ';
  324. },
  325. perimeter: function perimeter() {
  326. return 2 * Math.PI * this.radius;
  327. },
  328. rate: function rate() {
  329. return this.type === 'dashboard' ? 0.75 : 1;
  330. },
  331. strokeDashoffset: function strokeDashoffset() {
  332. var offset = -1 * this.perimeter * (1 - this.rate) / 2;
  333. return offset + 'px';
  334. },
  335. trailPathStyle: function trailPathStyle() {
  336. return {
  337. strokeDasharray: this.perimeter * this.rate + 'px, ' + this.perimeter + 'px',
  338. strokeDashoffset: this.strokeDashoffset
  339. };
  340. },
  341. circlePathStyle: function circlePathStyle() {
  342. return {
  343. strokeDasharray: this.perimeter * this.rate * (this.percentage / 100) + 'px, ' + this.perimeter + 'px',
  344. strokeDashoffset: this.strokeDashoffset,
  345. transition: 'stroke-dasharray 0.6s ease 0s, stroke 0.6s ease'
  346. };
  347. },
  348. stroke: function stroke() {
  349. var ret = void 0;
  350. if (this.color) {
  351. ret = this.getCurrentColor(this.percentage);
  352. } else {
  353. switch (this.status) {
  354. case 'success':
  355. ret = '#13ce66';
  356. break;
  357. case 'exception':
  358. ret = '#ff4949';
  359. break;
  360. case 'warning':
  361. ret = '#e6a23c';
  362. break;
  363. default:
  364. ret = '#20a0ff';
  365. }
  366. }
  367. return ret;
  368. },
  369. iconClass: function iconClass() {
  370. if (this.status === 'warning') {
  371. return 'el-icon-warning';
  372. }
  373. if (this.type === 'line') {
  374. return this.status === 'success' ? 'el-icon-circle-check' : 'el-icon-circle-close';
  375. } else {
  376. return this.status === 'success' ? 'el-icon-check' : 'el-icon-close';
  377. }
  378. },
  379. progressTextSize: function progressTextSize() {
  380. return this.type === 'line' ? 12 + this.strokeWidth * 0.4 : this.width * 0.111111 + 2;
  381. },
  382. content: function content() {
  383. if (typeof this.format === 'function') {
  384. return this.format(this.percentage) || '';
  385. } else {
  386. return this.percentage + '%';
  387. }
  388. }
  389. },
  390. methods: {
  391. getCurrentColor: function getCurrentColor(percentage) {
  392. if (typeof this.color === 'function') {
  393. return this.color(percentage);
  394. } else if (typeof this.color === 'string') {
  395. return this.color;
  396. } else {
  397. return this.getLevelColor(percentage);
  398. }
  399. },
  400. getLevelColor: function getLevelColor(percentage) {
  401. var colorArray = this.getColorArray().sort(function (a, b) {
  402. return a.percentage - b.percentage;
  403. });
  404. for (var i = 0; i < colorArray.length; i++) {
  405. if (colorArray[i].percentage > percentage) {
  406. return colorArray[i].color;
  407. }
  408. }
  409. return colorArray[colorArray.length - 1].color;
  410. },
  411. getColorArray: function getColorArray() {
  412. var color = this.color;
  413. var span = 100 / color.length;
  414. return color.map(function (seriesColor, index) {
  415. if (typeof seriesColor === 'string') {
  416. return {
  417. color: seriesColor,
  418. percentage: (index + 1) * span
  419. };
  420. }
  421. return seriesColor;
  422. });
  423. }
  424. }
  425. });
  426. // CONCATENATED MODULE: ./packages/progress/src/progress.vue?vue&type=script&lang=js&
  427. /* harmony default export */ var src_progressvue_type_script_lang_js_ = (progressvue_type_script_lang_js_);
  428. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  429. var componentNormalizer = __webpack_require__(2);
  430. // CONCATENATED MODULE: ./packages/progress/src/progress.vue
  431. /* normalize component */
  432. var component = Object(componentNormalizer["a" /* default */])(
  433. src_progressvue_type_script_lang_js_,
  434. render,
  435. staticRenderFns,
  436. false,
  437. null,
  438. null,
  439. null
  440. )
  441. /* hot reload */
  442. if (false) { var api; }
  443. component.options.__file = "packages/progress/src/progress.vue"
  444. /* harmony default export */ var progress = (component.exports);
  445. // CONCATENATED MODULE: ./packages/progress/index.js
  446. /* istanbul ignore next */
  447. progress.install = function (Vue) {
  448. Vue.component(progress.name, progress);
  449. };
  450. /* harmony default export */ var packages_progress = __webpack_exports__["default"] = (progress);
  451. /***/ }),
  452. /***/ 2:
  453. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  454. "use strict";
  455. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
  456. /* globals __VUE_SSR_CONTEXT__ */
  457. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  458. // This module is a runtime utility for cleaner component module output and will
  459. // be included in the final webpack user bundle.
  460. function normalizeComponent (
  461. scriptExports,
  462. render,
  463. staticRenderFns,
  464. functionalTemplate,
  465. injectStyles,
  466. scopeId,
  467. moduleIdentifier, /* server only */
  468. shadowMode /* vue-cli only */
  469. ) {
  470. // Vue.extend constructor export interop
  471. var options = typeof scriptExports === 'function'
  472. ? scriptExports.options
  473. : scriptExports
  474. // render functions
  475. if (render) {
  476. options.render = render
  477. options.staticRenderFns = staticRenderFns
  478. options._compiled = true
  479. }
  480. // functional template
  481. if (functionalTemplate) {
  482. options.functional = true
  483. }
  484. // scopedId
  485. if (scopeId) {
  486. options._scopeId = 'data-v-' + scopeId
  487. }
  488. var hook
  489. if (moduleIdentifier) { // server build
  490. hook = function (context) {
  491. // 2.3 injection
  492. context =
  493. context || // cached call
  494. (this.$vnode && this.$vnode.ssrContext) || // stateful
  495. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  496. // 2.2 with runInNewContext: true
  497. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  498. context = __VUE_SSR_CONTEXT__
  499. }
  500. // inject component styles
  501. if (injectStyles) {
  502. injectStyles.call(this, context)
  503. }
  504. // register component module identifier for async chunk inferrence
  505. if (context && context._registeredComponents) {
  506. context._registeredComponents.add(moduleIdentifier)
  507. }
  508. }
  509. // used by ssr in case component is cached and beforeCreate
  510. // never gets called
  511. options._ssrRegister = hook
  512. } else if (injectStyles) {
  513. hook = shadowMode
  514. ? function () {
  515. injectStyles.call(
  516. this,
  517. (options.functional ? this.parent : this).$root.$options.shadowRoot
  518. )
  519. }
  520. : injectStyles
  521. }
  522. if (hook) {
  523. if (options.functional) {
  524. // for template-only hot-reload because in that case the render fn doesn't
  525. // go through the normalizer
  526. options._injectStyles = hook
  527. // register for functional component in vue file
  528. var originalRender = options.render
  529. options.render = function renderWithStyleInjection (h, context) {
  530. hook.call(context)
  531. return originalRender(h, context)
  532. }
  533. } else {
  534. // inject component registration as beforeCreate hook
  535. var existing = options.beforeCreate
  536. options.beforeCreate = existing
  537. ? [].concat(existing, hook)
  538. : [hook]
  539. }
  540. }
  541. return {
  542. exports: scriptExports,
  543. options: options
  544. }
  545. }
  546. /***/ }),
  547. /***/ 36:
  548. /***/ (function(module, exports) {
  549. module.exports = require("tis-ui/lib/mixins/migrating");
  550. /***/ }),
  551. /***/ 38:
  552. /***/ (function(module, exports) {
  553. module.exports = require("tis-ui/lib/mixins/locale");
  554. /***/ }),
  555. /***/ 518:
  556. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  557. "use strict";
  558. // ESM COMPAT FLAG
  559. __webpack_require__.r(__webpack_exports__);
  560. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/upload/src/upload-list.vue?vue&type=template&id=173fedf5&
  561. var upload_listvue_type_template_id_173fedf5_render = function() {
  562. var _vm = this
  563. var _h = _vm.$createElement
  564. var _c = _vm._self._c || _h
  565. return _c(
  566. "transition-group",
  567. {
  568. class: [
  569. "el-upload-list",
  570. "el-upload-list--" + _vm.listType,
  571. { "is-disabled": _vm.disabled }
  572. ],
  573. attrs: { tag: "ul", name: "el-list" }
  574. },
  575. _vm._l(_vm.files, function(file) {
  576. return _c(
  577. "li",
  578. {
  579. key: file.uid,
  580. class: [
  581. "el-upload-list__item",
  582. "is-" + file.status,
  583. _vm.focusing ? "focusing" : ""
  584. ],
  585. attrs: { tabindex: "0" },
  586. on: {
  587. keydown: function($event) {
  588. if (
  589. !("button" in $event) &&
  590. _vm._k($event.keyCode, "delete", [8, 46], $event.key, [
  591. "Backspace",
  592. "Delete",
  593. "Del"
  594. ])
  595. ) {
  596. return null
  597. }
  598. !_vm.disabled && _vm.$emit("remove", file)
  599. },
  600. focus: function($event) {
  601. _vm.focusing = true
  602. },
  603. blur: function($event) {
  604. _vm.focusing = false
  605. },
  606. click: function($event) {
  607. _vm.focusing = false
  608. }
  609. }
  610. },
  611. [
  612. _vm._t(
  613. "default",
  614. [
  615. file.status !== "uploading" &&
  616. ["picture-card", "picture"].indexOf(_vm.listType) > -1
  617. ? _c("img", {
  618. staticClass: "el-upload-list__item-thumbnail",
  619. attrs: { src: file.url, alt: "" }
  620. })
  621. : _vm._e(),
  622. _c(
  623. "a",
  624. {
  625. staticClass: "el-upload-list__item-name",
  626. on: {
  627. click: function($event) {
  628. _vm.handleClick(file)
  629. }
  630. }
  631. },
  632. [
  633. _c("i", { staticClass: "el-icon-document" }),
  634. _vm._v(_vm._s(file.name) + "\n ")
  635. ]
  636. ),
  637. _c(
  638. "label",
  639. { staticClass: "el-upload-list__item-status-label" },
  640. [
  641. _c("i", {
  642. class: {
  643. "el-icon-upload-success": true,
  644. "el-icon-circle-check": _vm.listType === "text",
  645. "el-icon-check":
  646. ["picture-card", "picture"].indexOf(_vm.listType) > -1
  647. }
  648. })
  649. ]
  650. ),
  651. !_vm.disabled
  652. ? _c("i", {
  653. staticClass: "el-icon-close",
  654. on: {
  655. click: function($event) {
  656. _vm.$emit("remove", file)
  657. }
  658. }
  659. })
  660. : _vm._e(),
  661. !_vm.disabled
  662. ? _c("i", { staticClass: "el-icon-close-tip" }, [
  663. _vm._v(_vm._s(_vm.t("el.upload.deleteTip")))
  664. ])
  665. : _vm._e(),
  666. file.status === "uploading"
  667. ? _c("tis-progress", {
  668. attrs: {
  669. type: _vm.listType === "picture-card" ? "circle" : "line",
  670. "stroke-width": _vm.listType === "picture-card" ? 6 : 2,
  671. percentage: _vm.parsePercentage(file.percentage)
  672. }
  673. })
  674. : _vm._e(),
  675. _vm.listType === "picture-card"
  676. ? _c("span", { staticClass: "el-upload-list__item-actions" }, [
  677. _vm.handlePreview && _vm.listType === "picture-card"
  678. ? _c(
  679. "span",
  680. {
  681. staticClass: "el-upload-list__item-preview",
  682. on: {
  683. click: function($event) {
  684. _vm.handlePreview(file)
  685. }
  686. }
  687. },
  688. [_c("i", { staticClass: "el-icon-zoom-in" })]
  689. )
  690. : _vm._e(),
  691. !_vm.disabled
  692. ? _c(
  693. "span",
  694. {
  695. staticClass: "el-upload-list__item-delete",
  696. on: {
  697. click: function($event) {
  698. _vm.$emit("remove", file)
  699. }
  700. }
  701. },
  702. [_c("i", { staticClass: "el-icon-delete" })]
  703. )
  704. : _vm._e()
  705. ])
  706. : _vm._e()
  707. ],
  708. { file: file }
  709. )
  710. ],
  711. 2
  712. )
  713. }),
  714. 0
  715. )
  716. }
  717. var staticRenderFns = []
  718. upload_listvue_type_template_id_173fedf5_render._withStripped = true
  719. // CONCATENATED MODULE: ./packages/upload/src/upload-list.vue?vue&type=template&id=173fedf5&
  720. // EXTERNAL MODULE: external "tis-ui/lib/mixins/locale"
  721. var locale_ = __webpack_require__(38);
  722. var locale_default = /*#__PURE__*/__webpack_require__.n(locale_);
  723. // EXTERNAL MODULE: ./packages/progress/index.js + 5 modules
  724. var progress = __webpack_require__(123);
  725. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/upload/src/upload-list.vue?vue&type=script&lang=js&
  726. //
  727. //
  728. //
  729. //
  730. //
  731. //
  732. //
  733. //
  734. //
  735. //
  736. //
  737. //
  738. //
  739. //
  740. //
  741. //
  742. //
  743. //
  744. //
  745. //
  746. //
  747. //
  748. //
  749. //
  750. //
  751. //
  752. //
  753. //
  754. //
  755. //
  756. //
  757. //
  758. //
  759. //
  760. //
  761. //
  762. //
  763. //
  764. //
  765. //
  766. //
  767. //
  768. //
  769. //
  770. //
  771. //
  772. //
  773. //
  774. //
  775. //
  776. //
  777. //
  778. //
  779. //
  780. //
  781. //
  782. //
  783. //
  784. //
  785. //
  786. //
  787. //
  788. //
  789. //
  790. /* harmony default export */ var upload_listvue_type_script_lang_js_ = ({
  791. name: 'TisUploadList',
  792. mixins: [locale_default.a],
  793. data: function data() {
  794. return {
  795. focusing: false
  796. };
  797. },
  798. components: { ElProgress: progress["default"] },
  799. props: {
  800. files: {
  801. type: Array,
  802. default: function _default() {
  803. return [];
  804. }
  805. },
  806. disabled: {
  807. type: Boolean,
  808. default: false
  809. },
  810. handlePreview: Function,
  811. listType: String
  812. },
  813. methods: {
  814. parsePercentage: function parsePercentage(val) {
  815. return parseInt(val, 10);
  816. },
  817. handleClick: function handleClick(file) {
  818. this.handlePreview && this.handlePreview(file);
  819. }
  820. }
  821. });
  822. // CONCATENATED MODULE: ./packages/upload/src/upload-list.vue?vue&type=script&lang=js&
  823. /* harmony default export */ var src_upload_listvue_type_script_lang_js_ = (upload_listvue_type_script_lang_js_);
  824. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  825. var componentNormalizer = __webpack_require__(2);
  826. // CONCATENATED MODULE: ./packages/upload/src/upload-list.vue
  827. /* normalize component */
  828. var component = Object(componentNormalizer["a" /* default */])(
  829. src_upload_listvue_type_script_lang_js_,
  830. upload_listvue_type_template_id_173fedf5_render,
  831. staticRenderFns,
  832. false,
  833. null,
  834. null,
  835. null
  836. )
  837. /* hot reload */
  838. if (false) { var api; }
  839. component.options.__file = "packages/upload/src/upload-list.vue"
  840. /* harmony default export */ var upload_list = (component.exports);
  841. // EXTERNAL MODULE: external "babel-helper-vue-jsx-merge-props"
  842. var external_babel_helper_vue_jsx_merge_props_ = __webpack_require__(90);
  843. var external_babel_helper_vue_jsx_merge_props_default = /*#__PURE__*/__webpack_require__.n(external_babel_helper_vue_jsx_merge_props_);
  844. // CONCATENATED MODULE: ./packages/upload/src/ajax.js
  845. function getError(action, option, xhr) {
  846. var msg = void 0;
  847. if (xhr.response) {
  848. msg = '' + (xhr.response.error || xhr.response);
  849. } else if (xhr.responseText) {
  850. msg = '' + xhr.responseText;
  851. } else {
  852. msg = 'fail to post ' + action + ' ' + xhr.status;
  853. }
  854. var err = new Error(msg);
  855. err.status = xhr.status;
  856. err.method = 'post';
  857. err.url = action;
  858. return err;
  859. }
  860. function getBody(xhr) {
  861. var text = xhr.responseText || xhr.response;
  862. if (!text) {
  863. return text;
  864. }
  865. try {
  866. return JSON.parse(text);
  867. } catch (e) {
  868. return text;
  869. }
  870. }
  871. function upload(option) {
  872. if (typeof XMLHttpRequest === 'undefined') {
  873. return;
  874. }
  875. var xhr = new XMLHttpRequest();
  876. var action = option.action;
  877. if (xhr.upload) {
  878. xhr.upload.onprogress = function progress(e) {
  879. if (e.total > 0) {
  880. e.percent = e.loaded / e.total * 100;
  881. }
  882. option.onProgress(e);
  883. };
  884. }
  885. var formData = new FormData();
  886. if (option.data) {
  887. Object.keys(option.data).forEach(function (key) {
  888. formData.append(key, option.data[key]);
  889. });
  890. }
  891. formData.append(option.filename, option.file, option.file.name);
  892. xhr.onerror = function error(e) {
  893. option.onError(e);
  894. };
  895. xhr.onload = function onload() {
  896. if (xhr.status < 200 || xhr.status >= 300) {
  897. return option.onError(getError(action, option, xhr));
  898. }
  899. option.onSuccess(getBody(xhr));
  900. };
  901. xhr.open('post', action, true);
  902. if (option.withCredentials && 'withCredentials' in xhr) {
  903. xhr.withCredentials = true;
  904. }
  905. var headers = option.headers || {};
  906. for (var item in headers) {
  907. if (headers.hasOwnProperty(item) && headers[item] !== null) {
  908. xhr.setRequestHeader(item, headers[item]);
  909. }
  910. }
  911. xhr.send(formData);
  912. return xhr;
  913. }
  914. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/upload/src/upload-dragger.vue?vue&type=template&id=7ebbf219&
  915. var upload_draggervue_type_template_id_7ebbf219_render = function() {
  916. var _vm = this
  917. var _h = _vm.$createElement
  918. var _c = _vm._self._c || _h
  919. return _c(
  920. "div",
  921. {
  922. staticClass: "el-upload-dragger",
  923. class: {
  924. "is-dragover": _vm.dragover
  925. },
  926. on: {
  927. drop: function($event) {
  928. $event.preventDefault()
  929. return _vm.onDrop($event)
  930. },
  931. dragover: function($event) {
  932. $event.preventDefault()
  933. return _vm.onDragover($event)
  934. },
  935. dragleave: function($event) {
  936. $event.preventDefault()
  937. _vm.dragover = false
  938. }
  939. }
  940. },
  941. [_vm._t("default")],
  942. 2
  943. )
  944. }
  945. var upload_draggervue_type_template_id_7ebbf219_staticRenderFns = []
  946. upload_draggervue_type_template_id_7ebbf219_render._withStripped = true
  947. // CONCATENATED MODULE: ./packages/upload/src/upload-dragger.vue?vue&type=template&id=7ebbf219&
  948. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/upload/src/upload-dragger.vue?vue&type=script&lang=js&
  949. //
  950. //
  951. //
  952. //
  953. //
  954. //
  955. //
  956. //
  957. //
  958. //
  959. //
  960. //
  961. //
  962. /* harmony default export */ var upload_draggervue_type_script_lang_js_ = ({
  963. name: 'TisUploadDrag',
  964. props: {
  965. disabled: Boolean
  966. },
  967. inject: {
  968. uploader: {
  969. default: ''
  970. }
  971. },
  972. data: function data() {
  973. return {
  974. dragover: false
  975. };
  976. },
  977. methods: {
  978. onDragover: function onDragover() {
  979. if (!this.disabled) {
  980. this.dragover = true;
  981. }
  982. },
  983. onDrop: function onDrop(e) {
  984. if (this.disabled || !this.uploader) return;
  985. var accept = this.uploader.accept;
  986. this.dragover = false;
  987. if (!accept) {
  988. this.$emit('file', e.dataTransfer.files);
  989. return;
  990. }
  991. this.$emit('file', [].slice.call(e.dataTransfer.files).filter(function (file) {
  992. var type = file.type,
  993. name = file.name;
  994. var extension = name.indexOf('.') > -1 ? '.' + name.split('.').pop() : '';
  995. var baseType = type.replace(/\/.*$/, '');
  996. return accept.split(',').map(function (type) {
  997. return type.trim();
  998. }).filter(function (type) {
  999. return type;
  1000. }).some(function (acceptedType) {
  1001. if (/\..+$/.test(acceptedType)) {
  1002. return extension === acceptedType;
  1003. }
  1004. if (/\/\*$/.test(acceptedType)) {
  1005. return baseType === acceptedType.replace(/\/\*$/, '');
  1006. }
  1007. if (/^[^\/]+\/[^\/]+$/.test(acceptedType)) {
  1008. return type === acceptedType;
  1009. }
  1010. return false;
  1011. });
  1012. }));
  1013. }
  1014. }
  1015. });
  1016. // CONCATENATED MODULE: ./packages/upload/src/upload-dragger.vue?vue&type=script&lang=js&
  1017. /* harmony default export */ var src_upload_draggervue_type_script_lang_js_ = (upload_draggervue_type_script_lang_js_);
  1018. // CONCATENATED MODULE: ./packages/upload/src/upload-dragger.vue
  1019. /* normalize component */
  1020. var upload_dragger_component = Object(componentNormalizer["a" /* default */])(
  1021. src_upload_draggervue_type_script_lang_js_,
  1022. upload_draggervue_type_template_id_7ebbf219_render,
  1023. upload_draggervue_type_template_id_7ebbf219_staticRenderFns,
  1024. false,
  1025. null,
  1026. null,
  1027. null
  1028. )
  1029. /* hot reload */
  1030. if (false) { var upload_dragger_api; }
  1031. upload_dragger_component.options.__file = "packages/upload/src/upload-dragger.vue"
  1032. /* harmony default export */ var upload_dragger = (upload_dragger_component.exports);
  1033. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/upload/src/upload.vue?vue&type=script&lang=js&
  1034. /* harmony default export */ var uploadvue_type_script_lang_js_ = ({
  1035. inject: ['uploader'],
  1036. components: {
  1037. UploadDragger: upload_dragger
  1038. },
  1039. props: {
  1040. type: String,
  1041. action: {
  1042. type: String,
  1043. required: true
  1044. },
  1045. name: {
  1046. type: String,
  1047. default: 'file'
  1048. },
  1049. data: Object,
  1050. headers: Object,
  1051. withCredentials: Boolean,
  1052. multiple: Boolean,
  1053. accept: String,
  1054. onStart: Function,
  1055. onProgress: Function,
  1056. onSuccess: Function,
  1057. onError: Function,
  1058. beforeUpload: Function,
  1059. drag: Boolean,
  1060. onPreview: {
  1061. type: Function,
  1062. default: function _default() {}
  1063. },
  1064. onRemove: {
  1065. type: Function,
  1066. default: function _default() {}
  1067. },
  1068. fileList: Array,
  1069. autoUpload: Boolean,
  1070. listType: String,
  1071. httpRequest: {
  1072. type: Function,
  1073. default: upload
  1074. },
  1075. disabled: Boolean,
  1076. limit: Number,
  1077. onExceed: Function
  1078. },
  1079. data: function data() {
  1080. return {
  1081. mouseover: false,
  1082. reqs: {}
  1083. };
  1084. },
  1085. methods: {
  1086. isImage: function isImage(str) {
  1087. return str.indexOf('image') !== -1;
  1088. },
  1089. handleChange: function handleChange(ev) {
  1090. var files = ev.target.files;
  1091. if (!files) return;
  1092. this.uploadFiles(files);
  1093. },
  1094. uploadFiles: function uploadFiles(files) {
  1095. var _this = this;
  1096. if (this.limit && this.fileList.length + files.length > this.limit) {
  1097. this.onExceed && this.onExceed(files, this.fileList);
  1098. return;
  1099. }
  1100. var postFiles = Array.prototype.slice.call(files);
  1101. if (!this.multiple) {
  1102. postFiles = postFiles.slice(0, 1);
  1103. }
  1104. if (postFiles.length === 0) {
  1105. return;
  1106. }
  1107. postFiles.forEach(function (rawFile) {
  1108. _this.onStart(rawFile);
  1109. if (_this.autoUpload) _this.upload(rawFile);
  1110. });
  1111. },
  1112. upload: function upload(rawFile) {
  1113. var _this2 = this;
  1114. this.$refs.input.value = null;
  1115. if (!this.beforeUpload) {
  1116. return this.post(rawFile);
  1117. }
  1118. var before = this.beforeUpload(rawFile);
  1119. if (before && before.then) {
  1120. before.then(function (processedFile) {
  1121. var fileType = Object.prototype.toString.call(processedFile);
  1122. if (fileType === '[object File]' || fileType === '[object Blob]') {
  1123. if (fileType === '[object Blob]') {
  1124. processedFile = new File([processedFile], rawFile.name, {
  1125. type: rawFile.type
  1126. });
  1127. }
  1128. for (var p in rawFile) {
  1129. if (rawFile.hasOwnProperty(p)) {
  1130. processedFile[p] = rawFile[p];
  1131. }
  1132. }
  1133. _this2.post(processedFile);
  1134. } else {
  1135. _this2.post(rawFile);
  1136. }
  1137. }, function () {
  1138. _this2.onRemove(null, rawFile);
  1139. });
  1140. } else if (before !== false) {
  1141. this.post(rawFile);
  1142. } else {
  1143. this.onRemove(null, rawFile);
  1144. }
  1145. },
  1146. abort: function abort(file) {
  1147. var reqs = this.reqs;
  1148. if (file) {
  1149. var uid = file;
  1150. if (file.uid) uid = file.uid;
  1151. if (reqs[uid]) {
  1152. reqs[uid].abort();
  1153. }
  1154. } else {
  1155. Object.keys(reqs).forEach(function (uid) {
  1156. if (reqs[uid]) reqs[uid].abort();
  1157. delete reqs[uid];
  1158. });
  1159. }
  1160. },
  1161. post: function post(rawFile) {
  1162. var _this3 = this;
  1163. var uid = rawFile.uid;
  1164. var options = {
  1165. headers: this.headers,
  1166. withCredentials: this.withCredentials,
  1167. file: rawFile,
  1168. data: this.data,
  1169. filename: this.name,
  1170. action: this.action,
  1171. onProgress: function onProgress(e) {
  1172. _this3.onProgress(e, rawFile);
  1173. },
  1174. onSuccess: function onSuccess(res) {
  1175. _this3.onSuccess(res, rawFile);
  1176. delete _this3.reqs[uid];
  1177. },
  1178. onError: function onError(err) {
  1179. _this3.onError(err, rawFile);
  1180. delete _this3.reqs[uid];
  1181. }
  1182. };
  1183. var req = this.httpRequest(options);
  1184. this.reqs[uid] = req;
  1185. if (req && req.then) {
  1186. req.then(options.onSuccess, options.onError);
  1187. }
  1188. },
  1189. handleClick: function handleClick() {
  1190. if (!this.disabled) {
  1191. this.$refs.input.value = null;
  1192. this.$refs.input.click();
  1193. }
  1194. },
  1195. handleKeydown: function handleKeydown(e) {
  1196. if (e.target !== e.currentTarget) return;
  1197. if (e.keyCode === 13 || e.keyCode === 32) {
  1198. this.handleClick();
  1199. }
  1200. }
  1201. },
  1202. render: function render(h) {
  1203. var handleClick = this.handleClick,
  1204. drag = this.drag,
  1205. name = this.name,
  1206. handleChange = this.handleChange,
  1207. multiple = this.multiple,
  1208. accept = this.accept,
  1209. listType = this.listType,
  1210. uploadFiles = this.uploadFiles,
  1211. disabled = this.disabled,
  1212. handleKeydown = this.handleKeydown;
  1213. var data = {
  1214. class: {
  1215. 'el-upload': true
  1216. },
  1217. on: {
  1218. click: handleClick,
  1219. keydown: handleKeydown
  1220. }
  1221. };
  1222. data.class['el-upload--' + listType] = true;
  1223. return h(
  1224. 'div',
  1225. external_babel_helper_vue_jsx_merge_props_default()([data, {
  1226. attrs: { tabindex: '0' }
  1227. }]),
  1228. [drag ? h(
  1229. 'upload-dragger',
  1230. {
  1231. attrs: { disabled: disabled },
  1232. on: {
  1233. 'file': uploadFiles
  1234. }
  1235. },
  1236. [this.$slots.default]
  1237. ) : this.$slots.default, h('input', { 'class': 'el-upload__input', attrs: { type: 'file', name: name, multiple: multiple, accept: accept },
  1238. ref: 'input', on: {
  1239. 'change': handleChange
  1240. }
  1241. })]
  1242. );
  1243. }
  1244. });
  1245. // CONCATENATED MODULE: ./packages/upload/src/upload.vue?vue&type=script&lang=js&
  1246. /* harmony default export */ var src_uploadvue_type_script_lang_js_ = (uploadvue_type_script_lang_js_);
  1247. // CONCATENATED MODULE: ./packages/upload/src/upload.vue
  1248. var upload_render, upload_staticRenderFns
  1249. /* normalize component */
  1250. var upload_component = Object(componentNormalizer["a" /* default */])(
  1251. src_uploadvue_type_script_lang_js_,
  1252. upload_render,
  1253. upload_staticRenderFns,
  1254. false,
  1255. null,
  1256. null,
  1257. null
  1258. )
  1259. /* hot reload */
  1260. if (false) { var upload_api; }
  1261. upload_component.options.__file = "packages/upload/src/upload.vue"
  1262. /* harmony default export */ var src_upload = (upload_component.exports);
  1263. // EXTERNAL MODULE: external "tis-ui/lib/mixins/migrating"
  1264. var migrating_ = __webpack_require__(36);
  1265. var migrating_default = /*#__PURE__*/__webpack_require__.n(migrating_);
  1266. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/upload/src/index.vue?vue&type=script&lang=js&
  1267. function noop() {}
  1268. /* harmony default export */ var srcvue_type_script_lang_js_ = ({
  1269. name: 'TisUpload',
  1270. mixins: [migrating_default.a],
  1271. components: {
  1272. ElProgress: progress["default"],
  1273. UploadList: upload_list,
  1274. Upload: src_upload
  1275. },
  1276. provide: function provide() {
  1277. return {
  1278. uploader: this
  1279. };
  1280. },
  1281. inject: {
  1282. elForm: {
  1283. default: ''
  1284. }
  1285. },
  1286. props: {
  1287. action: {
  1288. type: String,
  1289. required: true
  1290. },
  1291. headers: {
  1292. type: Object,
  1293. default: function _default() {
  1294. return {};
  1295. }
  1296. },
  1297. data: Object,
  1298. multiple: Boolean,
  1299. name: {
  1300. type: String,
  1301. default: 'file'
  1302. },
  1303. drag: Boolean,
  1304. dragger: Boolean,
  1305. withCredentials: Boolean,
  1306. showFileList: {
  1307. type: Boolean,
  1308. default: true
  1309. },
  1310. accept: String,
  1311. type: {
  1312. type: String,
  1313. default: 'select'
  1314. },
  1315. beforeUpload: Function,
  1316. beforeRemove: Function,
  1317. onRemove: {
  1318. type: Function,
  1319. default: noop
  1320. },
  1321. onChange: {
  1322. type: Function,
  1323. default: noop
  1324. },
  1325. onPreview: {
  1326. type: Function
  1327. },
  1328. onSuccess: {
  1329. type: Function,
  1330. default: noop
  1331. },
  1332. onProgress: {
  1333. type: Function,
  1334. default: noop
  1335. },
  1336. onError: {
  1337. type: Function,
  1338. default: noop
  1339. },
  1340. fileList: {
  1341. type: Array,
  1342. default: function _default() {
  1343. return [];
  1344. }
  1345. },
  1346. autoUpload: {
  1347. type: Boolean,
  1348. default: true
  1349. },
  1350. listType: {
  1351. type: String,
  1352. default: 'text' // text,picture,picture-card
  1353. },
  1354. httpRequest: Function,
  1355. disabled: Boolean,
  1356. limit: Number,
  1357. onExceed: {
  1358. type: Function,
  1359. default: noop
  1360. }
  1361. },
  1362. data: function data() {
  1363. return {
  1364. uploadFiles: [],
  1365. dragOver: false,
  1366. draging: false,
  1367. tempIndex: 1
  1368. };
  1369. },
  1370. computed: {
  1371. uploadDisabled: function uploadDisabled() {
  1372. return this.disabled || (this.elForm || {}).disabled;
  1373. }
  1374. },
  1375. watch: {
  1376. listType: function listType(type) {
  1377. if (type === 'picture-card' || type === 'picture') {
  1378. this.uploadFiles = this.uploadFiles.map(function (file) {
  1379. if (!file.url && file.raw) {
  1380. try {
  1381. file.url = URL.createObjectURL(file.raw);
  1382. } catch (err) {
  1383. console.error('[Element Error][Upload]', err);
  1384. }
  1385. }
  1386. return file;
  1387. });
  1388. }
  1389. },
  1390. fileList: {
  1391. immediate: true,
  1392. handler: function handler(fileList) {
  1393. var _this = this;
  1394. this.uploadFiles = fileList.map(function (item) {
  1395. item.uid = item.uid || Date.now() + _this.tempIndex++;
  1396. item.status = item.status || 'success';
  1397. return item;
  1398. });
  1399. }
  1400. }
  1401. },
  1402. methods: {
  1403. handleStart: function handleStart(rawFile) {
  1404. rawFile.uid = Date.now() + this.tempIndex++;
  1405. var file = {
  1406. status: 'ready',
  1407. name: rawFile.name,
  1408. size: rawFile.size,
  1409. percentage: 0,
  1410. uid: rawFile.uid,
  1411. raw: rawFile
  1412. };
  1413. if (this.listType === 'picture-card' || this.listType === 'picture') {
  1414. try {
  1415. file.url = URL.createObjectURL(rawFile);
  1416. } catch (err) {
  1417. console.error('[Element Error][Upload]', err);
  1418. return;
  1419. }
  1420. }
  1421. this.uploadFiles.push(file);
  1422. this.onChange(file, this.uploadFiles);
  1423. },
  1424. handleProgress: function handleProgress(ev, rawFile) {
  1425. var file = this.getFile(rawFile);
  1426. this.onProgress(ev, file, this.uploadFiles);
  1427. file.status = 'uploading';
  1428. file.percentage = ev.percent || 0;
  1429. },
  1430. handleSuccess: function handleSuccess(res, rawFile) {
  1431. var file = this.getFile(rawFile);
  1432. if (file) {
  1433. file.status = 'success';
  1434. file.response = res;
  1435. this.onSuccess(res, file, this.uploadFiles);
  1436. this.onChange(file, this.uploadFiles);
  1437. }
  1438. },
  1439. handleError: function handleError(err, rawFile) {
  1440. var file = this.getFile(rawFile);
  1441. var fileList = this.uploadFiles;
  1442. file.status = 'fail';
  1443. fileList.splice(fileList.indexOf(file), 1);
  1444. this.onError(err, file, this.uploadFiles);
  1445. this.onChange(file, this.uploadFiles);
  1446. },
  1447. handleRemove: function handleRemove(file, raw) {
  1448. var _this2 = this;
  1449. if (raw) {
  1450. file = this.getFile(raw);
  1451. }
  1452. var doRemove = function doRemove() {
  1453. _this2.abort(file);
  1454. var fileList = _this2.uploadFiles;
  1455. fileList.splice(fileList.indexOf(file), 1);
  1456. _this2.onRemove(file, fileList);
  1457. };
  1458. if (!this.beforeRemove) {
  1459. doRemove();
  1460. } else if (typeof this.beforeRemove === 'function') {
  1461. var before = this.beforeRemove(file, this.uploadFiles);
  1462. if (before && before.then) {
  1463. before.then(function () {
  1464. doRemove();
  1465. }, noop);
  1466. } else if (before !== false) {
  1467. doRemove();
  1468. }
  1469. }
  1470. },
  1471. getFile: function getFile(rawFile) {
  1472. var fileList = this.uploadFiles;
  1473. var target = void 0;
  1474. fileList.every(function (item) {
  1475. target = rawFile.uid === item.uid ? item : null;
  1476. return !target;
  1477. });
  1478. return target;
  1479. },
  1480. abort: function abort(file) {
  1481. this.$refs['upload-inner'].abort(file);
  1482. },
  1483. clearFiles: function clearFiles() {
  1484. this.uploadFiles = [];
  1485. },
  1486. submit: function submit() {
  1487. var _this3 = this;
  1488. this.uploadFiles.filter(function (file) {
  1489. return file.status === 'ready';
  1490. }).forEach(function (file) {
  1491. _this3.$refs['upload-inner'].upload(file.raw);
  1492. });
  1493. },
  1494. getMigratingConfig: function getMigratingConfig() {
  1495. return {
  1496. props: {
  1497. 'default-file-list': 'default-file-list is renamed to file-list.',
  1498. 'show-upload-list': 'show-upload-list is renamed to show-file-list.',
  1499. 'thumbnail-mode': 'thumbnail-mode has been deprecated, you can implement the same effect according to this case: http://element.eleme.io/#/zh-CN/component/upload#yong-hu-tou-xiang-shang-chuan'
  1500. }
  1501. };
  1502. }
  1503. },
  1504. beforeDestroy: function beforeDestroy() {
  1505. this.uploadFiles.forEach(function (file) {
  1506. if (file.url && file.url.indexOf('blob:') === 0) {
  1507. URL.revokeObjectURL(file.url);
  1508. }
  1509. });
  1510. },
  1511. render: function render(h) {
  1512. var _this4 = this;
  1513. var uploadList = void 0;
  1514. if (this.showFileList) {
  1515. uploadList = h(
  1516. upload_list,
  1517. {
  1518. attrs: {
  1519. disabled: this.uploadDisabled,
  1520. listType: this.listType,
  1521. files: this.uploadFiles,
  1522. handlePreview: this.onPreview },
  1523. on: {
  1524. 'remove': this.handleRemove
  1525. }
  1526. },
  1527. [function (props) {
  1528. if (_this4.$scopedSlots.file) {
  1529. return _this4.$scopedSlots.file({
  1530. file: props.file
  1531. });
  1532. }
  1533. }]
  1534. );
  1535. }
  1536. var uploadData = {
  1537. props: {
  1538. type: this.type,
  1539. drag: this.drag,
  1540. action: this.action,
  1541. multiple: this.multiple,
  1542. 'before-upload': this.beforeUpload,
  1543. 'with-credentials': this.withCredentials,
  1544. headers: this.headers,
  1545. name: this.name,
  1546. data: this.data,
  1547. accept: this.accept,
  1548. fileList: this.uploadFiles,
  1549. autoUpload: this.autoUpload,
  1550. listType: this.listType,
  1551. disabled: this.uploadDisabled,
  1552. limit: this.limit,
  1553. 'on-exceed': this.onExceed,
  1554. 'on-start': this.handleStart,
  1555. 'on-progress': this.handleProgress,
  1556. 'on-success': this.handleSuccess,
  1557. 'on-error': this.handleError,
  1558. 'on-preview': this.onPreview,
  1559. 'on-remove': this.handleRemove,
  1560. 'http-request': this.httpRequest
  1561. },
  1562. ref: 'upload-inner'
  1563. };
  1564. var trigger = this.$slots.trigger || this.$slots.default;
  1565. var uploadComponent = h(
  1566. 'upload',
  1567. uploadData,
  1568. [trigger]
  1569. );
  1570. return h('div', [this.listType === 'picture-card' ? uploadList : '', this.$slots.trigger ? [uploadComponent, this.$slots.default] : uploadComponent, this.$slots.tip, this.listType !== 'picture-card' ? uploadList : '']);
  1571. }
  1572. });
  1573. // CONCATENATED MODULE: ./packages/upload/src/index.vue?vue&type=script&lang=js&
  1574. /* harmony default export */ var upload_srcvue_type_script_lang_js_ = (srcvue_type_script_lang_js_);
  1575. // CONCATENATED MODULE: ./packages/upload/src/index.vue
  1576. var src_render, src_staticRenderFns
  1577. /* normalize component */
  1578. var src_component = Object(componentNormalizer["a" /* default */])(
  1579. upload_srcvue_type_script_lang_js_,
  1580. src_render,
  1581. src_staticRenderFns,
  1582. false,
  1583. null,
  1584. null,
  1585. null
  1586. )
  1587. /* hot reload */
  1588. if (false) { var src_api; }
  1589. src_component.options.__file = "packages/upload/src/index.vue"
  1590. /* harmony default export */ var src = (src_component.exports);
  1591. // CONCATENATED MODULE: ./packages/upload/index.js
  1592. /* istanbul ignore next */
  1593. src.install = function (Vue) {
  1594. Vue.component(src.name, src);
  1595. };
  1596. /* harmony default export */ var packages_upload = __webpack_exports__["default"] = (src);
  1597. /***/ }),
  1598. /***/ 90:
  1599. /***/ (function(module, exports) {
  1600. module.exports = require("babel-helper-vue-jsx-merge-props");
  1601. /***/ })
  1602. /******/ });