vxe-table 3.5.9-beta.3 → 3.5.9-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/edit/src/mixin.js +5 -5
- package/lib/edit/src/mixin.min.js +1 -1
- package/lib/filter/src/mixin.js +8 -5
- package/lib/filter/src/mixin.min.js +1 -1
- package/lib/form/src/form-item.js +1 -0
- package/lib/form/src/form-item.min.js +1 -1
- package/lib/form/src/render.js +1 -0
- package/lib/form/src/render.min.js +1 -1
- package/lib/grid/src/grid.js +11 -6
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.umd.js +326 -109
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/en-US.js +2 -0
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +2 -0
- package/lib/locale/lang/ja-JP.js +2 -0
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +2 -0
- package/lib/locale/lang/zh-CN.js +2 -0
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +2 -0
- package/lib/locale/lang/zh-HK.min.js +1 -1
- package/lib/locale/lang/zh-HK.umd.js +2 -0
- package/lib/locale/lang/zh-MO.min.js +1 -1
- package/lib/locale/lang/zh-MO.umd.js +2 -0
- package/lib/locale/lang/zh-TC.js +2 -0
- package/lib/locale/lang/zh-TC.min.js +1 -1
- package/lib/locale/lang/zh-TC.umd.js +2 -0
- package/lib/locale/lang/zh-TW.min.js +1 -1
- package/lib/locale/lang/zh-TW.umd.js +2 -0
- package/lib/select/src/select.js +213 -33
- package/lib/select/src/select.min.js +1 -1
- package/lib/select/style/style.css +17 -3
- package/lib/select/style/style.min.css +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/src/body.js +1 -1
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +3 -3
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/columnInfo.js +1 -1
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/methods.js +75 -53
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +4 -1
- package/lib/toolbar/style/style.css +13 -10
- package/lib/toolbar/style/style.min.css +1 -1
- package/lib/tools/log.js +1 -1
- package/lib/tools/log.min.js +1 -1
- package/lib/tools/utils.js +2 -2
- package/lib/tools/utils.min.js +1 -1
- package/lib/v-x-e-table/index.js +1 -1
- package/lib/v-x-e-table/index.min.js +1 -1
- package/package.json +1 -1
- package/packages/edit/src/mixin.js +5 -4
- package/packages/filter/src/mixin.js +5 -5
- package/packages/form/src/form-item.js +1 -1
- package/packages/form/src/render.js +1 -1
- package/packages/grid/src/grid.js +7 -4
- package/packages/locale/lang/en-US.js +2 -0
- package/packages/locale/lang/ja-JP.js +2 -0
- package/packages/locale/lang/zh-CN.js +2 -0
- package/packages/locale/lang/zh-TC.js +2 -0
- package/packages/select/src/select.js +139 -16
- package/packages/table/src/body.js +1 -1
- package/packages/table/src/cell.js +3 -3
- package/packages/table/src/columnInfo.js +1 -1
- package/packages/table/src/methods.js +61 -50
- package/packages/table/src/table.js +3 -0
- package/packages/tools/utils.js +2 -2
- package/styles/select.scss +24 -5
- package/styles/toolbar.scss +9 -5
- package/styles/variable.scss +0 -4
- package/types/form-item.d.ts +11 -8
- package/types/form.d.ts +5 -2
- package/types/table.d.ts +5 -0
package/lib/v-x-e-table/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _exportNames={use:!0,config:!0,t:!0,_t:!0,v:!0,VXETable:!0};exports.VXETable=void 0,exports._t=_t,exports.default=exports.config=void 0,exports.t=t,exports.use=use,exports.v=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_conf=_interopRequireDefault(require("../v-x-e-table/src/conf")),_interceptor=require("./src/interceptor");Object.keys(_interceptor).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(_exportNames,e)||e in exports&&exports[e]===_interceptor[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return _interceptor[e]}}))});var _renderer=require("./src/renderer");Object.keys(_renderer).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(_exportNames,e)||e in exports&&exports[e]===_renderer[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return _renderer[e]}}))});var _commands=require("./src/commands");Object.keys(_commands).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(_exportNames,e)||e in exports&&exports[e]===_commands[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return _commands[e]}}))});var _menus=require("./src/menus");Object.keys(_menus).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(_exportNames,e)||e in exports&&exports[e]===_menus[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return _menus[e]}}))});var _formats=require("./src/formats");Object.keys(_formats).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(_exportNames,e)||e in exports&&exports[e]===_formats[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return _formats[e]}}))});var _setup=require("./src/setup");Object.keys(_setup).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(_exportNames,e)||e in exports&&exports[e]===_setup[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return _setup[e]}}))});var _utils=require("../tools/utils"),_log=require("../tools/log");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}var installedPlugins=[];function use(e,t){return e&&e.install&&-1===installedPlugins.indexOf(e)&&(e.install(VXETable,t),installedPlugins.push(e)),VXETable}function reg(e){"development"===process.env.NODE_ENV&&VXETable.Table&&(0,_log.errLog)("vxe.error.useErr",[e]),VXETable["_".concat(e)]=1}function getExportOrImpotType(e,r){var o=[];return _xeUtils.default.objectEach(e,function(e,t){0!==e&&e!==r||o.push(t)}),o}var VXETableConfig=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"zIndex",get:function(){return _utils.UtilTools.getLastZIndex()}},{key:"nextZIndex",get:function(){return _utils.UtilTools.nextZIndex()}},{key:"exportTypes",get:function(){return getExportOrImpotType(_conf.default.export.types,1)}},{key:"importTypes",get:function(){return getExportOrImpotType(_conf.default.export.types,2)}}]),e}(),config=new VXETableConfig;function t(e,t){return _conf.default.i18n(e,t)}function _t(e,t){return e?_xeUtils.default.toValueString(_conf.default.translate?_conf.default.translate(e,t):e):""}exports.config=config;var v="v3",VXETable={v:exports.v=v,version:"3.5.9-beta.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _exportNames={use:!0,config:!0,t:!0,_t:!0,v:!0,VXETable:!0};exports.VXETable=void 0,exports._t=_t,exports.default=exports.config=void 0,exports.t=t,exports.use=use,exports.v=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_conf=_interopRequireDefault(require("../v-x-e-table/src/conf")),_interceptor=require("./src/interceptor");Object.keys(_interceptor).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(_exportNames,e)||e in exports&&exports[e]===_interceptor[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return _interceptor[e]}}))});var _renderer=require("./src/renderer");Object.keys(_renderer).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(_exportNames,e)||e in exports&&exports[e]===_renderer[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return _renderer[e]}}))});var _commands=require("./src/commands");Object.keys(_commands).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(_exportNames,e)||e in exports&&exports[e]===_commands[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return _commands[e]}}))});var _menus=require("./src/menus");Object.keys(_menus).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(_exportNames,e)||e in exports&&exports[e]===_menus[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return _menus[e]}}))});var _formats=require("./src/formats");Object.keys(_formats).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(_exportNames,e)||e in exports&&exports[e]===_formats[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return _formats[e]}}))});var _setup=require("./src/setup");Object.keys(_setup).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(_exportNames,e)||e in exports&&exports[e]===_setup[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return _setup[e]}}))});var _utils=require("../tools/utils"),_log=require("../tools/log");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}var installedPlugins=[];function use(e,t){return e&&e.install&&-1===installedPlugins.indexOf(e)&&(e.install(VXETable,t),installedPlugins.push(e)),VXETable}function reg(e){"development"===process.env.NODE_ENV&&VXETable.Table&&(0,_log.errLog)("vxe.error.useErr",[e]),VXETable["_".concat(e)]=1}function getExportOrImpotType(e,r){var o=[];return _xeUtils.default.objectEach(e,function(e,t){0!==e&&e!==r||o.push(t)}),o}var VXETableConfig=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"zIndex",get:function(){return _utils.UtilTools.getLastZIndex()}},{key:"nextZIndex",get:function(){return _utils.UtilTools.nextZIndex()}},{key:"exportTypes",get:function(){return getExportOrImpotType(_conf.default.export.types,1)}},{key:"importTypes",get:function(){return getExportOrImpotType(_conf.default.export.types,2)}}]),e}(),config=new VXETableConfig;function t(e,t){return _conf.default.i18n(e,t)}function _t(e,t){return e?_xeUtils.default.toValueString(_conf.default.translate?_conf.default.translate(e,t):e):""}exports.config=config;var v="v3",VXETable={v:exports.v=v,version:"3.5.9-beta.6",reg:reg,use:use,setup:_setup.setup,interceptor:_interceptor.interceptor,renderer:_renderer.renderer,commands:_commands.commands,formats:_formats.formats,menus:_menus.menus,config:config,t:t,_t:_t},_default=exports.VXETable=VXETable;exports.default=_default;
|
package/package.json
CHANGED
|
@@ -189,7 +189,7 @@ export default {
|
|
|
189
189
|
const { afterFullData, tableFullData, tableFullTreeData, treeConfig, mergeList, editStore, checkboxOpts, selection, isInsertByRow, treeOpts } = this
|
|
190
190
|
const { transform } = treeOpts
|
|
191
191
|
const { actived, removeList, insertList } = editStore
|
|
192
|
-
const { checkField
|
|
192
|
+
const { checkField } = checkboxOpts
|
|
193
193
|
let rest = []
|
|
194
194
|
if (!rows) {
|
|
195
195
|
rows = tableFullData
|
|
@@ -203,7 +203,7 @@ export default {
|
|
|
203
203
|
}
|
|
204
204
|
})
|
|
205
205
|
// 如果绑定了多选属性,则更新状态
|
|
206
|
-
if (!
|
|
206
|
+
if (!checkField) {
|
|
207
207
|
rows.forEach(row => {
|
|
208
208
|
const sIndex = selection.indexOf(row)
|
|
209
209
|
if (sIndex > -1) {
|
|
@@ -380,16 +380,17 @@ export default {
|
|
|
380
380
|
*/
|
|
381
381
|
handleActived (params, evnt) {
|
|
382
382
|
const { editStore, editOpts, tableColumn, editConfig, mouseConfig } = this
|
|
383
|
-
const { mode
|
|
383
|
+
const { mode } = editOpts
|
|
384
384
|
const { actived } = editStore
|
|
385
385
|
const { row, column } = params
|
|
386
386
|
const { editRender } = column
|
|
387
387
|
const cell = params.cell = (params.cell || this.getCell(row, column))
|
|
388
|
+
const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod
|
|
388
389
|
if (isEnableConf(editConfig) && isEnableConf(editRender) && cell) {
|
|
389
390
|
if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
|
|
390
391
|
// 判断是否禁用编辑
|
|
391
392
|
let type = 'edit-disabled'
|
|
392
|
-
if (!
|
|
393
|
+
if (!beforeEditMethod || beforeEditMethod({ ...params, $table: this })) {
|
|
393
394
|
if (mouseConfig) {
|
|
394
395
|
this.clearSelected(evnt)
|
|
395
396
|
this.clearCellAreas(evnt)
|
|
@@ -130,13 +130,13 @@ export default {
|
|
|
130
130
|
filterStore.maxHeight = maxHeight
|
|
131
131
|
})
|
|
132
132
|
}
|
|
133
|
-
this.emitEvent('filter-visible', { column, property: column.
|
|
133
|
+
this.emitEvent('filter-visible', { column, field: column.field, property: column.field, filterList: this.getCheckedFilters(), visible: filterStore.visible }, evnt)
|
|
134
134
|
},
|
|
135
135
|
_getCheckedFilters () {
|
|
136
136
|
const { tableFullColumn } = this
|
|
137
137
|
const filterList = []
|
|
138
138
|
tableFullColumn.filter(column => {
|
|
139
|
-
const {
|
|
139
|
+
const { field, filters } = column
|
|
140
140
|
const valueList = []
|
|
141
141
|
const dataList = []
|
|
142
142
|
if (filters && filters.length) {
|
|
@@ -147,7 +147,7 @@ export default {
|
|
|
147
147
|
}
|
|
148
148
|
})
|
|
149
149
|
if (valueList.length) {
|
|
150
|
-
filterList.push({ column, property, values: valueList, datas: dataList })
|
|
150
|
+
filterList.push({ column, field, property: field, values: valueList, datas: dataList })
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
})
|
|
@@ -161,7 +161,7 @@ export default {
|
|
|
161
161
|
confirmFilterEvent (evnt) {
|
|
162
162
|
const { filterStore, filterOpts, scrollXLoad: oldScrollXLoad, scrollYLoad: oldScrollYLoad } = this
|
|
163
163
|
const { column } = filterStore
|
|
164
|
-
const {
|
|
164
|
+
const { field } = column
|
|
165
165
|
const values = []
|
|
166
166
|
const datas = []
|
|
167
167
|
column.filters.forEach(item => {
|
|
@@ -176,7 +176,7 @@ export default {
|
|
|
176
176
|
this.handleTableData(true)
|
|
177
177
|
this.checkSelectionStatus()
|
|
178
178
|
}
|
|
179
|
-
this.emitEvent('filter-change', { column, property, values, datas, filters: filterList, filterList }, evnt)
|
|
179
|
+
this.emitEvent('filter-change', { column, field, property: field, values, datas, filters: filterList, filterList }, evnt)
|
|
180
180
|
this.closeFilter()
|
|
181
181
|
this.updateFooter().then(() => {
|
|
182
182
|
const { scrollXLoad, scrollYLoad } = this
|
|
@@ -54,7 +54,7 @@ const renderItem = (h, _vm, item, slots) => {
|
|
|
54
54
|
const showTitle = itemOverflow === 'title'
|
|
55
55
|
const showTooltip = itemOverflow === true || itemOverflow === 'tooltip'
|
|
56
56
|
const hasEllipsis = showTitle || showTooltip || showEllipsis
|
|
57
|
-
const params = { data, property: field, item, $form: _vm }
|
|
57
|
+
const params = { data, field, property: field, item, $form: _vm }
|
|
58
58
|
let isRequired
|
|
59
59
|
if (!itemVisibleMethod && compConf && compConf.itemVisibleMethod) {
|
|
60
60
|
itemVisibleMethod = compConf.itemVisibleMethod
|
|
@@ -26,7 +26,7 @@ export function renderTitle (h, _vm, item) {
|
|
|
26
26
|
const { data, tooltipOpts } = _vm
|
|
27
27
|
const { slots, field, itemRender, titlePrefix, titleSuffix } = item
|
|
28
28
|
const compConf = isEnableConf(itemRender) ? VXETable.renderer.get(itemRender.name) : null
|
|
29
|
-
const params = { data, property: field, item, $form: _vm }
|
|
29
|
+
const params = { data, field, property: field, item, $form: _vm }
|
|
30
30
|
const contVNs = []
|
|
31
31
|
const titVNs = []
|
|
32
32
|
if (titlePrefix) {
|
|
@@ -226,7 +226,7 @@ export default {
|
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
228
|
if (editConfig) {
|
|
229
|
-
tableProps.editConfig = Object.assign({}, editConfig, {
|
|
229
|
+
tableProps.editConfig = Object.assign({}, editConfig, { beforeEditMethod: this.handleBeforeEditMethod })
|
|
230
230
|
}
|
|
231
231
|
return tableProps
|
|
232
232
|
}
|
|
@@ -400,10 +400,13 @@ export default {
|
|
|
400
400
|
clss.push(rowClassName ? (XEUtils.isFunction(rowClassName) ? rowClassName(params) : rowClassName) : '')
|
|
401
401
|
return clss
|
|
402
402
|
},
|
|
403
|
-
|
|
403
|
+
handleBeforeEditMethod (params) {
|
|
404
404
|
const { editConfig } = this
|
|
405
|
-
const
|
|
406
|
-
|
|
405
|
+
const beforeEditMethod = editConfig ? (editConfig.beforeEditMethod || editConfig.activeMethod) : null
|
|
406
|
+
if (this.pendingRecords.indexOf(params.row) === -1) {
|
|
407
|
+
return !beforeEditMethod || beforeEditMethod({ ...params, $grid: this })
|
|
408
|
+
}
|
|
409
|
+
return false
|
|
407
410
|
},
|
|
408
411
|
initToolbar () {
|
|
409
412
|
this.$nextTick(() => {
|
|
@@ -4,7 +4,7 @@ import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
|
4
4
|
import vSize from '../../mixins/size'
|
|
5
5
|
import UtilTools, { getFuncText } from '../../tools/utils'
|
|
6
6
|
import DomTools from '../../tools/dom'
|
|
7
|
-
import { GlobalEvent } from '../../tools/event'
|
|
7
|
+
import { GlobalEvent, hasEventKey, EVENT_KEYS } from '../../tools/event'
|
|
8
8
|
|
|
9
9
|
function isOptionVisible (option) {
|
|
10
10
|
return option.visible !== false
|
|
@@ -112,6 +112,13 @@ function findOption (_vm, optionValue) {
|
|
|
112
112
|
return fullOptionList.find(item => optionValue === item[valueField])
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
function getRemoteSelectLabel (_vm, value) {
|
|
116
|
+
const { remoteValueList } = _vm
|
|
117
|
+
const remoteItem = remoteValueList.find(item => value === item.key)
|
|
118
|
+
const item = remoteItem ? remoteItem.result : null
|
|
119
|
+
return XEUtils.toValueString(item ? item[_vm.labelField] : value)
|
|
120
|
+
}
|
|
121
|
+
|
|
115
122
|
function getSelectLabel (_vm, value) {
|
|
116
123
|
const item = findOption(_vm, value)
|
|
117
124
|
return XEUtils.toValueString(item ? item[_vm.labelField] : value)
|
|
@@ -141,7 +148,7 @@ export function renderOption (h, _vm, list, group) {
|
|
|
141
148
|
mousedown: _vm.mousedownOptionEvent,
|
|
142
149
|
click: (evnt) => {
|
|
143
150
|
if (!isDisabled) {
|
|
144
|
-
_vm.changeOptionEvent(evnt, optionValue)
|
|
151
|
+
_vm.changeOptionEvent(evnt, optionValue, option)
|
|
145
152
|
}
|
|
146
153
|
},
|
|
147
154
|
mouseenter: () => {
|
|
@@ -182,7 +189,21 @@ export function renderOptgroup (h, _vm) {
|
|
|
182
189
|
}
|
|
183
190
|
|
|
184
191
|
function renderOpts (h, _vm) {
|
|
185
|
-
const { isGroup, visibleGroupList, visibleOptionList } = _vm
|
|
192
|
+
const { isGroup, visibleGroupList, visibleOptionList, searchLoading } = _vm
|
|
193
|
+
if (searchLoading) {
|
|
194
|
+
return [
|
|
195
|
+
h('div', {
|
|
196
|
+
class: 'vxe-select--search-loading'
|
|
197
|
+
}, [
|
|
198
|
+
h('i', {
|
|
199
|
+
class: ['vxe-select--search-icon', GlobalConfig.icon.SELECT_LOADED]
|
|
200
|
+
}),
|
|
201
|
+
h('span', {
|
|
202
|
+
class: 'vxe-select--search-text'
|
|
203
|
+
}, GlobalConfig.i18n('vxe.select.loadingText'))
|
|
204
|
+
])
|
|
205
|
+
]
|
|
206
|
+
}
|
|
186
207
|
if (isGroup) {
|
|
187
208
|
if (visibleGroupList.length) {
|
|
188
209
|
return renderOptgroup(h, _vm)
|
|
@@ -219,6 +240,10 @@ export default {
|
|
|
219
240
|
optionConfig: Object,
|
|
220
241
|
className: [String, Function],
|
|
221
242
|
size: { type: String, default: () => GlobalConfig.select.size || GlobalConfig.size },
|
|
243
|
+
filterable: Boolean,
|
|
244
|
+
filterMethod: Function,
|
|
245
|
+
remote: Boolean,
|
|
246
|
+
remoteMethod: Function,
|
|
222
247
|
emptyText: String,
|
|
223
248
|
// 已废弃,被 option-config.keyField 替换
|
|
224
249
|
optionId: { type: String, default: () => GlobalConfig.select.optionId },
|
|
@@ -250,13 +275,17 @@ export default {
|
|
|
250
275
|
fullOptionList: [],
|
|
251
276
|
visibleGroupList: [],
|
|
252
277
|
visibleOptionList: [],
|
|
278
|
+
remoteValueList: [],
|
|
253
279
|
panelIndex: 0,
|
|
254
280
|
panelStyle: null,
|
|
255
281
|
panelPlacement: null,
|
|
282
|
+
currentOption: null,
|
|
256
283
|
currentValue: null,
|
|
257
284
|
visiblePanel: false,
|
|
258
285
|
animatVisible: false,
|
|
259
|
-
isActivated: false
|
|
286
|
+
isActivated: false,
|
|
287
|
+
searchValue: '',
|
|
288
|
+
searchLoading: false
|
|
260
289
|
}
|
|
261
290
|
},
|
|
262
291
|
computed: {
|
|
@@ -288,9 +317,13 @@ export default {
|
|
|
288
317
|
return XEUtils.toNumber(this.multiCharOverflow)
|
|
289
318
|
},
|
|
290
319
|
selectLabel () {
|
|
291
|
-
const { value, multiple, multiMaxCharNum } = this
|
|
320
|
+
const { value, multiple, remote, multiMaxCharNum } = this
|
|
292
321
|
if (value && multiple) {
|
|
293
|
-
|
|
322
|
+
const vals = (XEUtils.isArray(value) ? value : [value])
|
|
323
|
+
if (remote) {
|
|
324
|
+
return vals.map(val => getRemoteSelectLabel(this, val)).join(', ')
|
|
325
|
+
}
|
|
326
|
+
return vals.map(val => {
|
|
294
327
|
const label = getSelectLabel(this, val)
|
|
295
328
|
if (multiMaxCharNum > 0 && label.length > multiMaxCharNum) {
|
|
296
329
|
return `${label.substring(0, multiMaxCharNum)}...`
|
|
@@ -298,6 +331,9 @@ export default {
|
|
|
298
331
|
return label
|
|
299
332
|
}).join(', ')
|
|
300
333
|
}
|
|
334
|
+
if (remote) {
|
|
335
|
+
return getRemoteSelectLabel(this, value)
|
|
336
|
+
}
|
|
301
337
|
return getSelectLabel(this, value)
|
|
302
338
|
}
|
|
303
339
|
},
|
|
@@ -349,13 +385,14 @@ export default {
|
|
|
349
385
|
GlobalEvent.off(this, 'blur')
|
|
350
386
|
},
|
|
351
387
|
render (h) {
|
|
352
|
-
const { $scopedSlots, vSize, className, inited, isActivated, loading, disabled, visiblePanel } = this
|
|
388
|
+
const { _e, $scopedSlots, vSize, className, inited, isActivated, loading, disabled, visiblePanel, filterable } = this
|
|
353
389
|
const prefixSlot = $scopedSlots.prefix
|
|
354
390
|
return h('div', {
|
|
355
391
|
class: ['vxe-select', className ? (XEUtils.isFunction(className) ? className({ $select: this }) : className) : '', {
|
|
356
392
|
[`size--${vSize}`]: vSize,
|
|
357
393
|
'is--visivle': visiblePanel,
|
|
358
394
|
'is--disabled': disabled,
|
|
395
|
+
'is--filter': filterable,
|
|
359
396
|
'is--loading': loading,
|
|
360
397
|
'is--active': isActivated
|
|
361
398
|
}]
|
|
@@ -400,6 +437,28 @@ export default {
|
|
|
400
437
|
},
|
|
401
438
|
style: this.panelStyle
|
|
402
439
|
}, inited ? [
|
|
440
|
+
filterable ? h('div', {
|
|
441
|
+
class: 'vxe-select-filter--wrapper'
|
|
442
|
+
}, [
|
|
443
|
+
h('vxe-input', {
|
|
444
|
+
ref: 'inpSearch',
|
|
445
|
+
class: 'vxe-select-filter--input',
|
|
446
|
+
props: {
|
|
447
|
+
value: this.searchValue,
|
|
448
|
+
type: 'text',
|
|
449
|
+
clearable: true,
|
|
450
|
+
placeholder: GlobalConfig.i18n('vxe.select.search'),
|
|
451
|
+
prefixIcon: GlobalConfig.icon.INPUT_SEARCH
|
|
452
|
+
},
|
|
453
|
+
on: {
|
|
454
|
+
modelValue: this.modelSearchEvent,
|
|
455
|
+
focus: this.focusSearchEvent,
|
|
456
|
+
keydown: this.keydownSearchEvent,
|
|
457
|
+
change: this.triggerSearchEvent,
|
|
458
|
+
search: this.triggerSearchEvent
|
|
459
|
+
}
|
|
460
|
+
})
|
|
461
|
+
]) : _e(),
|
|
403
462
|
h('div', {
|
|
404
463
|
ref: 'optWrapper',
|
|
405
464
|
class: 'vxe-select-option--wrapper'
|
|
@@ -441,19 +500,32 @@ export default {
|
|
|
441
500
|
this.refreshOption()
|
|
442
501
|
},
|
|
443
502
|
/**
|
|
444
|
-
*
|
|
503
|
+
* 刷新选项,当选项被搜索、动态显示/隐藏时可能会用到
|
|
445
504
|
*/
|
|
446
505
|
refreshOption () {
|
|
447
|
-
const { isGroup, fullOptionList, fullGroupList } = this
|
|
506
|
+
const { isGroup, fullOptionList, fullGroupList, filterable, filterMethod, searchValue, labelField, groupLabelField } = this
|
|
448
507
|
if (isGroup) {
|
|
449
|
-
|
|
508
|
+
if (filterable && filterMethod) {
|
|
509
|
+
this.visibleGroupList = fullGroupList.filter(group => isOptionVisible(group) && filterMethod({ group, option: null, searchValue }))
|
|
510
|
+
} else if (filterable) {
|
|
511
|
+
this.visibleGroupList = fullGroupList.filter(group => isOptionVisible(group) && (!searchValue || `${group[groupLabelField]}`.indexOf(searchValue) > -1))
|
|
512
|
+
} else {
|
|
513
|
+
this.visibleGroupList = fullGroupList.filter(isOptionVisible)
|
|
514
|
+
}
|
|
450
515
|
} else {
|
|
451
|
-
|
|
516
|
+
if (filterable && filterMethod) {
|
|
517
|
+
this.visibleOptionList = fullOptionList.filter(option => isOptionVisible(option) && filterMethod({ group: null, option, searchValue }))
|
|
518
|
+
} else if (filterable) {
|
|
519
|
+
this.visibleOptionList = fullOptionList.filter(option => isOptionVisible(option) && (!searchValue || `${option[labelField]}`.indexOf(searchValue) > -1))
|
|
520
|
+
} else {
|
|
521
|
+
this.visibleOptionList = fullOptionList.filter(isOptionVisible)
|
|
522
|
+
}
|
|
452
523
|
}
|
|
453
524
|
return this.$nextTick()
|
|
454
525
|
},
|
|
455
526
|
setCurrentOption (option) {
|
|
456
527
|
if (option) {
|
|
528
|
+
this.currentOption = option
|
|
457
529
|
this.currentValue = option[this.valueField]
|
|
458
530
|
}
|
|
459
531
|
},
|
|
@@ -484,6 +556,7 @@ export default {
|
|
|
484
556
|
this.hideOptionPanel()
|
|
485
557
|
},
|
|
486
558
|
clearValueEvent (evnt, selectValue) {
|
|
559
|
+
this.remoteValueList = []
|
|
487
560
|
this.changeEvent(evnt, selectValue)
|
|
488
561
|
this.$emit('clear', { value: selectValue, $event: evnt })
|
|
489
562
|
},
|
|
@@ -503,8 +576,8 @@ export default {
|
|
|
503
576
|
evnt.stopPropagation()
|
|
504
577
|
}
|
|
505
578
|
},
|
|
506
|
-
changeOptionEvent (evnt, selectValue) {
|
|
507
|
-
const { value, multiple } = this
|
|
579
|
+
changeOptionEvent (evnt, selectValue, option) {
|
|
580
|
+
const { value, multiple, remoteValueList } = this
|
|
508
581
|
if (multiple) {
|
|
509
582
|
let multipleValue
|
|
510
583
|
if (value) {
|
|
@@ -516,8 +589,15 @@ export default {
|
|
|
516
589
|
} else {
|
|
517
590
|
multipleValue = [selectValue]
|
|
518
591
|
}
|
|
592
|
+
const remoteItem = remoteValueList.find(item => item.key === selectValue)
|
|
593
|
+
if (remoteItem) {
|
|
594
|
+
remoteItem.result = option
|
|
595
|
+
} else {
|
|
596
|
+
remoteValueList.push({ key: selectValue, result: option })
|
|
597
|
+
}
|
|
519
598
|
this.changeEvent(evnt, multipleValue)
|
|
520
599
|
} else {
|
|
600
|
+
this.remoteValueList = [{ key: selectValue, result: option }]
|
|
521
601
|
this.changeEvent(evnt, selectValue)
|
|
522
602
|
this.hideOptionPanel()
|
|
523
603
|
}
|
|
@@ -544,7 +624,7 @@ export default {
|
|
|
544
624
|
}
|
|
545
625
|
},
|
|
546
626
|
handleGlobalKeydownEvent (evnt) {
|
|
547
|
-
const { visiblePanel, currentValue, clearable, disabled } = this
|
|
627
|
+
const { visiblePanel, currentValue, currentOption, clearable, disabled } = this
|
|
548
628
|
if (!disabled) {
|
|
549
629
|
const keyCode = evnt.keyCode
|
|
550
630
|
const isTab = keyCode === 9
|
|
@@ -563,7 +643,7 @@ export default {
|
|
|
563
643
|
} else if (isEnter) {
|
|
564
644
|
evnt.preventDefault()
|
|
565
645
|
evnt.stopPropagation()
|
|
566
|
-
this.changeOptionEvent(evnt, currentValue)
|
|
646
|
+
this.changeOptionEvent(evnt, currentValue, currentOption)
|
|
567
647
|
} else if (isUpArrow || isDwArrow) {
|
|
568
648
|
evnt.preventDefault()
|
|
569
649
|
let { firstOption, offsetOption } = findOffsetOption(this, currentValue, isUpArrow)
|
|
@@ -594,6 +674,15 @@ export default {
|
|
|
594
674
|
this.panelIndex = UtilTools.nextZIndex()
|
|
595
675
|
}
|
|
596
676
|
},
|
|
677
|
+
handleFocusSearch () {
|
|
678
|
+
if (this.filterable) {
|
|
679
|
+
this.$nextTick(() => {
|
|
680
|
+
if (this.$refs.inpSearch) {
|
|
681
|
+
this.$refs.inpSearch.focus()
|
|
682
|
+
}
|
|
683
|
+
})
|
|
684
|
+
}
|
|
685
|
+
},
|
|
597
686
|
focusEvent () {
|
|
598
687
|
if (!this.disabled) {
|
|
599
688
|
this.isActivated = true
|
|
@@ -602,6 +691,32 @@ export default {
|
|
|
602
691
|
blurEvent () {
|
|
603
692
|
this.isActivated = false
|
|
604
693
|
},
|
|
694
|
+
modelSearchEvent (value) {
|
|
695
|
+
this.searchValue = value
|
|
696
|
+
},
|
|
697
|
+
focusSearchEvent () {
|
|
698
|
+
this.isActivated = true
|
|
699
|
+
},
|
|
700
|
+
keydownSearchEvent (params) {
|
|
701
|
+
const { $event } = params
|
|
702
|
+
const isEnter = hasEventKey($event, EVENT_KEYS.ENTER)
|
|
703
|
+
if (isEnter) {
|
|
704
|
+
$event.preventDefault()
|
|
705
|
+
$event.stopPropagation()
|
|
706
|
+
}
|
|
707
|
+
},
|
|
708
|
+
triggerSearchEvent: XEUtils.debounce(function () {
|
|
709
|
+
const { remote, remoteMethod, searchValue } = this
|
|
710
|
+
if (remote && remoteMethod) {
|
|
711
|
+
this.searchLoading = true
|
|
712
|
+
Promise.resolve(remoteMethod({ searchValue })).then(() => this.$nextTick()).catch(() => this.$nextTick()).finally(() => {
|
|
713
|
+
this.searchLoading = false
|
|
714
|
+
this.refreshOption()
|
|
715
|
+
})
|
|
716
|
+
} else {
|
|
717
|
+
this.refreshOption()
|
|
718
|
+
}
|
|
719
|
+
}, 350, { trailing: true }),
|
|
605
720
|
isPanelVisible () {
|
|
606
721
|
return this.visiblePanel
|
|
607
722
|
},
|
|
@@ -635,8 +750,9 @@ export default {
|
|
|
635
750
|
}
|
|
636
751
|
},
|
|
637
752
|
showOptionPanel () {
|
|
638
|
-
const { loading, disabled } = this
|
|
753
|
+
const { loading, disabled, filterable } = this
|
|
639
754
|
if (!loading && !disabled) {
|
|
755
|
+
this.searchList = this.option
|
|
640
756
|
clearTimeout(this.hidePanelTimeout)
|
|
641
757
|
if (!this.inited) {
|
|
642
758
|
this.inited = true
|
|
@@ -646,6 +762,9 @@ export default {
|
|
|
646
762
|
}
|
|
647
763
|
this.isActivated = true
|
|
648
764
|
this.animatVisible = true
|
|
765
|
+
if (filterable) {
|
|
766
|
+
this.refreshOption()
|
|
767
|
+
}
|
|
649
768
|
setTimeout(() => {
|
|
650
769
|
const { value, multiple } = this
|
|
651
770
|
const currOption = findOption(this, multiple && value ? value[0] : value)
|
|
@@ -654,15 +773,19 @@ export default {
|
|
|
654
773
|
this.setCurrentOption(currOption)
|
|
655
774
|
this.scrollToOption(currOption)
|
|
656
775
|
}
|
|
776
|
+
this.handleFocusSearch()
|
|
657
777
|
}, 10)
|
|
658
778
|
this.updateZindex()
|
|
659
779
|
this.updatePlacement()
|
|
660
780
|
}
|
|
661
781
|
},
|
|
662
782
|
hideOptionPanel () {
|
|
783
|
+
this.searchValue = ''
|
|
784
|
+
this.searchLoading = false
|
|
663
785
|
this.visiblePanel = false
|
|
664
786
|
this.hidePanelTimeout = setTimeout(() => {
|
|
665
787
|
this.animatVisible = false
|
|
788
|
+
this.searchValue = ''
|
|
666
789
|
}, 350)
|
|
667
790
|
},
|
|
668
791
|
updatePlacement () {
|
|
@@ -205,7 +205,7 @@ function renderColumn (h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, r
|
|
|
205
205
|
}
|
|
206
206
|
// 如果编辑列开启显示状态
|
|
207
207
|
if (!fixedHiddenColumn && editConfig && (editRender || cellRender) && (editOpts.showStatus || editOpts.showUpdateStatus)) {
|
|
208
|
-
isDirty = $xetable.isUpdateByRow(row, column.
|
|
208
|
+
isDirty = $xetable.isUpdateByRow(row, column.field)
|
|
209
209
|
}
|
|
210
210
|
const tdVNs = []
|
|
211
211
|
if (fixedHiddenColumn && (allColumnOverflow ? isAllOverflow : allColumnOverflow)) {
|
|
@@ -478,7 +478,7 @@ export const Cell = {
|
|
|
478
478
|
renderCheckboxCellByProp (h, params) {
|
|
479
479
|
const { $table, row, column, isHidden } = params
|
|
480
480
|
const { treeConfig, treeIndeterminates } = $table
|
|
481
|
-
const { labelField, checkField
|
|
481
|
+
const { labelField, checkField, halfField, checkMethod, visibleMethod } = $table.checkboxOpts
|
|
482
482
|
const { slots } = column
|
|
483
483
|
const defaultSlot = slots ? slots.default : null
|
|
484
484
|
const checkboxSlot = slots ? slots.checkbox : null
|
|
@@ -488,7 +488,7 @@ export const Cell = {
|
|
|
488
488
|
let isDisabled = !!checkMethod
|
|
489
489
|
let on
|
|
490
490
|
if (!isHidden) {
|
|
491
|
-
isChecked = XEUtils.get(row,
|
|
491
|
+
isChecked = XEUtils.get(row, checkField)
|
|
492
492
|
on = {
|
|
493
493
|
click (evnt) {
|
|
494
494
|
if (!isDisabled && isVisible) {
|
|
@@ -712,7 +712,7 @@ export const Cell = {
|
|
|
712
712
|
const { sortable, remoteSort, filters, editRender } = column
|
|
713
713
|
let isRequired = false
|
|
714
714
|
if (editRules) {
|
|
715
|
-
const columnRules = XEUtils.get(editRules,
|
|
715
|
+
const columnRules = XEUtils.get(editRules, column.field)
|
|
716
716
|
if (columnRules) {
|
|
717
717
|
isRequired = columnRules.some(rule => rule.required)
|
|
718
718
|
}
|