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.

2052 lines
55 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 = 524);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ 10:
  90. /***/ (function(module, exports) {
  91. module.exports = require("tis-ui/lib/utils/util");
  92. /***/ }),
  93. /***/ 13:
  94. /***/ (function(module, exports) {
  95. module.exports = require("tis-ui/lib/mixins/emitter");
  96. /***/ }),
  97. /***/ 2:
  98. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  99. "use strict";
  100. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
  101. /* globals __VUE_SSR_CONTEXT__ */
  102. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  103. // This module is a runtime utility for cleaner component module output and will
  104. // be included in the final webpack user bundle.
  105. function normalizeComponent (
  106. scriptExports,
  107. render,
  108. staticRenderFns,
  109. functionalTemplate,
  110. injectStyles,
  111. scopeId,
  112. moduleIdentifier, /* server only */
  113. shadowMode /* vue-cli only */
  114. ) {
  115. // Vue.extend constructor export interop
  116. var options = typeof scriptExports === 'function'
  117. ? scriptExports.options
  118. : scriptExports
  119. // render functions
  120. if (render) {
  121. options.render = render
  122. options.staticRenderFns = staticRenderFns
  123. options._compiled = true
  124. }
  125. // functional template
  126. if (functionalTemplate) {
  127. options.functional = true
  128. }
  129. // scopedId
  130. if (scopeId) {
  131. options._scopeId = 'data-v-' + scopeId
  132. }
  133. var hook
  134. if (moduleIdentifier) { // server build
  135. hook = function (context) {
  136. // 2.3 injection
  137. context =
  138. context || // cached call
  139. (this.$vnode && this.$vnode.ssrContext) || // stateful
  140. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  141. // 2.2 with runInNewContext: true
  142. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  143. context = __VUE_SSR_CONTEXT__
  144. }
  145. // inject component styles
  146. if (injectStyles) {
  147. injectStyles.call(this, context)
  148. }
  149. // register component module identifier for async chunk inferrence
  150. if (context && context._registeredComponents) {
  151. context._registeredComponents.add(moduleIdentifier)
  152. }
  153. }
  154. // used by ssr in case component is cached and beforeCreate
  155. // never gets called
  156. options._ssrRegister = hook
  157. } else if (injectStyles) {
  158. hook = shadowMode
  159. ? function () {
  160. injectStyles.call(
  161. this,
  162. (options.functional ? this.parent : this).$root.$options.shadowRoot
  163. )
  164. }
  165. : injectStyles
  166. }
  167. if (hook) {
  168. if (options.functional) {
  169. // for template-only hot-reload because in that case the render fn doesn't
  170. // go through the normalizer
  171. options._injectStyles = hook
  172. // register for functional component in vue file
  173. var originalRender = options.render
  174. options.render = function renderWithStyleInjection (h, context) {
  175. hook.call(context)
  176. return originalRender(h, context)
  177. }
  178. } else {
  179. // inject component registration as beforeCreate hook
  180. var existing = options.beforeCreate
  181. options.beforeCreate = existing
  182. ? [].concat(existing, hook)
  183. : [hook]
  184. }
  185. }
  186. return {
  187. exports: scriptExports,
  188. options: options
  189. }
  190. }
  191. /***/ }),
  192. /***/ 33:
  193. /***/ (function(module, exports) {
  194. module.exports = require("tis-ui/lib/utils/merge");
  195. /***/ }),
  196. /***/ 34:
  197. /***/ (function(module, exports) {
  198. module.exports = require("tis-ui/lib/utils/vue-popper");
  199. /***/ }),
  200. /***/ 36:
  201. /***/ (function(module, exports) {
  202. module.exports = require("tis-ui/lib/mixins/migrating");
  203. /***/ }),
  204. /***/ 44:
  205. /***/ (function(module, exports) {
  206. module.exports = require("tis-ui/lib/utils/resize-event");
  207. /***/ }),
  208. /***/ 49:
  209. /***/ (function(module, exports) {
  210. module.exports = require("tis-ui/lib/utils/shared");
  211. /***/ }),
  212. /***/ 52:
  213. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  214. "use strict";
  215. // ESM COMPAT FLAG
  216. __webpack_require__.r(__webpack_exports__);
  217. // 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&
  218. var render = function() {
  219. var _vm = this
  220. var _h = _vm.$createElement
  221. var _c = _vm._self._c || _h
  222. return _c(
  223. "div",
  224. {
  225. class: [
  226. _vm.type === "textarea" ? "el-textarea" : "el-input",
  227. _vm.inputSize ? "el-input--" + _vm.inputSize : "",
  228. {
  229. "is-disabled": _vm.inputDisabled,
  230. "is-exceed": _vm.inputExceed,
  231. "el-input-group": _vm.$slots.prepend || _vm.$slots.append,
  232. "el-input-group--append": _vm.$slots.append,
  233. "el-input-group--prepend": _vm.$slots.prepend,
  234. "el-input--prefix": _vm.$slots.prefix || _vm.prefixIcon,
  235. "el-input--suffix":
  236. _vm.$slots.suffix ||
  237. _vm.suffixIcon ||
  238. _vm.clearable ||
  239. _vm.showPassword
  240. }
  241. ],
  242. on: {
  243. mouseenter: function($event) {
  244. _vm.hovering = true
  245. },
  246. mouseleave: function($event) {
  247. _vm.hovering = false
  248. }
  249. }
  250. },
  251. [
  252. _vm.type !== "textarea"
  253. ? [
  254. _vm.$slots.prepend
  255. ? _c(
  256. "div",
  257. { staticClass: "el-input-group__prepend" },
  258. [_vm._t("prepend")],
  259. 2
  260. )
  261. : _vm._e(),
  262. _vm.type !== "textarea"
  263. ? _c(
  264. "input",
  265. _vm._b(
  266. {
  267. ref: "input",
  268. staticClass: "el-input__inner",
  269. attrs: {
  270. tabindex: _vm.tabindex,
  271. type: _vm.showPassword
  272. ? _vm.passwordVisible
  273. ? "text"
  274. : "password"
  275. : _vm.type,
  276. disabled: _vm.inputDisabled,
  277. readonly: _vm.readonly,
  278. autocomplete: _vm.autoComplete || _vm.autocomplete,
  279. "aria-label": _vm.label
  280. },
  281. on: {
  282. compositionstart: _vm.handleCompositionStart,
  283. compositionupdate: _vm.handleCompositionUpdate,
  284. compositionend: _vm.handleCompositionEnd,
  285. input: _vm.handleInput,
  286. focus: _vm.handleFocus,
  287. blur: _vm.handleBlur,
  288. change: _vm.handleChange
  289. }
  290. },
  291. "input",
  292. _vm.$attrs,
  293. false
  294. )
  295. )
  296. : _vm._e(),
  297. _vm.$slots.prefix || _vm.prefixIcon
  298. ? _c(
  299. "span",
  300. { staticClass: "el-input__prefix" },
  301. [
  302. _vm._t("prefix"),
  303. _vm.prefixIcon
  304. ? _c("i", {
  305. staticClass: "el-input__icon",
  306. class: _vm.prefixIcon
  307. })
  308. : _vm._e()
  309. ],
  310. 2
  311. )
  312. : _vm._e(),
  313. _vm.getSuffixVisible()
  314. ? _c("span", { staticClass: "el-input__suffix" }, [
  315. _c(
  316. "span",
  317. { staticClass: "el-input__suffix-inner" },
  318. [
  319. !_vm.showClear ||
  320. !_vm.showPwdVisible ||
  321. !_vm.isWordLimitVisible
  322. ? [
  323. _vm._t("suffix"),
  324. _vm.suffixIcon
  325. ? _c("i", {
  326. staticClass: "el-input__icon",
  327. class: _vm.suffixIcon
  328. })
  329. : _vm._e()
  330. ]
  331. : _vm._e(),
  332. _vm.showClear
  333. ? _c("i", {
  334. staticClass:
  335. "el-input__icon el-icon-circle-close el-input__clear",
  336. on: {
  337. mousedown: function($event) {
  338. $event.preventDefault()
  339. },
  340. click: _vm.clear
  341. }
  342. })
  343. : _vm._e(),
  344. _vm.showPwdVisible
  345. ? _c("i", {
  346. staticClass:
  347. "el-input__icon el-icon-view el-input__clear",
  348. on: { click: _vm.handlePasswordVisible }
  349. })
  350. : _vm._e(),
  351. _vm.isWordLimitVisible
  352. ? _c("span", { staticClass: "el-input__count" }, [
  353. _c(
  354. "span",
  355. { staticClass: "el-input__count-inner" },
  356. [
  357. _vm._v(
  358. "\n " +
  359. _vm._s(_vm.textLength) +
  360. "/" +
  361. _vm._s(_vm.upperLimit) +
  362. "\n "
  363. )
  364. ]
  365. )
  366. ])
  367. : _vm._e()
  368. ],
  369. 2
  370. ),
  371. _vm.validateState
  372. ? _c("i", {
  373. staticClass: "el-input__icon",
  374. class: ["el-input__validateIcon", _vm.validateIcon]
  375. })
  376. : _vm._e()
  377. ])
  378. : _vm._e(),
  379. _vm.$slots.append
  380. ? _c(
  381. "div",
  382. { staticClass: "el-input-group__append" },
  383. [_vm._t("append")],
  384. 2
  385. )
  386. : _vm._e()
  387. ]
  388. : _c(
  389. "textarea",
  390. _vm._b(
  391. {
  392. ref: "textarea",
  393. staticClass: "el-textarea__inner",
  394. style: _vm.textareaStyle,
  395. attrs: {
  396. tabindex: _vm.tabindex,
  397. disabled: _vm.inputDisabled,
  398. readonly: _vm.readonly,
  399. autocomplete: _vm.autoComplete || _vm.autocomplete,
  400. "aria-label": _vm.label
  401. },
  402. on: {
  403. compositionstart: _vm.handleCompositionStart,
  404. compositionupdate: _vm.handleCompositionUpdate,
  405. compositionend: _vm.handleCompositionEnd,
  406. input: _vm.handleInput,
  407. focus: _vm.handleFocus,
  408. blur: _vm.handleBlur,
  409. change: _vm.handleChange
  410. }
  411. },
  412. "textarea",
  413. _vm.$attrs,
  414. false
  415. )
  416. ),
  417. _vm.isWordLimitVisible && _vm.type === "textarea"
  418. ? _c("span", { staticClass: "el-input__count" }, [
  419. _vm._v(_vm._s(_vm.textLength) + "/" + _vm._s(_vm.upperLimit))
  420. ])
  421. : _vm._e()
  422. ],
  423. 2
  424. )
  425. }
  426. var staticRenderFns = []
  427. render._withStripped = true
  428. // CONCATENATED MODULE: ./packages/input/src/input.vue?vue&type=template&id=343dd774&
  429. // EXTERNAL MODULE: external "tis-ui/lib/mixins/emitter"
  430. var emitter_ = __webpack_require__(13);
  431. var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
  432. // EXTERNAL MODULE: external "tis-ui/lib/mixins/migrating"
  433. var migrating_ = __webpack_require__(36);
  434. var migrating_default = /*#__PURE__*/__webpack_require__.n(migrating_);
  435. // CONCATENATED MODULE: ./packages/input/src/calcTextareaHeight.js
  436. var hiddenTextarea = void 0;
  437. 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';
  438. 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'];
  439. function calculateNodeStyling(targetElement) {
  440. var style = window.getComputedStyle(targetElement);
  441. var boxSizing = style.getPropertyValue('box-sizing');
  442. var paddingSize = parseFloat(style.getPropertyValue('padding-bottom')) + parseFloat(style.getPropertyValue('padding-top'));
  443. var borderSize = parseFloat(style.getPropertyValue('border-bottom-width')) + parseFloat(style.getPropertyValue('border-top-width'));
  444. var contextStyle = CONTEXT_STYLE.map(function (name) {
  445. return name + ':' + style.getPropertyValue(name);
  446. }).join(';');
  447. return { contextStyle: contextStyle, paddingSize: paddingSize, borderSize: borderSize, boxSizing: boxSizing };
  448. }
  449. function calcTextareaHeight(targetElement) {
  450. var minRows = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
  451. var maxRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  452. if (!hiddenTextarea) {
  453. hiddenTextarea = document.createElement('textarea');
  454. document.body.appendChild(hiddenTextarea);
  455. }
  456. var _calculateNodeStyling = calculateNodeStyling(targetElement),
  457. paddingSize = _calculateNodeStyling.paddingSize,
  458. borderSize = _calculateNodeStyling.borderSize,
  459. boxSizing = _calculateNodeStyling.boxSizing,
  460. contextStyle = _calculateNodeStyling.contextStyle;
  461. hiddenTextarea.setAttribute('style', contextStyle + ';' + HIDDEN_STYLE);
  462. hiddenTextarea.value = targetElement.value || targetElement.placeholder || '';
  463. var height = hiddenTextarea.scrollHeight;
  464. var result = {};
  465. if (boxSizing === 'border-box') {
  466. height = height + borderSize;
  467. } else if (boxSizing === 'content-box') {
  468. height = height - paddingSize;
  469. }
  470. hiddenTextarea.value = '';
  471. var singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  472. if (minRows !== null) {
  473. var minHeight = singleRowHeight * minRows;
  474. if (boxSizing === 'border-box') {
  475. minHeight = minHeight + paddingSize + borderSize;
  476. }
  477. height = Math.max(minHeight, height);
  478. result.minHeight = minHeight + 'px';
  479. }
  480. if (maxRows !== null) {
  481. var maxHeight = singleRowHeight * maxRows;
  482. if (boxSizing === 'border-box') {
  483. maxHeight = maxHeight + paddingSize + borderSize;
  484. }
  485. height = Math.min(maxHeight, height);
  486. }
  487. result.height = height + 'px';
  488. hiddenTextarea.parentNode && hiddenTextarea.parentNode.removeChild(hiddenTextarea);
  489. hiddenTextarea = null;
  490. return result;
  491. };
  492. // EXTERNAL MODULE: external "tis-ui/lib/utils/merge"
  493. var merge_ = __webpack_require__(33);
  494. var merge_default = /*#__PURE__*/__webpack_require__.n(merge_);
  495. // EXTERNAL MODULE: external "tis-ui/lib/utils/shared"
  496. var shared_ = __webpack_require__(49);
  497. // 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&
  498. //
  499. //
  500. //
  501. //
  502. //
  503. //
  504. //
  505. //
  506. //
  507. //
  508. //
  509. //
  510. //
  511. //
  512. //
  513. //
  514. //
  515. //
  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. //
  564. //
  565. //
  566. //
  567. //
  568. //
  569. //
  570. //
  571. //
  572. //
  573. //
  574. //
  575. //
  576. //
  577. //
  578. //
  579. //
  580. //
  581. //
  582. //
  583. //
  584. //
  585. //
  586. //
  587. //
  588. //
  589. //
  590. //
  591. //
  592. //
  593. //
  594. //
  595. //
  596. //
  597. //
  598. //
  599. //
  600. //
  601. //
  602. //
  603. //
  604. //
  605. //
  606. //
  607. /* harmony default export */ var inputvue_type_script_lang_js_ = ({
  608. name: 'TisInput',
  609. componentName: 'TisInput',
  610. mixins: [emitter_default.a, migrating_default.a],
  611. inheritAttrs: false,
  612. inject: {
  613. elForm: {
  614. default: ''
  615. },
  616. elFormItem: {
  617. default: ''
  618. }
  619. },
  620. data: function data() {
  621. return {
  622. textareaCalcStyle: {},
  623. hovering: false,
  624. focused: false,
  625. isComposing: false,
  626. passwordVisible: false
  627. };
  628. },
  629. props: {
  630. value: [String, Number],
  631. size: String,
  632. resize: String,
  633. form: String,
  634. disabled: Boolean,
  635. readonly: Boolean,
  636. type: {
  637. type: String,
  638. default: 'text'
  639. },
  640. autosize: {
  641. type: [Boolean, Object],
  642. default: false
  643. },
  644. autocomplete: {
  645. type: String,
  646. default: 'off'
  647. },
  648. /** @Deprecated in next major version */
  649. autoComplete: {
  650. type: String,
  651. validator: function validator(val) {
  652. false && false;
  653. return true;
  654. }
  655. },
  656. validateEvent: {
  657. type: Boolean,
  658. default: true
  659. },
  660. suffixIcon: String,
  661. prefixIcon: String,
  662. label: String,
  663. clearable: {
  664. type: Boolean,
  665. default: false
  666. },
  667. showPassword: {
  668. type: Boolean,
  669. default: false
  670. },
  671. showWordLimit: {
  672. type: Boolean,
  673. default: false
  674. },
  675. tabindex: String
  676. },
  677. computed: {
  678. _elFormItemSize: function _elFormItemSize() {
  679. return (this.elFormItem || {}).elFormItemSize;
  680. },
  681. validateState: function validateState() {
  682. return this.elFormItem ? this.elFormItem.validateState : '';
  683. },
  684. needStatusIcon: function needStatusIcon() {
  685. return this.elForm ? this.elForm.statusIcon : false;
  686. },
  687. validateIcon: function validateIcon() {
  688. return {
  689. validating: 'el-icon-loading',
  690. success: 'el-icon-circle-check',
  691. error: 'el-icon-circle-close'
  692. }[this.validateState];
  693. },
  694. textareaStyle: function textareaStyle() {
  695. return merge_default()({}, this.textareaCalcStyle, { resize: this.resize });
  696. },
  697. inputSize: function inputSize() {
  698. return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
  699. },
  700. inputDisabled: function inputDisabled() {
  701. return this.disabled || (this.elForm || {}).disabled;
  702. },
  703. nativeInputValue: function nativeInputValue() {
  704. return this.value === null || this.value === undefined ? '' : String(this.value);
  705. },
  706. showClear: function showClear() {
  707. return this.clearable && !this.inputDisabled && !this.readonly && this.nativeInputValue && (this.focused || this.hovering);
  708. },
  709. showPwdVisible: function showPwdVisible() {
  710. return this.showPassword && !this.inputDisabled && !this.readonly && (!!this.nativeInputValue || this.focused);
  711. },
  712. isWordLimitVisible: function isWordLimitVisible() {
  713. return this.showWordLimit && this.$attrs.maxlength && (this.type === 'text' || this.type === 'textarea') && !this.inputDisabled && !this.readonly && !this.showPassword;
  714. },
  715. upperLimit: function upperLimit() {
  716. return this.$attrs.maxlength;
  717. },
  718. textLength: function textLength() {
  719. if (typeof this.value === 'number') {
  720. return String(this.value).length;
  721. }
  722. return (this.value || '').length;
  723. },
  724. inputExceed: function inputExceed() {
  725. // show exceed style if length of initial value greater then maxlength
  726. return this.isWordLimitVisible && this.textLength > this.upperLimit;
  727. }
  728. },
  729. watch: {
  730. value: function value(val) {
  731. this.$nextTick(this.resizeTextarea);
  732. if (this.validateEvent) {
  733. this.dispatch('ElFormItem', 'el.form.change', [val]);
  734. }
  735. },
  736. // native input value is set explicitly
  737. // do not use v-model / :value in template
  738. // see: https://github.com/ElemeFE/element/issues/14521
  739. nativeInputValue: function nativeInputValue() {
  740. this.setNativeInputValue();
  741. },
  742. // when change between <input> and <textarea>,
  743. // update DOM dependent value and styles
  744. // https://github.com/ElemeFE/element/issues/14857
  745. type: function type() {
  746. var _this = this;
  747. this.$nextTick(function () {
  748. _this.setNativeInputValue();
  749. _this.resizeTextarea();
  750. _this.updateIconOffset();
  751. });
  752. }
  753. },
  754. methods: {
  755. focus: function focus() {
  756. this.getInput().focus();
  757. },
  758. blur: function blur() {
  759. this.getInput().blur();
  760. },
  761. getMigratingConfig: function getMigratingConfig() {
  762. return {
  763. props: {
  764. 'icon': 'icon is removed, use suffix-icon / prefix-icon instead.',
  765. 'on-icon-click': 'on-icon-click is removed.'
  766. },
  767. events: {
  768. 'click': 'click is removed.'
  769. }
  770. };
  771. },
  772. handleBlur: function handleBlur(event) {
  773. this.focused = false;
  774. this.$emit('blur', event);
  775. if (this.validateEvent) {
  776. this.dispatch('ElFormItem', 'el.form.blur', [this.value]);
  777. }
  778. },
  779. select: function select() {
  780. this.getInput().select();
  781. },
  782. resizeTextarea: function resizeTextarea() {
  783. if (this.$isServer) return;
  784. var autosize = this.autosize,
  785. type = this.type;
  786. if (type !== 'textarea') return;
  787. if (!autosize) {
  788. this.textareaCalcStyle = {
  789. minHeight: calcTextareaHeight(this.$refs.textarea).minHeight
  790. };
  791. return;
  792. }
  793. var minRows = autosize.minRows;
  794. var maxRows = autosize.maxRows;
  795. this.textareaCalcStyle = calcTextareaHeight(this.$refs.textarea, minRows, maxRows);
  796. },
  797. setNativeInputValue: function setNativeInputValue() {
  798. var input = this.getInput();
  799. if (!input) return;
  800. if (input.value === this.nativeInputValue) return;
  801. input.value = this.nativeInputValue;
  802. },
  803. handleFocus: function handleFocus(event) {
  804. this.focused = true;
  805. this.$emit('focus', event);
  806. },
  807. handleCompositionStart: function handleCompositionStart() {
  808. this.isComposing = true;
  809. },
  810. handleCompositionUpdate: function handleCompositionUpdate(event) {
  811. var text = event.target.value;
  812. var lastCharacter = text[text.length - 1] || '';
  813. this.isComposing = !Object(shared_["isKorean"])(lastCharacter);
  814. },
  815. handleCompositionEnd: function handleCompositionEnd(event) {
  816. if (this.isComposing) {
  817. this.isComposing = false;
  818. this.handleInput(event);
  819. }
  820. },
  821. handleInput: function handleInput(event) {
  822. // should not emit input during composition
  823. // see: https://github.com/ElemeFE/element/issues/10516
  824. if (this.isComposing) return;
  825. // hack for https://github.com/ElemeFE/element/issues/8548
  826. // should remove the following line when we don't support IE
  827. if (event.target.value === this.nativeInputValue) return;
  828. this.$emit('input', event.target.value);
  829. // ensure native input value is controlled
  830. // see: https://github.com/ElemeFE/element/issues/12850
  831. this.$nextTick(this.setNativeInputValue);
  832. },
  833. handleChange: function handleChange(event) {
  834. this.$emit('change', event.target.value);
  835. },
  836. calcIconOffset: function calcIconOffset(place) {
  837. var elList = [].slice.call(this.$el.querySelectorAll('.el-input__' + place) || []);
  838. if (!elList.length) return;
  839. var el = null;
  840. for (var i = 0; i < elList.length; i++) {
  841. if (elList[i].parentNode === this.$el) {
  842. el = elList[i];
  843. break;
  844. }
  845. }
  846. if (!el) return;
  847. var pendantMap = {
  848. suffix: 'append',
  849. prefix: 'prepend'
  850. };
  851. var pendant = pendantMap[place];
  852. if (this.$slots[pendant]) {
  853. el.style.transform = 'translateX(' + (place === 'suffix' ? '-' : '') + this.$el.querySelector('.el-input-group__' + pendant).offsetWidth + 'px)';
  854. } else {
  855. el.removeAttribute('style');
  856. }
  857. },
  858. updateIconOffset: function updateIconOffset() {
  859. this.calcIconOffset('prefix');
  860. this.calcIconOffset('suffix');
  861. },
  862. clear: function clear() {
  863. this.$emit('input', '');
  864. this.$emit('change', '');
  865. this.$emit('clear');
  866. },
  867. handlePasswordVisible: function handlePasswordVisible() {
  868. this.passwordVisible = !this.passwordVisible;
  869. this.focus();
  870. },
  871. getInput: function getInput() {
  872. return this.$refs.input || this.$refs.textarea;
  873. },
  874. getSuffixVisible: function getSuffixVisible() {
  875. return this.$slots.suffix || this.suffixIcon || this.showClear || this.showPassword || this.isWordLimitVisible || this.validateState && this.needStatusIcon;
  876. }
  877. },
  878. created: function created() {
  879. this.$on('inputSelect', this.select);
  880. },
  881. mounted: function mounted() {
  882. this.setNativeInputValue();
  883. this.resizeTextarea();
  884. this.updateIconOffset();
  885. },
  886. updated: function updated() {
  887. this.$nextTick(this.updateIconOffset);
  888. }
  889. });
  890. // CONCATENATED MODULE: ./packages/input/src/input.vue?vue&type=script&lang=js&
  891. /* harmony default export */ var src_inputvue_type_script_lang_js_ = (inputvue_type_script_lang_js_);
  892. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  893. var componentNormalizer = __webpack_require__(2);
  894. // CONCATENATED MODULE: ./packages/input/src/input.vue
  895. /* normalize component */
  896. var component = Object(componentNormalizer["a" /* default */])(
  897. src_inputvue_type_script_lang_js_,
  898. render,
  899. staticRenderFns,
  900. false,
  901. null,
  902. null,
  903. null
  904. )
  905. /* hot reload */
  906. if (false) { var api; }
  907. component.options.__file = "packages/input/src/input.vue"
  908. /* harmony default export */ var input = (component.exports);
  909. // CONCATENATED MODULE: ./packages/input/index.js
  910. /* istanbul ignore next */
  911. input.install = function (Vue) {
  912. Vue.component(input.name, input);
  913. };
  914. /* harmony default export */ var packages_input = __webpack_exports__["default"] = (input);
  915. /***/ }),
  916. /***/ 524:
  917. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  918. "use strict";
  919. // ESM COMPAT FLAG
  920. __webpack_require__.r(__webpack_exports__);
  921. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/autocomplete/src/autocomplete.vue?vue&type=template&id=152f2ee6&
  922. var render = function() {
  923. var _vm = this
  924. var _h = _vm.$createElement
  925. var _c = _vm._self._c || _h
  926. return _c(
  927. "div",
  928. {
  929. directives: [
  930. {
  931. name: "clickoutside",
  932. rawName: "v-clickoutside",
  933. value: _vm.close,
  934. expression: "close"
  935. }
  936. ],
  937. staticClass: "el-autocomplete",
  938. attrs: {
  939. "aria-haspopup": "listbox",
  940. role: "combobox",
  941. "aria-expanded": _vm.suggestionVisible,
  942. "aria-owns": _vm.id
  943. }
  944. },
  945. [
  946. _c(
  947. "tis-input",
  948. _vm._b(
  949. {
  950. ref: "input",
  951. on: {
  952. input: _vm.handleInput,
  953. change: _vm.handleChange,
  954. focus: _vm.handleFocus,
  955. blur: _vm.handleBlur,
  956. clear: _vm.handleClear
  957. },
  958. nativeOn: {
  959. keydown: [
  960. function($event) {
  961. if (
  962. !("button" in $event) &&
  963. _vm._k($event.keyCode, "up", 38, $event.key, [
  964. "Up",
  965. "ArrowUp"
  966. ])
  967. ) {
  968. return null
  969. }
  970. $event.preventDefault()
  971. _vm.highlight(_vm.highlightedIndex - 1)
  972. },
  973. function($event) {
  974. if (
  975. !("button" in $event) &&
  976. _vm._k($event.keyCode, "down", 40, $event.key, [
  977. "Down",
  978. "ArrowDown"
  979. ])
  980. ) {
  981. return null
  982. }
  983. $event.preventDefault()
  984. _vm.highlight(_vm.highlightedIndex + 1)
  985. },
  986. function($event) {
  987. if (
  988. !("button" in $event) &&
  989. _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")
  990. ) {
  991. return null
  992. }
  993. return _vm.handleKeyEnter($event)
  994. },
  995. function($event) {
  996. if (
  997. !("button" in $event) &&
  998. _vm._k($event.keyCode, "tab", 9, $event.key, "Tab")
  999. ) {
  1000. return null
  1001. }
  1002. return _vm.close($event)
  1003. }
  1004. ]
  1005. }
  1006. },
  1007. "tis-input",
  1008. [_vm.$props, _vm.$attrs],
  1009. false
  1010. ),
  1011. [
  1012. _vm.$slots.prepend
  1013. ? _c("template", { slot: "prepend" }, [_vm._t("prepend")], 2)
  1014. : _vm._e(),
  1015. _vm.$slots.append
  1016. ? _c("template", { slot: "append" }, [_vm._t("append")], 2)
  1017. : _vm._e(),
  1018. _vm.$slots.prefix
  1019. ? _c("template", { slot: "prefix" }, [_vm._t("prefix")], 2)
  1020. : _vm._e(),
  1021. _vm.$slots.suffix
  1022. ? _c("template", { slot: "suffix" }, [_vm._t("suffix")], 2)
  1023. : _vm._e()
  1024. ],
  1025. 2
  1026. ),
  1027. _c(
  1028. "tis-autocomplete-suggestions",
  1029. {
  1030. ref: "suggestions",
  1031. class: [_vm.popperClass ? _vm.popperClass : ""],
  1032. attrs: {
  1033. "visible-arrow": "",
  1034. "popper-options": _vm.popperOptions,
  1035. "append-to-body": _vm.popperAppendToBody,
  1036. placement: _vm.placement,
  1037. id: _vm.id
  1038. }
  1039. },
  1040. _vm._l(_vm.suggestions, function(item, index) {
  1041. return _c(
  1042. "li",
  1043. {
  1044. key: index,
  1045. class: { highlighted: _vm.highlightedIndex === index },
  1046. attrs: {
  1047. id: _vm.id + "-item-" + index,
  1048. role: "option",
  1049. "aria-selected": _vm.highlightedIndex === index
  1050. },
  1051. on: {
  1052. click: function($event) {
  1053. _vm.select(item)
  1054. }
  1055. }
  1056. },
  1057. [
  1058. _vm._t(
  1059. "default",
  1060. [
  1061. _vm._v("\n " + _vm._s(item[_vm.valueKey]) + "\n ")
  1062. ],
  1063. { item: item }
  1064. )
  1065. ],
  1066. 2
  1067. )
  1068. }),
  1069. 0
  1070. )
  1071. ],
  1072. 1
  1073. )
  1074. }
  1075. var staticRenderFns = []
  1076. render._withStripped = true
  1077. // CONCATENATED MODULE: ./packages/autocomplete/src/autocomplete.vue?vue&type=template&id=152f2ee6&
  1078. // EXTERNAL MODULE: external "throttle-debounce/debounce"
  1079. var debounce_ = __webpack_require__(62);
  1080. var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce_);
  1081. // EXTERNAL MODULE: ./packages/input/index.js + 6 modules
  1082. var input = __webpack_require__(52);
  1083. // EXTERNAL MODULE: external "tis-ui/lib/utils/clickoutside"
  1084. var clickoutside_ = __webpack_require__(61);
  1085. var clickoutside_default = /*#__PURE__*/__webpack_require__.n(clickoutside_);
  1086. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/autocomplete/src/autocomplete-suggestions.vue?vue&type=template&id=cd10dcf0&
  1087. var autocomplete_suggestionsvue_type_template_id_cd10dcf0_render = function() {
  1088. var _vm = this
  1089. var _h = _vm.$createElement
  1090. var _c = _vm._self._c || _h
  1091. return _c(
  1092. "transition",
  1093. { attrs: { name: "el-zoom-in-top" }, on: { "after-leave": _vm.doDestroy } },
  1094. [
  1095. _c(
  1096. "div",
  1097. {
  1098. directives: [
  1099. {
  1100. name: "show",
  1101. rawName: "v-show",
  1102. value: _vm.showPopper,
  1103. expression: "showPopper"
  1104. }
  1105. ],
  1106. staticClass: "el-autocomplete-suggestion el-popper",
  1107. class: {
  1108. "is-loading": !_vm.parent.hideLoading && _vm.parent.loading
  1109. },
  1110. style: { width: _vm.dropdownWidth },
  1111. attrs: { role: "region" }
  1112. },
  1113. [
  1114. _c(
  1115. "tis-scrollbar",
  1116. {
  1117. attrs: {
  1118. tag: "ul",
  1119. "wrap-class": "el-autocomplete-suggestion__wrap",
  1120. "view-class": "el-autocomplete-suggestion__list"
  1121. }
  1122. },
  1123. [
  1124. !_vm.parent.hideLoading && _vm.parent.loading
  1125. ? _c("li", [_c("i", { staticClass: "el-icon-loading" })])
  1126. : _vm._t("default")
  1127. ],
  1128. 2
  1129. )
  1130. ],
  1131. 1
  1132. )
  1133. ]
  1134. )
  1135. }
  1136. var autocomplete_suggestionsvue_type_template_id_cd10dcf0_staticRenderFns = []
  1137. autocomplete_suggestionsvue_type_template_id_cd10dcf0_render._withStripped = true
  1138. // CONCATENATED MODULE: ./packages/autocomplete/src/autocomplete-suggestions.vue?vue&type=template&id=cd10dcf0&
  1139. // EXTERNAL MODULE: external "tis-ui/lib/utils/vue-popper"
  1140. var vue_popper_ = __webpack_require__(34);
  1141. var vue_popper_default = /*#__PURE__*/__webpack_require__.n(vue_popper_);
  1142. // EXTERNAL MODULE: external "tis-ui/lib/mixins/emitter"
  1143. var emitter_ = __webpack_require__(13);
  1144. var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
  1145. // EXTERNAL MODULE: ./packages/scrollbar/index.js + 3 modules
  1146. var scrollbar = __webpack_require__(66);
  1147. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/autocomplete/src/autocomplete-suggestions.vue?vue&type=script&lang=js&
  1148. //
  1149. //
  1150. //
  1151. //
  1152. //
  1153. //
  1154. //
  1155. //
  1156. //
  1157. //
  1158. //
  1159. //
  1160. //
  1161. //
  1162. //
  1163. //
  1164. //
  1165. //
  1166. //
  1167. /* harmony default export */ var autocomplete_suggestionsvue_type_script_lang_js_ = ({
  1168. components: { ElScrollbar: scrollbar["default"] },
  1169. mixins: [vue_popper_default.a, emitter_default.a],
  1170. componentName: 'TisAutocompleteSuggestions',
  1171. data: function data() {
  1172. return {
  1173. parent: this.$parent,
  1174. dropdownWidth: ''
  1175. };
  1176. },
  1177. props: {
  1178. options: {
  1179. default: function _default() {
  1180. return {
  1181. gpuAcceleration: false
  1182. };
  1183. }
  1184. },
  1185. id: String
  1186. },
  1187. methods: {
  1188. select: function select(item) {
  1189. this.dispatch('ElAutocomplete', 'item-click', item);
  1190. }
  1191. },
  1192. updated: function updated() {
  1193. var _this = this;
  1194. this.$nextTick(function (_) {
  1195. _this.popperJS && _this.updatePopper();
  1196. });
  1197. },
  1198. mounted: function mounted() {
  1199. this.$parent.popperElm = this.popperElm = this.$el;
  1200. this.referenceElm = this.$parent.$refs.input.$refs.input || this.$parent.$refs.input.$refs.textarea;
  1201. this.referenceList = this.$el.querySelector('.el-autocomplete-suggestion__list');
  1202. this.referenceList.setAttribute('role', 'listbox');
  1203. this.referenceList.setAttribute('id', this.id);
  1204. },
  1205. created: function created() {
  1206. var _this2 = this;
  1207. this.$on('visible', function (val, inputWidth) {
  1208. _this2.dropdownWidth = inputWidth + 'px';
  1209. _this2.showPopper = val;
  1210. });
  1211. }
  1212. });
  1213. // CONCATENATED MODULE: ./packages/autocomplete/src/autocomplete-suggestions.vue?vue&type=script&lang=js&
  1214. /* harmony default export */ var src_autocomplete_suggestionsvue_type_script_lang_js_ = (autocomplete_suggestionsvue_type_script_lang_js_);
  1215. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  1216. var componentNormalizer = __webpack_require__(2);
  1217. // CONCATENATED MODULE: ./packages/autocomplete/src/autocomplete-suggestions.vue
  1218. /* normalize component */
  1219. var component = Object(componentNormalizer["a" /* default */])(
  1220. src_autocomplete_suggestionsvue_type_script_lang_js_,
  1221. autocomplete_suggestionsvue_type_template_id_cd10dcf0_render,
  1222. autocomplete_suggestionsvue_type_template_id_cd10dcf0_staticRenderFns,
  1223. false,
  1224. null,
  1225. null,
  1226. null
  1227. )
  1228. /* hot reload */
  1229. if (false) { var api; }
  1230. component.options.__file = "packages/autocomplete/src/autocomplete-suggestions.vue"
  1231. /* harmony default export */ var autocomplete_suggestions = (component.exports);
  1232. // EXTERNAL MODULE: external "tis-ui/lib/mixins/migrating"
  1233. var migrating_ = __webpack_require__(36);
  1234. var migrating_default = /*#__PURE__*/__webpack_require__.n(migrating_);
  1235. // EXTERNAL MODULE: external "tis-ui/lib/utils/util"
  1236. var util_ = __webpack_require__(10);
  1237. // EXTERNAL MODULE: external "tis-ui/lib/mixins/focus"
  1238. var focus_ = __webpack_require__(88);
  1239. var focus_default = /*#__PURE__*/__webpack_require__.n(focus_);
  1240. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/autocomplete/src/autocomplete.vue?vue&type=script&lang=js&
  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. /* harmony default export */ var autocompletevue_type_script_lang_js_ = ({
  1301. name: 'TisAutocomplete',
  1302. mixins: [emitter_default.a, focus_default()('input'), migrating_default.a],
  1303. inheritAttrs: false,
  1304. componentName: 'TisAutocomplete',
  1305. components: {
  1306. TisInput: input["default"],
  1307. TisAutocompleteSuggestions: autocomplete_suggestions
  1308. },
  1309. directives: { Clickoutside: clickoutside_default.a },
  1310. props: {
  1311. valueKey: {
  1312. type: String,
  1313. default: 'value'
  1314. },
  1315. popperClass: String,
  1316. popperOptions: Object,
  1317. placeholder: String,
  1318. clearable: {
  1319. type: Boolean,
  1320. default: false
  1321. },
  1322. disabled: Boolean,
  1323. name: String,
  1324. size: String,
  1325. value: String,
  1326. maxlength: Number,
  1327. minlength: Number,
  1328. autofocus: Boolean,
  1329. fetchSuggestions: Function,
  1330. triggerOnFocus: {
  1331. type: Boolean,
  1332. default: true
  1333. },
  1334. customItem: String,
  1335. selectWhenUnmatched: {
  1336. type: Boolean,
  1337. default: false
  1338. },
  1339. prefixIcon: String,
  1340. suffixIcon: String,
  1341. label: String,
  1342. debounce: {
  1343. type: Number,
  1344. default: 300
  1345. },
  1346. placement: {
  1347. type: String,
  1348. default: 'bottom-start'
  1349. },
  1350. hideLoading: Boolean,
  1351. popperAppendToBody: {
  1352. type: Boolean,
  1353. default: true
  1354. },
  1355. highlightFirstItem: {
  1356. type: Boolean,
  1357. default: false
  1358. }
  1359. },
  1360. data: function data() {
  1361. return {
  1362. activated: false,
  1363. suggestions: [],
  1364. loading: false,
  1365. highlightedIndex: -1,
  1366. suggestionDisabled: false
  1367. };
  1368. },
  1369. computed: {
  1370. suggestionVisible: function suggestionVisible() {
  1371. var suggestions = this.suggestions;
  1372. var isValidData = Array.isArray(suggestions) && suggestions.length > 0;
  1373. return (isValidData || this.loading) && this.activated;
  1374. },
  1375. id: function id() {
  1376. return 'el-autocomplete-' + Object(util_["generateId"])();
  1377. }
  1378. },
  1379. watch: {
  1380. suggestionVisible: function suggestionVisible(val) {
  1381. var $input = this.getInput();
  1382. if ($input) {
  1383. this.broadcast('TisAutocompleteSuggestions', 'visible', [val, $input.offsetWidth]);
  1384. }
  1385. }
  1386. },
  1387. methods: {
  1388. getMigratingConfig: function getMigratingConfig() {
  1389. return {
  1390. props: {
  1391. 'custom-item': 'custom-item is removed, use scoped slot instead.',
  1392. 'props': 'props is removed, use value-key instead.'
  1393. }
  1394. };
  1395. },
  1396. getData: function getData(queryString) {
  1397. var _this = this;
  1398. if (this.suggestionDisabled) {
  1399. return;
  1400. }
  1401. this.loading = true;
  1402. this.fetchSuggestions(queryString, function (suggestions) {
  1403. _this.loading = false;
  1404. if (_this.suggestionDisabled) {
  1405. return;
  1406. }
  1407. if (Array.isArray(suggestions)) {
  1408. _this.suggestions = suggestions;
  1409. _this.highlightedIndex = _this.highlightFirstItem ? 0 : -1;
  1410. } else {
  1411. console.error('[Element Error][Autocomplete]autocomplete suggestions must be an array');
  1412. }
  1413. });
  1414. },
  1415. handleInput: function handleInput(value) {
  1416. this.$emit('input', value);
  1417. this.suggestionDisabled = false;
  1418. if (!this.triggerOnFocus && !value) {
  1419. this.suggestionDisabled = true;
  1420. this.suggestions = [];
  1421. return;
  1422. }
  1423. this.debouncedGetData(value);
  1424. },
  1425. handleChange: function handleChange(value) {
  1426. this.$emit('change', value);
  1427. },
  1428. handleFocus: function handleFocus(event) {
  1429. this.activated = true;
  1430. this.$emit('focus', event);
  1431. if (this.triggerOnFocus) {
  1432. this.debouncedGetData(this.value);
  1433. }
  1434. },
  1435. handleBlur: function handleBlur(event) {
  1436. this.$emit('blur', event);
  1437. },
  1438. handleClear: function handleClear() {
  1439. this.activated = false;
  1440. this.$emit('clear');
  1441. },
  1442. close: function close(e) {
  1443. this.activated = false;
  1444. },
  1445. handleKeyEnter: function handleKeyEnter(e) {
  1446. var _this2 = this;
  1447. if (this.suggestionVisible && this.highlightedIndex >= 0 && this.highlightedIndex < this.suggestions.length) {
  1448. e.preventDefault();
  1449. this.select(this.suggestions[this.highlightedIndex]);
  1450. } else if (this.selectWhenUnmatched) {
  1451. this.$emit('select', { value: this.value });
  1452. this.$nextTick(function (_) {
  1453. _this2.suggestions = [];
  1454. _this2.highlightedIndex = -1;
  1455. });
  1456. }
  1457. },
  1458. select: function select(item) {
  1459. var _this3 = this;
  1460. this.$emit('input', item[this.valueKey]);
  1461. this.$emit('select', item);
  1462. this.$nextTick(function (_) {
  1463. _this3.suggestions = [];
  1464. _this3.highlightedIndex = -1;
  1465. });
  1466. },
  1467. highlight: function highlight(index) {
  1468. if (!this.suggestionVisible || this.loading) {
  1469. return;
  1470. }
  1471. if (index < 0) {
  1472. this.highlightedIndex = -1;
  1473. return;
  1474. }
  1475. if (index >= this.suggestions.length) {
  1476. index = this.suggestions.length - 1;
  1477. }
  1478. var suggestion = this.$refs.suggestions.$el.querySelector('.el-autocomplete-suggestion__wrap');
  1479. var suggestionList = suggestion.querySelectorAll('.el-autocomplete-suggestion__list li');
  1480. var highlightItem = suggestionList[index];
  1481. var scrollTop = suggestion.scrollTop;
  1482. var offsetTop = highlightItem.offsetTop;
  1483. if (offsetTop + highlightItem.scrollHeight > scrollTop + suggestion.clientHeight) {
  1484. suggestion.scrollTop += highlightItem.scrollHeight;
  1485. }
  1486. if (offsetTop < scrollTop) {
  1487. suggestion.scrollTop -= highlightItem.scrollHeight;
  1488. }
  1489. this.highlightedIndex = index;
  1490. var $input = this.getInput();
  1491. $input.setAttribute('aria-activedescendant', this.id + '-item-' + this.highlightedIndex);
  1492. },
  1493. getInput: function getInput() {
  1494. return this.$refs.input.getInput();
  1495. }
  1496. },
  1497. mounted: function mounted() {
  1498. var _this4 = this;
  1499. this.debouncedGetData = debounce_default()(this.debounce, this.getData);
  1500. this.$on('item-click', function (item) {
  1501. _this4.select(item);
  1502. });
  1503. var $input = this.getInput();
  1504. $input.setAttribute('role', 'textbox');
  1505. $input.setAttribute('aria-autocomplete', 'list');
  1506. $input.setAttribute('aria-controls', 'id');
  1507. $input.setAttribute('aria-activedescendant', this.id + '-item-' + this.highlightedIndex);
  1508. },
  1509. beforeDestroy: function beforeDestroy() {
  1510. this.$refs.suggestions.$destroy();
  1511. }
  1512. });
  1513. // CONCATENATED MODULE: ./packages/autocomplete/src/autocomplete.vue?vue&type=script&lang=js&
  1514. /* harmony default export */ var src_autocompletevue_type_script_lang_js_ = (autocompletevue_type_script_lang_js_);
  1515. // CONCATENATED MODULE: ./packages/autocomplete/src/autocomplete.vue
  1516. /* normalize component */
  1517. var autocomplete_component = Object(componentNormalizer["a" /* default */])(
  1518. src_autocompletevue_type_script_lang_js_,
  1519. render,
  1520. staticRenderFns,
  1521. false,
  1522. null,
  1523. null,
  1524. null
  1525. )
  1526. /* hot reload */
  1527. if (false) { var autocomplete_api; }
  1528. autocomplete_component.options.__file = "packages/autocomplete/src/autocomplete.vue"
  1529. /* harmony default export */ var autocomplete = (autocomplete_component.exports);
  1530. // CONCATENATED MODULE: ./packages/autocomplete/index.js
  1531. /* istanbul ignore next */
  1532. autocomplete.install = function (Vue) {
  1533. Vue.component(autocomplete.name, autocomplete);
  1534. };
  1535. /* harmony default export */ var packages_autocomplete = __webpack_exports__["default"] = (autocomplete);
  1536. /***/ }),
  1537. /***/ 61:
  1538. /***/ (function(module, exports) {
  1539. module.exports = require("tis-ui/lib/utils/clickoutside");
  1540. /***/ }),
  1541. /***/ 62:
  1542. /***/ (function(module, exports) {
  1543. module.exports = require("throttle-debounce/debounce");
  1544. /***/ }),
  1545. /***/ 65:
  1546. /***/ (function(module, exports) {
  1547. module.exports = require("tis-ui/lib/utils/scrollbar-width");
  1548. /***/ }),
  1549. /***/ 66:
  1550. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1551. "use strict";
  1552. // ESM COMPAT FLAG
  1553. __webpack_require__.r(__webpack_exports__);
  1554. // EXTERNAL MODULE: external "tis-ui/lib/utils/resize-event"
  1555. var resize_event_ = __webpack_require__(44);
  1556. // EXTERNAL MODULE: external "tis-ui/lib/utils/scrollbar-width"
  1557. var scrollbar_width_ = __webpack_require__(65);
  1558. var scrollbar_width_default = /*#__PURE__*/__webpack_require__.n(scrollbar_width_);
  1559. // EXTERNAL MODULE: external "tis-ui/lib/utils/util"
  1560. var util_ = __webpack_require__(10);
  1561. // EXTERNAL MODULE: external "tis-ui/lib/utils/dom"
  1562. var dom_ = __webpack_require__(7);
  1563. // CONCATENATED MODULE: ./packages/scrollbar/src/util.js
  1564. var BAR_MAP = {
  1565. vertical: {
  1566. offset: 'offsetHeight',
  1567. scroll: 'scrollTop',
  1568. scrollSize: 'scrollHeight',
  1569. size: 'height',
  1570. key: 'vertical',
  1571. axis: 'Y',
  1572. client: 'clientY',
  1573. direction: 'top'
  1574. },
  1575. horizontal: {
  1576. offset: 'offsetWidth',
  1577. scroll: 'scrollLeft',
  1578. scrollSize: 'scrollWidth',
  1579. size: 'width',
  1580. key: 'horizontal',
  1581. axis: 'X',
  1582. client: 'clientX',
  1583. direction: 'left'
  1584. }
  1585. };
  1586. function renderThumbStyle(_ref) {
  1587. var move = _ref.move,
  1588. size = _ref.size,
  1589. bar = _ref.bar;
  1590. var style = {};
  1591. var translate = 'translate' + bar.axis + '(' + move + '%)';
  1592. style[bar.size] = size;
  1593. style.transform = translate;
  1594. style.msTransform = translate;
  1595. style.webkitTransform = translate;
  1596. return style;
  1597. };
  1598. // CONCATENATED MODULE: ./packages/scrollbar/src/bar.js
  1599. /* istanbul ignore next */
  1600. /* harmony default export */ var src_bar = ({
  1601. name: 'Bar',
  1602. props: {
  1603. vertical: Boolean,
  1604. size: String,
  1605. move: Number
  1606. },
  1607. computed: {
  1608. bar: function bar() {
  1609. return BAR_MAP[this.vertical ? 'vertical' : 'horizontal'];
  1610. },
  1611. wrap: function wrap() {
  1612. return this.$parent.wrap;
  1613. }
  1614. },
  1615. render: function render(h) {
  1616. var size = this.size,
  1617. move = this.move,
  1618. bar = this.bar;
  1619. return h(
  1620. 'div',
  1621. {
  1622. 'class': ['el-scrollbar__bar', 'is-' + bar.key],
  1623. on: {
  1624. 'mousedown': this.clickTrackHandler
  1625. }
  1626. },
  1627. [h('div', {
  1628. ref: 'thumb',
  1629. 'class': 'el-scrollbar__thumb',
  1630. on: {
  1631. 'mousedown': this.clickThumbHandler
  1632. },
  1633. style: renderThumbStyle({ size: size, move: move, bar: bar }) })]
  1634. );
  1635. },
  1636. methods: {
  1637. clickThumbHandler: function clickThumbHandler(e) {
  1638. // prevent click event of right button
  1639. if (e.ctrlKey || e.button === 2) {
  1640. return;
  1641. }
  1642. this.startDrag(e);
  1643. this[this.bar.axis] = e.currentTarget[this.bar.offset] - (e[this.bar.client] - e.currentTarget.getBoundingClientRect()[this.bar.direction]);
  1644. },
  1645. clickTrackHandler: function clickTrackHandler(e) {
  1646. var offset = Math.abs(e.target.getBoundingClientRect()[this.bar.direction] - e[this.bar.client]);
  1647. var thumbHalf = this.$refs.thumb[this.bar.offset] / 2;
  1648. var thumbPositionPercentage = (offset - thumbHalf) * 100 / this.$el[this.bar.offset];
  1649. this.wrap[this.bar.scroll] = thumbPositionPercentage * this.wrap[this.bar.scrollSize] / 100;
  1650. },
  1651. startDrag: function startDrag(e) {
  1652. e.stopImmediatePropagation();
  1653. this.cursorDown = true;
  1654. Object(dom_["on"])(document, 'mousemove', this.mouseMoveDocumentHandler);
  1655. Object(dom_["on"])(document, 'mouseup', this.mouseUpDocumentHandler);
  1656. document.onselectstart = function () {
  1657. return false;
  1658. };
  1659. },
  1660. mouseMoveDocumentHandler: function mouseMoveDocumentHandler(e) {
  1661. if (this.cursorDown === false) return;
  1662. var prevPage = this[this.bar.axis];
  1663. if (!prevPage) return;
  1664. var offset = (this.$el.getBoundingClientRect()[this.bar.direction] - e[this.bar.client]) * -1;
  1665. var thumbClickPosition = this.$refs.thumb[this.bar.offset] - prevPage;
  1666. var thumbPositionPercentage = (offset - thumbClickPosition) * 100 / this.$el[this.bar.offset];
  1667. this.wrap[this.bar.scroll] = thumbPositionPercentage * this.wrap[this.bar.scrollSize] / 100;
  1668. },
  1669. mouseUpDocumentHandler: function mouseUpDocumentHandler(e) {
  1670. this.cursorDown = false;
  1671. this[this.bar.axis] = 0;
  1672. Object(dom_["off"])(document, 'mousemove', this.mouseMoveDocumentHandler);
  1673. document.onselectstart = null;
  1674. }
  1675. },
  1676. destroyed: function destroyed() {
  1677. Object(dom_["off"])(document, 'mouseup', this.mouseUpDocumentHandler);
  1678. }
  1679. });
  1680. // CONCATENATED MODULE: ./packages/scrollbar/src/main.js
  1681. // reference https://github.com/noeldelgado/gemini-scrollbar/blob/master/index.js
  1682. /* istanbul ignore next */
  1683. /* harmony default export */ var main = ({
  1684. name: 'TisScrollbar',
  1685. components: { Bar: src_bar },
  1686. props: {
  1687. native: Boolean,
  1688. wrapStyle: {},
  1689. wrapClass: {},
  1690. viewClass: {},
  1691. viewStyle: {},
  1692. noresize: Boolean, // 如果 container 尺寸不会发生变化,最好设置它可以优化性能
  1693. tag: {
  1694. type: String,
  1695. default: 'div'
  1696. }
  1697. },
  1698. data: function data() {
  1699. return {
  1700. sizeWidth: '0',
  1701. sizeHeight: '0',
  1702. moveX: 0,
  1703. moveY: 0
  1704. };
  1705. },
  1706. computed: {
  1707. wrap: function wrap() {
  1708. return this.$refs.wrap;
  1709. }
  1710. },
  1711. render: function render(h) {
  1712. var gutter = scrollbar_width_default()();
  1713. var style = this.wrapStyle;
  1714. if (gutter) {
  1715. var gutterWith = '-' + gutter + 'px';
  1716. var gutterStyle = 'margin-bottom: ' + gutterWith + '; margin-right: ' + gutterWith + ';';
  1717. if (Array.isArray(this.wrapStyle)) {
  1718. style = Object(util_["toObject"])(this.wrapStyle);
  1719. style.marginRight = style.marginBottom = gutterWith;
  1720. } else if (typeof this.wrapStyle === 'string') {
  1721. style += gutterStyle;
  1722. } else {
  1723. style = gutterStyle;
  1724. }
  1725. }
  1726. var view = h(this.tag, {
  1727. class: ['el-scrollbar__view', this.viewClass],
  1728. style: this.viewStyle,
  1729. ref: 'resize'
  1730. }, this.$slots.default);
  1731. var wrap = h(
  1732. 'div',
  1733. {
  1734. ref: 'wrap',
  1735. style: style,
  1736. on: {
  1737. 'scroll': this.handleScroll
  1738. },
  1739. 'class': [this.wrapClass, 'el-scrollbar__wrap', gutter ? '' : 'el-scrollbar__wrap--hidden-default'] },
  1740. [[view]]
  1741. );
  1742. var nodes = void 0;
  1743. if (!this.native) {
  1744. nodes = [wrap, h(src_bar, {
  1745. attrs: {
  1746. move: this.moveX,
  1747. size: this.sizeWidth }
  1748. }), h(src_bar, {
  1749. attrs: {
  1750. vertical: true,
  1751. move: this.moveY,
  1752. size: this.sizeHeight }
  1753. })];
  1754. } else {
  1755. nodes = [h(
  1756. 'div',
  1757. {
  1758. ref: 'wrap',
  1759. 'class': [this.wrapClass, 'el-scrollbar__wrap'],
  1760. style: style },
  1761. [[view]]
  1762. )];
  1763. }
  1764. return h('div', { class: 'el-scrollbar' }, nodes);
  1765. },
  1766. methods: {
  1767. handleScroll: function handleScroll() {
  1768. var wrap = this.wrap;
  1769. this.moveY = wrap.scrollTop * 100 / wrap.clientHeight;
  1770. this.moveX = wrap.scrollLeft * 100 / wrap.clientWidth;
  1771. },
  1772. update: function update() {
  1773. var heightPercentage = void 0,
  1774. widthPercentage = void 0;
  1775. var wrap = this.wrap;
  1776. if (!wrap) return;
  1777. heightPercentage = wrap.clientHeight * 100 / wrap.scrollHeight;
  1778. widthPercentage = wrap.clientWidth * 100 / wrap.scrollWidth;
  1779. this.sizeHeight = heightPercentage < 100 ? heightPercentage + '%' : '';
  1780. this.sizeWidth = widthPercentage < 100 ? widthPercentage + '%' : '';
  1781. }
  1782. },
  1783. mounted: function mounted() {
  1784. if (this.native) return;
  1785. this.$nextTick(this.update);
  1786. !this.noresize && Object(resize_event_["addResizeListener"])(this.$refs.resize, this.update);
  1787. },
  1788. beforeDestroy: function beforeDestroy() {
  1789. if (this.native) return;
  1790. !this.noresize && Object(resize_event_["removeResizeListener"])(this.$refs.resize, this.update);
  1791. }
  1792. });
  1793. // CONCATENATED MODULE: ./packages/scrollbar/index.js
  1794. /* istanbul ignore next */
  1795. main.install = function (Vue) {
  1796. Vue.component(main.name, main);
  1797. };
  1798. /* harmony default export */ var scrollbar = __webpack_exports__["default"] = (main);
  1799. /***/ }),
  1800. /***/ 7:
  1801. /***/ (function(module, exports) {
  1802. module.exports = require("tis-ui/lib/utils/dom");
  1803. /***/ }),
  1804. /***/ 88:
  1805. /***/ (function(module, exports) {
  1806. module.exports = require("tis-ui/lib/mixins/focus");
  1807. /***/ })
  1808. /******/ });