@gm-pc/react 1.28.0-beta.10 → 1.28.0-beta.11
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gm-pc/react",
|
|
3
|
-
"version": "1.28.0-beta.
|
|
3
|
+
"version": "1.28.0-beta.11",
|
|
4
4
|
"description": "观麦前端基础组件库",
|
|
5
5
|
"author": "liyatang <liyatang@qq.com>",
|
|
6
6
|
"homepage": "https://github.com/gmfe/gm-pc#readme",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@gm-common/hooks": "^2.10.0",
|
|
26
26
|
"@gm-common/tool": "^2.10.0",
|
|
27
|
-
"@gm-pc/locales": "^1.28.0-beta.
|
|
27
|
+
"@gm-pc/locales": "^1.28.0-beta.11",
|
|
28
28
|
"big.js": "^6.0.1",
|
|
29
29
|
"classnames": "^2.2.5",
|
|
30
30
|
"lodash": "^4.17.19",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"react-router-dom": "^5.2.0",
|
|
49
49
|
"react-window": "^1.8.5"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "740fa35594c216a01956599921e3ed94038ffdb3"
|
|
52
52
|
}
|
|
@@ -401,19 +401,74 @@ class MoreSelectBase<V extends string | number = string> extends Component<
|
|
|
401
401
|
renderListItem,
|
|
402
402
|
listHeight,
|
|
403
403
|
} = this.props
|
|
404
|
+
|
|
405
|
+
const selectedValues = new Set(selected.map((v) => v.value))
|
|
406
|
+
|
|
407
|
+
// 分离已勾选和未勾选的数据
|
|
408
|
+
const selectedGroups: MoreSelectGroupDataItem<V>[] = []
|
|
409
|
+
const availableGroups: MoreSelectGroupDataItem<V>[] = []
|
|
410
|
+
|
|
411
|
+
filterData.forEach((group) => {
|
|
412
|
+
const selectedChildren = group.children.filter((item) =>
|
|
413
|
+
selectedValues.has(item.value)
|
|
414
|
+
)
|
|
415
|
+
const availableChildren = group.children.filter(
|
|
416
|
+
(item) => !selectedValues.has(item.value)
|
|
417
|
+
)
|
|
418
|
+
|
|
419
|
+
if (selectedChildren.length > 0) {
|
|
420
|
+
selectedGroups.push({
|
|
421
|
+
...group,
|
|
422
|
+
children: selectedChildren,
|
|
423
|
+
})
|
|
424
|
+
}
|
|
425
|
+
if (availableChildren.length > 0) {
|
|
426
|
+
availableGroups.push({
|
|
427
|
+
...group,
|
|
428
|
+
children: availableChildren,
|
|
429
|
+
})
|
|
430
|
+
}
|
|
431
|
+
})
|
|
432
|
+
|
|
404
433
|
return (
|
|
405
|
-
<
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
434
|
+
<div style={{ height: listHeight, overflow: 'auto' }}>
|
|
435
|
+
{selectedGroups.length > 0 && (
|
|
436
|
+
<>
|
|
437
|
+
<div className='gm-more-select-section-title gm-padding-5 gm-text-desc gm-text-12'>
|
|
438
|
+
已勾选
|
|
439
|
+
</div>
|
|
440
|
+
<ListBase
|
|
441
|
+
selected={selected.map((v) => v.value)}
|
|
442
|
+
data={selectedGroups}
|
|
443
|
+
multiple={multiple}
|
|
444
|
+
isGroupList={isGroupList}
|
|
445
|
+
className='gm-border-0'
|
|
446
|
+
renderItem={renderListItem}
|
|
447
|
+
onSelect={this._handleSelect}
|
|
448
|
+
isScrollTo={false}
|
|
449
|
+
willActiveIndex={willActiveIndex!}
|
|
450
|
+
/>
|
|
451
|
+
</>
|
|
452
|
+
)}
|
|
453
|
+
{availableGroups.length > 0 && (
|
|
454
|
+
<>
|
|
455
|
+
<div className='gm-more-select-section-title gm-padding-5 gm-text-desc gm-text-12'>
|
|
456
|
+
可选择的筛选项
|
|
457
|
+
</div>
|
|
458
|
+
<ListBase
|
|
459
|
+
selected={selected.map((v) => v.value)}
|
|
460
|
+
data={availableGroups}
|
|
461
|
+
multiple={multiple}
|
|
462
|
+
isGroupList={isGroupList}
|
|
463
|
+
className='gm-border-0'
|
|
464
|
+
renderItem={renderListItem}
|
|
465
|
+
onSelect={this._handleSelect}
|
|
466
|
+
isScrollTo={false}
|
|
467
|
+
willActiveIndex={willActiveIndex!}
|
|
468
|
+
/>
|
|
469
|
+
</>
|
|
470
|
+
)}
|
|
471
|
+
</div>
|
|
417
472
|
)
|
|
418
473
|
}
|
|
419
474
|
}
|
|
@@ -8,7 +8,7 @@ class MoreSelect<V = any> extends Component<MoreSelectProps<V>> {
|
|
|
8
8
|
renderSelected: (item: MoreSelectDataItem<any>) => item.text,
|
|
9
9
|
renderListItem: (item: MoreSelectDataItem<any>) => item.text,
|
|
10
10
|
delay: 500,
|
|
11
|
-
listHeight: '
|
|
11
|
+
listHeight: '280px',
|
|
12
12
|
renderListFilterType: 'default',
|
|
13
13
|
popoverType: 'focus',
|
|
14
14
|
onKeyDown: _.noop,
|