@king-design/intact 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/components/button/demos/basic.md +1 -1
- package/components/button/demos/disabled.md +2 -1
- package/components/button/demos/group.md +2 -2
- package/components/button/demos/icon.md +7 -7
- package/components/button/demos/loading.md +4 -4
- package/components/button/demos/size.md +4 -4
- package/components/button/styles.ts +19 -13
- package/components/carousel/index.vdt +2 -2
- package/components/cascader/index.vdt +1 -1
- package/components/checkbox/demos/basic.md +1 -1
- package/components/checkbox/demos/group.md +1 -1
- package/components/checkbox/demos/indeterminate.md +1 -1
- package/components/checkbox/demos/value.md +1 -1
- package/components/collapse/item.vdt +1 -1
- package/components/copy/index.vdt +1 -1
- package/components/datepicker/calendar.vdt +6 -6
- package/components/datepicker/demos/datetime.md +5 -4
- package/components/datepicker/index.spec.ts +11 -1
- package/components/datepicker/styles.ts +6 -1
- package/components/datepicker/useValue.ts +35 -10
- package/components/dialog/styles.ts +1 -1
- package/components/dropdown/demos/basic.md +1 -1
- package/components/dropdown/demos/checkbox.md +1 -1
- package/components/dropdown/demos/disabled.md +2 -2
- package/components/dropdown/demos/nested.md +6 -6
- package/components/dropdown/demos/position.md +3 -3
- package/components/dropdown/demos/trigger.md +2 -2
- package/components/form/demos/basic.md +2 -2
- package/components/form/demos/custom.md +2 -4
- package/components/form/styles.ts +2 -2
- package/components/icon/demos/icons.md +130 -97
- package/components/icon/styles.ts +6 -2
- package/components/input/demos/blocks.md +7 -2
- package/components/input/demos/clearable.md +2 -2
- package/components/input/demos/showCount.md +18 -0
- package/components/input/demos/size.md +6 -4
- package/components/input/index.md +1 -0
- package/components/input/index.ts +5 -0
- package/components/input/index.vdt +22 -14
- package/components/input/search.vdt +2 -5
- package/components/input/styles.ts +81 -77
- package/components/input/useFocus.ts +17 -0
- package/components/menu/item.vdt +1 -1
- package/components/pagination/index.vdt +2 -2
- package/components/progress/index.vdt +1 -1
- package/components/radio/demos/basic.md +1 -1
- package/components/radio/demos/group.md +1 -1
- package/components/radio/demos/value.md +1 -1
- package/components/select/base.vdt +19 -17
- package/components/select/demos/customMenu.md +2 -2
- package/components/select/index.spec.ts +4 -1
- package/components/select/menu.vdt +2 -2
- package/components/select/option.vdt +1 -0
- package/components/select/styles.ts +5 -1
- package/components/spinner/index.vdt +4 -4
- package/components/spinner/styles.ts +9 -6
- package/components/steps/step.vdt +2 -2
- package/components/steps/styles.ts +5 -1
- package/components/table/cell.vdt +1 -1
- package/components/table/column.vdt +27 -16
- package/components/table/demos/group.md +4 -3
- package/components/table/demos/title.md +3 -5
- package/components/table/index.spec.ts +18 -1
- package/components/table/styles.ts +21 -28
- package/components/table/useGroup.ts +41 -23
- package/components/tabs/index.vdt +3 -2
- package/components/tag/index.md +31 -0
- package/components/tag/styles.ts +6 -6
- package/components/tag/tags.vdt +1 -0
- package/components/tag/useNowrap.ts +1 -1
- package/components/transfer/index.vdt +4 -3
- package/components/types.ts +1 -0
- package/components/upload/index.vdt +4 -4
- package/es/components/button/styles.d.ts +1 -1
- package/es/components/button/styles.js +3 -5
- package/es/components/carousel/index.vdt.js +2 -2
- package/es/components/cascader/index.vdt.js +1 -1
- package/es/components/collapse/item.vdt.js +1 -1
- package/es/components/copy/index.vdt.js +1 -1
- package/es/components/datepicker/calendar.vdt.js +6 -6
- package/es/components/datepicker/index.spec.js +170 -152
- package/es/components/datepicker/styles.js +1 -1
- package/es/components/datepicker/useValue.d.ts +3 -3
- package/es/components/datepicker/useValue.js +38 -9
- package/es/components/dialog/styles.js +1 -1
- package/es/components/form/styles.js +1 -1
- package/es/components/icon/styles.js +1 -1
- package/es/components/input/index.d.ts +3 -1
- package/es/components/input/index.js +4 -1
- package/es/components/input/index.vdt.js +21 -10
- package/es/components/input/search.vdt.js +2 -4
- package/es/components/input/styles.js +13 -6
- package/es/components/input/useFocus.d.ts +4 -0
- package/es/components/input/useFocus.js +21 -0
- package/es/components/menu/item.vdt.js +4 -1
- package/es/components/pagination/index.vdt.js +2 -2
- package/es/components/progress/index.vdt.js +1 -1
- package/es/components/select/base.vdt.js +36 -19
- package/es/components/select/index.spec.js +23 -11
- package/es/components/select/menu.vdt.js +5 -5
- package/es/components/select/option.vdt.js +2 -1
- package/es/components/select/styles.js +1 -1
- package/es/components/spinner/index.vdt.js +4 -4
- package/es/components/spinner/styles.js +2 -2
- package/es/components/steps/step.vdt.js +2 -2
- package/es/components/steps/styles.js +6 -2
- package/es/components/table/cell.vdt.js +1 -1
- package/es/components/table/column.vdt.js +40 -24
- package/es/components/table/index.spec.js +37 -6
- package/es/components/table/styles.js +15 -8
- package/es/components/table/useGroup.d.ts +9 -3
- package/es/components/table/useGroup.js +45 -37
- package/es/components/tabs/index.vdt.js +7 -2
- package/es/components/tag/styles.js +1 -1
- package/es/components/tag/tags.vdt.js +14 -2
- package/es/components/tag/useNowrap.js +1 -1
- package/es/components/transfer/index.vdt.js +14 -3
- package/es/components/types.d.ts +1 -0
- package/es/components/upload/index.vdt.js +4 -4
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/site/data/components/button/demos/disabled/react.js +5 -2
- package/es/site/data/components/button/demos/group/react.js +2 -2
- package/es/site/data/components/button/demos/icon/react.js +7 -7
- package/es/site/data/components/button/demos/loading/react.js +4 -4
- package/es/site/data/components/button/demos/size/react.js +4 -4
- package/es/site/data/components/datepicker/demos/datetime/index.d.ts +1 -0
- package/es/site/data/components/datepicker/demos/datetime/index.js +1 -0
- package/es/site/data/components/dropdown/demos/basic/react.js +1 -1
- package/es/site/data/components/dropdown/demos/checkbox/react.js +1 -1
- package/es/site/data/components/dropdown/demos/disabled/react.js +2 -2
- package/es/site/data/components/dropdown/demos/nested/react.js +9 -9
- package/es/site/data/components/dropdown/demos/position/react.js +3 -3
- package/es/site/data/components/dropdown/demos/trigger/react.js +2 -2
- package/es/site/data/components/form/demos/basic/react.js +1 -1
- package/es/site/data/components/icon/demos/icons/index.d.ts +8 -4
- package/es/site/data/components/icon/demos/icons/index.js +35 -1
- package/es/site/data/components/icon/demos/icons/react.d.ts +9 -4
- package/es/site/data/components/icon/demos/icons/react.js +51 -9
- package/es/site/data/components/input/demos/blocks/react.js +7 -7
- package/es/site/data/components/input/demos/clearable/react.js +2 -2
- package/es/site/data/components/input/demos/showCount/index.d.ts +5 -0
- package/es/site/data/components/input/demos/showCount/index.js +17 -0
- package/es/site/data/components/input/demos/showCount/react.d.ts +4 -0
- package/es/site/data/components/input/demos/showCount/react.js +33 -0
- package/es/site/data/components/input/demos/size/react.js +8 -8
- package/es/site/data/components/select/demos/customMenu/react.js +5 -5
- package/es/site/data/components/table/demos/title/react.js +4 -4
- package/es/site/src/pages/styles.js +1 -1
- package/es/site/src/router/index.js +1 -1
- package/es/styles/fonts/iconfont.eot +0 -0
- package/es/styles/fonts/iconfont.js +1 -1
- package/es/styles/fonts/iconfont.svg +35 -35
- package/es/styles/fonts/iconfont.ttf +0 -0
- package/es/styles/fonts/iconfont.woff +0 -0
- package/es/styles/global.js +1 -1
- package/index.ts +2 -2
- package/package.json +2 -2
- package/styles/fonts/demo.css +277 -108
- package/styles/fonts/demo_index.html +2169 -0
- package/styles/fonts/iconfont.css +52 -50
- package/styles/fonts/iconfont.eot +0 -0
- package/styles/fonts/iconfont.js +1 -0
- package/styles/fonts/iconfont.json +611 -0
- package/styles/fonts/iconfont.svg +35 -35
- package/styles/fonts/iconfont.ts +123 -124
- package/styles/fonts/iconfont.ttf +0 -0
- package/styles/fonts/iconfont.woff +0 -0
- package/styles/fonts/iconfont.woff2 +0 -0
- package/styles/global.ts +4 -4
- package/components/select/useNowrap.ts +0 -24
- package/es/components/select/useNowrap.d.ts +0 -3
- package/es/components/select/useNowrap.js +0 -19
|
@@ -6,20 +6,25 @@ order: 3
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
```vdt
|
|
9
|
-
import {Icon} from 'kpc';
|
|
9
|
+
import {Icon, Input} from 'kpc';
|
|
10
10
|
|
|
11
|
-
<div
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
<div>
|
|
12
|
+
<Input v-model="keywords" placeholder="Search icon" clearable />
|
|
13
|
+
<div class="icons">
|
|
14
|
+
<div class="icon" v-for={this.filter()}>
|
|
15
|
+
<Icon
|
|
16
|
+
class={'k-icon-' + $value[0]}
|
|
17
|
+
size="large"
|
|
18
|
+
/>
|
|
19
|
+
<div>{'k-icon-' + $value[0]}</div>
|
|
20
|
+
</div>
|
|
18
21
|
</div>
|
|
19
22
|
</div>
|
|
20
23
|
```
|
|
21
24
|
|
|
22
25
|
```styl
|
|
26
|
+
.k-input
|
|
27
|
+
margin-bottom 16px
|
|
23
28
|
.icons
|
|
24
29
|
display flex
|
|
25
30
|
flex-wrap wrap
|
|
@@ -30,100 +35,128 @@ import {Icon} from 'kpc';
|
|
|
30
35
|
```
|
|
31
36
|
|
|
32
37
|
```ts
|
|
33
|
-
|
|
38
|
+
interface Props {
|
|
39
|
+
keywords?: string
|
|
40
|
+
fonts: string[][]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default class extends Component<Props> {
|
|
34
44
|
static template = template;
|
|
35
45
|
|
|
36
46
|
static defaults() {
|
|
37
47
|
return {
|
|
48
|
+
keywords: '',
|
|
38
49
|
fonts: [
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
]
|
|
126
|
-
}
|
|
50
|
+
["information-fill"],
|
|
51
|
+
["warning-fill"],
|
|
52
|
+
["success-fill"],
|
|
53
|
+
["error-fill"],
|
|
54
|
+
["question-fill"],
|
|
55
|
+
["heart-fill"],
|
|
56
|
+
['heart'],
|
|
57
|
+
['notification-fill'],
|
|
58
|
+
['notification'],
|
|
59
|
+
["information"],
|
|
60
|
+
["alert"],
|
|
61
|
+
["question"],
|
|
62
|
+
["zoom-in"],
|
|
63
|
+
["zoom-out"],
|
|
64
|
+
["close-outline"],
|
|
65
|
+
["check-outline"],
|
|
66
|
+
["time"],
|
|
67
|
+
['right-circled', 'arrow'],
|
|
68
|
+
['down-circled', 'arrow'],
|
|
69
|
+
['right-circled', 'arrow'],
|
|
70
|
+
['up-circled', 'arrow'],
|
|
71
|
+
['right-squared', 'arrow'],
|
|
72
|
+
['down-squared', 'arrow'],
|
|
73
|
+
['left-squared', 'arrow'],
|
|
74
|
+
['up-squared', 'arrow'],
|
|
75
|
+
['right', 'arrow'],
|
|
76
|
+
['down', 'arrow'],
|
|
77
|
+
['left', 'arrow'],
|
|
78
|
+
['up', 'arrow'],
|
|
79
|
+
['right-bold', 'arrow'],
|
|
80
|
+
['down-bold', 'arrow'],
|
|
81
|
+
['left-bold', 'arrow'],
|
|
82
|
+
['up-bold', 'arrow'],
|
|
83
|
+
['sort'],
|
|
84
|
+
['sort-bold'],
|
|
85
|
+
['close'],
|
|
86
|
+
['close-bold'],
|
|
87
|
+
['check'],
|
|
88
|
+
['check-bold'],
|
|
89
|
+
['add'],
|
|
90
|
+
['add-bold'],
|
|
91
|
+
['minus'],
|
|
92
|
+
['minus-bold'],
|
|
93
|
+
['share'],
|
|
94
|
+
['tag'],
|
|
95
|
+
['clone'],
|
|
96
|
+
['cloud'],
|
|
97
|
+
['pin'],
|
|
98
|
+
['home'],
|
|
99
|
+
['cut'],
|
|
100
|
+
['server'],
|
|
101
|
+
['internet'],
|
|
102
|
+
['mail'],
|
|
103
|
+
['paper'],
|
|
104
|
+
['phone'],
|
|
105
|
+
['panel'],
|
|
106
|
+
['alarm'],
|
|
107
|
+
['earphone'],
|
|
108
|
+
['settings-horizontal'],
|
|
109
|
+
['settings-vertical'],
|
|
110
|
+
['settings'],
|
|
111
|
+
['message'],
|
|
112
|
+
['return-right'],
|
|
113
|
+
['picture'],
|
|
114
|
+
['logout'],
|
|
115
|
+
['all'],
|
|
116
|
+
['drag'],
|
|
117
|
+
['more'],
|
|
118
|
+
['more-circled'],
|
|
119
|
+
['folder'],
|
|
120
|
+
['folder-open'],
|
|
121
|
+
['lock'],
|
|
122
|
+
['unlock'],
|
|
123
|
+
['user'],
|
|
124
|
+
['users'],
|
|
125
|
+
['edit'],
|
|
126
|
+
['location'],
|
|
127
|
+
['delete'],
|
|
128
|
+
['calendar'],
|
|
129
|
+
['search'],
|
|
130
|
+
['batchsearch'],
|
|
131
|
+
['hidden'],
|
|
132
|
+
['visible'],
|
|
133
|
+
['refresh'],
|
|
134
|
+
['upload'],
|
|
135
|
+
['download'],
|
|
136
|
+
],
|
|
137
|
+
} as Props
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
init() {
|
|
141
|
+
const fonts = this.get('fonts');
|
|
142
|
+
const map: Record<string, boolean> = {};
|
|
143
|
+
fonts.forEach(([font]) => {
|
|
144
|
+
if (map[font]) {
|
|
145
|
+
console.log('duplicated', font);
|
|
146
|
+
}
|
|
147
|
+
map[font] = true;
|
|
148
|
+
})
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
filter() {
|
|
152
|
+
const keywords = this.get('keywords')!.trim().toLowerCase();
|
|
153
|
+
const fonts = this.get('fonts');
|
|
154
|
+
|
|
155
|
+
if (!keywords) return fonts;
|
|
156
|
+
|
|
157
|
+
return fonts.filter((font) => {
|
|
158
|
+
return font[0].includes(keywords) || font[1] && font[1].includes(keywords);
|
|
159
|
+
});
|
|
127
160
|
}
|
|
128
161
|
}
|
|
129
162
|
```
|
|
@@ -57,9 +57,13 @@ export default function makeStyles(color?: string) {
|
|
|
57
57
|
animation: ${rotate} 1s infinite linear;
|
|
58
58
|
}
|
|
59
59
|
&:before {
|
|
60
|
-
position: relative;
|
|
61
60
|
font-size: inherit;
|
|
62
|
-
|
|
61
|
+
/**
|
|
62
|
+
* FIXME: Why add bellow two styles?
|
|
63
|
+
* https://github.com/ksc-fe/kpc/issues/876
|
|
64
|
+
*/
|
|
65
|
+
// position: relative;
|
|
66
|
+
// z-index: 1;
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
// hoverable
|
|
@@ -13,6 +13,7 @@ import {Input, Button, Icon} from 'kpc';
|
|
|
13
13
|
<b:prepend>http://</b:prepend>
|
|
14
14
|
<b:append>.com</b:append>
|
|
15
15
|
</Input>
|
|
16
|
+
<br />
|
|
16
17
|
<Input placeholder="please enter">
|
|
17
18
|
<b:append>
|
|
18
19
|
<Button icon type="none">
|
|
@@ -20,6 +21,7 @@ import {Input, Button, Icon} from 'kpc';
|
|
|
20
21
|
</Button>
|
|
21
22
|
</b:append>
|
|
22
23
|
</Input>
|
|
24
|
+
<br />
|
|
23
25
|
<Input placeholder="please enter">
|
|
24
26
|
<b:append>
|
|
25
27
|
<Button icon type="primary">
|
|
@@ -27,18 +29,21 @@ import {Input, Button, Icon} from 'kpc';
|
|
|
27
29
|
</Button>
|
|
28
30
|
</b:append>
|
|
29
31
|
</Input>
|
|
32
|
+
<br />
|
|
30
33
|
<Input placeholder="please enter">
|
|
31
34
|
<b:append><Button type="primary">搜索</Button></b:append>
|
|
32
35
|
</Input>
|
|
36
|
+
<br />
|
|
33
37
|
<Input placeholder="please enter">
|
|
34
38
|
<b:prefix><Icon class="k-icon-internet" /></b:prefix>
|
|
35
|
-
<b:suffix><Icon class="
|
|
39
|
+
<b:suffix><Icon class="k-icon-search" hoverable /></b:suffix>
|
|
36
40
|
</Input>
|
|
41
|
+
<br />
|
|
37
42
|
<Input placeholder="please enter">
|
|
38
43
|
<b:prepend>http://</b:prepend>
|
|
39
44
|
<b:append>.com</b:append>
|
|
40
45
|
<b:prefix><Icon class="k-icon-internet" /></b:prefix>
|
|
41
|
-
<b:suffix><Icon class="
|
|
46
|
+
<b:suffix><Icon class="k-icon-search" hoverable /></b:suffix>
|
|
42
47
|
</Input>
|
|
43
48
|
</div>
|
|
44
49
|
```
|
|
@@ -14,11 +14,11 @@ import {Input, Icon} from 'kpc';
|
|
|
14
14
|
<Input value="disabled" clearable disabled />
|
|
15
15
|
<br />
|
|
16
16
|
<Input clearable placeholder="please enter">
|
|
17
|
-
<b:suffix><Icon class="
|
|
17
|
+
<b:suffix><Icon class="k-icon-search" hoverable /></b:suffix>
|
|
18
18
|
</Input>
|
|
19
19
|
<br />
|
|
20
20
|
<Input clearable stackClearIcon placeholder="please enter">
|
|
21
|
-
<b:suffix><Icon class="
|
|
21
|
+
<b:suffix><Icon class="k-icon-search" hoverable /></b:suffix>
|
|
22
22
|
</Input>
|
|
23
23
|
</div>
|
|
24
24
|
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 展示提示数字
|
|
3
|
+
order: 11
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
添加`showCount`属性,展示字符长度提示数字
|
|
7
|
+
|
|
8
|
+
```vdt
|
|
9
|
+
import {Input} from 'kpc';
|
|
10
|
+
|
|
11
|
+
<div>
|
|
12
|
+
<Input placeholder="Please enter" showCount />
|
|
13
|
+
<br /><br />
|
|
14
|
+
<Input placeholder="Please enter" showCount maxlength="10" />
|
|
15
|
+
<br /><br />
|
|
16
|
+
<Input type="textarea" placeholder="please enter" showCount maxlength="100" />
|
|
17
|
+
</div>
|
|
18
|
+
```
|
|
@@ -6,8 +6,7 @@ order: 2
|
|
|
6
6
|
添加`size`属性,定义如下尺寸:`large`, `default`,`small`,`mini`
|
|
7
7
|
|
|
8
8
|
```vdt
|
|
9
|
-
import {Input} from 'kpc';
|
|
10
|
-
import {Button} from 'kpc';
|
|
9
|
+
import {Input, Button, Icon} from 'kpc';
|
|
11
10
|
|
|
12
11
|
<div>
|
|
13
12
|
<Input size="large" value="large" />
|
|
@@ -15,18 +14,21 @@ import {Button} from 'kpc';
|
|
|
15
14
|
<Input value="default" />
|
|
16
15
|
<br />
|
|
17
16
|
<Input value="small" size="small" />
|
|
17
|
+
<br />
|
|
18
18
|
<Input size="small" placeholder="please enter">
|
|
19
19
|
<b:prepend>http://</b:prepend>
|
|
20
20
|
<b:append>.com</b:append>
|
|
21
21
|
</Input>
|
|
22
|
+
<br />
|
|
22
23
|
<Input size="small" placeholder="please enter">
|
|
23
24
|
<b:prefix><i class="ion-earth"></i></b:prefix>
|
|
24
|
-
<b:append><Button size="small" icon type="primary"><
|
|
25
|
+
<b:append><Button size="small" icon type="primary"><Icon class="k-icon k-icon-search" size="small" /></Button></b:append>
|
|
25
26
|
</Input>
|
|
27
|
+
<br />
|
|
26
28
|
<Input size="small" placeholder="please enter" clearable>
|
|
27
29
|
<b:append><Button type="primary" size="small">Search</Button></b:append>
|
|
28
30
|
</Input>
|
|
29
|
-
|
|
31
|
+
<br />
|
|
30
32
|
<Input value="mini" size="mini" />
|
|
31
33
|
</div>
|
|
32
34
|
```
|
|
@@ -29,6 +29,7 @@ sidebar: doc
|
|
|
29
29
|
| inline | 是否展示内联模式 | `boolean` | `flase` |
|
|
30
30
|
| resize | 指定textarea输入框拖动调整大小的方向,默认只能垂直方向调整 | `"none"` | `"vertical"` | `"horizontal"` | `"both"`' | `"vertical"` |
|
|
31
31
|
| flat | 是否展示扁平样式 | `boolean` | `false` |
|
|
32
|
+
| showCount | 是否展示字符长度提示数字 | `boolean` | `false` |
|
|
32
33
|
|
|
33
34
|
## Search
|
|
34
35
|
|
|
@@ -7,6 +7,7 @@ import {useFrozen} from './useFrozen';
|
|
|
7
7
|
import {CommonInputHTMLAttributes, Events} from '../types';
|
|
8
8
|
import {useAutoRows} from './useAutoRows';
|
|
9
9
|
import { useShowPassword } from './useShowPassword';
|
|
10
|
+
import { useFocus } from './useFocus';
|
|
10
11
|
export * from './search';
|
|
11
12
|
|
|
12
13
|
export type HTMLInputTypes =
|
|
@@ -33,6 +34,7 @@ export type HTMLInputTypes =
|
|
|
33
34
|
| 'time'
|
|
34
35
|
| 'url'
|
|
35
36
|
| 'week'
|
|
37
|
+
| 'maxlength'
|
|
36
38
|
| (string & {});
|
|
37
39
|
|
|
38
40
|
interface InputHTMLAttributes extends CommonInputHTMLAttributes {
|
|
@@ -68,6 +70,7 @@ export interface InputProps<V extends Value = Value> extends InputHTMLAttributes
|
|
|
68
70
|
resize?: 'none' | 'vertical' | 'horizontal' | 'both'
|
|
69
71
|
showPassword?: boolean
|
|
70
72
|
flat?: boolean
|
|
73
|
+
showCount?: boolean
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
export type AutoRows = {
|
|
@@ -109,6 +112,7 @@ const typeDefs: Required<TypeDefs<Omit<InputProps, keyof InputHTMLAttributes>>>
|
|
|
109
112
|
resize: ['none', 'vertical', 'horizontal', 'both'],
|
|
110
113
|
showPassword: Boolean,
|
|
111
114
|
flat: Boolean,
|
|
115
|
+
showCount: Boolean,
|
|
112
116
|
}
|
|
113
117
|
|
|
114
118
|
const defaults = (): Partial<InputProps> => ({
|
|
@@ -136,6 +140,7 @@ export class Input<V extends Value = Value> extends Component<InputProps<V>, Inp
|
|
|
136
140
|
private frozen = useFrozen();
|
|
137
141
|
private autoRows = useAutoRows(this.inputRef);
|
|
138
142
|
private showPassword = useShowPassword();
|
|
143
|
+
private focusHook = useFocus();
|
|
139
144
|
|
|
140
145
|
focus() {
|
|
141
146
|
this.inputRef.value!.focus();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {Icon} from '../icon';
|
|
2
|
-
import {addStyle, isTextBlock, getRestProps} from '../utils';
|
|
2
|
+
import {addStyle, isTextBlock, getRestProps, stopPropagation} from '../utils';
|
|
3
3
|
import {makeStyles} from './styles';
|
|
4
4
|
import {noop, isNullOrUndefined, isStringOrNumber} from 'intact-shared';
|
|
5
5
|
import {Wave} from '../wave';
|
|
@@ -9,7 +9,7 @@ const {
|
|
|
9
9
|
className, style, type, value, defaultValue, placeholder,
|
|
10
10
|
clearable, disabled, size, rows, autoWidth, fluid,
|
|
11
11
|
width, stackClearIcon, frozenOnInput, readonly, inline,
|
|
12
|
-
waveDisabled, resize, flat,
|
|
12
|
+
waveDisabled, resize, flat, showCount, maxlength,
|
|
13
13
|
|
|
14
14
|
'ev-click': click,
|
|
15
15
|
'ev-mounseenter': mouseenter,
|
|
@@ -23,6 +23,7 @@ const {
|
|
|
23
23
|
originalValue: {value: originalValue},
|
|
24
24
|
startInput, onInput, endInput
|
|
25
25
|
} = this.frozen;
|
|
26
|
+
const { isFocus, focusInputOnClick }= this.focusHook;
|
|
26
27
|
|
|
27
28
|
const isNotAutoRows = isStringOrNumber(rows) && rows !== 'auto';
|
|
28
29
|
|
|
@@ -31,14 +32,14 @@ const classNameObj = {
|
|
|
31
32
|
[`k-${size}`]: size !== 'default',
|
|
32
33
|
'k-group': $blocks.prepend || $blocks.append,
|
|
33
34
|
'k-disabled': disabled,
|
|
34
|
-
'k-with-prefix': $blocks.prefix,
|
|
35
|
-
'k-with-suffix': $blocks.suffix,
|
|
36
35
|
'k-clearable': clearable,
|
|
37
36
|
'k-auto-width': autoWidth,
|
|
38
37
|
'k-fluid': fluid,
|
|
39
38
|
'k-stack-clear': stackClearIcon,
|
|
40
39
|
'k-inline': inline,
|
|
41
40
|
'k-flat': flat,
|
|
41
|
+
'k-type-textarea': type === 'textarea',
|
|
42
|
+
'k-focus': isFocus.value,
|
|
42
43
|
[`k-resize-${resize}`]: type === 'textarea' && isNotAutoRows,
|
|
43
44
|
[`k-resize-none`]: type === 'textarea' && !isNotAutoRows,
|
|
44
45
|
[className]: className,
|
|
@@ -67,6 +68,7 @@ const inputProps = {
|
|
|
67
68
|
readOnly: readonly,
|
|
68
69
|
placeholder,
|
|
69
70
|
disabled,
|
|
71
|
+
maxLength: maxlength,
|
|
70
72
|
ref: this.inputRef,
|
|
71
73
|
style: autoWidth && fakeWidth ? {width: fakeWidth + 'px'} : undefined,
|
|
72
74
|
};
|
|
@@ -95,8 +97,8 @@ if (hasInputValue) {
|
|
|
95
97
|
}}
|
|
96
98
|
<ErrorContext.Consumer defaultValue={false}>
|
|
97
99
|
{isInvalid => {
|
|
98
|
-
return <Wave disabled={waveDisabled || disabled || isInvalid}>
|
|
99
|
-
<div class="k-input-wrapper">
|
|
100
|
+
return <Wave disabled={waveDisabled || disabled || isInvalid} inset="-2px">
|
|
101
|
+
<div class="k-input-wrapper" ev-click={focusInputOnClick}>
|
|
100
102
|
<div class="k-input-prefix" v-if={$blocks.prefix}>
|
|
101
103
|
<b:prefix />
|
|
102
104
|
</div>
|
|
@@ -111,31 +113,37 @@ if (hasInputValue) {
|
|
|
111
113
|
rows={isNotAutoRows ? rows : 1}
|
|
112
114
|
style={height.value ? addStyle(inputProps.style, { height: height.value + 'px' }) : inputProps.style}
|
|
113
115
|
></textarea>
|
|
114
|
-
<div class="k-input-suffix"
|
|
116
|
+
<div class="k-input-suffix"
|
|
117
|
+
v-if={$blocks.suffix || clearable && !disabled || showPasswordIcon.value || showCount}
|
|
118
|
+
ev-click={stopPropagation}
|
|
119
|
+
>
|
|
115
120
|
<template v-if={showPasswordIcon.value}>
|
|
116
121
|
<Icon hoverable
|
|
117
122
|
class={{
|
|
118
123
|
"k-input-show-password": true,
|
|
119
|
-
"
|
|
120
|
-
"
|
|
124
|
+
"k-icon-hidden": !isShowPassword.value,
|
|
125
|
+
"k-icon-visible": isShowPassword.value,
|
|
121
126
|
}}
|
|
122
127
|
ev-click={toggleShowPassword}
|
|
123
128
|
/>{' '}
|
|
124
129
|
</template>
|
|
125
130
|
<Icon v-if={clearable && !disabled}
|
|
126
131
|
class={{
|
|
127
|
-
"k-input-clear
|
|
132
|
+
"k-input-clear k-icon-error-fill": true,
|
|
128
133
|
"k-input-show": hasValue,
|
|
129
134
|
}}
|
|
130
135
|
ev-click={this.clear}
|
|
131
136
|
hoverable
|
|
132
137
|
/>{' '}
|
|
138
|
+
<span class="k-input-count" v-if={showCount}>
|
|
139
|
+
{hasValue ? value.length : 0}
|
|
140
|
+
<span v-if={maxlength}> / {maxlength}</span>
|
|
141
|
+
</span>
|
|
133
142
|
<b:suffix />
|
|
134
143
|
</div>
|
|
135
|
-
<div v-if={autoWidth}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
>{!hasValue ? placeholder : inputValue}</div>
|
|
144
|
+
<div class="k-input-fake" v-if={autoWidth}>
|
|
145
|
+
<span ref={fakeRef}>{!hasValue ? placeholder : inputValue}</span>
|
|
146
|
+
</div>
|
|
139
147
|
</div>
|
|
140
148
|
</Wave>
|
|
141
149
|
}}
|
|
@@ -9,14 +9,12 @@ const {
|
|
|
9
9
|
type, size, open,
|
|
10
10
|
} = this.get();
|
|
11
11
|
|
|
12
|
-
const isTypeNotDefault = type !== 'default';
|
|
13
|
-
|
|
14
12
|
const classNameObj = {
|
|
15
13
|
'k-search': true,
|
|
16
14
|
[className]: className,
|
|
17
15
|
'k-open': open,
|
|
18
16
|
'k-hide': !open,
|
|
19
|
-
[`k-${type}`]:
|
|
17
|
+
[`k-${type}`]: type,
|
|
20
18
|
[makeSearchStyles()]: true,
|
|
21
19
|
};
|
|
22
20
|
|
|
@@ -32,8 +30,7 @@ const classNameObj = {
|
|
|
32
30
|
ev-$change:value={this.onChangeValue}
|
|
33
31
|
readonly={!open}
|
|
34
32
|
size={size}
|
|
35
|
-
|
|
36
|
-
waveDisabled={isTypeNotDefault}
|
|
33
|
+
waveDisabled={type !== 'default'}
|
|
37
34
|
/>
|
|
38
35
|
<Button icon type="none" ev-click={this.onClickBtn} size={size}>
|
|
39
36
|
<Icon class="k-icon-search k-search-icon" />
|