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.

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