UNPKG

element-ui-for-gov

Version:

element-ui for gov

1,660 lines (1,505 loc) 53.6 kB
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] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = 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; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "/dist/"; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 324); /******/ }) /************************************************************************/ /******/ ({ /***/ 1: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; }); /* globals __VUE_SSR_CONTEXT__ */ // IMPORTANT: Do NOT use ES2015 features in this file (except for modules). // This module is a runtime utility for cleaner component module output and will // be included in the final webpack user bundle. function normalizeComponent ( scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, /* server only */ shadowMode /* vue-cli only */ ) { // Vue.extend constructor export interop var options = typeof scriptExports === 'function' ? scriptExports.options : scriptExports // render functions if (render) { options.render = render options.staticRenderFns = staticRenderFns options._compiled = true } // functional template if (functionalTemplate) { options.functional = true } // scopedId if (scopeId) { options._scopeId = 'data-v-' + scopeId } var hook if (moduleIdentifier) { // server build hook = function (context) { // 2.3 injection context = context || // cached call (this.$vnode && this.$vnode.ssrContext) || // stateful (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional // 2.2 with runInNewContext: true if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { context = __VUE_SSR_CONTEXT__ } // inject component styles if (injectStyles) { injectStyles.call(this, context) } // register component module identifier for async chunk inferrence if (context && context._registeredComponents) { context._registeredComponents.add(moduleIdentifier) } } // used by ssr in case component is cached and beforeCreate // never gets called options._ssrRegister = hook } else if (injectStyles) { hook = shadowMode ? function () { injectStyles.call( this, (options.functional ? this.parent : this).$root.$options.shadowRoot ) } : injectStyles } if (hook) { if (options.functional) { // for template-only hot-reload because in that case the render fn doesn't // go through the normalizer options._injectStyles = hook // register for functional component in vue file var originalRender = options.render options.render = function renderWithStyleInjection (h, context) { hook.call(context) return originalRender(h, context) } } else { // inject component registration as beforeCreate hook var existing = options.beforeCreate options.beforeCreate = existing ? [].concat(existing, hook) : [hook] } } return { exports: scriptExports, options: options } } /***/ }), /***/ 12: /***/ (function(module, exports) { module.exports = require("element-ui-for-gov/lib/utils/clickoutside"); /***/ }), /***/ 13: /***/ (function(module, exports) { module.exports = require("element-ui-for-gov/lib/scrollbar"); /***/ }), /***/ 15: /***/ (function(module, exports, __webpack_require__) { /* eslint-disable no-undefined */ var throttle = __webpack_require__(18); /** * Debounce execution of a function. Debouncing, unlike throttling, * guarantees that a function is only executed a single time, either at the * very beginning of a series of calls, or at the very end. * * @param {Number} delay A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful. * @param {Boolean} [atBegin] Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call. * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset). * @param {Function} callback A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is, * to `callback` when the debounced-function is executed. * * @return {Function} A new, debounced function. */ module.exports = function ( delay, atBegin, callback ) { return callback === undefined ? throttle(delay, atBegin, false) : throttle(delay, callback, atBegin !== false); }; /***/ }), /***/ 16: /***/ (function(module, exports) { module.exports = require("element-ui-for-gov/lib/utils/resize-event"); /***/ }), /***/ 18: /***/ (function(module, exports) { /* eslint-disable no-undefined,no-param-reassign,no-shadow */ /** * Throttle execution of a function. Especially useful for rate limiting * execution of handlers on events like resize and scroll. * * @param {Number} delay A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful. * @param {Boolean} [noTrailing] Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds while the * throttled-function is being called. If noTrailing is false or unspecified, callback will be executed one final time * after the last throttled-function call. (After the throttled-function has not been called for `delay` milliseconds, * the internal counter is reset) * @param {Function} callback A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is, * to `callback` when the throttled-function is executed. * @param {Boolean} [debounceMode] If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is false (at end), * schedule `callback` to execute after `delay` ms. * * @return {Function} A new, throttled, function. */ module.exports = function ( delay, noTrailing, callback, debounceMode ) { // After wrapper has stopped being called, this timeout ensures that // `callback` is executed at the proper times in `throttle` and `end` // debounce modes. var timeoutID; // Keep track of the last time `callback` was executed. var lastExec = 0; // `noTrailing` defaults to falsy. if ( typeof noTrailing !== 'boolean' ) { debounceMode = callback; callback = noTrailing; noTrailing = undefined; } // The `wrapper` function encapsulates all of the throttling / debouncing // functionality and when executed will limit the rate at which `callback` // is executed. function wrapper () { var self = this; var elapsed = Number(new Date()) - lastExec; var args = arguments; // Execute `callback` and update the `lastExec` timestamp. function exec () { lastExec = Number(new Date()); callback.apply(self, args); } // If `debounceMode` is true (at begin) this is used to clear the flag // to allow future `callback` executions. function clear () { timeoutID = undefined; } if ( debounceMode && !timeoutID ) { // Since `wrapper` is being called for the first time and // `debounceMode` is true (at begin), execute `callback`. exec(); } // Clear any existing timeout. if ( timeoutID ) { clearTimeout(timeoutID); } if ( debounceMode === undefined && elapsed > delay ) { // In throttle mode, if `delay` time has been exceeded, execute // `callback`. exec(); } else if ( noTrailing !== true ) { // In trailing throttle mode, since `delay` time has not been // exceeded, schedule `callback` to execute `delay` ms after most // recent execution. // // If `debounceMode` is true (at begin), schedule `clear` to execute // after `delay` ms. // // If `debounceMode` is false (at end), schedule `callback` to // execute after `delay` ms. timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay); } } // Return the wrapper function. return wrapper; }; /***/ }), /***/ 2: /***/ (function(module, exports) { module.exports = require("element-ui-for-gov/lib/utils/util"); /***/ }), /***/ 31: /***/ (function(module, exports) { module.exports = require("element-ui-for-gov/lib/tree"); /***/ }), /***/ 324: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/tree-select/src/tree-select.vue?vue&type=template&id=b0e07870& var 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.handleClose, expression: "handleClose" } ], staticClass: "el-tree-select el-select", class: [ _vm.selectSize ? "el-select--" + _vm.selectSize : "", _vm.overflow ? "el-tree-select--overflow" : "" ], on: { click: function($event) { $event.stopPropagation() return _vm.toggleMenu($event) } } }, [ _vm.multiple ? _c( "div", { ref: "tags", staticClass: "el-select__tags", style: { "max-width": _vm.inputWidth - 32 + "px", width: "100%" } }, [ _vm.collapseTags && _vm.selected.length ? _c( "span", [ _c( "el-tag", { attrs: { closable: !_vm.selectDisabled, size: _vm.collapseTagSize, hit: _vm.selected[0].hitState, type: "info", "disable-transitions": "" }, on: { close: function($event) { _vm.deleteTag($event, _vm.selected[0]) } } }, [ _c("span", { staticClass: "el-select__tags-text" }, [ _vm._v(_vm._s(_vm.selected[0].currentLabel)) ]) ] ), _vm.selected.length > 1 ? _c( "el-tag", { attrs: { closable: false, size: _vm.collapseTagSize, type: "info", "disable-transitions": "" } }, [ _c( "span", { staticClass: "el-select__tags-text" }, [_vm._v("+ " + _vm._s(_vm.selected.length - 1))] ) ] ) : _vm._e() ], 1 ) : _vm._e(), !_vm.collapseTags ? _c( "transition-group", { on: { "after-leave": _vm.resetInputHeight } }, _vm._l(_vm.selected, function(item) { return _c( "el-tag", { key: item.value, attrs: { closable: !_vm.selectDisabled, size: _vm.collapseTagSize, hit: item.hitState, type: "info", "disable-transitions": "" }, on: { close: function($event) { _vm.deleteTag($event, item) } } }, [ _c("span", { staticClass: "el-select__tags-text" }, [ _vm._v(_vm._s(item.currentLabel)) ]) ] ) }), 1 ) : _vm._e() ], 1 ) : _vm._e(), _c( "el-input", { ref: "reference", class: { "is-focus": _vm.visible }, attrs: { type: "text", placeholder: _vm.currentPlaceholder, name: _vm.name, id: _vm.id, size: _vm.selectSize, disabled: _vm.selectDisabled, readonly: _vm.readonly, "validate-event": false, tabindex: _vm.multiple && _vm.filterable ? "-1" : null }, on: { focus: _vm.handleFocus, blur: _vm.handleBlur }, nativeOn: { keydown: [ function($event) { if ( !("button" in $event) && _vm._k($event.keyCode, "esc", 27, $event.key, [ "Esc", "Escape" ]) ) { return null } $event.stopPropagation() $event.preventDefault() _vm.visible = false }, function($event) { if ( !("button" in $event) && _vm._k($event.keyCode, "tab", 9, $event.key, "Tab") ) { return null } _vm.visible = false } ], mouseenter: function($event) { _vm.inputHovering = true }, mouseleave: function($event) { _vm.inputHovering = false } }, model: { value: _vm.selectedLabel, callback: function($$v) { _vm.selectedLabel = $$v }, expression: "selectedLabel" } }, [ _vm.$slots.prefix ? _c("template", { slot: "prefix" }, [_vm._t("prefix")], 2) : _vm._e(), _c("template", { slot: "suffix" }, [ _c("i", { directives: [ { name: "show", rawName: "v-show", value: !_vm.showClose, expression: "!showClose" } ], class: [ "el-select__caret", "el-input__icon", "el-icon-" + _vm.iconClass ] }), _vm.showClose ? _c("i", { staticClass: "el-select__caret el-input__icon el-icon-circle-close", on: { click: _vm.handleClearClick } }) : _vm._e() ]) ], 2 ), _c( "transition", { attrs: { name: "el-zoom-in-top" }, on: { "after-leave": _vm.doDestroy } }, [ _c( "el-select-menu", { directives: [ { name: "show", rawName: "v-show", value: _vm.visible, expression: "visible" } ], ref: "popper", staticStyle: { padding: "12px" }, attrs: { "append-to-body": _vm.popperAppendToBody } }, [ _vm.filterable ? _c( "el-input", { attrs: { placeholder: "请输入关键字", size: "small" }, on: { input: _vm.debouncedQueryChange }, nativeOn: { keyup: function($event) { if ( !("button" in $event) && _vm._k( $event.keyCode, "enter", 13, $event.key, "Enter" ) ) { return null } return _vm.handleRemoteQuery($event) } }, model: { value: _vm.query, callback: function($$v) { _vm.query = $$v }, expression: "query" } }, [ _vm.remote ? _c("template", { slot: "append" }, [ _c("i", { staticClass: "sg-icon sg-icon-fangdajing", staticStyle: { cursor: "pointer" }, on: { click: _vm.handleRemoteQuery } }) ]) : _vm._e() ], 2 ) : _vm._e(), _c( "el-scrollbar", { directives: [ { name: "show", rawName: "v-show", value: (_vm.store.data.length > 0 && !_vm.loading) || _vm.lazy, expression: "store.data.length > 0 && !loading || lazy" } ], ref: "scrollbar", attrs: { tag: "div", "wrap-class": "el-select-dropdown__wrap", "view-class": "el-select-dropdown__list" } }, [ _c("el-tree", { ref: "tree", attrs: { "node-key": "id", "default-expand-all": !_vm.lazy ? _vm.defaultExpandAll : false, lazy: _vm.lazy, props: { isLeaf: function(item) { return item.isLeaf } }, load: _vm.loadNodes, data: _vm.treeData, "show-checkbox": _vm.multiple, "highlight-current": !_vm.multiple, "expand-on-click-node": _vm.multiple, "current-node-key": !_vm.multiple ? _vm.value : undefined, "check-strictly": "", "filter-node-method": _vm.filterNodeMethod, tooltipOverflowWidth: _vm.treeTooltipOverflowWidth, checkOnClickNode: _vm.checkOnClickNode }, on: { "node-click": _vm.handleNodeClick, check: _vm.handleNodeCheck } }) ], 1 ), _vm.emptyText && (_vm.loading || _vm.store.data.length === 0) ? [ _vm.$slots.empty ? _vm._t("empty") : _c("p", { staticClass: "el-select-dropdown__empty" }, [ _vm._v( "\n " + _vm._s(_vm.emptyText) + "\n " ) ]) ] : _vm._e() ], 2 ) ], 1 ) ], 1 ) } var staticRenderFns = [] render._withStripped = true // CONCATENATED MODULE: ./packages/tree-select/src/tree-select.vue?vue&type=template&id=b0e07870& // EXTERNAL MODULE: ./node_modules/throttle-debounce/debounce.js var debounce = __webpack_require__(15); var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce); // EXTERNAL MODULE: external "element-ui-for-gov/lib/mixins/emitter" var emitter_ = __webpack_require__(6); var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_); // EXTERNAL MODULE: external "element-ui-for-gov/lib/mixins/focus" var focus_ = __webpack_require__(46); var focus_default = /*#__PURE__*/__webpack_require__.n(focus_); // EXTERNAL MODULE: external "element-ui-for-gov/lib/mixins/locale" var locale_ = __webpack_require__(7); var locale_default = /*#__PURE__*/__webpack_require__.n(locale_); // EXTERNAL MODULE: external "element-ui-for-gov/lib/utils/clickoutside" var clickoutside_ = __webpack_require__(12); var clickoutside_default = /*#__PURE__*/__webpack_require__.n(clickoutside_); // EXTERNAL MODULE: external "element-ui-for-gov/lib/utils/resize-event" var resize_event_ = __webpack_require__(16); // EXTERNAL MODULE: ./packages/select/src/select-dropdown.vue + 4 modules var select_dropdown = __webpack_require__(82); // EXTERNAL MODULE: external "element-ui-for-gov/lib/utils/util" var util_ = __webpack_require__(2); // EXTERNAL MODULE: external "element-ui-for-gov/lib/tree" var tree_ = __webpack_require__(31); var tree_default = /*#__PURE__*/__webpack_require__.n(tree_); // EXTERNAL MODULE: external "element-ui-for-gov/lib/input" var input_ = __webpack_require__(8); var input_default = /*#__PURE__*/__webpack_require__.n(input_); // EXTERNAL MODULE: external "element-ui-for-gov/lib/tag" var tag_ = __webpack_require__(34); var tag_default = /*#__PURE__*/__webpack_require__.n(tag_); // EXTERNAL MODULE: external "element-ui-for-gov/lib/scrollbar" var scrollbar_ = __webpack_require__(13); var scrollbar_default = /*#__PURE__*/__webpack_require__.n(scrollbar_); // EXTERNAL MODULE: external "element-ui-for-gov/lib/utils/tree-store" var tree_store_ = __webpack_require__(81); var tree_store_default = /*#__PURE__*/__webpack_require__.n(tree_store_); // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/tree-select/src/tree-select.vue?vue&type=script&lang=js& // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /* harmony default export */ var tree_selectvue_type_script_lang_js_ = ({ name: 'ElTreeSelect', mixins: [emitter_default.a, locale_default.a, focus_default()('reference')], components: { ElInput: input_default.a, ElSelectMenu: select_dropdown["a" /* default */], ElTree: tree_default.a, ElScrollbar: scrollbar_default.a, ElTag: tag_default.a }, directives: { Clickoutside: clickoutside_default.a }, props: { name: String, id: String, value: { required: true }, overflow: Boolean, lazy: Boolean, loadDataAsync: Function, autocomplete: { type: String, default: 'off' }, defaultExpandAll: { type: Boolean, default: false }, automaticDropdown: Boolean, checkOnClickNode: Boolean, loadingText: String, noMatchText: String, noDataText: String, size: String, reserveKeyword: Boolean, remote: Boolean, remoteMethod: Function, disabled: Boolean, clearable: Boolean, filterable: Boolean, allowCreate: Boolean, loading: Boolean, multiple: Boolean, options: { type: Array, default: function _default() { return []; } }, fieldNames: { type: Object, default: function _default() { return { value: 'value', label: 'label', children: 'children', isLeaf: 'isLeaf' }; } }, collapseTags: Boolean, placeholder: String, popperAppendToBody: { type: Boolean, default: true }, checkStrictly: { type: Boolean, default: false }, defaultValue: { type: Array, default: function _default() { return []; } }, treeTooltipOverflowWidth: String, inputable: Boolean }, data: function data() { return { store: null, treeData: [], visible: false, softFocus: false, selectedLabel: '', hoverIndex: -1, query: '', previousQuery: null, cachedPlaceHolder: '', currentPlaceholder: '', menuVisibleOnFocus: false, selected: '', inputLength: 20, inputWidth: 0, inputHovering: false, debouncedQueryChange: null, defaultOptionMap: {} }; }, created: function created() { var _this = this; this.cachedPlaceHolder = this.currentPlaceholder = this.propPlaceholder; if (this.multiple && !Array.isArray(this.value)) { this.$emit('input', []); } if (!this.multiple && Array.isArray(this.value)) { this.$emit('input', ''); } this.debouncedQueryChange = debounce_default()(this.debounce, function (val) { _this.handleQueryChange(val); }); var _fieldNames = this.fieldNames, value = _fieldNames.value, label = _fieldNames.label, children = _fieldNames.children, isLeaf = _fieldNames.isLeaf, _fieldNames$disabled = _fieldNames.disabled, disabled = _fieldNames$disabled === undefined ? 'disabled' : _fieldNames$disabled, _fieldNames$hideCheck = _fieldNames.hideCheckbox, hideCheckbox = _fieldNames$hideCheck === undefined ? 'hideCheckbox' : _fieldNames$hideCheck; this.store = new tree_store_default.a({ key: value, label: label, children: children, disabled: disabled, hideCheckbox: hideCheckbox, data: this.options, isLeaf: isLeaf || function (data) { return Array.isArray(data[children]) && data[children].length === 0; } }); this.treeData = this.store.data; }, mounted: function mounted() { var _this2 = this; if (this.multiple && Array.isArray(this.value) && this.value.length > 0) { this.currentPlaceholder = ''; } // addResizeListener(this.$el, this.handleResize); var reference = this.$refs.reference; if (reference && reference.$el) { var sizeMap = { medium: 36, small: 32, mini: 28 }; var input = reference.$el.querySelector('input'); this.initialInputHeight = input.getBoundingClientRect().height || sizeMap[this.selectSize]; } if (this.remote && this.multiple) { this.resetInputHeight(); } this.$nextTick(function () { if (reference && reference.$el) { _this2.inputWidth = reference.$el.getBoundingClientRect().width; } }); // console.log('mounted set value ============'); this.setValue(this.value, undefined, true); }, watch: { value: function value(val, oldVal) { // console.log('watch value---------'); this.setValue(val, oldVal, false); }, visible: function visible(val) { var _this3 = this; if (!val) { this.broadcast('ElSelectDropdown', 'destroyPopper'); if (this.$refs.input) { this.$refs.input.blur(); } if (!this.reserveKeyword) { this.query = ''; this.previousQuery = null; } if (this.readonly) this.selectedLabel = ''; this.inputLength = 20; this.menuVisibleOnFocus = false; this.$nextTick(function () { if (_this3.$refs.input && _this3.$refs.input.value === '' && _this3.selected.length === 0) { _this3.currentPlaceholder = _this3.cachedPlaceHolder; } _this3.$refs.tree.filter(''); }); if (!this.multiple && this.readonly) { if (this.selected) { if (this.filterable && this.allowCreate && this.createdSelected && this.createdLabel) { this.selectedLabel = this.createdLabel; } else { this.selectedLabel = this.selected.currentLabel; } } if (this.filterable) { this.currentPlaceholder = this.cachedPlaceHolder; } } } else { this.broadcast('ElSelectDropdown', 'updatePopper'); } this.$emit('visible-change', val); }, propPlaceholder: function propPlaceholder(val) { this.cachedPlaceHolder = this.currentPlaceholder = val; }, options: function options(val) { var _this4 = this; if (this.$isServer) return; this.store.initData(val); this.treeData = this.store.data; this.$nextTick(function () { _this4.setValue(_this4.value); _this4.broadcast('ElSelectDropdown', 'updatePopper'); }); if (this.multiple) { this.resetInputHeight(); } var inputs = this.$el.querySelectorAll('input'); if ([].indexOf.call(inputs, document.activeElement) === -1) { this.setSelected(); } }, defaultValue: { handler: function handler() { var _this5 = this; var valueName = this.fieldNames.value; var labelName = this.fieldNames.label; if (this.defaultValue.length) { this.defaultOptionMap = {}; this.defaultValue.forEach(function (item) { _this5.defaultOptionMap[item[valueName]] = item; }); if (!this.multiple) { if (this.defaultValue && this.defaultValue[0] && this.defaultValue[0][this.fieldNames.value]) { var value = this.defaultValue[0][valueName]; this.createdLabel = this.defaultValue[0][labelName]; this.$emit('input', value); this.emitChange(value); this.$nextTick(function () { _this5.$refs.tree.setStoreCurrentKey(value); }); } } else { var values = []; this.defaultValue.forEach(function (item) { values.push(item.value); }); this.$nextTick(function () { _this5.setValue(values); }); this.$emit('input', values); this.emitChange(values); } } }, immediate: true }, selectedLabel: function selectedLabel(val) { if (this.inputable) this.$emit('input', val); } }, computed: { _elFormItemSize: function _elFormItemSize() { return (this.elFormItem || {}).elFormItemSize; }, readonly: function readonly() { console.log('readonly', this.multiple || !this.inputable); return this.multiple || !this.inputable; // return !this.filterable || this.multiple || (!isIE() && !isEdge() && !this.visible); }, iconClass: function iconClass() { return this.visible ? 'arrow-up is-reverse' : 'arrow-up'; }, emptyText: function emptyText() { if (this.loading) { return this.loadingText || this.t('el.select.loading'); } else { if (this.remote && this.store.data.length === 0) return false; if (this.filterable && this.query && this.store.data.length > 0 && this.filteredOptionsCount === 0) { return this.noMatchText || this.t('el.select.noMatch'); } if (this.store.data.length === 0) { return this.noDataText || this.t('el.select.noData'); } } return null; }, showClose: function showClose() { var hasValue = this.multiple ? Array.isArray(this.value) && this.value.length > 0 : this.value !== undefined && this.value !== null && this.value !== ''; var criteria = this.clearable && !this.selectDisabled && this.inputHovering && hasValue; return criteria; }, selectSize: function selectSize() { return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size; }, selectDisabled: function selectDisabled() { return this.disabled || (this.elForm || {}).disabled; }, collapseTagSize: function collapseTagSize() { return ['small', 'mini'].indexOf(this.selectSize) > -1 ? 'mini' : 'small'; }, propPlaceholder: function propPlaceholder() { return typeof this.placeholder !== 'undefined' ? this.placeholder : this.t('el.select.placeholder'); } }, methods: { setValue: function setValue(val, oldVal, init) { var _this6 = this; // console.log('new: old', val, oldVal); if (this.multiple) { this.resetInputHeight(); if (val && val.length > 0 || this.$refs.input && this.query !== '') { this.currentPlaceholder = ''; } else { this.currentPlaceholder = this.cachedPlaceHolder; } if (this.filterable && !this.reserveKeyword) { // console.log('2222'); this.query = ''; this.handleQueryChange(this.query); } var ids = val.map(function (key) { return _this6.store.getNodesByKey(key); }).reduce(function (total, cur) { return total.concat(cur.map(function (item) { return item.id; })); }, []); this.$refs.tree.setCheckedKeys(ids); } else { this.$refs.tree.setStoreCurrentKey(val); } this.setSelected(); if (this.filterable && !this.multiple) { this.inputLength = 20; } if (!init && !Object(util_["valueEquals"])(val, oldVal)) { this.dispatch('ElFormItem', 'el.form.change', val); } }, loadNodes: function loadNodes(node, resolve) { var _this7 = this; this.loadDataAsync(node.data ? node.data : node, function (data) { if (data && data.length > 0) { if (!node.data || !node.data.length) { _this7.store.data = []; } var childList = data.map(function (item) { var temp = _this7.store.registerNode(item); if (!node.data || !node.data.length) { _this7.store.data.push(temp); } else { node.children.push(temp); } temp.parent = node.data; return temp; }); _this7.$nextTick(function () { _this7.setValue(_this7.value, _this7.value); }); return resolve(childList); } else { return resolve([]); } }); }, filterNodeMethod: function filterNodeMethod(value, data, node) { if (this.filterMethod) { return this.filterMethod(value, data, node); } var label = data.label; if (!value) { return true; } return label.indexOf(value) !== -1; }, handleQueryChange: function handleQueryChange(val) { var _this8 = this; if (this.previousQuery === val) return; if (this.remote && typeof this.remoteMethod === 'function') return; this.previousQuery = val; this.hoverIndex = -1; if (this.multiple && this.filterable) { this.$nextTick(function () { _this8.resetInputHeight(); }); } this.$refs.tree.filter(val); this.$nextTick(function () { // console.log('updatepopper2', this.visible); if (_this8.visible) _this8.broadcast('ElSelectDropdown', 'updatePopper'); }); }, handleRemoteQuery: function handleRemoteQuery() { this.remoteMethod(this.query); }, resetInputWidth: function resetInputWidth() { this.inputWidth = this.$refs.reference.$el.getBoundingClientRect().width; }, resetInputState: function resetInputState() { this.resetInputHeight(); }, resetInputHeight: function resetInputHeight() { var _this9 = this; if (this.collapseTags && !this.filterable) return; this.$nextTick(function () { if (!_this9.$refs.reference) return; var inputChildNodes = _this9.$refs.reference.$el.childNodes; var input = [].filter.call(inputChildNodes, function (item) { return item.tagName === 'INPUT'; })[0]; var tags = _this9.$refs.tags; var sizeInMap = _this9.initialInputHeight || 40; input.style.height = _this9.selected.length === 0 ? sizeInMap + 'px' : Math.max(tags ? tags.clientHeight + (tags.clientHeight > sizeInMap ? 6 : 0) : 0, sizeInMap) + 'px'; if (_this9.visible && _this9.emptyText !== false) { _this9.broadcast('ElSelectDropdown', 'updatePopper'); } }); }, handleResize: function handleResize() { this.resetInputWidth(); if (this.multiple) this.resetInputHeight(); }, handleClose: function handleClose() { this.visible = false; }, toggleMenu: function toggleMenu() { if (!this.selectDisabled) { if (this.menuVisibleOnFocus) { this.menuVisibleOnFocus = false; } else { this.visible = !this.visible; } if (this.visible) { (this.$refs.input || this.$refs.reference).focus(); } } }, deletePrevTag: function deletePrevTag(e) { if (e.target.value.length <= 0) { var value = this.value.slice(); value.pop(); this.$emit('input', value); this.emitChange(value); } }, deleteSelected: function deleteSelected(event) { event.stopPropagation(); var value = this.multiple ? [] : ''; this.$emit('input', value); this.emitChange(value); this.visible = false; this.$emit('clear'); }, deleteTag: function deleteTag(event, tag) { var index = this.selected.indexOf(tag); if (index > -1 && !this.selectDisabled) { var value = this.value.slice(); value.splice(index, 1); this.$emit('input', value); this.emitChange(value); this.$emit('remove-tag', tag.value); } event.stopPropagation(); }, doDestroy: function doDestroy() { this.$refs.popper && this.$refs.popper.doDestroy(); }, emitChange: function emitChange(val) { if (!Object(util_["valueEquals"])(this.value, val)) { this.$emit('change', val); } }, getOption: function getOption(value) { var option = void 0; var isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]'; var isNull = Object.prototype.toString.call(value).toLowerCase() === '[object null]'; var isUndefined = Object.prototype.toString.call(value).toLowerCase() === '[object undefined]'; if (!isNull && !isUndefined) { option = this.store.getNodesByKey(value)[0]; } if (option) { return { created: true, value: option.id, currentLabel: option.label }; } var label = !isObject && !isNull && !isUndefined ? this.defaultOptionMap[value] ? this.defaultOptionMap[value][this.fieldNames.label] : value : ''; var newOption = { value: value, currentLabel: label }; if (this.multiple) { newOption.hitState = false; } return newOption; }, setSelected: function setSelected() { var _this10 = this; if (!this.multiple) { var option = this.getOption(this.value); if (option.created) { this.createdLabel = option.currentLabel; this.createdSelected = true; } else { this.createdSelected = false; } this.selectedLabel = option.currentLabel; this.selected = option; // if (this.filterable) { // this.query = this.selectedLabel; // } return; } var result = []; if (Array.isArray(this.value)) { this.value.forEach(function (value) { result.push(_this10.getOption(value)); }); } this.selected = result; this.$nextTick(function () { _this10.resetInputHeight(); }); }, handleNodeCheck: function handleNodeCheck(data, _ref) { var _this11 = this; var checkedKeys = _ref.checkedKeys, checkedNodes = _ref.checkedNodes; if (!this.multiple) return; // console.log(data, checkedKeys, checkedNodes); var ids = []; checkedNodes.forEach(function (node) { // 取消选中 if (!checkedKeys.includes(data.id)) { // 需要删除相同key的节点 if (node.key !== data.key) { ids.push(node.id); } } else { ids.push(node.id); } }); if (!this.checkStrictly) { // 选中 if (checkedKeys.includes(data.id)) { data.traverseSub(function (item) { !checkedKeys.includes(item.id) && ids.push(item.id); }); data.traverseParent(function (parent) { if (Array.isArray(parent.children) && parent.children.every(function (item) { return ids.includes(item.id); }) && !checkedKeys.includes(parent.id)) { ids.push(parent.id); } }); } else { data.traverseSub(function (item) { var index = ids.indexOf(item.id); checkedKeys.includes(item.id) && index > -1 && ids.splice(index, 1); }); data.traverseParent(function (parent) { var index = ids.indexOf(parent.id); checkedKeys.includes(parent.id) && index > -1 && ids.splice(index, 1); }); } } var value = []; var allNodes = []; ids.forEach(function (id) { var node = _this11.store.getNodeById(id); if (!value.includes(node.key)) { value.push(node.key); } allNodes.push(node.data); }); this.$emit('input', value); this.emitChange(value); this.$emit('checked-change', allNodes); this.isSilentBlur = true; this.setSoftFocus(); }, handleNodeClick: function handleNodeClick(data) { console.log('handleNodeClick', data); if (this.multiple || data.disabled) return; this.createdLabel = data.label; this.$emit('input', data.key); this.emitChange(data.key); this.$emit('checked-change', [data.data]); this.visible = false; this.isSilentBlur = true; this.setSoftFocus(); }, setSoftFocus: function setSoftFocus() { this.softFocus = true; var input = this.$refs.input || this.$refs.reference; if (input) { input.focus(); } }, handleFocus: function handleFocus(event) { // console.log(event); if (!this.softFocus) { if (this.automaticDropdown || this.filterable) { this.visible = true; if (this.filterable) { this.menuVisibleOnFocus = true; } } this.$emit('focus', event); } else { this.softFocus = false; } }, blur: function blur() { this.visible = false; this.$refs.reference.blur(); }, handleBlur: function handleBlur(event) { var _this12 = this; setTimeout(function () { if (_this12.isSilentBlur) { _this12.isSilentBlur = false; } else { _this12.$emit('blur', event); } }, 50); this.softFocus = false; }, handleClearClick: function handleClearClick(event) { this.deleteSelected(event); } }, beforeDestroy: function beforeDestroy() { if (this.$el && this.handleResize) Object(resize_event_["removeResizeListener"])(this.$el, this.handleResize); } }); // CONCATENATED MODULE: ./packages/tree-select/src/tree-select.vue?vue&type=script&lang=js& /* harmony default export */ var src_tree_selectvue_type_script_lang_js_ = (tree_selectvue_type_script_lang_js_); // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js var componentNormalizer = __webpack_require__(1); // CONCATENATED MODULE: ./packages/tree-select/src/tree-select.vue /* normalize component */ var component = Object(componentNormalizer["a" /* default */])( src_tree_selectvue_type_script_lang_js_, render, staticRenderFns, false, null, null, null ) /* hot reload */ if (false) { var api; } component.options.__file = "packages/tree-select/src/tree-select.vue" /* harmony default export */ var tree_select = (component.exports); // CONCATENATED MODULE: ./packages/tree-select/index.js /* istanbul ignore next */ tree_select.install = function (Vue) { Vue.component(tree_select.name, tree_select); }; /* harmony default export */ var packages_tree_select = __webpack_exports__["default"] = (tree_select); /***/ }), /***/ 34: /***/ (function(module, exports) { module.exports = require("element-ui-for-gov/lib/tag"); /***/ }), /***/ 46: /***/ (function(module, exports) { module.exports = require("element-ui-for-gov/lib/mixins/focus"); /***/ }), /***/ 5: /***/ (function(module, exports) { module.exports = require("element-ui-for-gov/lib/utils/vue-popper"); /***/ }), /***/ 6: /***/ (function(module, exports) { module.exports = require("element-ui-for-gov/lib/mixins/emitter"); /***/ }), /***/ 7: /***/ (function(module, exports) { module.exports = require("element-ui-for-gov/lib/mixins/locale"); /***/ }), /***/ 8: /***/ (function(module, exports) { module.exports =