@king-design/intact 3.4.3 → 3.4.5
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/components/button/demos/group.md +3 -3
- package/components/button/group.ts +5 -0
- package/components/button/group.vdt +2 -2
- package/components/button/index.md +2 -1
- package/components/button/styles.ts +4 -4
- package/components/table/cell.ts +2 -2
- package/components/table/cell.vdt +5 -3
- package/components/table/column.vdt +3 -3
- package/components/table/demos/asyncTree.md +3 -0
- package/components/table/demos/fixFooter.md +1 -1
- package/components/table/demos/tree.md +22 -10
- package/components/table/index.md +1 -0
- package/components/table/row.ts +1 -0
- package/components/table/row.vdt +2 -0
- package/components/table/styles.ts +3 -0
- package/components/table/table.ts +4 -3
- package/components/table/table.vdt +4 -2
- package/components/table/useColumns.ts +24 -1
- package/components/tip/demos/icon.md +53 -0
- package/components/tip/demos/size.md +39 -0
- package/components/tip/index.md +2 -0
- package/components/tip/index.ts +17 -1
- package/components/tip/index.vdt +38 -5
- package/components/tip/styles.ts +84 -3
- package/components/tooltip/demos/always.md +6 -0
- package/components/tooltip/tooltip.ts +2 -1
- package/components/transfer/index.vdt +2 -4
- package/components/tree/demos/loading.md +3 -0
- package/components/upload/demos/files.md +1 -0
- package/components/upload/index.vdt +4 -1
- package/components/upload/styles.ts +1 -0
- package/es/components/button/group.d.ts +1 -0
- package/es/components/button/group.js +4 -0
- package/es/components/button/group.vdt.js +3 -2
- package/es/components/button/styles.js +3 -3
- package/es/components/table/cell.d.ts +1 -0
- package/es/components/table/cell.vdt.js +5 -3
- package/es/components/table/column.vdt.js +15 -12
- package/es/components/table/row.d.ts +1 -0
- package/es/components/table/row.vdt.js +4 -2
- package/es/components/table/styles.d.ts +49 -0
- package/es/components/table/styles.js +2 -1
- package/es/components/table/table.d.ts +1 -0
- package/es/components/table/table.js +1 -0
- package/es/components/table/table.vdt.js +11 -2
- package/es/components/table/useColumns.d.ts +9 -0
- package/es/components/table/useColumns.js +29 -1
- package/es/components/tip/index.d.ts +6 -1
- package/es/components/tip/index.js +12 -1
- package/es/components/tip/index.vdt.js +25 -5
- package/es/components/tip/styles.js +44 -2
- package/es/components/tooltip/tooltip.js +5 -1
- package/es/components/transfer/index.vdt.js +2 -4
- package/es/components/upload/index.vdt.js +4 -1
- package/es/components/upload/styles.js +1 -1
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/site/data/components/button/demos/group/react.js +2 -2
- package/es/site/data/components/table/demos/tree/react.js +18 -2
- package/es/site/data/components/tip/demos/icon/index.d.ts +9 -0
- package/es/site/data/components/tip/demos/icon/index.js +19 -0
- package/es/site/data/components/tip/demos/icon/react.d.ts +8 -0
- package/es/site/data/components/tip/demos/icon/react.js +54 -0
- package/es/site/data/components/tip/demos/size/index.d.ts +9 -0
- package/es/site/data/components/tip/demos/size/index.js +19 -0
- package/es/site/data/components/tip/demos/size/react.d.ts +8 -0
- package/es/site/data/components/tip/demos/size/react.js +39 -0
- package/es/site/data/components/tooltip/demos/always/react.js +5 -0
- package/es/site/data/components/upload/demos/files/index.js +3 -0
- package/es/site/data/components/upload/demos/files/react.js +3 -0
- package/es/site/src/pages/font/index.js +1 -1
- package/es/site/src/pages/font/styles.js +1 -1
- package/index.ts +2 -2
- package/package.json +2 -2
package/components/tip/styles.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {theme, setDefault} from '../../styles/theme';
|
|
2
2
|
import {css} from '@emotion/css';
|
|
3
3
|
import '../../styles/global';
|
|
4
|
-
import {deepDefaults} from '../../styles/utils';
|
|
4
|
+
import {deepDefaults, sizes} from '../../styles/utils';
|
|
5
5
|
import { cache } from '../utils';
|
|
6
6
|
|
|
7
7
|
const defaults = {
|
|
@@ -12,6 +12,35 @@ const defaults = {
|
|
|
12
12
|
},
|
|
13
13
|
get color() { return theme.color.text },
|
|
14
14
|
get padding() { return `6px ${theme.default.padding}` },
|
|
15
|
+
content: {
|
|
16
|
+
padding: '7px 33px 8px 8px',
|
|
17
|
+
},
|
|
18
|
+
icon: {
|
|
19
|
+
fontSize: `18px`,
|
|
20
|
+
left: `16px`,
|
|
21
|
+
top: `6px`,
|
|
22
|
+
},
|
|
23
|
+
large: {
|
|
24
|
+
padding: `12px`,
|
|
25
|
+
get fontSize() { return theme.default.fontSize },
|
|
26
|
+
close: {
|
|
27
|
+
height: '42px',
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
small: {
|
|
31
|
+
padding: `4px 12px`,
|
|
32
|
+
get fontSize() { return theme.small.fontSize },
|
|
33
|
+
close: {
|
|
34
|
+
height: '26px',
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
mini: {
|
|
38
|
+
padding: `2px 12px`,
|
|
39
|
+
fontSize: '11px',
|
|
40
|
+
close: {
|
|
41
|
+
height: '20px',
|
|
42
|
+
}
|
|
43
|
+
},
|
|
15
44
|
};
|
|
16
45
|
|
|
17
46
|
let tip: typeof defaults;
|
|
@@ -29,6 +58,23 @@ export const makeStyles = cache(function makeStyles(k: string) {
|
|
|
29
58
|
padding: 0;
|
|
30
59
|
color: ${tip.color} !important;
|
|
31
60
|
align-items: flex-start;
|
|
61
|
+
${sizes.map(s => {
|
|
62
|
+
if (s === 'default') return;
|
|
63
|
+
const styles = tip[s];
|
|
64
|
+
return css `
|
|
65
|
+
&.${k}-${s} {
|
|
66
|
+
padding: 0;
|
|
67
|
+
height: auto;
|
|
68
|
+
font-size: ${styles.fontSize};
|
|
69
|
+
.${k}-tip-wrapper {
|
|
70
|
+
padding: ${styles.padding};
|
|
71
|
+
}
|
|
72
|
+
.${k}-tip-close {
|
|
73
|
+
height: ${styles.close.height};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
`;
|
|
77
|
+
})}
|
|
32
78
|
}
|
|
33
79
|
.${k}-tip-wrapper {
|
|
34
80
|
flex: 1;
|
|
@@ -39,14 +85,49 @@ export const makeStyles = cache(function makeStyles(k: string) {
|
|
|
39
85
|
font-size: ${tip.title.fontSize};
|
|
40
86
|
margin-bottom: ${tip.title.gap};
|
|
41
87
|
font-weight: ${tip.title.fontWeight}
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
42
90
|
}
|
|
43
91
|
|
|
44
92
|
&.${k}-fade-leave-active {
|
|
45
93
|
position: relative;
|
|
46
94
|
}
|
|
47
95
|
|
|
48
|
-
.${k}-tip-close
|
|
49
|
-
|
|
96
|
+
.${k}-tip-close {
|
|
97
|
+
height: 30px;
|
|
98
|
+
&:hover {
|
|
99
|
+
background: none;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.${k}-with-icon {
|
|
104
|
+
display: flex;
|
|
105
|
+
.${k}-tip-icon {
|
|
106
|
+
font-size: 18px;
|
|
107
|
+
vertical-align: middle;
|
|
108
|
+
}
|
|
109
|
+
.${k}-title-content {
|
|
110
|
+
display: inline-block;
|
|
111
|
+
padding-left: 8px;
|
|
112
|
+
}
|
|
113
|
+
.${k}-tip-content {
|
|
114
|
+
display: inline-block;
|
|
115
|
+
padding-left: 8px;
|
|
116
|
+
vertical-align: middle;
|
|
117
|
+
word-break: break-word;
|
|
118
|
+
overflow-wrap: break-word;
|
|
119
|
+
}
|
|
50
120
|
}
|
|
121
|
+
|
|
122
|
+
${(['primary', 'danger', 'success', 'warning'] as const).map(type => {
|
|
123
|
+
const color = theme.color[type];
|
|
124
|
+
return css`
|
|
125
|
+
&.${k}-${type} {
|
|
126
|
+
.${k}-tip-icon {
|
|
127
|
+
color: ${color};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
`
|
|
131
|
+
})}
|
|
51
132
|
`;
|
|
52
133
|
});
|
|
@@ -18,6 +18,12 @@ import {Tooltip} from 'kpc';
|
|
|
18
18
|
always show this tootip
|
|
19
19
|
</Tooltip>
|
|
20
20
|
<br /><br />
|
|
21
|
+
<Tooltip content="hide" always value={false}
|
|
22
|
+
container={this.container}
|
|
23
|
+
>
|
|
24
|
+
always hide this tootip
|
|
25
|
+
</Tooltip>
|
|
26
|
+
<br /><br />
|
|
21
27
|
<Tooltip content="" always value={true}>
|
|
22
28
|
don't show if content is empty
|
|
23
29
|
</Tooltip>
|
|
@@ -76,7 +76,8 @@ export class Tooltip<
|
|
|
76
76
|
public $isTooltip = true;
|
|
77
77
|
|
|
78
78
|
show(shouldFocus: boolean = false) {
|
|
79
|
-
|
|
79
|
+
const {disabled, always, value} = this.get();
|
|
80
|
+
if (disabled || (always && !value)) return;
|
|
80
81
|
|
|
81
82
|
clearTimeout(this.timer);
|
|
82
83
|
this.set('value', true);
|
|
@@ -82,16 +82,14 @@ const Panel = (model) => {
|
|
|
82
82
|
<Button circle icon
|
|
83
83
|
disabled={!enableRemove()}
|
|
84
84
|
ev-click={remove}
|
|
85
|
-
type="
|
|
86
|
-
size="large"
|
|
85
|
+
type="secondary"
|
|
87
86
|
>
|
|
88
87
|
<Icon class={`${k}-transfer-icon ${k}-icon-left`} />
|
|
89
88
|
</Button>
|
|
90
89
|
<Button circle icon
|
|
91
90
|
disabled={!enableAdd()}
|
|
92
91
|
ev-click={add}
|
|
93
|
-
type="
|
|
94
|
-
size="large"
|
|
92
|
+
type="secondary"
|
|
95
93
|
>
|
|
96
94
|
<Icon class={`${k}-transfer-icon ${k}-icon-right`} />
|
|
97
95
|
</Button>
|
|
@@ -10,6 +10,9 @@ order: 1.2
|
|
|
10
10
|
组件默认遇到`children`为`[]`空数组的情况就会去进行异步加载,你可以通过`loaded`属性设为`true`来
|
|
11
11
|
标识该子节点已经加载完成,无需再次加载
|
|
12
12
|
|
|
13
|
+
> 组件在该节点数据异步加载完成后,会往原始数据上自动添加`loaded=true`。你也可以手动指定该节点数据
|
|
14
|
+
> `loaded=true`,这样即使组件发现该节点数据`children`为空`[]`,也不会去加载了
|
|
15
|
+
|
|
13
16
|
```vdt
|
|
14
17
|
import {Tree} from 'kpc';
|
|
15
18
|
|
|
@@ -40,6 +40,7 @@ export default class extends Component<Props> {
|
|
|
40
40
|
{name: 'test1.jpg', url: 'http://www.example.com/test1.jpg'},
|
|
41
41
|
{name: 'test2.png', url: 'http://www.example.com/test2.png'},
|
|
42
42
|
{name: 'test3.png', status: UploadFileStatus.Error},
|
|
43
|
+
{name: 'test4-测试超长测试超长测试超长测试超长测试超长测试超长测试超长测试超长测试超长测试超长测试超长测试超长测试超长测试超长测试超长测试超长测试超长测试超长.png', url: 'http://www.example.com/test4.png'},
|
|
43
44
|
]
|
|
44
45
|
} as Props;
|
|
45
46
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {Button} from '../button';
|
|
2
2
|
import {Progress} from '../progress';
|
|
3
3
|
import {Dialog} from '../dialog';
|
|
4
|
+
import {Ellipsis} from '../ellipsis';
|
|
4
5
|
import {expandAnimationCallbacks, getRestProps} from '../utils';
|
|
5
6
|
import {makeStyles, makeUploadDialogStyles} from './styles';
|
|
6
7
|
import {TransitionGroup, Transition, linkEvent} from 'intact';
|
|
@@ -131,7 +132,9 @@ const {show, close, image, isShow} = this.showImage;
|
|
|
131
132
|
<div class={`${k}-upload-file-main`}>
|
|
132
133
|
<div class={`${k}-upload-name c-ellipsis`}>
|
|
133
134
|
<Icon class={`${k}-upload-file-icon ion-document`} />
|
|
134
|
-
<span class={`${k}-upload-file-name`}>
|
|
135
|
+
<span class={`${k}-upload-file-name`}>
|
|
136
|
+
<Ellipsis>{$value.name}</Ellipsis>
|
|
137
|
+
</span>
|
|
135
138
|
<Icon class={`${k}-upload-status-icon ${k}-icon-success-fill`}
|
|
136
139
|
v-if={$value.status === UploadFileStatus.Done}
|
|
137
140
|
/>
|
|
@@ -11,6 +11,7 @@ var typeDefs = {
|
|
|
11
11
|
fluid: Boolean,
|
|
12
12
|
checkType: ['none', 'radio', 'checkbox'],
|
|
13
13
|
seperate: Boolean,
|
|
14
|
+
separate: Boolean,
|
|
14
15
|
btnWidth: [Number, String]
|
|
15
16
|
};
|
|
16
17
|
var defaults = function defaults() {
|
|
@@ -33,6 +34,9 @@ export var ButtonGroup = /*#__PURE__*/function (_Component) {
|
|
|
33
34
|
var _proto = ButtonGroup.prototype;
|
|
34
35
|
_proto.init = function init() {
|
|
35
36
|
provide(BUTTON_GROUP, this);
|
|
37
|
+
if (typeof this.get().seperate === 'boolean') {
|
|
38
|
+
console.warn("`seperate` is a typo which will be removed in next version, please using `separate` instead");
|
|
39
|
+
}
|
|
36
40
|
};
|
|
37
41
|
_proto.setValue = function setValue(v) {
|
|
38
42
|
var _this$get = this.get(),
|
|
@@ -12,9 +12,10 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
12
12
|
vertical = _this$get.vertical,
|
|
13
13
|
children = _this$get.children,
|
|
14
14
|
fluid = _this$get.fluid,
|
|
15
|
-
seperate = _this$get.seperate
|
|
15
|
+
seperate = _this$get.seperate,
|
|
16
|
+
separate = _this$get.separate;
|
|
16
17
|
var k = this.config.k;
|
|
17
|
-
var classNameObj = (_classNameObj = {}, _classNameObj[k + "-btns"] = true, _classNameObj[k + "-vertical"] = vertical, _classNameObj[k + "-fluid"] = fluid, _classNameObj[k + "-
|
|
18
|
+
var classNameObj = (_classNameObj = {}, _classNameObj[k + "-btns"] = true, _classNameObj[k + "-vertical"] = vertical, _classNameObj[k + "-fluid"] = fluid, _classNameObj[k + "-separate"] = typeof separate === 'boolean' ? separate : separate, _classNameObj[className] = className, _classNameObj[makeButtonGroupStyles(k)] = true, _classNameObj);
|
|
18
19
|
return _$cv('div', _extends({
|
|
19
20
|
'className': _$cn(classNameObj)
|
|
20
21
|
}, getRestProps(this)), children);
|
|
@@ -219,13 +219,13 @@ export var makeButtonStyles = cache(function makeButtonStyles(k, iconSide, color
|
|
|
219
219
|
}), ";.", k, "-icon-loading{margin-left:-1em;}}}"), ";"));
|
|
220
220
|
});
|
|
221
221
|
export var makeButtonGroupStyles = cache(function makeButtonGroupStyles(k) {
|
|
222
|
-
return /*#__PURE__*/css("display:inline-flex;align-items:center;flex-wrap:wrap;vertical-align:middle;.", k, "-btn{margin:0;vertical-align:middle;&:hover,&:focus,&.", k, "-active{z-index:1;position:relative;}}&.", k, "-fluid{width:100%;}&:not(.", k, "-vertical):not(.", k, "-
|
|
222
|
+
return /*#__PURE__*/css("display:inline-flex;align-items:center;flex-wrap:wrap;vertical-align:middle;.", k, "-btn{margin:0;vertical-align:middle;&:hover,&:focus,&.", k, "-active{z-index:1;position:relative;}}&.", k, "-fluid{width:100%;}&:not(.", k, "-vertical):not(.", k, "-separate){>.", k, "-btn{", _mapInstanceProperty(types).call(types, function (type) {
|
|
223
223
|
if (type === 'active') return;
|
|
224
224
|
var borderColor = button.group[type].borderColor;
|
|
225
225
|
return /*#__PURE__*/css("&.", k, "-", type, ":not(:first-child){border-left-color:", borderColor, ";}&.", k, "-", type, ":not(:last-child){border-right-color:", borderColor, ";}");
|
|
226
|
-
}), ";&:not(:first-child){margin-left:-1px;&:not(:last-child){border-radius:0;}}&:not(:only-child):first-child{border-top-right-radius:0;border-bottom-right-radius:0;}&:not(:only-child):last-child{border-top-left-radius:0;border-bottom-left-radius:0;}}&.", k, "-fluid{display:flex;>.", k, "-btn{flex:1;}}}&.", k, "-vertical:not(.", k, "-
|
|
226
|
+
}), ";&:not(:first-child){margin-left:-1px;&:not(:last-child){border-radius:0;}}&:not(:only-child):first-child{border-top-right-radius:0;border-bottom-right-radius:0;}&:not(:only-child):last-child{border-top-left-radius:0;border-bottom-left-radius:0;}}&.", k, "-fluid{display:flex;>.", k, "-btn{flex:1;}}}&.", k, "-vertical:not(.", k, "-separate){flex-direction:column;>.", k, "-btn{", _mapInstanceProperty(types).call(types, function (type) {
|
|
227
227
|
if (type === 'active') return;
|
|
228
228
|
var borderColor = button.group[type].borderColor;
|
|
229
229
|
return /*#__PURE__*/css("&.", k, "-", type, ":not(:first-child){border-top-color:", borderColor, ";}&.", k, "-", type, ":not(:last-child){border-bottom-color:", borderColor, ";}");
|
|
230
|
-
}), ";&:not(.", k, "-btn-icon){width:100%;}&:not(:first-child){margin-top:-1px;&:not(:last-child){border-radius:0;}}&:not(:only-child):first-child{border-bottom-left-radius:0;border-bottom-right-radius:0;}&:not(:only-child):last-child{border-top-left-radius:0;border-top-right-radius:0;}}}&.", k, "-
|
|
230
|
+
}), ";&:not(.", k, "-btn-icon){width:100%;}&:not(:first-child){margin-top:-1px;&:not(:last-child){border-radius:0;}}&:not(:only-child):first-child{border-bottom-left-radius:0;border-bottom-right-radius:0;}&:not(:only-child):last-child{border-top-left-radius:0;border-top-right-radius:0;}}}&.", k, "-separate{gap:8px;}");
|
|
231
231
|
});
|
|
@@ -16,6 +16,7 @@ export interface TableCellProps {
|
|
|
16
16
|
onClickArrow: (e: MouseEvent) => void;
|
|
17
17
|
hasChildren: boolean;
|
|
18
18
|
loaded: boolean;
|
|
19
|
+
spreadArrowIndex: number;
|
|
19
20
|
}
|
|
20
21
|
export declare class TableCell extends Component<TableCellProps> {
|
|
21
22
|
static template: string | import("intact").Template<any>;
|
|
@@ -23,10 +23,12 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
23
23
|
rowspan = _this$get.rowspan,
|
|
24
24
|
onClickArrow = _this$get.onClickArrow,
|
|
25
25
|
hasChildren = _this$get.hasChildren,
|
|
26
|
-
loaded = _this$get.loaded
|
|
26
|
+
loaded = _this$get.loaded,
|
|
27
|
+
spreadArrowIndex = _this$get.spreadArrowIndex;
|
|
27
28
|
var k = this.config.k;
|
|
28
29
|
var blocks = props.$blocks;
|
|
29
30
|
var children = get(data, props.key);
|
|
31
|
+
var isTree = !spreadArrowIndex ? columnIndex === 0 : columnIndex === spreadArrowIndex;
|
|
30
32
|
if (blocks) {
|
|
31
33
|
var template = blocks.template || blocks.default;
|
|
32
34
|
if (template) {
|
|
@@ -41,12 +43,12 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
41
43
|
var _getClassAndStyleForF = getClassAndStyleForFixed(props, offset, k, checkType),
|
|
42
44
|
className = _getClassAndStyleForF.className,
|
|
43
45
|
style = _getClassAndStyleForF.style;
|
|
44
|
-
if (
|
|
46
|
+
if (isTree && indent) {
|
|
45
47
|
style || (style = {});
|
|
46
48
|
style.paddingLeft = indent + "px";
|
|
47
49
|
}
|
|
48
50
|
var classNameObj = (_classNameObj = {}, _classNameObj[k + "-hidden"] = props.hidden, _classNameObj[className] = className, _classNameObj);
|
|
49
|
-
return _$ce(2, 'td', [
|
|
51
|
+
return _$ce(2, 'td', [hasChildren && isTree ? _$cc(Button, {
|
|
50
52
|
'type': 'none',
|
|
51
53
|
'icon': true,
|
|
52
54
|
'circle': true,
|
|
@@ -13,7 +13,7 @@ import { linkEvent } from 'intact';
|
|
|
13
13
|
import { context as TableContext } from './useColumns';
|
|
14
14
|
import { context as ResizableContext } from './useResizable';
|
|
15
15
|
import { context as FixedColumnsContext } from './useFixedColumns';
|
|
16
|
-
import { stopPropagation } from '../utils';
|
|
16
|
+
import { stopPropagation, addStyle } from '../utils';
|
|
17
17
|
import { Input } from '../input';
|
|
18
18
|
import { _$ } from '../../i18n';
|
|
19
19
|
import { ignoreSortable } from './useSortable';
|
|
@@ -49,19 +49,22 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
49
49
|
checkAll = _this$group.checkAll;
|
|
50
50
|
var k = this.config.k;
|
|
51
51
|
return _$cc(TableContext.Consumer, {
|
|
52
|
-
'children': function children(
|
|
52
|
+
'children': function children(_ref) {
|
|
53
|
+
var checkType = _ref.checkType,
|
|
54
|
+
lastCellKey = _ref.lastCellKey,
|
|
55
|
+
lastCellStyle = _ref.lastCellStyle;
|
|
53
56
|
return _$cc(GroupContext.Consumer, {
|
|
54
|
-
'children': function children(
|
|
55
|
-
var currentGroup =
|
|
56
|
-
onChange =
|
|
57
|
+
'children': function children(_ref2) {
|
|
58
|
+
var currentGroup = _ref2.group,
|
|
59
|
+
onChange = _ref2.onChange;
|
|
57
60
|
return _$cc(SortableContext.Consumer, {
|
|
58
|
-
'children': function children(
|
|
59
|
-
var sort = _sortInstanceProperty(
|
|
60
|
-
onChangeSort =
|
|
61
|
+
'children': function children(_ref3) {
|
|
62
|
+
var sort = _sortInstanceProperty(_ref3),
|
|
63
|
+
onChangeSort = _ref3.onChange;
|
|
61
64
|
return _$cc(ResizableContext.Consumer, {
|
|
62
|
-
'children': function children(
|
|
63
|
-
var resizable =
|
|
64
|
-
onStart =
|
|
65
|
+
'children': function children(_ref4) {
|
|
66
|
+
var resizable = _ref4.resizable,
|
|
67
|
+
onStart = _ref4.onStart;
|
|
65
68
|
return _$cc(FixedColumnsContext.Consumer, {
|
|
66
69
|
'children': function children(offsetMap) {
|
|
67
70
|
var _classNameObj, _$cn2, _$cn4;
|
|
@@ -168,7 +171,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
168
171
|
'className': _$cn(k + "-icon-down-bold " + k + "-desc"),
|
|
169
172
|
'size': 'mini'
|
|
170
173
|
})], 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,
|
|
174
|
+
'style': key === lastCellKey ? addStyle(style, lastCellStyle) : style,
|
|
172
175
|
'title': isStringOrNumber(title) ? title : null,
|
|
173
176
|
'ev-click': sortable ? linkEvent(key, onChangeSort) : null,
|
|
174
177
|
'colspan': cols,
|
|
@@ -34,7 +34,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
34
34
|
draggable = _this$get.draggable,
|
|
35
35
|
draggingKey = _this$get.draggingKey,
|
|
36
36
|
animation = _this$get.animation,
|
|
37
|
-
loaded = _this$get.loaded
|
|
37
|
+
loaded = _this$get.loaded,
|
|
38
|
+
spreadArrowIndex = _this$get.spreadArrowIndex;
|
|
38
39
|
var k = this.config.k;
|
|
39
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);
|
|
40
41
|
var getGridItem = function getGridItem(columnIndex) {
|
|
@@ -92,7 +93,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
92
93
|
'rowspan': spans ? spans.rowspan : undefined,
|
|
93
94
|
'onClickArrow': _this.onClickArrow,
|
|
94
95
|
'hasChildren': hasChildren,
|
|
95
|
-
'key': columnKey
|
|
96
|
+
'key': columnKey,
|
|
97
|
+
'spreadArrowIndex': spreadArrowIndex
|
|
96
98
|
}, columnKey));
|
|
97
99
|
});
|
|
98
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,8 +89,9 @@ 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-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, ";}}}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
|
+
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
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
|
});
|
|
@@ -39,6 +39,7 @@ export interface TableProps<T = any, K extends TableRowKey = TableRowKey, C exte
|
|
|
39
39
|
hideHeader?: boolean;
|
|
40
40
|
pagination?: boolean | PaginationProps;
|
|
41
41
|
fixFooter?: boolean;
|
|
42
|
+
spreadArrowIndex?: number;
|
|
42
43
|
load?: (value: T) => Promise<void> | void;
|
|
43
44
|
}
|
|
44
45
|
export interface TableEvents<T = any, K extends TableRowKey = number> {
|
|
@@ -55,13 +55,17 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
55
55
|
_animation = _this$get.animation,
|
|
56
56
|
hideHeader = _this$get.hideHeader,
|
|
57
57
|
pagination = _this$get.pagination,
|
|
58
|
-
fixFooter = _this$get.fixFooter
|
|
58
|
+
fixFooter = _this$get.fixFooter,
|
|
59
|
+
spreadArrowIndex = _this$get.spreadArrowIndex;
|
|
59
60
|
var animation = !Array.isArray(_animation) ? [_animation, _animation] : _animation;
|
|
60
61
|
var _this$columns$getData = this.columns.getData(),
|
|
61
62
|
columns = _this$columns$getData.columns,
|
|
62
63
|
cols = _this$columns$getData.cols,
|
|
63
64
|
maxRows = _this$columns$getData.maxRows,
|
|
64
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;
|
|
65
69
|
var _this$fixedColumns = this.fixedColumns,
|
|
66
70
|
scrollPosition = _this$fixedColumns.scrollPosition,
|
|
67
71
|
hasFixed = _this$fixedColumns.hasFixed,
|
|
@@ -101,7 +105,11 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
101
105
|
onChangeChecked = _this$checked.onChangeChecked;
|
|
102
106
|
var allCheckedStatus = getAllCheckedStatus();
|
|
103
107
|
var thead = hideHeader ? null : _$cc(TableContext.Provider, {
|
|
104
|
-
'value':
|
|
108
|
+
'value': {
|
|
109
|
+
checkType: checkType,
|
|
110
|
+
lastCellKey: lastCellKey,
|
|
111
|
+
lastCellStyle: lastCellStyle
|
|
112
|
+
},
|
|
105
113
|
'children': _$cc(GroupContext.Provider, {
|
|
106
114
|
'value': {
|
|
107
115
|
group: group,
|
|
@@ -205,6 +213,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
205
213
|
'onBeforeUnmount': _this.resetRowStatus.onRowBeforeUnmount,
|
|
206
214
|
'offsetMap': offsetMap.value,
|
|
207
215
|
'animation': animation[1],
|
|
216
|
+
'spreadArrowIndex': spreadArrowIndex,
|
|
208
217
|
'draggable': draggable,
|
|
209
218
|
'draggingKey': draggingKey.value,
|
|
210
219
|
'onRowDragStart': onRowDragStart,
|
|
@@ -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").Key | null;
|
|
22
|
+
lastCellStyle: {
|
|
23
|
+
'border-right': string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
17
26
|
};
|
|
@@ -3,6 +3,7 @@ import { useInstance, directClone } from 'intact';
|
|
|
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
|
}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
import { TypeDefs } from 'intact';
|
|
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").Template<any>;
|
|
15
|
+
static typeDefs: Required<TypeDefs<TipProps>>;
|
|
16
|
+
static defaults: () => Partial<TipProps>;
|
|
12
17
|
}
|
|
@@ -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;
|