@rc-component/tree-select 1.1.0 → 1.1.1
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/es/OptionList.js +5 -1
- package/es/TreeSelect.js +17 -2
- package/es/TreeSelectContext.d.ts +3 -0
- package/lib/OptionList.js +5 -1
- package/lib/TreeSelect.js +17 -2
- package/lib/TreeSelectContext.d.ts +3 -0
- package/package.json +3 -3
package/es/OptionList.js
CHANGED
|
@@ -42,7 +42,9 @@ const OptionList = (_, ref) => {
|
|
|
42
42
|
onPopupScroll,
|
|
43
43
|
leftMaxCount,
|
|
44
44
|
leafCountOnly,
|
|
45
|
-
valueEntities
|
|
45
|
+
valueEntities,
|
|
46
|
+
classNames: treeClassNames,
|
|
47
|
+
styles
|
|
46
48
|
} = React.useContext(TreeSelectContext);
|
|
47
49
|
const {
|
|
48
50
|
checkable,
|
|
@@ -308,6 +310,8 @@ const OptionList = (_, ref) => {
|
|
|
308
310
|
nodeDisabled
|
|
309
311
|
}
|
|
310
312
|
}, /*#__PURE__*/React.createElement(Tree, _extends({
|
|
313
|
+
classNames: treeClassNames,
|
|
314
|
+
styles: styles,
|
|
311
315
|
ref: treeRef,
|
|
312
316
|
focusable: false,
|
|
313
317
|
prefixCls: `${prefixCls}-tree`,
|
package/es/TreeSelect.js
CHANGED
|
@@ -77,6 +77,8 @@ const TreeSelect = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
77
77
|
treeMotion,
|
|
78
78
|
treeTitleRender,
|
|
79
79
|
onPopupScroll,
|
|
80
|
+
classNames: treeSelectClassNames,
|
|
81
|
+
styles,
|
|
80
82
|
...restProps
|
|
81
83
|
} = props;
|
|
82
84
|
const mergedId = useId(id);
|
|
@@ -441,9 +443,11 @@ const TreeSelect = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
441
443
|
onPopupScroll,
|
|
442
444
|
leftMaxCount: maxCount === undefined ? null : maxCount - cachedDisplayValues.length,
|
|
443
445
|
leafCountOnly: mergedShowCheckedStrategy === 'SHOW_CHILD' && !treeCheckStrictly && !!treeCheckable,
|
|
444
|
-
valueEntities
|
|
446
|
+
valueEntities,
|
|
447
|
+
classNames: treeSelectClassNames,
|
|
448
|
+
styles
|
|
445
449
|
};
|
|
446
|
-
}, [virtual, popupMatchSelectWidth, listHeight, listItemHeight, listItemScrollOffset, filteredTreeData, mergedFieldNames, onOptionSelect, treeExpandAction, treeTitleRender, onPopupScroll, maxCount, cachedDisplayValues.length, mergedShowCheckedStrategy, treeCheckStrictly, treeCheckable, valueEntities]);
|
|
450
|
+
}, [virtual, popupMatchSelectWidth, listHeight, listItemHeight, listItemScrollOffset, filteredTreeData, mergedFieldNames, onOptionSelect, treeExpandAction, treeTitleRender, onPopupScroll, maxCount, cachedDisplayValues.length, mergedShowCheckedStrategy, treeCheckStrictly, treeCheckable, valueEntities, treeSelectClassNames, styles]);
|
|
447
451
|
|
|
448
452
|
// ======================= Legacy Context =======================
|
|
449
453
|
const legacyContext = React.useMemo(() => ({
|
|
@@ -474,7 +478,18 @@ const TreeSelect = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
474
478
|
}, /*#__PURE__*/React.createElement(BaseSelect, _extends({
|
|
475
479
|
ref: ref
|
|
476
480
|
}, restProps, {
|
|
481
|
+
classNames: {
|
|
482
|
+
prefix: treeSelectClassNames?.prefix,
|
|
483
|
+
suffix: treeSelectClassNames?.suffix,
|
|
484
|
+
input: treeSelectClassNames?.input
|
|
485
|
+
},
|
|
486
|
+
styles: {
|
|
487
|
+
prefix: styles?.prefix,
|
|
488
|
+
suffix: styles?.suffix,
|
|
489
|
+
input: styles?.input
|
|
490
|
+
}
|
|
477
491
|
// >>> MISC
|
|
492
|
+
,
|
|
478
493
|
id: mergedId,
|
|
479
494
|
prefixCls: prefixCls,
|
|
480
495
|
mode: mergedMultiple ? 'multiple' : undefined
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import type { ExpandAction } from '@rc-component/tree/lib/Tree';
|
|
3
3
|
import type { DataNode, FieldNames, Key } from './interface';
|
|
4
4
|
import type useDataEntities from './hooks/useDataEntities';
|
|
5
|
+
export type SemanticName = 'item' | 'itemTitle' | 'input' | 'prefix' | 'suffix';
|
|
5
6
|
export interface TreeSelectContextProps {
|
|
6
7
|
virtual?: boolean;
|
|
7
8
|
popupMatchSelectWidth?: boolean | number;
|
|
@@ -20,6 +21,8 @@ export interface TreeSelectContextProps {
|
|
|
20
21
|
/** When `true`, only take leaf node as count, or take all as count with `maxCount` limitation */
|
|
21
22
|
leafCountOnly: boolean;
|
|
22
23
|
valueEntities: ReturnType<typeof useDataEntities>['valueEntities'];
|
|
24
|
+
styles?: Partial<Record<SemanticName, React.CSSProperties>>;
|
|
25
|
+
classNames?: Partial<Record<SemanticName, string>>;
|
|
23
26
|
}
|
|
24
27
|
declare const TreeSelectContext: React.Context<TreeSelectContextProps>;
|
|
25
28
|
export default TreeSelectContext;
|
package/lib/OptionList.js
CHANGED
|
@@ -50,7 +50,9 @@ const OptionList = (_, ref) => {
|
|
|
50
50
|
onPopupScroll,
|
|
51
51
|
leftMaxCount,
|
|
52
52
|
leafCountOnly,
|
|
53
|
-
valueEntities
|
|
53
|
+
valueEntities,
|
|
54
|
+
classNames: treeClassNames,
|
|
55
|
+
styles
|
|
54
56
|
} = React.useContext(_TreeSelectContext.default);
|
|
55
57
|
const {
|
|
56
58
|
checkable,
|
|
@@ -316,6 +318,8 @@ const OptionList = (_, ref) => {
|
|
|
316
318
|
nodeDisabled
|
|
317
319
|
}
|
|
318
320
|
}, /*#__PURE__*/React.createElement(_tree.default, _extends({
|
|
321
|
+
classNames: treeClassNames,
|
|
322
|
+
styles: styles,
|
|
319
323
|
ref: treeRef,
|
|
320
324
|
focusable: false,
|
|
321
325
|
prefixCls: `${prefixCls}-tree`,
|
package/lib/TreeSelect.js
CHANGED
|
@@ -86,6 +86,8 @@ const TreeSelect = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
86
86
|
treeMotion,
|
|
87
87
|
treeTitleRender,
|
|
88
88
|
onPopupScroll,
|
|
89
|
+
classNames: treeSelectClassNames,
|
|
90
|
+
styles,
|
|
89
91
|
...restProps
|
|
90
92
|
} = props;
|
|
91
93
|
const mergedId = (0, _useId.default)(id);
|
|
@@ -450,9 +452,11 @@ const TreeSelect = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
450
452
|
onPopupScroll,
|
|
451
453
|
leftMaxCount: maxCount === undefined ? null : maxCount - cachedDisplayValues.length,
|
|
452
454
|
leafCountOnly: mergedShowCheckedStrategy === 'SHOW_CHILD' && !treeCheckStrictly && !!treeCheckable,
|
|
453
|
-
valueEntities
|
|
455
|
+
valueEntities,
|
|
456
|
+
classNames: treeSelectClassNames,
|
|
457
|
+
styles
|
|
454
458
|
};
|
|
455
|
-
}, [virtual, popupMatchSelectWidth, listHeight, listItemHeight, listItemScrollOffset, filteredTreeData, mergedFieldNames, onOptionSelect, treeExpandAction, treeTitleRender, onPopupScroll, maxCount, cachedDisplayValues.length, mergedShowCheckedStrategy, treeCheckStrictly, treeCheckable, valueEntities]);
|
|
459
|
+
}, [virtual, popupMatchSelectWidth, listHeight, listItemHeight, listItemScrollOffset, filteredTreeData, mergedFieldNames, onOptionSelect, treeExpandAction, treeTitleRender, onPopupScroll, maxCount, cachedDisplayValues.length, mergedShowCheckedStrategy, treeCheckStrictly, treeCheckable, valueEntities, treeSelectClassNames, styles]);
|
|
456
460
|
|
|
457
461
|
// ======================= Legacy Context =======================
|
|
458
462
|
const legacyContext = React.useMemo(() => ({
|
|
@@ -483,7 +487,18 @@ const TreeSelect = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
483
487
|
}, /*#__PURE__*/React.createElement(_select.BaseSelect, _extends({
|
|
484
488
|
ref: ref
|
|
485
489
|
}, restProps, {
|
|
490
|
+
classNames: {
|
|
491
|
+
prefix: treeSelectClassNames?.prefix,
|
|
492
|
+
suffix: treeSelectClassNames?.suffix,
|
|
493
|
+
input: treeSelectClassNames?.input
|
|
494
|
+
},
|
|
495
|
+
styles: {
|
|
496
|
+
prefix: styles?.prefix,
|
|
497
|
+
suffix: styles?.suffix,
|
|
498
|
+
input: styles?.input
|
|
499
|
+
}
|
|
486
500
|
// >>> MISC
|
|
501
|
+
,
|
|
487
502
|
id: mergedId,
|
|
488
503
|
prefixCls: prefixCls,
|
|
489
504
|
mode: mergedMultiple ? 'multiple' : undefined
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import type { ExpandAction } from '@rc-component/tree/lib/Tree';
|
|
3
3
|
import type { DataNode, FieldNames, Key } from './interface';
|
|
4
4
|
import type useDataEntities from './hooks/useDataEntities';
|
|
5
|
+
export type SemanticName = 'item' | 'itemTitle' | 'input' | 'prefix' | 'suffix';
|
|
5
6
|
export interface TreeSelectContextProps {
|
|
6
7
|
virtual?: boolean;
|
|
7
8
|
popupMatchSelectWidth?: boolean | number;
|
|
@@ -20,6 +21,8 @@ export interface TreeSelectContextProps {
|
|
|
20
21
|
/** When `true`, only take leaf node as count, or take all as count with `maxCount` limitation */
|
|
21
22
|
leafCountOnly: boolean;
|
|
22
23
|
valueEntities: ReturnType<typeof useDataEntities>['valueEntities'];
|
|
24
|
+
styles?: Partial<Record<SemanticName, React.CSSProperties>>;
|
|
25
|
+
classNames?: Partial<Record<SemanticName, string>>;
|
|
23
26
|
}
|
|
24
27
|
declare const TreeSelectContext: React.Context<TreeSelectContextProps>;
|
|
25
28
|
export default TreeSelectContext;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rc-component/tree-select",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "tree-select ui component for react",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"classnames": "2.x",
|
|
48
|
-
"@rc-component/select": "~1.0.
|
|
49
|
-
"@rc-component/tree": "~1.0.
|
|
48
|
+
"@rc-component/select": "~1.0.2",
|
|
49
|
+
"@rc-component/tree": "~1.0.1",
|
|
50
50
|
"@rc-component/util": "^1.2.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|