MedalTableOptions型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
What a medal table can be told: the sort (gold, total or given), ties, how many rows, columns, highlighting, and the options of every board.
インポート
import type { MedalTableOptions } from "@johnmorrisdotca/taisen-brackets";
定義
interface MedalTableOptions extends BoardOptions {
sort?: "gold" | "total" | "given";
ties?: boolean;
rankStyle?: "plain" | "hash";
top?: number;
rows?: number;
page?: number;
columns?: 1 | 2;
highlight?: boolean;
skipEmpty?: boolean;
}
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
sort (省略可) | "given" | "gold" | "total" | undefined |
|
ties (省略可) | boolean | undefined | Equal rows share a rank ( |
rankStyle (省略可) | "plain" | "hash" | undefined |
|
top (省略可) | number | undefined | Only the first N rows, after sorting. |
rows (省略可) | number | undefined | The most rows drawn, from the first of the page, and which page (0 is the first). Default: as many as fit at a readable size. |
page (省略可) | number | undefined | |
columns (省略可) | 2 | 1 | undefined | One column or two (the first column runs down before the second starts). Default 1, and 2 on a wide board with more than 10 rows. |
highlight (省略可) | boolean | undefined | Mark the first three ranks with a bar in gold, silver and bronze. Default true. |
skipEmpty (省略可) | boolean | undefined | Hide the rows with no medal at all. Default false. |
size (省略可) | BoardSizeName | { width: number; height: number; } | undefined | One of |
theme (省略可) | "auto" | "light" | "dark" | undefined |
|
flags (省略可) | FlagRenderer | undefined | Draws a flag from its code, as for |
flagHref (省略可) | ((code: string) => string | null | undefined) | undefined | The address of a flag as a picture to load, tried where |
flagShape (省略可) | "round" | "square" | undefined |
|
locale (省略可) | string | Locale | undefined | The language: |
words (省略可) | Partial<Words> | undefined | |
title (省略可) | string | undefined | The |
id (省略可) | string | undefined | Prefix for the drawing's ids. Default: a hash of the state and the options. |
className (省略可) | string | undefined |
例
import { medalTable, type MedalTableOptions } from "@johnmorrisdotca/taisen-brackets";
const options: MedalTableOptions = { sort: "total", top: 10, columns: 2 };
console.log(medalTable({ rows: [
{ name: "France", flag: "FR", gold: 6, silver: 1, bronze: 3 },
{ name: "Japan", flag: "JP", gold: 5, silver: 3, bronze: 2 },
] }, options).startsWith("<svg"));true出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。