@jetlinks-web/components 2.0.38 → 2.1.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 +5 -2
- package/es/EditTable/EditTable.js +23 -11
- package/es/EditTable/FormItem.js +213 -0
- package/es/EditTable/Header.js +3 -2
- package/es/EditTable/components/Search/Search.js +7 -13
- package/es/EditTable/index.js +2 -0
- package/es/EditTable/props.js +12 -0
- package/es/EditTable/style/body.less +76 -76
- package/es/EditTable/style/index.css +0 -5
- package/es/EditTable/style/index.less +1 -5
- package/es/EditTable/style/table.less +42 -42
- package/es/EditTable/utils.js +0 -1
- package/es/FullPage/FullPage.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/style/index.css +0 -5
- package/lib/EditTable/Body.js +5 -2
- package/lib/EditTable/EditTable.js +23 -11
- package/lib/EditTable/FormItem.js +213 -0
- package/lib/EditTable/Header.js +3 -2
- package/lib/EditTable/components/Search/Search.js +7 -13
- package/lib/EditTable/index.js +2 -0
- package/lib/EditTable/props.js +12 -0
- package/lib/EditTable/style/body.less +76 -76
- package/lib/EditTable/style/index.css +0 -5
- package/lib/EditTable/style/index.less +1 -5
- package/lib/EditTable/style/table.less +42 -42
- package/lib/EditTable/utils.js +0 -1
- package/lib/FullPage/FullPage.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/style/index.css +0 -5
- package/package.json +3 -3
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
.jetlinks-edit-table-wrapper {
|
|
2
|
-
background: #fff;
|
|
3
|
-
height: 100%;
|
|
4
|
-
position: relative;
|
|
5
|
-
|
|
6
|
-
&.table-full-screen {
|
|
7
|
-
padding: 24px;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.jetlinks-edit-table {
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-direction: column;
|
|
13
|
-
flex-grow: 0;
|
|
14
|
-
flex-shrink: 0;
|
|
15
|
-
|
|
16
|
-
.jetlinks-edit-table-header {
|
|
17
|
-
overflow: hidden;
|
|
18
|
-
width: 100%;
|
|
19
|
-
position: relative;
|
|
20
|
-
|
|
21
|
-
.jetlinks-edit-table-header-scroll-hidden {
|
|
22
|
-
position: absolute;
|
|
23
|
-
top: 0;
|
|
24
|
-
right: 0;
|
|
25
|
-
bottom: 0;
|
|
26
|
-
z-index: 5;
|
|
27
|
-
background: #fafafa;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
.jetlinks-edit-table-body {
|
|
33
|
-
background-color: #fff;
|
|
34
|
-
overflow-y: hidden;
|
|
35
|
-
position: relative;
|
|
36
|
-
height: 100%;
|
|
37
|
-
width: 100%;
|
|
38
|
-
flex: 1 1 auto;
|
|
39
|
-
flex-direction: row;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
1
|
+
.jetlinks-edit-table-wrapper {
|
|
2
|
+
background: #fff;
|
|
3
|
+
height: 100%;
|
|
4
|
+
position: relative;
|
|
5
|
+
|
|
6
|
+
&.table-full-screen {
|
|
7
|
+
padding: 24px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.jetlinks-edit-table {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
flex-grow: 0;
|
|
14
|
+
flex-shrink: 0;
|
|
15
|
+
|
|
16
|
+
.jetlinks-edit-table-header {
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
width: 100%;
|
|
19
|
+
position: relative;
|
|
20
|
+
|
|
21
|
+
.jetlinks-edit-table-header-scroll-hidden {
|
|
22
|
+
position: absolute;
|
|
23
|
+
top: 0;
|
|
24
|
+
right: 0;
|
|
25
|
+
bottom: 0;
|
|
26
|
+
z-index: 5;
|
|
27
|
+
background: #fafafa;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
.jetlinks-edit-table-body {
|
|
33
|
+
background-color: #fff;
|
|
34
|
+
overflow-y: hidden;
|
|
35
|
+
position: relative;
|
|
36
|
+
height: 100%;
|
|
37
|
+
width: 100%;
|
|
38
|
+
flex: 1 1 auto;
|
|
39
|
+
flex-direction: row;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
package/es/EditTable/utils.js
CHANGED
package/es/FullPage/FullPage.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
} */
|
|
7
7
|
import { defineComponent as _defineComponent } from 'vue';
|
|
8
8
|
import { unref as _unref, renderSlot as _renderSlot, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
9
|
-
const _withScopeId = n => (_pushScopeId("data-v-
|
|
9
|
+
const _withScopeId = n => (_pushScopeId("data-v-1722999078250"), n = n(), _popScopeId(), n);
|
|
10
10
|
const _hoisted_1 = { class: "full-page-warp-content" };
|
|
11
11
|
import { ref } from 'vue';
|
|
12
12
|
import { useElementBounding } from '@vueuse/core';
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
} */
|
|
22
22
|
import { defineComponent as _defineComponent } from 'vue';
|
|
23
23
|
import { unref as _unref, createVNode as _createVNode, withCtx as _withCtx, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createBlock as _createBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
24
|
-
const _withScopeId = n => (_pushScopeId("data-v-
|
|
24
|
+
const _withScopeId = n => (_pushScopeId("data-v-1722999080365"), n = n(), _popScopeId(), n);
|
|
25
25
|
const _hoisted_1 = {
|
|
26
26
|
key: 0,
|
|
27
27
|
style: { "width": "240px" }
|
package/es/Search/Item.js
CHANGED
|
@@ -78,7 +78,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
|
|
|
78
78
|
} */
|
|
79
79
|
import { defineComponent as _defineComponent } from 'vue';
|
|
80
80
|
import { unref as _unref, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementBlock as _createElementBlock, createVNode as _createVNode, Fragment as _Fragment, normalizeStyle as _normalizeStyle, mergeProps as _mergeProps, resolveDynamicComponent as _resolveDynamicComponent, withCtx as _withCtx, createElementVNode as _createElementVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
81
|
-
const _withScopeId = n => (_pushScopeId("data-v-
|
|
81
|
+
const _withScopeId = n => (_pushScopeId("data-v-1722999079745"), n = n(), _popScopeId(), n);
|
|
82
82
|
const _hoisted_1 = { class: "JSearch-item" };
|
|
83
83
|
const _hoisted_2 = {
|
|
84
84
|
key: 0,
|
package/es/Search/Search.js
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
} */
|
|
37
37
|
import { defineComponent as _defineComponent } from 'vue';
|
|
38
38
|
import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createVNode as _createVNode, unref as _unref, withCtx as _withCtx, createBlock as _createBlock, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
39
|
-
const _withScopeId = n => (_pushScopeId("data-v-
|
|
39
|
+
const _withScopeId = n => (_pushScopeId("data-v-1722999079821"), n = n(), _popScopeId(), n);
|
|
40
40
|
const _hoisted_1 = { class: "JSearch-content simple" };
|
|
41
41
|
const _hoisted_2 = { class: "JSearch-items" };
|
|
42
42
|
import { Button, Row, Col, Form, FormItemRest, } from 'ant-design-vue';
|
package/es/style/index.css
CHANGED
|
@@ -1586,8 +1586,6 @@ textarea.ant-pagination-options-quick-jumper input {
|
|
|
1586
1586
|
}
|
|
1587
1587
|
.jetlinks-edit-table-horizontal-scroll {
|
|
1588
1588
|
height: 17px;
|
|
1589
|
-
min-height: 17px;
|
|
1590
|
-
max-height: 17px;
|
|
1591
1589
|
width: 100%;
|
|
1592
1590
|
display: flex;
|
|
1593
1591
|
position: relative;
|
|
@@ -1599,15 +1597,12 @@ textarea.ant-pagination-options-quick-jumper input {
|
|
|
1599
1597
|
position: relative;
|
|
1600
1598
|
flex: 1 1 0;
|
|
1601
1599
|
height: 17px;
|
|
1602
|
-
min-height: 17px;
|
|
1603
|
-
max-height: 17px;
|
|
1604
1600
|
width: 100%;
|
|
1605
1601
|
}
|
|
1606
1602
|
.jetlinks-edit-table-horizontal-scroll .jetlinks-edit-table-horizontal-scroll-viewport > div {
|
|
1607
1603
|
height: 17px;
|
|
1608
1604
|
}
|
|
1609
1605
|
.jetlinks-edit-table-horizontal-scroll .jetlinks-edit-table-horizontal-scroll-hidden {
|
|
1610
|
-
width: 17px;
|
|
1611
1606
|
height: 100%;
|
|
1612
1607
|
overflow-x: hidden;
|
|
1613
1608
|
}
|
package/lib/EditTable/Body.js
CHANGED
|
@@ -47,7 +47,8 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
|
|
|
47
47
|
"scrollTo": "setup-const",
|
|
48
48
|
"showContextMenu": "setup-const",
|
|
49
49
|
"rowClick": "setup-const",
|
|
50
|
-
"updateSelectedKeys": "setup-const"
|
|
50
|
+
"updateSelectedKeys": "setup-const",
|
|
51
|
+
"getViewScrollRef": "setup-const"
|
|
51
52
|
} */
|
|
52
53
|
import { normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, unref as _unref, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, withModifiers as _withModifiers, normalizeClass as _normalizeClass, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, createVNode as _createVNode } from "vue";
|
|
53
54
|
const _hoisted_1 = {
|
|
@@ -152,6 +153,7 @@ const __sfc_main__ = Object.assign({
|
|
|
152
153
|
const updateSelectedKeys = (keys) => {
|
|
153
154
|
selectedRowKeys.value = keys;
|
|
154
155
|
};
|
|
156
|
+
const getViewScrollRef = () => viewScrollRef.value;
|
|
155
157
|
watch(() => JSON.stringify(_optionalChain([props, 'access', _6 => _6.rowSelection, 'optionalAccess', _7 => _7.selectedRowKeys])), (val) => {
|
|
156
158
|
selectedRowKeys.value = JSON.parse(val || '[]');
|
|
157
159
|
}, { immediate: true });
|
|
@@ -188,7 +190,8 @@ const __sfc_main__ = Object.assign({
|
|
|
188
190
|
});
|
|
189
191
|
__expose({
|
|
190
192
|
scrollTo,
|
|
191
|
-
updateSelectedKeys
|
|
193
|
+
updateSelectedKeys,
|
|
194
|
+
getViewScrollRef
|
|
192
195
|
});
|
|
193
196
|
return (_ctx, _cache) => {
|
|
194
197
|
const _component_j_empty = _resolveComponent("j-empty");
|
|
@@ -83,7 +83,6 @@ const _hoisted_3 = {
|
|
|
83
83
|
key: 0,
|
|
84
84
|
class: "jetlinks-edit-table-horizontal-scroll"
|
|
85
85
|
};
|
|
86
|
-
const _hoisted_4 = /*#__PURE__*/ _createElementVNode("div", { class: "jetlinks-edit-table-horizontal-scroll-hidden" }, null, -1 /* HOISTED */);
|
|
87
86
|
import { FULL_SCREEN, RIGHT_MENU, TABLE_DATA_SOURCE, TABLE_ERROR, TABLE_TOOL, TABLE_WRAPPER } from './consts';
|
|
88
87
|
import { handleColumnsWidth } from './utils';
|
|
89
88
|
import { useResizeObserver, useValidate, useFormContext } from './hooks';
|
|
@@ -213,7 +212,8 @@ const __sfc_main__ = Object.assign({
|
|
|
213
212
|
emit('searchVisibleChange', v);
|
|
214
213
|
},
|
|
215
214
|
scrollMap,
|
|
216
|
-
sortData
|
|
215
|
+
sortData,
|
|
216
|
+
columns: myColumns
|
|
217
217
|
});
|
|
218
218
|
const addField = (key, field) => {
|
|
219
219
|
fields[key] = field;
|
|
@@ -235,7 +235,16 @@ const __sfc_main__ = Object.assign({
|
|
|
235
235
|
fieldsErrMap.value[key] = message;
|
|
236
236
|
}
|
|
237
237
|
const scrollWidth = computed(() => {
|
|
238
|
-
|
|
238
|
+
let _width = 0;
|
|
239
|
+
if (props.dataSource.length * props.cellHeight) {
|
|
240
|
+
_width = 17;
|
|
241
|
+
}
|
|
242
|
+
if (_optionalChain([tableBody, 'access', _2 => _2.value, 'optionalAccess', _3 => _3.getViewScrollRef])) {
|
|
243
|
+
const viewScrollDom = _optionalChain([tableBody, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.getViewScrollRef, 'call', _6 => _6()]);
|
|
244
|
+
const bodyContainer = viewScrollDom.querySelector('.jetlinks-edit-table-body-container');
|
|
245
|
+
_width = viewScrollDom.offsetWidth - bodyContainer.offsetWidth;
|
|
246
|
+
}
|
|
247
|
+
return _width;
|
|
239
248
|
});
|
|
240
249
|
const onHorizontalScroll = () => {
|
|
241
250
|
if (!horizontalScrollRef.value)
|
|
@@ -266,8 +275,8 @@ const __sfc_main__ = Object.assign({
|
|
|
266
275
|
dataIndex: '__serial',
|
|
267
276
|
title: options.title,
|
|
268
277
|
customRender: (customData) => {
|
|
269
|
-
if (_optionalChain([props, 'access',
|
|
270
|
-
return _optionalChain([props, 'access',
|
|
278
|
+
if (_optionalChain([props, 'access', _7 => _7.serial, 'optionalAccess', _8 => _8.customRender])) {
|
|
279
|
+
return _optionalChain([props, 'access', _9 => _9.serial, 'optionalAccess', _10 => _10.customRender, 'call', _11 => _11(customData)]);
|
|
271
280
|
}
|
|
272
281
|
return customData.index + 1;
|
|
273
282
|
},
|
|
@@ -276,8 +285,7 @@ const __sfc_main__ = Object.assign({
|
|
|
276
285
|
};
|
|
277
286
|
newColumns = [serial, ...props.columns];
|
|
278
287
|
}
|
|
279
|
-
myColumns.value = handleColumnsWidth(newColumns, _width, _optionalChain([props, 'access',
|
|
280
|
-
console.log(width, _width, myColumns.value);
|
|
288
|
+
myColumns.value = handleColumnsWidth(newColumns, _width, _optionalChain([props, 'access', _12 => _12.scroll, 'optionalAccess', _13 => _13.x]));
|
|
281
289
|
}
|
|
282
290
|
const onScrollDown = (len) => {
|
|
283
291
|
emit('scrollDown', len);
|
|
@@ -340,8 +348,9 @@ const __sfc_main__ = Object.assign({
|
|
|
340
348
|
_createVNode(Header, {
|
|
341
349
|
columns: myColumns.value,
|
|
342
350
|
style: _normalizeStyle({ width: tableStyle.width }),
|
|
343
|
-
rowKey: _ctx.rowKey
|
|
344
|
-
|
|
351
|
+
rowKey: _ctx.rowKey,
|
|
352
|
+
searchColumns: _ctx.searchColumns
|
|
353
|
+
}, null, 8 /* PROPS */, ["columns", "style", "rowKey", "searchColumns"]),
|
|
345
354
|
_createElementVNode("div", {
|
|
346
355
|
class: "jetlinks-edit-table-header-scroll-hidden",
|
|
347
356
|
style: _normalizeStyle({ width: _unref(scrollWidth) + 'px' })
|
|
@@ -374,7 +383,7 @@ const __sfc_main__ = Object.assign({
|
|
|
374
383
|
]), 1032 /* PROPS, DYNAMIC_SLOTS */, ["dataSource", "columns", "cellHeight", "height", "disableMenu", "rowKey", "rowSelection"]),
|
|
375
384
|
_renderSlot(_ctx.$slots, "bodyExtra")
|
|
376
385
|
], 4 /* STYLE */),
|
|
377
|
-
(_ctx.scroll.x)
|
|
386
|
+
(_optionalChain([_ctx, 'access', _14 => _14.scroll, 'optionalAccess', _15 => _15.x]))
|
|
378
387
|
? (_openBlock(), _createElementBlock("div", _hoisted_3, [
|
|
379
388
|
_createElementVNode("div", {
|
|
380
389
|
class: "jetlinks-edit-table-horizontal-scroll-viewport",
|
|
@@ -390,7 +399,10 @@ const __sfc_main__ = Object.assign({
|
|
|
390
399
|
})
|
|
391
400
|
}, null, 4 /* STYLE */)
|
|
392
401
|
], 544 /* NEED_HYDRATION, NEED_PATCH */),
|
|
393
|
-
|
|
402
|
+
_createElementVNode("div", {
|
|
403
|
+
class: "jetlinks-edit-table-horizontal-scroll-hidden",
|
|
404
|
+
style: _normalizeStyle({ width: _unref(scrollWidth) + 'px' })
|
|
405
|
+
}, null, 4 /* STYLE */)
|
|
394
406
|
]))
|
|
395
407
|
: _createCommentVNode("v-if", true)
|
|
396
408
|
])
|
|
@@ -0,0 +1,213 @@
|
|
|
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
|
+
"name": "props",
|
|
19
|
+
"required": "props",
|
|
20
|
+
"onBeforeUnmount": "setup-const",
|
|
21
|
+
"computed": "setup-const",
|
|
22
|
+
"reactive": "setup-const",
|
|
23
|
+
"watch": "setup-const",
|
|
24
|
+
"defineOptions": "setup-const",
|
|
25
|
+
"get": "setup-maybe-ref",
|
|
26
|
+
"isArray": "setup-maybe-ref",
|
|
27
|
+
"useProvideFormItemContext": "setup-maybe-ref",
|
|
28
|
+
"useInjectError": "setup-maybe-ref",
|
|
29
|
+
"useInjectForm": "setup-maybe-ref",
|
|
30
|
+
"TABLE_FORM_ITEM_ERROR": "setup-maybe-ref",
|
|
31
|
+
"props": "setup-reactive-const",
|
|
32
|
+
"emit": "setup-const",
|
|
33
|
+
"context": "setup-maybe-ref",
|
|
34
|
+
"globalErrorMessage": "setup-maybe-ref",
|
|
35
|
+
"hideTimer": "setup-let",
|
|
36
|
+
"eventKey": "setup-ref",
|
|
37
|
+
"errorMap": "setup-reactive-const",
|
|
38
|
+
"filedId": "setup-ref",
|
|
39
|
+
"filedName": "setup-ref",
|
|
40
|
+
"filedValue": "setup-ref",
|
|
41
|
+
"popContainer": "setup-const",
|
|
42
|
+
"removeTimer": "setup-const",
|
|
43
|
+
"showErrorTip": "setup-const",
|
|
44
|
+
"hideErrorTip": "setup-const",
|
|
45
|
+
"validateRules": "setup-const",
|
|
46
|
+
"onFieldBlur": "setup-const",
|
|
47
|
+
"onFieldChange": "setup-const"
|
|
48
|
+
} */
|
|
49
|
+
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, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
50
|
+
const _withScopeId = n => (_pushScopeId("data-v-1722999077850"), n = n(), _popScopeId(), n);
|
|
51
|
+
const _hoisted_1 = { style: { "color": "#1d2129" } };
|
|
52
|
+
const _hoisted_2 = {
|
|
53
|
+
key: 0,
|
|
54
|
+
class: "table-form-error-target"
|
|
55
|
+
};
|
|
56
|
+
const _hoisted_3 = ["id"];
|
|
57
|
+
import { onBeforeUnmount, computed, reactive, watch, } from "vue";
|
|
58
|
+
import { get, isArray } from 'lodash-es';
|
|
59
|
+
import { useProvideFormItemContext } from 'ant-design-vue/es/form/FormItemContext';
|
|
60
|
+
import { useInjectError, useInjectForm } from "./hooks";
|
|
61
|
+
import { TABLE_FORM_ITEM_ERROR } from "./consts";
|
|
62
|
+
const __sfc_main__ = Object.assign({
|
|
63
|
+
name: 'JEditTableFormItem'
|
|
64
|
+
}, {
|
|
65
|
+
props: {
|
|
66
|
+
name: {
|
|
67
|
+
type: [String, Array],
|
|
68
|
+
default: undefined
|
|
69
|
+
},
|
|
70
|
+
required: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: false
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
emits: ['change'],
|
|
76
|
+
setup(__props, { emit: __emit }) {
|
|
77
|
+
const props = __props;
|
|
78
|
+
const emit = __emit;
|
|
79
|
+
const context = useInjectForm();
|
|
80
|
+
const globalErrorMessage = useInjectError();
|
|
81
|
+
let hideTimer;
|
|
82
|
+
const eventKey = computed(() => {
|
|
83
|
+
const names = isArray(props.name) ? props.name : [props.name];
|
|
84
|
+
return names.join('-');
|
|
85
|
+
});
|
|
86
|
+
const errorMap = reactive({
|
|
87
|
+
message: '',
|
|
88
|
+
visible: false
|
|
89
|
+
});
|
|
90
|
+
const filedId = computed(() => {
|
|
91
|
+
const names = isArray(props.name) ? props.name : [props.name];
|
|
92
|
+
return names.join('_');
|
|
93
|
+
});
|
|
94
|
+
const filedName = computed(() => {
|
|
95
|
+
const names = isArray(props.name) ? props.name : [props.name];
|
|
96
|
+
const _rules = context.rules.value;
|
|
97
|
+
let tempKey = undefined;
|
|
98
|
+
for (const key of names) {
|
|
99
|
+
if (key in _rules) {
|
|
100
|
+
tempKey = key;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return tempKey;
|
|
104
|
+
});
|
|
105
|
+
const filedValue = computed(() => {
|
|
106
|
+
return get(context.dataSource.value, props.name);
|
|
107
|
+
});
|
|
108
|
+
provide(TABLE_FORM_ITEM_ERROR, errorMap);
|
|
109
|
+
const popContainer = (e) => {
|
|
110
|
+
return e;
|
|
111
|
+
};
|
|
112
|
+
const removeTimer = () => {
|
|
113
|
+
if (hideTimer) {
|
|
114
|
+
window.clearTimeout(hideTimer);
|
|
115
|
+
hideTimer = null;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const showErrorTip = (msg) => {
|
|
119
|
+
removeTimer();
|
|
120
|
+
errorMap.message = msg;
|
|
121
|
+
errorMap.visible = true;
|
|
122
|
+
};
|
|
123
|
+
const hideErrorTip = () => {
|
|
124
|
+
errorMap.visible = false;
|
|
125
|
+
removeTimer();
|
|
126
|
+
hideTimer = setTimeout(() => {
|
|
127
|
+
errorMap.message = '';
|
|
128
|
+
}, 300);
|
|
129
|
+
};
|
|
130
|
+
const validateRules = () => {
|
|
131
|
+
let index = 0;
|
|
132
|
+
if (isArray(props.name)) {
|
|
133
|
+
index = props.name[0];
|
|
134
|
+
}
|
|
135
|
+
const promise = context.validateItem({ [filedName.value]: get(context.dataSource.value, props.name) }, index);
|
|
136
|
+
promise.catch(res => {
|
|
137
|
+
const error = _optionalChain([res, 'optionalAccess', _2 => _2.filter, 'call', _3 => _3(item => item.field === filedName.value)]) || [];
|
|
138
|
+
if (error.length === 0) {
|
|
139
|
+
hideErrorTip();
|
|
140
|
+
context.removeFieldError(eventKey.value);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
removeTimer();
|
|
144
|
+
errorMap.message = _optionalChain([error, 'access', _4 => _4[0], 'optionalAccess', _5 => _5.message]) || errorMap.message;
|
|
145
|
+
errorMap.visible = !!error.length;
|
|
146
|
+
context.addFieldError(eventKey.value, errorMap.message);
|
|
147
|
+
}
|
|
148
|
+
return errorMap.message;
|
|
149
|
+
});
|
|
150
|
+
return promise;
|
|
151
|
+
};
|
|
152
|
+
const onFieldBlur = () => {
|
|
153
|
+
// validateRules()
|
|
154
|
+
};
|
|
155
|
+
const onFieldChange = () => {
|
|
156
|
+
validateRules();
|
|
157
|
+
emit('change');
|
|
158
|
+
};
|
|
159
|
+
watch(() => globalErrorMessage.value, (val) => {
|
|
160
|
+
if (val[eventKey.value]) {
|
|
161
|
+
showErrorTip(val[eventKey.value]);
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
hideErrorTip();
|
|
165
|
+
}
|
|
166
|
+
}, { immediate: true, deep: true });
|
|
167
|
+
useProvideFormItemContext({
|
|
168
|
+
id: filedId,
|
|
169
|
+
onFieldChange,
|
|
170
|
+
onFieldBlur,
|
|
171
|
+
}, computed(() => get(context.dataSource.value, props.name)));
|
|
172
|
+
onBeforeUnmount(() => {
|
|
173
|
+
hideErrorTip();
|
|
174
|
+
});
|
|
175
|
+
watch(() => [filedName.value, props.name], () => {
|
|
176
|
+
context.addField(eventKey.value, {
|
|
177
|
+
filedName: filedName.value,
|
|
178
|
+
eventKey: eventKey.value,
|
|
179
|
+
names: props.name,
|
|
180
|
+
validateRules,
|
|
181
|
+
showErrorTip
|
|
182
|
+
});
|
|
183
|
+
}, { immediate: true });
|
|
184
|
+
return (_ctx, _cache) => {
|
|
185
|
+
const _component_a_tooltip = _resolveComponent("a-tooltip");
|
|
186
|
+
return (_openBlock(), _createElementBlock(_Fragment, null, [
|
|
187
|
+
_createVNode(_component_a_tooltip, {
|
|
188
|
+
color: "#ffffff",
|
|
189
|
+
"get-popup-container": popContainer,
|
|
190
|
+
arrowPointAtCenter: true
|
|
191
|
+
}, {
|
|
192
|
+
title: _withCtx(() => [
|
|
193
|
+
_createElementVNode("span", _hoisted_1, _toDisplayString(errorMap.message), 1 /* TEXT */)
|
|
194
|
+
]),
|
|
195
|
+
default: _withCtx(() => [
|
|
196
|
+
(errorMap.visible)
|
|
197
|
+
? (_openBlock(), _createElementBlock("div", _hoisted_2))
|
|
198
|
+
: _createCommentVNode("v-if", true)
|
|
199
|
+
]),
|
|
200
|
+
_: 1 /* STABLE */
|
|
201
|
+
}),
|
|
202
|
+
_createElementVNode("div", {
|
|
203
|
+
id: eventKey.value,
|
|
204
|
+
style: { "position": "relative" },
|
|
205
|
+
class: _normalizeClass({ 'edit-table-form-has-error': errorMap.message })
|
|
206
|
+
}, [
|
|
207
|
+
_renderSlot(_ctx.$slots, "default")
|
|
208
|
+
], 10 /* CLASS, PROPS */, _hoisted_3)
|
|
209
|
+
], 64 /* STABLE_FRAGMENT */));
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
export default __sfc_main__;
|
package/lib/EditTable/Header.js
CHANGED
|
@@ -78,7 +78,7 @@ const __sfc_main__ = Object.assign({
|
|
|
78
78
|
style: {
|
|
79
79
|
type: Object,
|
|
80
80
|
default: undefined
|
|
81
|
-
}
|
|
81
|
+
},
|
|
82
82
|
},
|
|
83
83
|
setup(__props) {
|
|
84
84
|
const props = __props;
|
|
@@ -232,8 +232,9 @@ const __sfc_main__ = Object.assign({
|
|
|
232
232
|
key: 0,
|
|
233
233
|
searchKey: searchData.key,
|
|
234
234
|
rowKey: _ctx.rowKey,
|
|
235
|
+
columns: _ctx.searchColumns,
|
|
235
236
|
onClose: _cache[0] || (_cache[0] = $event => (searchData.visible = false))
|
|
236
|
-
}, null, 8 /* PROPS */, ["searchKey", "rowKey"]))
|
|
237
|
+
}, null, 8 /* PROPS */, ["searchKey", "rowKey", "columns"]))
|
|
237
238
|
: _createCommentVNode("v-if", true)
|
|
238
239
|
], 64 /* STABLE_FRAGMENT */));
|
|
239
240
|
};
|
|
@@ -17,6 +17,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
|
|
|
17
17
|
/* Analyzed bindings: {
|
|
18
18
|
"searchKey": "props",
|
|
19
19
|
"rowKey": "props",
|
|
20
|
+
"columns": "props",
|
|
20
21
|
"Table": "setup-const",
|
|
21
22
|
"useTableDataSource": "setup-maybe-ref",
|
|
22
23
|
"useTableTool": "setup-maybe-ref",
|
|
@@ -39,7 +40,6 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
|
|
|
39
40
|
"tableHeight": "setup-ref",
|
|
40
41
|
"selectedRowKeys": "setup-ref",
|
|
41
42
|
"tableRef": "setup-ref",
|
|
42
|
-
"columns": "setup-const",
|
|
43
43
|
"selectedTableRow": "setup-const",
|
|
44
44
|
"handleFilterArray": "setup-const",
|
|
45
45
|
"search": "setup-const",
|
|
@@ -73,6 +73,10 @@ const __sfc_main__ = Object.assign({
|
|
|
73
73
|
rowKey: {
|
|
74
74
|
type: String,
|
|
75
75
|
default: 'id'
|
|
76
|
+
},
|
|
77
|
+
columns: {
|
|
78
|
+
type: Array,
|
|
79
|
+
default: () => []
|
|
76
80
|
}
|
|
77
81
|
},
|
|
78
82
|
emits: ['close'],
|
|
@@ -89,16 +93,6 @@ const __sfc_main__ = Object.assign({
|
|
|
89
93
|
const tableHeight = ref(230);
|
|
90
94
|
const selectedRowKeys = ref([]);
|
|
91
95
|
const tableRef = ref();
|
|
92
|
-
const columns = [
|
|
93
|
-
{
|
|
94
|
-
title: '标识',
|
|
95
|
-
dataIndex: 'id',
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
title: '名称',
|
|
99
|
-
dataIndex: 'name',
|
|
100
|
-
}
|
|
101
|
-
];
|
|
102
96
|
const selectedTableRow = (record) => {
|
|
103
97
|
tableTool.scrollTo({
|
|
104
98
|
...record,
|
|
@@ -238,7 +232,7 @@ const __sfc_main__ = Object.assign({
|
|
|
238
232
|
ref_key: "tableRef",
|
|
239
233
|
ref: tableRef,
|
|
240
234
|
"data-source": filterArray.value,
|
|
241
|
-
columns: columns,
|
|
235
|
+
columns: __props.columns,
|
|
242
236
|
height: tableHeight.value,
|
|
243
237
|
disableMenu: false,
|
|
244
238
|
cellHeight: 36,
|
|
@@ -270,7 +264,7 @@ const __sfc_main__ = Object.assign({
|
|
|
270
264
|
}, 1024 /* DYNAMIC_SLOTS */)
|
|
271
265
|
]),
|
|
272
266
|
_: 1 /* STABLE */
|
|
273
|
-
}, 8 /* PROPS */, ["data-source", "height", "rowSelection"])
|
|
267
|
+
}, 8 /* PROPS */, ["data-source", "columns", "height", "rowSelection"])
|
|
274
268
|
]))
|
|
275
269
|
: _createCommentVNode("v-if", true),
|
|
276
270
|
(visible.value)
|
package/lib/EditTable/index.js
CHANGED
|
@@ -8,9 +8,11 @@ exports.default = void 0;
|
|
|
8
8
|
var _EditTable = _interopRequireDefault(require("./EditTable.js"));
|
|
9
9
|
var _Body = _interopRequireDefault(require("./Body.js"));
|
|
10
10
|
var _Header = _interopRequireDefault(require("./Header.js"));
|
|
11
|
+
var _FormItem = _interopRequireDefault(require("./FormItem.js"));
|
|
11
12
|
_EditTable.default.install = function (app) {
|
|
12
13
|
app.component(_EditTable.default.name, _EditTable.default);
|
|
13
14
|
app.component(_Body.default.name, _Body.default);
|
|
14
15
|
app.component(_Header.default.name, _Header.default);
|
|
16
|
+
app.component(_FormItem.default.name, _FormItem.default);
|
|
15
17
|
};
|
|
16
18
|
var _default = exports.default = _EditTable.default;
|
package/lib/EditTable/props.js
CHANGED
|
@@ -15,6 +15,18 @@ var defaultProps = exports.defaultProps = function defaultProps() {
|
|
|
15
15
|
default: function _default() {
|
|
16
16
|
return [];
|
|
17
17
|
}
|
|
18
|
+
},
|
|
19
|
+
searchColumns: {
|
|
20
|
+
type: Array,
|
|
21
|
+
default: function _default() {
|
|
22
|
+
return [{
|
|
23
|
+
title: '标识',
|
|
24
|
+
dataIndex: 'id'
|
|
25
|
+
}, {
|
|
26
|
+
title: '名称',
|
|
27
|
+
dataIndex: 'name'
|
|
28
|
+
}];
|
|
29
|
+
}
|
|
18
30
|
}
|
|
19
31
|
};
|
|
20
32
|
};
|