feat: 氧化铝数字孪生系统监控大屏完成

This commit is contained in:
2026-04-08 21:44:08 +08:00
commit a48babc68d
67606 changed files with 3337335 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import { customRender } from 'test/render';
import { getMonthCaption } from 'test/selectors';
import { freezeBeforeAll } from 'test/utils';
import { CaptionLabel } from './CaptionLabel';
const today = new Date(1979, 8);
freezeBeforeAll(today);
test('should render the formatted display month', () => {
customRender(<CaptionLabel displayMonth={today} />);
expect(getMonthCaption()).toHaveTextContent('September 1979');
});
test('should apply the `caption_label` class name', () => {
customRender(<CaptionLabel displayMonth={today} />, {
classNames: { caption_label: 'foo' }
});
expect(getMonthCaption()).toHaveClass('foo');
});
test('should apply the `caption_label` style', () => {
customRender(<CaptionLabel displayMonth={today} />, {
styles: { caption_label: { color: 'red' } }
});
expect(getMonthCaption()).toHaveStyle({ color: 'red' });
});

View File

@@ -0,0 +1,32 @@
import { useDayPicker } from 'contexts/DayPicker';
/** The props for the {@link CaptionLabel} component. */
export interface CaptionLabelProps {
/** The ID for the heading element. Must be the same as the labelled-by in Table. */
id?: string;
/** The month where the caption is displayed. */
displayMonth: Date;
/** The index of the month where the caption is displayed. Older custom components may miss this prop. */
displayIndex?: number | undefined;
}
/** Render the caption for the displayed month. This component is used when `captionLayout="buttons"`. */
export function CaptionLabel(props: CaptionLabelProps): JSX.Element {
const {
locale,
classNames,
styles,
formatters: { formatCaption }
} = useDayPicker();
return (
<div
className={classNames.caption_label}
style={styles.caption_label}
aria-live="polite"
role="presentation"
id={props.id}
>
{formatCaption(props.displayMonth, { locale })}
</div>
);
}

View File

@@ -0,0 +1 @@
export * from './CaptionLabel';