@meethive/components 0.0.3 → 0.0.4
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/AutoComplete/AutoComplete.js +71 -80
- package/es/BadgeStatus/Badge.js +38 -47
- package/es/CardSelect/CardSelect.js +115 -137
- package/es/CheckButton/CheckButton.js +102 -118
- package/es/ConfigProvider/ConfigProvider.js +44 -68
- package/es/DragModal/DragModal.js +191 -212
- package/es/EditTable/Body.js +158 -189
- package/es/EditTable/CellRender.js +10 -12
- package/es/EditTable/EditTable.js +385 -434
- package/es/EditTable/FormItem.js +140 -169
- package/es/EditTable/Group.js +171 -204
- package/es/EditTable/Header.js +57 -63
- package/es/EditTable/HeaderRender.js +10 -12
- package/es/EditTable/components/ContextMenu/Menu.js +78 -86
- package/es/EditTable/components/Search/Search.js +151 -163
- package/es/EditTable/components/Search/Sort.js +104 -119
- package/es/Ellipsis/Ellipsis.js +144 -148
- package/es/Empty/Empty.js +51 -57
- package/es/FullPage/FullPage.js +20 -19
- package/es/Icon/Icon.js +42 -49
- package/es/LocaleProvider/LocaleProvider.js +32 -38
- package/es/Markdown/Markdown.js +101 -118
- package/es/PermissionButton/PermissionButton.js +118 -118
- package/es/ProLayout/Basic/BasicLayout.js +301 -418
- package/es/ProLayout/Basic/Header.js +91 -111
- package/es/ProLayout/PageContainer/index.js +267 -344
- package/es/ProLayout/SiderMenu/BaseMenu.js +186 -240
- package/es/ProTable/Alert.js +39 -40
- package/es/ProTable/Content.js +84 -97
- package/es/ProTable/Header.js +32 -33
- package/es/ProTable/Pagination.js +56 -55
- package/es/ProTable/ProTable.js +256 -276
- package/es/RadioButton/RadioButton.js +48 -53
- package/es/Scrollbar/Bar.js +65 -76
- package/es/Scrollbar/Scrollbar.js +129 -161
- package/es/Scrollbar/Thumb.js +101 -150
- package/es/Search/Item.js +208 -236
- package/es/Search/Search.js +90 -90
- package/es/Skeleton/Skeleton.js +26 -27
- package/es/Skeleton/components/DashBoardCard.js +26 -27
- package/es/Skeleton/components/DashBoardChart.js +26 -27
- package/es/Skeleton/components/Detail.js +26 -27
- package/es/Skeleton/components/Drawer.js +26 -27
- package/es/Skeleton/components/Item.js +55 -54
- package/es/Skeleton/components/List.js +29 -27
- package/es/Skeleton/components/ListCard.js +28 -28
- package/es/Skeleton/components/ListCardItem.js +20 -20
- package/es/Skeleton/components/ListTable.js +26 -27
- package/es/Skeleton/components/Page.js +27 -26
- package/es/Skeleton/components/Search.js +16 -16
- package/es/Skeleton/components/Tree.js +26 -27
- package/es/TimeFormat/TimeFormat.js +32 -36
- package/es/Title/Title.js +23 -26
- package/es/ValueItem/ValueItem.js +100 -113
- package/es/VirtualTable/VirtualTable.js +235 -271
- package/lib/AutoComplete/AutoComplete.js +71 -80
- package/lib/BadgeStatus/Badge.js +38 -47
- package/lib/CardSelect/CardSelect.js +115 -137
- package/lib/CheckButton/CheckButton.js +102 -118
- package/lib/ConfigProvider/ConfigProvider.js +44 -68
- package/lib/DragModal/DragModal.js +191 -212
- package/lib/EditTable/Body.js +158 -189
- package/lib/EditTable/CellRender.js +10 -12
- package/lib/EditTable/EditTable.js +385 -434
- package/lib/EditTable/FormItem.js +140 -169
- package/lib/EditTable/Group.js +171 -204
- package/lib/EditTable/Header.js +57 -63
- package/lib/EditTable/HeaderRender.js +10 -12
- package/lib/EditTable/components/ContextMenu/Menu.js +78 -86
- package/lib/EditTable/components/Search/Search.js +151 -163
- package/lib/EditTable/components/Search/Sort.js +104 -119
- package/lib/Ellipsis/Ellipsis.js +144 -148
- package/lib/Empty/Empty.js +51 -57
- package/lib/FullPage/FullPage.js +20 -19
- package/lib/Icon/Icon.js +42 -49
- package/lib/LocaleProvider/LocaleProvider.js +32 -38
- package/lib/Markdown/Markdown.js +101 -118
- package/lib/PermissionButton/PermissionButton.js +118 -118
- package/lib/ProLayout/Basic/BasicLayout.js +301 -418
- package/lib/ProLayout/Basic/Header.js +91 -111
- package/lib/ProLayout/PageContainer/index.js +267 -344
- package/lib/ProLayout/SiderMenu/BaseMenu.js +186 -240
- package/lib/ProTable/Alert.js +39 -40
- package/lib/ProTable/Content.js +84 -97
- package/lib/ProTable/Header.js +32 -33
- package/lib/ProTable/Pagination.js +56 -55
- package/lib/ProTable/ProTable.js +256 -276
- package/lib/RadioButton/RadioButton.js +48 -53
- package/lib/Scrollbar/Bar.js +65 -76
- package/lib/Scrollbar/Scrollbar.js +129 -161
- package/lib/Scrollbar/Thumb.js +101 -150
- package/lib/Search/Item.js +208 -236
- package/lib/Search/Search.js +90 -90
- package/lib/Skeleton/Skeleton.js +26 -27
- package/lib/Skeleton/components/DashBoardCard.js +26 -27
- package/lib/Skeleton/components/DashBoardChart.js +26 -27
- package/lib/Skeleton/components/Detail.js +26 -27
- package/lib/Skeleton/components/Drawer.js +26 -27
- package/lib/Skeleton/components/Item.js +55 -54
- package/lib/Skeleton/components/List.js +29 -27
- package/lib/Skeleton/components/ListCard.js +28 -28
- package/lib/Skeleton/components/ListCardItem.js +20 -20
- package/lib/Skeleton/components/ListTable.js +26 -27
- package/lib/Skeleton/components/Page.js +27 -26
- package/lib/Skeleton/components/Search.js +16 -16
- package/lib/Skeleton/components/Tree.js +26 -27
- package/lib/TimeFormat/TimeFormat.js +32 -36
- package/lib/Title/Title.js +23 -26
- package/lib/ValueItem/ValueItem.js +100 -113
- package/lib/VirtualTable/VirtualTable.js +235 -271
- package/package.json +1 -1
package/es/EditTable/FormItem.js
CHANGED
|
@@ -1,169 +1,140 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const prefixCls = computed(() => 'jetlinks-edit-table')
|
|
28
|
-
const [wrapSSR, hashId] = genEditTableStyle(prefixCls)
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
const names = isArray(props.name) ? props.name : [props.name]
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
computed(() => get(context.dataSource.value, props.name ))
|
|
142
|
-
)
|
|
143
|
-
|
|
144
|
-
onBeforeUnmount(() => {
|
|
145
|
-
hideErrorTip()
|
|
146
|
-
})
|
|
147
|
-
|
|
148
|
-
watch(
|
|
149
|
-
() => [filedName.value, props.name],
|
|
150
|
-
() => {
|
|
151
|
-
context.addField(eventKey.value, {
|
|
152
|
-
filedName: filedName.value,
|
|
153
|
-
eventKey: eventKey.value,
|
|
154
|
-
names: props.name,
|
|
155
|
-
validateRules,
|
|
156
|
-
showErrorTip
|
|
157
|
-
})
|
|
158
|
-
},
|
|
159
|
-
{ immediate: true }
|
|
160
|
-
)
|
|
161
|
-
|
|
162
|
-
return {
|
|
163
|
-
hashId,
|
|
164
|
-
eventKey,
|
|
165
|
-
errorMap,
|
|
166
|
-
popContainer
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
})
|
|
1
|
+
import { defineComponent, reactive, computed, watch, provide, onBeforeUnmount } from 'vue';
|
|
2
|
+
import { Tooltip as ATooltip } from 'ant-design-vue';
|
|
3
|
+
import { get, isArray } from 'lodash-es';
|
|
4
|
+
import { useProvideFormItemContext } from 'ant-design-vue/es/form/FormItemContext';
|
|
5
|
+
import { useInjectError, useInjectForm } from './hooks';
|
|
6
|
+
import { TABLE_FORM_ITEM_ERROR } from './consts';
|
|
7
|
+
import genEditTableStyle from './style';
|
|
8
|
+
export default defineComponent({
|
|
9
|
+
name: 'JEditTableFormItem',
|
|
10
|
+
components: {
|
|
11
|
+
ATooltip
|
|
12
|
+
},
|
|
13
|
+
props: {
|
|
14
|
+
name: {
|
|
15
|
+
type: [String, Array],
|
|
16
|
+
default: undefined
|
|
17
|
+
},
|
|
18
|
+
required: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: false
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
emits: ['change'],
|
|
24
|
+
setup(props, {
|
|
25
|
+
emit
|
|
26
|
+
}) {
|
|
27
|
+
const prefixCls = computed(() => 'jetlinks-edit-table');
|
|
28
|
+
const [wrapSSR, hashId] = genEditTableStyle(prefixCls);
|
|
29
|
+
const context = useInjectForm();
|
|
30
|
+
const globalErrorMessage = useInjectError();
|
|
31
|
+
let hideTimer = null;
|
|
32
|
+
const eventKey = computed(() => {
|
|
33
|
+
const names = isArray(props.name) ? props.name : [props.name];
|
|
34
|
+
return names.join('-');
|
|
35
|
+
});
|
|
36
|
+
const errorMap = reactive({
|
|
37
|
+
message: '',
|
|
38
|
+
visible: false
|
|
39
|
+
});
|
|
40
|
+
const filedId = computed(() => {
|
|
41
|
+
const names = isArray(props.name) ? props.name : [props.name];
|
|
42
|
+
const [index, ...extra] = names;
|
|
43
|
+
return `${index}-${extra.join('.')}`;
|
|
44
|
+
});
|
|
45
|
+
const filedName = computed(() => {
|
|
46
|
+
const names = isArray(props.name) ? props.name : [props.name];
|
|
47
|
+
return [...names].pop();
|
|
48
|
+
});
|
|
49
|
+
const filedValue = computed(() => {
|
|
50
|
+
return get(context.dataSource.value, props.name);
|
|
51
|
+
});
|
|
52
|
+
provide(TABLE_FORM_ITEM_ERROR, errorMap);
|
|
53
|
+
const popContainer = e => {
|
|
54
|
+
return e;
|
|
55
|
+
};
|
|
56
|
+
const removeTimer = () => {
|
|
57
|
+
if (hideTimer) {
|
|
58
|
+
window.clearTimeout(hideTimer);
|
|
59
|
+
hideTimer = null;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const showErrorTip = msg => {
|
|
63
|
+
removeTimer();
|
|
64
|
+
errorMap.message = msg;
|
|
65
|
+
errorMap.visible = true;
|
|
66
|
+
};
|
|
67
|
+
const hideErrorTip = () => {
|
|
68
|
+
errorMap.visible = false;
|
|
69
|
+
removeTimer();
|
|
70
|
+
hideTimer = window.setTimeout(() => {
|
|
71
|
+
errorMap.message = '';
|
|
72
|
+
}, 300);
|
|
73
|
+
};
|
|
74
|
+
const validateRules = () => {
|
|
75
|
+
let index = 0;
|
|
76
|
+
if (isArray(props.name)) {
|
|
77
|
+
index = props.name[0];
|
|
78
|
+
}
|
|
79
|
+
const promise = context.validateItem({
|
|
80
|
+
[filedName.value]: get(context.dataSource.value, props.name)
|
|
81
|
+
}, index);
|
|
82
|
+
promise.catch(res => {
|
|
83
|
+
const error = res?.filter(item => item.field === filedName.value) || [];
|
|
84
|
+
if (error.length === 0) {
|
|
85
|
+
hideErrorTip();
|
|
86
|
+
context.removeFieldError(eventKey.value);
|
|
87
|
+
} else {
|
|
88
|
+
removeTimer();
|
|
89
|
+
errorMap.message = error[0]?.message || errorMap.message;
|
|
90
|
+
errorMap.visible = !!error.length;
|
|
91
|
+
context.addFieldError(eventKey.value, errorMap.message);
|
|
92
|
+
}
|
|
93
|
+
return errorMap.message;
|
|
94
|
+
});
|
|
95
|
+
return promise;
|
|
96
|
+
};
|
|
97
|
+
const onFieldBlur = () => {
|
|
98
|
+
// validateRules()
|
|
99
|
+
};
|
|
100
|
+
const onFieldChange = () => {
|
|
101
|
+
validateRules();
|
|
102
|
+
emit('change');
|
|
103
|
+
};
|
|
104
|
+
watch(() => globalErrorMessage.value, val => {
|
|
105
|
+
if (val[eventKey.value]) {
|
|
106
|
+
showErrorTip(val[eventKey.value]);
|
|
107
|
+
} else {
|
|
108
|
+
hideErrorTip();
|
|
109
|
+
}
|
|
110
|
+
}, {
|
|
111
|
+
immediate: true,
|
|
112
|
+
deep: true
|
|
113
|
+
});
|
|
114
|
+
useProvideFormItemContext({
|
|
115
|
+
id: filedId,
|
|
116
|
+
onFieldChange,
|
|
117
|
+
onFieldBlur
|
|
118
|
+
}, computed(() => get(context.dataSource.value, props.name)));
|
|
119
|
+
onBeforeUnmount(() => {
|
|
120
|
+
hideErrorTip();
|
|
121
|
+
});
|
|
122
|
+
watch(() => [filedName.value, props.name], () => {
|
|
123
|
+
context.addField(eventKey.value, {
|
|
124
|
+
filedName: filedName.value,
|
|
125
|
+
eventKey: eventKey.value,
|
|
126
|
+
names: props.name,
|
|
127
|
+
validateRules,
|
|
128
|
+
showErrorTip
|
|
129
|
+
});
|
|
130
|
+
}, {
|
|
131
|
+
immediate: true
|
|
132
|
+
});
|
|
133
|
+
return {
|
|
134
|
+
hashId,
|
|
135
|
+
eventKey,
|
|
136
|
+
errorMap,
|
|
137
|
+
popContainer
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
});
|