Skip to content

Commit

Permalink
fix bugs: date-range-picker && remove event:expand warning on Element…
Browse files Browse the repository at this point in the history
… v1.x
  • Loading branch information
zollero committed Dec 8, 2017
1 parent 1cfe1d9 commit e7b5361
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 30 deletions.
30 changes: 20 additions & 10 deletions lib/el-search-table-pagination.common.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/index.js

Large diffs are not rendered by default.

28 changes: 19 additions & 9 deletions lib/search-table-pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,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_7e4869ac_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_683a1f2a_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 */

Expand All @@ -311,7 +311,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_7e4869ac_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_683a1f2a_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__,
Expand Down Expand Up @@ -520,7 +520,15 @@ exports.default = {
this.$refs['form'].resetFields();
},
changeDate: function changeDate(date, startDate, endDate) {
var dates = date.split(' - ');
var dates = void 0;
if (typeof date === 'string') {
dates = date.split(' - ');
} else {
var firstDate = date[0];
var secondDate = date[1];
dates = [firstDate.getFullYear() + '-' + ('0' + (firstDate.getMonth() + 1)).substr(-2) + '-' + ('0' + firstDate.getDate()).substr(-2), secondDate.getFullYear() + '-' + ('0' + (secondDate.getMonth() + 1)).substr(-2) + '-' + ('0' + secondDate.getDate()).substr(-2)];
}

this.params[startDate] = dates[0];
this.params[endDate] = dates[1];
},
Expand Down Expand Up @@ -606,7 +614,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_2dcff601_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_f5404f34_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 */

