Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 22x 4x 4x 4x 22x 22x 119x 119x 119x 119x 2x 2x 2x 2x 2x 1x 22x | import { type TagType } from '../store/Types';
import { type SectionElement, type SectionElementProps, useSectionStore } from '../store/Section';
import { useSectionRender } from '../utils/useRender';
export const CountInfoExtra = <K extends TagType>(props: SectionElement<K>) => {
const { CountInfoExtra: Comp = {} } = useSectionStore();
useSectionRender(Comp, props, 'CountInfoExtra');
return null;
};
CountInfoExtra.displayName = 'JVR.CountInfoExtra';
export interface CountInfoExtraCompsProps<T extends object> {
value?: T;
keyName: string | number;
}
export const CountInfoExtraComps = <T extends object, K extends TagType>(
props: SectionElementProps<K> & CountInfoExtraCompsProps<T>,
) => {
const { value = {}, keyName, ...other } = props;
const { CountInfoExtra: Comp = {} } = useSectionStore();
const { as, render, ...reset } = Comp;
if (!render && !reset.children) return null;
const Elm = as || 'span';
const isRender = render && typeof render === 'function';
const elmProps = { ...reset, ...other };
const child = isRender && render(elmProps as React.HTMLAttributes<K>, { value, keyName });
if (child) return child;
return <Elm {...elmProps} />;
};
CountInfoExtraComps.displayName = 'JVR.CountInfoExtraComps';
|