@douyinfe/semi-ui 2.17.0-alpha.1 → 2.17.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/_base/_story/a11y.jsx +2 -2
- package/avatar/__test__/avatar.test.js +3 -3
- package/avatar/interface.ts +1 -1
- package/cascader/_story/cascader.stories.js +91 -1
- package/cascader/index.tsx +35 -26
- package/checkbox/checkbox.tsx +4 -1
- package/collapse/__test__/collapse.test.js +22 -2
- package/collapse/_story/accordion.stories.js +2 -2
- package/collapse/item.tsx +20 -6
- package/collapsible/_story/collapsible.stories.js +6 -6
- package/configProvider/_story/RTLDirection/RTLForm.jsx +1 -1
- package/datePicker/__test__/datePicker.test.js +5 -5
- package/datePicker/_story/datePicker.stories.js +138 -22
- package/datePicker/datePicker.tsx +42 -7
- package/datePicker/monthsGrid.tsx +22 -10
- package/datePicker/quickControl.tsx +62 -16
- package/datePicker/yearAndMonth.tsx +31 -5
- package/dist/css/semi.css +328 -47
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +36811 -36304
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/empty/index.tsx +3 -3
- package/lib/cjs/avatar/interface.d.ts +1 -1
- package/lib/cjs/cascader/index.js +36 -25
- package/lib/cjs/checkbox/checkbox.js +4 -1
- package/lib/cjs/collapse/item.d.ts +8 -0
- package/lib/cjs/collapse/item.js +19 -8
- package/lib/cjs/datePicker/datePicker.d.ts +3 -0
- package/lib/cjs/datePicker/datePicker.js +56 -9
- package/lib/cjs/datePicker/monthsGrid.d.ts +3 -0
- package/lib/cjs/datePicker/monthsGrid.js +14 -3
- package/lib/cjs/datePicker/quickControl.d.ts +6 -0
- package/lib/cjs/datePicker/quickControl.js +61 -14
- package/lib/cjs/datePicker/yearAndMonth.d.ts +3 -0
- package/lib/cjs/datePicker/yearAndMonth.js +15 -3
- package/lib/cjs/empty/index.js +1 -1
- package/lib/cjs/popover/index.d.ts +3 -0
- package/lib/cjs/popover/index.js +4 -2
- package/lib/cjs/select/index.d.ts +6 -1
- package/lib/cjs/select/index.js +130 -72
- package/lib/cjs/select/option.js +4 -2
- package/lib/cjs/tag/index.js +6 -4
- package/lib/cjs/tag/interface.d.ts +1 -0
- package/lib/cjs/tagInput/index.d.ts +13 -1
- package/lib/cjs/tagInput/index.js +217 -91
- package/lib/cjs/timePicker/TimePicker.js +1 -1
- package/lib/cjs/tooltip/index.d.ts +4 -0
- package/lib/cjs/tooltip/index.js +5 -3
- package/lib/cjs/typography/base.js +3 -15
- package/lib/cjs/typography/text.js +1 -11
- package/lib/es/avatar/interface.d.ts +1 -1
- package/lib/es/cascader/index.js +40 -29
- package/lib/es/checkbox/checkbox.js +4 -1
- package/lib/es/collapse/item.d.ts +8 -0
- package/lib/es/collapse/item.js +19 -8
- package/lib/es/datePicker/datePicker.d.ts +3 -0
- package/lib/es/datePicker/datePicker.js +56 -9
- package/lib/es/datePicker/monthsGrid.d.ts +3 -0
- package/lib/es/datePicker/monthsGrid.js +14 -3
- package/lib/es/datePicker/quickControl.d.ts +6 -0
- package/lib/es/datePicker/quickControl.js +61 -15
- package/lib/es/datePicker/yearAndMonth.d.ts +3 -0
- package/lib/es/datePicker/yearAndMonth.js +14 -3
- package/lib/es/empty/index.js +1 -1
- package/lib/es/popover/index.d.ts +3 -0
- package/lib/es/popover/index.js +4 -2
- package/lib/es/select/index.d.ts +6 -1
- package/lib/es/select/index.js +129 -71
- package/lib/es/select/option.js +4 -2
- package/lib/es/tag/index.js +6 -4
- package/lib/es/tag/interface.d.ts +1 -0
- package/lib/es/tagInput/index.d.ts +13 -1
- package/lib/es/tagInput/index.js +217 -93
- package/lib/es/timePicker/TimePicker.js +1 -1
- package/lib/es/tooltip/index.d.ts +4 -0
- package/lib/es/tooltip/index.js +5 -3
- package/lib/es/typography/base.js +3 -15
- package/lib/es/typography/text.js +1 -10
- package/package.json +7 -7
- package/popover/index.tsx +4 -1
- package/select/__test__/select.test.js +5 -3
- package/select/_story/select.stories.js +1 -1
- package/select/_story/select.stories.tsx +2 -2
- package/select/index.tsx +65 -30
- package/select/option.tsx +2 -0
- package/table/_story/Perf/Render/complex.jsx +1 -1
- package/table/_story/Perf/Render/resizableSelection.jsx +1 -1
- package/tag/index.tsx +3 -2
- package/tag/interface.ts +1 -0
- package/tagInput/_story/tagInput.stories.js +20 -2
- package/tagInput/index.tsx +126 -26
- package/timePicker/TimePicker.tsx +1 -1
- package/tooltip/index.tsx +5 -2
- package/typography/_story/typography.stories.js +3 -15
- package/typography/base.tsx +4 -9
- package/typography/text.tsx +1 -9
- package/upload/__test__/upload.test.js +9 -9
- package/upload/_story/upload.stories.js +5 -5
package/_base/_story/a11y.jsx
CHANGED
|
@@ -218,7 +218,7 @@ const initValues = {
|
|
|
218
218
|
preview: true,
|
|
219
219
|
fileInstance: new File([new ArrayBuffer(2048)], 'jiafang1.jpeg', { type: 'image/jpeg' }),
|
|
220
220
|
url:
|
|
221
|
-
'https://
|
|
221
|
+
'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/bag.jpeg',
|
|
222
222
|
},
|
|
223
223
|
{
|
|
224
224
|
uid: '3',
|
|
@@ -229,7 +229,7 @@ const initValues = {
|
|
|
229
229
|
preview: true,
|
|
230
230
|
fileInstance: new File([new ArrayBuffer(2048)], 'jiafang2.jpeg', { type: 'image/jpeg' }),
|
|
231
231
|
url:
|
|
232
|
-
'https://
|
|
232
|
+
'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/bag.jpeg',
|
|
233
233
|
},
|
|
234
234
|
],
|
|
235
235
|
};
|
|
@@ -261,7 +261,7 @@ describe('Avatar', () => {
|
|
|
261
261
|
it('src', () => {
|
|
262
262
|
const element = (
|
|
263
263
|
<Avatar
|
|
264
|
-
src="https://
|
|
264
|
+
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/dy.png"
|
|
265
265
|
style={{ margin: 4 }}
|
|
266
266
|
/>
|
|
267
267
|
);
|
|
@@ -272,7 +272,7 @@ describe('Avatar', () => {
|
|
|
272
272
|
.at(0)
|
|
273
273
|
.props()
|
|
274
274
|
.src
|
|
275
|
-
).toEqual('https://
|
|
275
|
+
).toEqual('https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/dy.png');
|
|
276
276
|
});
|
|
277
277
|
|
|
278
278
|
it('shape', () => {
|
|
@@ -320,7 +320,7 @@ describe('Avatar', () => {
|
|
|
320
320
|
const avatar = mount(
|
|
321
321
|
<Avatar
|
|
322
322
|
onError={spyOnError}
|
|
323
|
-
src="https://
|
|
323
|
+
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/dy.png"
|
|
324
324
|
/>
|
|
325
325
|
);
|
|
326
326
|
avatar
|
package/avatar/interface.ts
CHANGED
|
@@ -38,7 +38,7 @@ export interface AvatarProps extends BaseProps {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export type AvatarGroupShape = 'circle' | 'square';
|
|
41
|
-
export type AvatarGroupSize = 'extra-extra-small' | 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large';
|
|
41
|
+
export type AvatarGroupSize = 'extra-extra-small' | 'extra-small' | 'small' | 'default' | 'medium' | 'large' | 'extra-large';
|
|
42
42
|
export type AvatarGroupOverlapFrom = 'start' | 'end';
|
|
43
43
|
|
|
44
44
|
export interface AvatarGroupProps {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useState, useCallback, useEffect } from 'react';
|
|
2
2
|
import CustomTrigger from './CustomTrigger';
|
|
3
3
|
import { Button, Typography, Toast, Cascader } from '../../index';
|
|
4
4
|
|
|
@@ -262,6 +262,96 @@ const treedataWithNodeLabel = [
|
|
|
262
262
|
}
|
|
263
263
|
];
|
|
264
264
|
|
|
265
|
+
export const issue703 = () => {
|
|
266
|
+
const initialData = [
|
|
267
|
+
{
|
|
268
|
+
label: 'Node1',
|
|
269
|
+
value: '0-0',
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
label: 'Node2',
|
|
273
|
+
value: '0-1',
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
label: 'Node3',
|
|
277
|
+
value: '0-2',
|
|
278
|
+
isLeaf: true
|
|
279
|
+
},
|
|
280
|
+
];
|
|
281
|
+
const [data, setData] = useState(initialData);
|
|
282
|
+
|
|
283
|
+
const updateTreeData = (list, value, children) => {
|
|
284
|
+
return list.map(node => {
|
|
285
|
+
if (node.value === value) {
|
|
286
|
+
return { ...node, children };
|
|
287
|
+
}
|
|
288
|
+
if (node.children) {
|
|
289
|
+
return { ...node, children: updateTreeData(node.children, value, children) };
|
|
290
|
+
}
|
|
291
|
+
return node;
|
|
292
|
+
});
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
const onLoadData = selectedOpt => {
|
|
296
|
+
const targetOpt = selectedOpt[selectedOpt.length - 1];
|
|
297
|
+
const { label, value } = targetOpt;
|
|
298
|
+
return new Promise(resolve => {
|
|
299
|
+
if (targetOpt.children) {
|
|
300
|
+
resolve();
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
setTimeout(() => {
|
|
305
|
+
setData(origin =>
|
|
306
|
+
updateTreeData(origin, value, [
|
|
307
|
+
{
|
|
308
|
+
label: `${label}-1`,
|
|
309
|
+
value: `${label}-1`,
|
|
310
|
+
isLeaf: selectedOpt.length > 1
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
label: `${label}-2`,
|
|
314
|
+
value: `${label}-2`,
|
|
315
|
+
isLeaf: selectedOpt.length > 1
|
|
316
|
+
},
|
|
317
|
+
]),
|
|
318
|
+
);
|
|
319
|
+
resolve();
|
|
320
|
+
}, 1000);
|
|
321
|
+
});
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
const [v,setV]=useState([['0-0'], ['0-1', 'Node2-2']]);
|
|
325
|
+
useEffect(()=>{
|
|
326
|
+
console.log('data change');
|
|
327
|
+
setTimeout(()=>setV([['0-0'], ['0-1', 'Node2-2', 'Node2-2-2']]),0);
|
|
328
|
+
},[data])
|
|
329
|
+
|
|
330
|
+
return (
|
|
331
|
+
<>
|
|
332
|
+
<div>treeData和value动态更新,value中的值在treeData中存在则能够正确显示</div>
|
|
333
|
+
<Cascader
|
|
334
|
+
multiple
|
|
335
|
+
onChange={(a)=>console.log(a)}
|
|
336
|
+
value={v}
|
|
337
|
+
style={{ width: 300 }}
|
|
338
|
+
treeData={data}
|
|
339
|
+
loadData={onLoadData}
|
|
340
|
+
placeholder="Please select"
|
|
341
|
+
/>
|
|
342
|
+
<div>非受控,动态更新treeData</div>
|
|
343
|
+
<Cascader
|
|
344
|
+
multiple
|
|
345
|
+
onChange={(a)=>console.log(a)}
|
|
346
|
+
style={{ width: 300 }}
|
|
347
|
+
treeData={data}
|
|
348
|
+
loadData={onLoadData}
|
|
349
|
+
placeholder="Please select"
|
|
350
|
+
/>
|
|
351
|
+
</>
|
|
352
|
+
);
|
|
353
|
+
};
|
|
354
|
+
|
|
265
355
|
export const _Cascader = () => {
|
|
266
356
|
return (
|
|
267
357
|
<div>
|
package/cascader/index.tsx
CHANGED
|
@@ -394,6 +394,34 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
394
394
|
const treeDataHasChange = prevProps && prevProps.treeData !== props.treeData;
|
|
395
395
|
return firstInProps || treeDataHasChange;
|
|
396
396
|
};
|
|
397
|
+
const getRealKeys = (realValue: Value, keyEntities: Entities) => {
|
|
398
|
+
// normallizedValue is used to save the value in two-dimensional array format
|
|
399
|
+
let normallizedValue: SimpleValueType[][] = [];
|
|
400
|
+
if (Array.isArray(realValue)) {
|
|
401
|
+
normallizedValue = Array.isArray(realValue[0])
|
|
402
|
+
? (realValue as SimpleValueType[][])
|
|
403
|
+
: ([realValue] as SimpleValueType[][]);
|
|
404
|
+
} else {
|
|
405
|
+
if (realValue !== undefined) {
|
|
406
|
+
normallizedValue = [[realValue]];
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
// formatValuePath is used to save value of valuePath
|
|
410
|
+
const formatValuePath: (string | number)[][] = [];
|
|
411
|
+
normallizedValue.forEach((valueItem: SimpleValueType[]) => {
|
|
412
|
+
const formatItem: (string | number)[] = onChangeWithObject ?
|
|
413
|
+
(valueItem as CascaderData[]).map(i => i?.value) :
|
|
414
|
+
valueItem as (string | number)[];
|
|
415
|
+
formatValuePath.push(formatItem);
|
|
416
|
+
});
|
|
417
|
+
// formatKeys is used to save key of value
|
|
418
|
+
const formatKeys: any[] = [];
|
|
419
|
+
formatValuePath.forEach(v => {
|
|
420
|
+
const formatKeyItem = findKeysForValues(v, keyEntities);
|
|
421
|
+
!isEmpty(formatKeyItem) && formatKeys.push(formatKeyItem);
|
|
422
|
+
});
|
|
423
|
+
return formatKeys;
|
|
424
|
+
};
|
|
397
425
|
const needUpdateTreeData = needUpdate('treeData') || needUpdateData();
|
|
398
426
|
const needUpdateValue = needUpdate('value') || (isEmpty(prevProps) && defaultValue);
|
|
399
427
|
if (multiple) {
|
|
@@ -408,34 +436,15 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
408
436
|
let realKeys: Array<string> | Set<string> = prevState.checkedKeys;
|
|
409
437
|
// when data was updated
|
|
410
438
|
if (needUpdateValue) {
|
|
411
|
-
// normallizedValue is used to save the value in two-dimensional array format
|
|
412
|
-
let normallizedValue: SimpleValueType[][] = [];
|
|
413
439
|
const realValue = needUpdate('value') ? value : defaultValue;
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
normallizedValue = [[realValue]];
|
|
422
|
-
}
|
|
440
|
+
realKeys = getRealKeys(realValue, keyEntities);
|
|
441
|
+
} else {
|
|
442
|
+
// needUpdateValue is false
|
|
443
|
+
// if treeData is updated & Cascader is controlled, realKeys should be recalculated
|
|
444
|
+
if (needUpdateTreeData && 'value' in props) {
|
|
445
|
+
const realValue = value;
|
|
446
|
+
realKeys = getRealKeys(realValue, keyEntities);
|
|
423
447
|
}
|
|
424
|
-
// formatValuePath is used to save value of valuePath
|
|
425
|
-
const formatValuePath: (string | number)[][] = [];
|
|
426
|
-
normallizedValue.forEach((valueItem: SimpleValueType[]) => {
|
|
427
|
-
const formatItem: (string | number)[] = onChangeWithObject ?
|
|
428
|
-
(valueItem as CascaderData[]).map(i => i?.value) :
|
|
429
|
-
valueItem as (string | number)[];
|
|
430
|
-
formatValuePath.push(formatItem);
|
|
431
|
-
});
|
|
432
|
-
// formatKeys is used to save key of value
|
|
433
|
-
const formatKeys: any[] = [];
|
|
434
|
-
formatValuePath.forEach(v => {
|
|
435
|
-
const formatKeyItem = findKeysForValues(v, keyEntities);
|
|
436
|
-
!isEmpty(formatKeyItem) && formatKeys.push(formatKeyItem);
|
|
437
|
-
});
|
|
438
|
-
realKeys = formatKeys;
|
|
439
448
|
}
|
|
440
449
|
if (isSet(realKeys)) {
|
|
441
450
|
realKeys = [...realKeys];
|
package/checkbox/checkbox.tsx
CHANGED
|
@@ -139,7 +139,10 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
isInGroup() {
|
|
142
|
-
|
|
142
|
+
// Why do we need to determine whether there is a value in props?
|
|
143
|
+
// If there is no value in the props of the checkbox in the context of the checkboxGroup,
|
|
144
|
+
// it will be considered not to belong to the checkboxGroup。
|
|
145
|
+
return Boolean(this.context && this.context.checkboxGroup && ('value' in this.props));
|
|
143
146
|
}
|
|
144
147
|
|
|
145
148
|
focus() {
|
|
@@ -3,11 +3,13 @@ import { BASE_CLASS_PREFIX } from '../../../semi-foundation/base/constants'; //
|
|
|
3
3
|
|
|
4
4
|
import { IconPlus, IconMinus, IconCopy } from '@douyinfe/semi-icons';
|
|
5
5
|
|
|
6
|
-
let getCollapse = collapseProps => {
|
|
6
|
+
let getCollapse = (collapseProps, panel1Props) => {
|
|
7
7
|
let props = collapseProps ? collapseProps : {};
|
|
8
|
+
let panelProps = panel1Props ? panel1Props : {};
|
|
9
|
+
|
|
8
10
|
return (
|
|
9
11
|
<Collapse {...collapseProps}>
|
|
10
|
-
<Collapse.Panel header="This is panel header 1" itemKey="1">
|
|
12
|
+
<Collapse.Panel header="This is panel header 1" itemKey="1" {...panelProps}>
|
|
11
13
|
<p>Hi, bytedance dance dance. This is the docsite of Semi UI. </p>
|
|
12
14
|
</Collapse.Panel>
|
|
13
15
|
<Collapse.Panel header="This is panel header 2" itemKey="2">
|
|
@@ -145,4 +147,22 @@ describe('Collapse', () => {
|
|
|
145
147
|
expect(headers.at(1).getDOMNode().getAttribute(expandAttr)).toEqual("false");
|
|
146
148
|
expect(headers.at(2).getDOMNode().getAttribute(expandAttr)).toEqual("true");
|
|
147
149
|
});
|
|
150
|
+
|
|
151
|
+
it('disable Collapse', () => {
|
|
152
|
+
let props = {
|
|
153
|
+
disabled: true,
|
|
154
|
+
};
|
|
155
|
+
const disabledPanel = mount(getCollapse({}, props));
|
|
156
|
+
expect(disabledPanel.exists('.semi-collapse-header-disabled')).toEqual(true);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it('hide the panel icon', () => {
|
|
160
|
+
const hidePanelArrow = mount(
|
|
161
|
+
<Collapse >
|
|
162
|
+
<Collapse.Panel header="This is panel header 1" itemKey="1" showArrow={false}>
|
|
163
|
+
<p>Hi, bytedance dance dance. This is the docsite of Semi UI. </p>
|
|
164
|
+
</Collapse.Panel>
|
|
165
|
+
</Collapse>);
|
|
166
|
+
expect(hidePanelArrow.exists('.semi-collapse-header-icon')).toEqual(false);
|
|
167
|
+
});
|
|
148
168
|
});
|
|
@@ -17,7 +17,7 @@ export default {
|
|
|
17
17
|
export const RegularCollapse = () => (
|
|
18
18
|
<div>
|
|
19
19
|
<Collapse onChange={k => console.log(k)}>
|
|
20
|
-
<Panel header="This is panel header 1" itemKey="1">
|
|
20
|
+
<Panel header="This is panel header 1" itemKey="1" showArrow={false}>
|
|
21
21
|
<p>{text}</p>
|
|
22
22
|
</Panel>
|
|
23
23
|
<Panel header="This is panel header 2" itemKey="2">
|
|
@@ -32,7 +32,7 @@ export const RegularCollapse = () => (
|
|
|
32
32
|
<Panel header="This is panel header 1" itemKey="1">
|
|
33
33
|
<p>{text}</p>
|
|
34
34
|
</Panel>
|
|
35
|
-
<Panel header="This is panel header 2" itemKey="124">
|
|
35
|
+
<Panel header="This is panel header 2" itemKey="124" disabled>
|
|
36
36
|
<p>{text}</p>
|
|
37
37
|
</Panel>
|
|
38
38
|
<Panel header="This is panel header 3" itemKey="3" disabled>
|
package/collapse/item.tsx
CHANGED
|
@@ -15,6 +15,8 @@ export interface CollapsePanelProps {
|
|
|
15
15
|
children?: React.ReactNode;
|
|
16
16
|
reCalcKey?: number | string;
|
|
17
17
|
style?: CSSProperties;
|
|
18
|
+
showArrow?: boolean,
|
|
19
|
+
disabled?: boolean,
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
export default class CollapsePanel extends PureComponent<CollapsePanelProps> {
|
|
@@ -32,6 +34,13 @@ export default class CollapsePanel extends PureComponent<CollapsePanelProps> {
|
|
|
32
34
|
PropTypes.string,
|
|
33
35
|
PropTypes.number,
|
|
34
36
|
]),
|
|
37
|
+
showArrow: PropTypes.bool,
|
|
38
|
+
disabled: PropTypes.bool,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
static defaultProps = {
|
|
42
|
+
showArrow: true,
|
|
43
|
+
disabled: false,
|
|
35
44
|
};
|
|
36
45
|
|
|
37
46
|
private ariaID = getUuidShort({});
|
|
@@ -40,6 +49,7 @@ export default class CollapsePanel extends PureComponent<CollapsePanelProps> {
|
|
|
40
49
|
|
|
41
50
|
renderHeader(active: boolean, expandIconEnable = true) {
|
|
42
51
|
const {
|
|
52
|
+
showArrow,
|
|
43
53
|
header,
|
|
44
54
|
extra,
|
|
45
55
|
} = this.props;
|
|
@@ -65,20 +75,20 @@ export default class CollapsePanel extends PureComponent<CollapsePanelProps> {
|
|
|
65
75
|
if (typeof header === 'string') {
|
|
66
76
|
return (
|
|
67
77
|
<>
|
|
68
|
-
{iconPosLeft ? icon : null}
|
|
78
|
+
{showArrow && (iconPosLeft ? icon : null)}
|
|
69
79
|
<span>{header}</span>
|
|
70
80
|
<span className={`${cssClasses.PREFIX}-header-right`}>
|
|
71
81
|
<span>{extra}</span>
|
|
72
|
-
{iconPosLeft ? null : icon}
|
|
82
|
+
{showArrow && (iconPosLeft ? null : icon)}
|
|
73
83
|
</span>
|
|
74
84
|
</>
|
|
75
85
|
);
|
|
76
86
|
}
|
|
77
87
|
return (
|
|
78
88
|
<>
|
|
79
|
-
{iconPosLeft ? icon : null}
|
|
89
|
+
{showArrow && (iconPosLeft ? icon : null)}
|
|
80
90
|
{header}
|
|
81
|
-
{iconPosLeft ? null : icon}
|
|
91
|
+
{showArrow && (iconPosLeft ? null : icon)}
|
|
82
92
|
</>
|
|
83
93
|
);
|
|
84
94
|
}
|
|
@@ -91,6 +101,8 @@ export default class CollapsePanel extends PureComponent<CollapsePanelProps> {
|
|
|
91
101
|
reCalcKey,
|
|
92
102
|
header,
|
|
93
103
|
extra,
|
|
104
|
+
showArrow,
|
|
105
|
+
disabled,
|
|
94
106
|
...restProps
|
|
95
107
|
} = this.props;
|
|
96
108
|
const {
|
|
@@ -106,6 +118,7 @@ export default class CollapsePanel extends PureComponent<CollapsePanelProps> {
|
|
|
106
118
|
});
|
|
107
119
|
const headerCls = cls({
|
|
108
120
|
[`${cssClasses.PREFIX}-header`]: true,
|
|
121
|
+
[`${cssClasses.PREFIX}-header-disabled`]: disabled,
|
|
109
122
|
[`${cssClasses.PREFIX}-header-iconLeft`]: expandIconPosition === 'left',
|
|
110
123
|
});
|
|
111
124
|
const contentCls = cls({
|
|
@@ -120,11 +133,12 @@ export default class CollapsePanel extends PureComponent<CollapsePanelProps> {
|
|
|
120
133
|
role="button"
|
|
121
134
|
tabIndex={0}
|
|
122
135
|
className={headerCls}
|
|
136
|
+
aria-disabled={disabled}
|
|
123
137
|
aria-expanded={active ? 'true' : 'false'}
|
|
124
138
|
aria-owns={this.ariaID}
|
|
125
|
-
onClick={e => onClick(itemKey, e)}
|
|
139
|
+
onClick={e => !disabled && onClick(itemKey, e)}
|
|
126
140
|
>
|
|
127
|
-
{this.renderHeader(active, children !== undefined)}
|
|
141
|
+
{this.renderHeader(active, children !== undefined && !disabled)}
|
|
128
142
|
</div>
|
|
129
143
|
{
|
|
130
144
|
children && (
|
|
@@ -368,7 +368,7 @@ class WithUpload extends React.Component {
|
|
|
368
368
|
status: 'success',
|
|
369
369
|
uid: 'd116a179410eb0ca18e66074509bde93-0',
|
|
370
370
|
url:
|
|
371
|
-
'https://
|
|
371
|
+
'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/bag.jpeg',
|
|
372
372
|
},
|
|
373
373
|
{
|
|
374
374
|
preview: false,
|
|
@@ -376,7 +376,7 @@ class WithUpload extends React.Component {
|
|
|
376
376
|
status: 'success',
|
|
377
377
|
uid: 'b7d579069320590ba4b128672eedbae2-1',
|
|
378
378
|
url:
|
|
379
|
-
'https://
|
|
379
|
+
'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/bag.jpeg',
|
|
380
380
|
},
|
|
381
381
|
{
|
|
382
382
|
preview: false,
|
|
@@ -384,7 +384,7 @@ class WithUpload extends React.Component {
|
|
|
384
384
|
status: 'success',
|
|
385
385
|
uid: 'b7d579069320590ba4b128672eedbae2-2',
|
|
386
386
|
url:
|
|
387
|
-
'https://
|
|
387
|
+
'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/bag.jpeg',
|
|
388
388
|
},
|
|
389
389
|
];
|
|
390
390
|
}
|
|
@@ -410,7 +410,7 @@ class WithUpload extends React.Component {
|
|
|
410
410
|
status: 'success',
|
|
411
411
|
uid: 'd116a179410eb0ca18e66074509bde93-0',
|
|
412
412
|
url:
|
|
413
|
-
'https://
|
|
413
|
+
'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/bag.jpeg',
|
|
414
414
|
},
|
|
415
415
|
{
|
|
416
416
|
preview: false,
|
|
@@ -418,7 +418,7 @@ class WithUpload extends React.Component {
|
|
|
418
418
|
status: 'success',
|
|
419
419
|
uid: 'b7d579069320590ba4b128672eedbae2-1',
|
|
420
420
|
url:
|
|
421
|
-
'https://
|
|
421
|
+
'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/bag.jpeg',
|
|
422
422
|
},
|
|
423
423
|
{
|
|
424
424
|
preview: false,
|
|
@@ -426,7 +426,7 @@ class WithUpload extends React.Component {
|
|
|
426
426
|
status: 'success',
|
|
427
427
|
uid: 'b7d579069320590ba4b128672eedbae2-2',
|
|
428
428
|
url:
|
|
429
|
-
'https://
|
|
429
|
+
'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/bag.jpeg',
|
|
430
430
|
},
|
|
431
431
|
]}
|
|
432
432
|
dragMainText="点击上传文件或拖拽文件到这里"
|
|
@@ -35,7 +35,7 @@ class RTLForm extends React.Component {
|
|
|
35
35
|
type: 'image/jpeg',
|
|
36
36
|
}),
|
|
37
37
|
url:
|
|
38
|
-
'https://
|
|
38
|
+
'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/bag.jpeg',
|
|
39
39
|
},
|
|
40
40
|
],
|
|
41
41
|
},
|
|
@@ -114,7 +114,7 @@ describe(`DatePicker`, () => {
|
|
|
114
114
|
const demo = mount(<DatePicker presets={presets} motion={motion} open={open} defaultValue={defaultValue} />);
|
|
115
115
|
const elem = demo.find(BaseDatePicker);
|
|
116
116
|
|
|
117
|
-
const btns = document.querySelectorAll(`.${BASE_CLASS_PREFIX}-datepicker-quick-control
|
|
117
|
+
const btns = document.querySelectorAll(`.${BASE_CLASS_PREFIX}-datepicker-quick-control button`);
|
|
118
118
|
|
|
119
119
|
/**
|
|
120
120
|
* click next day
|
|
@@ -560,7 +560,7 @@ describe(`DatePicker`, () => {
|
|
|
560
560
|
};
|
|
561
561
|
const demo = mount(<DatePicker {...props} />);
|
|
562
562
|
const elem = demo.find(BaseDatePicker);
|
|
563
|
-
const btns = document.querySelectorAll(`.${BASE_CLASS_PREFIX}-datepicker-quick-control
|
|
563
|
+
const btns = document.querySelectorAll(`.${BASE_CLASS_PREFIX}-datepicker-quick-control button`);
|
|
564
564
|
|
|
565
565
|
// click disabled date
|
|
566
566
|
btns[0].click();
|
|
@@ -675,7 +675,7 @@ describe(`DatePicker`, () => {
|
|
|
675
675
|
const demo = mount(<DatePicker onPresetClick={handlePresetClick} presets={presets} motion={motion} open={open} defaultValue={defaultValue} />);
|
|
676
676
|
const elem = demo.find(BaseDatePicker);
|
|
677
677
|
|
|
678
|
-
const btns = document.querySelectorAll(`.${BASE_CLASS_PREFIX}-datepicker-quick-control
|
|
678
|
+
const btns = document.querySelectorAll(`.${BASE_CLASS_PREFIX}-datepicker-quick-control button`);
|
|
679
679
|
|
|
680
680
|
btns[0].click();
|
|
681
681
|
btns[1].click();
|
|
@@ -987,7 +987,7 @@ describe(`DatePicker`, () => {
|
|
|
987
987
|
const demo = mount(<DatePicker {...props} onChange={handleChange} />);
|
|
988
988
|
const elem = demo.find(BaseDatePicker);
|
|
989
989
|
|
|
990
|
-
const btns = document.querySelectorAll('.semi-datepicker-quick-control
|
|
990
|
+
const btns = document.querySelectorAll('.semi-datepicker-quick-control button');
|
|
991
991
|
|
|
992
992
|
btns[0].click();
|
|
993
993
|
expect(handleChange.called).toBeTruthy();
|
|
@@ -1016,7 +1016,7 @@ describe(`DatePicker`, () => {
|
|
|
1016
1016
|
const demo = mount(<DatePicker {...props} onChange={handleChange} onConfirm={handleConfirm} />);
|
|
1017
1017
|
const elem = demo.find(BaseDatePicker);
|
|
1018
1018
|
|
|
1019
|
-
const btns = document.querySelectorAll('.semi-datepicker-quick-control
|
|
1019
|
+
const btns = document.querySelectorAll('.semi-datepicker-quick-control button');
|
|
1020
1020
|
|
|
1021
1021
|
// 点击 preset
|
|
1022
1022
|
btns[0].click();
|