@tmagic/form 1.2.7 → 1.2.9
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/dist/style.css +2 -4
- package/dist/tmagic-form.js +17 -30
- package/dist/tmagic-form.js.map +1 -1
- package/dist/tmagic-form.umd.cjs +16 -29
- package/dist/tmagic-form.umd.cjs.map +1 -1
- package/package.json +3 -3
- package/src/containers/Tabs.vue +22 -17
- package/src/theme/tabs.scss +2 -4
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.2.
|
|
2
|
+
"version": "1.2.9",
|
|
3
3
|
"name": "@tmagic/form",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@element-plus/icons-vue": "^2.0.9",
|
|
39
|
-
"@tmagic/design": "1.2.
|
|
40
|
-
"@tmagic/utils": "1.2.
|
|
39
|
+
"@tmagic/design": "1.2.9",
|
|
40
|
+
"@tmagic/utils": "1.2.9",
|
|
41
41
|
"lodash-es": "^4.17.21",
|
|
42
42
|
"sortablejs": "^1.14.0",
|
|
43
43
|
"vue": "^3.2.37"
|
package/src/containers/Tabs.vue
CHANGED
|
@@ -15,11 +15,10 @@
|
|
|
15
15
|
:is="uiComponent.component"
|
|
16
16
|
:key="tab[mForm?.keyProp || '__key'] ?? tabIndex"
|
|
17
17
|
:name="filter(tab.status) || tabIndex.toString()"
|
|
18
|
-
:label="filter(tab.title)"
|
|
19
18
|
:lazy="tab.lazy || false"
|
|
20
19
|
>
|
|
21
20
|
<template #label>
|
|
22
|
-
<span
|
|
21
|
+
<span>
|
|
23
22
|
{{ filter(tab.title)
|
|
24
23
|
}}<el-badge :hidden="!diffCount[tabIndex]" :value="diffCount[tabIndex]" class="diff-count-badge"></el-badge>
|
|
25
24
|
</span>
|
|
@@ -29,8 +28,26 @@
|
|
|
29
28
|
:key="item[mForm?.keyProp || '__key']"
|
|
30
29
|
:config="item"
|
|
31
30
|
:disabled="disabled"
|
|
32
|
-
:model="
|
|
33
|
-
|
|
31
|
+
:model="
|
|
32
|
+
config.dynamic
|
|
33
|
+
? (name ? model[name] : model)[tabIndex]
|
|
34
|
+
: tab.name
|
|
35
|
+
? (name ? model[name] : model)[tab.name]
|
|
36
|
+
: name
|
|
37
|
+
? model[name]
|
|
38
|
+
: model
|
|
39
|
+
"
|
|
40
|
+
:last-values="
|
|
41
|
+
isEmpty(lastValues)
|
|
42
|
+
? {}
|
|
43
|
+
: config.dynamic
|
|
44
|
+
? (name ? lastValues[name] : lastValues)[tabIndex]
|
|
45
|
+
: tab.name
|
|
46
|
+
? (name ? lastValues[name] : lastValues)[tab.name]
|
|
47
|
+
: name
|
|
48
|
+
? lastValues[name]
|
|
49
|
+
: lastValues
|
|
50
|
+
"
|
|
34
51
|
:is-compare="isCompare"
|
|
35
52
|
:prop="config.dynamic ? `${prop}${prop ? '.' : ''}${String(tabIndex)}` : prop"
|
|
36
53
|
:size="size"
|
|
@@ -46,7 +63,7 @@
|
|
|
46
63
|
|
|
47
64
|
<script setup lang="ts" name="MFormTabs">
|
|
48
65
|
import { computed, inject, ref, watchEffect } from 'vue';
|
|
49
|
-
import { cloneDeep } from 'lodash-es';
|
|
66
|
+
import { cloneDeep, isEmpty } from 'lodash-es';
|
|
50
67
|
|
|
51
68
|
import { getConfig, TMagicTabs } from '@tmagic/design';
|
|
52
69
|
|
|
@@ -185,18 +202,6 @@ const changeHandler = () => {
|
|
|
185
202
|
}
|
|
186
203
|
};
|
|
187
204
|
|
|
188
|
-
const getValues = (model: any, tabIndex: number, tab: any) => {
|
|
189
|
-
const tabName = props.config.dynamic ? (model[props?.name] || model)[tabIndex] : tab.name;
|
|
190
|
-
let propName = props.name;
|
|
191
|
-
if (tabName) {
|
|
192
|
-
propName = (model[props?.name] || model)[tab.name];
|
|
193
|
-
}
|
|
194
|
-
if (propName) {
|
|
195
|
-
return model[props.name];
|
|
196
|
-
}
|
|
197
|
-
return model;
|
|
198
|
-
};
|
|
199
|
-
|
|
200
205
|
// 在tabs组件中收集事件触发次数,即该tab下的差异数
|
|
201
206
|
const onAddDiffCount = (tabIndex: number) => {
|
|
202
207
|
if (!diffCount.value[tabIndex]) {
|
package/src/theme/tabs.scss
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
.magic-form-dynamic-tab {
|
|
2
2
|
.el-tabs__header.is-top {
|
|
3
|
-
display: flex;
|
|
4
|
-
flex-direction: row-reverse;
|
|
5
3
|
padding-right: 8px;
|
|
6
4
|
.el-tabs__new-tab {
|
|
7
5
|
margin-right: auto;
|
|
8
|
-
min-width:
|
|
6
|
+
min-width: 50px;
|
|
9
7
|
outline: none;
|
|
10
8
|
border-color: #409eff;
|
|
11
9
|
color: #409eff;
|
|
12
|
-
width:
|
|
10
|
+
width: 10px;
|
|
13
11
|
&::before {
|
|
14
12
|
content: "添加";
|
|
15
13
|
}
|