UNPKG

element-ui-for-gov

Version:

element-ui for gov

824 lines (746 loc) 23 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 = 317); /******/ }) /************************************************************************/ /******/ ({ /***/ 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 } } /***/ }), /***/ 31: /***/ (function(module, exports) { module.exports = require("element-ui-for-gov/lib/tree"); /***/ }), /***/ 317: /***/ (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-dialog/src/main.vue?vue&type=template&id=52241400& var render = function() { var _vm = this var _h = _vm.$createElement var _c = _vm._self._c || _h return _c( "div", { staticClass: "el-tree-dialog" }, [ _c( "el-dialog", { attrs: { "append-to-body": true, title: _vm.title, visible: _vm.visible, "custom-class": "custom-dialog" }, on: { close: _vm.close } }, [ _c( "el-row", { attrs: { gutter: 20 } }, [ _c( "el-col", { staticClass: "el-tree-dialog__col", attrs: { span: 12 } }, [ _c("div", { staticClass: "el-tree-dialog__head" }, [ _vm._v("待选") ]), _c("el-input", { staticClass: "el-tree-dialog__input", attrs: { placeholder: "输入关键字进行过滤" }, model: { value: _vm.filterUncheckText, callback: function($$v) { _vm.filterUncheckText = $$v }, expression: "filterUncheckText" } }), _c( "div", { staticClass: "el-tree-dialog__content" }, [ _c("el-tree", { ref: "tree", staticClass: "el-tree-dialog__tree", attrs: { "filter-node-method": _vm.filterNode, data: _vm.data, lazy: _vm.lazy, load: _vm.load, "render-content": _vm.renderWrapContent(), "check-strictly": _vm.checkStrictly, "default-expanded-keys": _vm.defaultExpandedKeys, "default-checked-keys": _vm.defaultCheckedKeys, "show-checkbox": _vm.showCheckbox, "node-key": "id" }, on: { "check-change": _vm.checkChange, "node-click": _vm.nodeClick } }) ], 1 ) ], 1 ), _c( "el-col", { staticClass: "el-tree-dialog__col", attrs: { span: 12 } }, [ _c("div", { staticClass: "el-tree-dialog__head" }, [ _vm._v("已选") ]), _c("el-input", { staticClass: "el-tree-dialog__input", attrs: { placeholder: "输入关键字进行过滤" }, model: { value: _vm.filterCheckText, callback: function($$v) { _vm.filterCheckText = $$v }, expression: "filterCheckText" } }), _c("div", { staticClass: "el-tree-dialog__content" }, [ _c( "div", { ref: "nodes", staticClass: "el-tree-dialog__nodes" }, [ _vm._l(_vm.filterCheckNodes, function(i, index) { return [ _c( "div", { key: "" + i.id + index, staticClass: "el-tree-dialog__node" }, [ _c( "span", { staticClass: "el-tree-dialog__node__label", attrs: { title: i.label } }, [_vm._v(_vm._s(i.label))] ), _c("span", { staticClass: "el-icon-close el-tree-dialog__node__icon", on: { click: function($event) { _vm.cancelCheck(i) } } }) ] ) ] }), _vm._l(_vm.placeNodes, function(i, index) { return [ _c("div", { key: index, staticClass: "el-tree-dialog__placenode" }) ] }) ], 2 ) ]) ], 1 ) ], 1 ), _c( "span", { staticClass: "dialog-footer", attrs: { slot: "footer" }, slot: "footer" }, [ _c("el-button", { on: { click: _vm.clickDialogDisable } }, [ _vm._v(_vm._s(this.cancelText)) ]), _c( "el-button", { attrs: { type: "primary" }, on: { click: _vm.clickDialogConfirm } }, [_vm._v(_vm._s(this.confirmText))] ) ], 1 ) ], 1 ) ], 1 ) } var staticRenderFns = [] render._withStripped = true // CONCATENATED MODULE: ./packages/tree-dialog/src/main.vue?vue&type=template&id=52241400& // EXTERNAL MODULE: external "element-ui-for-gov/lib/dialog" var dialog_ = __webpack_require__(42); var dialog_default = /*#__PURE__*/__webpack_require__.n(dialog_); // 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/row" var row_ = __webpack_require__(43); var row_default = /*#__PURE__*/__webpack_require__.n(row_); // EXTERNAL MODULE: external "element-ui-for-gov/lib/col" var col_ = __webpack_require__(36); var col_default = /*#__PURE__*/__webpack_require__.n(col_); // EXTERNAL MODULE: external "element-ui-for-gov/lib/button" var button_ = __webpack_require__(9); var button_default = /*#__PURE__*/__webpack_require__.n(button_); // EXTERNAL MODULE: external "element-ui-for-gov/lib/radio" var radio_ = __webpack_require__(32); var radio_default = /*#__PURE__*/__webpack_require__.n(radio_); // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/tree-dialog/src/main.vue?vue&type=script&lang=js& // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /* harmony default export */ var mainvue_type_script_lang_js_ = ({ name: 'ElTreeDialog', components: { ElDialog: dialog_default.a, ElTree: tree_default.a, ElInput: input_default.a, ElRow: row_default.a, ElCol: col_default.a, ElButton: button_default.a, Radio: radio_default.a }, props: { title: { type: String, default: '选择用户组' }, visible: { type: Boolean, default: false }, data: { type: Array }, renderContent: { type: Function }, clickDisable: { type: Function }, clickConfirm: { type: Function, default: function _default() { return function () {}; } }, checkStrictly: { type: Boolean, default: function _default() { return false; } }, defaultExpandedKeys: { type: Array, default: function _default() { return []; } }, defaultCheckedKeys: { type: Array, default: function _default() { return []; } }, getLeafOnly: { type: Boolean, default: function _default() { return false; } }, showCheckbox: { type: Boolean, default: function _default() { return true; } }, lazy: { type: Boolean, default: false }, load: { type: Function, default: function _default() { return function () {}; } }, cancelText: { type: String, default: '取消' }, confirmText: { type: String, default: '确定' } }, data: function data() { return { radio: '', radioNode: {}, filterUncheckText: '', filterCheckText: '', currentNodes: [] }; }, mounted: function mounted() { var _this = this; this.$nextTick(function () { if (!_this.showCheckbox) { _this.radio = _this.defaultCheckedKeys[0]; var node = _this.findNode(_this.radio, _this.data || []) || {}; _this.radioNode = node; _this.currentNodes = [node]; } }); }, methods: { stopRadio: function stopRadio(e) { e.stopPropagation(); }, renderWrapContent: function renderWrapContent() { var _this2 = this; var h = this.$createElement; if (this.renderContent && typeof this.renderContent === 'function') { return function (h, _ref) { var node = _ref.node, data = _ref.data, store = _ref.store; return h( 'span', { 'class': 'wrap-tree-node' }, [!_this2.showCheckbox && h(radio_default.a, { nativeOn: { 'click': _this2.stopRadio }, attrs: { value: _this2.radio, label: data.id }, on: { 'input': _this2.$_handleRadio } }), _this2.renderContent(h, { node: node, data: data, store: store })] ); }; } else { return function (h, _ref2) { var node = _ref2.node, data = _ref2.data, store = _ref2.store; return h( 'span', { 'class': 'wrap-tree-node' }, [!_this2.showCheckbox && h(radio_default.a, { nativeOn: { 'click': _this2.stopRadio }, attrs: { value: _this2.radio, label: data.id }, on: { 'input': _this2.$_handleRadio } }), h('span', { 'class': 'el-icon-folder wrap-tree-node__icon' }), h('span', [node.label])] ); }; } }, findNode: function findNode(id, array) { for (var i = 0; i < array.length; i++) { if (array[i].id === id) { return array[i]; } if (array[i].children && array[i].children.length) { return this.findNode(id, array[i].children); } } }, close: function close() { this.$emit('update:visible', false); }, getNodes: function getNodes() { if (!this.showCheckbox) { return this.radioNode; } var tree = this.$refs.tree; var nodes = tree && tree.getCheckedNodes(this.getLeafOnly); return nodes; }, filterNode: function filterNode(value, data) { if (!value) return true; return data.label.indexOf(value) !== -1; }, checkChange: function checkChange() { this.currentNodes = this.getNodes(); for (var _len = arguments.length, value = Array(_len), _key = 0; _key < _len; _key++) { value[_key] = arguments[_key]; } this.$emit.apply(this, ['check-change'].concat(value)); }, nodeClick: function nodeClick() { for (var _len2 = arguments.length, value = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { value[_key2] = arguments[_key2]; } this.$emit.apply(this, ['node-click'].concat(value)); }, clickDialogDisable: function clickDialogDisable() { if (this.clickDisable && typeof this.clickDisable === 'function') { this.clickDisable(); return; } this.close(); }, clickDialogConfirm: function clickDialogConfirm() { if (this.clickConfirm && typeof this.clickConfirm === 'function') { this.clickConfirm(this.getNodes()); } this.close(); }, cancelCheck: function cancelCheck(node) { if (!this.showCheckbox) { this.radio = ''; this.radioNode = {}; this.currentNodes = []; } else { this.$refs.tree && this.$refs.tree.setChecked(node.id, false); this.currentNodes = this.getNodes(); } }, $_handleRadio: function $_handleRadio(value) { this.radio = value; var node = {}; try { node = this.$refs.tree && this.$refs.tree.getNode(value).data || {}; } catch (e) { console.log(e); } this.radioNode = node; this.currentNodes = [node]; this.$emit('check-change', node); } }, computed: { filterCheckNodes: function filterCheckNodes() { var _this3 = this; return this.currentNodes.filter(function (item) { return item.label && item.label.indexOf(_this3.filterCheckText) !== -1; }); }, placeNodes: function placeNodes() { return this.filterCheckNodes && this.filterCheckNodes.length && 3 - this.filterCheckNodes.length % 3; } }, watch: { filterUncheckText: function filterUncheckText(val) { this.$refs.tree.filter(val); } } }); // CONCATENATED MODULE: ./packages/tree-dialog/src/main.vue?vue&type=script&lang=js& /* harmony default export */ var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_); // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js var componentNormalizer = __webpack_require__(1); // CONCATENATED MODULE: ./packages/tree-dialog/src/main.vue /* normalize component */ var component = Object(componentNormalizer["a" /* default */])( src_mainvue_type_script_lang_js_, render, staticRenderFns, false, null, null, null ) /* hot reload */ if (false) { var api; } component.options.__file = "packages/tree-dialog/src/main.vue" /* harmony default export */ var main = (component.exports); // CONCATENATED MODULE: ./packages/tree-dialog/index.js /* istanbul ignore next */ main.install = function (Vue) { Vue.component(main.name, main); }; /* harmony default export */ var tree_dialog = __webpack_exports__["default"] = (main); /***/ }), /***/ 32: /***/ (function(module, exports) { module.exports = require("element-ui-for-gov/lib/radio"); /***/ }), /***/ 36: /***/ (function(module, exports) { module.exports = require("element-ui-for-gov/lib/col"); /***/ }), /***/ 42: /***/ (function(module, exports) { module.exports = require("element-ui-for-gov/lib/dialog"); /***/ }), /***/ 43: /***/ (function(module, exports) { module.exports = require("element-ui-for-gov/lib/row"); /***/ }), /***/ 8: /***/ (function(module, exports) { module.exports = require("element-ui-for-gov/lib/input"); /***/ }), /***/ 9: /***/ (function(module, exports) { module.exports = require("element-ui-for-gov/lib/button"); /***/ }) /******/ });