@jetlinks-web/components 2.0.36 → 2.0.38

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 (78) hide show
  1. package/es/CardSelect/style/index.js +1 -0
  2. package/es/CheckButton/style/index.js +1 -0
  3. package/es/DragModal/DragModal.js +307 -0
  4. package/es/DragModal/index.js +5 -0
  5. package/es/DragModal/style/index.css +81 -0
  6. package/es/DragModal/style/index.js +1 -0
  7. package/es/DragModal/style/index.less +96 -0
  8. package/es/EditTable/Body.js +365 -0
  9. package/es/EditTable/EditTable.js +401 -0
  10. package/es/EditTable/Header.js +242 -0
  11. package/es/EditTable/components/ContextMenu/Menu.js +154 -0
  12. package/es/EditTable/components/ContextMenu/index.js +81 -0
  13. package/es/EditTable/components/Search/Search.js +290 -0
  14. package/es/EditTable/components/Search/index.js +1 -0
  15. package/es/EditTable/consts.js +7 -0
  16. package/es/EditTable/hooks/index.js +40 -0
  17. package/es/EditTable/hooks/useResizeObserver.js +31 -0
  18. package/es/EditTable/hooks/useValidate.js +87 -0
  19. package/es/EditTable/index.js +9 -0
  20. package/es/EditTable/props.js +50 -0
  21. package/es/EditTable/style/body.less +76 -0
  22. package/es/EditTable/style/header.less +77 -0
  23. package/es/EditTable/style/index.css +219 -0
  24. package/es/EditTable/style/index.js +1 -0
  25. package/es/EditTable/style/index.less +42 -0
  26. package/es/EditTable/style/table.less +42 -0
  27. package/es/EditTable/utils.js +98 -0
  28. package/es/Ellipsis/style/index.js +1 -0
  29. package/es/FullPage/FullPage.js +1 -1
  30. package/es/ProTable/Content.js +5 -2
  31. package/es/ProTable/style/ProTable.less +134 -134
  32. package/es/Search/Advanced/SaveHistory.js +1 -1
  33. package/es/Search/Item.js +1 -1
  34. package/es/Search/Search.js +1 -1
  35. package/es/components.js +3 -1
  36. package/es/style/index.css +292 -3
  37. package/es/style/index.less +9 -7
  38. package/es/style.js +3 -1
  39. package/lib/CardSelect/style/index.js +3 -0
  40. package/lib/CheckButton/style/index.js +3 -0
  41. package/lib/DragModal/DragModal.js +307 -0
  42. package/lib/DragModal/index.js +12 -0
  43. package/lib/DragModal/style/index.css +81 -0
  44. package/lib/DragModal/style/index.js +3 -0
  45. package/lib/DragModal/style/index.less +96 -0
  46. package/lib/EditTable/Body.js +365 -0
  47. package/lib/EditTable/EditTable.js +401 -0
  48. package/lib/EditTable/Header.js +242 -0
  49. package/lib/EditTable/components/ContextMenu/Menu.js +154 -0
  50. package/lib/EditTable/components/ContextMenu/index.js +88 -0
  51. package/lib/EditTable/components/Search/Search.js +290 -0
  52. package/lib/EditTable/components/Search/index.js +13 -0
  53. package/lib/EditTable/consts.js +13 -0
  54. package/lib/EditTable/hooks/index.js +79 -0
  55. package/lib/EditTable/hooks/useResizeObserver.js +38 -0
  56. package/lib/EditTable/hooks/useValidate.js +94 -0
  57. package/lib/EditTable/index.js +16 -0
  58. package/lib/EditTable/props.js +56 -0
  59. package/lib/EditTable/style/body.less +76 -0
  60. package/lib/EditTable/style/header.less +77 -0
  61. package/lib/EditTable/style/index.css +219 -0
  62. package/lib/EditTable/style/index.js +3 -0
  63. package/lib/EditTable/style/index.less +42 -0
  64. package/lib/EditTable/style/table.less +42 -0
  65. package/lib/EditTable/utils.js +105 -0
  66. package/lib/Ellipsis/style/index.js +3 -0
  67. package/lib/FullPage/FullPage.js +1 -1
  68. package/lib/ProTable/Content.js +5 -2
  69. package/lib/ProTable/style/ProTable.less +134 -134
  70. package/lib/Search/Advanced/SaveHistory.js +1 -1
  71. package/lib/Search/Item.js +1 -1
  72. package/lib/Search/Search.js +1 -1
  73. package/lib/components.js +14 -0
  74. package/lib/style/components.less +2 -0
  75. package/lib/style/index.css +292 -3
  76. package/lib/style/index.less +9 -7
  77. package/lib/style.js +3 -1
  78. package/package.json +5 -3
