vxe-table 4.10.11 → 4.10.12
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/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/edit/hook.js +7 -8
- package/es/table/module/validator/hook.js +11 -0
- package/es/table/render/index.js +104 -43
- package/es/table/src/table.js +28 -26
- package/es/table/style.css +10 -2
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +10 -2
- package/es/vxe-table/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +172 -87
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/edit/hook.js +7 -8
- package/lib/table/module/edit/hook.min.js +1 -1
- package/lib/table/module/validator/hook.js +16 -0
- package/lib/table/module/validator/hook.min.js +1 -1
- package/lib/table/render/index.js +109 -41
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/table.js +38 -36
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +10 -2
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-table/style/style.css +10 -2
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +1 -1
- package/packages/table/module/edit/hook.ts +7 -8
- package/packages/table/module/validator/hook.ts +11 -0
- package/packages/table/render/index.ts +120 -51
- package/packages/table/src/table.ts +28 -26
- package/styles/components/table.scss +10 -2
- /package/es/{iconfont.1739164577907.ttf → iconfont.1739237387649.ttf} +0 -0
- /package/es/{iconfont.1739164577907.woff → iconfont.1739237387649.woff} +0 -0
- /package/es/{iconfont.1739164577907.woff2 → iconfont.1739237387649.woff2} +0 -0
- /package/lib/{iconfont.1739164577907.ttf → iconfont.1739237387649.ttf} +0 -0
- /package/lib/{iconfont.1739164577907.woff → iconfont.1739237387649.woff} +0 -0
- /package/lib/{iconfont.1739164577907.woff2 → iconfont.1739237387649.woff2} +0 -0
package/es/table/render/index.js
CHANGED
|
@@ -93,10 +93,11 @@ function getCellLabelVNs(renderOpts, params, cellLabel) {
|
|
|
93
93
|
* @param modelFunc
|
|
94
94
|
* @param changeFunc
|
|
95
95
|
*/
|
|
96
|
-
function getNativeElementOns(renderOpts, params,
|
|
96
|
+
function getNativeElementOns(renderOpts, params, eFns) {
|
|
97
97
|
const { events } = renderOpts;
|
|
98
98
|
const modelEvent = getModelEvent(renderOpts);
|
|
99
99
|
const changeEvent = getChangeEvent(renderOpts);
|
|
100
|
+
const { model: modelFunc, change: changeFunc, blur: blurFunc } = eFns || {};
|
|
100
101
|
const isSameEvent = changeEvent === modelEvent;
|
|
101
102
|
const ons = {};
|
|
102
103
|
if (events) {
|
|
@@ -118,15 +119,24 @@ function getNativeElementOns(renderOpts, params, modelFunc, changeFunc) {
|
|
|
118
119
|
};
|
|
119
120
|
}
|
|
120
121
|
if (!isSameEvent && changeFunc) {
|
|
121
|
-
ons[getOnName(changeEvent)] = function (
|
|
122
|
-
changeFunc(
|
|
122
|
+
ons[getOnName(changeEvent)] = function (evnt) {
|
|
123
|
+
changeFunc(evnt);
|
|
123
124
|
if (events && events[changeEvent]) {
|
|
124
|
-
events[changeEvent](params,
|
|
125
|
+
events[changeEvent](params, evnt);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
if (blurFunc) {
|
|
130
|
+
ons[getOnName(blurEvent)] = function (evnt) {
|
|
131
|
+
blurFunc(evnt);
|
|
132
|
+
if (events && events[blurEvent]) {
|
|
133
|
+
events[blurEvent](params, evnt);
|
|
125
134
|
}
|
|
126
135
|
};
|
|
127
136
|
}
|
|
128
137
|
return ons;
|
|
129
138
|
}
|
|
139
|
+
const blurEvent = 'blur';
|
|
130
140
|
/**
|
|
131
141
|
* 组件事件处理
|
|
132
142
|
* @param renderOpts
|
|
@@ -134,10 +144,11 @@ function getNativeElementOns(renderOpts, params, modelFunc, changeFunc) {
|
|
|
134
144
|
* @param modelFunc
|
|
135
145
|
* @param changeFunc
|
|
136
146
|
*/
|
|
137
|
-
function getComponentOns(renderOpts, params,
|
|
147
|
+
function getComponentOns(renderOpts, params, eFns) {
|
|
138
148
|
const { events } = renderOpts;
|
|
139
149
|
const modelEvent = getModelEvent(renderOpts);
|
|
140
150
|
const changeEvent = getChangeEvent(renderOpts);
|
|
151
|
+
const { model: modelFunc, change: changeFunc, blur: blurFunc } = eFns || {};
|
|
141
152
|
const ons = {};
|
|
142
153
|
XEUtils.objectEach(events, (func, key) => {
|
|
143
154
|
ons[getOnName(key)] = function (...args) {
|
|
@@ -165,6 +176,14 @@ function getComponentOns(renderOpts, params, modelFunc, changeFunc) {
|
|
|
165
176
|
}
|
|
166
177
|
};
|
|
167
178
|
}
|
|
179
|
+
if (blurFunc) {
|
|
180
|
+
ons[getOnName(blurEvent)] = function (...args) {
|
|
181
|
+
blurFunc(...args);
|
|
182
|
+
if (events && events[blurEvent]) {
|
|
183
|
+
events[blurEvent](params, ...args);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
}
|
|
168
187
|
return ons;
|
|
169
188
|
}
|
|
170
189
|
function getEditOns(renderOpts, params) {
|
|
@@ -172,59 +191,101 @@ function getEditOns(renderOpts, params) {
|
|
|
172
191
|
const { name } = renderOpts;
|
|
173
192
|
const { model } = column;
|
|
174
193
|
const isImmediate = isImmediateCell(renderOpts, params);
|
|
175
|
-
return getComponentOns(renderOpts, params,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
model.value = cellValue;
|
|
179
|
-
if (isImmediate) {
|
|
180
|
-
setCellValue(row, column, cellValue);
|
|
181
|
-
}
|
|
182
|
-
}, (eventParams) => {
|
|
183
|
-
// 处理 change 事件相关逻辑
|
|
184
|
-
if (!isImmediate && (['VxeInput', 'VxeNumberInput', 'VxeTextarea', '$input', '$textarea'].includes(name))) {
|
|
185
|
-
const cellValue = eventParams.value;
|
|
194
|
+
return getComponentOns(renderOpts, params, {
|
|
195
|
+
model(cellValue) {
|
|
196
|
+
// 处理 model 值双向绑定
|
|
186
197
|
model.update = true;
|
|
187
198
|
model.value = cellValue;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
199
|
+
if (isImmediate) {
|
|
200
|
+
setCellValue(row, column, cellValue);
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
change(eventParams) {
|
|
204
|
+
// 处理 change 事件相关逻辑
|
|
205
|
+
if (!isImmediate && name && (['VxeInput', 'VxeNumberInput', 'VxeTextarea', '$input', '$textarea'].includes(name))) {
|
|
206
|
+
const cellValue = eventParams.value;
|
|
207
|
+
model.update = true;
|
|
208
|
+
model.value = cellValue;
|
|
209
|
+
$table.updateStatus(params, cellValue);
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
$table.updateStatus(params);
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
blur() {
|
|
216
|
+
if (isImmediate) {
|
|
217
|
+
$table.handleCellRuleUpdateStatus('blur', params);
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
$table.handleCellRuleUpdateStatus('blur', params, model.value);
|
|
221
|
+
}
|
|
192
222
|
}
|
|
193
223
|
});
|
|
194
224
|
}
|
|
195
225
|
function getFilterOns(renderOpts, params, option) {
|
|
196
|
-
return getComponentOns(renderOpts, params,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
226
|
+
return getComponentOns(renderOpts, params, {
|
|
227
|
+
model(value) {
|
|
228
|
+
// 处理 model 值双向绑定
|
|
229
|
+
option.data = value;
|
|
230
|
+
},
|
|
231
|
+
change() {
|
|
232
|
+
handleConfirmFilter(params, !XEUtils.eqNull(option.data), option);
|
|
233
|
+
},
|
|
234
|
+
blur() {
|
|
235
|
+
handleConfirmFilter(params, !XEUtils.eqNull(option.data), option);
|
|
236
|
+
}
|
|
201
237
|
});
|
|
202
238
|
}
|
|
203
239
|
function getNativeEditOns(renderOpts, params) {
|
|
204
240
|
const { $table, row, column } = params;
|
|
205
241
|
const { model } = column;
|
|
206
|
-
return getNativeElementOns(renderOpts, params,
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
242
|
+
return getNativeElementOns(renderOpts, params, {
|
|
243
|
+
model(evnt) {
|
|
244
|
+
// 处理 model 值双向绑定
|
|
245
|
+
const targetEl = evnt.target;
|
|
246
|
+
if (targetEl) {
|
|
247
|
+
const cellValue = targetEl.value;
|
|
248
|
+
if (isImmediateCell(renderOpts, params)) {
|
|
249
|
+
setCellValue(row, column, cellValue);
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
model.update = true;
|
|
253
|
+
model.value = cellValue;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
change(evnt) {
|
|
258
|
+
// 处理 change 事件相关逻辑
|
|
259
|
+
const targetEl = evnt.target;
|
|
260
|
+
if (targetEl) {
|
|
261
|
+
const cellValue = targetEl.value;
|
|
262
|
+
$table.updateStatus(params, cellValue);
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
blur(evnt) {
|
|
266
|
+
const targetEl = evnt.target;
|
|
267
|
+
if (targetEl) {
|
|
268
|
+
const cellValue = targetEl.value;
|
|
269
|
+
$table.updateStatus(params, cellValue);
|
|
270
|
+
}
|
|
215
271
|
}
|
|
216
|
-
}, (evnt) => {
|
|
217
|
-
// 处理 change 事件相关逻辑
|
|
218
|
-
const cellValue = evnt.target.value;
|
|
219
|
-
$table.updateStatus(params, cellValue);
|
|
220
272
|
});
|
|
221
273
|
}
|
|
222
274
|
function getNativeFilterOns(renderOpts, params, option) {
|
|
223
|
-
return getNativeElementOns(renderOpts, params,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
275
|
+
return getNativeElementOns(renderOpts, params, {
|
|
276
|
+
model(evnt) {
|
|
277
|
+
// 处理 model 值双向绑定
|
|
278
|
+
const targetEl = evnt.target;
|
|
279
|
+
if (targetEl) {
|
|
280
|
+
option.data = targetEl.value;
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
change() {
|
|
284
|
+
handleConfirmFilter(params, !XEUtils.eqNull(option.data), option);
|
|
285
|
+
},
|
|
286
|
+
blur() {
|
|
287
|
+
handleConfirmFilter(params, !XEUtils.eqNull(option.data), option);
|
|
288
|
+
}
|
|
228
289
|
});
|
|
229
290
|
}
|
|
230
291
|
/**
|
package/es/table/src/table.js
CHANGED
|
@@ -5375,34 +5375,10 @@ export default defineComponent({
|
|
|
5375
5375
|
* 如果单元格配置了校验规则,则会进行校验
|
|
5376
5376
|
*/
|
|
5377
5377
|
updateStatus(slotParams, cellValue) {
|
|
5378
|
-
const customVal = !XEUtils.isUndefined(cellValue);
|
|
5379
5378
|
return nextTick().then(() => {
|
|
5380
5379
|
const { editRules } = props;
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
if (slotParams && tableBody && editRules) {
|
|
5384
|
-
const { row, column } = slotParams;
|
|
5385
|
-
const type = 'change';
|
|
5386
|
-
if ($xeTable.hasCellRules) {
|
|
5387
|
-
if ($xeTable.hasCellRules(type, row, column)) {
|
|
5388
|
-
const cell = tableMethods.getCellElement(row, column);
|
|
5389
|
-
if (cell) {
|
|
5390
|
-
return $xeTable.validCellRules(type, row, column, cellValue)
|
|
5391
|
-
.then(() => {
|
|
5392
|
-
if (customVal && validStore.visible) {
|
|
5393
|
-
setCellValue(row, column, cellValue);
|
|
5394
|
-
}
|
|
5395
|
-
$xeTable.clearValidate(row, column);
|
|
5396
|
-
})
|
|
5397
|
-
.catch(({ rule }) => {
|
|
5398
|
-
if (customVal) {
|
|
5399
|
-
setCellValue(row, column, cellValue);
|
|
5400
|
-
}
|
|
5401
|
-
$xeTable.showValidTooltip({ rule, row, column, cell });
|
|
5402
|
-
});
|
|
5403
|
-
}
|
|
5404
|
-
}
|
|
5405
|
-
}
|
|
5380
|
+
if (slotParams && editRules) {
|
|
5381
|
+
return $xeTable.handleCellRuleUpdateStatus('change', slotParams, cellValue);
|
|
5406
5382
|
}
|
|
5407
5383
|
});
|
|
5408
5384
|
},
|
|
@@ -7741,6 +7717,32 @@ export default defineComponent({
|
|
|
7741
7717
|
$xeTable.handleColumnSortEvent(evnt, column);
|
|
7742
7718
|
}
|
|
7743
7719
|
},
|
|
7720
|
+
handleCellRuleUpdateStatus(type, cellParams, cellValue) {
|
|
7721
|
+
const { validStore } = reactData;
|
|
7722
|
+
const { row, column } = cellParams;
|
|
7723
|
+
if ($xeTable.hasCellRules) {
|
|
7724
|
+
if ($xeTable.hasCellRules(type, row, column)) {
|
|
7725
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
7726
|
+
if (cell) {
|
|
7727
|
+
const customVal = !XEUtils.isUndefined(cellValue);
|
|
7728
|
+
return $xeTable.validCellRules(type, row, column, cellValue)
|
|
7729
|
+
.then(() => {
|
|
7730
|
+
if (customVal && validStore.visible) {
|
|
7731
|
+
setCellValue(row, column, cellValue);
|
|
7732
|
+
}
|
|
7733
|
+
$xeTable.clearValidate(row, column);
|
|
7734
|
+
})
|
|
7735
|
+
.catch(({ rule }) => {
|
|
7736
|
+
if (customVal) {
|
|
7737
|
+
setCellValue(row, column, cellValue);
|
|
7738
|
+
}
|
|
7739
|
+
$xeTable.showValidTooltip({ rule, row, column, cell });
|
|
7740
|
+
});
|
|
7741
|
+
}
|
|
7742
|
+
}
|
|
7743
|
+
}
|
|
7744
|
+
return nextTick();
|
|
7745
|
+
},
|
|
7744
7746
|
/**
|
|
7745
7747
|
* 表头单元格按下事件
|
|
7746
7748
|
*/
|
package/es/table/style.css
CHANGED
|
@@ -2661,6 +2661,9 @@
|
|
|
2661
2661
|
.vxe-table--render-default.size--medium .vxe-cell .vxe-default-input[type=date]::-webkit-inner-spin-button {
|
|
2662
2662
|
margin-top: 3px;
|
|
2663
2663
|
}
|
|
2664
|
+
.vxe-table--render-default.size--medium .vxe-cell--valid-error-tip {
|
|
2665
|
+
padding: 0 var(--vxe-ui-table-cell-padding-medium);
|
|
2666
|
+
}
|
|
2664
2667
|
.vxe-table--render-default.size--small {
|
|
2665
2668
|
font-size: var(--vxe-ui-font-size-small);
|
|
2666
2669
|
}
|
|
@@ -2686,6 +2689,9 @@
|
|
|
2686
2689
|
.vxe-table--render-default.size--small .vxe-cell .vxe-default-input[type=date]::-webkit-inner-spin-button {
|
|
2687
2690
|
margin-top: 2px;
|
|
2688
2691
|
}
|
|
2692
|
+
.vxe-table--render-default.size--small .vxe-cell--valid-error-tip {
|
|
2693
|
+
padding: 0 var(--vxe-ui-table-cell-padding-small);
|
|
2694
|
+
}
|
|
2689
2695
|
.vxe-table--render-default.size--mini {
|
|
2690
2696
|
font-size: var(--vxe-ui-font-size-mini);
|
|
2691
2697
|
}
|
|
@@ -2711,6 +2717,9 @@
|
|
|
2711
2717
|
.vxe-table--render-default.size--mini .vxe-cell .vxe-default-input[type=date]::-webkit-inner-spin-button {
|
|
2712
2718
|
margin-top: 1px;
|
|
2713
2719
|
}
|
|
2720
|
+
.vxe-table--render-default.size--mini .vxe-cell--valid-error-tip {
|
|
2721
|
+
padding: 0 var(--vxe-ui-table-cell-padding-mini);
|
|
2722
|
+
}
|
|
2714
2723
|
.vxe-table--render-default .vxe-header--column.is--padding .vxe-cell,
|
|
2715
2724
|
.vxe-table--render-default .vxe-body--column.is--padding .vxe-cell,
|
|
2716
2725
|
.vxe-table--render-default .vxe-footer--column.is--padding .vxe-cell {
|
|
@@ -3288,8 +3297,7 @@
|
|
|
3288
3297
|
transform: translateX(-50%);
|
|
3289
3298
|
text-align: left;
|
|
3290
3299
|
z-index: 4;
|
|
3291
|
-
padding
|
|
3292
|
-
padding-right: var(--vxe-ui-table-cell-padding-right);
|
|
3300
|
+
padding: 0 var(--vxe-ui-table-cell-padding-default);
|
|
3293
3301
|
}
|
|
3294
3302
|
.vxe-table--render-default .vxe-body--column .vxe-cell--valid-error-wrapper {
|
|
3295
3303
|
display: inline-block;
|