@jetlinks-web/components 2.4.25 → 2.5.1
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/EditTable/Body.js +91 -181
- package/es/EditTable/EditTable.js +179 -105
- package/es/EditTable/FormItem.js +3 -4
- package/es/EditTable/Header.js +56 -164
- package/es/EditTable/components/ContextMenu/Menu.js +11 -7
- package/es/EditTable/components/Search/index.js +2 -1
- package/es/EditTable/components/Search/{Search.js → search.js} +94 -66
- package/es/EditTable/components/Search/sort.js +214 -0
- package/es/EditTable/consts.js +6 -1
- package/es/EditTable/context.js +50 -0
- package/es/EditTable/group.js +355 -0
- package/es/EditTable/hooks/index.js +1 -0
- package/es/EditTable/hooks/useGroup.js +44 -0
- package/es/EditTable/props.js +14 -4
- package/es/EditTable/style/body.less +17 -27
- package/es/EditTable/style/form.less +33 -0
- package/es/EditTable/style/group.less +32 -0
- package/es/EditTable/style/header.less +16 -21
- package/es/EditTable/style/index.css +103 -66
- package/es/EditTable/style/index.less +3 -0
- package/es/EditTable/style/menu.less +25 -0
- package/es/EditTable/style/table.less +2 -11
- package/es/EditTable/utils.js +22 -50
- package/es/FullPage/FullPage.js +1 -1
- package/es/PermissionButton/index.js +40 -20
- package/es/RadioButton/RadioButton.js +1 -1
- package/es/Search/Advanced/SaveHistory.js +1 -1
- package/es/Search/Item.js +1 -1
- package/es/Search/Search.js +1 -1
- package/es/locale/en-US.js +39 -3
- package/es/locale/zh-CN.js +36 -0
- package/es/style/index.css +103 -66
- package/lib/EditTable/Body.js +91 -181
- package/lib/EditTable/EditTable.js +179 -105
- package/lib/EditTable/FormItem.js +3 -4
- package/lib/EditTable/Header.js +56 -164
- package/lib/EditTable/components/ContextMenu/Menu.js +11 -7
- package/lib/EditTable/components/Search/index.js +10 -3
- package/lib/EditTable/components/Search/{Search.js → search.js} +94 -66
- package/lib/EditTable/components/Search/sort.js +214 -0
- package/lib/EditTable/consts.js +7 -2
- package/lib/EditTable/context.js +56 -0
- package/lib/EditTable/group.js +355 -0
- package/lib/EditTable/hooks/index.js +12 -0
- package/lib/EditTable/hooks/useGroup.js +50 -0
- package/lib/EditTable/props.js +14 -4
- package/lib/EditTable/style/body.less +17 -27
- package/lib/EditTable/style/form.less +33 -0
- package/lib/EditTable/style/group.less +32 -0
- package/lib/EditTable/style/header.less +16 -21
- package/lib/EditTable/style/index.css +103 -66
- package/lib/EditTable/style/index.less +3 -0
- package/lib/EditTable/style/menu.less +25 -0
- package/lib/EditTable/style/table.less +2 -11
- package/lib/EditTable/utils.js +23 -51
- package/lib/FullPage/FullPage.js +1 -1
- package/lib/PermissionButton/index.js +40 -20
- package/lib/RadioButton/RadioButton.js +1 -1
- package/lib/Search/Advanced/SaveHistory.js +1 -1
- package/lib/Search/Item.js +1 -1
- package/lib/Search/Search.js +1 -1
- package/lib/locale/en-US.js +39 -3
- package/lib/locale/zh-CN.js +36 -0
- package/lib/style/index.css +103 -66
- package/package.json +2 -2
|
@@ -17,22 +17,25 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
|
|
|
17
17
|
/* Analyzed bindings: {
|
|
18
18
|
"serial": "props",
|
|
19
19
|
"validateRowKey": "props",
|
|
20
|
+
"readonly": "props",
|
|
20
21
|
"FULL_SCREEN": "setup-maybe-ref",
|
|
21
22
|
"RIGHT_MENU": "setup-maybe-ref",
|
|
22
23
|
"TABLE_DATA_SOURCE": "setup-maybe-ref",
|
|
23
24
|
"TABLE_ERROR": "setup-maybe-ref",
|
|
25
|
+
"TABLE_GROUP_ACTIVE": "setup-maybe-ref",
|
|
26
|
+
"TABLE_GROUP_ERROR": "setup-maybe-ref",
|
|
27
|
+
"TABLE_GROUP_OPTIONS": "setup-maybe-ref",
|
|
28
|
+
"TABLE_OPEN_GROUP": "setup-maybe-ref",
|
|
24
29
|
"TABLE_TOOL": "setup-maybe-ref",
|
|
25
30
|
"TABLE_WRAPPER": "setup-maybe-ref",
|
|
26
31
|
"handleColumnsWidth": "setup-maybe-ref",
|
|
32
|
+
"useGroup": "setup-maybe-ref",
|
|
27
33
|
"useResizeObserver": "setup-maybe-ref",
|
|
28
34
|
"useValidate": "setup-maybe-ref",
|
|
29
|
-
"useFormContext": "setup-maybe-ref",
|
|
30
35
|
"tableProps": "setup-maybe-ref",
|
|
31
|
-
"
|
|
32
|
-
"Body": "setup-const",
|
|
36
|
+
"useFormContext": "setup-maybe-ref",
|
|
33
37
|
"useFullscreen": "setup-maybe-ref",
|
|
34
38
|
"provide": "setup-const",
|
|
35
|
-
"useAttrs": "setup-const",
|
|
36
39
|
"useSlots": "setup-const",
|
|
37
40
|
"ref": "setup-const",
|
|
38
41
|
"reactive": "setup-const",
|
|
@@ -40,24 +43,35 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
|
|
|
40
43
|
"computed": "setup-const",
|
|
41
44
|
"watch": "setup-const",
|
|
42
45
|
"bodyProps": "setup-maybe-ref",
|
|
43
|
-
"defaultProps": "setup-maybe-ref",
|
|
44
46
|
"findIndex": "setup-maybe-ref",
|
|
45
47
|
"get": "setup-maybe-ref",
|
|
46
48
|
"sortBy": "setup-maybe-ref",
|
|
49
|
+
"Header": "setup-const",
|
|
50
|
+
"Body": "setup-const",
|
|
51
|
+
"Group": "setup-const",
|
|
52
|
+
"useLocaleReceiver": "setup-maybe-ref",
|
|
47
53
|
"emit": "setup-const",
|
|
54
|
+
"contextLocale": "setup-maybe-ref",
|
|
48
55
|
"props": "setup-reactive-const",
|
|
49
56
|
"slots": "setup-maybe-ref",
|
|
50
|
-
"attrs": "setup-maybe-ref",
|
|
51
57
|
"myColumns": "setup-ref",
|
|
52
58
|
"tableWrapper": "setup-ref",
|
|
53
59
|
"tableBody": "setup-ref",
|
|
54
|
-
"horizontalScrollRef": "setup-ref",
|
|
55
|
-
"scrollMap": "setup-reactive-const",
|
|
56
60
|
"tableStyle": "setup-reactive-const",
|
|
57
61
|
"fields": "setup-const",
|
|
62
|
+
"defaultGroupId": "literal-const",
|
|
58
63
|
"fieldsErrMap": "setup-ref",
|
|
64
|
+
"fieldsGroupError": "setup-ref",
|
|
65
|
+
"scrollDefaultWidth": "setup-ref",
|
|
59
66
|
"sortData": "setup-reactive-const",
|
|
67
|
+
"groupActive": "setup-maybe-ref",
|
|
68
|
+
"groupOptions": "setup-maybe-ref",
|
|
69
|
+
"addGroup": "setup-maybe-ref",
|
|
70
|
+
"removeGroup": "setup-maybe-ref",
|
|
71
|
+
"updateGroupActive": "setup-maybe-ref",
|
|
72
|
+
"updateGroupOptions": "setup-maybe-ref",
|
|
60
73
|
"_dataSource": "setup-ref",
|
|
74
|
+
"bodyDataSource": "setup-ref",
|
|
61
75
|
"isFullscreen": "setup-maybe-ref",
|
|
62
76
|
"toggle": "setup-maybe-ref",
|
|
63
77
|
"rules": "setup-maybe-ref",
|
|
@@ -70,75 +84,81 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
|
|
|
70
84
|
"removeFieldError": "setup-const",
|
|
71
85
|
"addFieldError": "setup-const",
|
|
72
86
|
"scrollWidth": "setup-ref",
|
|
73
|
-
"onHorizontalScroll": "setup-const",
|
|
74
87
|
"onResize": "setup-const",
|
|
75
88
|
"onScrollDown": "setup-const",
|
|
76
89
|
"rightMenu": "setup-const",
|
|
77
90
|
"scrollToById": "setup-const",
|
|
78
91
|
"scrollToByIndex": "setup-const",
|
|
79
|
-
"getTableWrapperRef": "setup-const"
|
|
92
|
+
"getTableWrapperRef": "setup-const",
|
|
93
|
+
"groupDelete": "setup-const",
|
|
94
|
+
"groupEdit": "setup-const",
|
|
95
|
+
"getGroupActive": "setup-const"
|
|
80
96
|
} */
|
|
81
|
-
import { unref as _unref, renderSlot as _renderSlot, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, createVNode as _createVNode, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, withCtx as _withCtx, renderList as _renderList, createSlots as _createSlots, openBlock as _openBlock,
|
|
97
|
+
import { unref as _unref, renderSlot as _renderSlot, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, createVNode as _createVNode, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, withCtx as _withCtx, renderList as _renderList, createSlots as _createSlots, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, normalizeClass as _normalizeClass, createElementBlock as _createElementBlock } from "vue";
|
|
82
98
|
const _hoisted_1 = { class: "jetlinks-edit-table-extra" };
|
|
83
99
|
const _hoisted_2 = { class: "jetlinks-edit-table" };
|
|
84
|
-
|
|
85
|
-
key: 0,
|
|
86
|
-
class: "jetlinks-edit-table-horizontal-scroll"
|
|
87
|
-
};
|
|
88
|
-
import { FULL_SCREEN, RIGHT_MENU, TABLE_DATA_SOURCE, TABLE_ERROR, TABLE_TOOL, TABLE_WRAPPER } from './consts';
|
|
100
|
+
import { FULL_SCREEN, RIGHT_MENU, TABLE_DATA_SOURCE, TABLE_ERROR, TABLE_GROUP_ACTIVE, TABLE_GROUP_ERROR, TABLE_GROUP_OPTIONS, TABLE_OPEN_GROUP, TABLE_TOOL, TABLE_WRAPPER } from './consts';
|
|
89
101
|
import { handleColumnsWidth } from './utils';
|
|
90
|
-
import { useResizeObserver, useValidate
|
|
102
|
+
import { useGroup, useResizeObserver, useValidate } from './hooks';
|
|
91
103
|
import { tableProps } from 'ant-design-vue/lib/table';
|
|
92
|
-
import
|
|
93
|
-
import Body from './Body.js';
|
|
104
|
+
import { useFormContext } from './context';
|
|
94
105
|
import { useFullscreen } from '@vueuse/core';
|
|
95
|
-
import { provide,
|
|
96
|
-
import { bodyProps
|
|
106
|
+
import { provide, useSlots, ref, reactive, computed, watch } from 'vue';
|
|
107
|
+
import { bodyProps } from "./props";
|
|
97
108
|
import { findIndex, get, sortBy } from 'lodash-es';
|
|
109
|
+
import Header from './Header.js';
|
|
110
|
+
import Body from './Body.js';
|
|
111
|
+
import Group from './group.js';
|
|
112
|
+
import { useLocaleReceiver } from "../LocaleReciver";
|
|
113
|
+
const defaultGroupId = 'group_1';
|
|
98
114
|
const __sfc_main__ = Object.assign({
|
|
99
115
|
name: 'JEditTable'
|
|
100
116
|
}, {
|
|
101
117
|
props: {
|
|
102
118
|
...tableProps(),
|
|
103
|
-
...defaultProps(),
|
|
104
119
|
...bodyProps(),
|
|
105
120
|
serial: {
|
|
106
121
|
type: [Object, Boolean],
|
|
107
|
-
default: () => ({
|
|
122
|
+
default: () => ({
|
|
123
|
+
width: 66,
|
|
124
|
+
title: ''
|
|
125
|
+
})
|
|
108
126
|
},
|
|
109
127
|
validateRowKey: {
|
|
110
128
|
type: Boolean,
|
|
111
129
|
default: false
|
|
112
130
|
},
|
|
131
|
+
readonly: {
|
|
132
|
+
type: Boolean,
|
|
133
|
+
default: false
|
|
134
|
+
}
|
|
113
135
|
},
|
|
114
136
|
emits: ['scrollDown', 'rightMenuClick', 'editChange', 'searchVisibleChange'],
|
|
115
137
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
116
138
|
const emit = __emit;
|
|
139
|
+
const [contextLocale] = useLocaleReceiver('EditTable');
|
|
117
140
|
const props = __props;
|
|
118
141
|
const slots = useSlots();
|
|
119
|
-
const attrs = useAttrs();
|
|
120
142
|
const myColumns = ref([]);
|
|
121
143
|
const tableWrapper = ref();
|
|
122
144
|
const tableBody = ref();
|
|
123
|
-
const horizontalScrollRef = ref();
|
|
124
|
-
const scrollMap = reactive({
|
|
125
|
-
x: 0,
|
|
126
|
-
y: 0,
|
|
127
|
-
down: undefined
|
|
128
|
-
});
|
|
129
145
|
const tableStyle = reactive({
|
|
130
146
|
width: '100%',
|
|
131
147
|
height: props.height
|
|
132
148
|
});
|
|
133
149
|
const fields = {};
|
|
134
150
|
const fieldsErrMap = ref({});
|
|
151
|
+
const fieldsGroupError = ref({});
|
|
152
|
+
const scrollDefaultWidth = ref(17);
|
|
135
153
|
const sortData = reactive({
|
|
136
154
|
key: undefined,
|
|
137
155
|
order: undefined,
|
|
138
156
|
orderKeys: [],
|
|
139
157
|
dataIndex: undefined
|
|
140
158
|
});
|
|
159
|
+
const { groupActive, groupOptions, addGroup, removeGroup, updateGroupActive, updateGroupOptions } = useGroup(props.openGroup);
|
|
141
160
|
const _dataSource = computed(() => {
|
|
161
|
+
const _options = new Map();
|
|
142
162
|
const sortDataSource = sortData.key ?
|
|
143
163
|
sortBy(props.dataSource, (val) => {
|
|
144
164
|
if (!val.id)
|
|
@@ -148,15 +168,53 @@ const __sfc_main__ = Object.assign({
|
|
|
148
168
|
}) : props.dataSource;
|
|
149
169
|
sortDataSource.forEach((item, index) => {
|
|
150
170
|
item.__dataIndex = index;
|
|
151
|
-
|
|
171
|
+
if (props.openGroup) {
|
|
172
|
+
const _groupId = _optionalChain([item, 'access', _2 => _2.expands, 'optionalAccess', _3 => _3.groupId]);
|
|
173
|
+
if (!_groupId) {
|
|
174
|
+
item.expands.groupId = groupActive.value || defaultGroupId;
|
|
175
|
+
item.expands.groupName = groupActive.label || (contextLocale.value.Group.one + '1');
|
|
176
|
+
}
|
|
177
|
+
const _optionsItem = _options.get(item.expands.groupId);
|
|
178
|
+
if (!_optionsItem) {
|
|
179
|
+
_options.set(item.expands.groupId, {
|
|
180
|
+
value: _optionalChain([item, 'access', _4 => _4.expands, 'optionalAccess', _5 => _5.groupId]),
|
|
181
|
+
label: _optionalChain([item, 'access', _6 => _6.expands, 'optionalAccess', _7 => _7.groupName]),
|
|
182
|
+
effective: item.id ? 1 : 0,
|
|
183
|
+
len: 1 // 分组数据总长度
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
if (item.id) {
|
|
188
|
+
_optionsItem.effective += 1;
|
|
189
|
+
}
|
|
190
|
+
_optionsItem.len += 1;
|
|
191
|
+
_options.set(item.expands.groupId, _optionsItem);
|
|
192
|
+
}
|
|
193
|
+
item.__serial = _optionalChain([_optionsItem, 'optionalAccess', _8 => _8.len]) || 1;
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
item.__serial = index + 1;
|
|
197
|
+
}
|
|
152
198
|
});
|
|
199
|
+
if (props.openGroup) {
|
|
200
|
+
updateGroupOptions([..._options.values()]);
|
|
201
|
+
}
|
|
153
202
|
return sortDataSource;
|
|
154
203
|
});
|
|
204
|
+
const bodyDataSource = computed(() => {
|
|
205
|
+
if (props.openGroup) {
|
|
206
|
+
return _dataSource.value.filter(item => {
|
|
207
|
+
return item.expands.groupId === groupActive.value;
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
return _dataSource.value;
|
|
211
|
+
});
|
|
155
212
|
useResizeObserver(tableWrapper, onResize);
|
|
156
213
|
const { isFullscreen, toggle } = useFullscreen(tableWrapper);
|
|
157
214
|
const { rules, validateItem, validate, errorMap } = useValidate(_dataSource, props.columns, props.rowKey, {
|
|
158
215
|
onError: (err) => {
|
|
159
216
|
fieldsErrMap.value = {};
|
|
217
|
+
fieldsGroupError.value = {};
|
|
160
218
|
const errMap = {};
|
|
161
219
|
// 显示全部err红标
|
|
162
220
|
err.forEach((item, errIndex) => {
|
|
@@ -168,6 +226,10 @@ const __sfc_main__ = Object.assign({
|
|
|
168
226
|
}
|
|
169
227
|
errMap[_eventKey] = e.message;
|
|
170
228
|
if (errIndex === 0 && eIndex === 0) {
|
|
229
|
+
if (props.openGroup) {
|
|
230
|
+
const expands = _dataSource.value[e.__dataIndex].expands;
|
|
231
|
+
updateGroupActive(expands.groupId, expands.groupName);
|
|
232
|
+
}
|
|
171
233
|
setTimeout(() => {
|
|
172
234
|
tableBody.value.scrollTo(e.__serial - 1);
|
|
173
235
|
}, 10);
|
|
@@ -188,9 +250,15 @@ const __sfc_main__ = Object.assign({
|
|
|
188
250
|
provide(FULL_SCREEN, isFullscreen);
|
|
189
251
|
provide(RIGHT_MENU, { click: rightMenu, getPopupContainer: () => tableWrapper.value });
|
|
190
252
|
provide(TABLE_ERROR, fieldsErrMap);
|
|
253
|
+
provide(TABLE_GROUP_ERROR, fieldsGroupError);
|
|
191
254
|
provide(TABLE_DATA_SOURCE, _dataSource);
|
|
255
|
+
provide(TABLE_OPEN_GROUP, props.openGroup);
|
|
192
256
|
provide(TABLE_TOOL, {
|
|
193
257
|
scrollTo: (record) => {
|
|
258
|
+
if (props.openGroup) {
|
|
259
|
+
const expands = record.expands;
|
|
260
|
+
updateGroupActive(expands.groupId, expands.groupName);
|
|
261
|
+
}
|
|
194
262
|
setTimeout(() => {
|
|
195
263
|
tableBody.value.scrollTo(record.__serial);
|
|
196
264
|
}, 10);
|
|
@@ -210,13 +278,10 @@ const __sfc_main__ = Object.assign({
|
|
|
210
278
|
sortData.orderKeys = [];
|
|
211
279
|
sortData.dataIndex = undefined;
|
|
212
280
|
},
|
|
213
|
-
|
|
214
|
-
emit('searchVisibleChange', v);
|
|
215
|
-
},
|
|
216
|
-
scrollMap,
|
|
217
|
-
sortData,
|
|
218
|
-
columns: myColumns
|
|
281
|
+
sortData
|
|
219
282
|
});
|
|
283
|
+
provide(TABLE_GROUP_OPTIONS, groupOptions);
|
|
284
|
+
provide(TABLE_GROUP_ACTIVE, groupActive);
|
|
220
285
|
const addField = (key, field) => {
|
|
221
286
|
fields[key] = field;
|
|
222
287
|
};
|
|
@@ -237,57 +302,31 @@ const __sfc_main__ = Object.assign({
|
|
|
237
302
|
fieldsErrMap.value[key] = message;
|
|
238
303
|
}
|
|
239
304
|
const scrollWidth = computed(() => {
|
|
240
|
-
|
|
241
|
-
if (props.dataSource.length * props.cellHeight) {
|
|
242
|
-
_width = 17;
|
|
243
|
-
}
|
|
244
|
-
if (_optionalChain([tableBody, 'access', _2 => _2.value, 'optionalAccess', _3 => _3.getViewScrollRef]) && props.dataSource.length) {
|
|
245
|
-
const viewScrollDom = _optionalChain([tableBody, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.getViewScrollRef, 'call', _6 => _6()]);
|
|
246
|
-
const bodyContainer = viewScrollDom.querySelector('.jetlinks-edit-table-body-container');
|
|
247
|
-
_width = viewScrollDom.offsetWidth - bodyContainer.offsetWidth;
|
|
248
|
-
}
|
|
249
|
-
return _width;
|
|
305
|
+
return (props.dataSource.length * props.cellHeight) > props.height ? scrollDefaultWidth.value : 0;
|
|
250
306
|
});
|
|
251
|
-
|
|
252
|
-
if (!horizontalScrollRef.value)
|
|
253
|
-
return;
|
|
254
|
-
const { clientWidth, scrollLeft, scrollWidth } = horizontalScrollRef.value;
|
|
255
|
-
scrollMap.x = scrollLeft;
|
|
256
|
-
if (clientWidth + scrollLeft >= scrollWidth) {
|
|
257
|
-
scrollMap.down = 'right';
|
|
258
|
-
}
|
|
259
|
-
else if (scrollLeft === 0) {
|
|
260
|
-
scrollMap.down = undefined;
|
|
261
|
-
}
|
|
262
|
-
else {
|
|
263
|
-
scrollMap.down = 'left';
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
function onResize({ width = 0, height }) {
|
|
307
|
+
function onResize({ width = 0 }) {
|
|
267
308
|
const _width = width - scrollWidth.value;
|
|
268
309
|
tableStyle.width = width || '100%';
|
|
310
|
+
// const viewportDom = document.querySelector('.jetlinks-edit-table-body-viewport')
|
|
311
|
+
// const viewportDivDom = viewportDom.querySelector('div')
|
|
312
|
+
//
|
|
313
|
+
// scrollDefaultWidth.value = viewportDom.offsetWidth - viewportDivDom.offsetWidth
|
|
269
314
|
let newColumns = [...props.columns];
|
|
270
315
|
if (props.serial) {
|
|
271
|
-
const options = Object.assign({
|
|
272
|
-
title: '序号',
|
|
273
|
-
width: 66,
|
|
274
|
-
fixed: 'left'
|
|
275
|
-
}, props.serial);
|
|
276
316
|
const serial = {
|
|
277
317
|
dataIndex: '__serial',
|
|
278
|
-
title:
|
|
318
|
+
title: props.serial.title || contextLocale.value.serial,
|
|
279
319
|
customRender: (customData) => {
|
|
280
|
-
if (_optionalChain([props, 'access',
|
|
281
|
-
return _optionalChain([props, 'access',
|
|
320
|
+
if (_optionalChain([props, 'access', _9 => _9.serial, 'optionalAccess', _10 => _10.customRender])) {
|
|
321
|
+
return _optionalChain([props, 'access', _11 => _11.serial, 'optionalAccess', _12 => _12.customRender, 'call', _13 => _13(customData)]);
|
|
282
322
|
}
|
|
283
323
|
return customData.index + 1;
|
|
284
324
|
},
|
|
285
|
-
width:
|
|
286
|
-
fixed: options.fixed
|
|
325
|
+
width: _optionalChain([props, 'access', _14 => _14.serial, 'optionalAccess', _15 => _15.width])
|
|
287
326
|
};
|
|
288
327
|
newColumns = [serial, ...props.columns];
|
|
289
328
|
}
|
|
290
|
-
myColumns.value = handleColumnsWidth(newColumns, _width
|
|
329
|
+
myColumns.value = handleColumnsWidth(newColumns, _width);
|
|
291
330
|
}
|
|
292
331
|
const onScrollDown = (len) => {
|
|
293
332
|
emit('scrollDown', len);
|
|
@@ -305,6 +344,52 @@ const __sfc_main__ = Object.assign({
|
|
|
305
344
|
const getTableWrapperRef = () => {
|
|
306
345
|
return tableWrapper.value;
|
|
307
346
|
};
|
|
347
|
+
const groupDelete = (id, index) => {
|
|
348
|
+
removeGroup(index);
|
|
349
|
+
Object.keys(fieldsErrMap.value).forEach(errorKey => {
|
|
350
|
+
const [index] = errorKey.split('-');
|
|
351
|
+
const dataSourceItem = _dataSource.value[index];
|
|
352
|
+
const groupId = _optionalChain([dataSourceItem, 'access', _16 => _16.expands, 'optionalAccess', _17 => _17.groupId]);
|
|
353
|
+
if (groupId === id) {
|
|
354
|
+
removeFieldError(errorKey);
|
|
355
|
+
removeField(errorKey);
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
emit('groupDelete', id);
|
|
359
|
+
};
|
|
360
|
+
const groupEdit = (record) => {
|
|
361
|
+
emit('groupEdit', record);
|
|
362
|
+
};
|
|
363
|
+
const getGroupActive = () => {
|
|
364
|
+
return groupActive.value;
|
|
365
|
+
};
|
|
366
|
+
watch(() => fieldsErrMap.value, (errorMap) => {
|
|
367
|
+
fieldsGroupError.value = {};
|
|
368
|
+
if (props.openGroup) {
|
|
369
|
+
const _errorObj = errorMap;
|
|
370
|
+
const groupErrorMap = {};
|
|
371
|
+
Object.keys(_errorObj).forEach(errorKey => {
|
|
372
|
+
const [index] = errorKey.split('-');
|
|
373
|
+
const dataSourceItem = _dataSource.value[index];
|
|
374
|
+
const groupId = _optionalChain([dataSourceItem, 'access', _18 => _18.expands, 'optionalAccess', _19 => _19.groupId]);
|
|
375
|
+
const groupError = groupErrorMap[groupId];
|
|
376
|
+
const groupErrorItem = {
|
|
377
|
+
[errorKey]: {
|
|
378
|
+
message: _errorObj[errorKey],
|
|
379
|
+
index,
|
|
380
|
+
serial: dataSourceItem.__serial
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
if (groupError) {
|
|
384
|
+
groupError.push(groupErrorItem);
|
|
385
|
+
}
|
|
386
|
+
else {
|
|
387
|
+
groupErrorMap[groupId] = [groupErrorItem];
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
fieldsGroupError.value = groupErrorMap;
|
|
391
|
+
}
|
|
392
|
+
}, { deep: true });
|
|
308
393
|
watch(() => scrollWidth.value, () => {
|
|
309
394
|
onResize({ width: tableStyle.width });
|
|
310
395
|
});
|
|
@@ -326,6 +411,7 @@ const __sfc_main__ = Object.assign({
|
|
|
326
411
|
scrollToById,
|
|
327
412
|
scrollToByIndex,
|
|
328
413
|
getTableWrapperRef,
|
|
414
|
+
getGroupActive
|
|
329
415
|
});
|
|
330
416
|
return (_ctx, _cache) => {
|
|
331
417
|
return (_openBlock(), _createElementBlock("div", {
|
|
@@ -349,14 +435,8 @@ const __sfc_main__ = Object.assign({
|
|
|
349
435
|
}, [
|
|
350
436
|
_createVNode(Header, {
|
|
351
437
|
columns: myColumns.value,
|
|
352
|
-
style: _normalizeStyle({ width: tableStyle.width })
|
|
353
|
-
|
|
354
|
-
searchColumns: _ctx.searchColumns
|
|
355
|
-
}, null, 8 /* PROPS */, ["columns", "style", "rowKey", "searchColumns"]),
|
|
356
|
-
_createElementVNode("div", {
|
|
357
|
-
class: "jetlinks-edit-table-header-scroll-hidden",
|
|
358
|
-
style: _normalizeStyle({ width: scrollWidth.value + 'px' })
|
|
359
|
-
}, null, 4 /* STYLE */)
|
|
438
|
+
style: _normalizeStyle({ width: tableStyle.width })
|
|
439
|
+
}, null, 8 /* PROPS */, ["columns", "style"])
|
|
360
440
|
], 4 /* STYLE */),
|
|
361
441
|
_createElementVNode("div", {
|
|
362
442
|
class: "jetlinks-edit-table-body",
|
|
@@ -365,13 +445,16 @@ const __sfc_main__ = Object.assign({
|
|
|
365
445
|
_createVNode(Body, {
|
|
366
446
|
ref_key: "tableBody",
|
|
367
447
|
ref: tableBody,
|
|
368
|
-
dataSource:
|
|
448
|
+
dataSource: bodyDataSource.value,
|
|
369
449
|
columns: myColumns.value,
|
|
370
450
|
cellHeight: _ctx.cellHeight,
|
|
371
451
|
height: _ctx.height,
|
|
372
452
|
disableMenu: _ctx.disableMenu,
|
|
373
453
|
rowKey: _ctx.rowKey,
|
|
454
|
+
groupKey: _unref(groupActive).value,
|
|
455
|
+
openGroup: _ctx.openGroup,
|
|
374
456
|
rowSelection: _ctx.rowSelection,
|
|
457
|
+
readonly: __props.readonly,
|
|
375
458
|
onScrollDown: onScrollDown
|
|
376
459
|
}, _createSlots({ _: 2 /* DYNAMIC */ }, [
|
|
377
460
|
_renderList(_unref(slots), (_, name) => {
|
|
@@ -382,30 +465,21 @@ const __sfc_main__ = Object.assign({
|
|
|
382
465
|
])
|
|
383
466
|
};
|
|
384
467
|
})
|
|
385
|
-
]), 1032 /* PROPS, DYNAMIC_SLOTS */, ["dataSource", "columns", "cellHeight", "height", "disableMenu", "rowKey", "rowSelection"]),
|
|
468
|
+
]), 1032 /* PROPS, DYNAMIC_SLOTS */, ["dataSource", "columns", "cellHeight", "height", "disableMenu", "rowKey", "groupKey", "openGroup", "rowSelection", "readonly"]),
|
|
386
469
|
_renderSlot(_ctx.$slots, "bodyExtra")
|
|
387
470
|
], 4 /* STYLE */),
|
|
388
|
-
(
|
|
389
|
-
? (_openBlock(),
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
maxWidth: _ctx.scroll.x + 'px'
|
|
401
|
-
})
|
|
402
|
-
}, null, 4 /* STYLE */)
|
|
403
|
-
], 544 /* NEED_HYDRATION, NEED_PATCH */),
|
|
404
|
-
_createElementVNode("div", {
|
|
405
|
-
class: "jetlinks-edit-table-horizontal-scroll-hidden",
|
|
406
|
-
style: _normalizeStyle({ width: scrollWidth.value + 'px' })
|
|
407
|
-
}, null, 4 /* STYLE */)
|
|
408
|
-
]))
|
|
471
|
+
(_ctx.dataSource.length && _ctx.openGroup)
|
|
472
|
+
? (_openBlock(), _createBlock(Group, {
|
|
473
|
+
key: 0,
|
|
474
|
+
activeKey: _unref(groupActive).value,
|
|
475
|
+
"onUpdate:activeKey": _cache[0] || (_cache[0] = $event => ((_unref(groupActive).value) = $event)),
|
|
476
|
+
options: _unref(groupOptions),
|
|
477
|
+
readonly: __props.readonly,
|
|
478
|
+
onAdd: _unref(addGroup),
|
|
479
|
+
onDelete: groupDelete,
|
|
480
|
+
onEdit: groupEdit,
|
|
481
|
+
onChange: _unref(updateGroupActive)
|
|
482
|
+
}, null, 8 /* PROPS */, ["activeKey", "options", "readonly", "onAdd", "onChange"]))
|
|
409
483
|
: _createCommentVNode("v-if", true)
|
|
410
484
|
])
|
|
411
485
|
], 2 /* CLASS */));
|
|
@@ -47,12 +47,11 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
|
|
|
47
47
|
"onFieldBlur": "setup-const",
|
|
48
48
|
"onFieldChange": "setup-const"
|
|
49
49
|
} */
|
|
50
|
-
import { toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, createVNode as _createVNode, renderSlot as _renderSlot, normalizeClass as _normalizeClass, Fragment as _Fragment
|
|
51
|
-
const _withScopeId = n => (_pushScopeId("data-v-1741691309963"), n = n(), _popScopeId(), n);
|
|
50
|
+
import { toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, createVNode as _createVNode, renderSlot as _renderSlot, normalizeClass as _normalizeClass, Fragment as _Fragment } from "vue";
|
|
52
51
|
const _hoisted_1 = { style: { "color": "#1d2129" } };
|
|
53
52
|
const _hoisted_2 = {
|
|
54
53
|
key: 0,
|
|
55
|
-
class: "table-form-error-target"
|
|
54
|
+
class: "jetlinks-table-form-error-target"
|
|
56
55
|
};
|
|
57
56
|
const _hoisted_3 = ["id"];
|
|
58
57
|
import { onBeforeUnmount, computed, reactive, watch, provide } from "vue";
|
|
@@ -203,7 +202,7 @@ const __sfc_main__ = Object.assign({
|
|
|
203
202
|
_createElementVNode("div", {
|
|
204
203
|
id: eventKey.value,
|
|
205
204
|
style: { "position": "relative" },
|
|
206
|
-
class: _normalizeClass({ 'edit-table-form-has-error': errorMap.message })
|
|
205
|
+
class: _normalizeClass({ 'jetlinks-edit-table-form-has-error': errorMap.message })
|
|
207
206
|
}, [
|
|
208
207
|
_renderSlot(_ctx.$slots, "default")
|
|
209
208
|
], 10 /* CLASS, PROPS */, _hoisted_3)
|