@meethive/components 0.0.2 → 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 +38 -31
- 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 +38 -31
- 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
|
@@ -1,86 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
showDetail,
|
|
80
|
-
showPaste,
|
|
81
|
-
showDelete,
|
|
82
|
-
clickFunc,
|
|
83
|
-
close
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
})
|
|
1
|
+
import { defineComponent, ref, computed, onMounted, nextTick } from 'vue';
|
|
2
|
+
import { Menu } from 'ant-design-vue';
|
|
3
|
+
import AIcon from '../../../Icon';
|
|
4
|
+
import { useLocaleReceiver } from '../../../LocaleReciver';
|
|
5
|
+
import useEditTableStyle from '../../style';
|
|
6
|
+
const MenuItem = Menu.Item;
|
|
7
|
+
export default defineComponent({
|
|
8
|
+
name: 'JEditTableContextMenu',
|
|
9
|
+
components: {
|
|
10
|
+
Menu,
|
|
11
|
+
MenuItem,
|
|
12
|
+
AIcon
|
|
13
|
+
},
|
|
14
|
+
props: {
|
|
15
|
+
data: {
|
|
16
|
+
type: Object,
|
|
17
|
+
default: () => ({})
|
|
18
|
+
},
|
|
19
|
+
onClose: {
|
|
20
|
+
type: Function,
|
|
21
|
+
default: () => {}
|
|
22
|
+
},
|
|
23
|
+
onClick: {
|
|
24
|
+
type: Function,
|
|
25
|
+
default: () => {}
|
|
26
|
+
},
|
|
27
|
+
onCopy: {
|
|
28
|
+
type: Function,
|
|
29
|
+
default: () => {}
|
|
30
|
+
},
|
|
31
|
+
paste: {
|
|
32
|
+
type: Object,
|
|
33
|
+
default: () => ({})
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
setup(props) {
|
|
37
|
+
const contextMenu = ref(null);
|
|
38
|
+
const prefixCls = computed(() => 'jetlinks-edit-table');
|
|
39
|
+
const [wrapSSR, hashId] = useEditTableStyle(prefixCls);
|
|
40
|
+
const [contextLocale] = useLocaleReceiver('EditTable');
|
|
41
|
+
const showDetail = computed(() => {
|
|
42
|
+
return !props.data.id;
|
|
43
|
+
});
|
|
44
|
+
const showPaste = computed(() => {
|
|
45
|
+
return !props.paste;
|
|
46
|
+
});
|
|
47
|
+
const showDelete = computed(() => {
|
|
48
|
+
return props.data?.expands?.isProduct;
|
|
49
|
+
});
|
|
50
|
+
const clickFunc = ({
|
|
51
|
+
key
|
|
52
|
+
}) => {
|
|
53
|
+
if (key === 'copy') {
|
|
54
|
+
props.onCopy(props.data);
|
|
55
|
+
}
|
|
56
|
+
props.onClick(key);
|
|
57
|
+
};
|
|
58
|
+
const close = () => {
|
|
59
|
+
setTimeout(() => {
|
|
60
|
+
props.onClose();
|
|
61
|
+
}, 300);
|
|
62
|
+
};
|
|
63
|
+
onMounted(async () => {
|
|
64
|
+
await nextTick();
|
|
65
|
+
contextMenu.value.focus();
|
|
66
|
+
});
|
|
67
|
+
return {
|
|
68
|
+
contextMenu,
|
|
69
|
+
hashId,
|
|
70
|
+
contextLocale,
|
|
71
|
+
showDetail,
|
|
72
|
+
showPaste,
|
|
73
|
+
showDelete,
|
|
74
|
+
clickFunc,
|
|
75
|
+
close
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
});
|
|
@@ -1,163 +1,151 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const [contextLocale] = useLocaleReceiver('EditTable')
|
|
34
|
-
const dataSource = useTableDataSource()
|
|
35
|
-
const openGroup = useTableOpenGroup()
|
|
36
|
-
const tableTool = useTableTool()
|
|
37
|
-
const groupOptions = useGroupOptions()
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const selectedTableRow =
|
|
62
|
-
tableTool.scrollTo({
|
|
63
|
-
...record,
|
|
64
|
-
__serial: record.__oldSerial - 1
|
|
65
|
-
})
|
|
66
|
-
tableTool.selected([record.id])
|
|
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
|
-
searchIndex.value
|
|
106
|
-
} else {
|
|
107
|
-
searchIndex.value
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (
|
|
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
|
-
|
|
142
|
-
selectedRowKeys
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
modalHeight,
|
|
153
|
-
tableHeight,
|
|
154
|
-
selectedRowKeys,
|
|
155
|
-
tableRef,
|
|
156
|
-
myColumns,
|
|
157
|
-
search,
|
|
158
|
-
heightChange,
|
|
159
|
-
onClose,
|
|
160
|
-
onSelect
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
})
|
|
1
|
+
import { defineComponent, ref, computed } from 'vue';
|
|
2
|
+
import { Space as ASpace, Input as AInput, Button as AButton } from 'ant-design-vue';
|
|
3
|
+
import EditTable from '../../EditTable.js';
|
|
4
|
+
import DragModal from '../../../DragModal/DragModal.js';
|
|
5
|
+
import Ellipsis from '../../../Ellipsis/Ellipsis.js';
|
|
6
|
+
import { useTableDataSource, useTableOpenGroup, useTableTool, useGroupOptions } from '../../context';
|
|
7
|
+
import { useLocaleReceiver } from '../../../LocaleReciver';
|
|
8
|
+
import { isNumber, isArray, isObject, isBoolean } from 'lodash-es';
|
|
9
|
+
export default defineComponent({
|
|
10
|
+
name: 'JEditTableSearch',
|
|
11
|
+
components: {
|
|
12
|
+
ASpace,
|
|
13
|
+
AInput,
|
|
14
|
+
AButton,
|
|
15
|
+
EditTable,
|
|
16
|
+
DragModal,
|
|
17
|
+
Ellipsis
|
|
18
|
+
},
|
|
19
|
+
props: {
|
|
20
|
+
searchKey: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: 'id'
|
|
23
|
+
},
|
|
24
|
+
columns: {
|
|
25
|
+
type: Array,
|
|
26
|
+
default: undefined
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
emits: ['close'],
|
|
30
|
+
setup(props, {
|
|
31
|
+
emit
|
|
32
|
+
}) {
|
|
33
|
+
const [contextLocale] = useLocaleReceiver('EditTable');
|
|
34
|
+
const dataSource = useTableDataSource();
|
|
35
|
+
const openGroup = useTableOpenGroup();
|
|
36
|
+
const tableTool = useTableTool();
|
|
37
|
+
const groupOptions = useGroupOptions();
|
|
38
|
+
const searchValue = ref();
|
|
39
|
+
const filterArray = ref([]);
|
|
40
|
+
const visible = ref(false);
|
|
41
|
+
const searchIndex = ref(-1);
|
|
42
|
+
const modalHeight = ref(100);
|
|
43
|
+
const tableHeight = ref(230);
|
|
44
|
+
const selectedRowKeys = ref([]);
|
|
45
|
+
const tableRef = ref();
|
|
46
|
+
const myColumns = computed(() => {
|
|
47
|
+
if (props.columns) {
|
|
48
|
+
return props.columns.map(item => ({
|
|
49
|
+
title: item.title,
|
|
50
|
+
dataIndex: item.dataIndex
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
return [{
|
|
54
|
+
title: contextLocale.value.columns.sign,
|
|
55
|
+
dataIndex: 'id'
|
|
56
|
+
}, {
|
|
57
|
+
title: contextLocale.value.columns.name,
|
|
58
|
+
dataIndex: 'name'
|
|
59
|
+
}];
|
|
60
|
+
});
|
|
61
|
+
const selectedTableRow = record => {
|
|
62
|
+
tableTool.scrollTo({
|
|
63
|
+
...record,
|
|
64
|
+
__serial: record.__oldSerial - 1
|
|
65
|
+
});
|
|
66
|
+
tableTool.selected([record.id]);
|
|
67
|
+
};
|
|
68
|
+
const handleFilterArray = () => {
|
|
69
|
+
const cloneDataSource = JSON.parse(JSON.stringify(dataSource.value || '[]')).map(item => Object.assign(item, {
|
|
70
|
+
__oldSerial: item.__serial
|
|
71
|
+
}));
|
|
72
|
+
const _filterArray = cloneDataSource.filter(item => {
|
|
73
|
+
let targetValue = item[props.searchKey];
|
|
74
|
+
if (targetValue) {
|
|
75
|
+
if (isNumber(targetValue) || isBoolean(targetValue)) {
|
|
76
|
+
targetValue = String(targetValue);
|
|
77
|
+
} else if (isArray(targetValue) || isObject(targetValue)) {
|
|
78
|
+
targetValue = JSON.stringify(targetValue);
|
|
79
|
+
}
|
|
80
|
+
return targetValue.includes(searchValue.value);
|
|
81
|
+
}
|
|
82
|
+
return false;
|
|
83
|
+
});
|
|
84
|
+
if (openGroup) {
|
|
85
|
+
const handleGroup = [];
|
|
86
|
+
groupOptions.value.forEach(group => {
|
|
87
|
+
handleGroup.push(..._filterArray.filter(item => item.expands.groupId === group.value));
|
|
88
|
+
});
|
|
89
|
+
return handleGroup;
|
|
90
|
+
}
|
|
91
|
+
return _filterArray;
|
|
92
|
+
};
|
|
93
|
+
const search = key => {
|
|
94
|
+
filterArray.value = handleFilterArray();
|
|
95
|
+
if (key === 'all') {
|
|
96
|
+
visible.value = true;
|
|
97
|
+
modalHeight.value = 400;
|
|
98
|
+
searchIndex.value = 0;
|
|
99
|
+
} else if (key === 'next') {
|
|
100
|
+
searchIndex.value += 1;
|
|
101
|
+
} else {
|
|
102
|
+
searchIndex.value -= 1;
|
|
103
|
+
}
|
|
104
|
+
if (searchIndex.value < 0) {
|
|
105
|
+
searchIndex.value = filterArray.value.length - 1;
|
|
106
|
+
} else if (searchIndex.value > filterArray.value.length - 1) {
|
|
107
|
+
searchIndex.value = 0;
|
|
108
|
+
}
|
|
109
|
+
const searchItem = filterArray.value[searchIndex.value];
|
|
110
|
+
if (key !== 'all' && visible.value) {
|
|
111
|
+
tableRef.value?.scrollToByIndex(searchIndex.value - 1);
|
|
112
|
+
}
|
|
113
|
+
if (filterArray.value.length >= 1) {
|
|
114
|
+
selectedRowKeys.value = [searchItem.id];
|
|
115
|
+
selectedTableRow(searchItem);
|
|
116
|
+
} else {
|
|
117
|
+
selectedRowKeys.value = [];
|
|
118
|
+
tableTool.selected([]);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
const heightChange = h => {
|
|
122
|
+
if (h > 340) {
|
|
123
|
+
tableHeight.value = h - 160;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
const onClose = () => {
|
|
127
|
+
emit('close');
|
|
128
|
+
};
|
|
129
|
+
const onSelect = record => {
|
|
130
|
+
searchIndex.value = filterArray.value.findIndex(item => item.id === record.id);
|
|
131
|
+
selectedRowKeys.value = [record.id];
|
|
132
|
+
selectedTableRow(record);
|
|
133
|
+
};
|
|
134
|
+
return {
|
|
135
|
+
contextLocale,
|
|
136
|
+
openGroup,
|
|
137
|
+
searchValue,
|
|
138
|
+
filterArray,
|
|
139
|
+
visible,
|
|
140
|
+
modalHeight,
|
|
141
|
+
tableHeight,
|
|
142
|
+
selectedRowKeys,
|
|
143
|
+
tableRef,
|
|
144
|
+
myColumns,
|
|
145
|
+
search,
|
|
146
|
+
heightChange,
|
|
147
|
+
onClose,
|
|
148
|
+
onSelect
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
});
|