@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.
Files changed (65) hide show
  1. package/es/EditTable/Body.js +91 -181
  2. package/es/EditTable/EditTable.js +178 -105
  3. package/es/EditTable/FormItem.js +3 -4
  4. package/es/EditTable/Header.js +56 -164
  5. package/es/EditTable/components/ContextMenu/Menu.js +11 -7
  6. package/es/EditTable/components/Search/index.js +2 -1
  7. package/es/EditTable/components/Search/{Search.js → search.js} +94 -66
  8. package/es/EditTable/components/Search/sort.js +214 -0
  9. package/es/EditTable/consts.js +6 -1
  10. package/es/EditTable/context.js +50 -0
  11. package/es/EditTable/group.js +355 -0
  12. package/es/EditTable/hooks/index.js +1 -0
  13. package/es/EditTable/hooks/useGroup.js +44 -0
  14. package/es/EditTable/props.js +14 -4
  15. package/es/EditTable/style/body.less +17 -27
  16. package/es/EditTable/style/form.less +33 -0
  17. package/es/EditTable/style/group.less +32 -0
  18. package/es/EditTable/style/header.less +16 -21
  19. package/es/EditTable/style/index.css +103 -66
  20. package/es/EditTable/style/index.less +3 -0
  21. package/es/EditTable/style/menu.less +25 -0
  22. package/es/EditTable/style/table.less +2 -11
  23. package/es/EditTable/utils.js +22 -50
  24. package/es/FullPage/FullPage.js +1 -1
  25. package/es/PermissionButton/index.js +40 -20
  26. package/es/RadioButton/RadioButton.js +1 -1
  27. package/es/Search/Advanced/SaveHistory.js +1 -1
  28. package/es/Search/Item.js +1 -1
  29. package/es/Search/Search.js +1 -1
  30. package/es/locale/en-US.js +39 -3
  31. package/es/locale/zh-CN.js +36 -0
  32. package/es/style/index.css +103 -66
  33. package/lib/EditTable/Body.js +91 -181
  34. package/lib/EditTable/EditTable.js +178 -105
  35. package/lib/EditTable/FormItem.js +3 -4
  36. package/lib/EditTable/Header.js +56 -164
  37. package/lib/EditTable/components/ContextMenu/Menu.js +11 -7
  38. package/lib/EditTable/components/Search/index.js +10 -3
  39. package/lib/EditTable/components/Search/{Search.js → search.js} +94 -66
  40. package/lib/EditTable/components/Search/sort.js +214 -0
  41. package/lib/EditTable/consts.js +7 -2
  42. package/lib/EditTable/context.js +56 -0
  43. package/lib/EditTable/group.js +355 -0
  44. package/lib/EditTable/hooks/index.js +12 -0
  45. package/lib/EditTable/hooks/useGroup.js +50 -0
  46. package/lib/EditTable/props.js +14 -4
  47. package/lib/EditTable/style/body.less +17 -27
  48. package/lib/EditTable/style/form.less +33 -0
  49. package/lib/EditTable/style/group.less +32 -0
  50. package/lib/EditTable/style/header.less +16 -21
  51. package/lib/EditTable/style/index.css +103 -66
  52. package/lib/EditTable/style/index.less +3 -0
  53. package/lib/EditTable/style/menu.less +25 -0
  54. package/lib/EditTable/style/table.less +2 -11
  55. package/lib/EditTable/utils.js +23 -51
  56. package/lib/FullPage/FullPage.js +1 -1
  57. package/lib/PermissionButton/index.js +40 -20
  58. package/lib/RadioButton/RadioButton.js +1 -1
  59. package/lib/Search/Advanced/SaveHistory.js +1 -1
  60. package/lib/Search/Item.js +1 -1
  61. package/lib/Search/Search.js +1 -1
  62. package/lib/locale/en-US.js +39 -3
  63. package/lib/locale/zh-CN.js +36 -0
  64. package/lib/style/index.css +103 -66
  65. 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
