123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626 |
- module.exports =
- /******/ (function(modules) { // webpackBootstrap
- /******/ // The module cache
- /******/ var installedModules = {};
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/ // Check if module is in cache
- /******/ if(installedModules[moduleId])
- /******/ return installedModules[moduleId].exports;
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = installedModules[moduleId] = {
- /******/ exports: {},
- /******/ id: moduleId,
- /******/ loaded: false
- /******/ };
- /******/ // Execute the module function
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/ // Flag the module as loaded
- /******/ module.loaded = true;
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = modules;
- /******/ // expose the module cache
- /******/ __webpack_require__.c = installedModules;
- /******/ // __webpack_public_path__
- /******/ __webpack_require__.p = "/dist/";
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(0);
- /******/ })
- /************************************************************************/
- /******/ ([
- /* 0 */
- /***/ function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(6);
- /***/ },
- /* 1 */,
- /* 2 */,
- /* 3 */
- /***/ function(module, exports) {
- module.exports = function normalizeComponent (
- rawScriptExports,
- compiledTemplate,
- scopeId,
- cssModules
- ) {
- var esModule
- var scriptExports = rawScriptExports = rawScriptExports || {}
- // ES6 modules interop
- var type = typeof rawScriptExports.default
- if (type === 'object' || type === 'function') {
- esModule = rawScriptExports
- scriptExports = rawScriptExports.default
- }
- // Vue.extend constructor export interop
- var options = typeof scriptExports === 'function'
- ? scriptExports.options
- : scriptExports
- // render functions
- if (compiledTemplate) {
- options.render = compiledTemplate.render
- options.staticRenderFns = compiledTemplate.staticRenderFns
- }
- // scopedId
- if (scopeId) {
- options._scopeId = scopeId
- }
- // inject cssModules
- if (cssModules) {
- var computed = options.computed || (options.computed = {})
- Object.keys(cssModules).forEach(function (key) {
- var module = cssModules[key]
- computed[key] = function () { return module }
- })
- }
- return {
- esModule: esModule,
- exports: scriptExports,
- options: options
- }
- }
- /***/ },
- /* 4 */,
- /* 5 */,
- /* 6 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
- exports.__esModule = true;
- var _autocomplete = __webpack_require__(7);
- var _autocomplete2 = _interopRequireDefault(_autocomplete);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- /* istanbul ignore next */
- _autocomplete2.default.install = function (Vue) {
- Vue.component(_autocomplete2.default.name, _autocomplete2.default);
- };
- exports.default = _autocomplete2.default;
- /***/ },
- /* 7 */
- /***/ function(module, exports, __webpack_require__) {
- var Component = __webpack_require__(3)(
- /* script */
- __webpack_require__(8),
- /* template */
- __webpack_require__(17),
- /* scopeId */
- null,
- /* cssModules */
- null
- )
- module.exports = Component.exports
- /***/ },
- /* 8 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
- exports.__esModule = true;
- var _input = __webpack_require__(9);
- var _input2 = _interopRequireDefault(_input);
- var _clickoutside = __webpack_require__(10);
- var _clickoutside2 = _interopRequireDefault(_clickoutside);
- var _autocompleteSuggestions = __webpack_require__(11);
- var _autocompleteSuggestions2 = _interopRequireDefault(_autocompleteSuggestions);
- var _emitter = __webpack_require__(14);
- var _emitter2 = _interopRequireDefault(_emitter);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- exports.default = {
- name: 'ElAutocomplete',
- mixins: [_emitter2.default],
- componentName: 'ElAutocomplete',
- components: {
- ElInput: _input2.default,
- ElAutocompleteSuggestions: _autocompleteSuggestions2.default
- },
- directives: { Clickoutside: _clickoutside2.default },
- props: {
- popperClass: String,
- placeholder: String,
- disabled: Boolean,
- name: String,
- size: String,
- value: String,
- autofocus: Boolean,
- fetchSuggestions: Function,
- triggerOnFocus: {
- type: Boolean,
- default: true
- },
- customItem: String,
- icon: String,
- onIconClick: Function
- },
- data: function data() {
- return {
- isFocus: false,
- suggestions: [],
- loading: false,
- highlightedIndex: -1
- };
- },
- computed: {
- suggestionVisible: function suggestionVisible() {
- var suggestions = this.suggestions;
- var isValidData = Array.isArray(suggestions) && suggestions.length > 0;
- return (isValidData || this.loading) && this.isFocus;
- }
- },
- watch: {
- suggestionVisible: function suggestionVisible(val) {
- this.broadcast('ElAutocompleteSuggestions', 'visible', [val, this.$refs.input.$refs.input.offsetWidth]);
- }
- },
- methods: {
- getData: function getData(queryString) {
- var _this = this;
- this.loading = true;
- this.fetchSuggestions(queryString, function (suggestions) {
- _this.loading = false;
- if (Array.isArray(suggestions)) {
- _this.suggestions = suggestions;
- } else {
- console.error('autocomplete suggestions must be an array');
- }
- });
- },
- handleChange: function handleChange(value) {
- this.$emit('input', value);
- if (!this.triggerOnFocus && !value) {
- this.suggestions = [];
- return;
- }
- this.getData(value);
- },
- handleFocus: function handleFocus() {
- this.isFocus = true;
- if (this.triggerOnFocus) {
- this.getData(this.value);
- }
- },
- handleBlur: function handleBlur() {
- var _this2 = this;
- // 因为 blur 事件处理优先于 select 事件执行
- setTimeout(function (_) {
- _this2.isFocus = false;
- }, 100);
- },
- handleKeyEnter: function handleKeyEnter() {
- if (this.suggestionVisible && this.highlightedIndex >= 0 && this.highlightedIndex < this.suggestions.length) {
- this.select(this.suggestions[this.highlightedIndex]);
- }
- },
- handleClickoutside: function handleClickoutside() {
- this.isFocus = false;
- },
- select: function select(item) {
- var _this3 = this;
- this.$emit('input', item.value);
- this.$emit('select', item);
- this.$nextTick(function (_) {
- _this3.suggestions = [];
- });
- },
- highlight: function highlight(index) {
- if (!this.suggestionVisible || this.loading) {
- return;
- }
- if (index < 0) index = 0;
- if (index >= this.suggestions.length) {
- index = this.suggestions.length - 1;
- }
- var suggestion = this.$refs.suggestions.$el.querySelector('.el-autocomplete-suggestion__wrap');
- var suggestionList = suggestion.querySelectorAll('.el-autocomplete-suggestion__list li');
- var highlightItem = suggestionList[index];
- var scrollTop = suggestion.scrollTop;
- var offsetTop = highlightItem.offsetTop;
- if (offsetTop + highlightItem.scrollHeight > scrollTop + suggestion.clientHeight) {
- suggestion.scrollTop += highlightItem.scrollHeight;
- }
- if (offsetTop < scrollTop) {
- suggestion.scrollTop -= highlightItem.scrollHeight;
- }
- this.highlightedIndex = index;
- }
- },
- mounted: function mounted() {
- var _this4 = this;
- this.$on('item-click', function (item) {
- _this4.select(item);
- });
- },
- beforeDestroy: function beforeDestroy() {
- this.$refs.suggestions.$destroy();
- }
- };
- /***/ },
- /* 9 */
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/input");
- /***/ },
- /* 10 */
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/utils/clickoutside");
- /***/ },
- /* 11 */
- /***/ function(module, exports, __webpack_require__) {
- var Component = __webpack_require__(3)(
- /* script */
- __webpack_require__(12),
- /* template */
- __webpack_require__(16),
- /* scopeId */
- null,
- /* cssModules */
- null
- )
- module.exports = Component.exports
- /***/ },
- /* 12 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
- exports.__esModule = true;
- var _vuePopper = __webpack_require__(13);
- var _vuePopper2 = _interopRequireDefault(_vuePopper);
- var _emitter = __webpack_require__(14);
- var _emitter2 = _interopRequireDefault(_emitter);
- var _scrollbar = __webpack_require__(15);
- var _scrollbar2 = _interopRequireDefault(_scrollbar);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- exports.default = {
- components: { ElScrollbar: _scrollbar2.default },
- mixins: [_vuePopper2.default, _emitter2.default],
- componentName: 'ElAutocompleteSuggestions',
- data: function data() {
- return {
- parent: this.$parent,
- dropdownWidth: ''
- };
- },
- props: {
- suggestions: Array,
- options: {
- default: function _default() {
- return {
- forceAbsolute: true,
- gpuAcceleration: false
- };
- }
- }
- },
- methods: {
- select: function select(item) {
- this.dispatch('ElAutocomplete', 'item-click', item);
- }
- },
- updated: function updated() {
- var _this = this;
- this.$nextTick(function (_) {
- _this.updatePopper();
- });
- },
- mounted: function mounted() {
- this.popperElm = this.$el;
- this.referenceElm = this.$parent.$refs.input.$refs.input;
- },
- created: function created() {
- var _this2 = this;
- this.$on('visible', function (val, inputWidth) {
- _this2.dropdownWidth = inputWidth + 'px';
- _this2.showPopper = val;
- });
- }
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- /***/ },
- /* 13 */
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/utils/vue-popper");
- /***/ },
- /* 14 */
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/mixins/emitter");
- /***/ },
- /* 15 */
- /***/ function(module, exports) {
- module.exports = require("element-ui/lib/scrollbar");
- /***/ },
- /* 16 */
- /***/ function(module, exports) {
- module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
- return _c('transition', {
- attrs: {
- "name": "el-zoom-in-top"
- },
- on: {
- "after-leave": _vm.doDestroy
- }
- }, [_c('div', {
- directives: [{
- name: "show",
- rawName: "v-show",
- value: (_vm.showPopper),
- expression: "showPopper"
- }],
- staticClass: "el-autocomplete-suggestion",
- class: {
- 'is-loading': _vm.parent.loading
- },
- style: ({
- width: _vm.dropdownWidth
- })
- }, [_c('el-scrollbar', {
- attrs: {
- "tag": "ul",
- "wrap-class": "el-autocomplete-suggestion__wrap",
- "view-class": "el-autocomplete-suggestion__list"
- }
- }, [(_vm.parent.loading) ? _c('li', [_c('i', {
- staticClass: "el-icon-loading"
- })]) : _vm._l((_vm.suggestions), function(item, index) {
- return [(!_vm.parent.customItem) ? _c('li', {
- class: {
- 'highlighted': _vm.parent.highlightedIndex === index
- },
- on: {
- "click": function($event) {
- _vm.select(item)
- }
- }
- }, [_vm._v("\n " + _vm._s(item.value) + "\n ")]) : _c(_vm.parent.customItem, {
- tag: "component",
- class: {
- 'highlighted': _vm.parent.highlightedIndex === index
- },
- attrs: {
- "item": item,
- "index": index
- },
- on: {
- "click": function($event) {
- _vm.select(item)
- }
- }
- })]
- })], 2)], 1)])
- },staticRenderFns: []}
- /***/ },
- /* 17 */
- /***/ function(module, exports) {
- module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
- return _c('div', {
- directives: [{
- name: "clickoutside",
- rawName: "v-clickoutside",
- value: (_vm.handleClickoutside),
- expression: "handleClickoutside"
- }],
- staticClass: "el-autocomplete"
- }, [_c('el-input', {
- ref: "input",
- attrs: {
- "value": _vm.value,
- "disabled": _vm.disabled,
- "placeholder": _vm.placeholder,
- "name": _vm.name,
- "size": _vm.size,
- "icon": _vm.icon,
- "on-icon-click": _vm.onIconClick
- },
- on: {
- "change": _vm.handleChange,
- "focus": _vm.handleFocus,
- "blur": _vm.handleBlur
- },
- nativeOn: {
- "keydown": [function($event) {
- if (_vm._k($event.keyCode, "up", 38)) { return; }
- $event.preventDefault();
- _vm.highlight(_vm.highlightedIndex - 1)
- }, function($event) {
- if (_vm._k($event.keyCode, "down", 40)) { return; }
- $event.preventDefault();
- _vm.highlight(_vm.highlightedIndex + 1)
- }, function($event) {
- if (_vm._k($event.keyCode, "enter", 13)) { return; }
- $event.stopPropagation();
- _vm.handleKeyEnter($event)
- }]
- }
- }, [(_vm.$slots.prepend) ? _c('template', {
- slot: "prepend"
- }, [_vm._t("prepend")], 2) : _vm._e(), (_vm.$slots.append) ? _c('template', {
- slot: "append"
- }, [_vm._t("append")], 2) : _vm._e()], 2), _c('el-autocomplete-suggestions', {
- ref: "suggestions",
- class: [_vm.popperClass ? _vm.popperClass : ''],
- attrs: {
- "suggestions": _vm.suggestions
- }
- })], 1)
- },staticRenderFns: []}
- /***/ }
- /******/ ]);
|