Expand All @@ -622,7 +630,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_2dcff601_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_f5404f34_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__,
Expand Down Expand Up @@ -685,7 +693,7 @@ exports.default = {

computed: {
newSlotScope: function newSlotScope() {
return Number(_vue2.default.version.replace('.', '')) > 250;
return Number(_vue2.default.version.replace(/\./g, '')) >= 250;
}
},
methods: {
Expand Down Expand Up @@ -727,11 +735,9 @@ exports.default = {
pageSize = pagination.pageSize;

var mergeParams = Object.assign(params, formParams);
console.log('mergeParams: ', mergeParams);
var validParamKeys = Object.keys(mergeParams).filter(function (v) {
return mergeParams[v] !== undefined && mergeParams[v] !== '';
});
console.log('ddd', validParamKeys);
if (validParamKeys.length > 0) {
var validData = cacheLocalData.filter(function (v) {
var valids = [];
Expand Down Expand Up @@ -865,6 +871,10 @@ exports.default = {
mounted: function mounted() {
var _this3 = this;

// event: expand changed to `expand-change` in Element v2.x
this.$refs['table'].$on('expand', function (row, expanded) {
return _this3.emitEventHandler('expand', row, expanded);
});
var type = this.type,
autoLoad = this.autoLoad,
data = this.data,
Expand Down Expand Up @@ -1211,7 +1221,7 @@ exports.default = props;
/***/ (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('div',[(_vm.formOptions)?_c('search-form',{ref:"searchForm",attrs:{"forms":_vm.formOptions.forms,"size":_vm.formOptions.size,"inline":_vm.formOptions.inline,"label-width":_vm.formOptions.labelWidth,"item-width":_vm.formOptions.itemWidth,"submit-handler":_vm.searchHandler,"submit-loading":_vm.loading,"showResetBtn":_vm.formOptions.showResetBtn,"submitBtnText":_vm.formOptions.submitBtnText,"resetBtnText":_vm.formOptions.resetBtnText}}):_vm._e(),_vm._t("form",null,{loading:_vm.loading,search:_vm.searchHandler}),_vm._t("default"),_c('el-table',{directives:[{name:"loading",rawName:"v-loading.lock",value:(_vm.loading),expression:"loading",modifiers:{"lock":true}}],staticStyle:{"width":"100%","margin-top":"20px"},attrs:{"data":_vm.tableData,"border":_vm.border,"stripe":_vm.stripe,"height":_vm.height,"max-height":_vm.maxHeight,"fit":_vm.fit,"show-header":_vm.showHeader,"highlight-current-row":_vm.highlightCurrentRow,"current-row-key":_vm.currentRowKey,"row-class-name":_vm.rowClassName,"row-style":_vm.rowStyle,"row-ket":_vm.rowKey,"empty-text":_vm.emptyText,"default-expand-all":_vm.defaultExpandAll,"expand-row-keys":_vm.expandRowKeys,"default-sort":_vm.defaultSort,"tooltip-effect":_vm.tooltipEffect,"show-summary":_vm.showSummary,"sum-text":_vm.sumText,"summary-method":_vm.summaryMethod},on:{"select":function (selection, row) { return _vm.emitEventHandler('select', selection, row); },"select-all":function (selection) { return _vm.emitEventHandler('select-all', selection); },"selection-change":function (selection) { return _vm.emitEventHandler('selection-change', selection); },"cell-mouse-enter":function (row, column, cell, event) { return _vm.emitEventHandler('cell-mouse-enter', row, column, cell, event); },"cell-mouse-leave":function (row, column, cell, event) { return _vm.emitEventHandler('cell-mouse-leave', row, column, cell, event); },"cell-click":function (row, column, cell, event) { return _vm.emitEventHandler('cell-click', row, column, cell, event); },"cell-dblclick":function (row, column, cell, event) { return _vm.emitEventHandler('cell-dblclick', row, column, cell, event); },"row-click":function (row, event, column) { return _vm.emitEventHandler('row-click', row, event, column); },"row-dblclick":function (row, event) { return _vm.emitEventHandler('row-dblclick', row, event); },"row-contextmenu":function (row, event) { return _vm.emitEventHandler('row-contextmenu', row, event); },"header-click":function (column, event) { return _vm.emitEventHandler('header-click', column, event); },"sort-change":function (args) { return _vm.emitEventHandler('sort-change', args); },"filter-change":function (filters) { return _vm.emitEventHandler('filter-change', filters); },"current-change":function (currentRow, oldCurrentRow) { return _vm.emitEventHandler('current-change', currentRow, oldCurrentRow); },"header-dragend":function (newWidth, oldWidth, column, event) { return _vm.emitEventHandler('header-dragend', newWidth, oldWidth, column, event); },"expand":function (row, expanded) { return _vm.emitEventHandler('expand', row, expanded); },"expand-change":function (row, expanded) { return _vm.emitEventHandler('expand-change', row, expanded); }}},[_vm._t("prepend"),_vm._l((_vm.columns),function(column,columnIndex){return _c('el-table-column',{key:columnIndex,attrs:{"column-key":column.columnKey,"prop":column.prop,"label":column.label,"width":column.minWidth ? '-' : (column.width || 140),"minWidth":column.minWidth || column.width || 140,"fixed":column.fixed,"render-header":column.renderHeader,"sortable":column.sortable,"sort-method":column.method,"resizable":column.resizable,"formatter":column.formatter,"show-overflow-tooltip":column.showOverflowTooltip,"align":column.align,"header-align":column.headerAlign || column.align,"class-name":column.className,"label-class-name":column.labelClassName,"selectable":column.selectable,"reserve-selection":column.reserveSelection,"filters":column.filters,"filter-placement":column.filterPlacement,"filter-multiple":column.filterMultiple,"filter-method":column.filterMethod,"filtered-value":column.filteredValue},scopedSlots:_vm._u([{key:"default",fn:function(scope){return [(column.filter)?_c('span',[_vm._v("\n "+_vm._s(_vm.Vue.filter(column['filter'])(scope.row[column.prop]))+"\n ")]):(column.slotName)?_c('span',[_vm._t(column.slotName,null,{row:scope.row})],2):_c('span',[_vm._v("\n "+_vm._s(column.render ? column.render(scope.row) : scope.row[column.prop])+"\n ")])]}}])})}),_vm._t("append")],2),(_vm.showPagination)?_c('div',{staticStyle:{"margin-top":"10px","text-align":"right"}},[_c('el-pagination',{attrs:{"current-page":_vm.pagination.pageIndex,"page-sizes":_vm.pageSizes,"page-size":_vm.pagination.pageSize,"layout":_vm.paginationLayout,"total":_vm.total},on:{"size-change":_vm.handleSizeChange,"current-change":_vm.handleCurrentChange}})],1):_vm._e()],2)}
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[(_vm.formOptions)?_c('search-form',{ref:"searchForm",attrs:{"forms":_vm.formOptions.forms,"size":_vm.formOptions.size,"inline":_vm.formOptions.inline,"label-width":_vm.formOptions.labelWidth,"item-width":_vm.formOptions.itemWidth,"submit-handler":_vm.searchHandler,"submit-loading":_vm.loading,"showResetBtn":_vm.formOptions.showResetBtn,"submitBtnText":_vm.formOptions.submitBtnText,"resetBtnText":_vm.formOptions.resetBtnText}}):_vm._e(),_vm._t("form",null,{loading:_vm.loading,search:_vm.searchHandler}),_vm._t("default"),_c('el-table',{directives:[{name:"loading",rawName:"v-loading.lock",value:(_vm.loading),expression:"loading",modifiers:{"lock":true}}],ref:"table",staticStyle:{"width":"100%","margin-top":"20px"},attrs:{"data":_vm.tableData,"border":_vm.border,"stripe":_vm.stripe,"height":_vm.height,"max-height":_vm.maxHeight,"fit":_vm.fit,"show-header":_vm.showHeader,"highlight-current-row":_vm.highlightCurrentRow,"current-row-key":_vm.currentRowKey,"row-class-name":_vm.rowClassName,"row-style":_vm.rowStyle,"row-ket":_vm.rowKey,"empty-text":_vm.emptyText,"default-expand-all":_vm.defaultExpandAll,"expand-row-keys":_vm.expandRowKeys,"default-sort":_vm.defaultSort,"tooltip-effect":_vm.tooltipEffect,"show-summary":_vm.showSummary,"sum-text":_vm.sumText,"summary-method":_vm.summaryMethod},on:{"select":function (selection, row) { return _vm.emitEventHandler('select', selection, row); },"select-all":function (selection) { return _vm.emitEventHandler('select-all', selection); },"selection-change":function (selection) { return _vm.emitEventHandler('selection-change', selection); },"cell-mouse-enter":function (row, column, cell, event) { return _vm.emitEventHandler('cell-mouse-enter', row, column, cell, event); },"cell-mouse-leave":function (row, column, cell, event) { return _vm.emitEventHandler('cell-mouse-leave', row, column, cell, event); },"cell-click":function (row, column, cell, event) { return _vm.emitEventHandler('cell-click', row, column, cell, event); },"cell-dblclick":function (row, column, cell, event) { return _vm.emitEventHandler('cell-dblclick', row, column, cell, event); },"row-click":function (row, event, column) { return _vm.emitEventHandler('row-click', row, event, column); },"row-dblclick":function (row, event) { return _vm.emitEventHandler('row-dblclick', row, event); },"row-contextmenu":function (row, event) { return _vm.emitEventHandler('row-contextmenu', row, event); },"header-click":function (column, event) { return _vm.emitEventHandler('header-click', column, event); },"sort-change":function (args) { return _vm.emitEventHandler('sort-change', args); },"filter-change":function (filters) { return _vm.emitEventHandler('filter-change', filters); },"current-change":function (currentRow, oldCurrentRow) { return _vm.emitEventHandler('current-change', currentRow, oldCurrentRow); },"header-dragend":function (newWidth, oldWidth, column, event) { return _vm.emitEventHandler('header-dragend', newWidth, oldWidth, column, event); },"expand-change":function (row, expanded) { return _vm.emitEventHandler('expand-change', row, expanded); }}},[_vm._t("prepend"),_vm._l((_vm.columns),function(column,columnIndex){return _c('el-table-column',{key:columnIndex,attrs:{"column-key":column.columnKey,"prop":column.prop,"label":column.label,"width":column.minWidth ? '-' : (column.width || 140),"minWidth":column.minWidth || column.width || 140,"fixed":column.fixed,"render-header":column.renderHeader,"sortable":column.sortable,"sort-method":column.method,"resizable":column.resizable,"formatter":column.formatter,"show-overflow-tooltip":column.showOverflowTooltip,"align":column.align,"header-align":column.headerAlign || column.align,"class-name":column.className,"label-class-name":column.labelClassName,"selectable":column.selectable,"reserve-selection":column.reserveSelection,"filters":column.filters,"filter-placement":column.filterPlacement,"filter-multiple":column.filterMultiple,"filter-method":column.filterMethod,"filtered-value":column.filteredValue},scopedSlots:_vm._u([{key:"default",fn:function(scope){return [(column.filter)?_c('span',[_vm._v("\n "+_vm._s(_vm.Vue.filter(column['filter'])(scope.row[column.prop]))+"\n ")]):(column.slotName)?_c('span',[_vm._t(column.slotName,null,{row:scope.row})],2):_c('span',[_vm._v("\n "+_vm._s(column.render ? column.render(scope.row) : scope.row[column.prop])+"\n ")])]}}])})}),_vm._t("append")],2),(_vm.showPagination)?_c('div',{staticStyle:{"margin-top":"10px","text-align":"right"}},[_c('el-pagination',{attrs:{"current-page":_vm.pagination.pageIndex,"page-sizes":_vm.pageSizes,"page-size":_vm.pagination.pageSize,"layout":_vm.paginationLayout,"total":_vm.total},on:{"size-change":_vm.handleSizeChange,"current-change":_vm.handleCurrentChange}})],1):_vm._e()],2)}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ __webpack_exports__["a"] = (esExports);
Expand Down
14 changes: 11 additions & 3 deletions lib/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,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_7e4869ac_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_683a1f2a_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 */

Expand All @@ -311,7 +311,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_7e4869ac_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_683a1f2a_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__,
Expand Down Expand Up @@ -520,7 +520,15 @@ exports.default = {
this.$refs['form'].resetFields();
},
changeDate: function changeDate(date, startDate, endDate) {
var dates = date.split(' - ');
var dates = void 0;
if (typeof date === 'string') {
dates = date.split(' - ');
} else {
var firstDate = date[0];
var secondDate = date[1];
dates = [firstDate.getFullYear() + '-' + ('0' + (firstDate.getMonth() + 1)).substr(-2) + '-' + ('0' + firstDate.getDate()).substr(-2), secondDate.getFullYear() + '-' + ('0' + (secondDate.getMonth() + 1)).substr(-2) + '-' + ('0' + secondDate.getDate()).substr(-2)];
}

this.params[startDate] = dates[0];
this.params[endDate] = dates[1];
},
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "el-search-table-pagination",
"version": "0.4.14",
"version": "0.4.15",
"description": "A component which combines form、table with pagination components in Element UI. ",
"main": "./lib/index.js",
"files": [
Expand Down Expand Up @@ -31,7 +31,7 @@
},
"homepage": "https://github.com/zollero/el-search-table-pagination#readme",
"peerDependencies": {
"element-ui": "^1.4.7",
"element-ui": "^2.0.7",
"vue": "^2.5.2"
},
"dependencies": {
Expand Down
Loading

0 comments on commit e7b5361

Please sign in to comment.