From 80edd74f61788a728d45abffe034f33c83fa38c5 Mon Sep 17 00:00:00 2001 From: zollero Date: Tue, 19 Dec 2017 15:33:44 +0800 Subject: [PATCH] remove props keys of forms and columns --- lib/el-search-table-pagination.common.js | 259 +++++++++--------- lib/index.js | 2 +- lib/search-table-pagination.js | 259 +++++++++--------- lib/search.js | 128 ++++----- package.json | 2 +- packages/search-table-pagination/src/main.vue | 6 +- packages/search-table-pagination/src/props.js | 118 ++++---- packages/search/src/main.vue | 4 +- packages/search/src/props.js | 122 ++++----- 9 files changed, 449 insertions(+), 451 deletions(-) diff --git a/lib/el-search-table-pagination.common.js b/lib/el-search-table-pagination.common.js index f3497f3..5672348 100644 --- a/lib/el-search-table-pagination.common.js +++ b/lib/el-search-table-pagination.common.js @@ -221,59 +221,59 @@ var formProps = exports.formProps = { }, forms: { type: Array, - required: true, - label: String, - prop: { - type: [String, Array], - required: true - }, - itemType: { - type: String, - default: 'input', - validator: itemTypeValidator - }, - size: { - type: String, - default: '', - validator: sizeValidator - }, - placeholder: { - type: String, - default: '' - }, - editable: { - type: Boolean, - default: true - }, - disabled: { - type: Boolean, - default: false - }, - readonly: { - type: Boolean, - default: false - }, - fuzzy: { - type: Boolean, - default: false - }, - options: Array, - selectFetch: Function, - selectResultField: String, - selectResultHandler: Function, - selectUrl: String, - selectMethod: String, - valueKey: String, - labelKey: String, - format: Function, - selectParams: { - type: Object, - default: function _default() { - return {}; - } - }, - rules: Array, - pickerOptions: Object + required: true + // label: String, + // prop: { + // type: [String, Array], + // required: true + // }, + // itemType: { + // type: String, + // default: 'input', + // validator: itemTypeValidator + // }, + // size: { + // type: String, + // default: '', + // validator: sizeValidator + // }, + // placeholder: { + // type: String, + // default: '' + // }, + // editable: { + // type: Boolean, + // default: true + // }, + // disabled: { + // type: Boolean, + // default: false + // }, + // readonly: { + // type: Boolean, + // default: false + // }, + // fuzzy: { + // type: Boolean, + // default: false + // }, + // options: Array, + // selectFetch: Function, + // selectResultField: String, + // selectResultHandler: Function, + // selectUrl: String, + // selectMethod: String, + // valueKey: String, + // labelKey: String, + // format: Function, + // selectParams: { + // type: Object, + // default: () => { + // return {} + // } + // }, + // rules: Array, + // pickerOptions: Object } }; @@ -286,14 +286,14 @@ function sizeValidator(value) { return valid; } -function itemTypeValidator(value) { - var methodTypes = ['input', 'select', 'date', 'daterange']; - var valid = methodTypes.indexOf(value.toLowerCase()) !== -1; - if (!valid) { - throw new Error('ItemType must be one of [\'input\', \'select\', \'date\', \'daterange\']'); - } - return valid; -} +// function itemTypeValidator(value) { +// const methodTypes = ['input', 'select', 'date', 'daterange']; +// const valid = methodTypes.indexOf(value.toLowerCase()) !== -1 +// if (!valid) { +// throw new Error(`ItemType must be one of ['input', 'select', 'date', 'daterange']`) +// } +// return valid +// } /***/ }), /* 2 */ @@ -303,7 +303,7 @@ function itemTypeValidator(value) { Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue__ = __webpack_require__(10); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_a5e9fc3c_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__ = __webpack_require__(11); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_5b9d566d_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__ = __webpack_require__(11); var normalizeComponent = __webpack_require__(0) /* script */ @@ -319,7 +319,7 @@ var __vue_scopeId__ = null var __vue_module_identifier__ = null var Component = normalizeComponent( __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue___default.a, - __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_a5e9fc3c_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__["a" /* default */], + __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_5b9d566d_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__["a" /* default */], __vue_template_functional__, __vue_styles__, __vue_scopeId__, @@ -418,7 +418,7 @@ exports.default = _main2.default; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_e5d62ac6_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__ = __webpack_require__(12); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_3561beac_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__ = __webpack_require__(12); var normalizeComponent = __webpack_require__(0) /* script */ @@ -434,7 +434,7 @@ var __vue_scopeId__ = null var __vue_module_identifier__ = null var Component = normalizeComponent( __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue___default.a, - __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_e5d62ac6_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__["a" /* default */], + __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_3561beac_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__["a" /* default */], __vue_template_functional__, __vue_styles__, __vue_scopeId__, @@ -643,19 +643,19 @@ exports.default = { } var totalValue = response; - if (totalField && totalField.indexOf('.') !== -1) { + if (response[totalField] && totalField && totalField.indexOf('.') !== -1) { totalField.split('.').forEach(function (vv) { totalValue = totalValue[vv]; }); } else { - totalValue = response[totalField] || result.length; + totalValue = response && response[totalField] || result.length; } _this2.total = totalValue; _this2.loading = false; }).catch(function (error) { - console.error('Get remote data failed. ', error); + // console.error('Get remote data failed. ', error) _this2.loading = false; }); }, @@ -936,62 +936,62 @@ var props = { }, columns: { type: Array, - required: true, - // Element UI table-column attribute - columnKey: String, - label: { - type: String, - required: true - }, - prop: { - type: String, - required: true - }, - width: Number, - minWidth: Number, - fixed: [Boolean, String], - renderHeader: Function, - sortable: [Boolean, String], - sortMethod: Function, - resizable: { - type: Boolean, - default: true - }, - formatter: Function, - showOverflowTooltip: Boolean, - align: { - type: String, - default: 'left' - }, - headerAlign: String, - className: { - type: String, - default: '' - }, - labelClassName: { - type: String, - default: '' - }, - selectable: Function, - reserveSelection: Boolean, - filters: Array, - filterPlacement: String, - filterMultiple: { - type: Boolean, - default: true - }, - filterMethod: Function, - filteredValue: Array, - // custom table-column attribute - filter: { - type: String - }, - render: { - type: Function - }, - slotName: { - type: String - } + required: true + // // Element UI table-column attribute + // columnKey: String, + // label: { + // type: String, + // required: true + // }, + // prop: { + // type: String, + // required: true + // }, + // width: Number, + // minWidth: Number, + // fixed: [Boolean, String], + // renderHeader: Function, + // sortable: [Boolean, String], + // sortMethod: Function, + // resizable: { + // type: Boolean, + // default: true + // }, + // formatter: Function, + // showOverflowTooltip: Boolean, + // align: { + // type: String, + // default: 'left' + // }, + // headerAlign: String, + // className: { + // type: String, + // default: '' + // }, + // labelClassName: { + // type: String, + // default: '' + // }, + // selectable: Function, + // reserveSelection: Boolean, + // filters: Array, + // filterPlacement: String, + // filterMultiple: { + // type: Boolean, + // default: true + // }, + // filterMethod: Function, + // filteredValue: Array, + // // custom table-column attribute + // filter: { + // type: String + // }, + // render: { + // type: Function + // }, + // slotName: { + // type: String + // } }, showPagination: { type: Boolean, @@ -1015,13 +1015,12 @@ var props = { type: String, default: 'pageSize' } -}; -Object.keys(_props.formProps).forEach(function (v) { - props.formOptions[v] = _props.formProps[v]; -}); + // Object.keys(formProps).forEach(v => { + // props.formOptions[v] = formProps[v] + // }) -exports.default = props; +};exports.default = props; /***/ }), /* 10 */ @@ -1289,7 +1288,7 @@ exports.default = { /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('el-form',{ref:"form",attrs:{"model":_vm.params,"inline":_vm.inline,"label-width":_vm.labelWidth ? (_vm.labelWidth + 'px') : ''},nativeOn:{"submit":function($event){$event.preventDefault();_vm.searchHandler()}}},[_vm._l((_vm.forms),function(form,index){return _c('el-form-item',{key:index,attrs:{"prop":form.itemType != 'daterange' ? form.prop : (_vm.datePrefix + index),"label":form.label,"rules":form.rules || [],"label-width":form.labelWidth ? (form.labelWidth + 'px') : ''}},[(form.itemType === 'input' || form.itemType === undefined)?_c('el-input',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"size":form.size ? form.size : _vm.size,"readonly":form.readonly,"disabled":form.disabled,"placeholder":form.placeholder},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}}):(form.itemType === 'select')?_c('el-select',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"size":form.size ? form.size : _vm.size,"disabled":form.disabled,"placeholder":form.placeholder},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}},[_vm._l((form.options),function(option,optionIndex){return _c('el-option',{key:optionIndex,attrs:{"value":(typeof option === 'object') ? option[form.valueKey || 'value'] : option,"label":(typeof option === 'object') ? option[form.labelKey || 'label'] : option}})}),_vm._l((_vm.selectOptions[_vm.selectOptionPrefix + index]),function(op,opIndex){return _c('el-option',{key:opIndex,attrs:{"value":(typeof op === 'object') ? op[form.valueKey || 'value'] : op,"label":(typeof op === 'object') ? op[form.labelKey || 'label'] : op}})})],2):(form.itemType === 'date')?_c('el-date-picker',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"type":"date","placeholder":form.placeholder,"size":form.size ? form.size : _vm.size,"disabled":form.disabled,"readonly":form.readonly,"editable":form.editable,"picker-options":form.pickerOptions || {}},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}}):(form.itemType === 'daterange')?_c('el-date-picker',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"size":form.size ? form.size : _vm.size,"type":"daterange","disabled":form.disabled,"readonly":form.readonly,"editable":form.editable,"placeholder":form.placeholder,"picker-options":form.pickerOptions || {}},on:{"change":function (date) { return _vm.changeDate(date, form.prop[0], form.prop[1]); }},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}}):_vm._e()],1)}),_c('el-form-item',{attrs:{"label":""}},[_c('el-button',{attrs:{"type":"primary","size":_vm.size,"loading":_vm.submitLoading},on:{"click":_vm.searchHandler}},[_vm._v("\n "+_vm._s(_vm.submitBtnText)+"\n ")]),(_vm.showResetBtn)?_c('el-button',{attrs:{"type":"primary","plain":true,"size":_vm.size,"loading":_vm.submitLoading},on:{"click":_vm.resetForm}},[_vm._v("\n "+_vm._s(_vm.resetBtnText)+"\n ")]):_vm._e()],1)],2)} +var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('el-form',{ref:"form",attrs:{"model":_vm.params,"inline":_vm.inline,"label-width":_vm.labelWidth ? (_vm.labelWidth + 'px') : ''},nativeOn:{"submit":function($event){$event.preventDefault();_vm.searchHandler()}}},[_vm._l((_vm.forms),function(form,index){return _c('el-form-item',{key:index,attrs:{"prop":form.itemType != 'daterange' ? form.prop : (_vm.datePrefix + index),"label":form.label,"rules":form.rules || [],"label-width":form.labelWidth ? (form.labelWidth + 'px') : ''}},[(form.itemType === 'input' || form.itemType === undefined)?_c('el-input',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"size":form.size ? form.size : _vm.size,"readonly":form.readonly,"disabled":form.disabled,"placeholder":form.placeholder},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}}):(form.itemType === 'select')?_c('el-select',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"size":form.size ? form.size : _vm.size,"disabled":form.disabled,"placeholder":form.placeholder},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}},[_vm._l((form.options),function(option,optionIndex){return _c('el-option',{key:optionIndex + '_local',attrs:{"value":(typeof option === 'object') ? option[form.valueKey || 'value'] : option,"label":(typeof option === 'object') ? option[form.labelKey || 'label'] : option}})}),_vm._l((_vm.selectOptions[_vm.selectOptionPrefix + index]),function(op,opIndex){return _c('el-option',{key:opIndex + '_remote',attrs:{"value":(typeof op === 'object') ? op[form.valueKey || 'value'] : op,"label":(typeof op === 'object') ? op[form.labelKey || 'label'] : op}})})],2):(form.itemType === 'date')?_c('el-date-picker',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"type":"date","placeholder":form.placeholder,"size":form.size ? form.size : _vm.size,"disabled":form.disabled,"readonly":form.readonly,"editable":form.editable,"picker-options":form.pickerOptions || {}},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}}):(form.itemType === 'daterange')?_c('el-date-picker',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"size":form.size ? form.size : _vm.size,"type":"daterange","disabled":form.disabled,"readonly":form.readonly,"editable":form.editable,"placeholder":form.placeholder,"picker-options":form.pickerOptions || {}},on:{"change":function (date) { return _vm.changeDate(date, form.prop[0], form.prop[1]); }},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}}):_vm._e()],1)}),_c('el-form-item',{attrs:{"label":""}},[_c('el-button',{attrs:{"type":"primary","size":_vm.size,"loading":_vm.submitLoading},on:{"click":_vm.searchHandler}},[_vm._v("\n "+_vm._s(_vm.submitBtnText)+"\n ")]),(_vm.showResetBtn)?_c('el-button',{attrs:{"type":"primary","plain":true,"size":_vm.size,"loading":_vm.submitLoading},on:{"click":_vm.resetForm}},[_vm._v("\n "+_vm._s(_vm.resetBtnText)+"\n ")]):_vm._e()],1)],2)} var staticRenderFns = [] var esExports = { render: render, staticRenderFns: staticRenderFns } /* harmony default export */ __webpack_exports__["a"] = (esExports); diff --git a/lib/index.js b/lib/index.js index db6aa1d..c7df80e 100644 --- a/lib/index.js +++ b/lib/index.js @@ -3,4 +3,4 @@ * Copyright(c) 2017 zollero * MIT Licensed */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("vue")):"function"==typeof define&&define.amd?define("EL-SEARCH-TABLE-PAGINATION",["vue"],t):"object"==typeof exports?exports["EL-SEARCH-TABLE-PAGINATION"]=t(require("vue")):e["EL-SEARCH-TABLE-PAGINATION"]=t(e.Vue)}("undefined"!=typeof self?self:this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=10)}([function(e,t,n){"use strict";function r(e){return"[object Array]"===O.call(e)}function o(e){return"[object ArrayBuffer]"===O.call(e)}function a(e){return"undefined"!=typeof FormData&&e instanceof FormData}function i(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function s(e){return"string"==typeof e}function l(e){return"number"==typeof e}function u(e){return void 0===e}function c(e){return null!==e&&"object"==typeof e}function f(e){return"[object Date]"===O.call(e)}function d(e){return"[object File]"===O.call(e)}function p(e){return"[object Blob]"===O.call(e)}function h(e){return"[object Function]"===O.call(e)}function m(e){return c(e)&&h(e.pipe)}function g(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function y(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function b(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function v(e,t){if(null!==e&&void 0!==e)if("object"==typeof e||r(e)||(e=[e]),r(e))for(var n=0,o=e.length;n=200&&e<300}};s.headers={common:{Accept:"application/json, text/plain, */*"}},o.forEach(["delete","get","head"],function(e){s.headers[e]={}}),o.forEach(["post","put","patch"],function(e){s.headers[e]=o.merge(i)}),e.exports=s}).call(t,n(26))},function(e,t){e.exports=function(e,t,n,r,o,a){var i,s=e=e||{},l=typeof e.default;"object"!==l&&"function"!==l||(i=e,s=e.default);var u="function"==typeof s?s.options:s;t&&(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0),n&&(u.functional=!0),o&&(u._scopeId=o);var c;if(a?(c=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),r&&r.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},u._ssrRegister=c):r&&(c=r),c){var f=u.functional,d=f?u.render:u.beforeCreate;f?(u._injectStyles=c,u.render=function(e,t){return c.call(t),d(e,t)}):u.beforeCreate=d?[].concat(d,c):[c]}return{esModule:i,exports:s,options:u}}},function(e,t,n){"use strict";function r(e){var t=["large","small","mini"],n=-1!==t.indexOf(e.toLowerCase())||""===e;if(!n)throw new Error("Size must be one of ['large', 'small', 'mini']");return n}function o(e){var t=["input","select","date","daterange"],n=-1!==t.indexOf(e.toLowerCase());if(!n)throw new Error("ItemType must be one of ['input', 'select', 'date', 'daterange']");return n}t.__esModule=!0;t.formProps={size:{type:String,default:"",validator:r},showResetBtn:{type:Boolean,default:!1},inline:{type:Boolean,default:!1},fuzzy:{type:Boolean,default:!1},labelWidth:Number,itemWidth:Number,submitHandler:Function,submitLoading:{type:Boolean,default:!1},submitBtnText:{type:String,default:"查询"},resetBtnText:{type:String,default:"重置"},forms:{type:Array,required:!0,label:String,prop:{type:[String,Array],required:!0},itemType:{type:String,default:"input",validator:o},size:{type:String,default:"",validator:r},placeholder:{type:String,default:""},editable:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},fuzzy:{type:Boolean,default:!1},options:Array,selectFetch:Function,selectResultField:String,selectResultHandler:Function,selectUrl:String,selectMethod:String,valueKey:String,labelKey:String,format:Function,selectParams:{type:Object,default:function(){return{}}},rules:Array,pickerOptions:Object}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(17),o=n.n(r),a=n(18),i=n(2),s=i(o.a,a.a,!1,null,null,null);t.default=s.exports},function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r1&&void 0!==arguments[1]?arguments[1]:{};c.map(function(t){e.component(t.name,t)}),t.axios||(t.axios=n(22),t.axios.interceptors.response.use(function(e){return JSON.parse(JSON.stringify(e.data))},function(e){return Promise.reject(e.response)})),e.prototype.$axios=t.axios};"undefined"!=typeof window&&window.Vue&&f(window.Vue),t.default={version:u.default.version,install:f,SearchTablePagination:a.default,SearchForm:s.default}},function(e,t,n){"use strict";t.__esModule=!0;var r=n(13),o=function(e){return e&&e.__esModule?e:{default:e}}(r);o.default.install=function(e){e.component(o.default.name,o.default)},t.default=o.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(14),o=n.n(r),a=n(19),i=n(2),s=i(o.a,a.a,!1,null,null,null);t.default=s.exports},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=n(15),a=r(o),i=n(16),s=r(i),l=n(4),u=r(l);t.default={name:"ElSearchTablePagination",components:{searchForm:u.default},props:s.default,data:function(){var e=this;return{Vue:a.default,pagination:{pageIndex:1,pageSize:function(){var t=e.pageSizes;return t.length>0?t[0]:20}()},total:0,loading:!1,tableData:[],cacheLocalData:[]}},computed:{newSlotScope:function(){return Number(a.default.version.replace(/\./g,""))>=250}},methods:{handleSizeChange:function(e){this.pagination.pageSize=e,this.dataChangeHandler()},handleCurrentChange:function(e){this.pagination.pageIndex=e,this.dataChangeHandler()},searchHandler:function(){this.pagination.pageIndex=1,this.dataChangeHandler(arguments[0])},dataChangeHandler:function(){var e=this.type;"local"===e?this.dataFilterHandler(arguments[0]):"remote"===e&&this.fetchHandler(arguments[0])},dataFilter:function(e){var t=this.pagination,n=t.pageIndex,r=t.pageSize;return e.filter(function(e,t){return t>=(n-1)*r&&t0){var s=t.filter(function(e){var t=[];return a.forEach(function(n){"number"==typeof e[n]?t.push(i[n]?-1!==String(e[n]).indexOf(String(o[n])):String(e[n])===String(o[n])):t.push(i[n]?-1!==e[n].indexOf(o[n]):e[n]===o[n])}),t.every(function(e){return e})});this.tableData=this.dataFilter(s),this.total=s.length}else this.total=t.length,this.tableData=this.dataFilter(t)},fetchHandler:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.loading=!0;var n=this.fetch,r=this.method,o=this.url,a=this.$axios,i=this.headers,s=this.listField,l=this.pageIndexKey,u=this.pageSizeKey,c=this.totalField,f=this.params,d=this.showPagination,p=this.pagination;if(f=JSON.parse(JSON.stringify(Object.assign(f,t))),d){var h;f=Object.assign(f,(h={},h[l]=p.pageIndex,h[u]=p.pageSize,h))}var m=null;n?m=n(f):(a.interceptors.request.use(function(e){return Object.keys(i).forEach(function(t){e.headers[t]=i[t]}),e},function(e){return Promise.reject(e)}),r=r.toLowerCase(),m="get"===r?a[r](o,{params:f}):a[r](o,f)),m.then(function(t){var n=t;if(!t||t instanceof Array||(s&&-1!==s.indexOf(".")?s.split(".").forEach(function(e){n=n[e]}):n=t[s]),!(n&&n instanceof Array))throw new Error("The result of key:"+s+" is not Array.");e.dataHandler?e.tableData=n.map(e.dataHandler):e.tableData=n;var r=t;c&&-1!==c.indexOf(".")?c.split(".").forEach(function(e){r=r[e]}):r=t[c]||n.length,e.total=r,e.loading=!1}).catch(function(t){console.error("Get remote data failed. ",t),e.loading=!1})},emitEventHandler:function(e){this.$emit.apply(this,[e].concat(Array.from(arguments).slice(1)))},loadLocalData:function(e){if(!e)throw new Error("When the type is 'local', you must set attribute 'data' and 'data' must be a array.");var t=JSON.parse(JSON.stringify(e));this.tableData=this.dataFilter(t),this.cacheLocalData=t,this.total=t.length}},mounted:function(){var e=this;this.$refs.table.$on("expand",function(t,n){return e.emitEventHandler("expand",t,n)});var t=this.type,n=this.autoLoad,r=this.data,o=this.formOptions,a=this.params;"remote"===t&&n?o?this.$refs.searchForm.getParams(function(t,n){t||e.fetchHandler(Object.assign(n,a))}):this.fetchHandler(a):"local"===t&&this.loadLocalData(r)},watch:{data:function(e){this.loadLocalData(e)}}}},function(t,n){t.exports=e},function(e,t,n){"use strict";t.__esModule=!0;var r=n(3),o={height:[String,Number],maxHeight:[String,Number],stripe:Boolean,border:Boolean,fit:{type:Boolean,default:!0},showHeader:{type:Boolean,default:!0},highlightCurrentRow:Boolean,currentRowKey:[String,Number],rowClassName:[String,Function],rowStyle:[String,Function],rowKey:[String,Function],emptyText:String,defaultExpandAll:Boolean,expandRowKeys:Array,defaultSort:Object,tooltipEffect:String,showSummary:Boolean,sumText:String,summaryMethod:Function,fetch:{type:Function},url:{type:String},method:{type:String,default:"get",validator:function(e){return-1!==["get","post","put","delete"].indexOf(e.toLowerCase())}},headers:{type:Object,default:function(){return{}}},listField:{type:String,default:"data.list"},totalField:{type:String,default:"data.total"},params:{type:Object,default:function(){return{}}},formOptions:{type:Object},autoLoad:{type:Boolean,default:!0},type:{type:String,default:"remote",validator:function(e){var t=["remote","local"],n=-1!==t.indexOf(e);if(!n)throw new Error("Invalid type of '"+e+"', please set one type of 'remote' or 'local'.");return n}},data:{type:Array},dataHandler:{type:Function},columns:{type:Array,required:!0,columnKey:String,label:{type:String,required:!0},prop:{type:String,required:!0},width:Number,minWidth:Number,fixed:[Boolean,String],renderHeader:Function,sortable:[Boolean,String],sortMethod:Function,resizable:{type:Boolean,default:!0},formatter:Function,showOverflowTooltip:Boolean,align:{type:String,default:"left"},headerAlign:String,className:{type:String,default:""},labelClassName:{type:String,default:""},selectable:Function,reserveSelection:Boolean,filters:Array,filterPlacement:String,filterMultiple:{type:Boolean,default:!0},filterMethod:Function,filteredValue:Array,filter:{type:String},render:{type:Function},slotName:{type:String}},showPagination:{type:Boolean,default:!0},pageSizes:{type:Array,default:function(){return[20,50,100]}},paginationLayout:{type:String,default:"total, prev, pager, next, jumper, sizes"},pageIndexKey:{type:String,default:"pageIndex"},pageSizeKey:{type:String,default:"pageSize"}};Object.keys(r.formProps).forEach(function(e){o.formOptions[e]=r.formProps[e]}),t.default=o},function(e,t,n){"use strict";t.__esModule=!0;var r=Object.assign||function(e){for(var t=1;t",license:"MIT",bugs:{url:"https://github.com/zollero/el-search-table-pagination/issues"},homepage:"https://github.com/zollero/el-search-table-pagination#readme",peerDependencies:{"element-ui":"^2.0.7",vue:"^2.5.2"},dependencies:{axios:"^0.16.2"},devDependencies:{"babel-core":"^6.26.0","babel-loader":"^7.1.2","babel-plugin-module-resolver":"^3.0.0","babel-plugin-syntax-jsx":"^6.18.0","babel-plugin-transform-vue-jsx":"^3.5.0","babel-preset-es2015":"^6.24.1","babel-preset-stage-3":"^6.24.1",cooking:"^1.5.4","cooking-vue2":"^0.3.3","extract-text-webpack-plugin":"^3.0.2","html-webpack-plugin":"^2.30.1","vue-template-compiler":"^2.5.9",webpack:"^3.8.1","webpack-node-externals":"^1.6.0"}}},function(e,t,n){e.exports=n(23)},function(e,t,n){"use strict";function r(e){var t=new i(e),n=a(i.prototype.request,t);return o.extend(n,i.prototype,t),o.extend(n,t),n}var o=n(0),a=n(5),i=n(25),s=n(1),l=r(s);l.Axios=i,l.create=function(e){return r(o.merge(s,e))},l.Cancel=n(9),l.CancelToken=n(40),l.isCancel=n(8),l.all=function(e){return Promise.all(e)},l.spread=n(41),e.exports=l,e.exports.default=l},function(e,t){function n(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function r(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&n(e.slice(0,0))}e.exports=function(e){return null!=e&&(n(e)||r(e)||!!e._isBuffer)}},function(e,t,n){"use strict";function r(e){this.defaults=e,this.interceptors={request:new i,response:new i}}var o=n(1),a=n(0),i=n(35),s=n(36),l=n(38),u=n(39);r.prototype.request=function(e){"string"==typeof e&&(e=a.merge({url:arguments[0]},arguments[1])),e=a.merge(o,this.defaults,{method:"get"},e),e.method=e.method.toLowerCase(),e.baseURL&&!l(e.url)&&(e.url=u(e.baseURL,e.url));var t=[s,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},a.forEach(["delete","get","head","options"],function(e){r.prototype[e]=function(t,n){return this.request(a.merge(n||{},{method:e,url:t}))}}),a.forEach(["post","put","patch"],function(e){r.prototype[e]=function(t,n,r){return this.request(a.merge(r||{},{method:e,url:t,data:n}))}}),e.exports=r},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function a(e){if(f===clearTimeout)return clearTimeout(e);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function i(){m&&p&&(m=!1,p.length?h=p.concat(h):g=-1,h.length&&s())}function s(){if(!m){var e=o(i);m=!0;for(var t=h.length;t;){for(p=h,h=[];++g1)for(var n=1;n>8-s%1*8)){if((n=o.charCodeAt(s+=.75))>255)throw new r;t=t<<8|n}return i}var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.prototype=new Error,r.prototype.code=5,r.prototype.name="InvalidCharacterError",e.exports=o},function(e,t,n){"use strict";var r=n(0);e.exports=r.isStandardBrowserEnv()?function(){return{write:function(e,t,n,o,a,i){var s=[];s.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),r.isString(o)&&s.push("path="+o),r.isString(a)&&s.push("domain="+a),!0===i&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(e,t,n){"use strict";function r(){this.handlers=[]}var o=n(0);r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){o.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=r},function(e,t,n){"use strict";function r(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var o=n(0),a=n(37),i=n(8),s=n(1);e.exports=function(e){return r(e),e.headers=e.headers||{},e.data=a(e.data,e.headers,e.transformRequest),e.headers=o.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),o.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]}),(e.adapter||s.adapter)(e).then(function(t){return r(e),t.data=a(t.data,t.headers,e.transformResponse),t},function(t){return i(t)||(r(e),t&&t.response&&(t.response.data=a(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,n){"use strict";var r=n(0);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";function r(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new o(e),t(n.reason))})}var o=n(9);r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e;return{token:new r(function(t){e=t}),cancel:e}},e.exports=r},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}}])}); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("vue")):"function"==typeof define&&define.amd?define("EL-SEARCH-TABLE-PAGINATION",["vue"],t):"object"==typeof exports?exports["EL-SEARCH-TABLE-PAGINATION"]=t(require("vue")):e["EL-SEARCH-TABLE-PAGINATION"]=t(e.Vue)}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=10)}([function(e,t,n){"use strict";function r(e){return"[object Array]"===O.call(e)}function o(e){return"[object ArrayBuffer]"===O.call(e)}function a(e){return"undefined"!=typeof FormData&&e instanceof FormData}function i(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function s(e){return"string"==typeof e}function u(e){return"number"==typeof e}function l(e){return void 0===e}function c(e){return null!==e&&"object"==typeof e}function f(e){return"[object Date]"===O.call(e)}function d(e){return"[object File]"===O.call(e)}function p(e){return"[object Blob]"===O.call(e)}function h(e){return"[object Function]"===O.call(e)}function m(e){return c(e)&&h(e.pipe)}function g(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function y(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function b(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function v(e,t){if(null!==e&&void 0!==e)if("object"==typeof e||r(e)||(e=[e]),r(e))for(var n=0,o=e.length;n=200&&e<300}};s.headers={common:{Accept:"application/json, text/plain, */*"}},o.forEach(["delete","get","head"],function(e){s.headers[e]={}}),o.forEach(["post","put","patch"],function(e){s.headers[e]=o.merge(i)}),e.exports=s}).call(t,n(26))},function(e,t){e.exports=function(e,t,n,r,o,a){var i,s=e=e||{},u=typeof e.default;"object"!==u&&"function"!==u||(i=e,s=e.default);var l="function"==typeof s?s.options:s;t&&(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0),n&&(l.functional=!0),o&&(l._scopeId=o);var c;if(a?(c=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),r&&r.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},l._ssrRegister=c):r&&(c=r),c){var f=l.functional,d=f?l.render:l.beforeCreate;f?(l._injectStyles=c,l.render=function(e,t){return c.call(t),d(e,t)}):l.beforeCreate=d?[].concat(d,c):[c]}return{esModule:i,exports:s,options:l}}},function(e,t,n){"use strict";function r(e){var t=["large","small","mini"],n=-1!==t.indexOf(e.toLowerCase())||""===e;if(!n)throw new Error("Size must be one of ['large', 'small', 'mini']");return n}t.__esModule=!0;t.formProps={size:{type:String,default:"",validator:r},showResetBtn:{type:Boolean,default:!1},inline:{type:Boolean,default:!1},fuzzy:{type:Boolean,default:!1},labelWidth:Number,itemWidth:Number,submitHandler:Function,submitLoading:{type:Boolean,default:!1},submitBtnText:{type:String,default:"查询"},resetBtnText:{type:String,default:"重置"},forms:{type:Array,required:!0}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(17),o=n.n(r),a=n(18),i=n(2),s=i(o.a,a.a,!1,null,null,null);t.default=s.exports},function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r1&&void 0!==arguments[1]?arguments[1]:{};c.map(function(t){e.component(t.name,t)}),t.axios||(t.axios=n(22),t.axios.interceptors.response.use(function(e){return JSON.parse(JSON.stringify(e.data))},function(e){return Promise.reject(e.response)})),e.prototype.$axios=t.axios};"undefined"!=typeof window&&window.Vue&&f(window.Vue),t.default={version:l.default.version,install:f,SearchTablePagination:a.default,SearchForm:s.default}},function(e,t,n){"use strict";t.__esModule=!0;var r=n(13),o=function(e){return e&&e.__esModule?e:{default:e}}(r);o.default.install=function(e){e.component(o.default.name,o.default)},t.default=o.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(14),o=n.n(r),a=n(19),i=n(2),s=i(o.a,a.a,!1,null,null,null);t.default=s.exports},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=n(15),a=r(o),i=n(16),s=r(i),u=n(4),l=r(u);t.default={name:"ElSearchTablePagination",components:{searchForm:l.default},props:s.default,data:function(){var e=this;return{Vue:a.default,pagination:{pageIndex:1,pageSize:function(){var t=e.pageSizes;return t.length>0?t[0]:20}()},total:0,loading:!1,tableData:[],cacheLocalData:[]}},computed:{newSlotScope:function(){return Number(a.default.version.replace(/\./g,""))>=250}},methods:{handleSizeChange:function(e){this.pagination.pageSize=e,this.dataChangeHandler()},handleCurrentChange:function(e){this.pagination.pageIndex=e,this.dataChangeHandler()},searchHandler:function(){this.pagination.pageIndex=1,this.dataChangeHandler(arguments[0])},dataChangeHandler:function(){var e=this.type;"local"===e?this.dataFilterHandler(arguments[0]):"remote"===e&&this.fetchHandler(arguments[0])},dataFilter:function(e){var t=this.pagination,n=t.pageIndex,r=t.pageSize;return e.filter(function(e,t){return t>=(n-1)*r&&t0){var s=t.filter(function(e){var t=[];return a.forEach(function(n){"number"==typeof e[n]?t.push(i[n]?-1!==String(e[n]).indexOf(String(o[n])):String(e[n])===String(o[n])):t.push(i[n]?-1!==e[n].indexOf(o[n]):e[n]===o[n])}),t.every(function(e){return e})});this.tableData=this.dataFilter(s),this.total=s.length}else this.total=t.length,this.tableData=this.dataFilter(t)},fetchHandler:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.loading=!0;var n=this.fetch,r=this.method,o=this.url,a=this.$axios,i=this.headers,s=this.listField,u=this.pageIndexKey,l=this.pageSizeKey,c=this.totalField,f=this.params,d=this.showPagination,p=this.pagination;if(f=JSON.parse(JSON.stringify(Object.assign(f,t))),d){var h;f=Object.assign(f,(h={},h[u]=p.pageIndex,h[l]=p.pageSize,h))}var m=null;n?m=n(f):(a.interceptors.request.use(function(e){return Object.keys(i).forEach(function(t){e.headers[t]=i[t]}),e},function(e){return Promise.reject(e)}),r=r.toLowerCase(),m="get"===r?a[r](o,{params:f}):a[r](o,f)),m.then(function(t){var n=t;if(!t||t instanceof Array||(s&&-1!==s.indexOf(".")?s.split(".").forEach(function(e){n=n[e]}):n=t[s]),!(n&&n instanceof Array))throw new Error("The result of key:"+s+" is not Array.");e.dataHandler?e.tableData=n.map(e.dataHandler):e.tableData=n;var r=t;t[c]&&c&&-1!==c.indexOf(".")?c.split(".").forEach(function(e){r=r[e]}):r=t&&t[c]||n.length,e.total=r,e.loading=!1}).catch(function(t){e.loading=!1})},emitEventHandler:function(e){this.$emit.apply(this,[e].concat(Array.from(arguments).slice(1)))},loadLocalData:function(e){if(!e)throw new Error("When the type is 'local', you must set attribute 'data' and 'data' must be a array.");var t=JSON.parse(JSON.stringify(e));this.tableData=this.dataFilter(t),this.cacheLocalData=t,this.total=t.length}},mounted:function(){var e=this;this.$refs.table.$on("expand",function(t,n){return e.emitEventHandler("expand",t,n)});var t=this.type,n=this.autoLoad,r=this.data,o=this.formOptions,a=this.params;"remote"===t&&n?o?this.$refs.searchForm.getParams(function(t,n){t||e.fetchHandler(Object.assign(n,a))}):this.fetchHandler(a):"local"===t&&this.loadLocalData(r)},watch:{data:function(e){this.loadLocalData(e)}}}},function(t,n){t.exports=e},function(e,t,n){"use strict";t.__esModule=!0;var r=(n(3),{height:[String,Number],maxHeight:[String,Number],stripe:Boolean,border:Boolean,fit:{type:Boolean,default:!0},showHeader:{type:Boolean,default:!0},highlightCurrentRow:Boolean,currentRowKey:[String,Number],rowClassName:[String,Function],rowStyle:[String,Function],rowKey:[String,Function],emptyText:String,defaultExpandAll:Boolean,expandRowKeys:Array,defaultSort:Object,tooltipEffect:String,showSummary:Boolean,sumText:String,summaryMethod:Function,fetch:{type:Function},url:{type:String},method:{type:String,default:"get",validator:function(e){return-1!==["get","post","put","delete"].indexOf(e.toLowerCase())}},headers:{type:Object,default:function(){return{}}},listField:{type:String,default:"data.list"},totalField:{type:String,default:"data.total"},params:{type:Object,default:function(){return{}}},formOptions:{type:Object},autoLoad:{type:Boolean,default:!0},type:{type:String,default:"remote",validator:function(e){var t=["remote","local"],n=-1!==t.indexOf(e);if(!n)throw new Error("Invalid type of '"+e+"', please set one type of 'remote' or 'local'.");return n}},data:{type:Array},dataHandler:{type:Function},columns:{type:Array,required:!0},showPagination:{type:Boolean,default:!0},pageSizes:{type:Array,default:function(){return[20,50,100]}},paginationLayout:{type:String,default:"total, prev, pager, next, jumper, sizes"},pageIndexKey:{type:String,default:"pageIndex"},pageSizeKey:{type:String,default:"pageSize"}});t.default=r},function(e,t,n){"use strict";t.__esModule=!0;var r=Object.assign||function(e){for(var t=1;t",license:"MIT",bugs:{url:"https://github.com/zollero/el-search-table-pagination/issues"},homepage:"https://github.com/zollero/el-search-table-pagination#readme",peerDependencies:{"element-ui":"^2.0.7",vue:"^2.5.2"},dependencies:{axios:"^0.16.2"},devDependencies:{"babel-core":"^6.26.0","babel-loader":"^7.1.2","babel-plugin-module-resolver":"^3.0.0","babel-plugin-syntax-jsx":"^6.18.0","babel-plugin-transform-vue-jsx":"^3.5.0","babel-preset-es2015":"^6.24.1","babel-preset-stage-3":"^6.24.1",cooking:"^1.5.4","cooking-vue2":"^0.3.3","extract-text-webpack-plugin":"^3.0.2","html-webpack-plugin":"^2.30.1","vue-template-compiler":"^2.5.9",webpack:"^3.8.1","webpack-node-externals":"^1.6.0"}}},function(e,t,n){e.exports=n(23)},function(e,t,n){"use strict";function r(e){var t=new i(e),n=a(i.prototype.request,t);return o.extend(n,i.prototype,t),o.extend(n,t),n}var o=n(0),a=n(5),i=n(25),s=n(1),u=r(s);u.Axios=i,u.create=function(e){return r(o.merge(s,e))},u.Cancel=n(9),u.CancelToken=n(40),u.isCancel=n(8),u.all=function(e){return Promise.all(e)},u.spread=n(41),e.exports=u,e.exports.default=u},function(e,t){function n(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function r(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&n(e.slice(0,0))}e.exports=function(e){return null!=e&&(n(e)||r(e)||!!e._isBuffer)}},function(e,t,n){"use strict";function r(e){this.defaults=e,this.interceptors={request:new i,response:new i}}var o=n(1),a=n(0),i=n(35),s=n(36),u=n(38),l=n(39);r.prototype.request=function(e){"string"==typeof e&&(e=a.merge({url:arguments[0]},arguments[1])),e=a.merge(o,this.defaults,{method:"get"},e),e.method=e.method.toLowerCase(),e.baseURL&&!u(e.url)&&(e.url=l(e.baseURL,e.url));var t=[s,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},a.forEach(["delete","get","head","options"],function(e){r.prototype[e]=function(t,n){return this.request(a.merge(n||{},{method:e,url:t}))}}),a.forEach(["post","put","patch"],function(e){r.prototype[e]=function(t,n,r){return this.request(a.merge(r||{},{method:e,url:t,data:n}))}}),e.exports=r},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function a(e){if(f===clearTimeout)return clearTimeout(e);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function i(){m&&p&&(m=!1,p.length?h=p.concat(h):g=-1,h.length&&s())}function s(){if(!m){var e=o(i);m=!0;for(var t=h.length;t;){for(p=h,h=[];++g1)for(var n=1;n>8-s%1*8)){if((n=o.charCodeAt(s+=.75))>255)throw new r;t=t<<8|n}return i}var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.prototype=new Error,r.prototype.code=5,r.prototype.name="InvalidCharacterError",e.exports=o},function(e,t,n){"use strict";var r=n(0);e.exports=r.isStandardBrowserEnv()?function(){return{write:function(e,t,n,o,a,i){var s=[];s.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),r.isString(o)&&s.push("path="+o),r.isString(a)&&s.push("domain="+a),!0===i&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(e,t,n){"use strict";function r(){this.handlers=[]}var o=n(0);r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){o.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=r},function(e,t,n){"use strict";function r(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var o=n(0),a=n(37),i=n(8),s=n(1);e.exports=function(e){return r(e),e.headers=e.headers||{},e.data=a(e.data,e.headers,e.transformRequest),e.headers=o.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),o.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]}),(e.adapter||s.adapter)(e).then(function(t){return r(e),t.data=a(t.data,t.headers,e.transformResponse),t},function(t){return i(t)||(r(e),t&&t.response&&(t.response.data=a(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,n){"use strict";var r=n(0);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";function r(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new o(e),t(n.reason))})}var o=n(9);r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e;return{token:new r(function(t){e=t}),cancel:e}},e.exports=r},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}}])}); diff --git a/lib/search-table-pagination.js b/lib/search-table-pagination.js index 3d0f7e4..f793607 100644 --- a/lib/search-table-pagination.js +++ b/lib/search-table-pagination.js @@ -221,59 +221,59 @@ var formProps = exports.formProps = { }, forms: { type: Array, - required: true, - label: String, - prop: { - type: [String, Array], - required: true - }, - itemType: { - type: String, - default: 'input', - validator: itemTypeValidator - }, - size: { - type: String, - default: '', - validator: sizeValidator - }, - placeholder: { - type: String, - default: '' - }, - editable: { - type: Boolean, - default: true - }, - disabled: { - type: Boolean, - default: false - }, - readonly: { - type: Boolean, - default: false - }, - fuzzy: { - type: Boolean, - default: false - }, - options: Array, - selectFetch: Function, - selectResultField: String, - selectResultHandler: Function, - selectUrl: String, - selectMethod: String, - valueKey: String, - labelKey: String, - format: Function, - selectParams: { - type: Object, - default: function _default() { - return {}; - } - }, - rules: Array, - pickerOptions: Object + required: true + // label: String, + // prop: { + // type: [String, Array], + // required: true + // }, + // itemType: { + // type: String, + // default: 'input', + // validator: itemTypeValidator + // }, + // size: { + // type: String, + // default: '', + // validator: sizeValidator + // }, + // placeholder: { + // type: String, + // default: '' + // }, + // editable: { + // type: Boolean, + // default: true + // }, + // disabled: { + // type: Boolean, + // default: false + // }, + // readonly: { + // type: Boolean, + // default: false + // }, + // fuzzy: { + // type: Boolean, + // default: false + // }, + // options: Array, + // selectFetch: Function, + // selectResultField: String, + // selectResultHandler: Function, + // selectUrl: String, + // selectMethod: String, + // valueKey: String, + // labelKey: String, + // format: Function, + // selectParams: { + // type: Object, + // default: () => { + // return {} + // } + // }, + // rules: Array, + // pickerOptions: Object } }; @@ -286,14 +286,14 @@ function sizeValidator(value) { return valid; } -function itemTypeValidator(value) { - var methodTypes = ['input', 'select', 'date', 'daterange']; - var valid = methodTypes.indexOf(value.toLowerCase()) !== -1; - if (!valid) { - throw new Error('ItemType must be one of [\'input\', \'select\', \'date\', \'daterange\']'); - } - return valid; -} +// function itemTypeValidator(value) { +// const methodTypes = ['input', 'select', 'date', 'daterange']; +// const valid = methodTypes.indexOf(value.toLowerCase()) !== -1 +// if (!valid) { +// throw new Error(`ItemType must be one of ['input', 'select', 'date', 'daterange']`) +// } +// return valid +// } /***/ }), /* 2 */ @@ -303,7 +303,7 @@ function itemTypeValidator(value) { Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_a5e9fc3c_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_5b9d566d_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__ = __webpack_require__(4); var normalizeComponent = __webpack_require__(0) /* script */ @@ -319,7 +319,7 @@ var __vue_scopeId__ = null var __vue_module_identifier__ = null var Component = normalizeComponent( __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue___default.a, - __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_a5e9fc3c_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__["a" /* default */], + __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_5b9d566d_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__["a" /* default */], __vue_template_functional__, __vue_styles__, __vue_scopeId__, @@ -595,7 +595,7 @@ exports.default = { /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('el-form',{ref:"form",attrs:{"model":_vm.params,"inline":_vm.inline,"label-width":_vm.labelWidth ? (_vm.labelWidth + 'px') : ''},nativeOn:{"submit":function($event){$event.preventDefault();_vm.searchHandler()}}},[_vm._l((_vm.forms),function(form,index){return _c('el-form-item',{key:index,attrs:{"prop":form.itemType != 'daterange' ? form.prop : (_vm.datePrefix + index),"label":form.label,"rules":form.rules || [],"label-width":form.labelWidth ? (form.labelWidth + 'px') : ''}},[(form.itemType === 'input' || form.itemType === undefined)?_c('el-input',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"size":form.size ? form.size : _vm.size,"readonly":form.readonly,"disabled":form.disabled,"placeholder":form.placeholder},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}}):(form.itemType === 'select')?_c('el-select',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"size":form.size ? form.size : _vm.size,"disabled":form.disabled,"placeholder":form.placeholder},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}},[_vm._l((form.options),function(option,optionIndex){return _c('el-option',{key:optionIndex,attrs:{"value":(typeof option === 'object') ? option[form.valueKey || 'value'] : option,"label":(typeof option === 'object') ? option[form.labelKey || 'label'] : option}})}),_vm._l((_vm.selectOptions[_vm.selectOptionPrefix + index]),function(op,opIndex){return _c('el-option',{key:opIndex,attrs:{"value":(typeof op === 'object') ? op[form.valueKey || 'value'] : op,"label":(typeof op === 'object') ? op[form.labelKey || 'label'] : op}})})],2):(form.itemType === 'date')?_c('el-date-picker',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"type":"date","placeholder":form.placeholder,"size":form.size ? form.size : _vm.size,"disabled":form.disabled,"readonly":form.readonly,"editable":form.editable,"picker-options":form.pickerOptions || {}},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}}):(form.itemType === 'daterange')?_c('el-date-picker',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"size":form.size ? form.size : _vm.size,"type":"daterange","disabled":form.disabled,"readonly":form.readonly,"editable":form.editable,"placeholder":form.placeholder,"picker-options":form.pickerOptions || {}},on:{"change":function (date) { return _vm.changeDate(date, form.prop[0], form.prop[1]); }},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}}):_vm._e()],1)}),_c('el-form-item',{attrs:{"label":""}},[_c('el-button',{attrs:{"type":"primary","size":_vm.size,"loading":_vm.submitLoading},on:{"click":_vm.searchHandler}},[_vm._v("\n "+_vm._s(_vm.submitBtnText)+"\n ")]),(_vm.showResetBtn)?_c('el-button',{attrs:{"type":"primary","plain":true,"size":_vm.size,"loading":_vm.submitLoading},on:{"click":_vm.resetForm}},[_vm._v("\n "+_vm._s(_vm.resetBtnText)+"\n ")]):_vm._e()],1)],2)} +var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('el-form',{ref:"form",attrs:{"model":_vm.params,"inline":_vm.inline,"label-width":_vm.labelWidth ? (_vm.labelWidth + 'px') : ''},nativeOn:{"submit":function($event){$event.preventDefault();_vm.searchHandler()}}},[_vm._l((_vm.forms),function(form,index){return _c('el-form-item',{key:index,attrs:{"prop":form.itemType != 'daterange' ? form.prop : (_vm.datePrefix + index),"label":form.label,"rules":form.rules || [],"label-width":form.labelWidth ? (form.labelWidth + 'px') : ''}},[(form.itemType === 'input' || form.itemType === undefined)?_c('el-input',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"size":form.size ? form.size : _vm.size,"readonly":form.readonly,"disabled":form.disabled,"placeholder":form.placeholder},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}}):(form.itemType === 'select')?_c('el-select',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"size":form.size ? form.size : _vm.size,"disabled":form.disabled,"placeholder":form.placeholder},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}},[_vm._l((form.options),function(option,optionIndex){return _c('el-option',{key:optionIndex + '_local',attrs:{"value":(typeof option === 'object') ? option[form.valueKey || 'value'] : option,"label":(typeof option === 'object') ? option[form.labelKey || 'label'] : option}})}),_vm._l((_vm.selectOptions[_vm.selectOptionPrefix + index]),function(op,opIndex){return _c('el-option',{key:opIndex + '_remote',attrs:{"value":(typeof op === 'object') ? op[form.valueKey || 'value'] : op,"label":(typeof op === 'object') ? op[form.labelKey || 'label'] : op}})})],2):(form.itemType === 'date')?_c('el-date-picker',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"type":"date","placeholder":form.placeholder,"size":form.size ? form.size : _vm.size,"disabled":form.disabled,"readonly":form.readonly,"editable":form.editable,"picker-options":form.pickerOptions || {}},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}}):(form.itemType === 'daterange')?_c('el-date-picker',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"size":form.size ? form.size : _vm.size,"type":"daterange","disabled":form.disabled,"readonly":form.readonly,"editable":form.editable,"placeholder":form.placeholder,"picker-options":form.pickerOptions || {}},on:{"change":function (date) { return _vm.changeDate(date, form.prop[0], form.prop[1]); }},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}}):_vm._e()],1)}),_c('el-form-item',{attrs:{"label":""}},[_c('el-button',{attrs:{"type":"primary","size":_vm.size,"loading":_vm.submitLoading},on:{"click":_vm.searchHandler}},[_vm._v("\n "+_vm._s(_vm.submitBtnText)+"\n ")]),(_vm.showResetBtn)?_c('el-button',{attrs:{"type":"primary","plain":true,"size":_vm.size,"loading":_vm.submitLoading},on:{"click":_vm.resetForm}},[_vm._v("\n "+_vm._s(_vm.resetBtnText)+"\n ")]):_vm._e()],1)],2)} var staticRenderFns = [] var esExports = { render: render, staticRenderFns: staticRenderFns } /* harmony default export */ __webpack_exports__["a"] = (esExports); @@ -638,7 +638,7 @@ exports.default = _main2.default; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue__ = __webpack_require__(10); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_e5d62ac6_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__ = __webpack_require__(13); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_3561beac_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__ = __webpack_require__(13); var normalizeComponent = __webpack_require__(0) /* script */ @@ -654,7 +654,7 @@ var __vue_scopeId__ = null var __vue_module_identifier__ = null var Component = normalizeComponent( __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue___default.a, - __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_e5d62ac6_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__["a" /* default */], + __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_3561beac_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__["a" /* default */], __vue_template_functional__, __vue_styles__, __vue_scopeId__, @@ -863,19 +863,19 @@ exports.default = { } var totalValue = response; - if (totalField && totalField.indexOf('.') !== -1) { + if (response[totalField] && totalField && totalField.indexOf('.') !== -1) { totalField.split('.').forEach(function (vv) { totalValue = totalValue[vv]; }); } else { - totalValue = response[totalField] || result.length; + totalValue = response && response[totalField] || result.length; } _this2.total = totalValue; _this2.loading = false; }).catch(function (error) { - console.error('Get remote data failed. ', error); + // console.error('Get remote data failed. ', error) _this2.loading = false; }); }, @@ -1156,62 +1156,62 @@ var props = { }, columns: { type: Array, - required: true, - // Element UI table-column attribute - columnKey: String, - label: { - type: String, - required: true - }, - prop: { - type: String, - required: true - }, - width: Number, - minWidth: Number, - fixed: [Boolean, String], - renderHeader: Function, - sortable: [Boolean, String], - sortMethod: Function, - resizable: { - type: Boolean, - default: true - }, - formatter: Function, - showOverflowTooltip: Boolean, - align: { - type: String, - default: 'left' - }, - headerAlign: String, - className: { - type: String, - default: '' - }, - labelClassName: { - type: String, - default: '' - }, - selectable: Function, - reserveSelection: Boolean, - filters: Array, - filterPlacement: String, - filterMultiple: { - type: Boolean, - default: true - }, - filterMethod: Function, - filteredValue: Array, - // custom table-column attribute - filter: { - type: String - }, - render: { - type: Function - }, - slotName: { - type: String - } + required: true + // // Element UI table-column attribute + // columnKey: String, + // label: { + // type: String, + // required: true + // }, + // prop: { + // type: String, + // required: true + // }, + // width: Number, + // minWidth: Number, + // fixed: [Boolean, String], + // renderHeader: Function, + // sortable: [Boolean, String], + // sortMethod: Function, + // resizable: { + // type: Boolean, + // default: true + // }, + // formatter: Function, + // showOverflowTooltip: Boolean, + // align: { + // type: String, + // default: 'left' + // }, + // headerAlign: String, + // className: { + // type: String, + // default: '' + // }, + // labelClassName: { + // type: String, + // default: '' + // }, + // selectable: Function, + // reserveSelection: Boolean, + // filters: Array, + // filterPlacement: String, + // filterMultiple: { + // type: Boolean, + // default: true + // }, + // filterMethod: Function, + // filteredValue: Array, + // // custom table-column attribute + // filter: { + // type: String + // }, + // render: { + // type: Function + // }, + // slotName: { + // type: String + // } }, showPagination: { type: Boolean, @@ -1235,13 +1235,12 @@ var props = { type: String, default: 'pageSize' } -}; -Object.keys(_props.formProps).forEach(function (v) { - props.formOptions[v] = _props.formProps[v]; -}); + // Object.keys(formProps).forEach(v => { + // props.formOptions[v] = formProps[v] + // }) -exports.default = props; +};exports.default = props; /***/ }), /* 13 */ diff --git a/lib/search.js b/lib/search.js index 7b1152a..9c343cc 100644 --- a/lib/search.js +++ b/lib/search.js @@ -221,59 +221,59 @@ var formProps = exports.formProps = { }, forms: { type: Array, - required: true, - label: String, - prop: { - type: [String, Array], - required: true - }, - itemType: { - type: String, - default: 'input', - validator: itemTypeValidator - }, - size: { - type: String, - default: '', - validator: sizeValidator - }, - placeholder: { - type: String, - default: '' - }, - editable: { - type: Boolean, - default: true - }, - disabled: { - type: Boolean, - default: false - }, - readonly: { - type: Boolean, - default: false - }, - fuzzy: { - type: Boolean, - default: false - }, - options: Array, - selectFetch: Function, - selectResultField: String, - selectResultHandler: Function, - selectUrl: String, - selectMethod: String, - valueKey: String, - labelKey: String, - format: Function, - selectParams: { - type: Object, - default: function _default() { - return {}; - } - }, - rules: Array, - pickerOptions: Object + required: true + // label: String, + // prop: { + // type: [String, Array], + // required: true + // }, + // itemType: { + // type: String, + // default: 'input', + // validator: itemTypeValidator + // }, + // size: { + // type: String, + // default: '', + // validator: sizeValidator + // }, + // placeholder: { + // type: String, + // default: '' + // }, + // editable: { + // type: Boolean, + // default: true + // }, + // disabled: { + // type: Boolean, + // default: false + // }, + // readonly: { + // type: Boolean, + // default: false + // }, + // fuzzy: { + // type: Boolean, + // default: false + // }, + // options: Array, + // selectFetch: Function, + // selectResultField: String, + // selectResultHandler: Function, + // selectUrl: String, + // selectMethod: String, + // valueKey: String, + // labelKey: String, + // format: Function, + // selectParams: { + // type: Object, + // default: () => { + // return {} + // } + // }, + // rules: Array, + // pickerOptions: Object } }; @@ -286,14 +286,14 @@ function sizeValidator(value) { return valid; } -function itemTypeValidator(value) { - var methodTypes = ['input', 'select', 'date', 'daterange']; - var valid = methodTypes.indexOf(value.toLowerCase()) !== -1; - if (!valid) { - throw new Error('ItemType must be one of [\'input\', \'select\', \'date\', \'daterange\']'); - } - return valid; -} +// function itemTypeValidator(value) { +// const methodTypes = ['input', 'select', 'date', 'daterange']; +// const valid = methodTypes.indexOf(value.toLowerCase()) !== -1 +// if (!valid) { +// throw new Error(`ItemType must be one of ['input', 'select', 'date', 'daterange']`) +// } +// return valid +// } /***/ }), /* 2 */ @@ -303,7 +303,7 @@ function itemTypeValidator(value) { Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_a5e9fc3c_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_5b9d566d_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__ = __webpack_require__(4); var normalizeComponent = __webpack_require__(0) /* script */ @@ -319,7 +319,7 @@ var __vue_scopeId__ = null var __vue_module_identifier__ = null var Component = normalizeComponent( __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_main_vue___default.a, - __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_a5e9fc3c_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__["a" /* default */], + __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_5b9d566d_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_main_vue__["a" /* default */], __vue_template_functional__, __vue_styles__, __vue_scopeId__, @@ -595,7 +595,7 @@ exports.default = { /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('el-form',{ref:"form",attrs:{"model":_vm.params,"inline":_vm.inline,"label-width":_vm.labelWidth ? (_vm.labelWidth + 'px') : ''},nativeOn:{"submit":function($event){$event.preventDefault();_vm.searchHandler()}}},[_vm._l((_vm.forms),function(form,index){return _c('el-form-item',{key:index,attrs:{"prop":form.itemType != 'daterange' ? form.prop : (_vm.datePrefix + index),"label":form.label,"rules":form.rules || [],"label-width":form.labelWidth ? (form.labelWidth + 'px') : ''}},[(form.itemType === 'input' || form.itemType === undefined)?_c('el-input',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"size":form.size ? form.size : _vm.size,"readonly":form.readonly,"disabled":form.disabled,"placeholder":form.placeholder},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}}):(form.itemType === 'select')?_c('el-select',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"size":form.size ? form.size : _vm.size,"disabled":form.disabled,"placeholder":form.placeholder},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}},[_vm._l((form.options),function(option,optionIndex){return _c('el-option',{key:optionIndex,attrs:{"value":(typeof option === 'object') ? option[form.valueKey || 'value'] : option,"label":(typeof option === 'object') ? option[form.labelKey || 'label'] : option}})}),_vm._l((_vm.selectOptions[_vm.selectOptionPrefix + index]),function(op,opIndex){return _c('el-option',{key:opIndex,attrs:{"value":(typeof op === 'object') ? op[form.valueKey || 'value'] : op,"label":(typeof op === 'object') ? op[form.labelKey || 'label'] : op}})})],2):(form.itemType === 'date')?_c('el-date-picker',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"type":"date","placeholder":form.placeholder,"size":form.size ? form.size : _vm.size,"disabled":form.disabled,"readonly":form.readonly,"editable":form.editable,"picker-options":form.pickerOptions || {}},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}}):(form.itemType === 'daterange')?_c('el-date-picker',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"size":form.size ? form.size : _vm.size,"type":"daterange","disabled":form.disabled,"readonly":form.readonly,"editable":form.editable,"placeholder":form.placeholder,"picker-options":form.pickerOptions || {}},on:{"change":function (date) { return _vm.changeDate(date, form.prop[0], form.prop[1]); }},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}}):_vm._e()],1)}),_c('el-form-item',{attrs:{"label":""}},[_c('el-button',{attrs:{"type":"primary","size":_vm.size,"loading":_vm.submitLoading},on:{"click":_vm.searchHandler}},[_vm._v("\n "+_vm._s(_vm.submitBtnText)+"\n ")]),(_vm.showResetBtn)?_c('el-button',{attrs:{"type":"primary","plain":true,"size":_vm.size,"loading":_vm.submitLoading},on:{"click":_vm.resetForm}},[_vm._v("\n "+_vm._s(_vm.resetBtnText)+"\n ")]):_vm._e()],1)],2)} +var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('el-form',{ref:"form",attrs:{"model":_vm.params,"inline":_vm.inline,"label-width":_vm.labelWidth ? (_vm.labelWidth + 'px') : ''},nativeOn:{"submit":function($event){$event.preventDefault();_vm.searchHandler()}}},[_vm._l((_vm.forms),function(form,index){return _c('el-form-item',{key:index,attrs:{"prop":form.itemType != 'daterange' ? form.prop : (_vm.datePrefix + index),"label":form.label,"rules":form.rules || [],"label-width":form.labelWidth ? (form.labelWidth + 'px') : ''}},[(form.itemType === 'input' || form.itemType === undefined)?_c('el-input',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"size":form.size ? form.size : _vm.size,"readonly":form.readonly,"disabled":form.disabled,"placeholder":form.placeholder},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}}):(form.itemType === 'select')?_c('el-select',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"size":form.size ? form.size : _vm.size,"disabled":form.disabled,"placeholder":form.placeholder},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}},[_vm._l((form.options),function(option,optionIndex){return _c('el-option',{key:optionIndex + '_local',attrs:{"value":(typeof option === 'object') ? option[form.valueKey || 'value'] : option,"label":(typeof option === 'object') ? option[form.labelKey || 'label'] : option}})}),_vm._l((_vm.selectOptions[_vm.selectOptionPrefix + index]),function(op,opIndex){return _c('el-option',{key:opIndex + '_remote',attrs:{"value":(typeof op === 'object') ? op[form.valueKey || 'value'] : op,"label":(typeof op === 'object') ? op[form.labelKey || 'label'] : op}})})],2):(form.itemType === 'date')?_c('el-date-picker',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"type":"date","placeholder":form.placeholder,"size":form.size ? form.size : _vm.size,"disabled":form.disabled,"readonly":form.readonly,"editable":form.editable,"picker-options":form.pickerOptions || {}},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}}):(form.itemType === 'daterange')?_c('el-date-picker',{style:(_vm.itemStyle + (form.itemWidth ? ("width: " + (form.itemWidth) + "px;") : '')),attrs:{"size":form.size ? form.size : _vm.size,"type":"daterange","disabled":form.disabled,"readonly":form.readonly,"editable":form.editable,"placeholder":form.placeholder,"picker-options":form.pickerOptions || {}},on:{"change":function (date) { return _vm.changeDate(date, form.prop[0], form.prop[1]); }},model:{value:(_vm.params[form.modelValue]),callback:function ($$v) {_vm.$set(_vm.params, form.modelValue, $$v)},expression:"params[form.modelValue]"}}):_vm._e()],1)}),_c('el-form-item',{attrs:{"label":""}},[_c('el-button',{attrs:{"type":"primary","size":_vm.size,"loading":_vm.submitLoading},on:{"click":_vm.searchHandler}},[_vm._v("\n "+_vm._s(_vm.submitBtnText)+"\n ")]),(_vm.showResetBtn)?_c('el-button',{attrs:{"type":"primary","plain":true,"size":_vm.size,"loading":_vm.submitLoading},on:{"click":_vm.resetForm}},[_vm._v("\n "+_vm._s(_vm.resetBtnText)+"\n ")]):_vm._e()],1)],2)} var staticRenderFns = [] var esExports = { render: render, staticRenderFns: staticRenderFns } /* harmony default export */ __webpack_exports__["a"] = (esExports); diff --git a/package.json b/package.json index 6babec4..283e71b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "el-search-table-pagination", - "version": "0.4.19", + "version": "0.4.20", "description": "A component which combines form、table with pagination components in Element UI. ", "main": "./lib/index.js", "files": [ diff --git a/packages/search-table-pagination/src/main.vue b/packages/search-table-pagination/src/main.vue index f6fb7ea..a326ed2 100644 --- a/packages/search-table-pagination/src/main.vue +++ b/packages/search-table-pagination/src/main.vue @@ -287,19 +287,19 @@ } let totalValue = response - if (totalField && totalField.indexOf('.') !== -1) { + if (response[totalField] && totalField && totalField.indexOf('.') !== -1) { totalField.split('.').forEach(vv => { totalValue = totalValue[vv] }) } else { - totalValue = response[totalField] || result.length + totalValue = (response && response[totalField]) || result.length } this.total = totalValue this.loading = false }).catch(error => { - console.error('Get remote data failed. ', error) + // console.error('Get remote data failed. ', error) this.loading = false }) }, diff --git a/packages/search-table-pagination/src/props.js b/packages/search-table-pagination/src/props.js index 784f2c7..3e1ddd6 100644 --- a/packages/search-table-pagination/src/props.js +++ b/packages/search-table-pagination/src/props.js @@ -90,62 +90,62 @@ let props = { }, columns: { type: Array, - required: true, - // Element UI table-column attribute - columnKey: String, - label: { - type: String, - required: true - }, - prop: { - type: String, - required: true - }, - width: Number, - minWidth: Number, - fixed: [Boolean, String], - renderHeader: Function, - sortable: [Boolean, String], - sortMethod: Function, - resizable: { - type: Boolean, - default: true - }, - formatter: Function, - showOverflowTooltip: Boolean, - align: { - type: String, - default: 'left' - }, - headerAlign: String, - className: { - type: String, - default: '' - }, - labelClassName: { - type: String, - default: '' - }, - selectable: Function, - reserveSelection: Boolean, - filters: Array, - filterPlacement: String, - filterMultiple: { - type: Boolean, - default: true - }, - filterMethod: Function, - filteredValue: Array, - // custom table-column attribute - filter: { - type: String - }, - render: { - type: Function - }, - slotName: { - type: String - } + required: true + // // Element UI table-column attribute + // columnKey: String, + // label: { + // type: String, + // required: true + // }, + // prop: { + // type: String, + // required: true + // }, + // width: Number, + // minWidth: Number, + // fixed: [Boolean, String], + // renderHeader: Function, + // sortable: [Boolean, String], + // sortMethod: Function, + // resizable: { + // type: Boolean, + // default: true + // }, + // formatter: Function, + // showOverflowTooltip: Boolean, + // align: { + // type: String, + // default: 'left' + // }, + // headerAlign: String, + // className: { + // type: String, + // default: '' + // }, + // labelClassName: { + // type: String, + // default: '' + // }, + // selectable: Function, + // reserveSelection: Boolean, + // filters: Array, + // filterPlacement: String, + // filterMultiple: { + // type: Boolean, + // default: true + // }, + // filterMethod: Function, + // filteredValue: Array, + // // custom table-column attribute + // filter: { + // type: String + // }, + // render: { + // type: Function + // }, + // slotName: { + // type: String + // } }, showPagination: { type: Boolean, @@ -171,8 +171,8 @@ let props = { } } -Object.keys(formProps).forEach(v => { - props.formOptions[v] = formProps[v] -}) +// Object.keys(formProps).forEach(v => { +// props.formOptions[v] = formProps[v] +// }) export default props diff --git a/packages/search/src/main.vue b/packages/search/src/main.vue index edfb5ee..0430326 100644 --- a/packages/search/src/main.vue +++ b/packages/search/src/main.vue @@ -19,10 +19,10 @@ :disabled="form.disabled" :placeholder="form.placeholder" :style="itemStyle + (form.itemWidth ? `width: ${form.itemWidth}px;` : '')" > - - diff --git a/packages/search/src/props.js b/packages/search/src/props.js index 853d920..9796930 100644 --- a/packages/search/src/props.js +++ b/packages/search/src/props.js @@ -34,59 +34,59 @@ export const formProps = { }, forms: { type: Array, - required: true, - label: String, - prop: { - type: [String, Array], - required: true - }, - itemType: { - type: String, - default: 'input', - validator: itemTypeValidator - }, - size: { - type: String, - default: '', - validator: sizeValidator - }, - placeholder: { - type: String, - default: '' - }, - editable: { - type: Boolean, - default: true - }, - disabled: { - type: Boolean, - default: false - }, - readonly: { - type: Boolean, - default: false - }, - fuzzy: { - type: Boolean, - default: false - }, - options: Array, - selectFetch: Function, - selectResultField: String, - selectResultHandler: Function, - selectUrl: String, - selectMethod: String, - valueKey: String, - labelKey: String, - format: Function, - selectParams: { - type: Object, - default: () => { - return {} - } - }, - rules: Array, - pickerOptions: Object + required: true + // label: String, + // prop: { + // type: [String, Array], + // required: true + // }, + // itemType: { + // type: String, + // default: 'input', + // validator: itemTypeValidator + // }, + // size: { + // type: String, + // default: '', + // validator: sizeValidator + // }, + // placeholder: { + // type: String, + // default: '' + // }, + // editable: { + // type: Boolean, + // default: true + // }, + // disabled: { + // type: Boolean, + // default: false + // }, + // readonly: { + // type: Boolean, + // default: false + // }, + // fuzzy: { + // type: Boolean, + // default: false + // }, + // options: Array, + // selectFetch: Function, + // selectResultField: String, + // selectResultHandler: Function, + // selectUrl: String, + // selectMethod: String, + // valueKey: String, + // labelKey: String, + // format: Function, + // selectParams: { + // type: Object, + // default: () => { + // return {} + // } + // }, + // rules: Array, + // pickerOptions: Object } } @@ -99,11 +99,11 @@ function sizeValidator(value) { return valid } -function itemTypeValidator(value) { - const methodTypes = ['input', 'select', 'date', 'daterange']; - const valid = methodTypes.indexOf(value.toLowerCase()) !== -1 - if (!valid) { - throw new Error(`ItemType must be one of ['input', 'select', 'date', 'daterange']`) - } - return valid -} +// function itemTypeValidator(value) { +// const methodTypes = ['input', 'select', 'date', 'daterange']; +// const valid = methodTypes.indexOf(value.toLowerCase()) !== -1 +// if (!valid) { +// throw new Error(`ItemType must be one of ['input', 'select', 'date', 'daterange']`) +// } +// return valid +// }