@king-design/intact 3.4.4 → 3.5.0-beta.0
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/input/index.spec.ts +11 -0
- package/components/input/index.vdt +1 -1
- package/components/input/styles.ts +3 -0
- package/components/select/base.vdt +2 -0
- package/components/select/index.spec.ts +9 -0
- package/components/table/column.vdt +0 -1
- package/components/table/demos/group.md +1 -1
- package/es/components/input/index.spec.js +23 -4
- package/es/components/input/index.vdt.js +1 -1
- package/es/components/input/styles.js +1 -1
- package/es/components/select/base.vdt.js +4 -2
- package/es/components/select/index.spec.js +13 -1
- package/es/components/table/column.vdt.js +0 -1
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/index.ts +2 -2
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ import SearchDemo from '~/components/input/demos/search';
|
|
|
4
4
|
import FrozenDemo from '~/components/input/demos/frozen';
|
|
5
5
|
import AutoRowsDemo from '~/components/input/demos/autoRows';
|
|
6
6
|
import PasswordDemo from '~/components/input/demos/password';
|
|
7
|
+
import AutoWidthDemo from '~/components/input/demos/autowidth';
|
|
7
8
|
import {Input} from './';
|
|
8
9
|
import {Dialog} from '../dialog';
|
|
9
10
|
import { Component } from 'intact';
|
|
@@ -166,4 +167,14 @@ describe('Input', () => {
|
|
|
166
167
|
const width = parseInt(dialog.querySelector<HTMLInputElement>('.k-input-inner')!.style.width);
|
|
167
168
|
expect(width).to.gt(1);
|
|
168
169
|
});
|
|
170
|
+
|
|
171
|
+
it('autoWidth', async() => {
|
|
172
|
+
// should expand when input spaces
|
|
173
|
+
const [instance, element] = mount(AutoWidthDemo);
|
|
174
|
+
const input = element.querySelector('input') as HTMLInputElement;
|
|
175
|
+
input.value = 'ab ';
|
|
176
|
+
dispatchEvent(input, 'input');
|
|
177
|
+
await wait(50);
|
|
178
|
+
expect(input.offsetWidth).to.gt(16);
|
|
179
|
+
});
|
|
169
180
|
});
|
|
@@ -143,7 +143,7 @@ if (hasInputValue) {
|
|
|
143
143
|
<b:suffix />
|
|
144
144
|
</div>
|
|
145
145
|
<div class={`${k}-input-fake`} v-if={autoWidth}>
|
|
146
|
-
<
|
|
146
|
+
<pre ref={fakeRef}>{!hasValue ? (hasInputValue || !defaultValue ? placeholder : defaultValue) : inputValue}</pre>
|
|
147
147
|
</div>
|
|
148
148
|
</div>
|
|
149
149
|
</Wave>
|
|
@@ -54,6 +54,7 @@ const filterInput = <Input v-if={filterable}
|
|
|
54
54
|
readonly={!show}
|
|
55
55
|
waveDisabled={true}
|
|
56
56
|
flat={flat}
|
|
57
|
+
frozenOnInput
|
|
57
58
|
/>
|
|
58
59
|
|
|
59
60
|
<ErrorContext.Consumer defaultValue={false}>
|
|
@@ -95,6 +96,7 @@ const filterInput = <Input v-if={filterable}
|
|
|
95
96
|
readonly={!show}
|
|
96
97
|
waveDisabled={true}
|
|
97
98
|
flat={flat}
|
|
99
|
+
frozenOnInput
|
|
98
100
|
/>
|
|
99
101
|
<div class={`${k}-select-placeholder c-ellipsis`}
|
|
100
102
|
v-else-if={!filterable && !hasValue}
|
|
@@ -159,6 +159,15 @@ describe('Select', () => {
|
|
|
159
159
|
dispatchEvent(document, 'keydown', {keyCode: 13});
|
|
160
160
|
await wait();
|
|
161
161
|
expect(instance.get('day1')).to.eql('Wednesday');
|
|
162
|
+
|
|
163
|
+
// should input spaces
|
|
164
|
+
input1.click();
|
|
165
|
+
await wait();
|
|
166
|
+
dispatchEvent(input1, 'focus');
|
|
167
|
+
input1.value = 'm ';
|
|
168
|
+
dispatchEvent(input1, 'input');
|
|
169
|
+
await wait();
|
|
170
|
+
expect(input1.value).to.eql('m ');
|
|
162
171
|
});
|
|
163
172
|
|
|
164
173
|
it('group', async () => {
|
|
@@ -5,7 +5,7 @@ order: 18
|
|
|
5
5
|
|
|
6
6
|
分组需要两个`group`来指定:
|
|
7
7
|
|
|
8
|
-
1. 第一个是`Table`上的`group`属性,该属性指定当前分组的方式,形式为:`{
|
|
8
|
+
1. 第一个是`Table`上的`group`属性,该属性指定当前分组的方式,形式为:`{分组的列的key: ["当前列选择的分组的值"]}`。
|
|
9
9
|
对于“全部”选项,`value`需要设为空字符串`""`,这样才能在选择“全部”的时候,不高亮筛选按钮
|
|
10
10
|
2. 第二个是`TableColumn`的`group`属性,该属性指定当前列有哪些可选的分组方式,形式为:`[{label: "分组展示文案", value: "选择后的值"}]`。
|
|
11
11
|
如果该列支持多选,还可以添加`multiple`属性,默认为单选
|
|
@@ -3,18 +3,17 @@ import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
|
3
3
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
4
4
|
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
5
5
|
import BasicDemo from '~/components/input/demos/basic';
|
|
6
|
-
import { mount,
|
|
6
|
+
import { mount, dispatchEvent, wait, getElement } from '../../test/utils';
|
|
7
7
|
import SearchDemo from '~/components/input/demos/search';
|
|
8
8
|
import FrozenDemo from '~/components/input/demos/frozen';
|
|
9
9
|
import AutoRowsDemo from '~/components/input/demos/autoRows';
|
|
10
10
|
import PasswordDemo from '~/components/input/demos/password';
|
|
11
|
+
import AutoWidthDemo from '~/components/input/demos/autowidth';
|
|
11
12
|
import { Input } from './';
|
|
12
13
|
import { Dialog } from '../dialog';
|
|
13
14
|
import { Component } from 'intact';
|
|
14
15
|
describe('Input', function () {
|
|
15
|
-
afterEach(
|
|
16
|
-
unmount();
|
|
17
|
-
});
|
|
16
|
+
// afterEach(() => {unmount()});
|
|
18
17
|
it('basic test', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
19
18
|
var _mount, instance, element, input;
|
|
20
19
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
@@ -238,4 +237,24 @@ describe('Input', function () {
|
|
|
238
237
|
}
|
|
239
238
|
}, _callee6);
|
|
240
239
|
})));
|
|
240
|
+
it('autoWidth', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
241
|
+
var _mount7, instance, element, input;
|
|
242
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context8) {
|
|
243
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
244
|
+
case 0:
|
|
245
|
+
// should expand when input spaces
|
|
246
|
+
_mount7 = mount(AutoWidthDemo), instance = _mount7[0], element = _mount7[1];
|
|
247
|
+
input = element.querySelector('input');
|
|
248
|
+
input.value = 'ab ';
|
|
249
|
+
dispatchEvent(input, 'input');
|
|
250
|
+
_context8.next = 6;
|
|
251
|
+
return wait(50);
|
|
252
|
+
case 6:
|
|
253
|
+
expect(input.offsetWidth).to.gt(16);
|
|
254
|
+
case 7:
|
|
255
|
+
case "end":
|
|
256
|
+
return _context8.stop();
|
|
257
|
+
}
|
|
258
|
+
}, _callee7);
|
|
259
|
+
})));
|
|
241
260
|
});
|
|
@@ -133,7 +133,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
133
133
|
return block ? block.call($this, callBlock, data) : callBlock();
|
|
134
134
|
}, __$blocks['suffix'](_$no))], 0, _$cn(k + "-input-suffix"), {
|
|
135
135
|
'ev-click': stopPropagation
|
|
136
|
-
}) : undefined, autoWidth ? _$ce(2, 'div', _$ce(2, '
|
|
136
|
+
}) : undefined, autoWidth ? _$ce(2, 'div', _$ce(2, 'pre', !hasValue ? hasInputValue || !defaultValue ? placeholder : defaultValue : inputValue, 0, null, null, null, fakeRef), 2, _$cn(k + "-input-fake")) : undefined], 0, _$cn(k + "-input-wrapper"), {
|
|
137
137
|
'ev-click': focusInputOnClick
|
|
138
138
|
})
|
|
139
139
|
});
|
|
@@ -125,7 +125,7 @@ export var makeStyles = cache(function makeStyles(k) {
|
|
|
125
125
|
return /*#__PURE__*/css("&.", k, "-", size, "{", sizeClassName, ";}");
|
|
126
126
|
}), "&.", k, "-inline{.", k, "-input-wrapper{height:auto;border:none;border-radius:0;padding:0;}}&.", k, "-type-textarea{.", k, "-input-wrapper{display:inline-block;padding:0;height:auto;}.", k, "-textarea{width:100%;padding:", input.textareaPadding, ";line-height:1.5;vertical-align:top;}.", k, "-input-suffix{margin:0;justify-content:flex-end;}}", _mapInstanceProperty(_context = Input.typeDefs.resize).call(_context, function (type) {
|
|
127
127
|
return /*#__PURE__*/css("&.", k, "-resize-", type, "{.", k, "-textarea{resize:", type, ";}}");
|
|
128
|
-
}), ".", k, "-input-fake{left:0;top:0;position:absolute;overflow:hidden;visibility:hidden;white-space:nowrap;}&.", k, "-auto-width{width:auto;max-width:100%;}.", k, "-input-count{color:", input.count.color, ";}");
|
|
128
|
+
}), ".", k, "-input-fake{left:0;top:0;position:absolute;overflow:hidden;visibility:hidden;white-space:nowrap;pre{font-family:inherit;}}&.", k, "-auto-width{width:auto;max-width:100%;}.", k, "-input-count{color:", input.count.color, ";}");
|
|
129
129
|
});
|
|
130
130
|
export var makeSearchStyles = cache(function makeSearchStyles(k) {
|
|
131
131
|
return /*#__PURE__*/css("position:relative;display:inline-block;.", k, "-input{transition:width ", input.transition, ";}.", k, "-btn{position:absolute;top:0;right:0;z-index:1;}&.", k, "-default .", k, "-btn:hover{background:transparent;}.", k, "-input-suffix{margin-right:", input.search.suffixMarginRight, ";}&.", k, "-hide{", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
@@ -71,7 +71,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
71
71
|
'key': 'filter',
|
|
72
72
|
'readonly': !show,
|
|
73
73
|
'waveDisabled': true,
|
|
74
|
-
'flat': flat
|
|
74
|
+
'flat': flat,
|
|
75
|
+
'frozenOnInput': true
|
|
75
76
|
}, 'filter', inputRef) : undefined;
|
|
76
77
|
return _$cc(ErrorContext.Consumer, {
|
|
77
78
|
'defaultValue': false,
|
|
@@ -122,7 +123,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
122
123
|
'key': 'input',
|
|
123
124
|
'readonly': !show,
|
|
124
125
|
'waveDisabled': true,
|
|
125
|
-
'flat': flat
|
|
126
|
+
'flat': flat,
|
|
127
|
+
'frozenOnInput': true
|
|
126
128
|
}, 'input', inputRef) : !filterable && !hasValue ? _$ce(2, 'div', placeholder, 0, _$cn(k + "-select-placeholder c-ellipsis"), null, 'placeholder') : !multiple ? _$ce(2, 'div', (_$blocks['value'] = function ($super) {
|
|
127
129
|
return label;
|
|
128
130
|
}, __$blocks['value'] = function ($super, data) {
|
|
@@ -240,7 +240,19 @@ describe('Select', function () {
|
|
|
240
240
|
return wait();
|
|
241
241
|
case 50:
|
|
242
242
|
expect(instance.get('day1')).to.eql('Wednesday');
|
|
243
|
-
|
|
243
|
+
// should input spaces
|
|
244
|
+
input1.click();
|
|
245
|
+
_context6.next = 54;
|
|
246
|
+
return wait();
|
|
247
|
+
case 54:
|
|
248
|
+
dispatchEvent(input1, 'focus');
|
|
249
|
+
input1.value = 'm ';
|
|
250
|
+
dispatchEvent(input1, 'input');
|
|
251
|
+
_context6.next = 59;
|
|
252
|
+
return wait();
|
|
253
|
+
case 59:
|
|
254
|
+
expect(input1.value).to.eql('m ');
|
|
255
|
+
case 60:
|
|
244
256
|
case "end":
|
|
245
257
|
return _context6.stop();
|
|
246
258
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _sortInstanceProperty from "@babel/runtime-corejs3/core-js/instance/sort";
|
|
2
2
|
import { createUnknownComponentVNode as _$cc, createElementVNode as _$ce, className as _$cn, noop as _$no, extend as _$ex, EMPTY_OBJ as _$em, map as _$ma } from 'intact';
|
|
3
3
|
import { getClassAndStyleForFixed } from './useFixedColumns';
|
|
4
|
-
import { getStyleForLastColumn } from './useColumns';
|
|
5
4
|
import { Dropdown, DropdownMenu, DropdownItem } from '../dropdown';
|
|
6
5
|
import { Button } from '../button';
|
|
7
6
|
import { Icon } from '../icon';
|
package/es/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v3.
|
|
2
|
+
* @king-design v3.5.0-beta.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -64,4 +64,4 @@ export * from './components/treeSelect';
|
|
|
64
64
|
export * from './components/upload';
|
|
65
65
|
export * from './components/view';
|
|
66
66
|
export * from './components/wave';
|
|
67
|
-
export declare const version = "3.
|
|
67
|
+
export declare const version = "3.5.0-beta.0";
|
package/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v3.
|
|
2
|
+
* @king-design v3.5.0-beta.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -65,5 +65,5 @@ export * from './components/treeSelect';
|
|
|
65
65
|
export * from './components/upload';
|
|
66
66
|
export * from './components/view';
|
|
67
67
|
export * from './components/wave';
|
|
68
|
-
export var version = '3.
|
|
68
|
+
export var version = '3.5.0-beta.0';
|
|
69
69
|
/* generate end */
|
package/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v3.
|
|
2
|
+
* @king-design v3.5.0-beta.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -69,6 +69,6 @@ export * from './components/upload';
|
|
|
69
69
|
export * from './components/view';
|
|
70
70
|
export * from './components/wave';
|
|
71
71
|
|
|
72
|
-
export const version = '3.
|
|
72
|
+
export const version = '3.5.0-beta.0';
|
|
73
73
|
|
|
74
74
|
/* generate end */
|