@king-design/vue 3.4.3-beta.2 → 3.4.4
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/__tests__/__snapshots__/Vue Next Demos.md +295 -221
- package/__tests__/components/editable.spec.ts +1 -1
- package/__tests__/components/table.spec.ts +54 -0
- package/components/button/group.d.ts +1 -0
- package/components/button/group.js +4 -0
- package/components/button/group.vdt.js +3 -2
- package/components/button/index.vdt.js +1 -1
- package/components/button/styles.js +6 -6
- package/components/diagram/shapes/callout.d.ts +1 -1
- package/components/diagram/shapes/circle.d.ts +1 -1
- package/components/diagram/shapes/document.d.ts +1 -1
- package/components/diagram/shapes/ellipse.d.ts +1 -1
- package/components/diagram/shapes/hexagon.d.ts +1 -1
- package/components/diagram/shapes/image.d.ts +1 -1
- package/components/diagram/shapes/parallelogram.d.ts +1 -1
- package/components/diagram/shapes/rectangle.d.ts +1 -1
- package/components/diagram/shapes/square.d.ts +1 -1
- package/components/diagram/shapes/text.d.ts +1 -1
- package/components/dialog/styles.js +3 -3
- package/components/dropdown/item.js +5 -2
- package/components/editable/index.d.ts +2 -0
- package/components/editable/index.js +4 -2
- package/components/editable/index.spec.js +39 -0
- package/components/editable/index.vdt.js +17 -6
- package/components/editable/styles.d.ts +1 -0
- package/components/editable/styles.js +3 -0
- package/components/ellipsis/index.d.ts +1 -0
- package/components/ellipsis/index.js +4 -2
- package/components/ellipsis/index.vdt.js +3 -1
- package/components/input/styles.js +11 -1
- package/components/menu/styles.js +1 -1
- package/components/select/index.spec.js +47 -0
- package/components/switch/styles.js +1 -1
- package/components/table/cell.d.ts +2 -0
- package/components/table/cell.vdt.js +18 -5
- package/components/table/column.d.ts +1 -0
- package/components/table/column.js +1 -0
- package/components/table/column.vdt.js +16 -12
- package/components/table/row.d.ts +3 -1
- package/components/table/row.js +24 -15
- package/components/table/row.vdt.js +6 -2
- package/components/table/styles.d.ts +49 -0
- package/components/table/styles.js +3 -2
- package/components/table/table.d.ts +4 -0
- package/components/table/table.js +4 -1
- package/components/table/table.vdt.js +29 -4
- package/components/table/useColumns.d.ts +9 -0
- package/components/table/useColumns.js +29 -1
- package/components/table/useTree.d.ts +1 -1
- package/components/table/useTree.js +30 -2
- package/components/tip/index.d.ts +6 -1
- package/components/tip/index.js +12 -1
- package/components/tip/index.vdt.js +25 -5
- package/components/tip/styles.js +44 -2
- package/components/tooltip/index.spec.js +99 -67
- package/components/tooltip/tooltip.d.ts +1 -0
- package/components/tooltip/tooltip.js +14 -2
- package/components/transfer/index.vdt.js +2 -4
- package/components/treeSelect/index.vdt.js +1 -0
- package/components/upload/index.vdt.js +4 -1
- package/components/upload/styles.js +1 -1
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/install.js +6 -1
- package/package.json +2 -2
|
@@ -78,5 +78,5 @@ export var makeStyles = cache(function makeStyles(k) {
|
|
|
78
78
|
padding = _kswitch$size.padding,
|
|
79
79
|
iconSize = _kswitch$size.iconSize;
|
|
80
80
|
return /*#__PURE__*/css("&.", k, "-", size, ",&.", k, "-", size, " .", k, "-switch-on,&.", k, "-", size, " .", k, "-switch-off{width:", width, ";height:", height, ";}&.", k, "-", size, "{border-radius:", height, ";.", k, "-switch-bar{width:", height, ";border-radius:", height, ";}.", k, "-switch-wrapper{padding:", padding, ";}.", k, "-switch-on,.", k, "-switch-off{line-height:", height, ";left:0;}.", k, "-switch-on{padding:0 ", height, " 0 calc(", height, " / 3);}.", k, "-switch-off{padding:0 calc(", height, " / 3) 0 ", height, ";}.", k, "-switch-icon{font-size:", iconSize, ";}}");
|
|
81
|
-
}), "&.", k, "-checked{.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.checked.bgColor, ";}.", k, "-switch-bar{width:100%;}&:hover{.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.checked.hoverBgColor, ";}}}&.", k, "-disabled{&,.", k, "-switch-handle{cursor:not-allowed;}&,.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.disabledBgColor, ";}&.", k, "-checked{&,.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.checked.disabledBgColor, ";}}}");
|
|
81
|
+
}), " &.", k, "-small .", k, "-switch-on,&.", k, "-small .", k, "-switch-off{font-size:10px;}&.", k, "-checked{.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.checked.bgColor, ";}.", k, "-switch-bar{width:100%;}&:hover{.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.checked.hoverBgColor, ";}}}&.", k, "-disabled{&,.", k, "-switch-handle{cursor:not-allowed;}&,.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.disabledBgColor, ";}&.", k, "-checked{&,.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.checked.disabledBgColor, ";}}}");
|
|
82
82
|
});
|
|
@@ -15,6 +15,8 @@ export interface TableCellProps {
|
|
|
15
15
|
rowspan: number;
|
|
16
16
|
onClickArrow: (e: MouseEvent) => void;
|
|
17
17
|
hasChildren: boolean;
|
|
18
|
+
loaded: boolean;
|
|
19
|
+
spreadArrowIndex: number;
|
|
18
20
|
}
|
|
19
21
|
export declare class TableCell extends Component<TableCellProps> {
|
|
20
22
|
static template: string | import('intact-vue-next').Template<any>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createUnknownComponentVNode as _$cc, createElementVNode as _$ce, className as _$cn } from 'intact-vue-next';
|
|
2
2
|
import { getClassAndStyleForFixed } from './useFixedColumns';
|
|
3
3
|
import { get, noop } from 'intact-shared';
|
|
4
4
|
import { Button } from '../button';
|
|
5
5
|
import { Icon } from '../icon';
|
|
6
6
|
import { getTextByChildren } from '../utils';
|
|
7
|
+
import { Ellipsis } from '../ellipsis';
|
|
7
8
|
export default function ($props, $blocks, $__proto__) {
|
|
8
9
|
var _classNameObj;
|
|
9
10
|
$blocks || ($blocks = {});
|
|
@@ -21,34 +22,46 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
21
22
|
colspan = _this$get.colspan,
|
|
22
23
|
rowspan = _this$get.rowspan,
|
|
23
24
|
onClickArrow = _this$get.onClickArrow,
|
|
24
|
-
hasChildren = _this$get.hasChildren
|
|
25
|
+
hasChildren = _this$get.hasChildren,
|
|
26
|
+
loaded = _this$get.loaded,
|
|
27
|
+
spreadArrowIndex = _this$get.spreadArrowIndex;
|
|
25
28
|
var k = this.config.k;
|
|
26
29
|
var blocks = props.$blocks;
|
|
27
30
|
var children = get(data, props.key);
|
|
31
|
+
var isTree = !spreadArrowIndex ? columnIndex === 0 : columnIndex === spreadArrowIndex;
|
|
28
32
|
if (blocks) {
|
|
29
33
|
var template = blocks.template || blocks.default;
|
|
30
34
|
if (template) {
|
|
31
35
|
children = template(noop, [data, rowIndex]);
|
|
32
36
|
}
|
|
33
37
|
}
|
|
38
|
+
if (props.ellipsis) {
|
|
39
|
+
children = _$cc(Ellipsis, {
|
|
40
|
+
'children': children
|
|
41
|
+
});
|
|
42
|
+
}
|
|
34
43
|
var _getClassAndStyleForF = getClassAndStyleForFixed(props, offset, k, checkType),
|
|
35
44
|
className = _getClassAndStyleForF.className,
|
|
36
45
|
style = _getClassAndStyleForF.style;
|
|
37
|
-
if (
|
|
46
|
+
if (isTree && indent) {
|
|
38
47
|
style || (style = {});
|
|
39
48
|
style.paddingLeft = indent + "px";
|
|
40
49
|
}
|
|
41
50
|
var classNameObj = (_classNameObj = {}, _classNameObj[k + "-hidden"] = props.hidden, _classNameObj[className] = className, _classNameObj);
|
|
42
|
-
return _$ce(2, 'td', [
|
|
51
|
+
return _$ce(2, 'td', [hasChildren && isTree ? _$cc(Button, {
|
|
43
52
|
'type': 'none',
|
|
44
53
|
'icon': true,
|
|
45
54
|
'circle': true,
|
|
46
55
|
'size': 'mini',
|
|
47
56
|
'className': _$cn(k + "-table-arrow"),
|
|
48
57
|
'ev-click': onClickArrow,
|
|
49
|
-
'
|
|
58
|
+
'disabled': loaded === false,
|
|
59
|
+
'children': loaded !== false ? _$cc(Icon, {
|
|
50
60
|
'className': _$cn(k + "-icon-right"),
|
|
51
61
|
'size': 'small'
|
|
62
|
+
}) : _$cc(Icon, {
|
|
63
|
+
'className': _$cn(k + "-tree-icon ion-load-c"),
|
|
64
|
+
'rotate': true
|
|
52
65
|
})
|
|
53
66
|
}) : undefined, children], 0, _$cn(classNameObj), {
|
|
54
67
|
'style': style,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _sortInstanceProperty from "@babel/runtime-corejs3/core-js/instance/sort";
|
|
2
2
|
import { createUnknownComponentVNode as _$cc, createElementVNode as _$ce, className as _$cn, noop as _$no, extend as _$ex, EMPTY_OBJ as _$em, map as _$ma } from 'intact-vue-next';
|
|
3
3
|
import { getClassAndStyleForFixed } from './useFixedColumns';
|
|
4
|
+
import { getStyleForLastColumn } from './useColumns';
|
|
4
5
|
import { Dropdown, DropdownMenu, DropdownItem } from '../dropdown';
|
|
5
6
|
import { Button } from '../button';
|
|
6
7
|
import { Icon } from '../icon';
|
|
@@ -13,7 +14,7 @@ import { linkEvent } from 'intact-vue-next';
|
|
|
13
14
|
import { context as TableContext } from './useColumns';
|
|
14
15
|
import { context as ResizableContext } from './useResizable';
|
|
15
16
|
import { context as FixedColumnsContext } from './useFixedColumns';
|
|
16
|
-
import { stopPropagation } from '../utils';
|
|
17
|
+
import { stopPropagation, addStyle } from '../utils';
|
|
17
18
|
import { Input } from '../input';
|
|
18
19
|
import { _$ } from '../../i18n';
|
|
19
20
|
import { ignoreSortable } from './useSortable';
|
|
@@ -49,19 +50,22 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
49
50
|
checkAll = _this$group.checkAll;
|
|
50
51
|
var k = this.config.k;
|
|
51
52
|
return _$cc(TableContext.Consumer, {
|
|
52
|
-
'children': function children(
|
|
53
|
+
'children': function children(_ref) {
|
|
54
|
+
var checkType = _ref.checkType,
|
|
55
|
+
lastCellKey = _ref.lastCellKey,
|
|
56
|
+
lastCellStyle = _ref.lastCellStyle;
|
|
53
57
|
return _$cc(GroupContext.Consumer, {
|
|
54
|
-
'children': function children(
|
|
55
|
-
var currentGroup =
|
|
56
|
-
onChange =
|
|
58
|
+
'children': function children(_ref2) {
|
|
59
|
+
var currentGroup = _ref2.group,
|
|
60
|
+
onChange = _ref2.onChange;
|
|
57
61
|
return _$cc(SortableContext.Consumer, {
|
|
58
|
-
'children': function children(
|
|
59
|
-
var sort = _sortInstanceProperty(
|
|
60
|
-
onChangeSort =
|
|
62
|
+
'children': function children(_ref3) {
|
|
63
|
+
var sort = _sortInstanceProperty(_ref3),
|
|
64
|
+
onChangeSort = _ref3.onChange;
|
|
61
65
|
return _$cc(ResizableContext.Consumer, {
|
|
62
|
-
'children': function children(
|
|
63
|
-
var resizable =
|
|
64
|
-
onStart =
|
|
66
|
+
'children': function children(_ref4) {
|
|
67
|
+
var resizable = _ref4.resizable,
|
|
68
|
+
onStart = _ref4.onStart;
|
|
65
69
|
return _$cc(FixedColumnsContext.Consumer, {
|
|
66
70
|
'children': function children(offsetMap) {
|
|
67
71
|
var _classNameObj, _$cn2, _$cn4;
|
|
@@ -168,7 +172,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
168
172
|
'className': _$cn(k + "-icon-down-bold " + k + "-desc"),
|
|
169
173
|
'size': 'mini'
|
|
170
174
|
})], 4, _$cn((_$cn4 = {}, _$cn4[k + "-column-sort"] = true, _$cn4[k + "-" + type] = type, _$cn4))) : undefined], 0, _$cn(k + "-table-title"))], 0, _$cn(classNameObj), {
|
|
171
|
-
'style': style,
|
|
175
|
+
'style': key === lastCellKey ? addStyle(style, lastCellStyle) : style,
|
|
172
176
|
'title': isStringOrNumber(title) ? title : null,
|
|
173
177
|
'ev-click': sortable ? linkEvent(key, onChangeSort) : null,
|
|
174
178
|
'colspan': cols,
|
|
@@ -20,10 +20,12 @@ export interface TableRowProps {
|
|
|
20
20
|
spreaded: boolean;
|
|
21
21
|
hasChildren: boolean;
|
|
22
22
|
indent: number;
|
|
23
|
-
onToggleSpreadRow: (key: TableRowKey) => void;
|
|
23
|
+
onToggleSpreadRow: (key: TableRowKey, rowData?: any) => void;
|
|
24
24
|
onBeforeUnmount: (key: TableRowKey) => void;
|
|
25
25
|
offsetMap: Record<Key, number>;
|
|
26
26
|
animation: boolean;
|
|
27
|
+
spreadArrowIndex: number;
|
|
28
|
+
loaded: boolean;
|
|
27
29
|
draggable: boolean;
|
|
28
30
|
draggingKey: TableRowKey | null;
|
|
29
31
|
onRowDragStart: DragCallback;
|
package/components/table/row.js
CHANGED
|
@@ -6,6 +6,7 @@ import template from './row.vdt';
|
|
|
6
6
|
import { bind } from '../utils';
|
|
7
7
|
import { isEqualObject } from '../utils';
|
|
8
8
|
import { useConfigContext } from '../config';
|
|
9
|
+
import { hasOwn } from 'intact-shared';
|
|
9
10
|
export var TableRow = /*#__PURE__*/function (_Component) {
|
|
10
11
|
_inheritsLoose(TableRow, _Component);
|
|
11
12
|
function TableRow() {
|
|
@@ -23,19 +24,26 @@ export var TableRow = /*#__PURE__*/function (_Component) {
|
|
|
23
24
|
var lastProps = lastVNode.props;
|
|
24
25
|
var nextProps = nextVNode.props;
|
|
25
26
|
var isSame = true;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
27
|
+
if (hasOwn.call(this, 'vueInstance')) {
|
|
28
|
+
// In Vue, we may change value by modifing the same reference,
|
|
29
|
+
// and the new row may be expanded by click tree arrow
|
|
30
|
+
// so we can not compare in this case, #1030
|
|
31
|
+
isSame = false;
|
|
32
|
+
} else {
|
|
33
|
+
var key;
|
|
34
|
+
for (key in lastProps) {
|
|
35
|
+
// ignore index
|
|
36
|
+
if (key === 'index') continue;
|
|
37
|
+
var lastValue = lastProps[key];
|
|
38
|
+
var nextValue = nextProps[key];
|
|
39
|
+
// deeply compare for offsetMap
|
|
40
|
+
if (key === 'offsetMap' && isEqualObject(lastValue, nextValue)) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (lastValue !== nextValue) {
|
|
44
|
+
isSame = false;
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
39
47
|
}
|
|
40
48
|
}
|
|
41
49
|
if (!isSame) {
|
|
@@ -70,8 +78,9 @@ export var TableRow = /*#__PURE__*/function (_Component) {
|
|
|
70
78
|
e.stopPropagation();
|
|
71
79
|
var _this$get3 = this.get(),
|
|
72
80
|
onToggleSpreadRow = _this$get3.onToggleSpreadRow,
|
|
73
|
-
key = _this$get3.key
|
|
74
|
-
|
|
81
|
+
key = _this$get3.key,
|
|
82
|
+
data = _this$get3.data;
|
|
83
|
+
onToggleSpreadRow(key, data);
|
|
75
84
|
};
|
|
76
85
|
_proto.onMouseEnter = function onMouseEnter(e) {
|
|
77
86
|
// for tooltip
|
|
@@ -33,7 +33,9 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
33
33
|
offsetMap = _this$get.offsetMap,
|
|
34
34
|
draggable = _this$get.draggable,
|
|
35
35
|
draggingKey = _this$get.draggingKey,
|
|
36
|
-
animation = _this$get.animation
|
|
36
|
+
animation = _this$get.animation,
|
|
37
|
+
loaded = _this$get.loaded,
|
|
38
|
+
spreadArrowIndex = _this$get.spreadArrowIndex;
|
|
37
39
|
var k = this.config.k;
|
|
38
40
|
var classNameObj = (_classNameObj = {}, _classNameObj[k + "-disabled"] = disabled, _classNameObj[k + "-checked"] = checked, _classNameObj[k + "-selected"] = selected, _classNameObj[k + "-spreaded"] = spreaded, _classNameObj[k + "-dragging"] = draggingKey === key, _classNameObj[className] = className, _classNameObj);
|
|
39
41
|
var getGridItem = function getGridItem(columnIndex) {
|
|
@@ -82,6 +84,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
82
84
|
'columnIndex': columnIndex,
|
|
83
85
|
'rowIndex': rowIndex,
|
|
84
86
|
'data': data,
|
|
87
|
+
'loaded': loaded,
|
|
85
88
|
'offset': offsetMap[columnKey],
|
|
86
89
|
'checkType': checkType,
|
|
87
90
|
'indent': indent,
|
|
@@ -90,7 +93,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
90
93
|
'rowspan': spans ? spans.rowspan : undefined,
|
|
91
94
|
'onClickArrow': _this.onClickArrow,
|
|
92
95
|
'hasChildren': hasChildren,
|
|
93
|
-
'key': columnKey
|
|
96
|
+
'key': columnKey,
|
|
97
|
+
'spreadArrowIndex': spreadArrowIndex
|
|
94
98
|
}, columnKey));
|
|
95
99
|
});
|
|
96
100
|
var rows = animation ? _$cc(TransitionGroup, {
|
|
@@ -1,4 +1,53 @@
|
|
|
1
1
|
import '../../styles/global';
|
|
2
|
+
declare const defaults: {
|
|
3
|
+
readonly transition: string;
|
|
4
|
+
border: string;
|
|
5
|
+
readonly borderRadius: string;
|
|
6
|
+
fontSize: string;
|
|
7
|
+
bgColor: string;
|
|
8
|
+
readonly color: string;
|
|
9
|
+
fixLeftShadow: string;
|
|
10
|
+
fixRightShadow: string;
|
|
11
|
+
thead: {
|
|
12
|
+
readonly bgColor: string;
|
|
13
|
+
readonly color: string;
|
|
14
|
+
padding: string;
|
|
15
|
+
fontSize: string;
|
|
16
|
+
fontWeight: string;
|
|
17
|
+
textAlign: string;
|
|
18
|
+
height: string;
|
|
19
|
+
delimiterHeight: string;
|
|
20
|
+
delimiterColor: string;
|
|
21
|
+
};
|
|
22
|
+
tbody: {
|
|
23
|
+
readonly hoverBgcolor: string;
|
|
24
|
+
padding: string;
|
|
25
|
+
};
|
|
26
|
+
stripeBgColor: string;
|
|
27
|
+
group: {
|
|
28
|
+
gap: string;
|
|
29
|
+
menuMaxHeight: string;
|
|
30
|
+
menuMinWidth: string;
|
|
31
|
+
readonly activeColor: string;
|
|
32
|
+
headerPadding: string;
|
|
33
|
+
readonly headerBorder: string;
|
|
34
|
+
};
|
|
35
|
+
sort: {
|
|
36
|
+
iconHeight: string;
|
|
37
|
+
gap: string;
|
|
38
|
+
readonly enabledColor: string;
|
|
39
|
+
};
|
|
40
|
+
expandBgColor: string;
|
|
41
|
+
readonly selectedBgColor: string;
|
|
42
|
+
arrow: {
|
|
43
|
+
gap: string;
|
|
44
|
+
width: string;
|
|
45
|
+
};
|
|
46
|
+
resizeWidth: string;
|
|
47
|
+
draggingOpacity: string;
|
|
48
|
+
};
|
|
49
|
+
declare let table: typeof defaults;
|
|
50
|
+
export { table };
|
|
2
51
|
export declare const makeStyles: {
|
|
3
52
|
(k: string): string;
|
|
4
53
|
clearCache(): {};
|
|
@@ -89,10 +89,11 @@ setDefault(function () {
|
|
|
89
89
|
makeStyles == null || makeStyles.clearCache();
|
|
90
90
|
makeGroupMenuStyles == null || makeGroupMenuStyles.clearCache();
|
|
91
91
|
});
|
|
92
|
+
export { table };
|
|
92
93
|
export var makeStyles = cache(function makeStyles(k) {
|
|
93
|
-
return /*#__PURE__*/css("font-size:", table.fontSize, ";color:", table.color, ";position:relative;z-index:0;.", k, "-table-wrapper{border-bottom:", table.border, ";overflow:auto;border-radius:", table.borderRadius, ";}table{width:100%;border-spacing:0;table-layout:fixed;}thead{text-align:", table.thead.textAlign, ";font-size:", table.thead.fontSize, ";font-weight:", table.thead.fontWeight, ";
|
|
94
|
+
return /*#__PURE__*/css("font-size:", table.fontSize, ";color:", table.color, ";position:relative;z-index:0;.", k, "-table-wrapper{border-bottom:", table.border, ";overflow:auto;border-radius:", table.borderRadius, ";}table{width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed;}thead{text-align:", table.thead.textAlign, ";font-size:", table.thead.fontSize, ";font-weight:", table.thead.fontWeight, ";z-index:2;tr{height:", table.thead.height, ";&:not(:last-of-type) th{border-bottom:", table.border, ";}}}tfoot{z-index:2;tr{td{border-top:", table.border, ";border-bottom-color:transparent;}}}th{padding:", table.thead.padding, ";position:relative;background:", table.thead.bgColor, ";line-height:normal;&:before{content:'';height:", table.thead.delimiterHeight, ";position:absolute;background-color:", table.thead.delimiterColor, ";width:1px;left:1px;top:50%;transform:translateY(-50%);}&.", k, "-fixed-right:before{left:-2px;}&:first-of-type:before{display:none;}}.", k, "-table-title{display:inline-flex;align-items:center;max-width:100%;color:", table.thead.color, ";}.", k, "-table-title-text{flex:1;display:inline-flex;line-height:1.4;}tbody{tr{&:hover td{background:", table.tbody.hoverBgcolor, ";}&:last-of-type td{border-bottom-color:transparent;}}}td{padding:", table.tbody.padding, ";border-bottom:", table.border, ";background:", table.bgColor, ";word-wrap:break-word;}.", k, "-fixed-left,.", k, "-fixed-right{position:sticky;z-index:1;&:after{content:'';display:block;transition:box-shadow ", table.transition, ";position:absolute;top:0;bottom:0px;width:10px;pointer-events:none;}}.", k, "-fixed-left:after{right:-11px;}.", k, "-fixed-right:after{left:-11px;}&.", k, "-scroll-left .", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}&.", k, "-scroll-right .", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}&.", k, "-scroll-middle{.", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}.", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}}.", k, "-fixed-right+.", k, "-fixed-right:after{display:none;}.", k, "-table-affix-header{position:sticky;top:0;left:0;.", k, "-affix-wrapper{overflow:hidden;}&.", k, "-fixed{position:relative;}}&.", k, "-border,&.", k, "-grid{.", k, "-table-wrapper{border-top:", table.border, ";border-left:", table.border, ";border-right:", table.border, ";}}&.", k, "-grid{td:not(:last-of-type),th:not(:last-of-type){border-right:", table.border, ";}th:before{display:none;}}&.", k, "-stripe{tr:nth-child(even):not(:hover) td{background:", table.stripeBgColor, ";}}.", k, "-table-group{margin-left:", table.group.gap, ";}.", k, "-table-check{.", k, "-checkbox,.", k, "-radio{position:relative;top:-1px;}}.", k, "-column-sortable{cursor:pointer;}.", k, "-column-sort{.", k, "-icon{display:block;height:", _sortInstanceProperty(table).iconHeight, ";line-height:", _sortInstanceProperty(table).iconHeight, ";margin:0 0 1px ", _sortInstanceProperty(table).gap, ";}&.", k, "-desc .", k, "-icon.", k, "-desc,&.", k, "-asc .", k, "-icon.", k, "-asc{color:", _sortInstanceProperty(table).enabledColor, ";}}.", k, "-table-spin.", k, "-overlay{z-index:2;}.", k, "-table-empty{text-align:center;}tr.", k, "-expand{td{padding:0;background:#fdfcff;}}&.", k, "-with-expand{tr:not(.", k, "-expand){td{border-bottom:none;}}}.", k, "-table-expand{border-top:", table.border, ";box-sizing:content-box;}tbody tr.", k, "-selected td{background:", table.selectedBgColor, ";}.", k, "-hidden{display:none;}.", k, "-table-arrow{width:", table.arrow.width, "!important;margin-right:", table.arrow.gap, ";transition:transform ", table.transition, ";position:relative;top:-1px;}tr.", k, "-spreaded{.", k, "-table-arrow{transform:rotate(90deg);}}.", k, "-table-resize{height:100%;width:", table.resizeWidth, ";position:absolute;top:0;left:-1px;cursor:ew-resize;}tr.", k, "-dragging{opacity:", table.draggingOpacity, ";}.", k, "-table-scrollbar{overflow-x:auto;overflow-y:hidden;}.", k, "-table-scrollbar-inner{height:1px;}", _mapInstanceProperty(aligns).call(aligns, function (type) {
|
|
94
95
|
return /*#__PURE__*/css(".", k, "-align-", type, "{text-align:", type, ";}");
|
|
95
|
-
}), ">.", k, "-pagination{margin:16px 0;}&.", k, "-fix-header{min-height:0;.", k, "-table-wrapper{height:100%;}}");
|
|
96
|
+
}), ">.", k, "-pagination{margin:16px 0;}&.", k, "-fix-header{min-height:0;.", k, "-table-wrapper{height:100%;}thead{position:sticky;top:0;}}&.", k, "-fix-footer{min-height:0;.", k, "-table-wrapper{height:100%;}tfoot{position:sticky;bottom:0;}}");
|
|
96
97
|
});
|
|
97
98
|
export var makeGroupMenuStyles = cache(function makeGroupMenuStyles(k) {
|
|
98
99
|
return /*#__PURE__*/css("min-width:", table.group.menuMinWidth, "!important;.", k, "-dropdown-item.", k, "-active{color:", table.group.activeColor, ";}.", k, "-table-group-header{padding:", table.group.headerPadding, ";border-bottom:", table.group.headerBorder, ";}.", k, "-table-group-body{max-height:", table.group.menuMaxHeight, ";overflow:auto;}.", k, "-table-group-footer{text-align:right;border-top:", table.group.headerBorder, ";padding:8px;.", k, "-btn{margin-left:8px;}}");
|
|
@@ -38,6 +38,9 @@ export interface TableProps<T = any, K extends TableRowKey = TableRowKey, C exte
|
|
|
38
38
|
animation?: boolean | [boolean, boolean];
|
|
39
39
|
hideHeader?: boolean;
|
|
40
40
|
pagination?: boolean | PaginationProps;
|
|
41
|
+
fixFooter?: boolean;
|
|
42
|
+
spreadArrowIndex?: number;
|
|
43
|
+
load?: (value: T) => Promise<void> | void;
|
|
41
44
|
}
|
|
42
45
|
export interface TableEvents<T = any, K extends TableRowKey = number> {
|
|
43
46
|
clickRow: [T, number, K];
|
|
@@ -60,6 +63,7 @@ export interface TableBlocks<T = unknown> {
|
|
|
60
63
|
empty: null;
|
|
61
64
|
tooltip: [T, number];
|
|
62
65
|
expand: [T, number];
|
|
66
|
+
footer: null;
|
|
63
67
|
}
|
|
64
68
|
type CheckType = 'checkbox' | 'radio' | 'none';
|
|
65
69
|
export type TableCheckType = CheckType;
|
|
@@ -61,7 +61,10 @@ var typeDefs = {
|
|
|
61
61
|
draggable: Boolean,
|
|
62
62
|
animation: [Boolean, Array],
|
|
63
63
|
hideHeader: Boolean,
|
|
64
|
-
pagination: [Boolean, Object]
|
|
64
|
+
pagination: [Boolean, Object],
|
|
65
|
+
fixFooter: Boolean,
|
|
66
|
+
spreadArrowIndex: Number,
|
|
67
|
+
load: Function
|
|
65
68
|
};
|
|
66
69
|
var defaults = function defaults() {
|
|
67
70
|
return {
|
|
@@ -54,13 +54,18 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
54
54
|
draggable = _this$get.draggable,
|
|
55
55
|
_animation = _this$get.animation,
|
|
56
56
|
hideHeader = _this$get.hideHeader,
|
|
57
|
-
pagination = _this$get.pagination
|
|
57
|
+
pagination = _this$get.pagination,
|
|
58
|
+
fixFooter = _this$get.fixFooter,
|
|
59
|
+
spreadArrowIndex = _this$get.spreadArrowIndex;
|
|
58
60
|
var animation = !Array.isArray(_animation) ? [_animation, _animation] : _animation;
|
|
59
61
|
var _this$columns$getData = this.columns.getData(),
|
|
60
62
|
columns = _this$columns$getData.columns,
|
|
61
63
|
cols = _this$columns$getData.cols,
|
|
62
64
|
maxRows = _this$columns$getData.maxRows,
|
|
63
65
|
maxCols = _this$columns$getData.maxCols;
|
|
66
|
+
var _this$columns$getStyl = this.columns.getStyleForLastColumn(),
|
|
67
|
+
lastCellKey = _this$columns$getStyl.lastCellKey,
|
|
68
|
+
lastCellStyle = _this$columns$getStyl.lastCellStyle;
|
|
64
69
|
var _this$fixedColumns = this.fixedColumns,
|
|
65
70
|
scrollPosition = _this$fixedColumns.scrollPosition,
|
|
66
71
|
hasFixed = _this$fixedColumns.hasFixed,
|
|
@@ -73,7 +78,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
73
78
|
elementRef = _this$stickyHeader.elementRef,
|
|
74
79
|
headRef = _this$stickyHeader.headRef;
|
|
75
80
|
var k = this.config.k;
|
|
76
|
-
var classNameObj = (_classNameObj = {}, _classNameObj[k + "-table"] = true, _classNameObj[k + "-fix-header"] = fixHeader, _classNameObj[k + "-scroll-" + scrollPosition.value] = scrollPosition.value, _classNameObj[k + "-fix-columns"] = hasFixed.value, _classNameObj[k + "-" + type] = type && type !== 'default', _classNameObj[k + "-stripe"] = stripe, _classNameObj[k + "-with-expand"] = $blocks.expand, _classNameObj[className] = className, _classNameObj[makeStyles(k)] = true, _classNameObj);
|
|
81
|
+
var classNameObj = (_classNameObj = {}, _classNameObj[k + "-table"] = true, _classNameObj[k + "-fix-header"] = fixHeader, _classNameObj[k + "-fix-footer"] = fixFooter, _classNameObj[k + "-scroll-" + scrollPosition.value] = scrollPosition.value, _classNameObj[k + "-fix-columns"] = hasFixed.value, _classNameObj[k + "-" + type] = type && type !== 'default', _classNameObj[k + "-stripe"] = stripe, _classNameObj[k + "-with-expand"] = $blocks.expand, _classNameObj[className] = className, _classNameObj[makeStyles(k)] = true, _classNameObj);
|
|
77
82
|
var style = isStringOrNumber(fixHeader) ? {
|
|
78
83
|
maxHeight: fixHeader + "px"
|
|
79
84
|
} : null;
|
|
@@ -100,7 +105,11 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
100
105
|
onChangeChecked = _this$checked.onChangeChecked;
|
|
101
106
|
var allCheckedStatus = getAllCheckedStatus();
|
|
102
107
|
var thead = hideHeader ? null : _$cc(TableContext.Provider, {
|
|
103
|
-
'value':
|
|
108
|
+
'value': {
|
|
109
|
+
checkType: checkType,
|
|
110
|
+
lastCellKey: lastCellKey,
|
|
111
|
+
lastCellStyle: lastCellStyle
|
|
112
|
+
},
|
|
104
113
|
'children': _$cc(GroupContext.Provider, {
|
|
105
114
|
'value': {
|
|
106
115
|
group: group,
|
|
@@ -183,6 +192,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
183
192
|
'key': key,
|
|
184
193
|
'cols': cols,
|
|
185
194
|
'data': value,
|
|
195
|
+
'loaded': value.loaded,
|
|
186
196
|
'checkType': checkType,
|
|
187
197
|
'hasFixedLeft': hasFixedLeft,
|
|
188
198
|
'onClick': _this.clickRow,
|
|
@@ -203,6 +213,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
203
213
|
'onBeforeUnmount': _this.resetRowStatus.onRowBeforeUnmount,
|
|
204
214
|
'offsetMap': offsetMap.value,
|
|
205
215
|
'animation': animation[1],
|
|
216
|
+
'spreadArrowIndex': spreadArrowIndex,
|
|
206
217
|
'draggable': draggable,
|
|
207
218
|
'draggingKey': draggingKey.value,
|
|
208
219
|
'onRowDragStart': onRowDragStart,
|
|
@@ -265,6 +276,20 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
265
276
|
'children': rows
|
|
266
277
|
}) : rows;
|
|
267
278
|
}(), 0);
|
|
279
|
+
var tfooter = null;
|
|
280
|
+
if ($blocks.footer) {
|
|
281
|
+
tfooter = _$ce(2, 'tfoot', _$ce(2, 'tr', _$ce(2, 'td', (_$blocks['footer'] = function ($super) {
|
|
282
|
+
return null;
|
|
283
|
+
}, __$blocks['footer'] = function ($super, data) {
|
|
284
|
+
var block = $blocks['footer'];
|
|
285
|
+
var callBlock = function callBlock() {
|
|
286
|
+
return _$blocks['footer'].call($this, $super, data);
|
|
287
|
+
};
|
|
288
|
+
return block ? block.call($this, callBlock, data) : callBlock();
|
|
289
|
+
}, __$blocks['footer'](_$no)), 0, _$cn(k + "-table-footer"), {
|
|
290
|
+
'colspan': colCount
|
|
291
|
+
}), 2, null, null, 'table-footer'), 2);
|
|
292
|
+
}
|
|
268
293
|
var tableWidthPx = tableWidth.value ? tableWidth.value + "px" : null;
|
|
269
294
|
var _this$stickyScrollbar = this.stickyScrollbar,
|
|
270
295
|
shouldStickScrollbar = _this$stickyScrollbar.shouldStickScrollbar,
|
|
@@ -287,7 +312,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
287
312
|
width: tableWidthPx
|
|
288
313
|
}
|
|
289
314
|
}, null, headRef)
|
|
290
|
-
}) : undefined, _$ce(2, 'table', [colgroup, isNull(stickHeader.value) ? thead : undefined, tbody], 0, null, {
|
|
315
|
+
}) : undefined, _$ce(2, 'table', [colgroup, isNull(stickHeader.value) ? thead : undefined, tbody, $blocks.footer ? tfooter : undefined], 0, null, {
|
|
291
316
|
'style': {
|
|
292
317
|
width: tableWidthPx
|
|
293
318
|
}
|
|
@@ -14,4 +14,13 @@ export declare function useColumns(): {
|
|
|
14
14
|
maxRows: number;
|
|
15
15
|
maxCols: number;
|
|
16
16
|
};
|
|
17
|
+
getStyleForLastColumn: () => {
|
|
18
|
+
lastCellKey: null;
|
|
19
|
+
lastCellStyle: null;
|
|
20
|
+
} | {
|
|
21
|
+
lastCellKey: import('intact-vue-next').Key | null;
|
|
22
|
+
lastCellStyle: {
|
|
23
|
+
'border-right': string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
17
26
|
};
|
|
@@ -3,6 +3,7 @@ import { useInstance, directClone } from 'intact-vue-next';
|
|
|
3
3
|
import { eachChildren, isComponentVNode } from '../utils';
|
|
4
4
|
import { TableColumn } from './column';
|
|
5
5
|
import { createContext } from '../context';
|
|
6
|
+
import { table as theme } from './styles';
|
|
6
7
|
export var context = createContext();
|
|
7
8
|
export function useColumns() {
|
|
8
9
|
var instance = useInstance();
|
|
@@ -89,9 +90,36 @@ export function useColumns() {
|
|
|
89
90
|
maxCols: maxCols
|
|
90
91
|
};
|
|
91
92
|
}
|
|
93
|
+
function getStyleForLastColumn() {
|
|
94
|
+
if (instance.get('type') !== 'grid' || !columns.length || !cols.length) {
|
|
95
|
+
return {
|
|
96
|
+
lastCellKey: null,
|
|
97
|
+
lastCellStyle: null
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
var lastRow = columns[columns.length - 1];
|
|
101
|
+
var lastTrItem = lastRow[lastRow.length - 1];
|
|
102
|
+
var lastCol = cols[cols.length - 1];
|
|
103
|
+
if (!lastTrItem || !lastCol) {
|
|
104
|
+
return {
|
|
105
|
+
lastCellKey: null,
|
|
106
|
+
lastCellStyle: null
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
return lastCol.key === lastTrItem.key ? {
|
|
110
|
+
lastCellKey: null,
|
|
111
|
+
lastCellStyle: null
|
|
112
|
+
} : {
|
|
113
|
+
lastCellKey: lastTrItem.key,
|
|
114
|
+
lastCellStyle: {
|
|
115
|
+
'border-right': "" + theme.border
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
92
119
|
return {
|
|
93
120
|
getColumns: getColumns,
|
|
94
121
|
getCols: getCols,
|
|
95
|
-
getData: getData
|
|
122
|
+
getData: getData,
|
|
123
|
+
getStyleForLastColumn: getStyleForLastColumn
|
|
96
124
|
};
|
|
97
125
|
}
|
|
@@ -2,7 +2,7 @@ import type { TableRowKey } from './table';
|
|
|
2
2
|
import { State } from '../../hooks/useState';
|
|
3
3
|
export declare function useTree(data: State<any[] | undefined>): {
|
|
4
4
|
isSpreaded: (key: TableRowKey) => boolean;
|
|
5
|
-
toggleSpreadRow: (key: TableRowKey) => void
|
|
5
|
+
toggleSpreadRow: (key: TableRowKey, rowData?: any) => Promise<void>;
|
|
6
6
|
loopData: <T>(cb: (value: any, index: number, level: number, meta: T | null) => T, shouldBreak?: boolean) => void;
|
|
7
7
|
};
|
|
8
8
|
export declare function loopDataWithChildrenKey<T>(data: any[] | undefined, childrenKey: string | undefined, cb: (value: any, index: number, level: number, meta: T | null) => T, shouldBreak: boolean): void;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
1
3
|
import { useInstance } from 'intact-vue-next';
|
|
2
4
|
import { inArray } from './useChecked';
|
|
3
5
|
import { toggleArray } from '../utils';
|
|
@@ -6,8 +8,34 @@ export function useTree(data) {
|
|
|
6
8
|
function isSpreaded(key) {
|
|
7
9
|
return inArray(instance.get('spreadKeys'), key);
|
|
8
10
|
}
|
|
9
|
-
function toggleSpreadRow(
|
|
10
|
-
|
|
11
|
+
function toggleSpreadRow(_x, _x2) {
|
|
12
|
+
return _toggleSpreadRow.apply(this, arguments);
|
|
13
|
+
}
|
|
14
|
+
function _toggleSpreadRow() {
|
|
15
|
+
_toggleSpreadRow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(key, rowData) {
|
|
16
|
+
var _instance$get2, spreadKeys, load;
|
|
17
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
18
|
+
while (1) switch (_context.prev = _context.next) {
|
|
19
|
+
case 0:
|
|
20
|
+
_instance$get2 = instance.get(), spreadKeys = _instance$get2.spreadKeys, load = _instance$get2.load;
|
|
21
|
+
instance.set('spreadKeys', toggleArray(spreadKeys, key));
|
|
22
|
+
if (!(load && data.value && !rowData.loaded)) {
|
|
23
|
+
_context.next = 8;
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
rowData.loaded = false;
|
|
27
|
+
_context.next = 6;
|
|
28
|
+
return load(rowData);
|
|
29
|
+
case 6:
|
|
30
|
+
rowData.loaded = true;
|
|
31
|
+
instance.forceUpdate();
|
|
32
|
+
case 8:
|
|
33
|
+
case "end":
|
|
34
|
+
return _context.stop();
|
|
35
|
+
}
|
|
36
|
+
}, _callee);
|
|
37
|
+
}));
|
|
38
|
+
return _toggleSpreadRow.apply(this, arguments);
|
|
11
39
|
}
|
|
12
40
|
function loopData(cb, shouldBreak) {
|
|
13
41
|
if (shouldBreak === void 0) {
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
import { TypeDefs } from 'intact-vue-next';
|
|
1
2
|
import { Tag, TagProps, TagEvents, TagBlocks } from '../tag/base';
|
|
2
3
|
export interface TipProps extends TagProps {
|
|
4
|
+
showIcon?: boolean;
|
|
3
5
|
}
|
|
4
6
|
export interface TipEvents extends TagEvents {
|
|
5
7
|
}
|
|
6
8
|
export interface TipBlocks extends TagBlocks {
|
|
7
9
|
title: null;
|
|
8
10
|
close: null;
|
|
11
|
+
icon: null;
|
|
9
12
|
}
|
|
10
13
|
export declare class Tip extends Tag<TipProps, TipEvents, TipBlocks> {
|
|
11
|
-
static template: string | import(
|
|
14
|
+
static template: string | import('intact-vue-next').Template<any>;
|
|
15
|
+
static typeDefs: Required<TypeDefs<TipProps>>;
|
|
16
|
+
static defaults: () => Partial<TipProps>;
|
|
12
17
|
}
|
package/components/tip/index.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
3
|
import template from './index.vdt';
|
|
3
4
|
import { Tag } from '../tag/base';
|
|
5
|
+
var typeDefs = _extends({}, Tag.typeDefs, {
|
|
6
|
+
showIcon: Boolean
|
|
7
|
+
});
|
|
8
|
+
var defaults = function defaults() {
|
|
9
|
+
return _extends({}, Tag.defaults(), {
|
|
10
|
+
showIcon: false
|
|
11
|
+
});
|
|
12
|
+
};
|
|
4
13
|
export var Tip = /*#__PURE__*/function (_Tag) {
|
|
5
14
|
_inheritsLoose(Tip, _Tag);
|
|
6
15
|
function Tip() {
|
|
@@ -8,4 +17,6 @@ export var Tip = /*#__PURE__*/function (_Tag) {
|
|
|
8
17
|
}
|
|
9
18
|
return Tip;
|
|
10
19
|
}(Tag);
|
|
11
|
-
Tip.template = template;
|
|
20
|
+
Tip.template = template;
|
|
21
|
+
Tip.typeDefs = typeDefs;
|
|
22
|
+
Tip.defaults = defaults;
|