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

2850 lines
77 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 = 520);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ 10:
  90. /***/ (function(module, exports) {
  91. module.exports = require("tis-ui/lib/utils/util");
  92. /***/ }),
  93. /***/ 102:
  94. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  95. "use strict";
  96. // ESM COMPAT FLAG
  97. __webpack_require__.r(__webpack_exports__);
  98. // EXTERNAL MODULE: external "tis-ui/lib/utils/vue-popper"
  99. var vue_popper_ = __webpack_require__(34);
  100. var vue_popper_default = /*#__PURE__*/__webpack_require__.n(vue_popper_);
  101. // EXTERNAL MODULE: external "throttle-debounce/debounce"
  102. var debounce_ = __webpack_require__(62);
  103. var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce_);
  104. // EXTERNAL MODULE: external "tis-ui/lib/utils/dom"
  105. var dom_ = __webpack_require__(7);
  106. // EXTERNAL MODULE: external "tis-ui/lib/utils/util"
  107. var util_ = __webpack_require__(10);
  108. // EXTERNAL MODULE: external "vue"
  109. var external_vue_ = __webpack_require__(4);
  110. var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
  111. // CONCATENATED MODULE: ./packages/tooltip/src/main.js
  112. /* harmony default export */ var main = ({
  113. name: 'TisTooltip',
  114. mixins: [vue_popper_default.a],
  115. props: {
  116. openDelay: {
  117. type: Number,
  118. default: 0
  119. },
  120. disabled: Boolean,
  121. manual: Boolean,
  122. effect: {
  123. type: String,
  124. default: 'dark'
  125. },
  126. arrowOffset: {
  127. type: Number,
  128. default: 0
  129. },
  130. popperClass: String,
  131. content: String,
  132. visibleArrow: {
  133. default: true
  134. },
  135. transition: {
  136. type: String,
  137. default: 'el-fade-in-linear'
  138. },
  139. popperOptions: {
  140. default: function _default() {
  141. return {
  142. boundariesPadding: 10,
  143. gpuAcceleration: false
  144. };
  145. }
  146. },
  147. enterable: {
  148. type: Boolean,
  149. default: true
  150. },
  151. hideAfter: {
  152. type: Number,
  153. default: 0
  154. },
  155. tabindex: {
  156. type: Number,
  157. default: 0
  158. }
  159. },
  160. data: function data() {
  161. return {
  162. tooltipId: 'el-tooltip-' + Object(util_["generateId"])(),
  163. timeoutPending: null,
  164. focusing: false
  165. };
  166. },
  167. beforeCreate: function beforeCreate() {
  168. var _this = this;
  169. if (this.$isServer) return;
  170. this.popperVM = new external_vue_default.a({
  171. data: { node: '' },
  172. render: function render(h) {
  173. return this.node;
  174. }
  175. }).$mount();
  176. this.debounceClose = debounce_default()(200, function () {
  177. return _this.handleClosePopper();
  178. });
  179. },
  180. render: function render(h) {
  181. var _this2 = this;
  182. if (this.popperVM) {
  183. this.popperVM.node = h(
  184. 'transition',
  185. {
  186. attrs: {
  187. name: this.transition
  188. },
  189. on: {
  190. 'afterLeave': this.doDestroy
  191. }
  192. },
  193. [h(
  194. 'div',
  195. {
  196. on: {
  197. 'mouseleave': function mouseleave() {
  198. _this2.setExpectedState(false);_this2.debounceClose();
  199. },
  200. 'mouseenter': function mouseenter() {
  201. _this2.setExpectedState(true);
  202. }
  203. },
  204. ref: 'popper',
  205. attrs: { role: 'tooltip',
  206. id: this.tooltipId,
  207. 'aria-hidden': this.disabled || !this.showPopper ? 'true' : 'false'
  208. },
  209. directives: [{
  210. name: 'show',
  211. value: !this.disabled && this.showPopper
  212. }],
  213. 'class': ['el-tooltip__popper', 'is-' + this.effect, this.popperClass] },
  214. [this.$slots.content || this.content]
  215. )]
  216. );
  217. }
  218. var firstElement = this.getFirstElement();
  219. if (!firstElement) return null;
  220. var data = firstElement.data = firstElement.data || {};
  221. data.staticClass = this.addTooltipClass(data.staticClass);
  222. return firstElement;
  223. },
  224. mounted: function mounted() {
  225. var _this3 = this;
  226. this.referenceElm = this.$el;
  227. if (this.$el.nodeType === 1) {
  228. this.$el.setAttribute('aria-describedby', this.tooltipId);
  229. this.$el.setAttribute('tabindex', this.tabindex);
  230. Object(dom_["on"])(this.referenceElm, 'mouseenter', this.show);
  231. Object(dom_["on"])(this.referenceElm, 'mouseleave', this.hide);
  232. Object(dom_["on"])(this.referenceElm, 'focus', function () {
  233. if (!_this3.$slots.default || !_this3.$slots.default.length) {
  234. _this3.handleFocus();
  235. return;
  236. }
  237. var instance = _this3.$slots.default[0].componentInstance;
  238. if (instance && instance.focus) {
  239. instance.focus();
  240. } else {
  241. _this3.handleFocus();
  242. }
  243. });
  244. Object(dom_["on"])(this.referenceElm, 'blur', this.handleBlur);
  245. Object(dom_["on"])(this.referenceElm, 'click', this.removeFocusing);
  246. }
  247. // fix issue https://github.com/ElemeFE/element/issues/14424
  248. if (this.value && this.popperVM) {
  249. this.popperVM.$nextTick(function () {
  250. if (_this3.value) {
  251. _this3.updatePopper();
  252. }
  253. });
  254. }
  255. },
  256. watch: {
  257. focusing: function focusing(val) {
  258. if (val) {
  259. Object(dom_["addClass"])(this.referenceElm, 'focusing');
  260. } else {
  261. Object(dom_["removeClass"])(this.referenceElm, 'focusing');
  262. }
  263. }
  264. },
  265. methods: {
  266. show: function show() {
  267. this.setExpectedState(true);
  268. this.handleShowPopper();
  269. },
  270. hide: function hide() {
  271. this.setExpectedState(false);
  272. this.debounceClose();
  273. },
  274. handleFocus: function handleFocus() {
  275. this.focusing = true;
  276. this.show();
  277. },
  278. handleBlur: function handleBlur() {
  279. this.focusing = false;
  280. this.hide();
  281. },
  282. removeFocusing: function removeFocusing() {
  283. this.focusing = false;
  284. },
  285. addTooltipClass: function addTooltipClass(prev) {
  286. if (!prev) {
  287. return 'el-tooltip';
  288. } else {
  289. return 'el-tooltip ' + prev.replace('el-tooltip', '');
  290. }
  291. },
  292. handleShowPopper: function handleShowPopper() {
  293. var _this4 = this;
  294. if (!this.expectedState || this.manual) return;
  295. clearTimeout(this.timeout);
  296. this.timeout = setTimeout(function () {
  297. _this4.showPopper = true;
  298. }, this.openDelay);
  299. if (this.hideAfter > 0) {
  300. this.timeoutPending = setTimeout(function () {
  301. _this4.showPopper = false;
  302. }, this.hideAfter);
  303. }
  304. },
  305. handleClosePopper: function handleClosePopper() {
  306. if (this.enterable && this.expectedState || this.manual) return;
  307. clearTimeout(this.timeout);
  308. if (this.timeoutPending) {
  309. clearTimeout(this.timeoutPending);
  310. }
  311. this.showPopper = false;
  312. if (this.disabled) {
  313. this.doDestroy();
  314. }
  315. },
  316. setExpectedState: function setExpectedState(expectedState) {
  317. if (expectedState === false) {
  318. clearTimeout(this.timeoutPending);
  319. }
  320. this.expectedState = expectedState;
  321. },
  322. getFirstElement: function getFirstElement() {
  323. var slots = this.$slots.default;
  324. if (!Array.isArray(slots)) return null;
  325. var element = null;
  326. for (var index = 0; index < slots.length; index++) {
  327. if (slots[index] && slots[index].tag) {
  328. element = slots[index];
  329. };
  330. }
  331. return element;
  332. }
  333. },
  334. beforeDestroy: function beforeDestroy() {
  335. this.popperVM && this.popperVM.$destroy();
  336. },
  337. destroyed: function destroyed() {
  338. var reference = this.referenceElm;
  339. if (reference.nodeType === 1) {
  340. Object(dom_["off"])(reference, 'mouseenter', this.show);
  341. Object(dom_["off"])(reference, 'mouseleave', this.hide);
  342. Object(dom_["off"])(reference, 'focus', this.handleFocus);
  343. Object(dom_["off"])(reference, 'blur', this.handleBlur);
  344. Object(dom_["off"])(reference, 'click', this.removeFocusing);
  345. }
  346. }
  347. });
  348. // CONCATENATED MODULE: ./packages/tooltip/index.js
  349. /* istanbul ignore next */
  350. main.install = function (Vue) {
  351. Vue.component(main.name, main);
  352. };
  353. /* harmony default export */ var tooltip = __webpack_exports__["default"] = (main);
  354. /***/ }),
  355. /***/ 13:
  356. /***/ (function(module, exports) {
  357. module.exports = require("tis-ui/lib/mixins/emitter");
  358. /***/ }),
  359. /***/ 155:
  360. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  361. "use strict";
  362. // ESM COMPAT FLAG
  363. __webpack_require__.r(__webpack_exports__);
  364. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/input-number/src/input-number.vue?vue&type=template&id=42f8cf66&
  365. var render = function() {
  366. var _vm = this
  367. var _h = _vm.$createElement
  368. var _c = _vm._self._c || _h
  369. return _c(
  370. "div",
  371. {
  372. class: [
  373. "el-input-number",
  374. _vm.inputNumberSize ? "el-input-number--" + _vm.inputNumberSize : "",
  375. { "is-disabled": _vm.inputNumberDisabled },
  376. { "is-without-controls": !_vm.controls },
  377. { "is-controls-right": _vm.controlsAtRight }
  378. ],
  379. on: {
  380. dragstart: function($event) {
  381. $event.preventDefault()
  382. }
  383. }
  384. },
  385. [
  386. _vm.controls
  387. ? _c(
  388. "span",
  389. {
  390. directives: [
  391. {
  392. name: "repeat-click",
  393. rawName: "v-repeat-click",
  394. value: _vm.decrease,
  395. expression: "decrease"
  396. }
  397. ],
  398. staticClass: "el-input-number__decrease",
  399. class: { "is-disabled": _vm.minDisabled },
  400. attrs: { role: "button" },
  401. on: {
  402. keydown: function($event) {
  403. if (
  404. !("button" in $event) &&
  405. _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")
  406. ) {
  407. return null
  408. }
  409. return _vm.decrease($event)
  410. }
  411. }
  412. },
  413. [
  414. _c("i", {
  415. class:
  416. "el-icon-" + (_vm.controlsAtRight ? "arrow-down" : "minus")
  417. })
  418. ]
  419. )
  420. : _vm._e(),
  421. _vm.controls
  422. ? _c(
  423. "span",
  424. {
  425. directives: [
  426. {
  427. name: "repeat-click",
  428. rawName: "v-repeat-click",
  429. value: _vm.increase,
  430. expression: "increase"
  431. }
  432. ],
  433. staticClass: "el-input-number__increase",
  434. class: { "is-disabled": _vm.maxDisabled },
  435. attrs: { role: "button" },
  436. on: {
  437. keydown: function($event) {
  438. if (
  439. !("button" in $event) &&
  440. _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")
  441. ) {
  442. return null
  443. }
  444. return _vm.increase($event)
  445. }
  446. }
  447. },
  448. [
  449. _c("i", {
  450. class: "el-icon-" + (_vm.controlsAtRight ? "arrow-up" : "plus")
  451. })
  452. ]
  453. )
  454. : _vm._e(),
  455. _c("tis-input", {
  456. ref: "input",
  457. attrs: {
  458. value: _vm.displayValue,
  459. placeholder: _vm.placeholder,
  460. disabled: _vm.inputNumberDisabled,
  461. size: _vm.inputNumberSize,
  462. max: _vm.max,
  463. min: _vm.min,
  464. name: _vm.name,
  465. label: _vm.label
  466. },
  467. on: {
  468. blur: _vm.handleBlur,
  469. focus: _vm.handleFocus,
  470. input: _vm.handleInput,
  471. change: _vm.handleInputChange
  472. },
  473. nativeOn: {
  474. keydown: [
  475. function($event) {
  476. if (
  477. !("button" in $event) &&
  478. _vm._k($event.keyCode, "up", 38, $event.key, ["Up", "ArrowUp"])
  479. ) {
  480. return null
  481. }
  482. $event.preventDefault()
  483. return _vm.increase($event)
  484. },
  485. function($event) {
  486. if (
  487. !("button" in $event) &&
  488. _vm._k($event.keyCode, "down", 40, $event.key, [
  489. "Down",
  490. "ArrowDown"
  491. ])
  492. ) {
  493. return null
  494. }
  495. $event.preventDefault()
  496. return _vm.decrease($event)
  497. }
  498. ]
  499. }
  500. })
  501. ],
  502. 1
  503. )
  504. }
  505. var staticRenderFns = []
  506. render._withStripped = true
  507. // CONCATENATED MODULE: ./packages/input-number/src/input-number.vue?vue&type=template&id=42f8cf66&
  508. // EXTERNAL MODULE: ./packages/input/index.js + 6 modules
  509. var input = __webpack_require__(52);
  510. // EXTERNAL MODULE: external "tis-ui/lib/mixins/focus"
  511. var focus_ = __webpack_require__(88);
  512. var focus_default = /*#__PURE__*/__webpack_require__.n(focus_);
  513. // EXTERNAL MODULE: ./src/directives/repeat-click.js
  514. var repeat_click = __webpack_require__(99);
  515. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/input-number/src/input-number.vue?vue&type=script&lang=js&
  516. //
  517. //
  518. //
  519. //
  520. //
  521. //
  522. //
  523. //
  524. //
  525. //
  526. //
  527. //
  528. //
  529. //
  530. //
  531. //
  532. //
  533. //
  534. //
  535. //
  536. //
  537. //
  538. //
  539. //
  540. //
  541. //
  542. //
  543. //
  544. //
  545. //
  546. //
  547. //
  548. //
  549. //
  550. //
  551. //
  552. //
  553. //
  554. //
  555. //
  556. //
  557. //
  558. //
  559. //
  560. //
  561. //
  562. //
  563. /* harmony default export */ var input_numbervue_type_script_lang_js_ = ({
  564. name: 'TisInputNumber',
  565. mixins: [focus_default()('input')],
  566. inject: {
  567. elForm: {
  568. default: ''
  569. },
  570. elFormItem: {
  571. default: ''
  572. }
  573. },
  574. directives: {
  575. repeatClick: repeat_click["a" /* default */]
  576. },
  577. components: {
  578. ElInput: input["default"]
  579. },
  580. props: {
  581. step: {
  582. type: Number,
  583. default: 1
  584. },
  585. stepStrictly: {
  586. type: Boolean,
  587. default: false
  588. },
  589. max: {
  590. type: Number,
  591. default: Infinity
  592. },
  593. min: {
  594. type: Number,
  595. default: -Infinity
  596. },
  597. value: {},
  598. disabled: Boolean,
  599. size: String,
  600. controls: {
  601. type: Boolean,
  602. default: true
  603. },
  604. controlsPosition: {
  605. type: String,
  606. default: ''
  607. },
  608. name: String,
  609. label: String,
  610. placeholder: String,
  611. precision: {
  612. type: Number,
  613. validator: function validator(val) {
  614. return val >= 0 && val === parseInt(val, 10);
  615. }
  616. }
  617. },
  618. data: function data() {
  619. return {
  620. currentValue: 0,
  621. userInput: null
  622. };
  623. },
  624. watch: {
  625. value: {
  626. immediate: true,
  627. handler: function handler(value) {
  628. var newVal = value === undefined ? value : Number(value);
  629. if (newVal !== undefined) {
  630. if (isNaN(newVal)) {
  631. return;
  632. }
  633. if (this.stepStrictly) {
  634. var stepPrecision = this.getPrecision(this.step);
  635. var precisionFactor = Math.pow(10, stepPrecision);
  636. newVal = Math.round(newVal / this.step) * precisionFactor * this.step / precisionFactor;
  637. }
  638. if (this.precision !== undefined) {
  639. newVal = this.toPrecision(newVal, this.precision);
  640. }
  641. }
  642. if (newVal >= this.max) newVal = this.max;
  643. if (newVal <= this.min) newVal = this.min;
  644. this.currentValue = newVal;
  645. this.userInput = null;
  646. this.$emit('input', newVal);
  647. }
  648. }
  649. },
  650. computed: {
  651. minDisabled: function minDisabled() {
  652. return this._decrease(this.value, this.step) < this.min;
  653. },
  654. maxDisabled: function maxDisabled() {
  655. return this._increase(this.value, this.step) > this.max;
  656. },
  657. numPrecision: function numPrecision() {
  658. var value = this.value,
  659. step = this.step,
  660. getPrecision = this.getPrecision,
  661. precision = this.precision;
  662. var stepPrecision = getPrecision(step);
  663. if (precision !== undefined) {
  664. if (stepPrecision > precision) {
  665. console.warn('[Element Warn][InputNumber]precision should not be less than the decimal places of step');
  666. }
  667. return precision;
  668. } else {
  669. return Math.max(getPrecision(value), stepPrecision);
  670. }
  671. },
  672. controlsAtRight: function controlsAtRight() {
  673. return this.controls && this.controlsPosition === 'right';
  674. },
  675. _elFormItemSize: function _elFormItemSize() {
  676. return (this.elFormItem || {}).elFormItemSize;
  677. },
  678. inputNumberSize: function inputNumberSize() {
  679. return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
  680. },
  681. inputNumberDisabled: function inputNumberDisabled() {
  682. return this.disabled || !!(this.elForm || {}).disabled;
  683. },
  684. displayValue: function displayValue() {
  685. if (this.userInput !== null) {
  686. return this.userInput;
  687. }
  688. var currentValue = this.currentValue;
  689. if (typeof currentValue === 'number') {
  690. if (this.stepStrictly) {
  691. var stepPrecision = this.getPrecision(this.step);
  692. var precisionFactor = Math.pow(10, stepPrecision);
  693. currentValue = Math.round(currentValue / this.step) * precisionFactor * this.step / precisionFactor;
  694. }
  695. if (this.precision !== undefined) {
  696. currentValue = currentValue.toFixed(this.precision);
  697. }
  698. }
  699. return currentValue;
  700. }
  701. },
  702. methods: {
  703. toPrecision: function toPrecision(num, precision) {
  704. if (precision === undefined) precision = this.numPrecision;
  705. return parseFloat(Math.round(num * Math.pow(10, precision)) / Math.pow(10, precision));
  706. },
  707. getPrecision: function getPrecision(value) {
  708. if (value === undefined) return 0;
  709. var valueString = value.toString();
  710. var dotPosition = valueString.indexOf('.');
  711. var precision = 0;
  712. if (dotPosition !== -1) {
  713. precision = valueString.length - dotPosition - 1;
  714. }
  715. return precision;
  716. },
  717. _increase: function _increase(val, step) {
  718. if (typeof val !== 'number' && val !== undefined) return this.currentValue;
  719. var precisionFactor = Math.pow(10, this.numPrecision);
  720. // Solve the accuracy problem of JS decimal calculation by converting the value to integer.
  721. return this.toPrecision((precisionFactor * val + precisionFactor * step) / precisionFactor);
  722. },
  723. _decrease: function _decrease(val, step) {
  724. if (typeof val !== 'number' && val !== undefined) return this.currentValue;
  725. var precisionFactor = Math.pow(10, this.numPrecision);
  726. return this.toPrecision((precisionFactor * val - precisionFactor * step) / precisionFactor);
  727. },
  728. increase: function increase() {
  729. if (this.inputNumberDisabled || this.maxDisabled) return;
  730. var value = this.value || 0;
  731. var newVal = this._increase(value, this.step);
  732. this.setCurrentValue(newVal);
  733. },
  734. decrease: function decrease() {
  735. if (this.inputNumberDisabled || this.minDisabled) return;
  736. var value = this.value || 0;
  737. var newVal = this._decrease(value, this.step);
  738. this.setCurrentValue(newVal);
  739. },
  740. handleBlur: function handleBlur(event) {
  741. this.$emit('blur', event);
  742. },
  743. handleFocus: function handleFocus(event) {
  744. this.$emit('focus', event);
  745. },
  746. setCurrentValue: function setCurrentValue(newVal) {
  747. var oldVal = this.currentValue;
  748. if (typeof newVal === 'number' && this.precision !== undefined) {
  749. newVal = this.toPrecision(newVal, this.precision);
  750. }
  751. if (newVal >= this.max) newVal = this.max;
  752. if (newVal <= this.min) newVal = this.min;
  753. if (oldVal === newVal) return;
  754. this.userInput = null;
  755. this.$emit('input', newVal);
  756. this.$emit('change', newVal, oldVal);
  757. this.currentValue = newVal;
  758. },
  759. handleInput: function handleInput(value) {
  760. this.userInput = value;
  761. },
  762. handleInputChange: function handleInputChange(value) {
  763. var newVal = value === '' ? undefined : Number(value);
  764. if (!isNaN(newVal) || value === '') {
  765. this.setCurrentValue(newVal);
  766. }
  767. this.userInput = null;
  768. },
  769. select: function select() {
  770. this.$refs.input.select();
  771. }
  772. },
  773. mounted: function mounted() {
  774. var innerInput = this.$refs.input.$refs.input;
  775. innerInput.setAttribute('role', 'spinbutton');
  776. innerInput.setAttribute('aria-valuemax', this.max);
  777. innerInput.setAttribute('aria-valuemin', this.min);
  778. innerInput.setAttribute('aria-valuenow', this.currentValue);
  779. innerInput.setAttribute('aria-disabled', this.inputNumberDisabled);
  780. },
  781. updated: function updated() {
  782. if (!this.$refs || !this.$refs.input) return;
  783. var innerInput = this.$refs.input.$refs.input;
  784. innerInput.setAttribute('aria-valuenow', this.currentValue);
  785. }
  786. });
  787. // CONCATENATED MODULE: ./packages/input-number/src/input-number.vue?vue&type=script&lang=js&
  788. /* harmony default export */ var src_input_numbervue_type_script_lang_js_ = (input_numbervue_type_script_lang_js_);
  789. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  790. var componentNormalizer = __webpack_require__(2);
  791. // CONCATENATED MODULE: ./packages/input-number/src/input-number.vue
  792. /* normalize component */
  793. var component = Object(componentNormalizer["a" /* default */])(
  794. src_input_numbervue_type_script_lang_js_,
  795. render,
  796. staticRenderFns,
  797. false,
  798. null,
  799. null,
  800. null
  801. )
  802. /* hot reload */
  803. if (false) { var api; }
  804. component.options.__file = "packages/input-number/src/input-number.vue"
  805. /* harmony default export */ var input_number = (component.exports);
  806. // CONCATENATED MODULE: ./packages/input-number/index.js
  807. /* istanbul ignore next */
  808. input_number.install = function (Vue) {
  809. Vue.component(input_number.name, input_number);
  810. };
  811. /* harmony default export */ var packages_input_number = __webpack_exports__["default"] = (input_number);
  812. /***/ }),
  813. /***/ 2:
  814. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  815. "use strict";
  816. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
  817. /* globals __VUE_SSR_CONTEXT__ */
  818. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  819. // This module is a runtime utility for cleaner component module output and will
  820. // be included in the final webpack user bundle.
  821. function normalizeComponent (
  822. scriptExports,
  823. render,
  824. staticRenderFns,
  825. functionalTemplate,
  826. injectStyles,
  827. scopeId,
  828. moduleIdentifier, /* server only */
  829. shadowMode /* vue-cli only */
  830. ) {
  831. // Vue.extend constructor export interop
  832. var options = typeof scriptExports === 'function'
  833. ? scriptExports.options
  834. : scriptExports
  835. // render functions
  836. if (render) {
  837. options.render = render
  838. options.staticRenderFns = staticRenderFns
  839. options._compiled = true
  840. }
  841. // functional template
  842. if (functionalTemplate) {
  843. options.functional = true
  844. }
  845. // scopedId
  846. if (scopeId) {
  847. options._scopeId = 'data-v-' + scopeId
  848. }
  849. var hook
  850. if (moduleIdentifier) { // server build
  851. hook = function (context) {
  852. // 2.3 injection
  853. context =
  854. context || // cached call
  855. (this.$vnode && this.$vnode.ssrContext) || // stateful
  856. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  857. // 2.2 with runInNewContext: true
  858. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  859. context = __VUE_SSR_CONTEXT__
  860. }
  861. // inject component styles
  862. if (injectStyles) {
  863. injectStyles.call(this, context)
  864. }
  865. // register component module identifier for async chunk inferrence
  866. if (context && context._registeredComponents) {
  867. context._registeredComponents.add(moduleIdentifier)
  868. }
  869. }
  870. // used by ssr in case component is cached and beforeCreate
  871. // never gets called
  872. options._ssrRegister = hook
  873. } else if (injectStyles) {
  874. hook = shadowMode
  875. ? function () {
  876. injectStyles.call(
  877. this,
  878. (options.functional ? this.parent : this).$root.$options.shadowRoot
  879. )
  880. }
  881. : injectStyles
  882. }
  883. if (hook) {
  884. if (options.functional) {
  885. // for template-only hot-reload because in that case the render fn doesn't
  886. // go through the normalizer
  887. options._injectStyles = hook
  888. // register for functional component in vue file
  889. var originalRender = options.render
  890. options.render = function renderWithStyleInjection (h, context) {
  891. hook.call(context)
  892. return originalRender(h, context)
  893. }
  894. } else {
  895. // inject component registration as beforeCreate hook
  896. var existing = options.beforeCreate
  897. options.beforeCreate = existing
  898. ? [].concat(existing, hook)
  899. : [hook]
  900. }
  901. }
  902. return {
  903. exports: scriptExports,
  904. options: options
  905. }
  906. }
  907. /***/ }),
  908. /***/ 33:
  909. /***/ (function(module, exports) {
  910. module.exports = require("tis-ui/lib/utils/merge");
  911. /***/ }),
  912. /***/ 34:
  913. /***/ (function(module, exports) {
  914. module.exports = require("tis-ui/lib/utils/vue-popper");
  915. /***/ }),
  916. /***/ 36:
  917. /***/ (function(module, exports) {
  918. module.exports = require("tis-ui/lib/mixins/migrating");
  919. /***/ }),
  920. /***/ 4:
  921. /***/ (function(module, exports) {
  922. module.exports = require("vue");
  923. /***/ }),
  924. /***/ 49:
  925. /***/ (function(module, exports) {
  926. module.exports = require("tis-ui/lib/utils/shared");
  927. /***/ }),
  928. /***/ 52:
  929. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  930. "use strict";
  931. // ESM COMPAT FLAG
  932. __webpack_require__.r(__webpack_exports__);
  933. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/input/src/input.vue?vue&type=template&id=343dd774&
  934. var render = function() {
  935. var _vm = this
  936. var _h = _vm.$createElement
  937. var _c = _vm._self._c || _h
  938. return _c(
  939. "div",
  940. {
  941. class: [
  942. _vm.type === "textarea" ? "el-textarea" : "el-input",
  943. _vm.inputSize ? "el-input--" + _vm.inputSize : "",
  944. {
  945. "is-disabled": _vm.inputDisabled,
  946. "is-exceed": _vm.inputExceed,
  947. "el-input-group": _vm.$slots.prepend || _vm.$slots.append,
  948. "el-input-group--append": _vm.$slots.append,
  949. "el-input-group--prepend": _vm.$slots.prepend,
  950. "el-input--prefix": _vm.$slots.prefix || _vm.prefixIcon,
  951. "el-input--suffix":
  952. _vm.$slots.suffix ||
  953. _vm.suffixIcon ||
  954. _vm.clearable ||
  955. _vm.showPassword
  956. }
  957. ],
  958. on: {
  959. mouseenter: function($event) {
  960. _vm.hovering = true
  961. },
  962. mouseleave: function($event) {
  963. _vm.hovering = false
  964. }
  965. }
  966. },
  967. [
  968. _vm.type !== "textarea"
  969. ? [
  970. _vm.$slots.prepend
  971. ? _c(
  972. "div",
  973. { staticClass: "el-input-group__prepend" },
  974. [_vm._t("prepend")],
  975. 2
  976. )
  977. : _vm._e(),
  978. _vm.type !== "textarea"
  979. ? _c(
  980. "input",
  981. _vm._b(
  982. {
  983. ref: "input",
  984. staticClass: "el-input__inner",
  985. attrs: {
  986. tabindex: _vm.tabindex,
  987. type: _vm.showPassword
  988. ? _vm.passwordVisible
  989. ? "text"
  990. : "password"
  991. : _vm.type,
  992. disabled: _vm.inputDisabled,
  993. readonly: _vm.readonly,
  994. autocomplete: _vm.autoComplete || _vm.autocomplete,
  995. "aria-label": _vm.label
  996. },
  997. on: {
  998. compositionstart: _vm.handleCompositionStart,
  999. compositionupdate: _vm.handleCompositionUpdate,
  1000. compositionend: _vm.handleCompositionEnd,
  1001. input: _vm.handleInput,
  1002. focus: _vm.handleFocus,
  1003. blur: _vm.handleBlur,
  1004. change: _vm.handleChange
  1005. }
  1006. },
  1007. "input",
  1008. _vm.$attrs,
  1009. false
  1010. )
  1011. )
  1012. : _vm._e(),
  1013. _vm.$slots.prefix || _vm.prefixIcon
  1014. ? _c(
  1015. "span",
  1016. { staticClass: "el-input__prefix" },
  1017. [
  1018. _vm._t("prefix"),
  1019. _vm.prefixIcon
  1020. ? _c("i", {
  1021. staticClass: "el-input__icon",
  1022. class: _vm.prefixIcon
  1023. })
  1024. : _vm._e()
  1025. ],
  1026. 2
  1027. )
  1028. : _vm._e(),
  1029. _vm.getSuffixVisible()
  1030. ? _c("span", { staticClass: "el-input__suffix" }, [
  1031. _c(
  1032. "span",
  1033. { staticClass: "el-input__suffix-inner" },
  1034. [
  1035. !_vm.showClear ||
  1036. !_vm.showPwdVisible ||
  1037. !_vm.isWordLimitVisible
  1038. ? [
  1039. _vm._t("suffix"),
  1040. _vm.suffixIcon
  1041. ? _c("i", {
  1042. staticClass: "el-input__icon",
  1043. class: _vm.suffixIcon
  1044. })
  1045. : _vm._e()
  1046. ]
  1047. : _vm._e(),
  1048. _vm.showClear
  1049. ? _c("i", {
  1050. staticClass:
  1051. "el-input__icon el-icon-circle-close el-input__clear",
  1052. on: {
  1053. mousedown: function($event) {
  1054. $event.preventDefault()
  1055. },
  1056. click: _vm.clear
  1057. }
  1058. })
  1059. : _vm._e(),
  1060. _vm.showPwdVisible
  1061. ? _c("i", {
  1062. staticClass:
  1063. "el-input__icon el-icon-view el-input__clear",
  1064. on: { click: _vm.handlePasswordVisible }
  1065. })
  1066. : _vm._e(),
  1067. _vm.isWordLimitVisible
  1068. ? _c("span", { staticClass: "el-input__count" }, [
  1069. _c(
  1070. "span",
  1071. { staticClass: "el-input__count-inner" },
  1072. [
  1073. _vm._v(
  1074. "\n " +
  1075. _vm._s(_vm.textLength) +
  1076. "/" +
  1077. _vm._s(_vm.upperLimit) +
  1078. "\n "
  1079. )
  1080. ]
  1081. )
  1082. ])
  1083. : _vm._e()
  1084. ],
  1085. 2
  1086. ),
  1087. _vm.validateState
  1088. ? _c("i", {
  1089. staticClass: "el-input__icon",
  1090. class: ["el-input__validateIcon", _vm.validateIcon]
  1091. })
  1092. : _vm._e()
  1093. ])
  1094. : _vm._e(),
  1095. _vm.$slots.append
  1096. ? _c(
  1097. "div",
  1098. { staticClass: "el-input-group__append" },
  1099. [_vm._t("append")],
  1100. 2
  1101. )
  1102. : _vm._e()
  1103. ]
  1104. : _c(
  1105. "textarea",
  1106. _vm._b(
  1107. {
  1108. ref: "textarea",
  1109. staticClass: "el-textarea__inner",
  1110. style: _vm.textareaStyle,
  1111. attrs: {
  1112. tabindex: _vm.tabindex,
  1113. disabled: _vm.inputDisabled,
  1114. readonly: _vm.readonly,
  1115. autocomplete: _vm.autoComplete || _vm.autocomplete,
  1116. "aria-label": _vm.label
  1117. },
  1118. on: {
  1119. compositionstart: _vm.handleCompositionStart,
  1120. compositionupdate: _vm.handleCompositionUpdate,
  1121. compositionend: _vm.handleCompositionEnd,
  1122. input: _vm.handleInput,
  1123. focus: _vm.handleFocus,
  1124. blur: _vm.handleBlur,
  1125. change: _vm.handleChange
  1126. }
  1127. },
  1128. "textarea",
  1129. _vm.$attrs,
  1130. false
  1131. )
  1132. ),
  1133. _vm.isWordLimitVisible && _vm.type === "textarea"
  1134. ? _c("span", { staticClass: "el-input__count" }, [
  1135. _vm._v(_vm._s(_vm.textLength) + "/" + _vm._s(_vm.upperLimit))
  1136. ])
  1137. : _vm._e()
  1138. ],
  1139. 2
  1140. )
  1141. }
  1142. var staticRenderFns = []
  1143. render._withStripped = true
  1144. // CONCATENATED MODULE: ./packages/input/src/input.vue?vue&type=template&id=343dd774&
  1145. // EXTERNAL MODULE: external "tis-ui/lib/mixins/emitter"
  1146. var emitter_ = __webpack_require__(13);
  1147. var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
  1148. // EXTERNAL MODULE: external "tis-ui/lib/mixins/migrating"
  1149. var migrating_ = __webpack_require__(36);
  1150. var migrating_default = /*#__PURE__*/__webpack_require__.n(migrating_);
  1151. // CONCATENATED MODULE: ./packages/input/src/calcTextareaHeight.js
  1152. var hiddenTextarea = void 0;
  1153. var HIDDEN_STYLE = '\n height:0 !important;\n visibility:hidden !important;\n overflow:hidden !important;\n position:absolute !important;\n z-index:-1000 !important;\n top:0 !important;\n right:0 !important\n';
  1154. var CONTEXT_STYLE = ['letter-spacing', 'line-height', 'padding-top', 'padding-bottom', 'font-family', 'font-weight', 'font-size', 'text-rendering', 'text-transform', 'width', 'text-indent', 'padding-left', 'padding-right', 'border-width', 'box-sizing'];
  1155. function calculateNodeStyling(targetElement) {
  1156. var style = window.getComputedStyle(targetElement);
  1157. var boxSizing = style.getPropertyValue('box-sizing');
  1158. var paddingSize = parseFloat(style.getPropertyValue('padding-bottom')) + parseFloat(style.getPropertyValue('padding-top'));
  1159. var borderSize = parseFloat(style.getPropertyValue('border-bottom-width')) + parseFloat(style.getPropertyValue('border-top-width'));
  1160. var contextStyle = CONTEXT_STYLE.map(function (name) {
  1161. return name + ':' + style.getPropertyValue(name);
  1162. }).join(';');
  1163. return { contextStyle: contextStyle, paddingSize: paddingSize, borderSize: borderSize, boxSizing: boxSizing };
  1164. }
  1165. function calcTextareaHeight(targetElement) {
  1166. var minRows = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
  1167. var maxRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  1168. if (!hiddenTextarea) {
  1169. hiddenTextarea = document.createElement('textarea');
  1170. document.body.appendChild(hiddenTextarea);
  1171. }
  1172. var _calculateNodeStyling = calculateNodeStyling(targetElement),
  1173. paddingSize = _calculateNodeStyling.paddingSize,
  1174. borderSize = _calculateNodeStyling.borderSize,
  1175. boxSizing = _calculateNodeStyling.boxSizing,
  1176. contextStyle = _calculateNodeStyling.contextStyle;
  1177. hiddenTextarea.setAttribute('style', contextStyle + ';' + HIDDEN_STYLE);
  1178. hiddenTextarea.value = targetElement.value || targetElement.placeholder || '';
  1179. var height = hiddenTextarea.scrollHeight;
  1180. var result = {};
  1181. if (boxSizing === 'border-box') {
  1182. height = height + borderSize;
  1183. } else if (boxSizing === 'content-box') {
  1184. height = height - paddingSize;
  1185. }
  1186. hiddenTextarea.value = '';
  1187. var singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  1188. if (minRows !== null) {
  1189. var minHeight = singleRowHeight * minRows;
  1190. if (boxSizing === 'border-box') {
  1191. minHeight = minHeight + paddingSize + borderSize;
  1192. }
  1193. height = Math.max(minHeight, height);
  1194. result.minHeight = minHeight + 'px';
  1195. }
  1196. if (maxRows !== null) {
  1197. var maxHeight = singleRowHeight * maxRows;
  1198. if (boxSizing === 'border-box') {
  1199. maxHeight = maxHeight + paddingSize + borderSize;
  1200. }
  1201. height = Math.min(maxHeight, height);
  1202. }
  1203. result.height = height + 'px';
  1204. hiddenTextarea.parentNode && hiddenTextarea.parentNode.removeChild(hiddenTextarea);
  1205. hiddenTextarea = null;
  1206. return result;
  1207. };
  1208. // EXTERNAL MODULE: external "tis-ui/lib/utils/merge"
  1209. var merge_ = __webpack_require__(33);
  1210. var merge_default = /*#__PURE__*/__webpack_require__.n(merge_);
  1211. // EXTERNAL MODULE: external "tis-ui/lib/utils/shared"
  1212. var shared_ = __webpack_require__(49);
  1213. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/input/src/input.vue?vue&type=script&lang=js&
  1214. //
  1215. //
  1216. //
  1217. //
  1218. //
  1219. //
  1220. //
  1221. //
  1222. //
  1223. //
  1224. //
  1225. //
  1226. //
  1227. //
  1228. //
  1229. //
  1230. //
  1231. //
  1232. //
  1233. //
  1234. //
  1235. //
  1236. //
  1237. //
  1238. //
  1239. //
  1240. //
  1241. //
  1242. //
  1243. //
  1244. //
  1245. //
  1246. //
  1247. //
  1248. //
  1249. //
  1250. //
  1251. //
  1252. //
  1253. //
  1254. //
  1255. //
  1256. //
  1257. //
  1258. //
  1259. //
  1260. //
  1261. //
  1262. //
  1263. //
  1264. //
  1265. //
  1266. //
  1267. //
  1268. //
  1269. //
  1270. //
  1271. //
  1272. //
  1273. //
  1274. //
  1275. //
  1276. //
  1277. //
  1278. //
  1279. //
  1280. //
  1281. //
  1282. //
  1283. //
  1284. //
  1285. //
  1286. //
  1287. //
  1288. //
  1289. //
  1290. //
  1291. //
  1292. //
  1293. //
  1294. //
  1295. //
  1296. //
  1297. //
  1298. //
  1299. //
  1300. //
  1301. //
  1302. //
  1303. //
  1304. //
  1305. //
  1306. //
  1307. //
  1308. //
  1309. //
  1310. //
  1311. //
  1312. //
  1313. //
  1314. //
  1315. //
  1316. //
  1317. //
  1318. //
  1319. //
  1320. //
  1321. //
  1322. //
  1323. /* harmony default export */ var inputvue_type_script_lang_js_ = ({
  1324. name: 'TisInput',
  1325. componentName: 'TisInput',
  1326. mixins: [emitter_default.a, migrating_default.a],
  1327. inheritAttrs: false,
  1328. inject: {
  1329. elForm: {
  1330. default: ''
  1331. },
  1332. elFormItem: {
  1333. default: ''
  1334. }
  1335. },
  1336. data: function data() {
  1337. return {
  1338. textareaCalcStyle: {},
  1339. hovering: false,
  1340. focused: false,
  1341. isComposing: false,
  1342. passwordVisible: false
  1343. };
  1344. },
  1345. props: {
  1346. value: [String, Number],
  1347. size: String,
  1348. resize: String,
  1349. form: String,
  1350. disabled: Boolean,
  1351. readonly: Boolean,
  1352. type: {
  1353. type: String,
  1354. default: 'text'
  1355. },
  1356. autosize: {
  1357. type: [Boolean, Object],
  1358. default: false
  1359. },
  1360. autocomplete: {
  1361. type: String,
  1362. default: 'off'
  1363. },
  1364. /** @Deprecated in next major version */
  1365. autoComplete: {
  1366. type: String,
  1367. validator: function validator(val) {
  1368. false && false;
  1369. return true;
  1370. }
  1371. },
  1372. validateEvent: {
  1373. type: Boolean,
  1374. default: true
  1375. },
  1376. suffixIcon: String,
  1377. prefixIcon: String,
  1378. label: String,
  1379. clearable: {
  1380. type: Boolean,
  1381. default: false
  1382. },
  1383. showPassword: {
  1384. type: Boolean,
  1385. default: false
  1386. },
  1387. showWordLimit: {
  1388. type: Boolean,
  1389. default: false
  1390. },
  1391. tabindex: String
  1392. },
  1393. computed: {
  1394. _elFormItemSize: function _elFormItemSize() {
  1395. return (this.elFormItem || {}).elFormItemSize;
  1396. },
  1397. validateState: function validateState() {
  1398. return this.elFormItem ? this.elFormItem.validateState : '';
  1399. },
  1400. needStatusIcon: function needStatusIcon() {
  1401. return this.elForm ? this.elForm.statusIcon : false;
  1402. },
  1403. validateIcon: function validateIcon() {
  1404. return {
  1405. validating: 'el-icon-loading',
  1406. success: 'el-icon-circle-check',
  1407. error: 'el-icon-circle-close'
  1408. }[this.validateState];
  1409. },
  1410. textareaStyle: function textareaStyle() {
  1411. return merge_default()({}, this.textareaCalcStyle, { resize: this.resize });
  1412. },
  1413. inputSize: function inputSize() {
  1414. return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
  1415. },
  1416. inputDisabled: function inputDisabled() {
  1417. return this.disabled || (this.elForm || {}).disabled;
  1418. },
  1419. nativeInputValue: function nativeInputValue() {
  1420. return this.value === null || this.value === undefined ? '' : String(this.value);
  1421. },
  1422. showClear: function showClear() {
  1423. return this.clearable && !this.inputDisabled && !this.readonly && this.nativeInputValue && (this.focused || this.hovering);
  1424. },
  1425. showPwdVisible: function showPwdVisible() {
  1426. return this.showPassword && !this.inputDisabled && !this.readonly && (!!this.nativeInputValue || this.focused);
  1427. },
  1428. isWordLimitVisible: function isWordLimitVisible() {
  1429. return this.showWordLimit && this.$attrs.maxlength && (this.type === 'text' || this.type === 'textarea') && !this.inputDisabled && !this.readonly && !this.showPassword;
  1430. },
  1431. upperLimit: function upperLimit() {
  1432. return this.$attrs.maxlength;
  1433. },
  1434. textLength: function textLength() {
  1435. if (typeof this.value === 'number') {
  1436. return String(this.value).length;
  1437. }
  1438. return (this.value || '').length;
  1439. },
  1440. inputExceed: function inputExceed() {
  1441. // show exceed style if length of initial value greater then maxlength
  1442. return this.isWordLimitVisible && this.textLength > this.upperLimit;
  1443. }
  1444. },
  1445. watch: {
  1446. value: function value(val) {
  1447. this.$nextTick(this.resizeTextarea);
  1448. if (this.validateEvent) {
  1449. this.dispatch('ElFormItem', 'el.form.change', [val]);
  1450. }
  1451. },
  1452. // native input value is set explicitly
  1453. // do not use v-model / :value in template
  1454. // see: https://github.com/ElemeFE/element/issues/14521
  1455. nativeInputValue: function nativeInputValue() {
  1456. this.setNativeInputValue();
  1457. },
  1458. // when change between <input> and <textarea>,
  1459. // update DOM dependent value and styles
  1460. // https://github.com/ElemeFE/element/issues/14857
  1461. type: function type() {
  1462. var _this = this;
  1463. this.$nextTick(function () {
  1464. _this.setNativeInputValue();
  1465. _this.resizeTextarea();
  1466. _this.updateIconOffset();
  1467. });
  1468. }
  1469. },
  1470. methods: {
  1471. focus: function focus() {
  1472. this.getInput().focus();
  1473. },
  1474. blur: function blur() {
  1475. this.getInput().blur();
  1476. },
  1477. getMigratingConfig: function getMigratingConfig() {
  1478. return {
  1479. props: {
  1480. 'icon': 'icon is removed, use suffix-icon / prefix-icon instead.',
  1481. 'on-icon-click': 'on-icon-click is removed.'
  1482. },
  1483. events: {
  1484. 'click': 'click is removed.'
  1485. }
  1486. };
  1487. },
  1488. handleBlur: function handleBlur(event) {
  1489. this.focused = false;
  1490. this.$emit('blur', event);
  1491. if (this.validateEvent) {
  1492. this.dispatch('ElFormItem', 'el.form.blur', [this.value]);
  1493. }
  1494. },
  1495. select: function select() {
  1496. this.getInput().select();
  1497. },
  1498. resizeTextarea: function resizeTextarea() {
  1499. if (this.$isServer) return;
  1500. var autosize = this.autosize,
  1501. type = this.type;
  1502. if (type !== 'textarea') return;
  1503. if (!autosize) {
  1504. this.textareaCalcStyle = {
  1505. minHeight: calcTextareaHeight(this.$refs.textarea).minHeight
  1506. };
  1507. return;
  1508. }
  1509. var minRows = autosize.minRows;
  1510. var maxRows = autosize.maxRows;
  1511. this.textareaCalcStyle = calcTextareaHeight(this.$refs.textarea, minRows, maxRows);
  1512. },
  1513. setNativeInputValue: function setNativeInputValue() {
  1514. var input = this.getInput();
  1515. if (!input) return;
  1516. if (input.value === this.nativeInputValue) return;
  1517. input.value = this.nativeInputValue;
  1518. },
  1519. handleFocus: function handleFocus(event) {
  1520. this.focused = true;
  1521. this.$emit('focus', event);
  1522. },
  1523. handleCompositionStart: function handleCompositionStart() {
  1524. this.isComposing = true;
  1525. },
  1526. handleCompositionUpdate: function handleCompositionUpdate(event) {
  1527. var text = event.target.value;
  1528. var lastCharacter = text[text.length - 1] || '';
  1529. this.isComposing = !Object(shared_["isKorean"])(lastCharacter);
  1530. },
  1531. handleCompositionEnd: function handleCompositionEnd(event) {
  1532. if (this.isComposing) {
  1533. this.isComposing = false;
  1534. this.handleInput(event);
  1535. }
  1536. },
  1537. handleInput: function handleInput(event) {
  1538. // should not emit input during composition
  1539. // see: https://github.com/ElemeFE/element/issues/10516
  1540. if (this.isComposing) return;
  1541. // hack for https://github.com/ElemeFE/element/issues/8548
  1542. // should remove the following line when we don't support IE
  1543. if (event.target.value === this.nativeInputValue) return;
  1544. this.$emit('input', event.target.value);
  1545. // ensure native input value is controlled
  1546. // see: https://github.com/ElemeFE/element/issues/12850
  1547. this.$nextTick(this.setNativeInputValue);
  1548. },
  1549. handleChange: function handleChange(event) {
  1550. this.$emit('change', event.target.value);
  1551. },
  1552. calcIconOffset: function calcIconOffset(place) {
  1553. var elList = [].slice.call(this.$el.querySelectorAll('.el-input__' + place) || []);
  1554. if (!elList.length) return;
  1555. var el = null;
  1556. for (var i = 0; i < elList.length; i++) {
  1557. if (elList[i].parentNode === this.$el) {
  1558. el = elList[i];
  1559. break;
  1560. }
  1561. }
  1562. if (!el) return;
  1563. var pendantMap = {
  1564. suffix: 'append',
  1565. prefix: 'prepend'
  1566. };
  1567. var pendant = pendantMap[place];
  1568. if (this.$slots[pendant]) {
  1569. el.style.transform = 'translateX(' + (place === 'suffix' ? '-' : '') + this.$el.querySelector('.el-input-group__' + pendant).offsetWidth + 'px)';
  1570. } else {
  1571. el.removeAttribute('style');
  1572. }
  1573. },
  1574. updateIconOffset: function updateIconOffset() {
  1575. this.calcIconOffset('prefix');
  1576. this.calcIconOffset('suffix');
  1577. },
  1578. clear: function clear() {
  1579. this.$emit('input', '');
  1580. this.$emit('change', '');
  1581. this.$emit('clear');
  1582. },
  1583. handlePasswordVisible: function handlePasswordVisible() {
  1584. this.passwordVisible = !this.passwordVisible;
  1585. this.focus();
  1586. },
  1587. getInput: function getInput() {
  1588. return this.$refs.input || this.$refs.textarea;
  1589. },
  1590. getSuffixVisible: function getSuffixVisible() {
  1591. return this.$slots.suffix || this.suffixIcon || this.showClear || this.showPassword || this.isWordLimitVisible || this.validateState && this.needStatusIcon;
  1592. }
  1593. },
  1594. created: function created() {
  1595. this.$on('inputSelect', this.select);
  1596. },
  1597. mounted: function mounted() {
  1598. this.setNativeInputValue();
  1599. this.resizeTextarea();
  1600. this.updateIconOffset();
  1601. },
  1602. updated: function updated() {
  1603. this.$nextTick(this.updateIconOffset);
  1604. }
  1605. });
  1606. // CONCATENATED MODULE: ./packages/input/src/input.vue?vue&type=script&lang=js&
  1607. /* harmony default export */ var src_inputvue_type_script_lang_js_ = (inputvue_type_script_lang_js_);
  1608. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  1609. var componentNormalizer = __webpack_require__(2);
  1610. // CONCATENATED MODULE: ./packages/input/src/input.vue
  1611. /* normalize component */
  1612. var component = Object(componentNormalizer["a" /* default */])(
  1613. src_inputvue_type_script_lang_js_,
  1614. render,
  1615. staticRenderFns,
  1616. false,
  1617. null,
  1618. null,
  1619. null
  1620. )
  1621. /* hot reload */
  1622. if (false) { var api; }
  1623. component.options.__file = "packages/input/src/input.vue"
  1624. /* harmony default export */ var input = (component.exports);
  1625. // CONCATENATED MODULE: ./packages/input/index.js
  1626. /* istanbul ignore next */
  1627. input.install = function (Vue) {
  1628. Vue.component(input.name, input);
  1629. };
  1630. /* harmony default export */ var packages_input = __webpack_exports__["default"] = (input);
  1631. /***/ }),
  1632. /***/ 520:
  1633. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1634. "use strict";
  1635. // ESM COMPAT FLAG
  1636. __webpack_require__.r(__webpack_exports__);
  1637. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/slider/src/main.vue?vue&type=template&id=32708644&
  1638. var render = function() {
  1639. var _vm = this
  1640. var _h = _vm.$createElement
  1641. var _c = _vm._self._c || _h
  1642. return _c(
  1643. "div",
  1644. {
  1645. staticClass: "el-slider",
  1646. class: {
  1647. "is-vertical": _vm.vertical,
  1648. "el-slider--with-input": _vm.showInput
  1649. },
  1650. attrs: {
  1651. role: "slider",
  1652. "aria-valuemin": _vm.min,
  1653. "aria-valuemax": _vm.max,
  1654. "aria-orientation": _vm.vertical ? "vertical" : "horizontal",
  1655. "aria-disabled": _vm.sliderDisabled
  1656. }
  1657. },
  1658. [
  1659. _vm.showInput && !_vm.range
  1660. ? _c("tis-input-number", {
  1661. ref: "input",
  1662. staticClass: "el-slider__input",
  1663. attrs: {
  1664. step: _vm.step,
  1665. disabled: _vm.sliderDisabled,
  1666. controls: _vm.showInputControls,
  1667. min: _vm.min,
  1668. max: _vm.max,
  1669. debounce: _vm.debounce,
  1670. size: _vm.inputSize
  1671. },
  1672. on: { change: _vm.emitChange },
  1673. model: {
  1674. value: _vm.firstValue,
  1675. callback: function($$v) {
  1676. _vm.firstValue = $$v
  1677. },
  1678. expression: "firstValue"
  1679. }
  1680. })
  1681. : _vm._e(),
  1682. _c(
  1683. "div",
  1684. {
  1685. ref: "slider",
  1686. staticClass: "el-slider__runway",
  1687. class: { "show-input": _vm.showInput, disabled: _vm.sliderDisabled },
  1688. style: _vm.runwayStyle,
  1689. on: { click: _vm.onSliderClick }
  1690. },
  1691. [
  1692. _c("div", { staticClass: "el-slider__bar", style: _vm.barStyle }),
  1693. _c("slider-button", {
  1694. ref: "button1",
  1695. attrs: {
  1696. vertical: _vm.vertical,
  1697. "tooltip-class": _vm.tooltipClass
  1698. },
  1699. model: {
  1700. value: _vm.firstValue,
  1701. callback: function($$v) {
  1702. _vm.firstValue = $$v
  1703. },
  1704. expression: "firstValue"
  1705. }
  1706. }),
  1707. _vm.range
  1708. ? _c("slider-button", {
  1709. ref: "button2",
  1710. attrs: {
  1711. vertical: _vm.vertical,
  1712. "tooltip-class": _vm.tooltipClass
  1713. },
  1714. model: {
  1715. value: _vm.secondValue,
  1716. callback: function($$v) {
  1717. _vm.secondValue = $$v
  1718. },
  1719. expression: "secondValue"
  1720. }
  1721. })
  1722. : _vm._e(),
  1723. _vm._l(_vm.stops, function(item, key) {
  1724. return _vm.showStops
  1725. ? _c("div", {
  1726. key: key,
  1727. staticClass: "el-slider__stop",
  1728. style: _vm.getStopStyle(item)
  1729. })
  1730. : _vm._e()
  1731. }),
  1732. _vm.markList.length > 0
  1733. ? [
  1734. _c(
  1735. "div",
  1736. _vm._l(_vm.markList, function(item, key) {
  1737. return _c("div", {
  1738. key: key,
  1739. staticClass: "el-slider__stop el-slider__marks-stop",
  1740. style: _vm.getStopStyle(item.position)
  1741. })
  1742. }),
  1743. 0
  1744. ),
  1745. _c(
  1746. "div",
  1747. { staticClass: "el-slider__marks" },
  1748. _vm._l(_vm.markList, function(item, key) {
  1749. return _c("slider-marker", {
  1750. key: key,
  1751. style: _vm.getStopStyle(item.position),
  1752. attrs: { mark: item.mark }
  1753. })
  1754. }),
  1755. 1
  1756. )
  1757. ]
  1758. : _vm._e()
  1759. ],
  1760. 2
  1761. )
  1762. ],
  1763. 1
  1764. )
  1765. }
  1766. var staticRenderFns = []
  1767. render._withStripped = true
  1768. // CONCATENATED MODULE: ./packages/slider/src/main.vue?vue&type=template&id=32708644&
  1769. // EXTERNAL MODULE: ./packages/input-number/index.js + 5 modules
  1770. var input_number = __webpack_require__(155);
  1771. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/slider/src/button.vue?vue&type=template&id=e72d2ad2&
  1772. var buttonvue_type_template_id_e72d2ad2_render = function() {
  1773. var _vm = this
  1774. var _h = _vm.$createElement
  1775. var _c = _vm._self._c || _h
  1776. return _c(
  1777. "div",
  1778. {
  1779. ref: "button",
  1780. staticClass: "el-slider__button-wrapper",
  1781. class: { hover: _vm.hovering, dragging: _vm.dragging },
  1782. style: _vm.wrapperStyle,
  1783. attrs: { tabindex: "0" },
  1784. on: {
  1785. mouseenter: _vm.handleMouseEnter,
  1786. mouseleave: _vm.handleMouseLeave,
  1787. mousedown: _vm.onButtonDown,
  1788. touchstart: _vm.onButtonDown,
  1789. focus: _vm.handleMouseEnter,
  1790. blur: _vm.handleMouseLeave,
  1791. keydown: [
  1792. function($event) {
  1793. if (
  1794. !("button" in $event) &&
  1795. _vm._k($event.keyCode, "left", 37, $event.key, [
  1796. "Left",
  1797. "ArrowLeft"
  1798. ])
  1799. ) {
  1800. return null
  1801. }
  1802. if ("button" in $event && $event.button !== 0) {
  1803. return null
  1804. }
  1805. return _vm.onLeftKeyDown($event)
  1806. },
  1807. function($event) {
  1808. if (
  1809. !("button" in $event) &&
  1810. _vm._k($event.keyCode, "right", 39, $event.key, [
  1811. "Right",
  1812. "ArrowRight"
  1813. ])
  1814. ) {
  1815. return null
  1816. }
  1817. if ("button" in $event && $event.button !== 2) {
  1818. return null
  1819. }
  1820. return _vm.onRightKeyDown($event)
  1821. },
  1822. function($event) {
  1823. if (
  1824. !("button" in $event) &&
  1825. _vm._k($event.keyCode, "down", 40, $event.key, [
  1826. "Down",
  1827. "ArrowDown"
  1828. ])
  1829. ) {
  1830. return null
  1831. }
  1832. $event.preventDefault()
  1833. return _vm.onLeftKeyDown($event)
  1834. },
  1835. function($event) {
  1836. if (
  1837. !("button" in $event) &&
  1838. _vm._k($event.keyCode, "up", 38, $event.key, ["Up", "ArrowUp"])
  1839. ) {
  1840. return null
  1841. }
  1842. $event.preventDefault()
  1843. return _vm.onRightKeyDown($event)
  1844. }
  1845. ]
  1846. }
  1847. },
  1848. [
  1849. _c(
  1850. "tis-tooltip",
  1851. {
  1852. ref: "tooltip",
  1853. attrs: {
  1854. placement: "top",
  1855. "popper-class": _vm.tooltipClass,
  1856. disabled: !_vm.showTooltip
  1857. }
  1858. },
  1859. [
  1860. _c("span", { attrs: { slot: "content" }, slot: "content" }, [
  1861. _vm._v(_vm._s(_vm.formatValue))
  1862. ]),
  1863. _c("div", {
  1864. staticClass: "el-slider__button",
  1865. class: { hover: _vm.hovering, dragging: _vm.dragging }
  1866. })
  1867. ]
  1868. )
  1869. ],
  1870. 1
  1871. )
  1872. }
  1873. var buttonvue_type_template_id_e72d2ad2_staticRenderFns = []
  1874. buttonvue_type_template_id_e72d2ad2_render._withStripped = true
  1875. // CONCATENATED MODULE: ./packages/slider/src/button.vue?vue&type=template&id=e72d2ad2&
  1876. // EXTERNAL MODULE: ./packages/tooltip/index.js + 1 modules
  1877. var tooltip = __webpack_require__(102);
  1878. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/slider/src/button.vue?vue&type=script&lang=js&
  1879. //
  1880. //
  1881. //
  1882. //
  1883. //
  1884. //
  1885. //
  1886. //
  1887. //
  1888. //
  1889. //
  1890. //
  1891. //
  1892. //
  1893. //
  1894. //
  1895. //
  1896. //
  1897. //
  1898. //
  1899. //
  1900. //
  1901. //
  1902. //
  1903. //
  1904. //
  1905. //
  1906. //
  1907. //
  1908. /* harmony default export */ var buttonvue_type_script_lang_js_ = ({
  1909. name: 'TisSliderButton',
  1910. components: {
  1911. ElTooltip: tooltip["default"]
  1912. },
  1913. props: {
  1914. value: {
  1915. type: Number,
  1916. default: 0
  1917. },
  1918. vertical: {
  1919. type: Boolean,
  1920. default: false
  1921. },
  1922. tooltipClass: String
  1923. },
  1924. data: function data() {
  1925. return {
  1926. hovering: false,
  1927. dragging: false,
  1928. isClick: false,
  1929. startX: 0,
  1930. currentX: 0,
  1931. startY: 0,
  1932. currentY: 0,
  1933. startPosition: 0,
  1934. newPosition: null,
  1935. oldValue: this.value
  1936. };
  1937. },
  1938. computed: {
  1939. disabled: function disabled() {
  1940. return this.$parent.sliderDisabled;
  1941. },
  1942. max: function max() {
  1943. return this.$parent.max;
  1944. },
  1945. min: function min() {
  1946. return this.$parent.min;
  1947. },
  1948. step: function step() {
  1949. return this.$parent.step;
  1950. },
  1951. showTooltip: function showTooltip() {
  1952. return this.$parent.showTooltip;
  1953. },
  1954. precision: function precision() {
  1955. return this.$parent.precision;
  1956. },
  1957. currentPosition: function currentPosition() {
  1958. return (this.value - this.min) / (this.max - this.min) * 100 + '%';
  1959. },
  1960. enableFormat: function enableFormat() {
  1961. return this.$parent.formatTooltip instanceof Function;
  1962. },
  1963. formatValue: function formatValue() {
  1964. return this.enableFormat && this.$parent.formatTooltip(this.value) || this.value;
  1965. },
  1966. wrapperStyle: function wrapperStyle() {
  1967. return this.vertical ? { bottom: this.currentPosition } : { left: this.currentPosition };
  1968. }
  1969. },
  1970. watch: {
  1971. dragging: function dragging(val) {
  1972. this.$parent.dragging = val;
  1973. }
  1974. },
  1975. methods: {
  1976. displayTooltip: function displayTooltip() {
  1977. this.$refs.tooltip && (this.$refs.tooltip.showPopper = true);
  1978. },
  1979. hideTooltip: function hideTooltip() {
  1980. this.$refs.tooltip && (this.$refs.tooltip.showPopper = false);
  1981. },
  1982. handleMouseEnter: function handleMouseEnter() {
  1983. this.hovering = true;
  1984. this.displayTooltip();
  1985. },
  1986. handleMouseLeave: function handleMouseLeave() {
  1987. this.hovering = false;
  1988. this.hideTooltip();
  1989. },
  1990. onButtonDown: function onButtonDown(event) {
  1991. if (this.disabled) return;
  1992. event.preventDefault();
  1993. this.onDragStart(event);
  1994. window.addEventListener('mousemove', this.onDragging);
  1995. window.addEventListener('touchmove', this.onDragging);
  1996. window.addEventListener('mouseup', this.onDragEnd);
  1997. window.addEventListener('touchend', this.onDragEnd);
  1998. window.addEventListener('contextmenu', this.onDragEnd);
  1999. },
  2000. onLeftKeyDown: function onLeftKeyDown() {
  2001. if (this.disabled) return;
  2002. this.newPosition = parseFloat(this.currentPosition) - this.step / (this.max - this.min) * 100;
  2003. this.setPosition(this.newPosition);
  2004. this.$parent.emitChange();
  2005. },
  2006. onRightKeyDown: function onRightKeyDown() {
  2007. if (this.disabled) return;
  2008. this.newPosition = parseFloat(this.currentPosition) + this.step / (this.max - this.min) * 100;
  2009. this.setPosition(this.newPosition);
  2010. this.$parent.emitChange();
  2011. },
  2012. onDragStart: function onDragStart(event) {
  2013. this.dragging = true;
  2014. this.isClick = true;
  2015. if (event.type === 'touchstart') {
  2016. event.clientY = event.touches[0].clientY;
  2017. event.clientX = event.touches[0].clientX;
  2018. }
  2019. if (this.vertical) {
  2020. this.startY = event.clientY;
  2021. } else {
  2022. this.startX = event.clientX;
  2023. }
  2024. this.startPosition = parseFloat(this.currentPosition);
  2025. this.newPosition = this.startPosition;
  2026. },
  2027. onDragging: function onDragging(event) {
  2028. if (this.dragging) {
  2029. this.isClick = false;
  2030. this.displayTooltip();
  2031. this.$parent.resetSize();
  2032. var diff = 0;
  2033. if (event.type === 'touchmove') {
  2034. event.clientY = event.touches[0].clientY;
  2035. event.clientX = event.touches[0].clientX;
  2036. }
  2037. if (this.vertical) {
  2038. this.currentY = event.clientY;
  2039. diff = (this.startY - this.currentY) / this.$parent.sliderSize * 100;
  2040. } else {
  2041. this.currentX = event.clientX;
  2042. diff = (this.currentX - this.startX) / this.$parent.sliderSize * 100;
  2043. }
  2044. this.newPosition = this.startPosition + diff;
  2045. this.setPosition(this.newPosition);
  2046. }
  2047. },
  2048. onDragEnd: function onDragEnd() {
  2049. var _this = this;
  2050. if (this.dragging) {
  2051. /*
  2052. * 防止在 mouseup 后立即触发 click导致滑块有几率产生一小段位移
  2053. * 不使用 preventDefault 是因为 mouseup click 没有注册在同一个 DOM
  2054. */
  2055. setTimeout(function () {
  2056. _this.dragging = false;
  2057. _this.hideTooltip();
  2058. if (!_this.isClick) {
  2059. _this.setPosition(_this.newPosition);
  2060. _this.$parent.emitChange();
  2061. }
  2062. }, 0);
  2063. window.removeEventListener('mousemove', this.onDragging);
  2064. window.removeEventListener('touchmove', this.onDragging);
  2065. window.removeEventListener('mouseup', this.onDragEnd);
  2066. window.removeEventListener('touchend', this.onDragEnd);
  2067. window.removeEventListener('contextmenu', this.onDragEnd);
  2068. }
  2069. },
  2070. setPosition: function setPosition(newPosition) {
  2071. var _this2 = this;
  2072. if (newPosition === null || isNaN(newPosition)) return;
  2073. if (newPosition < 0) {
  2074. newPosition = 0;
  2075. } else if (newPosition > 100) {
  2076. newPosition = 100;
  2077. }
  2078. var lengthPerStep = 100 / ((this.max - this.min) / this.step);
  2079. var steps = Math.round(newPosition / lengthPerStep);
  2080. var value = steps * lengthPerStep * (this.max - this.min) * 0.01 + this.min;
  2081. value = parseFloat(value.toFixed(this.precision));
  2082. this.$emit('input', value);
  2083. this.$nextTick(function () {
  2084. _this2.displayTooltip();
  2085. _this2.$refs.tooltip && _this2.$refs.tooltip.updatePopper();
  2086. });
  2087. if (!this.dragging && this.value !== this.oldValue) {
  2088. this.oldValue = this.value;
  2089. }
  2090. }
  2091. }
  2092. });
  2093. // CONCATENATED MODULE: ./packages/slider/src/button.vue?vue&type=script&lang=js&
  2094. /* harmony default export */ var src_buttonvue_type_script_lang_js_ = (buttonvue_type_script_lang_js_);
  2095. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  2096. var componentNormalizer = __webpack_require__(2);
  2097. // CONCATENATED MODULE: ./packages/slider/src/button.vue
  2098. /* normalize component */
  2099. var component = Object(componentNormalizer["a" /* default */])(
  2100. src_buttonvue_type_script_lang_js_,
  2101. buttonvue_type_template_id_e72d2ad2_render,
  2102. buttonvue_type_template_id_e72d2ad2_staticRenderFns,
  2103. false,
  2104. null,
  2105. null,
  2106. null
  2107. )
  2108. /* hot reload */
  2109. if (false) { var api; }
  2110. component.options.__file = "packages/slider/src/button.vue"
  2111. /* harmony default export */ var src_button = (component.exports);
  2112. // CONCATENATED MODULE: ./packages/slider/src/marker.js
  2113. /* harmony default export */ var marker = ({
  2114. name: 'TisMarker',
  2115. props: {
  2116. mark: {
  2117. type: [String, Object]
  2118. }
  2119. },
  2120. render: function render() {
  2121. var h = arguments[0];
  2122. var label = typeof this.mark === 'string' ? this.mark : this.mark.label;
  2123. return h(
  2124. 'div',
  2125. { 'class': 'el-slider__marks-text', style: this.mark.style || {} },
  2126. [label]
  2127. );
  2128. }
  2129. });
  2130. // EXTERNAL MODULE: external "tis-ui/lib/mixins/emitter"
  2131. var emitter_ = __webpack_require__(13);
  2132. var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
  2133. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/slider/src/main.vue?vue&type=script&lang=js&
  2134. //
  2135. //
  2136. //
  2137. //
  2138. //
  2139. //
  2140. //
  2141. //
  2142. //
  2143. //
  2144. //
  2145. //
  2146. //
  2147. //
  2148. //
  2149. //
  2150. //
  2151. //
  2152. //
  2153. //
  2154. //
  2155. //
  2156. //
  2157. //
  2158. //
  2159. //
  2160. //
  2161. //
  2162. //
  2163. //
  2164. //
  2165. //
  2166. //
  2167. //
  2168. //
  2169. //
  2170. //
  2171. //
  2172. //
  2173. //
  2174. //
  2175. //
  2176. //
  2177. //
  2178. //
  2179. //
  2180. //
  2181. //
  2182. //
  2183. //
  2184. //
  2185. //
  2186. //
  2187. //
  2188. //
  2189. //
  2190. //
  2191. //
  2192. //
  2193. //
  2194. //
  2195. //
  2196. //
  2197. //
  2198. //
  2199. //
  2200. //
  2201. //
  2202. //
  2203. //
  2204. //
  2205. //
  2206. //
  2207. //
  2208. //
  2209. /* harmony default export */ var mainvue_type_script_lang_js_ = ({
  2210. name: 'TisSlider',
  2211. mixins: [emitter_default.a],
  2212. inject: {
  2213. elForm: {
  2214. default: ''
  2215. }
  2216. },
  2217. props: {
  2218. min: {
  2219. type: Number,
  2220. default: 0
  2221. },
  2222. max: {
  2223. type: Number,
  2224. default: 100
  2225. },
  2226. step: {
  2227. type: Number,
  2228. default: 1
  2229. },
  2230. value: {
  2231. type: [Number, Array],
  2232. default: 0
  2233. },
  2234. showInput: {
  2235. type: Boolean,
  2236. default: false
  2237. },
  2238. showInputControls: {
  2239. type: Boolean,
  2240. default: true
  2241. },
  2242. inputSize: {
  2243. type: String,
  2244. default: 'small'
  2245. },
  2246. showStops: {
  2247. type: Boolean,
  2248. default: false
  2249. },
  2250. showTooltip: {
  2251. type: Boolean,
  2252. default: true
  2253. },
  2254. formatTooltip: Function,
  2255. disabled: {
  2256. type: Boolean,
  2257. default: false
  2258. },
  2259. range: {
  2260. type: Boolean,
  2261. default: false
  2262. },
  2263. vertical: {
  2264. type: Boolean,
  2265. default: false
  2266. },
  2267. height: {
  2268. type: String
  2269. },
  2270. debounce: {
  2271. type: Number,
  2272. default: 300
  2273. },
  2274. label: {
  2275. type: String
  2276. },
  2277. tooltipClass: String,
  2278. marks: Object
  2279. },
  2280. components: {
  2281. ElInputNumber: input_number["default"],
  2282. SliderButton: src_button,
  2283. SliderMarker: marker
  2284. },
  2285. data: function data() {
  2286. return {
  2287. firstValue: null,
  2288. secondValue: null,
  2289. oldValue: null,
  2290. dragging: false,
  2291. sliderSize: 1
  2292. };
  2293. },
  2294. watch: {
  2295. value: function value(val, oldVal) {
  2296. if (this.dragging || Array.isArray(val) && Array.isArray(oldVal) && val.every(function (item, index) {
  2297. return item === oldVal[index];
  2298. })) {
  2299. return;
  2300. }
  2301. this.setValues();
  2302. },
  2303. dragging: function dragging(val) {
  2304. if (!val) {
  2305. this.setValues();
  2306. }
  2307. },
  2308. firstValue: function firstValue(val) {
  2309. if (this.range) {
  2310. this.$emit('input', [this.minValue, this.maxValue]);
  2311. } else {
  2312. this.$emit('input', val);
  2313. }
  2314. },
  2315. secondValue: function secondValue() {
  2316. if (this.range) {
  2317. this.$emit('input', [this.minValue, this.maxValue]);
  2318. }
  2319. },
  2320. min: function min() {
  2321. this.setValues();
  2322. },
  2323. max: function max() {
  2324. this.setValues();
  2325. }
  2326. },
  2327. methods: {
  2328. valueChanged: function valueChanged() {
  2329. var _this = this;
  2330. if (this.range) {
  2331. return ![this.minValue, this.maxValue].every(function (item, index) {
  2332. return item === _this.oldValue[index];
  2333. });
  2334. } else {
  2335. return this.value !== this.oldValue;
  2336. }
  2337. },
  2338. setValues: function setValues() {
  2339. if (this.min > this.max) {
  2340. console.error('[Element Error][Slider]min should not be greater than max.');
  2341. return;
  2342. }
  2343. var val = this.value;
  2344. if (this.range && Array.isArray(val)) {
  2345. if (val[1] < this.min) {
  2346. this.$emit('input', [this.min, this.min]);
  2347. } else if (val[0] > this.max) {
  2348. this.$emit('input', [this.max, this.max]);
  2349. } else if (val[0] < this.min) {
  2350. this.$emit('input', [this.min, val[1]]);
  2351. } else if (val[1] > this.max) {
  2352. this.$emit('input', [val[0], this.max]);
  2353. } else {
  2354. this.firstValue = val[0];
  2355. this.secondValue = val[1];
  2356. if (this.valueChanged()) {
  2357. this.dispatch('ElFormItem', 'el.form.change', [this.minValue, this.maxValue]);
  2358. this.oldValue = val.slice();
  2359. }
  2360. }
  2361. } else if (!this.range && typeof val === 'number' && !isNaN(val)) {
  2362. if (val < this.min) {
  2363. this.$emit('input', this.min);
  2364. } else if (val > this.max) {
  2365. this.$emit('input', this.max);
  2366. } else {
  2367. this.firstValue = val;
  2368. if (this.valueChanged()) {
  2369. this.dispatch('ElFormItem', 'el.form.change', val);
  2370. this.oldValue = val;
  2371. }
  2372. }
  2373. }
  2374. },
  2375. setPosition: function setPosition(percent) {
  2376. var targetValue = this.min + percent * (this.max - this.min) / 100;
  2377. if (!this.range) {
  2378. this.$refs.button1.setPosition(percent);
  2379. return;
  2380. }
  2381. var button = void 0;
  2382. if (Math.abs(this.minValue - targetValue) < Math.abs(this.maxValue - targetValue)) {
  2383. button = this.firstValue < this.secondValue ? 'button1' : 'button2';
  2384. } else {
  2385. button = this.firstValue > this.secondValue ? 'button1' : 'button2';
  2386. }
  2387. this.$refs[button].setPosition(percent);
  2388. },
  2389. onSliderClick: function onSliderClick(event) {
  2390. if (this.sliderDisabled || this.dragging) return;
  2391. this.resetSize();
  2392. if (this.vertical) {
  2393. var sliderOffsetBottom = this.$refs.slider.getBoundingClientRect().bottom;
  2394. this.setPosition((sliderOffsetBottom - event.clientY) / this.sliderSize * 100);
  2395. } else {
  2396. var sliderOffsetLeft = this.$refs.slider.getBoundingClientRect().left;
  2397. this.setPosition((event.clientX - sliderOffsetLeft) / this.sliderSize * 100);
  2398. }
  2399. this.emitChange();
  2400. },
  2401. resetSize: function resetSize() {
  2402. if (this.$refs.slider) {
  2403. this.sliderSize = this.$refs.slider['client' + (this.vertical ? 'Height' : 'Width')];
  2404. }
  2405. },
  2406. emitChange: function emitChange() {
  2407. var _this2 = this;
  2408. this.$nextTick(function () {
  2409. _this2.$emit('change', _this2.range ? [_this2.minValue, _this2.maxValue] : _this2.value);
  2410. });
  2411. },
  2412. getStopStyle: function getStopStyle(position) {
  2413. return this.vertical ? { 'bottom': position + '%' } : { 'left': position + '%' };
  2414. }
  2415. },
  2416. computed: {
  2417. stops: function stops() {
  2418. var _this3 = this;
  2419. if (!this.showStops || this.min > this.max) return [];
  2420. if (this.step === 0) {
  2421. false && false;
  2422. return [];
  2423. }
  2424. var stopCount = (this.max - this.min) / this.step;
  2425. var stepWidth = 100 * this.step / (this.max - this.min);
  2426. var result = [];
  2427. for (var i = 1; i < stopCount; i++) {
  2428. result.push(i * stepWidth);
  2429. }
  2430. if (this.range) {
  2431. return result.filter(function (step) {
  2432. return step < 100 * (_this3.minValue - _this3.min) / (_this3.max - _this3.min) || step > 100 * (_this3.maxValue - _this3.min) / (_this3.max - _this3.min);
  2433. });
  2434. } else {
  2435. return result.filter(function (step) {
  2436. return step > 100 * (_this3.firstValue - _this3.min) / (_this3.max - _this3.min);
  2437. });
  2438. }
  2439. },
  2440. markList: function markList() {
  2441. var _this4 = this;
  2442. if (!this.marks) {
  2443. return [];
  2444. }
  2445. var marksKeys = Object.keys(this.marks);
  2446. return marksKeys.map(parseFloat).sort(function (a, b) {
  2447. return a - b;
  2448. }).filter(function (point) {
  2449. return point <= _this4.max && point >= _this4.min;
  2450. }).map(function (point) {
  2451. return {
  2452. point: point,
  2453. position: (point - _this4.min) * 100 / (_this4.max - _this4.min),
  2454. mark: _this4.marks[point]
  2455. };
  2456. });
  2457. },
  2458. minValue: function minValue() {
  2459. return Math.min(this.firstValue, this.secondValue);
  2460. },
  2461. maxValue: function maxValue() {
  2462. return Math.max(this.firstValue, this.secondValue);
  2463. },
  2464. barSize: function barSize() {
  2465. return this.range ? 100 * (this.maxValue - this.minValue) / (this.max - this.min) + '%' : 100 * (this.firstValue - this.min) / (this.max - this.min) + '%';
  2466. },
  2467. barStart: function barStart() {
  2468. return this.range ? 100 * (this.minValue - this.min) / (this.max - this.min) + '%' : '0%';
  2469. },
  2470. precision: function precision() {
  2471. var precisions = [this.min, this.max, this.step].map(function (item) {
  2472. var decimal = ('' + item).split('.')[1];
  2473. return decimal ? decimal.length : 0;
  2474. });
  2475. return Math.max.apply(null, precisions);
  2476. },
  2477. runwayStyle: function runwayStyle() {
  2478. return this.vertical ? { height: this.height } : {};
  2479. },
  2480. barStyle: function barStyle() {
  2481. return this.vertical ? {
  2482. height: this.barSize,
  2483. bottom: this.barStart
  2484. } : {
  2485. width: this.barSize,
  2486. left: this.barStart
  2487. };
  2488. },
  2489. sliderDisabled: function sliderDisabled() {
  2490. return this.disabled || (this.elForm || {}).disabled;
  2491. }
  2492. },
  2493. mounted: function mounted() {
  2494. var valuetext = void 0;
  2495. if (this.range) {
  2496. if (Array.isArray(this.value)) {
  2497. this.firstValue = Math.max(this.min, this.value[0]);
  2498. this.secondValue = Math.min(this.max, this.value[1]);
  2499. } else {
  2500. this.firstValue = this.min;
  2501. this.secondValue = this.max;
  2502. }
  2503. this.oldValue = [this.firstValue, this.secondValue];
  2504. valuetext = this.firstValue + '-' + this.secondValue;
  2505. } else {
  2506. if (typeof this.value !== 'number' || isNaN(this.value)) {
  2507. this.firstValue = this.min;
  2508. } else {
  2509. this.firstValue = Math.min(this.max, Math.max(this.min, this.value));
  2510. }
  2511. this.oldValue = this.firstValue;
  2512. valuetext = this.firstValue;
  2513. }
  2514. this.$el.setAttribute('aria-valuetext', valuetext);
  2515. // label screen reader
  2516. this.$el.setAttribute('aria-label', this.label ? this.label : 'slider between ' + this.min + ' and ' + this.max);
  2517. this.resetSize();
  2518. window.addEventListener('resize', this.resetSize);
  2519. },
  2520. beforeDestroy: function beforeDestroy() {
  2521. window.removeEventListener('resize', this.resetSize);
  2522. }
  2523. });
  2524. // CONCATENATED MODULE: ./packages/slider/src/main.vue?vue&type=script&lang=js&
  2525. /* harmony default export */ var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_);
  2526. // CONCATENATED MODULE: ./packages/slider/src/main.vue
  2527. /* normalize component */
  2528. var main_component = Object(componentNormalizer["a" /* default */])(
  2529. src_mainvue_type_script_lang_js_,
  2530. render,
  2531. staticRenderFns,
  2532. false,
  2533. null,
  2534. null,
  2535. null
  2536. )
  2537. /* hot reload */
  2538. if (false) { var main_api; }
  2539. main_component.options.__file = "packages/slider/src/main.vue"
  2540. /* harmony default export */ var main = (main_component.exports);
  2541. // CONCATENATED MODULE: ./packages/slider/index.js
  2542. /* istanbul ignore next */
  2543. main.install = function (Vue) {
  2544. Vue.component(main.name, main);
  2545. };
  2546. /* harmony default export */ var slider = __webpack_exports__["default"] = (main);
  2547. /***/ }),
  2548. /***/ 62:
  2549. /***/ (function(module, exports) {
  2550. module.exports = require("throttle-debounce/debounce");
  2551. /***/ }),
  2552. /***/ 7:
  2553. /***/ (function(module, exports) {
  2554. module.exports = require("tis-ui/lib/utils/dom");
  2555. /***/ }),
  2556. /***/ 88:
  2557. /***/ (function(module, exports) {
  2558. module.exports = require("tis-ui/lib/mixins/focus");
  2559. /***/ }),
  2560. /***/ 99:
  2561. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2562. "use strict";
  2563. /* harmony import */ var tis_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7);
  2564. /* harmony import */ var tis_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(tis_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__);
  2565. /* harmony default export */ __webpack_exports__["a"] = ({
  2566. bind: function bind(el, binding, vnode) {
  2567. var interval = null;
  2568. var startTime = void 0;
  2569. var handler = function handler() {
  2570. return vnode.context[binding.expression].apply();
  2571. };
  2572. var clear = function clear() {
  2573. if (Date.now() - startTime < 100) {
  2574. handler();
  2575. }
  2576. clearInterval(interval);
  2577. interval = null;
  2578. };
  2579. Object(tis_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__["on"])(el, 'mousedown', function (e) {
  2580. if (e.button !== 0) return;
  2581. startTime = Date.now();
  2582. Object(tis_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__["once"])(document, 'mouseup', clear);
  2583. clearInterval(interval);
  2584. interval = setInterval(handler, 100);
  2585. });
  2586. }
  2587. });
  2588. /***/ })
  2589. /******/ });