@rc-component/tree-select
Advanced tools
| import * as React from 'react'; | ||
| import type { DataEntity } from '@rc-component/tree/lib/interface'; | ||
| import type { LabeledValueType, SafeKey } from '../interface'; | ||
| import type { DataEntity } from './useDataEntities'; | ||
| declare const useCheckedKeys: (rawLabeledValues: LabeledValueType[], rawHalfCheckedValues: LabeledValueType[], treeConduction: boolean, keyEntities: Record<SafeKey, DataEntity>) => React.Key[][]; | ||
| export default useCheckedKeys; |
| import * as React from 'react'; | ||
| import { conductCheck } from "@rc-component/tree/es/utils/conductUtil"; | ||
| import { conductCheck } from '@rc-component/tree'; | ||
| const useCheckedKeys = (rawLabeledValues, rawHalfCheckedValues, treeConduction, keyEntities) => { | ||
@@ -4,0 +4,0 @@ return React.useMemo(() => { |
@@ -1,3 +0,4 @@ | ||
| import type { DataEntity } from '@rc-component/tree/lib/interface'; | ||
| import { convertDataToEntities } from '@rc-component/tree'; | ||
| import type { SafeKey, FieldNames } from '../interface'; | ||
| export type DataEntity = ReturnType<typeof convertDataToEntities>['keyEntities'][string]; | ||
| declare const _default: (treeData: any, fieldNames: FieldNames) => { | ||
@@ -4,0 +5,0 @@ valueEntities: Map<SafeKey, DataEntity>; |
| import * as React from 'react'; | ||
| import { convertDataToEntities } from "@rc-component/tree/es/utils/treeUtil"; | ||
| import warning from "@rc-component/util/es/warning"; | ||
| import { convertDataToEntities } from '@rc-component/tree'; | ||
| import { warning } from '@rc-component/util'; | ||
| import { isNil } from "../utils/valueUtil"; | ||
@@ -5,0 +5,0 @@ export default ((treeData, fieldNames) => React.useMemo(() => { |
| import type * as React from 'react'; | ||
| import type { SafeKey, Key, DataNode as TreeDataNode } from '@rc-component/tree/lib/interface'; | ||
| export type { SafeKey, Key }; | ||
| import type { DataNode as TreeDataNode, TreeProps } from '@rc-component/tree'; | ||
| export type Key = React.Key; | ||
| export type SafeKey = Exclude<Key, bigint>; | ||
| export type ExpandAction = TreeProps['expandAction']; | ||
| export type IconType = TreeProps['icon']; | ||
| export interface DataNode extends Record<string, any>, Omit<TreeDataNode, 'key' | 'children'> { | ||
@@ -5,0 +8,0 @@ key?: Key; |
| import * as React from 'react'; | ||
| import type { DataEntity, IconType } from '@rc-component/tree/lib/interface'; | ||
| import type { LegacyDataNode, SafeKey, Key } from './interface'; | ||
| import type { LegacyDataNode, SafeKey, Key, IconType } from './interface'; | ||
| import type { DataEntity } from './hooks/useDataEntities'; | ||
| interface LegacyContextProps { | ||
@@ -21,5 +21,5 @@ checkable: boolean | React.ReactNode; | ||
| onTreeLoad: (loadedKeys: Key[]) => void; | ||
| keyEntities: Record<SafeKey, DataEntity<any>>; | ||
| keyEntities: Record<SafeKey, DataEntity>; | ||
| } | ||
| declare const LegacySelectContext: React.Context<LegacyContextProps>; | ||
| export default LegacySelectContext; |
@@ -1,4 +0,9 @@ | ||
| import type { RefOptionListProps } from '@rc-component/select/lib/OptionList'; | ||
| import type { ScrollTo } from '@rc-component/tree/lib/interface'; | ||
| import Tree from '@rc-component/tree'; | ||
| import * as React from 'react'; | ||
| interface RefOptionListProps { | ||
| onKeyDown: React.KeyboardEventHandler; | ||
| onKeyUp: React.KeyboardEventHandler; | ||
| scrollTo?: (args: unknown) => void; | ||
| } | ||
| type ScrollTo = NonNullable<React.ComponentRef<typeof Tree>['scrollTo']>; | ||
| type ReviseRefOptionListProps = Omit<RefOptionListProps, 'scrollTo'> & { | ||
@@ -5,0 +10,0 @@ scrollTo: ScrollTo; |
+1
-3
@@ -5,4 +5,3 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
| import { UnstableContext } from '@rc-component/tree'; | ||
| import KeyCode from "@rc-component/util/es/KeyCode"; | ||
| import useMemo from "@rc-component/util/es/hooks/useMemo"; | ||
| import { KeyCode, useEvent, useMemo } from '@rc-component/util'; | ||
| import * as React from 'react'; | ||
@@ -12,3 +11,2 @@ import LegacyContext from "./LegacyContext"; | ||
| import { getAllKeys, isCheckDisabled } from "./utils/valueUtil"; | ||
| import { useEvent } from '@rc-component/util'; | ||
| const HIDDEN_STYLE = { | ||
@@ -15,0 +13,0 @@ width: 0, |
| import type { BaseSelectPropsWithoutPrivate, BaseSelectRef } from '@rc-component/select'; | ||
| import type { BaseSelectSemanticName } from '@rc-component/select/lib/BaseSelect'; | ||
| import type { IconType } from '@rc-component/tree/lib/interface'; | ||
| import type { ExpandAction } from '@rc-component/tree/lib/Tree'; | ||
| import * as React from 'react'; | ||
@@ -9,4 +6,4 @@ import TreeNode from './TreeNode'; | ||
| import { SHOW_ALL, SHOW_CHILD, SHOW_PARENT } from './utils/strategyUtil'; | ||
| import type { SafeKey, DataNode, SimpleModeConfig, ChangeEventExtra, FieldNames, LegacyDataNode } from './interface'; | ||
| export type SemanticName = BaseSelectSemanticName; | ||
| import type { SafeKey, DataNode, ExpandAction, IconType, SimpleModeConfig, ChangeEventExtra, FieldNames, LegacyDataNode } from './interface'; | ||
| export type SemanticName = keyof NonNullable<BaseSelectPropsWithoutPrivate['classNames']>; | ||
| export type PopupSemantic = 'item' | 'itemTitle'; | ||
@@ -13,0 +10,0 @@ export interface SearchConfig { |
+2
-3
| function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
| import { BaseSelect } from '@rc-component/select'; | ||
| import useId from "@rc-component/util/es/hooks/useId"; | ||
| import { conductCheck } from "@rc-component/tree/es/utils/conductUtil"; | ||
| import useControlledState from "@rc-component/util/es/hooks/useControlledState"; | ||
| import { conductCheck } from '@rc-component/tree'; | ||
| import { useControlledState, useId } from '@rc-component/util'; | ||
| import * as React from 'react'; | ||
@@ -7,0 +6,0 @@ import useCache from "./hooks/useCache"; |
| import * as React from 'react'; | ||
| import type { ExpandAction } from '@rc-component/tree/lib/Tree'; | ||
| import type { DataNode, FieldNames, Key } from './interface'; | ||
| import type { DataNode, FieldNames, Key, ExpandAction } from './interface'; | ||
| import type useDataEntities from './hooks/useDataEntities'; | ||
| import { TreeSelectProps } from './TreeSelect'; | ||
| import type { TreeSelectProps } from './TreeSelect'; | ||
| export interface TreeSelectContextProps { | ||
@@ -7,0 +6,0 @@ virtual?: boolean; |
| import * as React from 'react'; | ||
| import toArray from "@rc-component/util/es/Children/toArray"; | ||
| import warning from "@rc-component/util/es/warning"; | ||
| import { toArray, warning } from '@rc-component/util'; | ||
| import TreeNode from "../TreeNode"; | ||
@@ -5,0 +4,0 @@ export function convertChildrenToData(nodes) { |
@@ -1,3 +0,3 @@ | ||
| import type { DataEntity } from '@rc-component/tree/lib/interface'; | ||
| import type { SafeKey, FieldNames } from '../interface'; | ||
| import type { DataEntity } from '../hooks/useDataEntities'; | ||
| export declare const SHOW_ALL = "SHOW_ALL"; | ||
@@ -4,0 +4,0 @@ export declare const SHOW_PARENT = "SHOW_PARENT"; |
@@ -1,2 +0,2 @@ | ||
| import warning from "@rc-component/util/es/warning"; | ||
| import { warning } from '@rc-component/util'; | ||
| import { toArray } from "./valueUtil"; | ||
@@ -3,0 +3,0 @@ function warningProps(props) { |
| import * as React from 'react'; | ||
| import type { DataEntity } from '@rc-component/tree/lib/interface'; | ||
| import type { LabeledValueType, SafeKey } from '../interface'; | ||
| import type { DataEntity } from './useDataEntities'; | ||
| declare const useCheckedKeys: (rawLabeledValues: LabeledValueType[], rawHalfCheckedValues: LabeledValueType[], treeConduction: boolean, keyEntities: Record<SafeKey, DataEntity>) => React.Key[][]; | ||
| export default useCheckedKeys; |
@@ -8,3 +8,3 @@ "use strict"; | ||
| var React = _interopRequireWildcard(require("react")); | ||
| var _conductUtil = require("@rc-component/tree/lib/utils/conductUtil"); | ||
| var _tree = require("@rc-component/tree"); | ||
| function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
@@ -23,3 +23,3 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
| if (treeConduction) { | ||
| const conductResult = (0, _conductUtil.conductCheck)(checkedKeys, true, keyEntities); | ||
| const conductResult = (0, _tree.conductCheck)(checkedKeys, true, keyEntities); | ||
| finalCheckedKeys = conductResult.checkedKeys; | ||
@@ -26,0 +26,0 @@ finalHalfCheckedKeys = conductResult.halfCheckedKeys; |
@@ -1,3 +0,4 @@ | ||
| import type { DataEntity } from '@rc-component/tree/lib/interface'; | ||
| import { convertDataToEntities } from '@rc-component/tree'; | ||
| import type { SafeKey, FieldNames } from '../interface'; | ||
| export type DataEntity = ReturnType<typeof convertDataToEntities>['keyEntities'][string]; | ||
| declare const _default: (treeData: any, fieldNames: FieldNames) => { | ||
@@ -4,0 +5,0 @@ valueEntities: Map<SafeKey, DataEntity>; |
@@ -8,10 +8,9 @@ "use strict"; | ||
| var React = _interopRequireWildcard(require("react")); | ||
| var _treeUtil = require("@rc-component/tree/lib/utils/treeUtil"); | ||
| var _warning = _interopRequireDefault(require("@rc-component/util/lib/warning")); | ||
| var _tree = require("@rc-component/tree"); | ||
| var _util = require("@rc-component/util"); | ||
| var _valueUtil = require("../utils/valueUtil"); | ||
| function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
| function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
| function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
| var _default = (treeData, fieldNames) => React.useMemo(() => { | ||
| const collection = (0, _treeUtil.convertDataToEntities)(treeData, { | ||
| const collection = (0, _tree.convertDataToEntities)(treeData, { | ||
| fieldNames, | ||
@@ -28,5 +27,5 @@ initWrapper: wrapper => ({ | ||
| const key = entity.node.key; | ||
| (0, _warning.default)(!(0, _valueUtil.isNil)(val), 'TreeNode `value` is invalidate: undefined'); | ||
| (0, _warning.default)(!wrapper.valueEntities.has(val), `Same \`value\` exist in the tree: ${val}`); | ||
| (0, _warning.default)(!key || String(key) === String(val), `\`key\` or \`value\` with TreeNode must be the same or you can remove one of them. key: ${key}, value: ${val}.`); | ||
| (0, _util.warning)(!(0, _valueUtil.isNil)(val), 'TreeNode `value` is invalidate: undefined'); | ||
| (0, _util.warning)(!wrapper.valueEntities.has(val), `Same \`value\` exist in the tree: ${val}`); | ||
| (0, _util.warning)(!key || String(key) === String(val), `\`key\` or \`value\` with TreeNode must be the same or you can remove one of them. key: ${key}, value: ${val}.`); | ||
| } | ||
@@ -33,0 +32,0 @@ wrapper.valueEntities.set(val, entity); |
| import type * as React from 'react'; | ||
| import type { SafeKey, Key, DataNode as TreeDataNode } from '@rc-component/tree/lib/interface'; | ||
| export type { SafeKey, Key }; | ||
| import type { DataNode as TreeDataNode, TreeProps } from '@rc-component/tree'; | ||
| export type Key = React.Key; | ||
| export type SafeKey = Exclude<Key, bigint>; | ||
| export type ExpandAction = TreeProps['expandAction']; | ||
| export type IconType = TreeProps['icon']; | ||
| export interface DataNode extends Record<string, any>, Omit<TreeDataNode, 'key' | 'children'> { | ||
@@ -5,0 +8,0 @@ key?: Key; |
| import * as React from 'react'; | ||
| import type { DataEntity, IconType } from '@rc-component/tree/lib/interface'; | ||
| import type { LegacyDataNode, SafeKey, Key } from './interface'; | ||
| import type { LegacyDataNode, SafeKey, Key, IconType } from './interface'; | ||
| import type { DataEntity } from './hooks/useDataEntities'; | ||
| interface LegacyContextProps { | ||
@@ -21,5 +21,5 @@ checkable: boolean | React.ReactNode; | ||
| onTreeLoad: (loadedKeys: Key[]) => void; | ||
| keyEntities: Record<SafeKey, DataEntity<any>>; | ||
| keyEntities: Record<SafeKey, DataEntity>; | ||
| } | ||
| declare const LegacySelectContext: React.Context<LegacyContextProps>; | ||
| export default LegacySelectContext; |
@@ -1,4 +0,9 @@ | ||
| import type { RefOptionListProps } from '@rc-component/select/lib/OptionList'; | ||
| import type { ScrollTo } from '@rc-component/tree/lib/interface'; | ||
| import Tree from '@rc-component/tree'; | ||
| import * as React from 'react'; | ||
| interface RefOptionListProps { | ||
| onKeyDown: React.KeyboardEventHandler; | ||
| onKeyUp: React.KeyboardEventHandler; | ||
| scrollTo?: (args: unknown) => void; | ||
| } | ||
| type ScrollTo = NonNullable<React.ComponentRef<typeof Tree>['scrollTo']>; | ||
| type ReviseRefOptionListProps = Omit<RefOptionListProps, 'scrollTo'> & { | ||
@@ -5,0 +10,0 @@ scrollTo: ScrollTo; |
+9
-11
@@ -9,4 +9,3 @@ "use strict"; | ||
| var _tree = _interopRequireWildcard(require("@rc-component/tree")); | ||
| var _KeyCode = _interopRequireDefault(require("@rc-component/util/lib/KeyCode")); | ||
| var _useMemo = _interopRequireDefault(require("@rc-component/util/lib/hooks/useMemo")); | ||
| var _util = require("@rc-component/util"); | ||
| var React = _interopRequireWildcard(require("react")); | ||
@@ -16,3 +15,2 @@ var _LegacyContext = _interopRequireDefault(require("./LegacyContext")); | ||
| var _valueUtil = require("./utils/valueUtil"); | ||
| var _util = require("@rc-component/util"); | ||
| function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -79,3 +77,3 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
| const treeRef = React.useRef(); | ||
| const memoTreeData = (0, _useMemo.default)(() => treeData, | ||
| const memoTreeData = (0, _util.useMemo)(() => treeData, | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
@@ -254,6 +252,6 @@ [open, treeData], (prev, next) => next[0] && prev[1] !== next[1]); | ||
| // >>> Arrow keys | ||
| case _KeyCode.default.UP: | ||
| case _KeyCode.default.DOWN: | ||
| case _KeyCode.default.LEFT: | ||
| case _KeyCode.default.RIGHT: | ||
| case _util.KeyCode.UP: | ||
| case _util.KeyCode.DOWN: | ||
| case _util.KeyCode.LEFT: | ||
| case _util.KeyCode.RIGHT: | ||
| treeRef.current?.onKeyDown(event); | ||
@@ -263,3 +261,3 @@ break; | ||
| // >>> Select item | ||
| case _KeyCode.default.ENTER: | ||
| case _util.KeyCode.ENTER: | ||
| { | ||
@@ -286,3 +284,3 @@ if (activeEntity) { | ||
| // >>> Close | ||
| case _KeyCode.default.ESC: | ||
| case _util.KeyCode.ESC: | ||
| { | ||
@@ -295,3 +293,3 @@ toggleOpen(false); | ||
| })); | ||
| const hasLoadDataFn = (0, _useMemo.default)(() => searchValue ? false : true, | ||
| const hasLoadDataFn = (0, _util.useMemo)(() => searchValue ? false : true, | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
@@ -298,0 +296,0 @@ [searchValue, treeExpandedKeys || expandedKeys], ([preSearchValue], [nextSearchValue, nextExcludeSearchExpandedKeys]) => preSearchValue !== nextSearchValue && !!(nextSearchValue || nextExcludeSearchExpandedKeys)); |
| import type { BaseSelectPropsWithoutPrivate, BaseSelectRef } from '@rc-component/select'; | ||
| import type { BaseSelectSemanticName } from '@rc-component/select/lib/BaseSelect'; | ||
| import type { IconType } from '@rc-component/tree/lib/interface'; | ||
| import type { ExpandAction } from '@rc-component/tree/lib/Tree'; | ||
| import * as React from 'react'; | ||
@@ -9,4 +6,4 @@ import TreeNode from './TreeNode'; | ||
| import { SHOW_ALL, SHOW_CHILD, SHOW_PARENT } from './utils/strategyUtil'; | ||
| import type { SafeKey, DataNode, SimpleModeConfig, ChangeEventExtra, FieldNames, LegacyDataNode } from './interface'; | ||
| export type SemanticName = BaseSelectSemanticName; | ||
| import type { SafeKey, DataNode, ExpandAction, IconType, SimpleModeConfig, ChangeEventExtra, FieldNames, LegacyDataNode } from './interface'; | ||
| export type SemanticName = keyof NonNullable<BaseSelectPropsWithoutPrivate['classNames']>; | ||
| export type PopupSemantic = 'item' | 'itemTitle'; | ||
@@ -13,0 +10,0 @@ export interface SearchConfig { |
@@ -8,5 +8,4 @@ "use strict"; | ||
| var _select = require("@rc-component/select"); | ||
| var _useId = _interopRequireDefault(require("@rc-component/util/lib/hooks/useId")); | ||
| var _conductUtil = require("@rc-component/tree/lib/utils/conductUtil"); | ||
| var _useControlledState = _interopRequireDefault(require("@rc-component/util/lib/hooks/useControlledState")); | ||
| var _tree = require("@rc-component/tree"); | ||
| var _util = require("@rc-component/util"); | ||
| var React = _interopRequireWildcard(require("react")); | ||
@@ -28,5 +27,5 @@ var _useCache = _interopRequireDefault(require("./hooks/useCache")); | ||
| var _useSearchConfig = _interopRequireDefault(require("./hooks/useSearchConfig")); | ||
| function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
| function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
| function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
| function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
| function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
@@ -97,3 +96,3 @@ function isRawValue(value) { | ||
| } = props; | ||
| const mergedId = (0, _useId.default)(id); | ||
| const mergedId = (0, _util.useId)(id); | ||
| const treeConduction = treeCheckable && !treeCheckStrictly; | ||
@@ -119,3 +118,3 @@ const mergedCheckable = treeCheckable || treeCheckStrictly; | ||
| } = searchConfig; | ||
| const [internalValue, setInternalValue] = (0, _useControlledState.default)(defaultValue, value); | ||
| const [internalValue, setInternalValue] = (0, _util.useControlledState)(defaultValue, value); | ||
@@ -141,3 +140,3 @@ // `multiple` && `!treeCheckable` should be show all | ||
| // =========================== Search =========================== | ||
| const [internalSearchValue, setSearchValue] = (0, _useControlledState.default)('', searchValue); | ||
| const [internalSearchValue, setSearchValue] = (0, _util.useControlledState)('', searchValue); | ||
| const mergedSearchValue = internalSearchValue || ''; | ||
@@ -407,7 +406,7 @@ const onInternalSearch = searchText => { | ||
| checkedKeys | ||
| } = (0, _conductUtil.conductCheck)(keyList, true, keyEntities)); | ||
| } = (0, _tree.conductCheck)(keyList, true, keyEntities)); | ||
| } else { | ||
| ({ | ||
| checkedKeys | ||
| } = (0, _conductUtil.conductCheck)(keyList, { | ||
| } = (0, _tree.conductCheck)(keyList, { | ||
| checked: false, | ||
@@ -414,0 +413,0 @@ halfCheckedKeys: rawHalfCheckedValues |
| import * as React from 'react'; | ||
| import type { ExpandAction } from '@rc-component/tree/lib/Tree'; | ||
| import type { DataNode, FieldNames, Key } from './interface'; | ||
| import type { DataNode, FieldNames, Key, ExpandAction } from './interface'; | ||
| import type useDataEntities from './hooks/useDataEntities'; | ||
| import { TreeSelectProps } from './TreeSelect'; | ||
| import type { TreeSelectProps } from './TreeSelect'; | ||
| export interface TreeSelectContextProps { | ||
@@ -7,0 +6,0 @@ virtual?: boolean; |
@@ -10,4 +10,3 @@ "use strict"; | ||
| var React = _interopRequireWildcard(require("react")); | ||
| var _toArray = _interopRequireDefault(require("@rc-component/util/lib/Children/toArray")); | ||
| var _warning = _interopRequireDefault(require("@rc-component/util/lib/warning")); | ||
| var _util = require("@rc-component/util"); | ||
| var _TreeNode = _interopRequireDefault(require("../TreeNode")); | ||
@@ -18,3 +17,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
| function convertChildrenToData(nodes) { | ||
| return (0, _toArray.default)(nodes).map(node => { | ||
| return (0, _util.toArray)(nodes).map(node => { | ||
| if (! /*#__PURE__*/React.isValidElement(node) || !node.type) { | ||
@@ -53,3 +52,3 @@ return null; | ||
| get() { | ||
| (0, _warning.default)(false, 'New `rc-tree-select` not support return node instance as argument anymore. Please consider to remove `props` access.'); | ||
| (0, _util.warning)(false, 'New `rc-tree-select` not support return node instance as argument anymore. Please consider to remove `props` access.'); | ||
| return cloneNode; | ||
@@ -117,3 +116,3 @@ } | ||
| get() { | ||
| (0, _warning.default)(false, '`triggerNode` is deprecated. Please consider decoupling data with node.'); | ||
| (0, _util.warning)(false, '`triggerNode` is deprecated. Please consider decoupling data with node.'); | ||
| generateMap(); | ||
@@ -125,3 +124,3 @@ return triggerNode; | ||
| get() { | ||
| (0, _warning.default)(false, '`allCheckedNodes` is deprecated. Please consider decoupling data with node.'); | ||
| (0, _util.warning)(false, '`allCheckedNodes` is deprecated. Please consider decoupling data with node.'); | ||
| generateMap(); | ||
@@ -128,0 +127,0 @@ if (showPosition) { |
@@ -1,3 +0,3 @@ | ||
| import type { DataEntity } from '@rc-component/tree/lib/interface'; | ||
| import type { SafeKey, FieldNames } from '../interface'; | ||
| import type { DataEntity } from '../hooks/useDataEntities'; | ||
| export declare const SHOW_ALL = "SHOW_ALL"; | ||
@@ -4,0 +4,0 @@ export declare const SHOW_PARENT = "SHOW_PARENT"; |
@@ -7,5 +7,4 @@ "use strict"; | ||
| exports.default = void 0; | ||
| var _warning = _interopRequireDefault(require("@rc-component/util/lib/warning")); | ||
| var _util = require("@rc-component/util"); | ||
| var _valueUtil = require("./valueUtil"); | ||
| function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
| function warningProps(props) { | ||
@@ -22,18 +21,18 @@ const { | ||
| } = props; | ||
| (0, _warning.default)(!searchPlaceholder, '`searchPlaceholder` has been removed.'); | ||
| (0, _util.warning)(!searchPlaceholder, '`searchPlaceholder` has been removed.'); | ||
| if (treeCheckStrictly && labelInValue === false) { | ||
| (0, _warning.default)(false, '`treeCheckStrictly` will force set `labelInValue` to `true`.'); | ||
| (0, _util.warning)(false, '`treeCheckStrictly` will force set `labelInValue` to `true`.'); | ||
| } | ||
| if (labelInValue || treeCheckStrictly) { | ||
| (0, _warning.default)((0, _valueUtil.toArray)(value).every(val => val && typeof val === 'object' && 'value' in val), 'Invalid prop `value` supplied to `TreeSelect`. You should use { label: string, value: string | number } or [{ label: string, value: string | number }] instead.'); | ||
| (0, _util.warning)((0, _valueUtil.toArray)(value).every(val => val && typeof val === 'object' && 'value' in val), 'Invalid prop `value` supplied to `TreeSelect`. You should use { label: string, value: string | number } or [{ label: string, value: string | number }] instead.'); | ||
| } | ||
| if (treeCheckStrictly || multiple || treeCheckable) { | ||
| (0, _warning.default)(!value || Array.isArray(value), '`value` should be an array when `TreeSelect` is checkable or multiple.'); | ||
| (0, _util.warning)(!value || Array.isArray(value), '`value` should be an array when `TreeSelect` is checkable or multiple.'); | ||
| } else { | ||
| (0, _warning.default)(!Array.isArray(value), '`value` should not be array when `TreeSelect` is single mode.'); | ||
| (0, _util.warning)(!Array.isArray(value), '`value` should not be array when `TreeSelect` is single mode.'); | ||
| } | ||
| if (maxCount && (showCheckedStrategy === 'SHOW_ALL' && !treeCheckStrictly || showCheckedStrategy === 'SHOW_PARENT')) { | ||
| (0, _warning.default)(false, '`maxCount` not work with `showCheckedStrategy=SHOW_ALL` (when `treeCheckStrictly=false`) or `showCheckedStrategy=SHOW_PARENT`.'); | ||
| (0, _util.warning)(false, '`maxCount` not work with `showCheckedStrategy=SHOW_ALL` (when `treeCheckStrictly=false`) or `showCheckedStrategy=SHOW_PARENT`.'); | ||
| } | ||
| } | ||
| var _default = exports.default = warningProps; |
+9
-13
| { | ||
| "name": "@rc-component/tree-select", | ||
| "version": "1.10.0", | ||
| "version": "1.11.0", | ||
| "description": "tree-select ui component for react", | ||
@@ -46,5 +46,5 @@ "keywords": [ | ||
| "dependencies": { | ||
| "@rc-component/select": "~1.7.0", | ||
| "@rc-component/tree": "~1.3.0", | ||
| "@rc-component/util": "^1.4.0", | ||
| "@rc-component/select": "~1.8.0", | ||
| "@rc-component/tree": "~1.3.2", | ||
| "@rc-component/util": "^1.11.1", | ||
| "clsx": "^2.1.1" | ||
@@ -54,3 +54,3 @@ }, | ||
| "@rc-component/dialog": "^1.2.0", | ||
| "@rc-component/father-plugin": "^2.0.2", | ||
| "@rc-component/father-plugin": "^2.2.0", | ||
| "@rc-component/form": "^1.4.0", | ||
@@ -60,15 +60,11 @@ "@rc-component/np": "^1.0.3", | ||
| "@rc-component/virtual-list": "^1.0.1", | ||
| "@testing-library/react": "^12.1.5", | ||
| "@testing-library/react": "^16.0.0", | ||
| "@types/jest": "^29.5.13", | ||
| "@types/node": "^22.7.5", | ||
| "@types/react": "^18.3.11", | ||
| "@types/react-dom": "^19.0.1", | ||
| "@types/react-dom": "^18.0.0", | ||
| "@types/warning": "^3.0.3", | ||
| "@umijs/fabric": "^4.0.1", | ||
| "cheerio": "1.0.0-rc.12", | ||
| "cross-env": "^7.0.3", | ||
| "dumi": "^2.4.12", | ||
| "enzyme": "^3.11.0", | ||
| "enzyme-adapter-react-16": "^1.15.8", | ||
| "enzyme-to-json": "^3.6.2", | ||
| "eslint": "^8.57.1", | ||
@@ -83,4 +79,4 @@ "eslint-plugin-jest": "^28.10.0", | ||
| "rc-test": "^7.1.1", | ||
| "react": "^16.0.0", | ||
| "react-dom": "^16.0.0", | ||
| "react": "^18.0.0", | ||
| "react-dom": "^18.0.0", | ||
| "typescript": "^5.6.3" | ||
@@ -87,0 +83,0 @@ }, |
27
-12.9%170610
-0.66%+ Added
- Removed
Updated
Updated
Updated