@jetlinks-web/components 2.4.25 → 2.5.0
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 +178 -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 +178 -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
|
@@ -16,22 +16,23 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
|
|
|
16
16
|
} return value; }
|
|
17
17
|
/* Analyzed bindings: {
|
|
18
18
|
"searchKey": "props",
|
|
19
|
-
"rowKey": "props",
|
|
20
|
-
"columns": "props",
|
|
21
19
|
"Table": "setup-const",
|
|
22
20
|
"useTableDataSource": "setup-maybe-ref",
|
|
21
|
+
"useTableOpenGroup": "setup-maybe-ref",
|
|
23
22
|
"useTableTool": "setup-maybe-ref",
|
|
24
|
-
"
|
|
25
|
-
"DragModal": "setup-maybe-ref",
|
|
26
|
-
"Button": "setup-maybe-ref",
|
|
27
|
-
"Input": "setup-maybe-ref",
|
|
28
|
-
"Space": "setup-maybe-ref",
|
|
23
|
+
"useGroupOptions": "setup-maybe-ref",
|
|
29
24
|
"ref": "setup-const",
|
|
30
25
|
"defineOptions": "setup-const",
|
|
26
|
+
"Ellipsis": "setup-const",
|
|
27
|
+
"DragModal": "setup-const",
|
|
28
|
+
"useLocaleReceiver": "setup-maybe-ref",
|
|
31
29
|
"props": "setup-reactive-const",
|
|
32
30
|
"emit": "setup-const",
|
|
31
|
+
"contextLocale": "setup-maybe-ref",
|
|
33
32
|
"dataSource": "setup-maybe-ref",
|
|
33
|
+
"openGroup": "setup-maybe-ref",
|
|
34
34
|
"tableTool": "setup-maybe-ref",
|
|
35
|
+
"groupOptions": "setup-maybe-ref",
|
|
35
36
|
"searchValue": "setup-ref",
|
|
36
37
|
"filterArray": "setup-ref",
|
|
37
38
|
"visible": "setup-ref",
|
|
@@ -40,6 +41,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
|
|
|
40
41
|
"tableHeight": "setup-ref",
|
|
41
42
|
"selectedRowKeys": "setup-ref",
|
|
42
43
|
"tableRef": "setup-ref",
|
|
44
|
+
"columns": "setup-maybe-ref",
|
|
43
45
|
"selectedTableRow": "setup-const",
|
|
44
46
|
"handleFilterArray": "setup-const",
|
|
45
47
|
"search": "setup-const",
|
|
@@ -47,21 +49,23 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
|
|
|
47
49
|
"onClose": "setup-const",
|
|
48
50
|
"onSelect": "setup-const"
|
|
49
51
|
} */
|
|
50
|
-
import { createElementVNode as _createElementVNode,
|
|
51
|
-
const _hoisted_1 = { class: "
|
|
52
|
-
const _hoisted_2 = { class: "
|
|
53
|
-
const _hoisted_3 =
|
|
54
|
-
const _hoisted_4 = {
|
|
52
|
+
import { unref as _unref, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, createVNode as _createVNode, createTextVNode as _createTextVNode, withCtx as _withCtx, withModifiers as _withModifiers, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createBlock as _createBlock } from "vue";
|
|
53
|
+
const _hoisted_1 = { class: "jetlinks-table-search" };
|
|
54
|
+
const _hoisted_2 = { class: "jetlinks-table-search-header" };
|
|
55
|
+
const _hoisted_3 = {
|
|
55
56
|
key: 0,
|
|
56
57
|
style: { "margin": "12px 0" }
|
|
57
58
|
};
|
|
59
|
+
const _hoisted_4 = { key: 0 };
|
|
58
60
|
const _hoisted_5 = { key: 1 };
|
|
59
|
-
const _hoisted_6 = {
|
|
61
|
+
const _hoisted_6 = { key: 1 };
|
|
62
|
+
const _hoisted_7 = { class: "jetlinks-table-search-result-total" };
|
|
60
63
|
import Table from '../../EditTable.js';
|
|
61
|
-
import { useTableDataSource, useTableTool } from "../../
|
|
62
|
-
import {
|
|
63
|
-
import
|
|
64
|
-
import
|
|
64
|
+
import { useTableDataSource, useTableOpenGroup, useTableTool, useGroupOptions } from "../../context";
|
|
65
|
+
import { ref, } from "vue";
|
|
66
|
+
import Ellipsis from '../../../Ellipsis/Ellipsis.js';
|
|
67
|
+
import DragModal from '../../../DragModal/DragModal.js';
|
|
68
|
+
import { useLocaleReceiver } from "../../../LocaleReciver/index";
|
|
65
69
|
const __sfc_main__ = Object.assign({
|
|
66
70
|
name: 'JEditTableSearch'
|
|
67
71
|
}, {
|
|
@@ -69,22 +73,17 @@ const __sfc_main__ = Object.assign({
|
|
|
69
73
|
searchKey: {
|
|
70
74
|
type: String,
|
|
71
75
|
default: 'id'
|
|
72
|
-
},
|
|
73
|
-
rowKey: {
|
|
74
|
-
type: String,
|
|
75
|
-
default: 'id'
|
|
76
|
-
},
|
|
77
|
-
columns: {
|
|
78
|
-
type: Array,
|
|
79
|
-
default: () => []
|
|
80
76
|
}
|
|
81
77
|
},
|
|
82
78
|
emits: ['close'],
|
|
83
79
|
setup(__props, { emit: __emit }) {
|
|
84
80
|
const props = __props;
|
|
85
81
|
const emit = __emit;
|
|
82
|
+
const [contextLocale] = useLocaleReceiver('EditTable');
|
|
86
83
|
const dataSource = useTableDataSource();
|
|
84
|
+
const openGroup = useTableOpenGroup();
|
|
87
85
|
const tableTool = useTableTool();
|
|
86
|
+
const groupOptions = useGroupOptions();
|
|
88
87
|
const searchValue = ref();
|
|
89
88
|
const filterArray = ref([]);
|
|
90
89
|
const visible = ref(false);
|
|
@@ -93,47 +92,65 @@ const __sfc_main__ = Object.assign({
|
|
|
93
92
|
const tableHeight = ref(230);
|
|
94
93
|
const selectedRowKeys = ref([]);
|
|
95
94
|
const tableRef = ref();
|
|
95
|
+
const columns = reactive([
|
|
96
|
+
{
|
|
97
|
+
title: contextLocale.value.columns.sign,
|
|
98
|
+
dataIndex: 'id',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
title: contextLocale.value.columns.name,
|
|
102
|
+
dataIndex: 'name',
|
|
103
|
+
}
|
|
104
|
+
]);
|
|
96
105
|
const selectedTableRow = (record) => {
|
|
97
106
|
tableTool.scrollTo({
|
|
98
107
|
...record,
|
|
99
|
-
__serial: record.
|
|
108
|
+
__serial: record.__serial - 1
|
|
100
109
|
});
|
|
101
|
-
tableTool.selected([record
|
|
110
|
+
tableTool.selected([record.id]);
|
|
102
111
|
};
|
|
103
112
|
const handleFilterArray = () => {
|
|
104
113
|
const cloneDataSource = JSON.parse(JSON.stringify(dataSource.value || '[]')).map(item => Object.assign(item, { __oldSerial: item.__serial }));
|
|
105
|
-
|
|
114
|
+
const _filterArray = cloneDataSource.filter(item => {
|
|
106
115
|
if (item[props.searchKey]) {
|
|
107
116
|
return item[props.searchKey].includes(searchValue.value);
|
|
108
117
|
}
|
|
109
118
|
return false;
|
|
110
119
|
});
|
|
120
|
+
if (openGroup) {
|
|
121
|
+
const handleGroup = [];
|
|
122
|
+
groupOptions.value.forEach(group => {
|
|
123
|
+
handleGroup.push(..._filterArray.filter(item => item.expands.groupId === group.value));
|
|
124
|
+
});
|
|
125
|
+
return handleGroup;
|
|
126
|
+
}
|
|
127
|
+
return _filterArray;
|
|
111
128
|
};
|
|
112
129
|
const search = (key) => {
|
|
113
130
|
filterArray.value = handleFilterArray();
|
|
114
|
-
if (key === 'all') {
|
|
131
|
+
if (key === 'all') {
|
|
115
132
|
visible.value = true;
|
|
116
133
|
modalHeight.value = 400;
|
|
117
134
|
searchIndex.value = 0;
|
|
118
135
|
}
|
|
119
|
-
else if (key === 'next') {
|
|
136
|
+
else if (key === 'next') {
|
|
120
137
|
searchIndex.value += 1;
|
|
121
138
|
}
|
|
122
|
-
else {
|
|
139
|
+
else {
|
|
123
140
|
searchIndex.value -= 1;
|
|
124
141
|
}
|
|
125
|
-
if (searchIndex.value < 0) {
|
|
142
|
+
if (searchIndex.value < 0) {
|
|
126
143
|
searchIndex.value = filterArray.value.length - 1;
|
|
127
144
|
}
|
|
128
|
-
else if (searchIndex.value > filterArray.value.length - 1) {
|
|
145
|
+
else if (searchIndex.value > filterArray.value.length - 1) {
|
|
129
146
|
searchIndex.value = 0;
|
|
130
147
|
}
|
|
131
148
|
const searchItem = filterArray.value[searchIndex.value];
|
|
132
149
|
if (key !== 'all' && visible.value) {
|
|
133
|
-
_optionalChain([tableRef, 'access', _2 => _2.value, 'optionalAccess', _3 => _3.scrollToByIndex, 'call', _4 => _4(searchIndex.value - 1)]);
|
|
150
|
+
_optionalChain([tableRef, 'access', _2 => _2.value, 'optionalAccess', _3 => _3.scrollToByIndex, 'call', _4 => _4(searchIndex.value - 1)]);
|
|
134
151
|
}
|
|
135
|
-
if (filterArray.value.length
|
|
136
|
-
selectedRowKeys.value = [searchItem
|
|
152
|
+
if (filterArray.value.length >= 1) {
|
|
153
|
+
selectedRowKeys.value = [searchItem.id];
|
|
137
154
|
selectedTableRow(searchItem);
|
|
138
155
|
}
|
|
139
156
|
else {
|
|
@@ -148,65 +165,66 @@ const __sfc_main__ = Object.assign({
|
|
|
148
165
|
};
|
|
149
166
|
const onClose = () => {
|
|
150
167
|
emit('close');
|
|
151
|
-
tableTool.searchVisible(false);
|
|
152
168
|
};
|
|
153
169
|
const onSelect = (record) => {
|
|
154
|
-
searchIndex.value = filterArray.value.findIndex(item => item
|
|
155
|
-
selectedRowKeys.value = [record
|
|
170
|
+
searchIndex.value = filterArray.value.findIndex(item => item.id === record.id);
|
|
171
|
+
selectedRowKeys.value = [record.id];
|
|
156
172
|
selectedTableRow(record);
|
|
157
173
|
};
|
|
158
174
|
return (_ctx, _cache) => {
|
|
159
|
-
|
|
175
|
+
const _component_a_input = _resolveComponent("a-input");
|
|
176
|
+
const _component_a_button = _resolveComponent("a-button");
|
|
177
|
+
const _component_a_space = _resolveComponent("a-space");
|
|
178
|
+
return (_openBlock(), _createBlock(DragModal, {
|
|
160
179
|
width: 800,
|
|
161
180
|
height: modalHeight.value,
|
|
162
181
|
title: false,
|
|
163
182
|
dragRang: [600, 200],
|
|
164
183
|
bodyStyle: {
|
|
165
|
-
overflow: 'hidden'
|
|
184
|
+
overflow: 'hidden'
|
|
166
185
|
},
|
|
167
|
-
footer: false,
|
|
168
186
|
onHeightChange: heightChange
|
|
169
187
|
}, {
|
|
170
188
|
default: _withCtx(() => [
|
|
171
189
|
_createElementVNode("div", _hoisted_1, [
|
|
172
190
|
_createElementVNode("div", _hoisted_2, [
|
|
173
191
|
_createElementVNode("div", null, [
|
|
174
|
-
_createVNode(
|
|
192
|
+
_createVNode(_component_a_space, null, {
|
|
175
193
|
default: _withCtx(() => [
|
|
176
|
-
|
|
177
|
-
_createVNode(
|
|
194
|
+
_createElementVNode("span", null, _toDisplayString(_unref(contextLocale).Search.find), 1 /* TEXT */),
|
|
195
|
+
_createVNode(_component_a_input, {
|
|
178
196
|
value: searchValue.value,
|
|
179
197
|
"onUpdate:value": _cache[0] || (_cache[0] = $event => ((searchValue).value = $event)),
|
|
180
198
|
maxlength: 64,
|
|
181
|
-
placeholder:
|
|
182
|
-
}, null, 8 /* PROPS */, ["value"]),
|
|
183
|
-
_createVNode(
|
|
199
|
+
placeholder: _unref(contextLocale).Search.placeholder
|
|
200
|
+
}, null, 8 /* PROPS */, ["value", "placeholder"]),
|
|
201
|
+
_createVNode(_component_a_button, {
|
|
184
202
|
type: "primary",
|
|
185
203
|
ghost: "",
|
|
186
204
|
onClick: _cache[1] || (_cache[1] = () => search('all'))
|
|
187
205
|
}, {
|
|
188
206
|
default: _withCtx(() => [
|
|
189
|
-
_createTextVNode(
|
|
207
|
+
_createTextVNode(_toDisplayString(_unref(contextLocale).Search.all), 1 /* TEXT */)
|
|
190
208
|
]),
|
|
191
209
|
_: 1 /* STABLE */
|
|
192
210
|
}),
|
|
193
|
-
_createVNode(
|
|
211
|
+
_createVNode(_component_a_button, {
|
|
194
212
|
type: "primary",
|
|
195
213
|
ghost: "",
|
|
196
214
|
onClick: _cache[2] || (_cache[2] = () => search('prev'))
|
|
197
215
|
}, {
|
|
198
216
|
default: _withCtx(() => [
|
|
199
|
-
_createTextVNode(
|
|
217
|
+
_createTextVNode(_toDisplayString(_unref(contextLocale).Search.prev), 1 /* TEXT */)
|
|
200
218
|
]),
|
|
201
219
|
_: 1 /* STABLE */
|
|
202
220
|
}),
|
|
203
|
-
_createVNode(
|
|
221
|
+
_createVNode(_component_a_button, {
|
|
204
222
|
type: "primary",
|
|
205
223
|
ghost: "",
|
|
206
224
|
onClick: _cache[3] || (_cache[3] = () => search('next'))
|
|
207
225
|
}, {
|
|
208
226
|
default: _withCtx(() => [
|
|
209
|
-
_createTextVNode(
|
|
227
|
+
_createTextVNode(_toDisplayString(_unref(contextLocale).Search.next), 1 /* TEXT */)
|
|
210
228
|
]),
|
|
211
229
|
_: 1 /* STABLE */
|
|
212
230
|
})
|
|
@@ -215,24 +233,24 @@ const __sfc_main__ = Object.assign({
|
|
|
215
233
|
})
|
|
216
234
|
]),
|
|
217
235
|
_createElementVNode("div", null, [
|
|
218
|
-
_createVNode(
|
|
236
|
+
_createVNode(_component_a_button, {
|
|
219
237
|
type: "primary",
|
|
220
238
|
onClick: _withModifiers(onClose, ["stop"])
|
|
221
239
|
}, {
|
|
222
240
|
default: _withCtx(() => [
|
|
223
|
-
_createTextVNode(
|
|
241
|
+
_createTextVNode(_toDisplayString(_unref(contextLocale).Search.close), 1 /* TEXT */)
|
|
224
242
|
]),
|
|
225
243
|
_: 1 /* STABLE */
|
|
226
244
|
})
|
|
227
245
|
])
|
|
228
246
|
]),
|
|
229
247
|
(visible.value)
|
|
230
|
-
? (_openBlock(), _createElementBlock("div",
|
|
248
|
+
? (_openBlock(), _createElementBlock("div", _hoisted_3, [
|
|
231
249
|
_createVNode(Table, {
|
|
232
250
|
ref_key: "tableRef",
|
|
233
251
|
ref: tableRef,
|
|
234
252
|
"data-source": filterArray.value,
|
|
235
|
-
columns:
|
|
253
|
+
columns: _unref(columns),
|
|
236
254
|
height: tableHeight.value,
|
|
237
255
|
disableMenu: false,
|
|
238
256
|
cellHeight: 36,
|
|
@@ -241,14 +259,24 @@ const __sfc_main__ = Object.assign({
|
|
|
241
259
|
selectedRowKeys: selectedRowKeys.value
|
|
242
260
|
},
|
|
243
261
|
serial: {
|
|
244
|
-
|
|
262
|
+
width: _unref(openGroup) ? 150 : 66,
|
|
263
|
+
title: _unref(contextLocale).serial
|
|
245
264
|
}
|
|
246
265
|
}, {
|
|
247
266
|
serial: _withCtx(({ record }) => [
|
|
248
|
-
|
|
267
|
+
(_unref(openGroup))
|
|
268
|
+
? (_openBlock(), _createElementBlock("span", _hoisted_4, [
|
|
269
|
+
_createVNode(Ellipsis, null, {
|
|
270
|
+
default: _withCtx(() => [
|
|
271
|
+
_createTextVNode(_toDisplayString(record.expands.groupName) + " " + _toDisplayString(_unref(contextLocale).Search.rd) + " " + _toDisplayString(record.__oldSerial) + " " + _toDisplayString(_unref(contextLocale).Search.row), 1 /* TEXT */)
|
|
272
|
+
]),
|
|
273
|
+
_: 2 /* DYNAMIC */
|
|
274
|
+
}, 1024 /* DYNAMIC_SLOTS */)
|
|
275
|
+
]))
|
|
276
|
+
: (_openBlock(), _createElementBlock("span", _hoisted_5, _toDisplayString(record.__oldSerial), 1 /* TEXT */))
|
|
249
277
|
]),
|
|
250
278
|
id: _withCtx(({ record }) => [
|
|
251
|
-
_createVNode(
|
|
279
|
+
_createVNode(Ellipsis, null, {
|
|
252
280
|
default: _withCtx(() => [
|
|
253
281
|
_createTextVNode(_toDisplayString(record.id), 1 /* TEXT */)
|
|
254
282
|
]),
|
|
@@ -256,7 +284,7 @@ const __sfc_main__ = Object.assign({
|
|
|
256
284
|
}, 1024 /* DYNAMIC_SLOTS */)
|
|
257
285
|
]),
|
|
258
286
|
name: _withCtx(({ record }) => [
|
|
259
|
-
_createVNode(
|
|
287
|
+
_createVNode(Ellipsis, null, {
|
|
260
288
|
default: _withCtx(() => [
|
|
261
289
|
_createTextVNode(_toDisplayString(record.name), 1 /* TEXT */)
|
|
262
290
|
]),
|
|
@@ -264,14 +292,14 @@ const __sfc_main__ = Object.assign({
|
|
|
264
292
|
}, 1024 /* DYNAMIC_SLOTS */)
|
|
265
293
|
]),
|
|
266
294
|
_: 1 /* STABLE */
|
|
267
|
-
}, 8 /* PROPS */, ["data-source", "columns", "height", "rowSelection"])
|
|
295
|
+
}, 8 /* PROPS */, ["data-source", "columns", "height", "rowSelection", "serial"])
|
|
268
296
|
]))
|
|
269
297
|
: _createCommentVNode("v-if", true),
|
|
270
298
|
(visible.value)
|
|
271
|
-
? (_openBlock(), _createElementBlock("div",
|
|
272
|
-
_createTextVNode("
|
|
273
|
-
_createElementVNode("span",
|
|
274
|
-
_createTextVNode("
|
|
299
|
+
? (_openBlock(), _createElementBlock("div", _hoisted_6, [
|
|
300
|
+
_createTextVNode(_toDisplayString(_unref(contextLocale).Search.found) + " ", 1 /* TEXT */),
|
|
301
|
+
_createElementVNode("span", _hoisted_7, _toDisplayString(filterArray.value.length), 1 /* TEXT */),
|
|
302
|
+
_createTextVNode(" " + _toDisplayString(_unref(contextLocale).Search.related), 1 /* TEXT */)
|
|
275
303
|
]))
|
|
276
304
|
: _createCommentVNode("v-if", true)
|
|
277
305
|
])
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) {
|
|
2
|
+
const op = ops[i];
|
|
3
|
+
const fn = ops[i + 1];
|
|
4
|
+
i += 2;
|
|
5
|
+
if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
if (op === 'access' || op === 'optionalAccess') {
|
|
9
|
+
lastAccessLHS = value;
|
|
10
|
+
value = fn(value);
|
|
11
|
+
}
|
|
12
|
+
else if (op === 'call' || op === 'optionalCall') {
|
|
13
|
+
value = fn((...args) => value.call(lastAccessLHS, ...args));
|
|
14
|
+
lastAccessLHS = undefined;
|
|
15
|
+
}
|
|
16
|
+
} return value; }
|
|
17
|
+
/* Analyzed bindings: {
|
|
18
|
+
"dataSource": "setup-ref",
|
|
19
|
+
"sortKey": "props",
|
|
20
|
+
"dataIndex": "props",
|
|
21
|
+
"selectedRowKeys": "props",
|
|
22
|
+
"active": "props",
|
|
23
|
+
"useTableTool": "setup-maybe-ref",
|
|
24
|
+
"useTableWrapper": "setup-maybe-ref",
|
|
25
|
+
"defineOptions": "setup-const",
|
|
26
|
+
"ref": "setup-const",
|
|
27
|
+
"useLocaleReceiver": "setup-maybe-ref",
|
|
28
|
+
"props": "setup-reactive-const",
|
|
29
|
+
"emit": "setup-const",
|
|
30
|
+
"contextLocale": "setup-maybe-ref",
|
|
31
|
+
"tableWrapperRef": "setup-maybe-ref",
|
|
32
|
+
"tableTool": "setup-maybe-ref",
|
|
33
|
+
"visible": "setup-ref",
|
|
34
|
+
"mySelectedRowKeys": "setup-ref",
|
|
35
|
+
"columns": "setup-maybe-ref",
|
|
36
|
+
"visibleChange": "setup-const",
|
|
37
|
+
"onSelectChange": "setup-const",
|
|
38
|
+
"cleanParams": "setup-const",
|
|
39
|
+
"handleSortRowKeys": "setup-const",
|
|
40
|
+
"onAsc": "setup-const",
|
|
41
|
+
"onDesc": "setup-const"
|
|
42
|
+
} */
|
|
43
|
+
import { unref as _unref, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, createTextVNode as _createTextVNode, withCtx as _withCtx, createVNode as _createVNode, normalizeClass as _normalizeClass, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
44
|
+
const _withScopeId = n => (_pushScopeId("data-v-1742373123165"), n = n(), _popScopeId(), n);
|
|
45
|
+
const _hoisted_1 = { class: "jetlinks-table-sort-content" };
|
|
46
|
+
const _hoisted_2 = { class: "jetlinks-table-sort-title" };
|
|
47
|
+
const _hoisted_3 = { class: "table-sort-body" };
|
|
48
|
+
const _hoisted_4 = { class: "jetlinks-table-sort-footer" };
|
|
49
|
+
import { useTableTool, useTableWrapper } from "../../context";
|
|
50
|
+
import { ref } from 'vue';
|
|
51
|
+
import { useLocaleReceiver } from "../../../LocaleReciver";
|
|
52
|
+
const __sfc_main__ = Object.assign({
|
|
53
|
+
name: 'JEditTableSearchSort'
|
|
54
|
+
}, {
|
|
55
|
+
props: {
|
|
56
|
+
dataSource: {
|
|
57
|
+
type: [Function, Array],
|
|
58
|
+
default: () => []
|
|
59
|
+
},
|
|
60
|
+
sortKey: {
|
|
61
|
+
type: [String, Array],
|
|
62
|
+
default: undefined
|
|
63
|
+
},
|
|
64
|
+
dataIndex: {
|
|
65
|
+
type: [Number, String],
|
|
66
|
+
default: undefined
|
|
67
|
+
},
|
|
68
|
+
selectedRowKeys: {
|
|
69
|
+
type: Array,
|
|
70
|
+
default: () => []
|
|
71
|
+
},
|
|
72
|
+
active: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
default: false
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
emits: ['click'],
|
|
78
|
+
setup(__props, { emit: __emit }) {
|
|
79
|
+
const props = __props;
|
|
80
|
+
const emit = __emit;
|
|
81
|
+
const [contextLocale] = useLocaleReceiver('EditTable');
|
|
82
|
+
const tableWrapperRef = useTableWrapper();
|
|
83
|
+
const tableTool = useTableTool();
|
|
84
|
+
const visible = ref(false);
|
|
85
|
+
const dataSource = ref([]);
|
|
86
|
+
const mySelectedRowKeys = ref([]);
|
|
87
|
+
const columns = reactive([
|
|
88
|
+
{
|
|
89
|
+
dataIndex: 'name',
|
|
90
|
+
title: contextLocale.value.columns.name
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
dataIndex: 'total',
|
|
94
|
+
title: contextLocale.value.columns.count,
|
|
95
|
+
width: 70
|
|
96
|
+
}
|
|
97
|
+
]);
|
|
98
|
+
const visibleChange = (e) => {
|
|
99
|
+
if (e) {
|
|
100
|
+
mySelectedRowKeys.value = props.selectedRowKeys;
|
|
101
|
+
dataSource.value = (_optionalChain([props, 'access', _2 => _2.dataSource, 'optionalCall', _3 => _3()]) || []).map((item, index) => Object.assign(item, { __index: index + 1 }));
|
|
102
|
+
}
|
|
103
|
+
if (!e) {
|
|
104
|
+
setTimeout(() => {
|
|
105
|
+
visible.value = e;
|
|
106
|
+
}, 300);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
visible.value = e;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
const onSelectChange = (keys) => {
|
|
113
|
+
mySelectedRowKeys.value = keys;
|
|
114
|
+
};
|
|
115
|
+
const cleanParams = () => {
|
|
116
|
+
mySelectedRowKeys.value = [];
|
|
117
|
+
tableTool.cleanOrder();
|
|
118
|
+
};
|
|
119
|
+
const handleSortRowKeys = () => {
|
|
120
|
+
return dataSource.value
|
|
121
|
+
.filter(item => mySelectedRowKeys.value.includes(item.key))
|
|
122
|
+
.sort((a, b) => b.__index - a.__index)
|
|
123
|
+
.map(item => item.key);
|
|
124
|
+
};
|
|
125
|
+
const onAsc = () => {
|
|
126
|
+
tableTool.order('asc', props.sortKey, handleSortRowKeys(), props.dataIndex);
|
|
127
|
+
emit('click');
|
|
128
|
+
};
|
|
129
|
+
const onDesc = () => {
|
|
130
|
+
tableTool.order('desc', props.sortKey, handleSortRowKeys(), props.dataIndex);
|
|
131
|
+
emit('click');
|
|
132
|
+
};
|
|
133
|
+
return (_ctx, _cache) => {
|
|
134
|
+
const _component_a_table = _resolveComponent("a-table");
|
|
135
|
+
const _component_a_button = _resolveComponent("a-button");
|
|
136
|
+
const _component_a_space = _resolveComponent("a-space");
|
|
137
|
+
const _component_AIcon = _resolveComponent("AIcon");
|
|
138
|
+
const _component_a_popover = _resolveComponent("a-popover");
|
|
139
|
+
return (_openBlock(), _createBlock(_component_a_popover, {
|
|
140
|
+
trigger: "click",
|
|
141
|
+
placement: "bottom",
|
|
142
|
+
overlayStyle: {
|
|
143
|
+
'zIndex': 1050
|
|
144
|
+
},
|
|
145
|
+
getPopupContainer: (node) => _unref(tableWrapperRef) || node,
|
|
146
|
+
onVisibleChange: visibleChange
|
|
147
|
+
}, {
|
|
148
|
+
content: _withCtx(() => [
|
|
149
|
+
_createElementVNode("div", _hoisted_1, [
|
|
150
|
+
_createElementVNode("div", _hoisted_2, _toDisplayString(_unref(contextLocale).Sort.sort), 1 /* TEXT */),
|
|
151
|
+
_createElementVNode("div", _hoisted_3, [
|
|
152
|
+
(visible.value)
|
|
153
|
+
? (_openBlock(), _createBlock(_component_a_table, {
|
|
154
|
+
key: 0,
|
|
155
|
+
size: "small",
|
|
156
|
+
columns: _unref(columns),
|
|
157
|
+
dataSource: dataSource.value,
|
|
158
|
+
"row-selection": { selectedRowKeys: mySelectedRowKeys.value, onChange: onSelectChange },
|
|
159
|
+
pagination: false,
|
|
160
|
+
scroll: dataSource.value.length > 5 ? { y: 200 } : undefined
|
|
161
|
+
}, null, 8 /* PROPS */, ["columns", "dataSource", "row-selection", "scroll"]))
|
|
162
|
+
: _createCommentVNode("v-if", true)
|
|
163
|
+
]),
|
|
164
|
+
_createElementVNode("div", _hoisted_4, [
|
|
165
|
+
_createVNode(_component_a_space, { size: 16 }, {
|
|
166
|
+
default: _withCtx(() => [
|
|
167
|
+
_createVNode(_component_a_button, {
|
|
168
|
+
type: "primary",
|
|
169
|
+
onClick: cleanParams,
|
|
170
|
+
disabled: !mySelectedRowKeys.value.length
|
|
171
|
+
}, {
|
|
172
|
+
default: _withCtx(() => [
|
|
173
|
+
_createTextVNode(_toDisplayString(_unref(contextLocale).Sort.clean), 1 /* TEXT */)
|
|
174
|
+
]),
|
|
175
|
+
_: 1 /* STABLE */
|
|
176
|
+
}, 8 /* PROPS */, ["disabled"]),
|
|
177
|
+
_createVNode(_component_a_button, {
|
|
178
|
+
type: "primary",
|
|
179
|
+
ghost: "",
|
|
180
|
+
onClick: onAsc
|
|
181
|
+
}, {
|
|
182
|
+
default: _withCtx(() => [
|
|
183
|
+
_createTextVNode(_toDisplayString(_unref(contextLocale).Sort.up), 1 /* TEXT */)
|
|
184
|
+
]),
|
|
185
|
+
_: 1 /* STABLE */
|
|
186
|
+
}),
|
|
187
|
+
_createVNode(_component_a_button, {
|
|
188
|
+
type: "primary",
|
|
189
|
+
ghost: "",
|
|
190
|
+
onClick: onDesc
|
|
191
|
+
}, {
|
|
192
|
+
default: _withCtx(() => [
|
|
193
|
+
_createTextVNode(_toDisplayString(_unref(contextLocale).Sort.down), 1 /* TEXT */)
|
|
194
|
+
]),
|
|
195
|
+
_: 1 /* STABLE */
|
|
196
|
+
})
|
|
197
|
+
]),
|
|
198
|
+
_: 1 /* STABLE */
|
|
199
|
+
})
|
|
200
|
+
])
|
|
201
|
+
])
|
|
202
|
+
]),
|
|
203
|
+
default: _withCtx(() => [
|
|
204
|
+
_createVNode(_component_AIcon, {
|
|
205
|
+
type: "icon-paixu",
|
|
206
|
+
class: _normalizeClass({ 'table-sort-icon': true, 'active': props.active })
|
|
207
|
+
}, null, 8 /* PROPS */, ["class"])
|
|
208
|
+
]),
|
|
209
|
+
_: 1 /* STABLE */
|
|
210
|
+
}, 8 /* PROPS */, ["getPopupContainer"]));
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
export default __sfc_main__;
|
package/es/EditTable/consts.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
export var METADATA_GROUP_OPTIONS = Symbol('metadata-group-options');
|
|
1
2
|
export var TABLE_WRAPPER = Symbol('table-wrapper');
|
|
2
3
|
export var FULL_SCREEN = Symbol('full');
|
|
3
4
|
export var RIGHT_MENU = Symbol('right-menu');
|
|
4
5
|
export var TABLE_ERROR = Symbol('table-error');
|
|
6
|
+
export var TABLE_GROUP_ERROR = Symbol('table-group-error');
|
|
7
|
+
export var TABLE_GROUP_OPTIONS = Symbol('table-group-options');
|
|
5
8
|
export var TABLE_DATA_SOURCE = Symbol('table-data-source');
|
|
9
|
+
export var TABLE_OPEN_GROUP = Symbol('table-open-group');
|
|
6
10
|
export var TABLE_TOOL = Symbol('table-tool');
|
|
7
|
-
export var TABLE_FORM_ITEM_ERROR = Symbol('table-form-item-error');
|
|
11
|
+
export var TABLE_FORM_ITEM_ERROR = Symbol('table-form-item-error');
|
|
12
|
+
export var TABLE_GROUP_ACTIVE = Symbol('table-group-active');
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { provide, inject, computed } from 'vue';
|
|
2
|
+
import { RIGHT_MENU, TABLE_DATA_SOURCE, TABLE_ERROR, TABLE_GROUP_ERROR, TABLE_WRAPPER, TABLE_OPEN_GROUP, TABLE_TOOL, TABLE_GROUP_OPTIONS, TABLE_FORM_ITEM_ERROR, TABLE_GROUP_ACTIVE, FULL_SCREEN } from "./consts";
|
|
3
|
+
var FormContextKey = 'form-context';
|
|
4
|
+
export var useFormContext = function useFormContext(options) {
|
|
5
|
+
provide(FormContextKey, options);
|
|
6
|
+
};
|
|
7
|
+
export var useInjectForm = function useInjectForm() {
|
|
8
|
+
return inject(FormContextKey, {
|
|
9
|
+
addField: function addField(key, field) {},
|
|
10
|
+
dataSource: computed(function () {
|
|
11
|
+
return [];
|
|
12
|
+
}),
|
|
13
|
+
rules: computed(function () {
|
|
14
|
+
return undefined;
|
|
15
|
+
})
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
export var useInjectError = function useInjectError() {
|
|
19
|
+
return inject(TABLE_ERROR);
|
|
20
|
+
};
|
|
21
|
+
export var useTableWrapper = function useTableWrapper() {
|
|
22
|
+
return inject(TABLE_WRAPPER);
|
|
23
|
+
};
|
|
24
|
+
export var useRightMenuContext = function useRightMenuContext() {
|
|
25
|
+
return inject(RIGHT_MENU);
|
|
26
|
+
};
|
|
27
|
+
export var useTableGroupError = function useTableGroupError() {
|
|
28
|
+
return inject(TABLE_GROUP_ERROR);
|
|
29
|
+
};
|
|
30
|
+
export var useTableDataSource = function useTableDataSource() {
|
|
31
|
+
return inject(TABLE_DATA_SOURCE, []);
|
|
32
|
+
};
|
|
33
|
+
export var useTableOpenGroup = function useTableOpenGroup() {
|
|
34
|
+
return inject(TABLE_OPEN_GROUP, false);
|
|
35
|
+
};
|
|
36
|
+
export var useTableTool = function useTableTool() {
|
|
37
|
+
return inject(TABLE_TOOL, false);
|
|
38
|
+
};
|
|
39
|
+
export var useGroupOptions = function useGroupOptions() {
|
|
40
|
+
return inject(TABLE_GROUP_OPTIONS, []);
|
|
41
|
+
};
|
|
42
|
+
export var useFormItemError = function useFormItemError() {
|
|
43
|
+
return inject(TABLE_FORM_ITEM_ERROR);
|
|
44
|
+
};
|
|
45
|
+
export var useGroupActive = function useGroupActive() {
|
|
46
|
+
return inject(TABLE_GROUP_ACTIVE);
|
|
47
|
+
};
|
|
48
|
+
export var useTableFullScreen = function useTableFullScreen() {
|
|
49
|
+
return inject(FULL_SCREEN);
|
|
50
|
+
};
|