lh-chs-ui
Version:
A Component Library for Vue.js.
838 lines (774 loc) • 22.6 kB
JavaScript
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 = 3);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (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
}
}
/***/ }),
/* 1 */,
/* 2 */,
/* 3 */
/***/ (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??ref--5!./node_modules/vue-loader/lib??vue-loader-options!./packages/select/src/index.vue?vue&type=template&id=e6c544fc
var render = function render() {
var _vm = this,
_c = _vm._self._c
return _c(
"div",
[
_vm.renderComponent === "single"
? _c("select-component", {
attrs: {
disabled: _vm.disabled,
clearable: _vm.clearable,
filterable: _vm.filterable,
placeholder: _vm.placeholder,
multiple: _vm.multiple,
props: _vm.props,
options: _vm.options,
collapsetags: _vm.collapsetags,
},
on: { change: _vm.handleChange },
model: {
value: _vm.sellist,
callback: function ($$v) {
_vm.sellist = $$v
},
expression: "sellist",
},
})
: _c("select-paginations", {
attrs: {
disabled: _vm.disabled,
placeholder: _vm.placeholder,
multiple: _vm.multiple,
options: _vm.options,
props: _vm.props,
collapsetags: _vm.collapsetags,
},
on: { change: _vm.handleChange },
model: {
value: _vm.sellist,
callback: function ($$v) {
_vm.sellist = $$v
},
expression: "sellist",
},
}),
],
1
)
}
var staticRenderFns = []
render._withStripped = true
// CONCATENATED MODULE: ./packages/select/src/index.vue?vue&type=template&id=e6c544fc
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/vue-loader/lib??vue-loader-options!./packages/select/src/select.vue?vue&type=template&id=11c82c4c
var selectvue_type_template_id_11c82c4c_render = function render() {
var _vm = this,
_c = _vm._self._c
return _c(
"el-select",
{
staticStyle: { width: "100%" },
attrs: {
clearable: _vm.clearable,
disabled: _vm.disabled,
"collapse-tags": _vm.collapsetags,
multiple: _vm.multiple,
filterable: _vm.filterable,
placeholder: _vm.placeholder,
},
on: { change: _vm.handleSelChanges },
model: {
value: _vm.sellist,
callback: function ($$v) {
_vm.sellist = $$v
},
expression: "sellist",
},
},
_vm._l(_vm.options, function (item, index) {
return _c("el-option", {
key: index,
attrs: {
label: item[_vm.propsKey.label],
value: item[_vm.propsKey.value],
disabled: item.disabled,
},
})
}),
1
)
}
var selectvue_type_template_id_11c82c4c_staticRenderFns = []
selectvue_type_template_id_11c82c4c_render._withStripped = true
// CONCATENATED MODULE: ./packages/select/src/select.vue?vue&type=template&id=11c82c4c
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/select/src/select.vue?vue&type=script&lang=js
/* harmony default export */ var selectvue_type_script_lang_js = ({
// 组件名称
name: 'chs-select',
// 组件参数 接收来自父组件的数据
props: {
/**
* 是否禁用
* 默认不禁用
*/
disabled: {
type: Boolean,
default: false
},
/**
* 是否可清除数据
* 默认开启
*/
clearable: {
type: Boolean,
default: true
},
/**
* 是否允许搜索
* 默认关闭
*/
filterable: {
type: Boolean,
default: false
},
/**
* 默认输入框提示
*/
placeholder: {
type: String,
default: '请选择'
},
/**
* 下拉框选择项
*/
options: {
type: Array,
default: function _default() {
return [];
}
},
props: {
type: Object,
default: function _default() {}
},
/**
* 是否开启多选
* 默认不开启
*/
multiple: {
type: Boolean,
default: false
},
/**
* 开启多选时,输入框展示文字或者+
* 默认 + 号
*/
collapsetags: {
type: Boolean,
default: true
},
value: {
type: [String, Array, Number, Boolean],
default: ''
}
},
computed: {
propsKey: function propsKey() {
var config = this.props || {};
var props = {
label: config.label || 'label',
value: config.value || 'value'
};
return props;
}
},
// 组件状态值
data: function data() {
return {
sellist: null
};
},
watch: {
value: {
handler: function handler(val) {
this.sellist = val;
},
immediate: true
}
},
methods: {
handleSelChanges: function handleSelChanges(val) {
this.$emit('input', this.sellist);
this.$emit('change', val);
}
}
});
// CONCATENATED MODULE: ./packages/select/src/select.vue?vue&type=script&lang=js
/* harmony default export */ var src_selectvue_type_script_lang_js = (selectvue_type_script_lang_js);
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(0);
// CONCATENATED MODULE: ./packages/select/src/select.vue
/* normalize component */
var component = Object(componentNormalizer["a" /* default */])(
src_selectvue_type_script_lang_js,
selectvue_type_template_id_11c82c4c_render,
selectvue_type_template_id_11c82c4c_staticRenderFns,
false,
null,
null,
null
)
/* harmony default export */ var src_select = (component.exports);
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/vue-loader/lib??vue-loader-options!./packages/select/src/select-pagination.vue?vue&type=template&id=3471a596
var select_paginationvue_type_template_id_3471a596_render = function render() {
var _vm = this,
_c = _vm._self._c
return _c(
"el-select",
{
staticStyle: { width: "100%" },
attrs: {
multiple: _vm.multiple,
filterable: "",
"popper-class": "select-options",
remote: "",
clearable: "",
disabled: _vm.disabled,
"collapse-tags": _vm.collapsetags,
"reserve-keyword": "",
placeholder: "请输入关键词",
"remote-method": _vm.remoteMethod,
loading: _vm.loading,
},
on: { change: _vm.handleSelChanges },
model: {
value: _vm.sellist,
callback: function ($$v) {
_vm.sellist = $$v
},
expression: "sellist",
},
},
[
_vm._l(_vm.data.records, function (item) {
return _c("el-option", {
key: item.value,
staticClass: "cus-li",
attrs: {
label: item.label,
disabled: item.disabled,
value: item.value,
},
})
}),
_c(
"div",
{ staticClass: "sel-cus-footer" },
[
_c("el-pagination", {
attrs: {
small: "",
layout: "prev, pager, next",
"current-page": _vm.data.current,
"page-size": 10,
total: _vm.data.total,
"pager-count": 5,
},
on: { "current-change": _vm.handleCurrentChange },
}),
],
1
),
],
2
)
}
var select_paginationvue_type_template_id_3471a596_staticRenderFns = []
select_paginationvue_type_template_id_3471a596_render._withStripped = true
// CONCATENATED MODULE: ./packages/select/src/select-pagination.vue?vue&type=template&id=3471a596
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/select/src/select-pagination.vue?vue&type=script&lang=js
/* harmony default export */ var select_paginationvue_type_script_lang_js = ({
// 组件名称
name: 'select-pagination',
// 组件参数 接收来自父组件的数据
props: {
disabled: {
default: false
},
/**
* 开启多选时,输入框展示文字或者+
* 默认 + 号
*/
collapsetags: {
type: Boolean,
default: true
},
multiple: {
default: false
},
/**
* 下拉框选择项
*/
options: {
type: Array,
default: function _default() {
return [];
}
},
props: {
type: Object,
default: function _default() {}
},
value: {
type: [String, Number, Array, Boolean],
default: ''
}
},
// 组件状态值
data: function data() {
return {
sourceOptions: [],
data: {
records: [],
current: 1,
total: 0
},
currentOptions: [],
loading: false,
sellist: []
};
},
computed: {
propsKey: function propsKey() {
var config = this.props || {};
var props = {
label: config.label || 'label',
value: config.value || 'value'
};
return props;
}
},
// 侦听器
watch: {
value: {
handler: function handler(newValue) {
this.sellist = newValue;
if (!newValue || JSON.stringify(newValue) === '[]') {
this.renderAllList();
} else {
var currentIndex = this.currentOptions.findIndex(function (v) {
return v.value === newValue;
});
if (currentIndex !== -1) {
var current = Math.ceil((currentIndex + 1) / 10);
if (current === this.data.current) {
return;
}
this.data = {
records: [],
current: current,
total: this.currentOptions.length
};
this.renderList();
}
}
},
immediate: true
},
options: {
handler: function handler(val) {
this.getOptions();
},
immediate: true
}
},
// 组件方法
methods: {
handleSelChanges: function handleSelChanges(val) {
this.$emit('input', this.sellist);
this.$emit('change', val, this.data.records);
},
renderList: function renderList() {
var current = this.data.current * 10;
var beforeCurrent = 0;
if (this.data.current > 1) {
beforeCurrent = (this.data.current - 1) * 10;
}
this.data.records = this.currentOptions.slice(beforeCurrent, current);
},
remoteMethod: function remoteMethod(query) {
if (query !== '') {
this.loading = true;
this.currentOptions = this.sourceOptions.filter(function (v) {
return v.label.indexOf(query) > -1;
});
this.data = {
records: [],
current: 1,
total: this.currentOptions.length
};
this.renderList();
this.loading = false;
} else {
this.renderAllList();
}
},
renderAllList: function renderAllList() {
this.currentOptions = this.sourceOptions;
this.data = {
records: [],
current: 1,
total: this.currentOptions.length
};
this.renderList();
},
getOptions: function getOptions() {
var _this = this;
this.sourceOptions = this.options.map(function (item) {
return {
label: item[_this.propsKey.value] + '-' + item[_this.propsKey.label],
value: item[_this.propsKey.value]
};
});
if (this.sellist && JSON.stringify(this.sellist) !== '[]') {
var sellId = Array.isArray(this.sellist) ? this.sellist[0] : this.sellist;
this.sourceOptions.forEach(function (v, i) {
if (v.value === sellId) {
_this.currentOptions = _this.sourceOptions;
_this.data = {
records: [],
current: Math.ceil((i + 1) / 10),
total: _this.currentOptions.length
};
_this.renderList();
}
});
} else {
this.renderAllList();
}
},
handleCurrentChange: function handleCurrentChange(val) {
this.data.current = val;
this.renderList();
}
}
});
// CONCATENATED MODULE: ./packages/select/src/select-pagination.vue?vue&type=script&lang=js
/* harmony default export */ var src_select_paginationvue_type_script_lang_js = (select_paginationvue_type_script_lang_js);
// CONCATENATED MODULE: ./packages/select/src/select-pagination.vue
/* normalize component */
var select_pagination_component = Object(componentNormalizer["a" /* default */])(
src_select_paginationvue_type_script_lang_js,
select_paginationvue_type_template_id_3471a596_render,
select_paginationvue_type_template_id_3471a596_staticRenderFns,
false,
null,
null,
null
)
/* harmony default export */ var select_pagination = (select_pagination_component.exports);
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/select/src/index.vue?vue&type=script&lang=js
/* harmony default export */ var srcvue_type_script_lang_js = ({
// 组件名称
name: 'chs-select',
components: {
selectComponent: src_select,
selectPaginations: select_pagination
},
props: {
/**
* 是否禁用
* 默认不禁用
*/
disabled: {
type: Boolean,
default: false
},
/**
* 是否可清除数据
* 默认开启
*/
clearable: {
type: Boolean,
default: true
},
/**
* 是否允许搜索
* 默认关闭
*/
filterable: {
type: Boolean,
default: false
},
/**
* 默认输入框提示
*/
placeholder: {
type: String,
default: '请选择'
},
props: {
type: Object,
default: function _default() {}
},
/**
* 下拉框选择项
*/
options: {
type: Array,
default: function _default() {
return [];
}
},
/**
* 是否开启多选
* 默认不开启
*/
multiple: {
type: Boolean,
default: false
},
/**
* 开启多选时,输入框展示文字或者+
* 默认 + 号
*/
collapsetags: {
type: Boolean,
default: true
},
value: {
type: [String, Array, Number, Boolean],
default: ''
}
},
// 组件状态值
data: function data() {
return {
sellist: null
};
},
computed: {
renderComponent: function renderComponent() {
if (this.options && this.options.length && this.options.length > 20) {
return 'multiple';
} else {
return 'single';
}
}
},
watch: {
value: {
handler: function handler(val) {
this.sellist = val;
},
immediate: true
}
},
methods: {
handleChange: function handleChange(val) {
this.$emit('input', this.sellist);
this.$emit('change', val);
}
}
});
// CONCATENATED MODULE: ./packages/select/src/index.vue?vue&type=script&lang=js
/* harmony default export */ var select_srcvue_type_script_lang_js = (srcvue_type_script_lang_js);
// CONCATENATED MODULE: ./packages/select/src/index.vue
/* normalize component */
var src_component = Object(componentNormalizer["a" /* default */])(
select_srcvue_type_script_lang_js,
render,
staticRenderFns,
false,
null,
null,
null
)
/* harmony default export */ var src = (src_component.exports);
// CONCATENATED MODULE: ./packages/select/index.js
/* istanbul ignore next */
src.install = function (Vue) {
Vue.component(src.name, src);
};
/* harmony default export */ var packages_select = __webpack_exports__["default"] = (src);
/***/ })
/******/ ]);