app模板、应用模板、组件模板、widget模板
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.

674 lines
18 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 = 566);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ 2:
  90. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  91. "use strict";
  92. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
  93. /* globals __VUE_SSR_CONTEXT__ */
  94. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  95. // This module is a runtime utility for cleaner component module output and will
  96. // be included in the final webpack user bundle.
  97. function normalizeComponent (
  98. scriptExports,
  99. render,
  100. staticRenderFns,
  101. functionalTemplate,
  102. injectStyles,
  103. scopeId,
  104. moduleIdentifier, /* server only */
  105. shadowMode /* vue-cli only */
  106. ) {
  107. // Vue.extend constructor export interop
  108. var options = typeof scriptExports === 'function'
  109. ? scriptExports.options
  110. : scriptExports
  111. // render functions
  112. if (render) {
  113. options.render = render
  114. options.staticRenderFns = staticRenderFns
  115. options._compiled = true
  116. }
  117. // functional template
  118. if (functionalTemplate) {
  119. options.functional = true
  120. }
  121. // scopedId
  122. if (scopeId) {
  123. options._scopeId = 'data-v-' + scopeId
  124. }
  125. var hook
  126. if (moduleIdentifier) { // server build
  127. hook = function (context) {
  128. // 2.3 injection
  129. context =
  130. context || // cached call
  131. (this.$vnode && this.$vnode.ssrContext) || // stateful
  132. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  133. // 2.2 with runInNewContext: true
  134. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  135. context = __VUE_SSR_CONTEXT__
  136. }
  137. // inject component styles
  138. if (injectStyles) {
  139. injectStyles.call(this, context)
  140. }
  141. // register component module identifier for async chunk inferrence
  142. if (context && context._registeredComponents) {
  143. context._registeredComponents.add(moduleIdentifier)
  144. }
  145. }
  146. // used by ssr in case component is cached and beforeCreate
  147. // never gets called
  148. options._ssrRegister = hook
  149. } else if (injectStyles) {
  150. hook = shadowMode
  151. ? function () {
  152. injectStyles.call(
  153. this,
  154. (options.functional ? this.parent : this).$root.$options.shadowRoot
  155. )
  156. }
  157. : injectStyles
  158. }
  159. if (hook) {
  160. if (options.functional) {
  161. // for template-only hot-reload because in that case the render fn doesn't
  162. // go through the normalizer
  163. options._injectStyles = hook
  164. // register for functional component in vue file
  165. var originalRender = options.render
  166. options.render = function renderWithStyleInjection (h, context) {
  167. hook.call(context)
  168. return originalRender(h, context)
  169. }
  170. } else {
  171. // inject component registration as beforeCreate hook
  172. var existing = options.beforeCreate
  173. options.beforeCreate = existing
  174. ? [].concat(existing, hook)
  175. : [hook]
  176. }
  177. }
  178. return {
  179. exports: scriptExports,
  180. options: options
  181. }
  182. }
  183. /***/ }),
  184. /***/ 36:
  185. /***/ (function(module, exports) {
  186. module.exports = require("tis-ui/lib/mixins/migrating");
  187. /***/ }),
  188. /***/ 566:
  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/rate/src/main.vue?vue&type=template&id=ada57782&
  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. staticClass: "el-rate",
  202. attrs: {
  203. role: "slider",
  204. "aria-valuenow": _vm.currentValue,
  205. "aria-valuetext": _vm.text,
  206. "aria-valuemin": "0",
  207. "aria-valuemax": _vm.max,
  208. tabindex: "0"
  209. },
  210. on: { keydown: _vm.handleKey }
  211. },
  212. [
  213. _vm._l(_vm.max, function(item, key) {
  214. return _c(
  215. "span",
  216. {
  217. key: key,
  218. staticClass: "el-rate__item",
  219. style: { cursor: _vm.rateDisabled ? "auto" : "pointer" },
  220. on: {
  221. mousemove: function($event) {
  222. _vm.setCurrentValue(item, $event)
  223. },
  224. mouseleave: _vm.resetCurrentValue,
  225. click: function($event) {
  226. _vm.selectValue(item)
  227. }
  228. }
  229. },
  230. [
  231. _c(
  232. "i",
  233. {
  234. staticClass: "el-rate__icon",
  235. class: [
  236. _vm.classes[item - 1],
  237. { hover: _vm.hoverIndex === item }
  238. ],
  239. style: _vm.getIconStyle(item)
  240. },
  241. [
  242. _vm.showDecimalIcon(item)
  243. ? _c("i", {
  244. staticClass: "el-rate__decimal",
  245. class: _vm.decimalIconClass,
  246. style: _vm.decimalStyle
  247. })
  248. : _vm._e()
  249. ]
  250. )
  251. ]
  252. )
  253. }),
  254. _vm.showText || _vm.showScore
  255. ? _c(
  256. "span",
  257. { staticClass: "el-rate__text", style: { color: _vm.textColor } },
  258. [_vm._v(_vm._s(_vm.text))]
  259. )
  260. : _vm._e()
  261. ],
  262. 2
  263. )
  264. }
  265. var staticRenderFns = []
  266. render._withStripped = true
  267. // CONCATENATED MODULE: ./packages/rate/src/main.vue?vue&type=template&id=ada57782&
  268. // EXTERNAL MODULE: external "tis-ui/lib/utils/dom"
  269. var dom_ = __webpack_require__(7);
  270. // EXTERNAL MODULE: external "tis-ui/lib/utils/types"
  271. var types_ = __webpack_require__(89);
  272. // EXTERNAL MODULE: external "tis-ui/lib/mixins/migrating"
  273. var migrating_ = __webpack_require__(36);
  274. var migrating_default = /*#__PURE__*/__webpack_require__.n(migrating_);
  275. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/rate/src/main.vue?vue&type=script&lang=js&
  276. //
  277. //
  278. //
  279. //
  280. //
  281. //
  282. //
  283. //
  284. //
  285. //
  286. //
  287. //
  288. //
  289. //
  290. //
  291. //
  292. //
  293. //
  294. //
  295. //
  296. //
  297. //
  298. //
  299. //
  300. //
  301. //
  302. //
  303. //
  304. //
  305. //
  306. //
  307. //
  308. //
  309. //
  310. /* harmony default export */ var mainvue_type_script_lang_js_ = ({
  311. name: 'TisRate',
  312. mixins: [migrating_default.a],
  313. inject: {
  314. elForm: {
  315. default: ''
  316. }
  317. },
  318. data: function data() {
  319. return {
  320. pointerAtLeftHalf: true,
  321. currentValue: this.value,
  322. hoverIndex: -1
  323. };
  324. },
  325. props: {
  326. value: {
  327. type: Number,
  328. default: 0
  329. },
  330. lowThreshold: {
  331. type: Number,
  332. default: 2
  333. },
  334. highThreshold: {
  335. type: Number,
  336. default: 4
  337. },
  338. max: {
  339. type: Number,
  340. default: 5
  341. },
  342. colors: {
  343. type: [Array, Object],
  344. default: function _default() {
  345. return ['#F7BA2A', '#F7BA2A', '#F7BA2A'];
  346. }
  347. },
  348. voidColor: {
  349. type: String,
  350. default: '#C6D1DE'
  351. },
  352. disabledVoidColor: {
  353. type: String,
  354. default: '#EFF2F7'
  355. },
  356. iconClasses: {
  357. type: [Array, Object],
  358. default: function _default() {
  359. return ['el-icon-star-on', 'el-icon-star-on', 'el-icon-star-on'];
  360. }
  361. },
  362. voidIconClass: {
  363. type: String,
  364. default: 'el-icon-star-off'
  365. },
  366. disabledVoidIconClass: {
  367. type: String,
  368. default: 'el-icon-star-on'
  369. },
  370. disabled: {
  371. type: Boolean,
  372. default: false
  373. },
  374. allowHalf: {
  375. type: Boolean,
  376. default: false
  377. },
  378. showText: {
  379. type: Boolean,
  380. default: false
  381. },
  382. showScore: {
  383. type: Boolean,
  384. default: false
  385. },
  386. textColor: {
  387. type: String,
  388. default: '#1f2d3d'
  389. },
  390. texts: {
  391. type: Array,
  392. default: function _default() {
  393. return ['极差', '失望', '一般', '满意', '惊喜'];
  394. }
  395. },
  396. scoreTemplate: {
  397. type: String,
  398. default: '{value}'
  399. }
  400. },
  401. computed: {
  402. text: function text() {
  403. var result = '';
  404. if (this.showScore) {
  405. result = this.scoreTemplate.replace(/\{\s*value\s*\}/, this.rateDisabled ? this.value : this.currentValue);
  406. } else if (this.showText) {
  407. result = this.texts[Math.ceil(this.currentValue) - 1];
  408. }
  409. return result;
  410. },
  411. decimalStyle: function decimalStyle() {
  412. var width = '';
  413. if (this.rateDisabled) {
  414. width = this.valueDecimal + '%';
  415. } else if (this.allowHalf) {
  416. width = '50%';
  417. }
  418. return {
  419. color: this.activeColor,
  420. width: width
  421. };
  422. },
  423. valueDecimal: function valueDecimal() {
  424. return this.value * 100 - Math.floor(this.value) * 100;
  425. },
  426. classMap: function classMap() {
  427. var _ref;
  428. return Array.isArray(this.iconClasses) ? (_ref = {}, _ref[this.lowThreshold] = this.iconClasses[0], _ref[this.highThreshold] = { value: this.iconClasses[1], excluded: true }, _ref[this.max] = this.iconClasses[2], _ref) : this.iconClasses;
  429. },
  430. decimalIconClass: function decimalIconClass() {
  431. return this.getValueFromMap(this.value, this.classMap);
  432. },
  433. voidClass: function voidClass() {
  434. return this.rateDisabled ? this.disabledVoidIconClass : this.voidIconClass;
  435. },
  436. activeClass: function activeClass() {
  437. return this.getValueFromMap(this.currentValue, this.classMap);
  438. },
  439. colorMap: function colorMap() {
  440. var _ref2;
  441. return Array.isArray(this.colors) ? (_ref2 = {}, _ref2[this.lowThreshold] = this.colors[0], _ref2[this.highThreshold] = { value: this.colors[1], excluded: true }, _ref2[this.max] = this.colors[2], _ref2) : this.colors;
  442. },
  443. activeColor: function activeColor() {
  444. return this.getValueFromMap(this.currentValue, this.colorMap);
  445. },
  446. classes: function classes() {
  447. var result = [];
  448. var i = 0;
  449. var threshold = this.currentValue;
  450. if (this.allowHalf && this.currentValue !== Math.floor(this.currentValue)) {
  451. threshold--;
  452. }
  453. for (; i < threshold; i++) {
  454. result.push(this.activeClass);
  455. }
  456. for (; i < this.max; i++) {
  457. result.push(this.voidClass);
  458. }
  459. return result;
  460. },
  461. rateDisabled: function rateDisabled() {
  462. return this.disabled || (this.elForm || {}).disabled;
  463. }
  464. },
  465. watch: {
  466. value: function value(val) {
  467. this.currentValue = val;
  468. this.pointerAtLeftHalf = this.value !== Math.floor(this.value);
  469. }
  470. },
  471. methods: {
  472. getMigratingConfig: function getMigratingConfig() {
  473. return {
  474. props: {
  475. 'text-template': 'text-template is renamed to score-template.'
  476. }
  477. };
  478. },
  479. getValueFromMap: function getValueFromMap(value, map) {
  480. var matchedKeys = Object.keys(map).filter(function (key) {
  481. var val = map[key];
  482. var excluded = Object(types_["isObject"])(val) ? val.excluded : false;
  483. return excluded ? value < key : value <= key;
  484. }).sort(function (a, b) {
  485. return a - b;
  486. });
  487. var matchedValue = map[matchedKeys[0]];
  488. return Object(types_["isObject"])(matchedValue) ? matchedValue.value : matchedValue || '';
  489. },
  490. showDecimalIcon: function showDecimalIcon(item) {
  491. var showWhenDisabled = this.rateDisabled && this.valueDecimal > 0 && item - 1 < this.value && item > this.value;
  492. /* istanbul ignore next */
  493. var showWhenAllowHalf = this.allowHalf && this.pointerAtLeftHalf && item - 0.5 <= this.currentValue && item > this.currentValue;
  494. return showWhenDisabled || showWhenAllowHalf;
  495. },
  496. getIconStyle: function getIconStyle(item) {
  497. var voidColor = this.rateDisabled ? this.disabledVoidColor : this.voidColor;
  498. return {
  499. color: item <= this.currentValue ? this.activeColor : voidColor
  500. };
  501. },
  502. selectValue: function selectValue(value) {
  503. if (this.rateDisabled) {
  504. return;
  505. }
  506. if (this.allowHalf && this.pointerAtLeftHalf) {
  507. this.$emit('input', this.currentValue);
  508. this.$emit('change', this.currentValue);
  509. } else {
  510. this.$emit('input', value);
  511. this.$emit('change', value);
  512. }
  513. },
  514. handleKey: function handleKey(e) {
  515. if (this.rateDisabled) {
  516. return;
  517. }
  518. var currentValue = this.currentValue;
  519. var keyCode = e.keyCode;
  520. if (keyCode === 38 || keyCode === 39) {
  521. // left / down
  522. if (this.allowHalf) {
  523. currentValue += 0.5;
  524. } else {
  525. currentValue += 1;
  526. }
  527. e.stopPropagation();
  528. e.preventDefault();
  529. } else if (keyCode === 37 || keyCode === 40) {
  530. if (this.allowHalf) {
  531. currentValue -= 0.5;
  532. } else {
  533. currentValue -= 1;
  534. }
  535. e.stopPropagation();
  536. e.preventDefault();
  537. }
  538. currentValue = currentValue < 0 ? 0 : currentValue;
  539. currentValue = currentValue > this.max ? this.max : currentValue;
  540. this.$emit('input', currentValue);
  541. this.$emit('change', currentValue);
  542. },
  543. setCurrentValue: function setCurrentValue(value, event) {
  544. if (this.rateDisabled) {
  545. return;
  546. }
  547. /* istanbul ignore if */
  548. if (this.allowHalf) {
  549. var target = event.target;
  550. if (Object(dom_["hasClass"])(target, 'el-rate__item')) {
  551. target = target.querySelector('.el-rate__icon');
  552. }
  553. if (Object(dom_["hasClass"])(target, 'el-rate__decimal')) {
  554. target = target.parentNode;
  555. }
  556. this.pointerAtLeftHalf = event.offsetX * 2 <= target.clientWidth;
  557. this.currentValue = this.pointerAtLeftHalf ? value - 0.5 : value;
  558. } else {
  559. this.currentValue = value;
  560. }
  561. this.hoverIndex = value;
  562. },
  563. resetCurrentValue: function resetCurrentValue() {
  564. if (this.rateDisabled) {
  565. return;
  566. }
  567. if (this.allowHalf) {
  568. this.pointerAtLeftHalf = this.value !== Math.floor(this.value);
  569. }
  570. this.currentValue = this.value;
  571. this.hoverIndex = -1;
  572. }
  573. },
  574. created: function created() {
  575. if (!this.value) {
  576. this.$emit('input', 0);
  577. }
  578. }
  579. });
  580. // CONCATENATED MODULE: ./packages/rate/src/main.vue?vue&type=script&lang=js&
  581. /* harmony default export */ var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_);
  582. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  583. var componentNormalizer = __webpack_require__(2);
  584. // CONCATENATED MODULE: ./packages/rate/src/main.vue
  585. /* normalize component */
  586. var component = Object(componentNormalizer["a" /* default */])(
  587. src_mainvue_type_script_lang_js_,
  588. render,
  589. staticRenderFns,
  590. false,
  591. null,
  592. null,
  593. null
  594. )
  595. /* hot reload */
  596. if (false) { var api; }
  597. component.options.__file = "packages/rate/src/main.vue"
  598. /* harmony default export */ var main = (component.exports);
  599. // CONCATENATED MODULE: ./packages/rate/index.js
  600. /* istanbul ignore next */
  601. main.install = function (Vue) {
  602. Vue.component(main.name, main);
  603. };
  604. /* harmony default export */ var rate = __webpack_exports__["default"] = (main);
  605. /***/ }),
  606. /***/ 7:
  607. /***/ (function(module, exports) {
  608. module.exports = require("tis-ui/lib/utils/dom");
  609. /***/ }),
  610. /***/ 89:
  611. /***/ (function(module, exports) {
  612. module.exports = require("tis-ui/lib/utils/types");
  613. /***/ })
  614. /******/ });