@truenewx/tnxvue3 3.0.0-alpha.26 → 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"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<el-tooltip :content="tooltipContent" :placement="tooltipPlacement" :disabled="disabled || !tooltipContent"
|
|
3
|
-
|
|
3
|
+
v-if="disabled === false || disabledTip !== false">
|
|
4
4
|
<el-dropdown split-button :type="type" :class="className" :disabled="disabled" :title="title" :size="size"
|
|
5
|
-
|
|
5
|
+
:style="$attrs.style" @click="clickButton" @command="clickItem" v-if="dropdownItems.length">
|
|
6
6
|
<i :class="icon" style="margin-right: 0.5rem;" v-if="icon"></i>
|
|
7
7
|
<template v-if="!hiddenCaption">
|
|
8
8
|
<slot v-if="$slots.default"></slot>
|
|
@@ -11,18 +11,18 @@
|
|
|
11
11
|
<template #dropdown>
|
|
12
12
|
<el-dropdown-menu>
|
|
13
13
|
<el-dropdown-item v-for="dropdownItem of dropdownItems" :key="dropdownItem.path"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
:icon="dropdownItem.icon" :disabled="dropdownItem.disabled"
|
|
15
|
+
:title="dropdownItem.title"
|
|
16
|
+
:command="dropdownItem">
|
|
17
17
|
{{ dropdownItem.caption || (dropdownItem.menuItem ? dropdownItem.menuItem.caption : '') }}
|
|
18
18
|
</el-dropdown-item>
|
|
19
19
|
</el-dropdown-menu>
|
|
20
20
|
</template>
|
|
21
21
|
</el-dropdown>
|
|
22
22
|
<el-button :type="type" :class="className" :disabled="disabled" :title="title" @click="clickButton" :size="size"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
:loading="loading" :plain="plain" :link="link" :bg="bg" :autofocus="autofocus"
|
|
24
|
+
:round="round"
|
|
25
|
+
:circle="circle" :style="$attrs.style" v-else>
|
|
26
26
|
<tnxel-icon :value="icon" v-if="icon"/>
|
|
27
27
|
<span v-if="!hiddenCaption && ($slots.default || menuItem)">
|
|
28
28
|
<slot>{{ menuItem ? menuItem.caption : '' }}</slot>
|
|
@@ -56,7 +56,6 @@ export default {
|
|
|
56
56
|
loading: Boolean,
|
|
57
57
|
plain: Boolean,
|
|
58
58
|
link: Boolean,
|
|
59
|
-
text: Boolean,
|
|
60
59
|
bg: Boolean,
|
|
61
60
|
autofocus: Boolean,
|
|
62
61
|
round: Boolean,
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
<el-table-column label="排序" align="center" width="60px" v-if="sortable">
|
|
13
13
|
<template #default="scope">
|
|
14
14
|
<tnxel-button
|
|
15
|
-
type="
|
|
15
|
+
type="primary" link
|
|
16
16
|
icon="Top"
|
|
17
17
|
:class="{'text-transparent': scope.$index === 0}"
|
|
18
18
|
@click="sortUp(scope.$index)"
|
|
19
19
|
/>
|
|
20
20
|
<tnxel-button
|
|
21
|
-
type="
|
|
21
|
+
type="primary" link
|
|
22
22
|
icon="Bottom"
|
|
23
23
|
class="ms-0"
|
|
24
24
|
:class="{'text-transparent': scope.$index === data.length - 1}"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<el-table-column label="移除" align="center" width="60px" v-if="removable">
|
|
30
30
|
<template #default="scope">
|
|
31
31
|
<tnxel-button
|
|
32
|
-
type="primary"
|
|
32
|
+
type="primary" link
|
|
33
33
|
icon="CircleClose"
|
|
34
34
|
:tooltip="scope.row.removeTip"
|
|
35
35
|
@click="toRemoveRow(scope.$index)"
|
|
@@ -37,22 +37,21 @@
|
|
|
37
37
|
</template>
|
|
38
38
|
</el-table-column>
|
|
39
39
|
</el-table>
|
|
40
|
-
<
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
</template>
|
|
45
|
-
</el-table-column>
|
|
46
|
-
</el-table>
|
|
40
|
+
<div class="tnxel-edit-table-footer" v-if="addable">
|
|
41
|
+
<tnxel-button type="primary" link icon="Plus" @click="toAddRow">{{ addText }}</tnxel-button>
|
|
42
|
+
</div>
|
|
43
|
+
<tnxel-icon class="d-none icon-warning" value="WarningFilled"/>
|
|
47
44
|
</div>
|
|
48
45
|
</template>
|
|
49
46
|
|
|
50
47
|
<script>
|
|
51
48
|
import Button from '../button/Button.vue';
|
|
49
|
+
import Icon from '../icon/Icon.vue';
|
|
52
50
|
|
|
53
51
|
export default {
|
|
54
52
|
components: {
|
|
55
53
|
'tnxel-button': Button,
|
|
54
|
+
'tnxel-icon': Icon,
|
|
56
55
|
},
|
|
57
56
|
name: 'TnxelEditTable',
|
|
58
57
|
props: {
|
|
@@ -196,15 +195,7 @@ export default {
|
|
|
196
195
|
});
|
|
197
196
|
},
|
|
198
197
|
bindRules() {
|
|
199
|
-
this.
|
|
200
|
-
element.addEventListener('blur', event => {
|
|
201
|
-
let element = event.target;
|
|
202
|
-
this.validateElement(fieldName, element);
|
|
203
|
-
});
|
|
204
|
-
element.addEventListener('focus', event => {
|
|
205
|
-
this.removeErrorIcon(event.target);
|
|
206
|
-
});
|
|
207
|
-
});
|
|
198
|
+
this.bindElementRules();
|
|
208
199
|
this.loopColumns((fieldName, columnName) => {
|
|
209
200
|
let rules = this.validationRules[fieldName];
|
|
210
201
|
if (rules) {
|
|
@@ -220,6 +211,20 @@ export default {
|
|
|
220
211
|
}
|
|
221
212
|
});
|
|
222
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
|
+
},
|
|
223
228
|
validateElement(fieldName, element) {
|
|
224
229
|
this.removeErrorIcon(element);
|
|
225
230
|
element.parentElement.classList.remove('is-error');
|
|
@@ -238,9 +243,13 @@ export default {
|
|
|
238
243
|
}
|
|
239
244
|
message = message.trim();
|
|
240
245
|
element.parentElement.classList.add('is-error');
|
|
241
|
-
|
|
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');
|
|
242
252
|
icon.classList.add('error-icon');
|
|
243
|
-
icon.classList.add('el-icon'); // TODO
|
|
244
253
|
icon.classList.add('text-danger');
|
|
245
254
|
icon.title = message;
|
|
246
255
|
icon.style.top = (element.parentElement.offsetHeight - 16) / 2 + 'px';
|
|
@@ -299,6 +308,7 @@ export default {
|
|
|
299
308
|
let row = this.newRow();
|
|
300
309
|
this.data.push(row);
|
|
301
310
|
this.$nextTick(() => {
|
|
311
|
+
this.bindElementRules();
|
|
302
312
|
this.focusRowFirstInput(this.data.length - 1);
|
|
303
313
|
});
|
|
304
314
|
},
|
|
@@ -335,7 +345,8 @@ export default {
|
|
|
335
345
|
padding: 0;
|
|
336
346
|
}
|
|
337
347
|
|
|
338
|
-
.tnxel-edit-table-container .el-table.padding-none .el-table__body-wrapper .el-input__wrapper
|
|
348
|
+
.tnxel-edit-table-container .el-table.padding-none .el-table__body-wrapper .el-input__wrapper,
|
|
349
|
+
.tnxel-edit-table-container .el-table.padding-none .el-table__body-wrapper .el-select__wrapper {
|
|
339
350
|
border-radius: 0;
|
|
340
351
|
height: 32px;
|
|
341
352
|
}
|
|
@@ -357,14 +368,8 @@ export default {
|
|
|
357
368
|
text-align: left;
|
|
358
369
|
}
|
|
359
370
|
|
|
360
|
-
.tnxel-edit-table-container .el-table
|
|
361
|
-
|
|
362
|
-
border-color: var(--el-color-primary);
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
.tnxel-edit-table-container .el-table .is-error .el-input__inner,
|
|
366
|
-
.tnxel-edit-table-container .el-table .is-error .el-textarea__inner {
|
|
367
|
-
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;
|
|
368
373
|
}
|
|
369
374
|
|
|
370
375
|
.tnxel-edit-table-container .el-table th.is-required:not(.is-no-asterisk) .cell:after {
|
|
@@ -378,6 +383,7 @@ export default {
|
|
|
378
383
|
top: 12px;
|
|
379
384
|
right: 10px;
|
|
380
385
|
font-size: 16px;
|
|
386
|
+
cursor: default;
|
|
381
387
|
}
|
|
382
388
|
|
|
383
389
|
.tnxel-edit-table-container .el-table .el-input__inner:focus + .error-icon,
|
|
@@ -394,11 +400,15 @@ export default {
|
|
|
394
400
|
}
|
|
395
401
|
|
|
396
402
|
.tnxel-edit-table-container .tnxel-edit-table-footer {
|
|
397
|
-
border-
|
|
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);
|
|
406
|
+
height: 32px;
|
|
407
|
+
display: flex;
|
|
408
|
+
align-items: center;
|
|
398
409
|
}
|
|
399
410
|
|
|
400
|
-
.tnxel-edit-table-container .tnxel-edit-table-footer .el-
|
|
401
|
-
|
|
402
|
-
padding-bottom: 3px;
|
|
411
|
+
.tnxel-edit-table-container .tnxel-edit-table-footer .el-button {
|
|
412
|
+
width: 100%;
|
|
403
413
|
}
|
|
404
414
|
</style>
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span v-if="item">{{ item.caption }}</span>
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script>
|
|
6
|
-
export default {
|
|
7
|
-
name: 'TnxelEnumView',
|
|
8
|
-
props: {
|
|
9
|
-
type: {
|
|
10
|
-
type: String,
|
|
11
|
-
required: true,
|
|
12
|
-
},
|
|
13
|
-
subtype: String,
|
|
14
|
-
itemKey: {
|
|
15
|
-
type: String,
|
|
16
|
-
required: true,
|
|
17
|
-
},
|
|
18
|
-
app: {
|
|
19
|
-
type: String,
|
|
20
|
-
default: () => window.tnx.componentDefaultApp, // 设置为方法以延时加载,确保更改的值生效
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
data() {
|
|
24
|
-
return {
|
|
25
|
-
item: null,
|
|
26
|
-
};
|
|
27
|
-
},
|
|
28
|
-
mounted() {
|
|
29
|
-
window.tnx.app.rpc.loadEnumType(this.type, this.subtype, enumType => {
|
|
30
|
-
this.item = enumType.items.find(item => item.key === this.itemKey);
|
|
31
|
-
}, {
|
|
32
|
-
app: this.app,
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
methods: {}
|
|
36
|
-
}
|
|
37
|
-
</script>
|
|
38
|
-
|
|
39
|
-
<style scoped>
|
|
40
|
-
|
|
41
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<span v-if="item">{{ item.caption }}</span>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
export default {
|
|
7
|
+
name: 'TnxelEnumView',
|
|
8
|
+
props: {
|
|
9
|
+
type: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
subtype: String,
|
|
14
|
+
itemKey: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
app: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: () => window.tnx.componentDefaultApp, // 设置为方法以延时加载,确保更改的值生效
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
data() {
|
|
24
|
+
return {
|
|
25
|
+
item: null,
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
mounted() {
|
|
29
|
+
window.tnx.app.rpc.loadEnumType(this.type, this.subtype, enumType => {
|
|
30
|
+
this.item = enumType.items.find(item => item.key === this.itemKey);
|
|
31
|
+
}, {
|
|
32
|
+
app: this.app,
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
methods: {}
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<style scoped>
|
|
40
|
+
|
|
41
|
+
</style>
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
<Memo v-else-if="value === 'Memo'"/>
|
|
35
35
|
<Minus v-else-if="value === 'Minus'"/>
|
|
36
36
|
<MoreFilled v-else-if="value === 'MoreFilled'"/>
|
|
37
|
+
<Notebook v-else-if="value === 'Notebook'"/>
|
|
37
38
|
<OfficeBuilding v-else-if="value === 'OfficeBuilding'"/>
|
|
38
39
|
<Picture v-else-if="value === 'Picture'"/>
|
|
39
40
|
<PictureFilled v-else-if="value === 'PictureFilled'"/>
|
|
@@ -96,6 +97,7 @@ import {
|
|
|
96
97
|
Memo,
|
|
97
98
|
Minus,
|
|
98
99
|
MoreFilled,
|
|
100
|
+
Notebook,
|
|
99
101
|
OfficeBuilding,
|
|
100
102
|
Picture,
|
|
101
103
|
PictureFilled,
|
|
@@ -155,6 +157,7 @@ const components = {
|
|
|
155
157
|
Memo,
|
|
156
158
|
Minus,
|
|
157
159
|
MoreFilled,
|
|
160
|
+
Notebook,
|
|
158
161
|
Loading,
|
|
159
162
|
OfficeBuilding,
|
|
160
163
|
Picture,
|
|
@@ -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>
|