@@ -0,0 +1,154 @@
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
+ "data": "props",
19
+ "onClose": "props",
20
+ "onClick": "props",
21
+ "onCopy": "props",
22
+ "paste": "props",
23
+ "onMounted": "setup-const",
24
+ "ref": "setup-const",
25
+ "nextTick": "setup-const",
26
+ "defineOptions": "setup-const",
27
+ "AIcon": "setup-maybe-ref",
28
+ "Menu": "setup-maybe-ref",
29
+ "MenuItem": "setup-maybe-ref",
30
+ "props": "setup-reactive-const",
31
+ "contextMenu": "setup-ref",
32
+ "showDetail": "setup-maybe-ref",
33
+ "showPaste": "setup-maybe-ref",
34
+ "showDelete": "setup-maybe-ref",
35
+ "clickFunc": "setup-const",
36
+ "close": "setup-const"
37
+ } */
38
+ import { unref as _unref, createVNode as _createVNode, createTextVNode as _createTextVNode, withCtx as _withCtx, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
39
+ import { onMounted, ref, nextTick, } from "vue";
40
+ import { AIcon } from '../../../components';
41
+ import { Menu } from 'ant-design-vue';
42
+ const __sfc_main__ = Object.assign({
43
+ name: 'JEditTableContextMenu'
44
+ }, {
45
+ props: {
46
+ data: { type: Object, default: () => ({}) },
47
+ onClose: { type: Function, default: () => { } },
48
+ onClick: { type: Function, default: () => { } },
49
+ onCopy: { type: Function, default: () => { } },
50
+ paste: { type: Object, default: () => ({}) }
51
+ },
52
+ setup(__props) {
53
+ const MenuItem = Menu.Item;
54
+ const props = __props;
55
+ const contextMenu = ref(null);
56
+ const showDetail = computed(() => {
57
+ return !props.data.id;
58
+ });
59
+ const showPaste = computed(() => {
60
+ return !props.paste;
61
+ });
62
+ const showDelete = computed(() => {
63
+ return _optionalChain([props, 'access', _2 => _2.data, 'access', _3 => _3.expands, 'optionalAccess', _4 => _4.isProduct]);
64
+ });
65
+ const clickFunc = ({ key }) => {
66
+ if (key === 'copy') {
67
+ props.onCopy(props.data);
68
+ }
69
+ props.onClick(key);
70
+ };
71
+ const close = (e) => {
72
+ setTimeout(() => {
73
+ props.onClose();
74
+ }, 300);
75
+ };
76
+ onMounted(async () => {
77
+ // 确保组件已经渲染
78
+ await nextTick();
79
+ // 触发组件focus
80
+ contextMenu.value.focus();
81
+ });
82
+ return (_ctx, _cache) => {
83
+ return (_openBlock(), _createElementBlock("div", {
84
+ class: "metadata-context-menu",
85
+ ref_key: "contextMenu",
86
+ ref: contextMenu,
87
+ tabindex: "-1",
88
+ onBlur: close
89
+ }, [
90
+ _createVNode(_unref(Menu), { onClick: clickFunc }, {
91
+ default: _withCtx(() => [
92
+ _createVNode(_unref(MenuItem), { key: "add" }, {
93
+ icon: _withCtx(() => [
94
+ _createVNode(_unref(AIcon), { type: "PlusSquareOutlined" })
95
+ ]),
96
+ default: _withCtx(() => [
97
+ _createTextVNode(" 新增行 ")
98
+ ]),
99
+ _: 1 /* STABLE */
100
+ }),
101
+ _createVNode(_unref(MenuItem), { key: "copy" }, {
102
+ icon: _withCtx(() => [
103
+ _createVNode(_unref(AIcon), { type: "icon-copy" })
104
+ ]),
105
+ default: _withCtx(() => [
106
+ _createTextVNode(" 复制行 ")
107
+ ]),
108
+ _: 1 /* STABLE */
109
+ }),
110
+ _createVNode(_unref(MenuItem), {
111
+ key: "paste",
112
+ disabled: _unref(showPaste)
113
+ }, {
114
+ icon: _withCtx(() => [
115
+ _createVNode(_unref(AIcon), { type: "icon-paste" })
116
+ ]),
117
+ default: _withCtx(() => [
118
+ _createTextVNode(" 粘贴行 ")
119
+ ]),
120
+ _: 1 /* STABLE */
121
+ }, 8 /* PROPS */, ["disabled"]),
122
+ _createVNode(_unref(MenuItem), {
123
+ key: "detail",
124
+ disabled: _unref(showDetail)
125
+ }, {
126
+ icon: _withCtx(() => [
127
+ _createVNode(_unref(AIcon), { type: "icon-chakan" })
128
+ ]),
129
+ default: _withCtx(() => [
130
+ _createTextVNode(" 查看详情 ")
131
+ ]),
132
+ _: 1 /* STABLE */
133
+ }, 8 /* PROPS */, ["disabled"]),
134
+ _createVNode(_unref(MenuItem), {
135
+ key: "delete",
136
+ class: "danger",
137
+ disabled: _unref(showDelete)
138
+ }, {
139
+ icon: _withCtx(() => [
140
+ _createVNode(_unref(AIcon), { type: "DeleteOutlined" })
141
+ ]),
142
+ default: _withCtx(() => [
143
+ _createTextVNode(" 删除 ")
144
+ ]),
145
+ _: 1 /* STABLE */
146
+ }, 8 /* PROPS */, ["disabled"])
147
+ ]),
148
+ _: 1 /* STABLE */
149
+ })
150
+ ], 544 /* NEED_HYDRATION, NEED_PATCH */));
151
+ };
152
+ }
153
+ });
154
+ export default __sfc_main__;
@@ -0,0 +1,81 @@
1
+ import MenuContext from './Menu.js';
2
+ import { h, render } from 'vue';
3
+ import { handlePureRecord } from "../../utils";
4
+ import { omit } from "lodash-es";
5
+ var curInstance = null;
6
+ var seed = 1;
7
+ var copyValue;
8
+ var contextMenu = function contextMenu(e, data, context) {
9
+ if (curInstance) {
10
+ curInstance.destroy();
11
+ }
12
+ curInstance = null;
13
+ var id = seed++;
14
+ // 创建一个临时的div,用于挂载我们的菜单
15
+ var container = document.createElement('div');
16
+ // 获取body标签,用于挂载整个菜单
17
+ var appendTo = context.getPopupContainer() || document.body;
18
+ // 传给menu组件的props
19
+ var props = {
20
+ data: data,
21
+ onClose: function onClose() {
22
+ if (curInstance) {
23
+ curInstance.destroy();
24
+ }
25
+ },
26
+ onClick: function onClick(type) {
27
+ var copyRecord = handlePureRecord(copyValue);
28
+ if (copyRecord.expands) {
29
+ copyRecord.expands = omit(copyRecord.expands, ['isProduct']);
30
+ }
31
+ context.click(type, data, handlePureRecord(copyRecord));
32
+ },
33
+ onCopy: function onCopy(data) {
34
+ copyValue = data;
35
+ context.click('copy', data);
36
+ },
37
+ paste: !!copyValue
38
+ };
39
+ // 渲染虚拟节点
40
+ var vnode = h(MenuContext, props);
41
+ // vnode为需要渲染的虚拟节点,container为渲染的容器
42
+ render(vnode, container);
43
+ // 首先需要先把菜单真正渲染到页面,才能拿到它的宽度和高度
44
+ appendTo.appendChild(container.firstElementChild);
45
+ // 当前真正的菜单节点,上面输出的vnode中可以看到,el就是我们的菜单节点
46
+ var curMenu = vnode.el;
47
+ // 获取curMenu的高度和宽度,用于临界的计算
48
+ var offsetWidth = curMenu.offsetWidth,
49
+ offsetHeight = curMenu.offsetHeight;
50
+ // 获取body的可视区域的宽度
51
+ var clientWidth = appendTo.clientWidth;
52
+ // 取出右键点击时的坐标,clientX是距离左侧的位置,clientY是距离顶部的位置
53
+ var clientX = e.clientX,
54
+ clientY = e.clientY;
55
+ // 当前可视区域的宽度 - 当前鼠标距离浏览器左边的距离
56
+ // 如果 大于菜单的宽度,说明正常设置菜单距离左边界的距离,即设置style.left
57
+ // 否则菜单需要在鼠标左侧展示,即需要设置style.right组件距离可视区域右侧的距离
58
+ var leftOrRight = clientWidth - clientX > offsetWidth ? "left" : "right";
59
+ // 当前浏览器的高度(不包含滚动条) - 当前鼠标距离浏览器上边的距离
60
+ // 如果 大于菜单的高度,说明可以正常设置菜单距离上边界的距离,即设置style.top
61
+ // 否则需要设置菜单距离底部边界的位置,即style.bottom
62
+ var topOrBottom = window.innerHeight - clientY > offsetHeight ? "top" : "bottom";
63
+ var offsetLeft = Math.abs(clientWidth - clientX);
64
+ // 设置left或者right的style
65
+ curMenu.style[leftOrRight] = leftOrRight === "left" ? "".concat(clientX + 20, "px") : "".concat(offsetLeft, "px");
66
+ // 设置top或者bottom的style
67
+ curMenu.style[topOrBottom] = topOrBottom === 'bottom' ? '2px' : "".concat(clientY, "px");
68
+ var instance = {
69
+ id: id,
70
+ destroy: function destroy() {
71
+ curInstance = null;
72
+ render(null, container);
73
+ },
74
+ cleanCopy: function cleanCopy() {
75
+ copyValue = null;
76
+ }
77
+ };
78
+ curInstance = instance;
79
+ return instance;
80
+ };
81
+ export default contextMenu;
@@ -0,0 +1,290 @@
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
+ "searchKey": "props",
19
+ "rowKey": "props",
20
+ "Table": "setup-const",
21
+ "useTableDataSource": "setup-maybe-ref",
22
+ "useTableTool": "setup-maybe-ref",
23
+ "Ellipsis": "setup-maybe-ref",
24
+ "DragModal": "setup-maybe-ref",
25
+ "Button": "setup-maybe-ref",
26
+ "Input": "setup-maybe-ref",
27
+ "Space": "setup-maybe-ref",
28
+ "ref": "setup-const",
29
+ "defineOptions": "setup-const",
30
+ "props": "setup-reactive-const",
31
+ "emit": "setup-const",
32
+ "dataSource": "setup-maybe-ref",
33
+ "tableTool": "setup-maybe-ref",
34
+ "searchValue": "setup-ref",
35
+ "filterArray": "setup-ref",
36
+ "visible": "setup-ref",
37
+ "searchIndex": "setup-ref",
38
+ "modalHeight": "setup-ref",
39
+ "tableHeight": "setup-ref",
40
+ "selectedRowKeys": "setup-ref",
41
+ "tableRef": "setup-ref",
42
+ "columns": "setup-const",
43
+ "selectedTableRow": "setup-const",
44
+ "handleFilterArray": "setup-const",
45
+ "search": "setup-const",
46
+ "heightChange": "setup-const",
47
+ "onClose": "setup-const",
48
+ "onSelect": "setup-const"
49
+ } */
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 = {
55
+ key: 0,
56
+ style: { "margin": "12px 0" }
57
+ };
58
+ const _hoisted_5 = { key: 1 };
59
+ const _hoisted_6 = { class: "edit-table-search-result-total" };
60
+ 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';
65
+ const __sfc_main__ = Object.assign({
66
+ name: 'JEditTableSearch'
67
+ }, {
68
+ props: {
69
+ searchKey: {
70
+ type: String,
71
+ default: 'id'
72
+ },
73
+ rowKey: {
74
+ type: String,
75
+ default: 'id'
76
+ }
77
+ },
78
+ emits: ['close'],
79
+ setup(__props, { emit: __emit }) {
80
+ const props = __props;
81
+ const emit = __emit;
82
+ const dataSource = useTableDataSource();
83
+ const tableTool = useTableTool();
84
+ const searchValue = ref();
85
+ const filterArray = ref([]);
86
+ const visible = ref(false);
87
+ const searchIndex = ref(-1);
88
+ const modalHeight = ref(100);
89
+ const tableHeight = ref(230);
90
+ const selectedRowKeys = ref([]);
91
+ const tableRef = ref();
92
+ const columns = [
93
+ {
94
+ title: '标识',
95
+ dataIndex: 'id',
96
+ },
97
+ {
98
+ title: '名称',
99
+ dataIndex: 'name',
100
+ }
101
+ ];
102
+ const selectedTableRow = (record) => {
103
+ tableTool.scrollTo({
104
+ ...record,
105
+ __serial: record.__oldSerial - 1
106
+ });
107
+ tableTool.selected([record[props.rowKey]]);
108
+ };
109
+ const handleFilterArray = () => {
110
+ const cloneDataSource = JSON.parse(JSON.stringify(dataSource.value || '[]')).map(item => Object.assign(item, { __oldSerial: item.__serial }));
111
+ return cloneDataSource.filter(item => {
112
+ if (item[props.searchKey]) {
113
+ return item[props.searchKey].includes(searchValue.value);
114
+ }
115
+ return false;
116
+ });
117
+ };
118
+ const search = (key) => {
119
+ filterArray.value = handleFilterArray();
120
+ if (key === 'all') { // 查找全部
121
+ visible.value = true;
122
+ modalHeight.value = 400;
123
+ searchIndex.value = 0;
124
+ }
125
+ else if (key === 'next') { // 下一个
126
+ searchIndex.value += 1;
127
+ }
128
+ else { // 上一个
129
+ searchIndex.value -= 1;
130
+ }
131
+ if (searchIndex.value < 0) { // 小于0时,跳转到最后一个
132
+ searchIndex.value = filterArray.value.length - 1;
133
+ }
134
+ else if (searchIndex.value > filterArray.value.length - 1) { // 大于整体搜索结果时,跳转到第一个
135
+ searchIndex.value = 0;
136
+ }
137
+ const searchItem = filterArray.value[searchIndex.value];
138
+ if (key !== 'all' && visible.value) {
139
+ _optionalChain([tableRef, 'access', _2 => _2.value, 'optionalAccess', _3 => _3.scrollToByIndex, 'call', _4 => _4(searchIndex.value - 1)]); // 控制EditTable滚动到指定为止
140
+ }
141
+ if (filterArray.value.length > 1) {
142
+ selectedRowKeys.value = [searchItem[props.rowKey]];
143
+ selectedTableRow(searchItem);
144
+ }
145
+ else {
146
+ selectedRowKeys.value = [];
147
+ tableTool.selected([]);
148
+ }
149
+ };
150
+ const heightChange = (h) => {
151
+ if (h > 340) {
152
+ tableHeight.value = h - 160;
153
+ }
154
+ };
155
+ const onClose = () => {
156
+ emit('close');
157
+ tableTool.searchVisible(false);
158
+ };
159
+ const onSelect = (record) => {
160
+ searchIndex.value = filterArray.value.findIndex(item => item[props.rowKey] === record[props.rowKey]);
161
+ selectedRowKeys.value = [record[props.rowKey]];
162
+ selectedTableRow(record);
163
+ };
164
+ return (_ctx, _cache) => {
165
+ return (_openBlock(), _createBlock(_unref(DragModal), {
166
+ width: 800,
167
+ height: modalHeight.value,
168
+ title: false,
169
+ dragRang: [600, 200],
170
+ bodyStyle: {
171
+ overflow: 'hidden',
172
+ },
173
+ footer: false,
174
+ onHeightChange: heightChange
175
+ }, {
176
+ default: _withCtx(() => [
177
+ _createElementVNode("div", _hoisted_1, [
178
+ _createElementVNode("div", _hoisted_2, [
179
+ _createElementVNode("div", null, [
180
+ _createVNode(_unref(Space), null, {
181
+ default: _withCtx(() => [
182
+ _hoisted_3,
183
+ _createVNode(_unref(Input), {
184
+ value: searchValue.value,
185
+ "onUpdate:value": _cache[0] || (_cache[0] = $event => ((searchValue).value = $event)),
186
+ maxlength: 64,
187
+ placeholder: "请输入查找内容"
188
+ }, null, 8 /* PROPS */, ["value"]),
189
+ _createVNode(_unref(Button), {
190
+ type: "primary",
191
+ ghost: "",
192
+ onClick: _cache[1] || (_cache[1] = () => search('all'))
193
+ }, {
194
+ default: _withCtx(() => [
195
+ _createTextVNode("查找全部")
196
+ ]),
197
+ _: 1 /* STABLE */
198
+ }),
199
+ _createVNode(_unref(Button), {
200
+ type: "primary",
201
+ ghost: "",
202
+ onClick: _cache[2] || (_cache[2] = () => search('prev'))
203
+ }, {
204
+ default: _withCtx(() => [
205
+ _createTextVNode("上一个")
206
+ ]),
207
+ _: 1 /* STABLE */
208
+ }),
209
+ _createVNode(_unref(Button), {
210
+ type: "primary",
211
+ ghost: "",
212
+ onClick: _cache[3] || (_cache[3] = () => search('next'))
213
+ }, {
214
+ default: _withCtx(() => [
215
+ _createTextVNode("下一个")
216
+ ]),
217
+ _: 1 /* STABLE */
218
+ })
219
+ ]),
220
+ _: 1 /* STABLE */
221
+ })
222
+ ]),
223
+ _createElementVNode("div", null, [
224
+ _createVNode(_unref(Button), {
225
+ type: "primary",
226
+ onClick: _withModifiers(onClose, ["stop"])
227
+ }, {
228
+ default: _withCtx(() => [
229
+ _createTextVNode("关闭")
230
+ ]),
231
+ _: 1 /* STABLE */
232
+ })
233
+ ])
234
+ ]),
235
+ (visible.value)
236
+ ? (_openBlock(), _createElementBlock("div", _hoisted_4, [
237
+ _createVNode(Table, {
238
+ ref_key: "tableRef",
239
+ ref: tableRef,
240
+ "data-source": filterArray.value,
241
+ columns: columns,
242
+ height: tableHeight.value,
243
+ disableMenu: false,
244
+ cellHeight: 36,
245
+ rowSelection: {
246
+ onSelect: onSelect,
247
+ selectedRowKeys: selectedRowKeys.value
248
+ },
249
+ serial: {
250
+ title: '行数'
251
+ }
252
+ }, {
253
+ serial: _withCtx(({ record }) => [
254
+ _createElementVNode("span", null, _toDisplayString(record.__oldSerial), 1 /* TEXT */)
255
+ ]),
256
+ id: _withCtx(({ record }) => [
257
+ _createVNode(_unref(Ellipsis), null, {
258
+ default: _withCtx(() => [
259
+ _createTextVNode(_toDisplayString(record.id), 1 /* TEXT */)
260
+ ]),
261
+ _: 2 /* DYNAMIC */
262
+ }, 1024 /* DYNAMIC_SLOTS */)
263
+ ]),
264
+ name: _withCtx(({ record }) => [
265
+ _createVNode(_unref(Ellipsis), null, {
266
+ default: _withCtx(() => [
267
+ _createTextVNode(_toDisplayString(record.name), 1 /* TEXT */)
268
+ ]),
269
+ _: 2 /* DYNAMIC */
270
+ }, 1024 /* DYNAMIC_SLOTS */)
271
+ ]),
272
+ _: 1 /* STABLE */
273
+ }, 8 /* PROPS */, ["data-source", "height", "rowSelection"])
274
+ ]))
275
+ : _createCommentVNode("v-if", true),
276
+ (visible.value)
277
+ ? (_openBlock(), _createElementBlock("div", _hoisted_5, [
278
+ _createTextVNode(" 查找到 "),
279
+ _createElementVNode("span", _hoisted_6, _toDisplayString(filterArray.value.length), 1 /* TEXT */),
280
+ _createTextVNode(" 条相关属性 ")
281
+ ]))
282
+ : _createCommentVNode("v-if", true)
283
+ ])
284
+ ]),
285
+ _: 1 /* STABLE */
286
+ }, 8 /* PROPS */, ["height"]));
287
+ };
288
+ }
289
+ });
290
+ export default __sfc_main__;
@@ -0,0 +1 @@
1
+ export { default as Search } from './Search.js';
@@ -0,0 +1,7 @@
1
+ export var TABLE_WRAPPER = Symbol('table-wrapper');
2
+ export var FULL_SCREEN = Symbol('full');
3
+ export var RIGHT_MENU = Symbol('right-menu');
4
+ export var TABLE_ERROR = Symbol('table-error');
5
+ export var TABLE_DATA_SOURCE = Symbol('table-data-source');
6
+ export var TABLE_TOOL = Symbol('table-tool');
7
+ export var TABLE_FORM_ITEM_ERROR = Symbol('table-form-item-error');
@@ -0,0 +1,40 @@
1
+ import { provide, inject, computed } from 'vue';
2
+ import { RIGHT_MENU, TABLE_DATA_SOURCE, TABLE_ERROR, TABLE_WRAPPER, TABLE_TOOL, TABLE_FORM_ITEM_ERROR, FULL_SCREEN } from "../consts";
3
+ export * from './useResizeObserver';
4
+ export * from './useValidate';
5
+ var FormContextKey = 'form-context';
6
+ export var useFormContext = function useFormContext(options) {
7
+ provide(FormContextKey, options);
8
+ };
9
+ export var useInjectForm = function useInjectForm() {
10
+ return inject(FormContextKey, {
11
+ addField: function addField(key, field) {},
12
+ dataSource: computed(function () {
13
+ return [];
14
+ }),
15
+ rules: computed(function () {
16
+ return undefined;
17
+ })
18
+ });
19
+ };
20
+ export var useInjectError = function useInjectError() {
21
+ return inject(TABLE_ERROR);
22
+ };
23
+ export var useTableWrapper = function useTableWrapper() {
24
+ return inject(TABLE_WRAPPER);
25
+ };
26
+ export var useRightMenuContext = function useRightMenuContext() {
27
+ return inject(RIGHT_MENU);
28
+ };
29
+ export var useTableDataSource = function useTableDataSource() {
30
+ return inject(TABLE_DATA_SOURCE, []);
31
+ };
32
+ export var useTableTool = function useTableTool() {
33
+ return inject(TABLE_TOOL, false);
34
+ };
35
+ export var useFormItemError = function useFormItemError() {
36
+ return inject(TABLE_FORM_ITEM_ERROR);
37
+ };
38
+ export var useTableFullScreen = function useTableFullScreen() {
39
+ return inject(FULL_SCREEN);
40
+ };
@@ -0,0 +1,31 @@
1
+ import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
2
+ import { onBeforeUnmount, onMounted } from "vue";
3
+ import ResizeObserver from "resize-observer-polyfill";
4
+ import { debounce } from "lodash-es";
5
+ export var useResizeObserver = function useResizeObserver(tableWrapper, cb) {
6
+ var observer;
7
+ var onResize = function onResize(e) {
8
+ var rect = {};
9
+ var _iterator = _createForOfIteratorHelper(e),
10
+ _step;
11
+ try {
12
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
13
+ var entry = _step.value;
14
+ rect = entry.contentRect;
15
+ }
16
+ } catch (err) {
17
+ _iterator.e(err);
18
+ } finally {
19
+ _iterator.f();
20
+ }
21
+ cb(rect, e);
22
+ };
23
+ onMounted(function () {
24
+ observer = new ResizeObserver(debounce(onResize, 100));
25
+ observer.observe(tableWrapper.value);
26
+ });
27
+ onBeforeUnmount(function () {
28
+ var _observer;
29
+ (_observer = observer) === null || _observer === void 0 ? void 0 : _observer.unobserve(tableWrapper.value);
30
+ });
31
+ };