@king-design/react 3.0.0-beta.1 → 3.0.0-beta.2
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__/Dialog.md +1 -1
- package/__tests__/__snapshots__/React Demos.md +278 -271
- package/components/button/styles.d.ts +1 -1
- package/components/button/styles.js +3 -5
- package/components/carousel/index.vdt.js +2 -2
- package/components/cascader/index.vdt.js +1 -1
- package/components/collapse/item.vdt.js +1 -1
- package/components/copy/index.vdt.js +1 -1
- package/components/datepicker/calendar.vdt.js +6 -6
- package/components/datepicker/index.spec.js +170 -152
- package/components/datepicker/styles.js +1 -1
- package/components/datepicker/useValue.d.ts +3 -3
- package/components/datepicker/useValue.js +38 -9
- package/components/dialog/styles.js +1 -1
- package/components/form/styles.js +1 -1
- package/components/icon/styles.js +1 -1
- package/components/input/index.d.ts +3 -1
- package/components/input/index.js +4 -1
- package/components/input/index.vdt.js +21 -10
- package/components/input/search.vdt.js +2 -4
- package/components/input/styles.js +13 -6
- package/components/input/useFocus.d.ts +4 -0
- package/components/input/useFocus.js +21 -0
- package/components/menu/item.vdt.js +4 -1
- package/components/pagination/index.vdt.js +2 -2
- package/components/progress/index.vdt.js +1 -1
- package/components/select/base.vdt.js +36 -19
- package/components/select/index.spec.js +23 -11
- package/components/select/menu.vdt.js +5 -5
- package/components/select/option.vdt.js +2 -1
- package/components/select/styles.js +1 -1
- package/components/spinner/index.vdt.js +4 -4
- package/components/spinner/styles.js +2 -2
- package/components/steps/step.vdt.js +2 -2
- package/components/steps/styles.js +6 -2
- package/components/table/cell.vdt.js +1 -1
- package/components/table/column.vdt.js +40 -24
- package/components/table/index.spec.js +37 -6
- package/components/table/styles.js +15 -8
- package/components/table/useGroup.d.ts +9 -3
- package/components/table/useGroup.js +45 -37
- package/components/tabs/index.vdt.js +7 -2
- package/components/tag/styles.js +1 -1
- package/components/tag/tags.vdt.js +14 -2
- package/components/tag/useNowrap.js +1 -1
- package/components/transfer/index.vdt.js +14 -3
- package/components/types.d.ts +1 -0
- package/components/upload/index.vdt.js +4 -4
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +1 -1
- package/styles/fonts/iconfont.eot +0 -0
- package/styles/fonts/iconfont.js +1 -1
- package/styles/fonts/iconfont.svg +35 -35
- package/styles/fonts/iconfont.ttf +0 -0
- package/styles/fonts/iconfont.woff +0 -0
- package/styles/global.js +1 -1
- package/components/select/useNowrap.d.ts +0 -3
- package/components/select/useNowrap.js +0 -19
|
@@ -11,7 +11,7 @@ import { Icon } from '../icon';
|
|
|
11
11
|
import { context } from './useSearchable';
|
|
12
12
|
import { Tabs, Tab } from '../tabs';
|
|
13
13
|
var _$tmp0 = {
|
|
14
|
-
'className': '
|
|
14
|
+
'className': 'k-icon-search'
|
|
15
15
|
};
|
|
16
16
|
export default function ($props, $blocks, $__proto__) {
|
|
17
17
|
var _classNameObj;
|
|
@@ -117,14 +117,14 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
117
117
|
'ev-click': unselectAll,
|
|
118
118
|
'children': _$('清空')
|
|
119
119
|
})], 4, 'k-select-op') : undefined], 0, 'k-select-header'), _$ce(2, 'div', children, 0, 'k-select-body'), multiple ? _$ce(2, 'div', [_$cc(Button, {
|
|
120
|
+
'size': 'small',
|
|
121
|
+
'ev-click': this.select.hide,
|
|
122
|
+
'children': _$('取消')
|
|
123
|
+
}), _$cc(Button, {
|
|
120
124
|
'type': 'primary',
|
|
121
125
|
'size': 'small',
|
|
122
126
|
'ev-click': confirm,
|
|
123
127
|
'children': _$('确定')
|
|
124
|
-
}), _$cc(Button, {
|
|
125
|
-
'size': 'small',
|
|
126
|
-
'ev-click': this.select.hide,
|
|
127
|
-
'children': _$('取消')
|
|
128
128
|
})], 4, 'k-select-footer') : undefined]
|
|
129
129
|
});
|
|
130
130
|
}
|
|
@@ -7,7 +7,8 @@ import { Icon } from '../icon';
|
|
|
7
7
|
import { Checkbox } from '../checkbox';
|
|
8
8
|
import { context } from './useSearchable';
|
|
9
9
|
var _$tmp0 = {
|
|
10
|
-
'className': 'k-select-checkmark ion-ios-checkmark-empty'
|
|
10
|
+
'className': 'k-select-checkmark ion-ios-checkmark-empty',
|
|
11
|
+
'color': 'primary'
|
|
11
12
|
};
|
|
12
13
|
export default function ($props, $blocks, $__proto__) {
|
|
13
14
|
var _classNameObj,
|
|
@@ -174,7 +174,7 @@ setDefault(function () {
|
|
|
174
174
|
}).select;
|
|
175
175
|
});
|
|
176
176
|
export default function makeStyles() {
|
|
177
|
-
return /*#__PURE__*/css("display:inline-flex;align-items:center;vertical-align:middle;position:relative;width:", select.width, ";cursor:pointer;outline:none;border:", select.border, ";background:", select.bgColor, ";transition:border ", select.transition, ",background ", select.transition, ",box-shadow ", select.transition, ";border-radius:", select.borderRadius, ";.k-select-main{flex:1;min-width:0;}.k-select-prefix,.k-select-suffix{position:relative;}.k-select-suffix{margin-left:", select.suffixGap, ";}.k-select-placeholder{color:", select.placeholderColor, ";user-select:none;}.k-input .k-input-inner{background:transparent;}&.k-fluid{width:100%;}.k-select-clear{opacity:0;transition:opacity ", select.transition, ",color ", select.transition, "!important;pointer-events:none;position:absolute;z-index:1;top:50%;left:50%;transform:translate(-50%, -50%);}&:hover{border:", select.hoverBorder, ";.k-select-clear.k-show{opacity:1;pointer-events:all;+.k-select-suffix-icon{opacity:0;}}}.k-select-suffix-icon{display:inline-
|
|
177
|
+
return /*#__PURE__*/css("display:inline-flex;align-items:center;vertical-align:middle;position:relative;width:", select.width, ";cursor:pointer;outline:none;border:", select.border, ";background:", select.bgColor, ";transition:border ", select.transition, ",background ", select.transition, ",box-shadow ", select.transition, ";border-radius:", select.borderRadius, ";.k-select-main{flex:1;min-width:0;}.k-select-prefix,.k-select-suffix{display:flex;align-items:center;position:relative;}.k-select-suffix{margin-left:", select.suffixGap, ";}.k-select-placeholder{color:", select.placeholderColor, ";user-select:none;}.k-input .k-input-inner{background:transparent;}&.k-fluid{width:100%;}.k-select-clear{opacity:0;transition:opacity ", select.transition, ",color ", select.transition, "!important;pointer-events:none;position:absolute;z-index:1;top:50%;left:50%;transform:translate(-50%, -50%);}&:hover{border:", select.hoverBorder, ";.k-select-clear.k-show{opacity:1;pointer-events:all;+.k-select-suffix-icon{opacity:0;}}}.k-select-suffix-icon{display:inline-flex;align-items:center;transition:opacity ", select.transition, ";}.k-select-arrow{display:inline-block;transition:transform ", select.transition, ";}&.k-dropdown-open{border:", select.focusBorder, ";.k-select-arrow{transform:rotateX(180deg);}}&:focus{outline:none;border:", select.focusBorder, ";}.k-tags{padding:3px 0;}.k-tag{word-break:break-word;height:auto;max-width:calc(100% - ", getRight(select.tag.margin), " - 1px);}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
178
178
|
var styles = select[size];
|
|
179
179
|
var className = /*#__PURE__*/css("font-size:", styles.fontSize, ";min-height:", styles.height, ";padding:", styles.padding, ";");
|
|
180
180
|
if (size === 'default') return className;
|
|
@@ -6,16 +6,16 @@ import { Input } from '../input';
|
|
|
6
6
|
import { getRestProps } from '../utils';
|
|
7
7
|
import { makeStyles } from './styles';
|
|
8
8
|
var _$tmp0 = {
|
|
9
|
-
'className': 'k-spinner-icon k-icon-minus
|
|
9
|
+
'className': 'k-spinner-icon k-icon-minus'
|
|
10
10
|
};
|
|
11
11
|
var _$tmp1 = {
|
|
12
|
-
'className': 'k-spinner-icon k-icon-
|
|
12
|
+
'className': 'k-spinner-icon k-icon-down'
|
|
13
13
|
};
|
|
14
14
|
var _$tmp2 = {
|
|
15
|
-
'className': 'k-spinner-icon k-icon-add
|
|
15
|
+
'className': 'k-spinner-icon k-icon-add'
|
|
16
16
|
};
|
|
17
17
|
var _$tmp3 = {
|
|
18
|
-
'className': 'k-spinner-icon k-icon-
|
|
18
|
+
'className': 'k-spinner-icon k-icon-up'
|
|
19
19
|
};
|
|
20
20
|
export default function ($props, $blocks, $__proto__) {
|
|
21
21
|
var _classNameObj;
|
|
@@ -70,7 +70,7 @@ setDefault(function () {
|
|
|
70
70
|
}).spinner;
|
|
71
71
|
});
|
|
72
72
|
export function makeStyles() {
|
|
73
|
-
return /*#__PURE__*/css("display:inline-block;vertical-align:middle;border:", spinner.border, ";border-radius:", spinner.borderRadius, ";&:hover{border-color:", spinner.hoverBorderColor, ";.k-spinner-btn{background:", spinner.hoverBtnBg, ";}.k-left{border-radius:", spinner.borderRadius, " 0 0 ", spinner.borderRadius, ";}.k-right{border-radius:0 ", spinner.borderRadius, " ", spinner.borderRadius, " 0;}}.k-spinner-input{width:", spinner.default.inputWidth, ";.k-input-
|
|
73
|
+
return /*#__PURE__*/css("display:inline-block;vertical-align:middle;border:", spinner.border, ";border-radius:", spinner.borderRadius, ";&:hover{border-color:", spinner.hoverBorderColor, ";.k-spinner-btn{background:", spinner.hoverBtnBg, ";}.k-left{border-radius:", spinner.borderRadius, " 0 0 ", spinner.borderRadius, ";}.k-right{border-radius:0 ", spinner.borderRadius, " ", spinner.borderRadius, " 0;}}.k-spinner-input{width:", spinner.default.inputWidth, ";.k-input-wrapper{border:none;border-radius:0;&:hover{border:none;}}&.k-focus .k-input-wrapper{border:none;}.k-input-inner{text-align:center;}}.k-spinner-icon{font-size:", spinner.default.iconFontSize, ";}&.k-vertical{position:relative;font-size:0;", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
74
74
|
var generate = function generate() {
|
|
75
75
|
return "\n .k-spinner-input {\n padding-right: " + theme[size].height + ";\n width: " + spinner.vertical[size].width + ";\n }\n ";
|
|
76
76
|
};
|
|
@@ -80,7 +80,7 @@ export function makeStyles() {
|
|
|
80
80
|
} else {
|
|
81
81
|
return "\n &.k-" + size + " {\n " + generate() + "\n }\n ";
|
|
82
82
|
}
|
|
83
|
-
}), ";.k-spinner-btn{position:absolute;right:0;margin:0;height:calc(50% - 2px);line-height:50%;}.k-spinner-icon{font-size:inherit!important;}.k-spinner-btn.k-left{bottom:1px;border-radius:0 0 ", spinner.borderRadius, " 0;}.k-spinner-btn.k-right{top:1px;border-radius:0 ", spinner.borderRadius, " 0 0;}.k-spinner-input{
|
|
83
|
+
}), ";.k-spinner-btn{position:absolute;right:0;margin:0;height:calc(50% - 2px);line-height:50%;}.k-spinner-icon{font-size:inherit!important;}.k-spinner-btn.k-left{bottom:1px;border-radius:0 0 ", spinner.borderRadius, " 0;}.k-spinner-btn.k-right{top:1px;border-radius:0 ", spinner.borderRadius, " 0 0;}.k-spinner-input{.k-input-wrapper{border-radius:", spinner.borderRadius, " 0 0 ", spinner.borderRadius, ";}}}&.k-disabled{border-color:", spinner.disabledBorderColor, ";background:", spinner.disabledBg, ";}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
84
84
|
var styles = spinner[size];
|
|
85
85
|
|
|
86
86
|
var generate = function generate() {
|
|
@@ -5,11 +5,11 @@ import { getRestProps, addStyle } from '../utils';
|
|
|
5
5
|
import { context as StepsContext } from './context';
|
|
6
6
|
import { Icon } from '../icon';
|
|
7
7
|
var _$tmp0 = {
|
|
8
|
-
'className': 'k-icon-close-
|
|
8
|
+
'className': 'k-icon-close-bold',
|
|
9
9
|
'color': 'danger'
|
|
10
10
|
};
|
|
11
11
|
var _$tmp1 = {
|
|
12
|
-
'className': 'k-icon-check',
|
|
12
|
+
'className': 'k-icon-check-bold',
|
|
13
13
|
'color': 'primary'
|
|
14
14
|
};
|
|
15
15
|
export default function ($props, $blocks, $__proto__) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
2
2
|
import { css } from '@emotion/css';
|
|
3
3
|
import { theme, setDefault } from '../../styles/theme';
|
|
4
|
-
import { deepDefaults } from '../../styles/utils';
|
|
4
|
+
import { deepDefaults, palette } from '../../styles/utils';
|
|
5
5
|
import '../../styles/global';
|
|
6
6
|
var defaults = {
|
|
7
7
|
gap: '10px',
|
|
@@ -45,6 +45,10 @@ var defaults = {
|
|
|
45
45
|
return theme.color.primary;
|
|
46
46
|
},
|
|
47
47
|
|
|
48
|
+
get markHoverBgColor() {
|
|
49
|
+
return palette(theme.color.primary, -4);
|
|
50
|
+
},
|
|
51
|
+
|
|
48
52
|
markBgColor: '#fff',
|
|
49
53
|
|
|
50
54
|
get mainColor() {
|
|
@@ -140,7 +144,7 @@ setDefault(function () {
|
|
|
140
144
|
});
|
|
141
145
|
var stepStatus = ['done', 'active', 'error'];
|
|
142
146
|
export function makeStepsStyles() {
|
|
143
|
-
return /*#__PURE__*/css("display:flex;", makeCommonStyles(), ";&.k-default{", makeDefaultStyles(), ";}&.k-line,&.k-line-compact,&.k-simple{", makeLineStyles(), ";}&.k-line-compact{", makeLineCompactStyles(), ";}&.k-simple{", makeSimpleStyles(), ";}&.k-clickable{.k-done{cursor:pointer;}}", makeVerticalStyles(), ";");
|
|
147
|
+
return /*#__PURE__*/css("display:flex;", makeCommonStyles(), ";&.k-default{", makeDefaultStyles(), ";}&.k-line,&.k-line-compact,&.k-simple{", makeLineStyles(), ";}&.k-line-compact{", makeLineCompactStyles(), ";}&.k-simple{", makeSimpleStyles(), ";}&.k-clickable{.k-done{cursor:pointer;.k-step-wrapper:hover .k-step-mark{background:", steps.done.markHoverBgColor, ";}}}", makeVerticalStyles(), ";");
|
|
144
148
|
}
|
|
145
149
|
|
|
146
150
|
function makeDefaultStyles() {
|
|
@@ -5,7 +5,7 @@ import { Button } from '../button';
|
|
|
5
5
|
import { Icon } from '../icon';
|
|
6
6
|
import { getTextByChildren } from '../utils';
|
|
7
7
|
var _$tmp0 = {
|
|
8
|
-
'className': '
|
|
8
|
+
'className': 'k-icon-right',
|
|
9
9
|
'size': 'small'
|
|
10
10
|
};
|
|
11
11
|
export default function ($props, $blocks, $__proto__) {
|
|
@@ -6,7 +6,7 @@ import { Button } from '../button';
|
|
|
6
6
|
import { Icon } from '../icon';
|
|
7
7
|
import { Checkbox } from '../checkbox';
|
|
8
8
|
import { makeGroupMenuStyles } from './styles';
|
|
9
|
-
import { isStringOrNumber, get } from 'intact-shared';
|
|
9
|
+
import { isStringOrNumber, get, isArray } from 'intact-shared';
|
|
10
10
|
import { context as GroupContext } from './useGroup';
|
|
11
11
|
import { context as SortableContext } from './useSortable';
|
|
12
12
|
import { linkEvent } from 'intact';
|
|
@@ -17,16 +17,15 @@ import { stopPropagation } from '../utils';
|
|
|
17
17
|
import { Input } from '../input';
|
|
18
18
|
import { _$ } from '../../i18n';
|
|
19
19
|
var _$tmp0 = {
|
|
20
|
-
'className': '
|
|
20
|
+
'className': 'k-icon-search'
|
|
21
21
|
};
|
|
22
22
|
var _$tmp1 = {
|
|
23
|
-
'className': '
|
|
23
|
+
'className': 'k-icon-up k-asc',
|
|
24
|
+
'size': 'mini'
|
|
24
25
|
};
|
|
25
26
|
var _$tmp2 = {
|
|
26
|
-
'className': '
|
|
27
|
-
|
|
28
|
-
var _$tmp3 = {
|
|
29
|
-
'className': 'ion-android-arrow-dropdown k-desc'
|
|
27
|
+
'className': 'k-icon-down k-desc',
|
|
28
|
+
'size': 'mini'
|
|
30
29
|
};
|
|
31
30
|
export default function ($props, $blocks, $__proto__) {
|
|
32
31
|
var _this = this;
|
|
@@ -50,9 +49,14 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
50
49
|
var _this$group = this.group,
|
|
51
50
|
onSelect = _this$group.onSelect,
|
|
52
51
|
isChecked = _this$group.isChecked,
|
|
53
|
-
getGroupText = _this$group.getGroupText,
|
|
54
52
|
keywords = _this$group.keywords,
|
|
55
|
-
filteredGroup = _this$group.filteredGroup
|
|
53
|
+
filteredGroup = _this$group.filteredGroup,
|
|
54
|
+
onShow = _this$group.onShow,
|
|
55
|
+
reset = _this$group.reset,
|
|
56
|
+
confirm = _this$group.confirm,
|
|
57
|
+
dropdownRef = _this$group.dropdownRef,
|
|
58
|
+
localGroupValue = _this$group.localGroupValue,
|
|
59
|
+
isEmptyValue = _this$group.isEmptyValue;
|
|
56
60
|
return _$cc(TableContext.Consumer, {
|
|
57
61
|
'children': function children(checkType) {
|
|
58
62
|
return _$cc(GroupContext.Consumer, {
|
|
@@ -80,7 +84,6 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
80
84
|
'k-column-sortable': sortable
|
|
81
85
|
}, _classNameObj[className] = className, _classNameObj);
|
|
82
86
|
var groupValue = currentGroup && currentGroup[key];
|
|
83
|
-
var groupText = getGroupText(groupValue);
|
|
84
87
|
var type = sort && sort.key === key && sort.type;
|
|
85
88
|
var checked;
|
|
86
89
|
return _$ce(2, 'th', [resizable && _this.$vNode.props.prevVNode ? _$ce(2, 'div', null, 1, 'k-table-resize', {
|
|
@@ -88,7 +91,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
88
91
|
e._vNode = _this.$vNode;
|
|
89
92
|
onStart(e);
|
|
90
93
|
}
|
|
91
|
-
}) : undefined, _$ce(2, 'div', [_$ce(2, 'div',
|
|
94
|
+
}) : undefined, _$ce(2, 'div', [_$ce(2, 'div', (_$blocks['title'] = function ($super) {
|
|
92
95
|
return title;
|
|
93
96
|
}, __$blocks['title'] = function ($super, data) {
|
|
94
97
|
var block = $blocks['title'];
|
|
@@ -98,7 +101,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
98
101
|
};
|
|
99
102
|
|
|
100
103
|
return block ? block.call($this, callBlock, data) : callBlock();
|
|
101
|
-
}, __$blocks['title'](_$no)),
|
|
104
|
+
}, __$blocks['title'](_$no)), 0, 'k-table-title-text c-ellipsis'), group ? _$cc(Dropdown, {
|
|
102
105
|
'position': {
|
|
103
106
|
my: 'center top',
|
|
104
107
|
at: 'center bottom+5',
|
|
@@ -107,16 +110,16 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
107
110
|
'key': 'dropdown',
|
|
108
111
|
'trigger': 'click',
|
|
109
112
|
'ev-show': function evShow() {
|
|
110
|
-
return
|
|
113
|
+
return onShow(groupValue);
|
|
111
114
|
},
|
|
112
|
-
'
|
|
113
|
-
|
|
114
|
-
'
|
|
115
|
-
'className': 'k-table-group',
|
|
115
|
+
'ref': dropdownRef,
|
|
116
|
+
'children': [_$cc(Icon, {
|
|
117
|
+
'className': 'k-icon-down-squared k-table-group',
|
|
116
118
|
'ev-click': function evClick(e) {
|
|
117
119
|
return e._ignoreSortable = true;
|
|
118
120
|
},
|
|
119
|
-
'
|
|
121
|
+
'hoverable': true,
|
|
122
|
+
'color': isEmptyValue(groupValue) ? null : 'primary'
|
|
120
123
|
}), _$cc(DropdownMenu, {
|
|
121
124
|
'className': _$cn((_$cn2 = {
|
|
122
125
|
"k-table-group-dropdown": true
|
|
@@ -133,7 +136,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
133
136
|
__$blocks = _$ex({}, $blocks);
|
|
134
137
|
|
|
135
138
|
return (_$blocks['suffix'] = function ($super) {
|
|
136
|
-
return _$cc(Icon, _$
|
|
139
|
+
return _$cc(Icon, _$tmp0);
|
|
137
140
|
}, __$blocks['suffix'] = function ($super, data) {
|
|
138
141
|
var block = $blocks['suffix'];
|
|
139
142
|
|
|
@@ -147,24 +150,37 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
147
150
|
}), 2, 'k-table-group-header'), _$ce(2, 'div', _$ma(filteredGroup.value, function ($value, $key) {
|
|
148
151
|
return _$cc(DropdownItem, {
|
|
149
152
|
'ev-select': function evSelect() {
|
|
150
|
-
return onSelect($value.value,
|
|
153
|
+
return onSelect($value.value, onChange);
|
|
151
154
|
},
|
|
152
155
|
'hideOnSelect': !multiple,
|
|
153
156
|
'className': _$cn({
|
|
154
|
-
'k-active': checked = isChecked($value.value
|
|
157
|
+
'k-active': checked = isChecked($value.value)
|
|
155
158
|
}),
|
|
156
159
|
'children': multiple ? _$cc(Checkbox, {
|
|
157
160
|
'value': checked,
|
|
158
161
|
'children': $value.label
|
|
159
162
|
}) : _$ce(2, 'span', $value.label, 0)
|
|
160
163
|
});
|
|
161
|
-
}, $this), 4, 'k-table-group-body')
|
|
164
|
+
}, $this), 4, 'k-table-group-body'), multiple ? _$ce(2, 'div', [_$cc(Button, {
|
|
165
|
+
'type': 'none',
|
|
166
|
+
'size': 'small',
|
|
167
|
+
'disabled': isEmptyValue(localGroupValue.value),
|
|
168
|
+
'ev-click': reset,
|
|
169
|
+
'children': '重置'
|
|
170
|
+
}), _$cc(Button, {
|
|
171
|
+
'type': 'primary',
|
|
172
|
+
'size': 'small',
|
|
173
|
+
'ev-click': function evClick() {
|
|
174
|
+
return confirm(onChange);
|
|
175
|
+
},
|
|
176
|
+
'children': '确定'
|
|
177
|
+
})], 4, 'k-table-group-footer') : undefined]
|
|
162
178
|
})]
|
|
163
|
-
}, 'dropdown') : undefined, sortable ? _$ce(2, 'div', [_$cc(Icon, _$
|
|
179
|
+
}, 'dropdown', dropdownRef) : undefined, sortable ? _$ce(2, 'div', [_$cc(Icon, _$tmp1), _$cc(Icon, _$tmp2)], 4, _$cn((_$cn3 = {
|
|
164
180
|
'k-column-sort': true
|
|
165
181
|
}, _$cn3["k-" + type] = type, _$cn3))) : undefined], 0, 'k-table-title')], 0, _$cn(classNameObj), {
|
|
166
182
|
'style': style,
|
|
167
|
-
'title': isStringOrNumber(title) ? title
|
|
183
|
+
'title': isStringOrNumber(title) ? title : null,
|
|
168
184
|
'ev-click': sortable ? linkEvent(key, onChangeSort) : null,
|
|
169
185
|
'colspan': cols,
|
|
170
186
|
'rowspan': rows
|
|
@@ -365,7 +365,7 @@ describe('Table', function () {
|
|
|
365
365
|
}, _callee6);
|
|
366
366
|
})));
|
|
367
367
|
it('group', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
368
|
-
var _mount7, instance, element, _instance$refs4, __test1, __test2, _element$querySelecto8, table1, table2, icon, dropdown, item, icon2, dropdown2, _dropdown2$querySelec, item1, item2, newDropdown;
|
|
368
|
+
var _mount7, instance, element, _instance$refs4, __test1, __test2, _element$querySelecto8, table1, table2, icon, dropdown, item, icon2, dropdown2, _dropdown2$querySelec, item1, item2, _dropdown2$querySelec2, reset, confirm, newDropdown;
|
|
369
369
|
|
|
370
370
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
371
371
|
while (1) {
|
|
@@ -407,7 +407,7 @@ describe('Table', function () {
|
|
|
407
407
|
|
|
408
408
|
case 25:
|
|
409
409
|
expect(instance.get('multipleGroup')).to.eql({
|
|
410
|
-
status: [
|
|
410
|
+
status: []
|
|
411
411
|
});
|
|
412
412
|
expect(table2.innerHTML).to.matchSnapshot();
|
|
413
413
|
item2.click();
|
|
@@ -415,24 +415,55 @@ describe('Table', function () {
|
|
|
415
415
|
return wait();
|
|
416
416
|
|
|
417
417
|
case 30:
|
|
418
|
+
expect(instance.get('multipleGroup')).to.eql({
|
|
419
|
+
status: []
|
|
420
|
+
}); // click confirm
|
|
421
|
+
|
|
422
|
+
_dropdown2$querySelec2 = dropdown2.querySelectorAll('.k-table-group-footer .k-btn'), reset = _dropdown2$querySelec2[0], confirm = _dropdown2$querySelec2[1];
|
|
423
|
+
confirm.click();
|
|
424
|
+
_context7.next = 35;
|
|
425
|
+
return wait();
|
|
426
|
+
|
|
427
|
+
case 35:
|
|
418
428
|
expect(instance.get('multipleGroup')).to.eql({
|
|
419
429
|
status: ['active', 'stopped']
|
|
420
430
|
});
|
|
421
|
-
expect(table2.innerHTML).to.matchSnapshot(); //
|
|
431
|
+
expect(table2.innerHTML).to.matchSnapshot(); // click reset
|
|
432
|
+
|
|
433
|
+
dispatchEvent(icon2, 'click');
|
|
434
|
+
_context7.next = 40;
|
|
435
|
+
return wait();
|
|
436
|
+
|
|
437
|
+
case 40:
|
|
438
|
+
expect(dropdown2.innerHTML).to.matchSnapshot();
|
|
439
|
+
reset.click();
|
|
440
|
+
_context7.next = 44;
|
|
441
|
+
return wait();
|
|
442
|
+
|
|
443
|
+
case 44:
|
|
444
|
+
expect(dropdown2.innerHTML).to.matchSnapshot();
|
|
445
|
+
confirm.click();
|
|
446
|
+
_context7.next = 48;
|
|
447
|
+
return wait();
|
|
448
|
+
|
|
449
|
+
case 48:
|
|
450
|
+
expect(instance.get('multipleGroup')).to.eql({
|
|
451
|
+
status: []
|
|
452
|
+
}); // update group
|
|
422
453
|
|
|
423
454
|
instance.set('statusGroup', [{
|
|
424
455
|
label: 'label',
|
|
425
456
|
value: 'value'
|
|
426
457
|
}]);
|
|
427
458
|
dispatchEvent(icon, 'click');
|
|
428
|
-
_context7.next =
|
|
459
|
+
_context7.next = 53;
|
|
429
460
|
return wait(500);
|
|
430
461
|
|
|
431
|
-
case
|
|
462
|
+
case 53:
|
|
432
463
|
newDropdown = getElement('.k-table-group-dropdown');
|
|
433
464
|
expect(newDropdown.innerHTML).to.matchSnapshot();
|
|
434
465
|
|
|
435
|
-
case
|
|
466
|
+
case 55:
|
|
436
467
|
case "end":
|
|
437
468
|
return _context7.stop();
|
|
438
469
|
}
|
|
@@ -31,6 +31,10 @@ var defaults = {
|
|
|
31
31
|
return theme.color.bg;
|
|
32
32
|
},
|
|
33
33
|
|
|
34
|
+
get color() {
|
|
35
|
+
return theme.color.lightBlack;
|
|
36
|
+
},
|
|
37
|
+
|
|
34
38
|
padding: "0 5px 0 12px",
|
|
35
39
|
fontSize: "12px",
|
|
36
40
|
fontWeight: "bold",
|
|
@@ -51,10 +55,9 @@ var defaults = {
|
|
|
51
55
|
stripeBgColor: '#f9f9fc',
|
|
52
56
|
// group
|
|
53
57
|
group: {
|
|
54
|
-
|
|
55
|
-
gap: "10px",
|
|
56
|
-
color: "#a6a6a6",
|
|
58
|
+
gap: "8px",
|
|
57
59
|
menuMaxHeight: '200px',
|
|
60
|
+
menuMinWidth: '200px',
|
|
58
61
|
|
|
59
62
|
get activeColor() {
|
|
60
63
|
return theme.color.primary;
|
|
@@ -70,9 +73,13 @@ var defaults = {
|
|
|
70
73
|
// sort
|
|
71
74
|
sort: {
|
|
72
75
|
iconHeight: "7px",
|
|
73
|
-
gap: "
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
gap: "8px",
|
|
77
|
+
|
|
78
|
+
// color: `#d0d5d9`,
|
|
79
|
+
get enabledColor() {
|
|
80
|
+
return theme.color.primary;
|
|
81
|
+
}
|
|
82
|
+
|
|
76
83
|
},
|
|
77
84
|
expandBgColor: '#fdfcff',
|
|
78
85
|
|
|
@@ -95,10 +102,10 @@ setDefault(function () {
|
|
|
95
102
|
}).table;
|
|
96
103
|
});
|
|
97
104
|
export function makeStyles() {
|
|
98
|
-
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;td,th{transition:all ", table.transition, ";}}thead{text-align:", table.thead.textAlign, ";font-size:", table.thead.fontSize, ";font-weight:", table.thead.fontWeight, ";position:sticky;top:0;z-index:2;tr{height:", table.thead.height, ";&:not(:last-of-type) th{border-bottom:", 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%);}&:first-of-type:before{display:none;}}.k-table-title{display:inline-flex;align-items:center;max-width:100%;color:",
|
|
105
|
+
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;td,th{transition:all ", table.transition, ";}}thead{text-align:", table.thead.textAlign, ";font-size:", table.thead.fontSize, ";font-weight:", table.thead.fontWeight, ";position:sticky;top:0;z-index:2;tr{height:", table.thead.height, ";&:not(:last-of-type) th{border-bottom:", 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%);}&: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;}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-table-arrow{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) {
|
|
99
106
|
return /*#__PURE__*/css(".k-align-", type, "{text-align:", type, ";}");
|
|
100
107
|
}), ">.k-pagination{margin:16px 0;}");
|
|
101
108
|
}
|
|
102
109
|
export function makeGroupMenuStyles() {
|
|
103
|
-
return /*#__PURE__*/css("max-height:", table.group.menuMaxHeight, ";overflow:auto;.k-dropdown-item.k-active{color:", table.group.activeColor, ";}.k-table-group-header{padding:", table.group.headerPadding, ";border-bottom:", table.group.headerBorder, ";}");
|
|
110
|
+
return /*#__PURE__*/css("max-height:", table.group.menuMaxHeight, ";min-width:", table.group.menuMinWidth, "!important;overflow:auto;.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-footer{text-align:right;border-top:", table.group.headerBorder, ";padding:8px;.k-btn{margin-left:8px;}}");
|
|
104
111
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TableColumnGroupItem } from './column';
|
|
2
|
+
import type { Dropdown } from '../dropdown';
|
|
2
3
|
declare type ContextValue = {
|
|
3
4
|
groupValue: any;
|
|
4
5
|
onChange: (key: string, groupValue: any) => void;
|
|
@@ -8,10 +9,15 @@ export declare const context: {
|
|
|
8
9
|
Consumer: import("intact").ComponentConstructor<import("intact").Component<import("../context").ConsumerProps<ContextValue>, {}, {}, {}>>;
|
|
9
10
|
};
|
|
10
11
|
export declare function useGroup(): {
|
|
11
|
-
onSelect: (value: any,
|
|
12
|
-
isChecked: (value: any
|
|
13
|
-
getGroupText: (groupValue: any) => string | null;
|
|
12
|
+
onSelect: (value: any, onChange: ContextValue['onChange']) => void;
|
|
13
|
+
isChecked: (value: any) => any;
|
|
14
14
|
keywords: import("../../hooks/useState").State<string>;
|
|
15
15
|
filteredGroup: import("../../hooks/useState").State<TableColumnGroupItem[] | undefined>;
|
|
16
|
+
onShow: (groupValue: any) => void;
|
|
17
|
+
reset: () => void;
|
|
18
|
+
confirm: (onChange: ContextValue['onChange']) => void;
|
|
19
|
+
dropdownRef: import("intact").RefObject<Dropdown>;
|
|
20
|
+
localGroupValue: import("../../hooks/useState").State<any>;
|
|
21
|
+
isEmptyValue: (groupValue: any) => boolean | undefined;
|
|
16
22
|
};
|
|
17
23
|
export {};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js/instance/includes";
|
|
2
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
3
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js/instance/filter";
|
|
4
2
|
import _trimInstanceProperty from "@babel/runtime-corejs3/core-js/instance/trim";
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
3
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js/instance/filter";
|
|
4
|
+
import { useInstance, createRef } from 'intact-react';
|
|
5
|
+
import { isArray } from 'intact-shared';
|
|
7
6
|
import { toggleArray } from '../utils';
|
|
8
7
|
import { createContext } from '../context';
|
|
9
8
|
import { useState, watchState } from '../../hooks/useState';
|
|
@@ -12,26 +11,37 @@ export function useGroup() {
|
|
|
12
11
|
var instance = useInstance();
|
|
13
12
|
var keywords = useState('');
|
|
14
13
|
var filteredGroup = useState(instance.get('group'));
|
|
14
|
+
var localGroupValue = useState(null);
|
|
15
|
+
var dropdownRef = createRef();
|
|
15
16
|
instance.on('$receive:group', function (group) {
|
|
16
17
|
return filteredGroup.set(group);
|
|
17
18
|
});
|
|
18
19
|
|
|
19
|
-
function
|
|
20
|
+
function onShow(groupValue) {
|
|
21
|
+
keywords.set('');
|
|
22
|
+
localGroupValue.set(groupValue);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function onSelect(value, onChange) {
|
|
20
26
|
var _instance$get = instance.get(),
|
|
21
27
|
multiple = _instance$get.multiple,
|
|
22
28
|
key = _instance$get.key;
|
|
23
29
|
|
|
24
30
|
if (multiple) {
|
|
25
|
-
|
|
31
|
+
// should click confirm button when it is multiple selection
|
|
32
|
+
localGroupValue.set(toggleArray(localGroupValue.value, value));
|
|
33
|
+
} else {
|
|
34
|
+
// change immediately when it is single selection
|
|
35
|
+
onChange(key, value);
|
|
26
36
|
}
|
|
27
|
-
|
|
28
|
-
onChange(key, value);
|
|
29
37
|
}
|
|
30
38
|
|
|
31
|
-
function isChecked(value
|
|
39
|
+
function isChecked(value) {
|
|
32
40
|
var _instance$get2 = instance.get(),
|
|
33
41
|
multiple = _instance$get2.multiple;
|
|
34
42
|
|
|
43
|
+
var groupValue = localGroupValue.value;
|
|
44
|
+
|
|
35
45
|
if (multiple) {
|
|
36
46
|
return groupValue && _includesInstanceProperty(groupValue).call(groupValue, value);
|
|
37
47
|
}
|
|
@@ -39,38 +49,31 @@ export function useGroup() {
|
|
|
39
49
|
return groupValue === value;
|
|
40
50
|
}
|
|
41
51
|
|
|
42
|
-
function
|
|
52
|
+
function confirm(onChange) {
|
|
43
53
|
var _instance$get3 = instance.get(),
|
|
44
|
-
|
|
45
|
-
group = _instance$get3.group;
|
|
46
|
-
|
|
47
|
-
if (isNullOrUndefined(groupValue)) return null;
|
|
54
|
+
key = _instance$get3.key;
|
|
48
55
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (group) {
|
|
54
|
-
var _context;
|
|
56
|
+
onChange(key, localGroupValue.value);
|
|
57
|
+
dropdownRef.value.hide(true);
|
|
58
|
+
}
|
|
55
59
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return item.label;
|
|
60
|
-
}).join(', ');
|
|
60
|
+
function reset() {
|
|
61
|
+
localGroupValue.set([]);
|
|
62
|
+
}
|
|
61
63
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
64
|
+
function isEmptyValue(groupValue) {
|
|
65
|
+
var _instance$get4 = instance.get(),
|
|
66
|
+
multiple = _instance$get4.multiple;
|
|
66
67
|
|
|
67
|
-
return
|
|
68
|
+
return !groupValue || multiple && (!isArray(groupValue) || groupValue.every(function (value) {
|
|
69
|
+
return !value;
|
|
70
|
+
}));
|
|
68
71
|
}
|
|
69
72
|
|
|
70
73
|
watchState(keywords, function (v) {
|
|
71
|
-
var _instance$
|
|
72
|
-
_instance$
|
|
73
|
-
group = _instance$
|
|
74
|
+
var _instance$get5 = instance.get(),
|
|
75
|
+
_instance$get5$group = _instance$get5.group,
|
|
76
|
+
group = _instance$get5$group === void 0 ? [] : _instance$get5$group;
|
|
74
77
|
|
|
75
78
|
v = _trimInstanceProperty(v).call(v);
|
|
76
79
|
|
|
@@ -78,17 +81,22 @@ export function useGroup() {
|
|
|
78
81
|
filteredGroup.set(group);
|
|
79
82
|
} else {
|
|
80
83
|
filteredGroup.set(_filterInstanceProperty(group).call(group, function (item) {
|
|
81
|
-
var
|
|
84
|
+
var _context, _context2;
|
|
82
85
|
|
|
83
|
-
return _includesInstanceProperty(
|
|
86
|
+
return _includesInstanceProperty(_context = String(item.label)).call(_context, v) || _includesInstanceProperty(_context2 = String(item.value)).call(_context2, v);
|
|
84
87
|
}));
|
|
85
88
|
}
|
|
86
89
|
});
|
|
87
90
|
return {
|
|
88
91
|
onSelect: onSelect,
|
|
89
92
|
isChecked: isChecked,
|
|
90
|
-
getGroupText: getGroupText,
|
|
91
93
|
keywords: keywords,
|
|
92
|
-
filteredGroup: filteredGroup
|
|
94
|
+
filteredGroup: filteredGroup,
|
|
95
|
+
onShow: onShow,
|
|
96
|
+
reset: reset,
|
|
97
|
+
confirm: confirm,
|
|
98
|
+
dropdownRef: dropdownRef,
|
|
99
|
+
localGroupValue: localGroupValue,
|
|
100
|
+
isEmptyValue: isEmptyValue
|
|
93
101
|
};
|
|
94
102
|
}
|
|
@@ -3,6 +3,7 @@ import { createVNode as _$cv, className as _$cn, createUnknownComponentVNode as
|
|
|
3
3
|
import { Button } from '../button';
|
|
4
4
|
import { getRestProps } from '../utils';
|
|
5
5
|
import { makeStyles } from './styles';
|
|
6
|
+
import { Icon } from '../icon';
|
|
6
7
|
export default function ($props, $blocks, $__proto__) {
|
|
7
8
|
var _classNameObj;
|
|
8
9
|
|
|
@@ -39,7 +40,9 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
39
40
|
'size': size,
|
|
40
41
|
'disabled': !enablePrev.value,
|
|
41
42
|
'ev-click': prev,
|
|
42
|
-
'children': _$
|
|
43
|
+
'children': _$cc(Icon, {
|
|
44
|
+
'className': _$cn(vertical ? "k-icon-up" : "k-icon-left")
|
|
45
|
+
})
|
|
43
46
|
}, 'prev') : undefined, _$ce(2, 'div', _$ce(2, 'div', [children, _$ce(2, 'div', null, 1, 'k-tabs-active-bar', {
|
|
44
47
|
'style': this.activeBar.value
|
|
45
48
|
})], 0, 'k-tabs-wrapper', {
|
|
@@ -54,7 +57,9 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
54
57
|
'size': size,
|
|
55
58
|
'disabled': !enableNext.value,
|
|
56
59
|
'ev-click': next,
|
|
57
|
-
'children': _$
|
|
60
|
+
'children': _$cc(Icon, {
|
|
61
|
+
'className': _$cn(vertical ? "k-icon-down" : "k-icon-right")
|
|
62
|
+
})
|
|
58
63
|
}, 'next') : undefined]);
|
|
59
64
|
}
|
|
60
65
|
;
|