- "Ellipsis": "setup-maybe-ref",
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, unref as _unref, createVNode as _createVNode, createTextVNode as _createTextVNode, withCtx as _withCtx, withModifiers as _withModifiers, toDisplayString as _toDisplayString, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createBlock as _createBlock } from "vue";
51
- const _hoisted_1 = { class: "edit-table-search" };
52
- const _hoisted_2 = { class: "edit-table-search-header" };
53
- const _hoisted_3 = /*#__PURE__*/ _createElementVNode("span", null, "查找", -1 /* HOISTED */);
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 = { class: "edit-table-search-result-total" };
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 "../../hooks";
62
- import { Ellipsis, DragModal } from '../../../components';
63
- import { Button, Input, Space } from 'ant-design-vue';
64
- import { ref, } from 'vue';
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.__oldSerial - 1
108
+ __serial: record.__serial - 1
100
109
  });
101
- tableTool.selected([record[props.rowKey]]);
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
- return cloneDataSource.filter(item => {
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) { // 小于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)]); // 控制EditTable滚动到指定为止
150
+ _optionalChain([tableRef, 'access', _2 => _2.value, 'optionalAccess', _3 => _3.scrollToByIndex, 'call', _4 => _4(searchIndex.value - 1)]);
134
151
  }
135
- if (filterArray.value.length > 1) {
136
- selectedRowKeys.value = [searchItem[props.rowKey]];
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[props.rowKey] === record[props.rowKey]);
155
- selectedRowKeys.value = [record[props.rowKey]];
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
- return (_openBlock(), _createBlock(_unref(DragModal), {
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(_unref(Space), null, {
192
+ _createVNode(_component_a_space, null, {
175
193
  default: _withCtx(() => [
176
- _hoisted_3,
177
- _createVNode(_unref(Input), {
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(_unref(Button), {
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(_unref(Button), {
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(_unref(Button), {
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(_unref(Button), {
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", _hoisted_4, [
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: __props.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
- title: '行数'
262
+ width: _unref(openGroup) ? 150 : 66,
263
+ title: _unref(contextLocale).serial
245
264
  }
246
265
  }, {
247
266
  serial: _withCtx(({ record }) => [
248
- _createElementVNode("span", null, _toDisplayString(record.__oldSerial), 1 /* TEXT */)
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(_unref(Ellipsis), null, {
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(_unref(Ellipsis), null, {
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", _hoisted_5, [
272
- _createTextVNode(" 查找到 "),
273
- _createElementVNode("span", _hoisted_6, _toDisplayString(filterArray.value.length), 1 /* TEXT */),
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-1742373123149"), 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__;
@@ -3,11 +3,16 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.TABLE_WRAPPER = exports.TABLE_TOOL = exports.TABLE_FORM_ITEM_ERROR = exports.TABLE_ERROR = exports.TABLE_DATA_SOURCE = exports.RIGHT_MENU = exports.FULL_SCREEN = void 0;
6
+ exports.TABLE_WRAPPER = exports.TABLE_TOOL = exports.TABLE_OPEN_GROUP = exports.TABLE_GROUP_OPTIONS = exports.TABLE_GROUP_ERROR = exports.TABLE_GROUP_ACTIVE = exports.TABLE_FORM_ITEM_ERROR = exports.TABLE_ERROR = exports.TABLE_DATA_SOURCE = exports.RIGHT_MENU = exports.METADATA_GROUP_OPTIONS = exports.FULL_SCREEN = void 0;
7
+ var METADATA_GROUP_OPTIONS = exports.METADATA_GROUP_OPTIONS = Symbol('metadata-group-options');
7
8
  var TABLE_WRAPPER = exports.TABLE_WRAPPER = Symbol('table-wrapper');
8
9
  var FULL_SCREEN = exports.FULL_SCREEN = Symbol('full');
9
10
  var RIGHT_MENU = exports.RIGHT_MENU = Symbol('right-menu');
10
11
  var TABLE_ERROR = exports.TABLE_ERROR = Symbol('table-error');
12
+ var TABLE_GROUP_ERROR = exports.TABLE_GROUP_ERROR = Symbol('table-group-error');
13
+ var TABLE_GROUP_OPTIONS = exports.TABLE_GROUP_OPTIONS = Symbol('table-group-options');
11
14
  var TABLE_DATA_SOURCE = exports.TABLE_DATA_SOURCE = Symbol('table-data-source');
15
+ var TABLE_OPEN_GROUP = exports.TABLE_OPEN_GROUP = Symbol('table-open-group');
12
16
  var TABLE_TOOL = exports.TABLE_TOOL = Symbol('table-tool');
13
- var TABLE_FORM_ITEM_ERROR = exports.TABLE_FORM_ITEM_ERROR = Symbol('table-form-item-error');
17
+ var TABLE_FORM_ITEM_ERROR = exports.TABLE_FORM_ITEM_ERROR = Symbol('table-form-item-error');
18
+ var TABLE_GROUP_ACTIVE = exports.TABLE_GROUP_ACTIVE = Symbol('table-group-active');
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useTableWrapper = exports.useTableTool = exports.useTableOpenGroup = exports.useTableGroupError = exports.useTableFullScreen = exports.useTableDataSource = exports.useRightMenuContext = exports.useInjectForm = exports.useInjectError = exports.useGroupOptions = exports.useGroupActive = exports.useFormItemError = exports.useFormContext = void 0;
7
+ var _vue = require("vue");
8
+ var _consts = require("./consts");
9
+ var FormContextKey = 'form-context';
10
+ var useFormContext = exports.useFormContext = function useFormContext(options) {
11
+ (0, _vue.provide)(FormContextKey, options);
12
+ };
13
+ var useInjectForm = exports.useInjectForm = function useInjectForm() {
14
+ return (0, _vue.inject)(FormContextKey, {
15
+ addField: function addField(key, field) {},
16
+ dataSource: (0, _vue.computed)(function () {
17
+ return [];
18
+ }),
19
+ rules: (0, _vue.computed)(function () {
20
+ return undefined;
21
+ })
22
+ });
23
+ };
24
+ var useInjectError = exports.useInjectError = function useInjectError() {
25
+ return (0, _vue.inject)(_consts.TABLE_ERROR);
26
+ };
27
+ var useTableWrapper = exports.useTableWrapper = function useTableWrapper() {
28
+ return (0, _vue.inject)(_consts.TABLE_WRAPPER);
29
+ };
30
+ var useRightMenuContext = exports.useRightMenuContext = function useRightMenuContext() {
31
+ return (0, _vue.inject)(_consts.RIGHT_MENU);
32
+ };
33
+ var useTableGroupError = exports.useTableGroupError = function useTableGroupError() {
34
+ return (0, _vue.inject)(_consts.TABLE_GROUP_ERROR);
35
+ };
36
+ var useTableDataSource = exports.useTableDataSource = function useTableDataSource() {
37
+ return (0, _vue.inject)(_consts.TABLE_DATA_SOURCE, []);
38
+ };
39
+ var useTableOpenGroup = exports.useTableOpenGroup = function useTableOpenGroup() {
40
+ return (0, _vue.inject)(_consts.TABLE_OPEN_GROUP, false);
41
+ };
42
+ var useTableTool = exports.useTableTool = function useTableTool() {
43
+ return (0, _vue.inject)(_consts.TABLE_TOOL, false);
44
+ };
45
+ var useGroupOptions = exports.useGroupOptions = function useGroupOptions() {
46
+ return (0, _vue.inject)(_consts.TABLE_GROUP_OPTIONS, []);
47
+ };
48
+ var useFormItemError = exports.useFormItemError = function useFormItemError() {
49
+ return (0, _vue.inject)(_consts.TABLE_FORM_ITEM_ERROR);
50
+ };
51
+ var useGroupActive = exports.useGroupActive = function useGroupActive() {
52
+ return (0, _vue.inject)(_consts.TABLE_GROUP_ACTIVE);
53
+ };
54
+ var useTableFullScreen = exports.useTableFullScreen = function useTableFullScreen() {
55
+ return (0, _vue.inject)(_consts.FULL_SCREEN);
56
+ };