mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 11:08:45 +08:00
chore: rename internal Affix (#40838)
This commit is contained in:
parent
bce4245d4f
commit
f9a38af179
@ -53,7 +53,7 @@ export interface AffixState {
|
||||
prevTarget: Window | HTMLElement | null;
|
||||
}
|
||||
|
||||
class Affix extends React.Component<InternalAffixProps, AffixState> {
|
||||
class InternalAffix extends React.Component<InternalAffixProps, AffixState> {
|
||||
static contextType = ConfigContext;
|
||||
|
||||
state: AffixState = {
|
||||
@ -293,9 +293,9 @@ class Affix extends React.Component<InternalAffixProps, AffixState> {
|
||||
}
|
||||
}
|
||||
// just use in test
|
||||
export type InternalAffixClass = Affix;
|
||||
export type InternalAffixClass = InternalAffix;
|
||||
|
||||
const AffixFC = forwardRef<Affix, AffixProps>((props, ref) => {
|
||||
const Affix = forwardRef<InternalAffix, AffixProps>((props, ref) => {
|
||||
const { prefixCls: customizePrefixCls, rootClassName } = props;
|
||||
const { getPrefixCls } = useContext<ConfigConsumerProps>(ConfigContext);
|
||||
const affixPrefixCls = getPrefixCls('affix', customizePrefixCls);
|
||||
@ -308,11 +308,11 @@ const AffixFC = forwardRef<Affix, AffixProps>((props, ref) => {
|
||||
rootClassName: classNames(rootClassName, hashId),
|
||||
};
|
||||
|
||||
return wrapSSR(<Affix {...AffixProps} ref={ref} />);
|
||||
return wrapSSR(<InternalAffix {...AffixProps} ref={ref} />);
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
AffixFC.displayName = 'Affix';
|
||||
Affix.displayName = 'Affix';
|
||||
}
|
||||
|
||||
export default AffixFC;
|
||||
export default Affix;
|
||||
|
@ -1,4 +1,5 @@
|
||||
import addEventListener from 'rc-util/lib/Dom/addEventListener';
|
||||
import type { InternalAffixClass } from '.';
|
||||
|
||||
export type BindElement = HTMLElement | Window | null | undefined;
|
||||
|
||||
@ -51,7 +52,10 @@ export function getObserverEntities() {
|
||||
return observerEntities;
|
||||
}
|
||||
|
||||
export function addObserveTarget<T>(target: HTMLElement | Window | null, affix?: T): void {
|
||||
export function addObserveTarget<T extends InternalAffixClass>(
|
||||
target: HTMLElement | Window | null,
|
||||
affix?: T,
|
||||
): void {
|
||||
if (!target) {
|
||||
return;
|
||||
}
|
||||
@ -79,7 +83,7 @@ export function addObserveTarget<T>(target: HTMLElement | Window | null, affix?:
|
||||
}
|
||||
}
|
||||
|
||||
export function removeObserveTarget<T>(affix: T): void {
|
||||
export function removeObserveTarget<T extends InternalAffixClass>(affix: T): void {
|
||||
const observerEntity = observerEntities.find((oriObserverEntity) => {
|
||||
const hasAffix = oriObserverEntity.affixList.some((item) => item === affix);
|
||||
if (hasAffix) {
|
||||
|
Loading…
Reference in New Issue
Block a user