@truenewx/tnxvue3 3.0.0-alpha.27 → 3.0.0-alpha.28
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truenewx/tnxvue3",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.28",
|
|
4
4
|
"description": "互联网技术解决方案:Vue3扩展支持",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"vue-router": "~4.4.0"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@truenewx/tnxcore": "3.0.0-alpha.
|
|
27
|
+
"@truenewx/tnxcore": "3.0.0-alpha.16",
|
|
28
28
|
"@element-plus/icons-vue": "2.3.1",
|
|
29
29
|
"async-validator": "4.2.5",
|
|
30
30
|
"mitt": "3.0.1"
|
|
@@ -40,15 +40,18 @@
|
|
|
40
40
|
<div class="tnxel-edit-table-footer" v-if="addable">
|
|
41
41
|
<tnxel-button type="primary" link icon="Plus" @click="toAddRow">{{ addText }}</tnxel-button>
|
|
42
42
|
</div>
|
|
43
|
+
<tnxel-icon class="d-none icon-warning" value="WarningFilled"/>
|
|
43
44
|
</div>
|
|
44
45
|
</template>
|
|
45
46
|
|
|
46
47
|
<script>
|
|
47
48
|
import Button from '../button/Button.vue';
|
|
49
|
+
import Icon from '../icon/Icon.vue';
|
|
48
50
|
|
|
49
51
|
export default {
|
|
50
52
|
components: {
|
|
51
53
|
'tnxel-button': Button,
|
|
54
|
+
'tnxel-icon': Icon,
|
|
52
55
|
},
|
|
53
56
|
name: 'TnxelEditTable',
|
|
54
57
|
props: {
|
|
@@ -192,15 +195,7 @@ export default {
|
|
|
192
195
|
});
|
|
193
196
|
},
|
|
194
197
|
bindRules() {
|
|
195
|
-
this.
|
|
196
|
-
element.addEventListener('blur', event => {
|
|
197
|
-
let element = event.target;
|
|
198
|
-
this.validateElement(fieldName, element);
|
|
199
|
-
});
|
|
200
|
-
element.addEventListener('focus', event => {
|
|
201
|
-
this.removeErrorIcon(event.target);
|
|
202
|
-
});
|
|
203
|
-
});
|
|
198
|
+
this.bindElementRules();
|
|
204
199
|
this.loopColumns((fieldName, columnName) => {
|
|
205
200
|
let rules = this.validationRules[fieldName];
|
|
206
201
|
if (rules) {
|
|
@@ -216,6 +211,20 @@ export default {
|
|
|
216
211
|
}
|
|
217
212
|
});
|
|
218
213
|
},
|
|
214
|
+
bindElementRules() {
|
|
215
|
+
this.loopValidatableElements((fieldName, element) => {
|
|
216
|
+
let blurEventHandler = event => {
|
|
217
|
+
this.validateElement(fieldName, event.target);
|
|
218
|
+
};
|
|
219
|
+
element.removeEventListener('blur', blurEventHandler);
|
|
220
|
+
element.addEventListener('blur', blurEventHandler);
|
|
221
|
+
let focusEventHandler = event => {
|
|
222
|
+
this.removeErrorIcon(event.target);
|
|
223
|
+
};
|
|
224
|
+
element.removeEventListener('focus', focusEventHandler);
|
|
225
|
+
element.addEventListener('focus', focusEventHandler);
|
|
226
|
+
});
|
|
227
|
+
},
|
|
219
228
|
validateElement(fieldName, element) {
|
|
220
229
|
this.removeErrorIcon(element);
|
|
221
230
|
element.parentElement.classList.remove('is-error');
|
|
@@ -234,9 +243,13 @@ export default {
|
|
|
234
243
|
}
|
|
235
244
|
message = message.trim();
|
|
236
245
|
element.parentElement.classList.add('is-error');
|
|
237
|
-
|
|
246
|
+
|
|
247
|
+
let container = document.getElementById(this.id);
|
|
248
|
+
let icon = container.getElementsByClassName('icon-warning')[0];
|
|
249
|
+
icon = icon.cloneNode(true);
|
|
250
|
+
icon.classList.remove('d-none');
|
|
251
|
+
icon.classList.remove('icon-warning');
|
|
238
252
|
icon.classList.add('error-icon');
|
|
239
|
-
icon.classList.add('el-icon'); // TODO
|
|
240
253
|
icon.classList.add('text-danger');
|
|
241
254
|
icon.title = message;
|
|
242
255
|
icon.style.top = (element.parentElement.offsetHeight - 16) / 2 + 'px';
|
|
@@ -295,6 +308,7 @@ export default {
|
|
|
295
308
|
let row = this.newRow();
|
|
296
309
|
this.data.push(row);
|
|
297
310
|
this.$nextTick(() => {
|
|
311
|
+
this.bindElementRules();
|
|
298
312
|
this.focusRowFirstInput(this.data.length - 1);
|
|
299
313
|
});
|
|
300
314
|
},
|
|
@@ -354,14 +368,8 @@ export default {
|
|
|
354
368
|
text-align: left;
|
|
355
369
|
}
|
|
356
370
|
|
|
357
|
-
.tnxel-edit-table-container .el-table
|
|
358
|
-
|
|
359
|
-
border-color: var(--el-color-primary);
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
.tnxel-edit-table-container .el-table .is-error .el-input__inner,
|
|
363
|
-
.tnxel-edit-table-container .el-table .is-error .el-textarea__inner {
|
|
364
|
-
border-color: var(--el-color-danger);
|
|
371
|
+
.tnxel-edit-table-container .el-table .is-error {
|
|
372
|
+
box-shadow: 0 0 0 1px var(--el-color-danger) inset;
|
|
365
373
|
}
|
|
366
374
|
|
|
367
375
|
.tnxel-edit-table-container .el-table th.is-required:not(.is-no-asterisk) .cell:after {
|
|
@@ -375,6 +383,7 @@ export default {
|
|
|
375
383
|
top: 12px;
|
|
376
384
|
right: 10px;
|
|
377
385
|
font-size: 16px;
|
|
386
|
+
cursor: default;
|
|
378
387
|
}
|
|
379
388
|
|
|
380
389
|
.tnxel-edit-table-container .el-table .el-input__inner:focus + .error-icon,
|
|
@@ -391,9 +400,9 @@ export default {
|
|
|
391
400
|
}
|
|
392
401
|
|
|
393
402
|
.tnxel-edit-table-container .tnxel-edit-table-footer {
|
|
394
|
-
border-left: 1px solid var(--el-border-color);
|
|
395
|
-
border-right: 1px solid var(--el-border-color);
|
|
396
|
-
border-bottom: 1px solid var(--el-border-color);
|
|
403
|
+
border-left: 1px solid var(--el-border-color-lighter);
|
|
404
|
+
border-right: 1px solid var(--el-border-color-lighter);
|
|
405
|
+
border-bottom: 1px solid var(--el-border-color-lighter);
|
|
397
406
|
height: 32px;
|
|
398
407
|
display: flex;
|
|
399
408
|
align-items: center;
|
|
@@ -142,8 +142,8 @@
|
|
|
142
142
|
{{ emptyText }}
|
|
143
143
|
</el-option>
|
|
144
144
|
<template v-for="item in items">
|
|
145
|
-
<el-option :key="item[valueName]" :value="item[valueName]" :
|
|
146
|
-
:disabled="item.disabled === true || typeof item.disabled === 'string'"
|
|
145
|
+
<el-option :key="item[valueName]" :value="item[valueName]" :label="item[textName]"
|
|
146
|
+
:data-value="item[valueName]" :disabled="item.disabled === true || typeof item.disabled === 'string'"
|
|
147
147
|
:title="typeof item.disabled === 'string' ? item.disabled : item.title"
|
|
148
148
|
v-if="!hiddenValues.contains(item[valueName])">
|
|
149
149
|
<slot name="option" :item="item" v-if="$slots.option"></slot>
|