@aiquants/period-slider 0.16.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +359 -0
- package/README.md +97 -66
- package/dist/DateSelector.d.ts +2 -2
- package/dist/DateSelector.d.ts.map +1 -1
- package/dist/MonthSelector.d.ts +2 -2
- package/dist/MonthSelector.d.ts.map +1 -1
- package/dist/PeriodSlider.d.ts +324 -47
- package/dist/PeriodSlider.d.ts.map +1 -1
- package/dist/VirtualDateDropdown.d.ts +19 -1
- package/dist/VirtualDateDropdown.d.ts.map +1 -1
- package/dist/YearSelector.d.ts +4 -2
- package/dist/YearSelector.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2723 -2593
- package/dist/inputValue.d.ts +98 -21
- package/dist/inputValue.d.ts.map +1 -1
- package/dist/optionText.d.ts +1 -1
- package/dist/optionText.d.ts.map +1 -1
- package/dist/selectorMemo.d.ts +14 -0
- package/dist/selectorMemo.d.ts.map +1 -1
- package/dist/selectorStep.d.ts +25 -30
- package/dist/selectorStep.d.ts.map +1 -1
- package/dist/useCommittedRef.d.ts +99 -0
- package/dist/useCommittedRef.d.ts.map +1 -0
- package/dist/usePeriodSlider.d.ts +74 -40
- package/dist/usePeriodSlider.d.ts.map +1 -1
- package/dist/useUncontrolledSelection.d.ts +40 -0
- package/dist/useUncontrolledSelection.d.ts.map +1 -0
- package/dist/vernierStep.d.ts +10 -1
- package/dist/vernierStep.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/DateSelector.tsx +34 -67
- package/src/MonthSelector.tsx +24 -57
- package/src/PeriodSlider.tsx +614 -198
- package/src/VirtualDateDropdown.tsx +90 -46
- package/src/YearSelector.tsx +34 -56
- package/src/inputValue.ts +159 -21
- package/src/optionText.ts +3 -5
- package/src/selectorMemo.ts +18 -3
- package/src/selectorStep.ts +46 -58
- package/src/useCommittedRef.ts +236 -0
- package/src/usePeriodSlider.ts +536 -289
- package/src/useUncontrolledSelection.ts +83 -0
- package/src/valueSet.ts +1 -1
- package/src/vernierStep.ts +19 -17
package/dist/PeriodSlider.d.ts
CHANGED
|
@@ -161,7 +161,7 @@ export interface BasePeriodSliderProps {
|
|
|
161
161
|
minDate: Date;
|
|
162
162
|
/** Maximum selectable boundary date, strictly later than minDate (required, no fallback) / 選択可能上限日付 (必須・minDate より後・フォールバックなし) */
|
|
163
163
|
maxDate: Date;
|
|
164
|
-
/** Discrete snap targets; when supplied the slider resolves to these dates only / 離散スナップ対象日付配列 (指定時はこの日付のみへスナップ) */
|
|
164
|
+
/** Discrete snap targets; when supplied the slider resolves to these dates only. Omitted (`undefined`) or `[]` keeps the rail continuous; a supplied value that is not an array (`null` included) throws RangeError where the list is read. Range and point read it at `unit`; the vernier reads it only through a discrete row that omits its own list, at that row's unit, and otherwise neither reads nor validates it / 離散スナップ対象日付配列 (指定時はこの日付のみへスナップ)。省略 (`undefined`)・`[]` はレールを連続のまま保ち、配列でない指定値 (`null` を含む) は一覧を読む所で RangeError。range / point は `unit` で読み、ノギスは自分の一覧を省略した離散の行だけがその行の単位で読む (継ぐ行が無ければ読まず、検証もしない) */
|
|
165
165
|
allowedDates?: Date[];
|
|
166
166
|
/** Placement strategy for allowedDates (default: "index") / allowedDates の配置方式 (既定: "index") */
|
|
167
167
|
snapMode?: PeriodSliderSnapMode;
|
|
@@ -276,17 +276,17 @@ export interface BasePeriodSliderVernierProps extends BasePeriodSliderProps {
|
|
|
276
276
|
showVernierTicks?: boolean;
|
|
277
277
|
/** Show 1px precision hairline pointer cursor on semicircles / 精密ヘアライン針の表示 (既定: true) */
|
|
278
278
|
showHairline?: boolean;
|
|
279
|
-
/** Macro scale unit (defaults to props.unit) / マクロ側の単位 (
|
|
279
|
+
/** Macro scale unit; only an omitted value (undefined) defaults to props.unit, and any other value outside the unit union (null included) throws a RangeError / マクロ側の単位 (省略 (undefined) のときだけ props.unit。null を含む宣言外の値は RangeError) */
|
|
280
280
|
macroUnit?: PeriodSliderUnit;
|
|
281
|
-
/** Micro scale unit (defaults to props.unit) / ミクロ側の単位 (
|
|
281
|
+
/** Micro scale unit; only an omitted value (undefined) defaults to props.unit, and any other value outside the unit union (null included) throws a RangeError / ミクロ側の単位 (省略 (undefined) のときだけ props.unit。null を含む宣言外の値は RangeError) */
|
|
282
282
|
microUnit?: PeriodSliderUnit;
|
|
283
|
-
/** Macro discrete mode flag / マクロ側の離散モードフラグ */
|
|
283
|
+
/** Macro discrete mode flag; only `true` makes the macro row discrete, and any other value (omitted, `false`, or a non-boolean) leaves it continuous / マクロ側の離散モードフラグ (離散にするのは `true` だけで、それ以外 (省略・`false`・真偽値以外の値) は連続) */
|
|
284
284
|
macroIsDiscrete?: boolean;
|
|
285
|
-
/** Micro discrete mode flag / ミクロ側の離散モードフラグ */
|
|
285
|
+
/** Micro discrete mode flag; only `true` makes the micro row discrete, and any other value (omitted, `false`, or a non-boolean) leaves it continuous / ミクロ側の離散モードフラグ (離散にするのは `true` だけで、それ以外 (省略・`false`・真偽値以外の値) は連続) */
|
|
286
286
|
microIsDiscrete?: boolean;
|
|
287
|
-
/** Macro allowed discrete dates / マクロ側の離散候補日付一覧 */
|
|
287
|
+
/** Macro allowed discrete dates; only an omitted (`undefined`) list inherits `allowedDates`, and `null` throws RangeError / マクロ側の離散候補日付一覧 (`allowedDates` を継ぐのは省略 (`undefined`) したときだけで、`null` は RangeError) */
|
|
288
288
|
macroAllowedDates?: Date[];
|
|
289
|
-
/** Micro allowed discrete dates / ミクロ側の離散候補日付一覧 */
|
|
289
|
+
/** Micro allowed discrete dates; only an omitted (`undefined`) list inherits `allowedDates`, and `null` throws RangeError / ミクロ側の離散候補日付一覧 (`allowedDates` を継ぐのは省略 (`undefined`) したときだけで、`null` は RangeError) */
|
|
290
290
|
microAllowedDates?: Date[];
|
|
291
291
|
/** Custom label formatter for macro handles and tooltip / マクロ用カスタム日付フォーマッタ */
|
|
292
292
|
formatMacroLabel?: PeriodOptionFormatter;
|
|
@@ -379,6 +379,102 @@ export declare const assertYearStartMonth: (owner: string, value: unknown) => vo
|
|
|
379
379
|
* @throws RangeError when a supplied value is not an integer in [0, 11] / 指定された値が 0 以上 11 以下の整数でない場合
|
|
380
380
|
*/
|
|
381
381
|
export declare const resolveYearStartMonth: (owner: string, value: number | undefined) => number;
|
|
382
|
+
/**
|
|
383
|
+
* Throws unless a value names one of the time units: the one unit check of every public entry point.
|
|
384
|
+
* 値が時間単位のいずれかを名乗る場合を除いて送出する関数 (すべての公開の入口が共有する唯一の単位の判定)。
|
|
385
|
+
*
|
|
386
|
+
* The calendar arithmetic branches on "year" and "month" and counts everything else as days, so an unknown unit would
|
|
387
|
+
* be drawn, keyed and stepped in days, and the formatters and the Intl option tables would receive a unit they cannot
|
|
388
|
+
* name. Every public entry point therefore calls this with its own name and argument before it reads yearStartMonth,
|
|
389
|
+
* a date, an amount or a candidate list, and before any early return; functions that are not exported from the
|
|
390
|
+
* package root may assume a validated unit.
|
|
391
|
+
* 暦の算術は "year" と "month" で分岐し、それ以外をすべて日として数える。宣言外の単位は日で描かれ・数えられ・歩かれ、
|
|
392
|
+
* フォーマッタと Intl のオプション表は名乗れない単位を受け取る。このため公開の入口はすべて、yearStartMonth・日付・amount・
|
|
393
|
+
* 候補の一覧を読む前、どの早期 return よりも前に、自分の名前と引数名でこれを呼ぶ。パッケージのルートから公開していない関数は、
|
|
394
|
+
* 検証済みの単位を前提にしてよい。
|
|
395
|
+
*
|
|
396
|
+
* @param owner - API name quoted in the error message / エラーメッセージが名指しする API 名
|
|
397
|
+
* @param path - Argument, prop or option path quoted in the error message / エラーメッセージが名指しする引数・Props・オプション経路
|
|
398
|
+
* @param value - Value supplied by the caller / 呼び出し側が渡した値
|
|
399
|
+
* @returns Nothing; the function only throws or returns normally / 戻り値なし (正常時は無返却)
|
|
400
|
+
* @throws RangeError `<owner>: <path> must be one of "year", "month", "day" (received: ...)` when the value is not "year", "month" or "day" (`null`, `undefined`, a different case and `""` included) / "year"・"month"・"day" でない場合 (`null`・`undefined`・大文字違い・`""` を含む)
|
|
401
|
+
*/
|
|
402
|
+
export declare const assertPeriodSliderUnit: (owner: string, path: string, value: unknown) => void;
|
|
403
|
+
/**
|
|
404
|
+
* Resolves a unit option that defaults to the entry's own unit, defaulting only an omitted value.
|
|
405
|
+
* 入口自身の単位を既定とする単位のオプションを解決する関数 (未指定のときだけ既定へ畳む)。
|
|
406
|
+
*
|
|
407
|
+
* A vernier row's `macroUnit` / `microUnit` and resolveSelectorSteps' `stepUnit` default to the entry's unit when omitted.
|
|
408
|
+
* `null` is rejected rather than folded, like resolveYearStartMonth: a reader that folds it and a reader that keeps it
|
|
409
|
+
* would draw and step the same input in two different units.
|
|
410
|
+
* ノギスの行の `macroUnit` / `microUnit` と resolveSelectorSteps の `stepUnit` は、省略すると入口の単位になる。
|
|
411
|
+
* `null` は resolveYearStartMonth と同じく畳まずに拒否する (畳む読み手と畳まない読み手が並ぶと、同じ入力を 2 つの単位で描き・歩くため)。
|
|
412
|
+
*
|
|
413
|
+
* @param owner - API name quoted in the error message / エラーメッセージが名指しする API 名
|
|
414
|
+
* @param path - Prop or option path quoted in the error message / エラーメッセージが名指しする Props・オプション経路
|
|
415
|
+
* @param value - Value the caller supplied, or undefined when it was omitted / 呼び出し側が渡した値 (省略時は undefined)
|
|
416
|
+
* @param unit - The entry's own unit, already validated / 入口自身の単位 (検証済み)
|
|
417
|
+
* @returns The supplied unit, or unit when the value was omitted / 渡された単位 (省略時は unit)
|
|
418
|
+
* @throws RangeError `<owner>: <path> must be one of "year", "month", "day" (received: ...)` when a supplied value is not "year", "month" or "day" (`null` included) / 指定された値が "year"・"month"・"day" でない場合 (`null` を含む)
|
|
419
|
+
*/
|
|
420
|
+
export declare const resolveOptionalUnit: (owner: string, path: string, value: PeriodSliderUnit | undefined, unit: PeriodSliderUnit) => PeriodSliderUnit;
|
|
421
|
+
/**
|
|
422
|
+
* Number of days in a month of the proleptic Gregorian calendar, the calendar Date itself counts in.
|
|
423
|
+
* Date 自身が数える先発グレゴリオ暦での月の日数。
|
|
424
|
+
*
|
|
425
|
+
* This and the four functions below are the package's one definition of calendar arithmetic: encode("day"), addUnit,
|
|
426
|
+
* getMacroWindowEndDate and shiftUnitKey all count with them, so a sum that lies past the Date range is still counted as
|
|
427
|
+
* a key instead of collapsing into an Invalid Date.
|
|
428
|
+
* この関数と以下の 4 関数がパッケージで唯一の暦の算術の定義。encode("day")・addUnit・getMacroWindowEndDate・shiftUnitKey が
|
|
429
|
+
* これで数えるため、表現範囲を越える和も Invalid Date へ潰れずにキーとして数えられる。
|
|
430
|
+
*
|
|
431
|
+
* @param year - Calendar year; year 0 and negative years follow the same leap rule / 暦年 (0 年・負の年も同じ閏年の規則)
|
|
432
|
+
* @param monthIndex - 0-based calendar month / 0 始まりの暦月
|
|
433
|
+
* @returns Days in the month, 28 to 31 / その月の日数 (28〜31)
|
|
434
|
+
*/
|
|
435
|
+
export declare const daysInMonth: (year: number, monthIndex: number) => number;
|
|
436
|
+
/**
|
|
437
|
+
* Moves a civil date by whole months, clamping the day to the target month's last day (the month-end clamp rule).
|
|
438
|
+
* 暦の日付を整数か月動かす関数 (日は行き先の月の末日へ丸める。月末丸めの規則)。
|
|
439
|
+
*
|
|
440
|
+
* @param year - Calendar year / 暦年
|
|
441
|
+
* @param monthIndex - 0-based calendar month / 0 始まりの暦月
|
|
442
|
+
* @param day - Day of month / 日
|
|
443
|
+
* @param months - Signed whole number of months / 符号付きの整数の月数
|
|
444
|
+
* @returns Target [year, monthIndex, day] / 行き先の [暦年, 暦月 (0 始まり), 日]
|
|
445
|
+
*/
|
|
446
|
+
export declare const shiftCivilMonths: (year: number, monthIndex: number, day: number, months: number) => [number, number, number];
|
|
447
|
+
/**
|
|
448
|
+
* Day key of a civil date: the days since 1970-01-01 in the proleptic Gregorian calendar (days from civil).
|
|
449
|
+
* 暦の日付の日のキー (先発グレゴリオ暦で 1970-01-01 から数えた日数)。
|
|
450
|
+
*
|
|
451
|
+
* The first and last days of the Date range get -1e8 and 1e8; dates past the range still get their keys.
|
|
452
|
+
* Date の表現範囲の最初と最後の日は -1e8 と 1e8。範囲の外の日付もキーを持つ。
|
|
453
|
+
*
|
|
454
|
+
* @param year - Calendar year / 暦年
|
|
455
|
+
* @param monthIndex - 0-based calendar month / 0 始まりの暦月
|
|
456
|
+
* @param day - Day of month / 日
|
|
457
|
+
* @returns Integer day key, or NaN when a field is NaN / 整数の日のキー (欄が NaN なら NaN)
|
|
458
|
+
*/
|
|
459
|
+
export declare const dayKeyOfCivil: (year: number, monthIndex: number, day: number) => number;
|
|
460
|
+
/**
|
|
461
|
+
* Civil date of a day key, the inverse of dayKeyOfCivil.
|
|
462
|
+
* 日のキーの暦の日付を返す関数 (dayKeyOfCivil の逆写像)。
|
|
463
|
+
*
|
|
464
|
+
* @param key - Integer day key / 整数の日のキー
|
|
465
|
+
* @returns [year, monthIndex, day] of the key / キーの [暦年, 暦月 (0 始まり), 日]
|
|
466
|
+
*/
|
|
467
|
+
export declare const civilOfDayKey: (key: number) => [number, number, number];
|
|
468
|
+
/**
|
|
469
|
+
* Year key of a civil month under a year start: the calendar year the containing year's first month falls in.
|
|
470
|
+
* 年の開始月のもとで暦月が属する年のキー (その年の先頭月が属する暦年)。
|
|
471
|
+
*
|
|
472
|
+
* @param year - Calendar year of the month / 暦月の暦年
|
|
473
|
+
* @param monthIndex - 0-based calendar month / 0 始まりの暦月
|
|
474
|
+
* @param yearStartMonth - Calendar month a `unit: "year"` period starts in, 0-based / `unit: "year"` の 1 年が始まる暦月 (0 始まり)
|
|
475
|
+
* @returns The year key / 年のキー
|
|
476
|
+
*/
|
|
477
|
+
export declare const yearKeyOfCivil: (year: number, monthIndex: number, yearStartMonth: number) => number;
|
|
382
478
|
/**
|
|
383
479
|
* Normalizes a date to the start of the specified unit.
|
|
384
480
|
* 指定した単位 (year, month, day) の先頭に日付を正規化します。
|
|
@@ -387,7 +483,7 @@ export declare const resolveYearStartMonth: (owner: string, value: number | unde
|
|
|
387
483
|
* @param d - Date to normalize / 正規化対象の日付
|
|
388
484
|
* @param yearStartMonth - Calendar month a `unit: "year"` period starts in, 0-based; 0 keeps the calendar year (default: 0) / `unit: "year"` の 1 年が始まる暦月 (0 始まり)。0 は暦年 (既定: 0)
|
|
389
485
|
* @returns New Date pinned to the start of the unit / 単位先頭に揃えた新しい Date
|
|
390
|
-
* @throws RangeError when d is absent or an Invalid Date, or when yearStartMonth is not an integer in [0, 11] / d が未指定または Invalid Date の場合、yearStartMonth が 0 以上 11 以下の整数でない場合
|
|
486
|
+
* @throws RangeError when unit is not "year", "month" or "day", judged first (`normalizeDateByUnit: unit must be one of "year", "month", "day" (received: ...)`), when d is absent or an Invalid Date, or when yearStartMonth is not an integer in [0, 11] / unit が "year"・"month"・"day" でない場合 (最初に判定)、d が未指定または Invalid Date の場合、yearStartMonth が 0 以上 11 以下の整数でない場合
|
|
391
487
|
*/
|
|
392
488
|
export declare const normalizeDateByUnit: (unit: PeriodSliderUnit, d: Date, yearStartMonth?: number) => Date;
|
|
393
489
|
/**
|
|
@@ -398,7 +494,7 @@ export declare const normalizeDateByUnit: (unit: PeriodSliderUnit, d: Date, year
|
|
|
398
494
|
* @param d - Date to encode / エンコード対象の日付
|
|
399
495
|
* @param yearStartMonth - Calendar month a `unit: "year"` period starts in, 0-based; 0 keeps the calendar year (default: 0) / `unit: "year"` の 1 年が始まる暦月 (0 始まり)。0 は暦年 (既定: 0)
|
|
400
496
|
* @returns Integer key that is strictly monotonic in time for the given unit / 単位ごとに時間について厳密単調な整数キー
|
|
401
|
-
* @throws RangeError when d is absent or an Invalid Date, or when yearStartMonth is not an integer in [0, 11] / d が未指定または Invalid Date の場合、yearStartMonth が 0 以上 11 以下の整数でない場合
|
|
497
|
+
* @throws RangeError when unit is not "year", "month" or "day", judged first (`encode: unit must be one of "year", "month", "day" (received: ...)`), when d is absent or an Invalid Date, or when yearStartMonth is not an integer in [0, 11] / unit が "year"・"month"・"day" でない場合 (最初に判定)、d が未指定または Invalid Date の場合、yearStartMonth が 0 以上 11 以下の整数でない場合
|
|
402
498
|
*/
|
|
403
499
|
export declare const encode: (unit: PeriodSliderUnit, d: Date, yearStartMonth?: number) => number;
|
|
404
500
|
/**
|
|
@@ -409,20 +505,112 @@ export declare const encode: (unit: PeriodSliderUnit, d: Date, yearStartMonth?:
|
|
|
409
505
|
* @param val - Encoded integer key / エンコード済み整数キー
|
|
410
506
|
* @param yearStartMonth - Calendar month a `unit: "year"` period starts in, 0-based; 0 keeps the calendar year (default: 0) / `unit: "year"` の 1 年が始まる暦月 (0 始まり)。0 は暦年 (既定: 0)
|
|
411
507
|
* @returns Date pinned to the start of the encoded unit / エンコード単位の先頭に揃えた Date
|
|
412
|
-
* @throws RangeError when yearStartMonth is not an integer in [0, 11] / yearStartMonth が 0 以上 11 以下の整数でない場合
|
|
508
|
+
* @throws RangeError when unit is not "year", "month" or "day", judged first (`decode: unit must be one of "year", "month", "day" (received: ...)`), or when yearStartMonth is not an integer in [0, 11] / unit が "year"・"month"・"day" でない場合 (最初に判定)、yearStartMonth が 0 以上 11 以下の整数でない場合
|
|
413
509
|
*/
|
|
414
510
|
export declare const decode: (unit: PeriodSliderUnit, val: number, yearStartMonth?: number) => Date;
|
|
415
511
|
/**
|
|
416
|
-
*
|
|
417
|
-
*
|
|
512
|
+
* Builds the tail a rejection appends when a bound is a sentinel for "no bound", such as `new Date(-8.64e15)`.
|
|
513
|
+
* 境界が「境界なし」の番兵 (`new Date(-8.64e15)` など) のとき、拒否メッセージへ添える末尾を組む関数。
|
|
514
|
+
*
|
|
515
|
+
* Every such tail reads `; <advice> instead of a sentinel for "no bound"`, so the slider, the hooks and the three selectors differ only in the advice.
|
|
516
|
+
* どの末尾も `; <直し方> instead of a sentinel for "no bound"` の形であり、本体・フック・3 セレクタで異なるのは直し方だけ。
|
|
517
|
+
*
|
|
518
|
+
* @param advice - What to declare or pass instead, naming props without quotes / 代わりに宣言する・渡すもの (Props 名は引用符なし)
|
|
519
|
+
* @returns The tail, starting with "; " / "; " で始まる末尾
|
|
520
|
+
*/
|
|
521
|
+
export declare const sentinelBoundRemedy: (advice: string) => string;
|
|
522
|
+
/**
|
|
523
|
+
* Message tail that the slider and the four state hooks append when minDate falls in a unit starting outside the Date range.
|
|
524
|
+
* minDate is required, so the date is usually a sentinel for "no lower bound", such as `new Date(-8.64e15)`.
|
|
525
|
+
* 本体と 4 つの状態フックが、単位の始まりが Date の表現範囲の外にある minDate を拒否するときに添えるメッセージ末尾。
|
|
526
|
+
* minDate は必須のため、その日付はたいてい「下限なし」の番兵 (`new Date(-8.64e15)` など)。
|
|
527
|
+
*/
|
|
528
|
+
export declare const REQUIRED_MIN_DATE_REMEDY: string;
|
|
529
|
+
/**
|
|
530
|
+
* Encodes a date at a unit, failing when the start of that unit lies outside the Date range.
|
|
531
|
+
* 日付を単位の整数キーへ符号化する関数 (その単位の始まりが Date の表現範囲の外にある場合は送出)。
|
|
532
|
+
*
|
|
533
|
+
* A valid Date in the first unit of the Date range (`-8.64e15` ms) can fall in a unit whose start is not a Date: the month
|
|
534
|
+
* and the year of `new Date(-8.64e15)` start before it in every time zone, its day does outside UTC, and a year's start
|
|
535
|
+
* moves with `yearStartMonth`. `encode` returns `NaN` for such a date, and `NaN` passes every `<` / `>` containment test,
|
|
536
|
+
* so the date would slip past the domain checks and fail later under a function the caller never called. This is the one
|
|
537
|
+
* message that PeriodSlider, the state hooks, getSortedAllowedDates / resolveMicroRail, resolveMacroWindow,
|
|
538
|
+
* getMacroWindowStartDate, getMacroWindowEndDate (for the pairs that return d's own micro unit start), findNearestDateIndex,
|
|
539
|
+
* encodeStepOption and the three selectors (their Date props and candidate entries: YearSelector at year under its
|
|
540
|
+
* yearStartMonth, MonthSelector at month, DateSelector at day) share, over the one predicate keyInsideDateRange.
|
|
541
|
+
* A unit start never follows its date, so no date at the upper end of the Date range is rejected.
|
|
542
|
+
* Date の表現範囲 (`-8.64e15` ms) の最初の単位にある有効な Date は、始まりが Date にならない単位に属し得る
|
|
543
|
+
* (`new Date(-8.64e15)` の月と年はどの時間帯でもそれより前に始まり、日は UTC 以外で同様。年の始まりは `yearStartMonth` と共に動く)。
|
|
544
|
+
* そうした日付の `encode` は `NaN` を返し、`NaN` は `<` / `>` による内包の判定をすべて素通りするため、日付が定義域の検証を抜けて、
|
|
545
|
+
* 呼び出し側が呼んでいない関数の名で後から落ちる。本体・状態フック・getSortedAllowedDates / resolveMicroRail・resolveMacroWindow・
|
|
546
|
+
* getMacroWindowStartDate・getMacroWindowEndDate (d 自身のミクロ単位の始まりを返す組)・findNearestDateIndex・encodeStepOption・
|
|
547
|
+
* 3 セレクタ (Date 型 Props と候補の要素。YearSelector は yearStartMonth の年、MonthSelector は月、DateSelector は日) が
|
|
548
|
+
* 共有する唯一の文言 (判定は keyInsideDateRange の 1 つ)。
|
|
549
|
+
* 単位の始まりが日付より後になることはないため、表現範囲の上端の日付は拒否しない。
|
|
550
|
+
*
|
|
551
|
+
* @param owner - API name quoted in the error message / エラーメッセージが名指しする API 名
|
|
552
|
+
* @param path - Prop, option, entry point or argument quoted in the error message / エラーメッセージが名指しする Props・オプション・入口・引数
|
|
553
|
+
* @param date - Valid Date to encode; the caller has already rejected an Invalid Date / 符号化する有効な Date (Invalid Date は呼び出し側が拒否済み)
|
|
554
|
+
* @param unit - Unit the date is drawn or compared at (validated by the calling entry point) / 日付を描く・比べる単位 (呼び出し元の入口で検証済み)
|
|
555
|
+
* @param yearStartMonth - Calendar month a `unit: "year"` period starts in, 0-based / `unit: "year"` の 1 年が始まる暦月 (0 始まり)
|
|
556
|
+
* @param remedy - Text appended to the message, or "" for none / メッセージ末尾に添える文 (無ければ "")
|
|
557
|
+
* @returns The integer key of the date's unit / 日付が属する単位の整数キー
|
|
558
|
+
* @throws RangeError `<owner>: <path> must fall in a <unit> that starts inside the Date range (received: <ISO>)<remedy>` when the unit starts outside the Date range / 単位の始まりが Date の表現範囲の外にある場合
|
|
559
|
+
*/
|
|
560
|
+
export declare const encodeInsideDateRange: (owner: string, path: string, date: Date, unit: PeriodSliderUnit, yearStartMonth: number, remedy: string) => number;
|
|
561
|
+
/**
|
|
562
|
+
* Encodes a date at a unit, or reports that the start of that unit lies outside the Date range: the predicate of encodeInsideDateRange without the throw.
|
|
563
|
+
* 日付を単位の整数キーへ符号化する関数 (その単位の始まりが Date の表現範囲の外なら null)。encodeInsideDateRange の判定から送出を除いたもの。
|
|
564
|
+
*
|
|
565
|
+
* For callers that must decide rather than reject. A date the package computed by calendar arithmetic whose unit starts outside the
|
|
566
|
+
* Date range lies past the domain bound in the step's direction: both bounds fall in units that start inside the range, because
|
|
567
|
+
* minDate is checked at every unit it is drawn at and a unit start never follows its date.
|
|
568
|
+
* 拒否ではなく判断する呼び出し側のためのもの。パッケージが暦の算術で求めた日付の単位の始まりが表現範囲の外なら、その日付は進む向きの
|
|
569
|
+
* 定義域の端の外にある (minDate は描くすべての単位で判定され、単位の始まりは日付より後にならないため、両端は範囲の中で始まる単位にある)。
|
|
570
|
+
*
|
|
571
|
+
* @param date - Valid Date to encode / 符号化する有効な Date
|
|
572
|
+
* @param unit - Unit the date is drawn or compared at (validated by the calling entry point) / 日付を描く・比べる単位 (呼び出し元の入口で検証済み)
|
|
573
|
+
* @param yearStartMonth - Calendar month a `unit: "year"` period starts in, 0-based / `unit: "year"` の 1 年が始まる暦月 (0 始まり)
|
|
574
|
+
* @returns The integer key of the date's unit, or null when that unit starts outside the Date range / 日付が属する単位の整数キー (その単位の始まりが表現範囲の外なら null)
|
|
575
|
+
* @throws RangeError when date is absent or an Invalid Date, or when yearStartMonth is not an integer in [0, 11] (raised by encode) / date が未指定または Invalid Date の場合、yearStartMonth が 0 以上 11 以下の整数でない場合 (encode が送出)
|
|
576
|
+
*/
|
|
577
|
+
export declare const keyInsideDateRange: (date: Date, unit: PeriodSliderUnit, yearStartMonth: number) => number | null;
|
|
578
|
+
/**
|
|
579
|
+
* Adds or subtracts whole units from a given date, clamping the day of month to the target month length and keeping the local wall-clock time.
|
|
580
|
+
* 日付に対して整数の単位数を加減算します (月末日は加算先の月の末日に丸め、現地の時刻は保つ)。
|
|
581
|
+
*
|
|
582
|
+
* Month and year steps follow shiftCivilMonths and write year, month and day at once, so a step into the Date range's last
|
|
583
|
+
* month returns its date even from a month end. The result is an Invalid Date only when the sum itself lies past the Date range.
|
|
584
|
+
* 月・年の加算は shiftCivilMonths に従い年月日を 1 度で書くため、表現範囲の最後の月への加算も月末日からその日付を返す。
|
|
585
|
+
* Invalid Date になるのは和そのものが Date の表現範囲を越えるときだけ。
|
|
418
586
|
*
|
|
419
587
|
* @param unit - Time resolution unit to step by / 加減算する時間解像度単位
|
|
420
588
|
* @param d - Base date / 起点日付
|
|
421
|
-
* @param amount - Signed number of units to add /
|
|
422
|
-
* @returns New Date advanced by amount units / amount 単位進めた新しい Date
|
|
423
|
-
* @throws RangeError when d is absent or an Invalid Date / d が未指定または Invalid Date
|
|
589
|
+
* @param amount - Signed whole number of units to add / 加減算する整数の単位数 (符号付き)
|
|
590
|
+
* @returns New Date advanced by amount units, or an Invalid Date when the sum lies past the Date range / amount 単位進めた新しい Date (和が Date の表現範囲を越える場合は Invalid Date)
|
|
591
|
+
* @throws RangeError when unit is not "year", "month" or "day", judged first (`addUnit: unit must be one of "year", "month", "day" (received: ...)`), when d is absent or an Invalid Date (`addUnit: d must be a valid Date (received: ...)`), or when amount is not an integer (`addUnit: amount must be an integer number of units (received: ...)`) / unit が "year"・"month"・"day" でない場合 (最初に判定)、d が未指定または Invalid Date の場合、amount が整数でない場合
|
|
424
592
|
*/
|
|
425
593
|
export declare const addUnit: (unit: PeriodSliderUnit, d: Date, amount: number) => Date;
|
|
594
|
+
/**
|
|
595
|
+
* Shifts a unit key by whole units of a step unit with calendar arithmetic, never building a Date.
|
|
596
|
+
* 単位のキーを、別の単位の整数個ぶん暦の算術で動かす関数 (Date を組まない)。
|
|
597
|
+
*
|
|
598
|
+
* The key's unit start moves the way addUnit moves a date (the month-end clamp for months and years) and the landing date is keyed
|
|
599
|
+
* again at the key's unit, so for keys of ordinary dates the result equals encode(keyUnit, addUnit(stepUnit, decode(keyUnit, key), amount)).
|
|
600
|
+
* Because no Date is built, a sum past the Date range comes back as a key past the range's keys instead of an Invalid Date, and a
|
|
601
|
+
* carry can still place it.
|
|
602
|
+
* キーの単位の始まりを addUnit と同じ規則 (月・年は月末丸め) で動かし、着いた日付をキーの単位で数え直す。通常の日付のキーでは
|
|
603
|
+
* encode(keyUnit, addUnit(stepUnit, decode(keyUnit, key), amount)) と一致する。Date を組まないため、表現範囲を越える和も
|
|
604
|
+
* Invalid Date ではなく範囲のキーの外のキーとして返り、運ぶ側がそのまま収められる。
|
|
605
|
+
*
|
|
606
|
+
* @param keyUnit - Unit the key is encoded at (validated by the calling entry point) / キーを符号化した単位 (呼び出し元の入口で検証済み)
|
|
607
|
+
* @param key - Integer key at keyUnit / keyUnit の整数キー
|
|
608
|
+
* @param stepUnit - Unit to step by (validated by the calling entry point) / 動かす単位 (呼び出し元の入口で検証済み)
|
|
609
|
+
* @param amount - Signed whole number of stepUnit units / 符号付きの整数の stepUnit の数
|
|
610
|
+
* @param yearStartMonth - Calendar month a `unit: "year"` period starts in, 0-based / `unit: "year"` の 1 年が始まる暦月 (0 始まり)
|
|
611
|
+
* @returns Integer key at keyUnit of the moved unit start / 動かした単位の始まりの keyUnit の整数キー
|
|
612
|
+
*/
|
|
613
|
+
export declare const shiftUnitKey: (keyUnit: PeriodSliderUnit, key: number, stepUnit: PeriodSliderUnit, amount: number, yearStartMonth: number) => number;
|
|
426
614
|
/**
|
|
427
615
|
* Calculates the start boundary of a macro window in micro unit resolution.
|
|
428
616
|
* マクロ窓の開始境界を、ミクロ単位の解像度で算出する関数。
|
|
@@ -444,23 +632,27 @@ export declare const addUnit: (unit: PeriodSliderUnit, d: Date, amount: number)
|
|
|
444
632
|
* @param d - Macro range start date / マクロ範囲の開始日付
|
|
445
633
|
* @param yearStartMonth - Calendar month a `unit: "year"` period starts in, 0-based; 0 keeps the calendar year (default: 0) / `unit: "year"` の 1 年が始まる暦月 (0 始まり)。0 は暦年 (既定: 0)
|
|
446
634
|
* @returns Corrected boundary Date in micro unit resolution / 補正後のミクロ解像度開始日付
|
|
447
|
-
* @throws RangeError when d is absent or an Invalid Date,
|
|
635
|
+
* @throws RangeError when macroUnit or microUnit is not "year", "month" or "day" (`getMacroWindowStartDate: macroUnit must be one of "year", "month", "day" (received: ...)`), when d is absent or an Invalid Date, when yearStartMonth is not an integer in [0, 11], or when d falls in a macroUnit or microUnit that starts outside the Date range, judged in that order (`getMacroWindowStartDate: d must fall in a <unit> that starts inside the Date range (received: ...)`, encodeInsideDateRange) / macroUnit・microUnit が "year"・"month"・"day" でない場合、d が未指定または Invalid Date の場合、yearStartMonth が 0 以上 11 以下の整数でない場合、d の macroUnit・microUnit の始まりが Date の表現範囲の外にある場合 (この順に判定)
|
|
448
636
|
*/
|
|
449
637
|
export declare const getMacroWindowStartDate: (macroUnit: PeriodSliderUnit, microUnit: PeriodSliderUnit, d: Date, yearStartMonth?: number) => Date;
|
|
450
638
|
/**
|
|
451
639
|
* Calculates the end boundary of a macro window in micro unit resolution.
|
|
452
|
-
* When the macro unit is coarser than the micro unit,
|
|
453
|
-
*
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
640
|
+
* When the macro unit is coarser than the micro unit, the end is the start of the last micro unit of the macro period
|
|
641
|
+
* containing d (Month -> last day of that month; Year -> its twelfth month, or that month's last day, counted from
|
|
642
|
+
* `yearStartMonth` rather than from December): local midnight, or that day's first instant where midnight does not exist.
|
|
643
|
+
* The last unit is counted on keys, so years 0-99 keep their own year and a period whose start lies outside the Date
|
|
644
|
+
* range still yields its last unit. Otherwise the end is d's own micro unit start.
|
|
645
|
+
* マクロ側の時間単位がミクロ側より粗い場合に、d を含むマクロ期間の最後のミクロ単位の始まりを終了境界とする関数
|
|
646
|
+
* (年の末尾は 12 月ではなく `yearStartMonth` から数えて 12 番目の月。現地 0 時、0 時の無い日はその日の最初の瞬間)。
|
|
647
|
+
* 最後の単位はキーで数えるため、0-99 年は自分の年のまま、始まりが表現範囲の外にある期間も最後の単位を返す。
|
|
648
|
+
* それ以外の組では d 自身のミクロ単位の始まり。
|
|
457
649
|
*
|
|
458
650
|
* @param macroUnit - Macro scale unit / マクロ側の時間解像度単位
|
|
459
651
|
* @param microUnit - Micro scale unit / ミクロ側の時間解像度単位
|
|
460
652
|
* @param d - Macro range end date / マクロ範囲の終了日付
|
|
461
653
|
* @param yearStartMonth - Calendar month a `unit: "year"` period starts in, 0-based; 0 keeps the calendar year (default: 0) / `unit: "year"` の 1 年が始まる暦月 (0 始まり)。0 は暦年 (既定: 0)
|
|
462
654
|
* @returns Corrected boundary Date in micro unit resolution / 補正後のミクロ解像度終了日付
|
|
463
|
-
* @throws RangeError when d is absent or an Invalid Date,
|
|
655
|
+
* @throws RangeError when macroUnit or microUnit is not "year", "month" or "day", judged first in that order (`getMacroWindowEndDate: macroUnit must be one of "year", "month", "day" (received: ...)`), when d is absent or an Invalid Date, when yearStartMonth is not an integer in [0, 11], when the macro unit is coarser than the micro unit and the last micro unit of the macro period containing d starts outside the Date range (`getMacroWindowEndDate: d must fall in a <macroUnit> whose last <microUnit> starts inside the Date range (received: ...)`), or, for the other pairs (the same unit, or a macro unit finer than the micro unit), when d falls in a microUnit that starts outside the Date range (`getMacroWindowEndDate: d must fall in a <microUnit> that starts inside the Date range (received: ...)`, encodeInsideDateRange) / macroUnit・microUnit が "year"・"month"・"day" でない場合 (この順に最初に判定)、d が未指定または Invalid Date の場合、yearStartMonth が 0 以上 11 以下の整数でない場合、マクロ単位がミクロ単位より粗い組で d を含むマクロ期間の最後のミクロ単位の始まりが Date の表現範囲の外にある場合、それ以外の組 (同じ単位・マクロ単位のほうが細かい組) で d のミクロ単位の始まりが Date の表現範囲の外にある場合
|
|
464
656
|
*/
|
|
465
657
|
export declare const getMacroWindowEndDate: (macroUnit: PeriodSliderUnit, microUnit: PeriodSliderUnit, d: Date, yearStartMonth?: number) => Date;
|
|
466
658
|
/**
|
|
@@ -481,8 +673,8 @@ export declare const getMacroWindowEndDate: (macroUnit: PeriodSliderUnit, microU
|
|
|
481
673
|
* @param minDate - Domain lower boundary / 定義域の下限
|
|
482
674
|
* @param maxDate - Domain upper boundary / 定義域の上限
|
|
483
675
|
* @param yearStartMonth - Calendar month a `unit: "year"` period starts in, 0-based; 0 keeps the calendar year (default: 0) / `unit: "year"` の 1 年が始まる暦月 (0 始まり)。0 は暦年 (既定: 0)
|
|
484
|
-
* @returns Window tuple in micro unit resolution, guaranteed to lie inside [minDate, maxDate] at that resolution / そのミクロ解像度で [minDate, maxDate]
|
|
485
|
-
* @throws RangeError naming this function when macroRange is not a usable tuple, when a boundary is absent or an Invalid Date, when either pair is inverted,
|
|
676
|
+
* @returns Window tuple of valid Dates in micro unit resolution, guaranteed to lie inside [minDate, maxDate] at that resolution; a window whose terminal macro period is maxDate's period or later ends at maxDate's micro-unit start, decided on the macro keys without building the period's end, so a window reaching the Date range's last macro period is resolved too / そのミクロ解像度で [minDate, maxDate] の内側であることが保証された、有効な Date から成るミクロ解像度の窓タプル (末尾のマクロ期間が maxDate の期間かそれより後の窓は、期間の末尾を組まずにマクロのキーで判断して maxDate のミクロ単位の始まりで閉じるため、Date の表現範囲の最後のマクロ期間へ届く窓も解決する)
|
|
677
|
+
* @throws RangeError naming this function when macroUnit or microUnit is not "year", "month" or "day", judged first in that order (`resolveMacroWindow: macroUnit must be one of "year", "month", "day" (received: ...)`), when macroRange is not a usable tuple, when a boundary is absent or an Invalid Date, when either pair is inverted, when yearStartMonth is not an integer in [0, 11], when maxDate falls in a microUnit that starts outside the Date range (`resolveMacroWindow: maxDate must fall in a <unit> that starts inside the Date range (received: ...)`; a window end clamped to maxDate is folded at microUnit), or when macroRange[0] falls in a macroUnit or microUnit that starts outside the Date range (`resolveMacroWindow: macroRange[0] must fall in a <unit> that starts inside the Date range (received: ...)`, encodeInsideDateRange); minDate is not judged, because a window end is clamped to it only when it lies after that end / macroUnit・microUnit が "year"・"month"・"day" でない場合 (この順に最初に判定)、macroRange が利用可能なタプルでない場合、境界が未指定または Invalid Date の場合、いずれかの対が逆転している場合、yearStartMonth が 0 以上 11 以下の整数でない場合、maxDate の microUnit の始まりが Date の表現範囲の外にある場合 (maxDate へクランプした窓の端は microUnit で畳むため)、macroRange[0] の macroUnit または microUnit の始まりが Date の表現範囲の外にある場合 (メッセージは本関数を名指しする)。minDate は窓の端より後にあるときだけクランプの結果になるため判定しない
|
|
486
678
|
*/
|
|
487
679
|
export declare const resolveMacroWindow: (macroUnit: PeriodSliderUnit, microUnit: PeriodSliderUnit, macroRange: [Date, Date], minDate: Date, maxDate: Date, yearStartMonth?: number) => [Date, Date];
|
|
488
680
|
/**
|
|
@@ -567,7 +759,7 @@ export declare const formatIsoYear: (year: number) => string;
|
|
|
567
759
|
* @param customFormat - Consumer formatter taking priority over both built-in paths / 組み込み 2 経路より優先される利用側フォーマッタ
|
|
568
760
|
* @param formatLocale - BCP 47 language tag enabling Intl formatting (the `formatLocale` prop, not the UI chrome `locale`) / Intl 書式を有効化する BCP 47 言語タグ (UI クロームの `locale` ではなく `formatLocale` prop)
|
|
569
761
|
* @returns Formatted label, or an empty string when d is absent or an Invalid Date / 書式化済みラベル (d が未指定・Invalid Date の場合は空文字列)
|
|
570
|
-
* @throws RangeError when formatLocale is not a structurally valid BCP 47 tag / formatLocale が構造的に妥当な BCP 47 タグでない場合
|
|
762
|
+
* @throws RangeError when unit is not "year", "month" or "day", judged before the Invalid Date short-circuit and before customFormat is called (`formatLabel: unit must be one of "year", "month", "day" (received: ...)`), or when formatLocale is not a structurally valid BCP 47 tag / unit が "year"・"month"・"day" でない場合 (無効日付の短絡と customFormat の呼び出しより先に判定)、formatLocale が構造的に妥当な BCP 47 タグでない場合
|
|
571
763
|
*/
|
|
572
764
|
export declare const formatLabel: (unit: PeriodSliderUnit, d: Date, customFormat?: PeriodOptionFormatter, formatLocale?: string) => string;
|
|
573
765
|
/**
|
|
@@ -583,7 +775,7 @@ export declare const formatLabel: (unit: PeriodSliderUnit, d: Date, customFormat
|
|
|
583
775
|
* @param customFormat - Consumer formatter taking priority over both built-in paths / 組み込み 2 経路より優先される利用側フォーマッタ
|
|
584
776
|
* @param formatLocale - BCP 47 language tag enabling Intl formatting (the `formatLocale` prop, not the UI chrome `locale`) / Intl 書式を有効化する BCP 47 言語タグ (UI クロームの `locale` ではなく `formatLocale` prop)
|
|
585
777
|
* @returns Announced text, or an empty string when d is absent or an Invalid Date / 読み上げ文字列 (d が未指定・Invalid Date の場合は空文字列)
|
|
586
|
-
* @throws RangeError when formatLocale is not a structurally valid BCP 47 tag / formatLocale が構造的に妥当な BCP 47 タグでない場合
|
|
778
|
+
* @throws RangeError when unit is not "year", "month" or "day", judged before the Invalid Date short-circuit (`formatScreenReaderLabel: unit must be one of "year", "month", "day" (received: ...)`), or when formatLocale is not a structurally valid BCP 47 tag / unit が "year"・"month"・"day" でない場合 (無効日付の短絡より先に判定)、formatLocale が構造的に妥当な BCP 47 タグでない場合
|
|
587
779
|
*/
|
|
588
780
|
export declare const formatScreenReaderLabel: (unit: PeriodSliderUnit, d: Date, customFormat?: PeriodOptionFormatter, formatLocale?: string) => string;
|
|
589
781
|
/**
|
|
@@ -624,8 +816,8 @@ export declare const formatQuarterLabel: (d: Date, yearStartMonth: number) => st
|
|
|
624
816
|
* @param target - Date to locate / 探索対象の日付
|
|
625
817
|
* @param unit - Time resolution unit used for the distance metric / 距離尺度に用いる時間解像度単位
|
|
626
818
|
* @param yearStartMonth - Calendar month a `unit: "year"` period starts in, 0-based; 0 keeps the calendar year (default: 0) / `unit: "year"` の 1 年が始まる暦月 (0 始まり)。0 は暦年 (既定: 0)
|
|
627
|
-
* @returns Index of the closest entry, or 0 for
|
|
628
|
-
* @throws RangeError when target or
|
|
819
|
+
* @returns Index of the closest entry, or 0 for a list of 0 or 1 entries, which is returned without reading target / 最近傍要素のインデックス (要素が 0 個・1 個の一覧では target を読まずに 0)
|
|
820
|
+
* @throws RangeError naming this function when unit is not "year", "month" or "day", judged first and before the 0- and 1-entry returns (`findNearestDateIndex: unit must be one of "year", "month", "day" (received: ...)`), when target is not a valid Date (`findNearestDateIndex: target must be a valid Date (received: ...)`) or falls in a unit that starts outside the Date range (`findNearestDateIndex: target must fall in a <unit> that starts inside the Date range (received: ...)`, encodeInsideDateRange); RangeError from normalizeDateByUnit when an inspected entry is an Invalid Date (entries must be ascending and unit-normalized, and a normalized entry is its own unit start); RangeError when yearStartMonth is not an integer in [0, 11] / unit が "year"・"month"・"day" でない場合 (最初に、0 要素・1 要素の一覧で返すより先に判定)、target が有効な Date でない場合、target の単位の始まりが Date の表現範囲の外にある場合 (本関数を名乗る)。参照した要素が Invalid Date の場合 (normalizeDateByUnit が送出。要素は昇順かつ単位正規化済みであること)。yearStartMonth が 0 以上 11 以下の整数でない場合
|
|
629
821
|
*/
|
|
630
822
|
export declare const findNearestDateIndex: (dates: Date[], target: Date, unit: PeriodSliderUnit, yearStartMonth?: number) => number;
|
|
631
823
|
/**
|
|
@@ -638,10 +830,60 @@ export declare const findNearestDateIndex: (dates: Date[], target: Date, unit: P
|
|
|
638
830
|
* @param minDate - Lower domain boundary; entries before it are excluded / 定義域下限 (これより前の要素は除外)
|
|
639
831
|
* @param maxDate - Upper domain boundary; entries after it are excluded / 定義域上限 (これより後の要素は除外)
|
|
640
832
|
* @param yearStartMonth - Calendar month a `unit: "year"` period starts in, 0-based; 0 keeps the calendar year (default: 0) / `unit: "year"` の 1 年が始まる暦月 (0 始まり)。0 は暦年 (既定: 0)
|
|
641
|
-
* @returns Ascending, deduplicated dates inside the domain, or an empty array when allowedDates is
|
|
642
|
-
* @throws RangeError when an entry - a hole of a sparse array included - is not a valid Date (named by its index, e.g. `allowedDates[1]`), when every supplied entry falls outside the domain, or when yearStartMonth is not an integer in [0, 11] /
|
|
833
|
+
* @returns Ascending, deduplicated dates inside the domain, or an empty array when allowedDates is omitted (`undefined`) or empty / 定義域内の昇順・重複排除済み日付 (allowedDates が省略 (`undefined`)・空配列なら空配列)
|
|
834
|
+
* @throws RangeError naming this function when unit is not "year", "month" or "day", judged first, before yearStartMonth and before an omitted or empty list returns (`getSortedAllowedDates: unit must be one of "year", "month", "day" (received: ...)`), when allowedDates is supplied but is not an array (`null` included), when an entry - a hole of a sparse array included - is not a valid Date (named by its index, e.g. `allowedDates[1]`), when a non-empty allowedDates meets a minDate or maxDate that is not a valid Date (`getSortedAllowedDates: minDate must be a valid Date (received: Invalid Date)`), when a non-empty allowedDates meets a minDate or maxDate, or holds an entry, whose unit starts outside the Date range (`getSortedAllowedDates: minDate must fall in a month that starts inside the Date range (received: ...)`, encodeInsideDateRange), when every supplied entry falls outside the domain, or when yearStartMonth is not an integer in [0, 11] / 本関数を名乗って送出 (unit が "year"・"month"・"day" でない場合 (最初に、yearStartMonth より先、省略・空の一覧で返すより先に判定)、allowedDates が配列でない指定値 (`null` を含む) の場合、要素 (疎配列の穴を含む) が有効な Date でない場合 (`allowedDates[1]` のように添字で名指す)、空でない allowedDates に対し minDate・maxDate が有効な Date でない場合、空でない allowedDates に対し minDate・maxDate・要素の単位の始まりが Date の表現範囲の外にある場合、全要素が定義域外の場合、yearStartMonth が 0 以上 11 以下の整数でない場合)
|
|
643
835
|
*/
|
|
644
836
|
export declare const getSortedAllowedDates: (allowedDates: Date[] | undefined, unit: PeriodSliderUnit, minDate: Date, maxDate: Date, yearStartMonth?: number) => Date[];
|
|
837
|
+
/**
|
|
838
|
+
* API that reads a candidate list and names itself at the head of every message rejecting it.
|
|
839
|
+
* 候補の一覧を読み、それを拒否するすべてのメッセージの先頭で名乗る API。
|
|
840
|
+
*/
|
|
841
|
+
export type CandidateOwner = "PeriodSlider" | "usePeriodSliderRange" | "usePeriodSliderPoint" | "useVernierSliderRange" | "useVernierSliderPoint" | "getSortedAllowedDates";
|
|
842
|
+
/**
|
|
843
|
+
* A candidate list as a rail reads it: the raw list and where it came from, so that a message rejecting it names what the consumer wrote.
|
|
844
|
+
* レールが読む候補の一覧 (生の一覧とその出所。拒否するメッセージが利用側の書いたものを名指すため)。
|
|
845
|
+
*/
|
|
846
|
+
export interface CandidateList {
|
|
847
|
+
/** The list as supplied, `undefined` when omitted; not yet validated / 渡されたままの一覧 (省略時は `undefined`。未検証) */
|
|
848
|
+
readonly list: Date[] | undefined;
|
|
849
|
+
/** Prop or option the list came from, as the consumer wrote it / 一覧が来た Props・オプション (利用側が書いた名前) */
|
|
850
|
+
readonly path: "allowedDates" | "macroAllowedDates" | "microAllowedDates";
|
|
851
|
+
/** Vernier row that read the shared `allowedDates` because it omits its own list, or null / 自分の一覧を省略したため共有の `allowedDates` を読んだノギスの行 (無ければ null) */
|
|
852
|
+
readonly inheritedBy: "macro" | "micro" | null;
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* The candidate list named `allowedDates`, read directly rather than inherited by a vernier row.
|
|
856
|
+
* `allowedDates` という名の候補の一覧 (ノギスの行が継いだのではなく、直接読むもの)。
|
|
857
|
+
*
|
|
858
|
+
* @param allowedDates - The list as supplied / 渡されたままの一覧
|
|
859
|
+
* @returns The list with its origin / 出所付きの一覧
|
|
860
|
+
*/
|
|
861
|
+
export declare const allowedDatesList: (allowedDates: Date[] | undefined) => CandidateList;
|
|
862
|
+
/**
|
|
863
|
+
* Validates a candidate list and resolves its candidates inside the domain, with the keys that ordered and deduplicated them.
|
|
864
|
+
* 候補の一覧を検証し、定義域内の候補と、その並べ替えと重複排除に使ったキーを解決する関数。
|
|
865
|
+
*
|
|
866
|
+
* The slider, the four state hooks and getSortedAllowedDates read every candidate list through this one function. Its
|
|
867
|
+
* messages name the owner and the list as the consumer wrote it (`PeriodSlider: microAllowedDates[3] ...`) and, for a
|
|
868
|
+
* vernier row that inherited the shared list, which row read it (`useVernierSliderRange: allowedDates[3] (inherited by
|
|
869
|
+
* the micro row) ...`), because the row's unit decides whether an entry lies inside the domain.
|
|
870
|
+
* 本体・4 つの状態フック・getSortedAllowedDates は、候補の一覧をすべてこの 1 つの関数で読む。メッセージは所有者と利用側が書いたとおりの
|
|
871
|
+
* 一覧を名乗り (`PeriodSlider: microAllowedDates[3] ...`)、共有の一覧を継いだノギスの行ならどの行が読んだかも名乗る
|
|
872
|
+
* (`useVernierSliderRange: allowedDates[3] (inherited by the micro row) ...`)。要素が定義域に入るかは行の単位で決まるため。
|
|
873
|
+
*
|
|
874
|
+
* @param owner - API named at the head of every message / すべてのメッセージの先頭で名乗る API
|
|
875
|
+
* @param candidates - The list and its origin / 一覧とその出所
|
|
876
|
+
* @param unit - Time resolution unit used for normalization and deduplication (validated by the calling entry point) / 正規化・重複排除に用いる時間解像度単位 (呼び出し元の入口で検証済み)
|
|
877
|
+
* @param minDate - Lower domain boundary; entries before it are excluded / 定義域下限 (これより前の要素は除外)
|
|
878
|
+
* @param maxDate - Upper domain boundary; entries after it are excluded / 定義域上限 (これより後の要素は除外)
|
|
879
|
+
* @param yearStartMonth - Calendar month a `unit: "year"` period starts in, 0-based / `unit: "year"` の 1 年が始まる暦月 (0 始まり)
|
|
880
|
+
* @returns Strictly ascending keys and, at the same index, the normalized date each key stands for; both empty when the list is omitted (`undefined`) or empty / 狭義昇順のキーと、同じ添字にそのキーが表す正規化済みの日付 (一覧が省略 (`undefined`)・空配列ならどちらも空)
|
|
881
|
+
* @throws RangeError naming owner when yearStartMonth is not an integer in [0, 11], when the list is supplied but is not an array (`null` included: `<owner>: <path><origin> must be an array of Dates (received: ...)`), when a non-empty list meets a minDate or maxDate that is not a valid Date (`<owner>: minDate|maxDate must be a valid Date (received: ...)`) or whose unit starts outside the Date range (`<owner>: minDate|maxDate must fall in a <unit> that starts inside the Date range (received: ...)`); only getSortedAllowedDates reaches either, because the slider and the hooks validate their bounds at this unit first), when an entry - a hole of a sparse array included - is not a valid Date (`<owner>: <path>[i]<origin> must be a valid Date (received: ...)`), when an entry falls in a unit that starts outside the Date range (`<owner>: <path>[i]<origin> must fall in a <unit> that starts inside the Date range (received: ...)`), or when every entry falls outside the domain (`<owner>: every <path> entry<origin> falls outside [minDate, maxDate] (...)`); origin is empty or ` (inherited by the macro|micro row)` / owner を名乗って送出 (0 以上 11 以下の整数でない yearStartMonth、配列でない指定値 (`null` を含む)、空でない一覧に対する有効な Date でない minDate・maxDate と、単位の始まりが Date の表現範囲の外にある minDate・maxDate (本体とフックはこの単位で境界を先に検証するため、どちらも届くのは getSortedAllowedDates だけ)、有効な Date でない要素 (疎配列の穴を含む)、単位の始まりが Date の表現範囲の外にある要素、全要素が定義域外。origin は空か ` (inherited by the macro|micro row)`)
|
|
882
|
+
*/
|
|
883
|
+
export declare const sortAllowedDates: (owner: CandidateOwner, candidates: CandidateList, unit: PeriodSliderUnit, minDate: Date, maxDate: Date, yearStartMonth: number) => {
|
|
884
|
+
readonly keys: number[];
|
|
885
|
+
readonly dates: Date[];
|
|
886
|
+
};
|
|
645
887
|
/**
|
|
646
888
|
* A vernier's discrete micro rail resolved over the domain: its candidates as a set over their keys, and the date each key stands for.
|
|
647
889
|
* 定義域で解決したノギスの離散ミクロレール (キーの候補集合と、各キーが表す日付)。
|
|
@@ -661,15 +903,16 @@ export type MicroRail = Extract<DrawnValues, {
|
|
|
661
903
|
* 1 度だけ解決し、窓ごとには解決しない。窓はそのキーを二分探索で絞るため、窓を動かす費用は一覧の大きさに比例しない。
|
|
662
904
|
* 本体とノギスの 2 つのフックは、この 1 つの関数でレールを読む。
|
|
663
905
|
*
|
|
664
|
-
* @param
|
|
665
|
-
* @param
|
|
906
|
+
* @param owner - API named by the messages that reject the list / 一覧を拒否するメッセージが名乗る API
|
|
907
|
+
* @param candidates - The micro row's candidate list and its origin (resolveVernierRowAllowedDates) / ミクロ行の候補の一覧とその出所 (resolveVernierRowAllowedDates)
|
|
908
|
+
* @param unit - Micro scale unit (validated by the calling entry point) / ミクロ側の時間解像度単位 (呼び出し元の入口で検証済み)
|
|
666
909
|
* @param minDate - Domain lower boundary / 定義域の下限
|
|
667
910
|
* @param maxDate - Domain upper boundary / 定義域の上限
|
|
668
911
|
* @param yearStartMonth - Calendar month a `unit: "year"` period starts in, 0-based / `unit: "year"` の 1 年が始まる暦月 (0 始まり)
|
|
669
|
-
* @returns The rail, or null when
|
|
670
|
-
* @throws {RangeError} Exactly as
|
|
912
|
+
* @returns The rail, or null when the list is omitted (`undefined`) or empty / レール (候補の一覧が省略 (`undefined`)・空なら null)
|
|
913
|
+
* @throws {RangeError} Exactly as sortAllowedDates, naming owner and the list (a list that is not an array, an entry that is not a valid Date, an entry whose unit starts outside the Date range, every entry outside [minDate, maxDate], an invalid yearStartMonth) / sortAllowedDates と同じ (owner と一覧を名乗る。配列でない一覧、有効な Date でない要素、単位の始まりが Date の表現範囲の外にある要素、全要素が定義域の外、不正な yearStartMonth)
|
|
671
914
|
*/
|
|
672
|
-
export declare const resolveMicroRail: (
|
|
915
|
+
export declare const resolveMicroRail: (owner: CandidateOwner, candidates: CandidateList, unit: PeriodSliderUnit, minDate: Date, maxDate: Date, yearStartMonth: number) => MicroRail | null;
|
|
673
916
|
/**
|
|
674
917
|
* The rail's own dates inside a window of its keys, for a reader that takes dates (a selector's candidate list, the slider's discrete rail maths).
|
|
675
918
|
* キーの窓の内側にあるレール自身の日付 (日付を読む相手、つまりセレクタの候補の一覧と本体の離散レールの計算のため)。
|
|
@@ -721,6 +964,7 @@ export interface ConnectDragValueOptions {
|
|
|
721
964
|
*
|
|
722
965
|
* @param options - Drag geometry, domain bounds and snapping configuration / ドラッグ形状・定義域・スナップ設定
|
|
723
966
|
* @returns Clamped [low, high] pair in the slider value space / スライダー値空間へクランプ済みの [下限, 上限]
|
|
967
|
+
* @throws RangeError when unit is not "year", "month" or "day", judged first in every mode, including the continuous and index-snapped ones that never read it (`calculateConnectDragValues: unit must be one of "year", "month", "day" (received: ...)`) / unit が "year"・"month"・"day" でない場合 (単位を読まない連続・インデックススナップを含むすべてのモードで最初に判定)
|
|
724
968
|
*/
|
|
725
969
|
export declare const calculateConnectDragValues: ({ posDiffPct, startLowVal, startHighVal, rangeMin, rangeMax, isDiscrete, sortedAllowedDates, snapMode, unit, yearStartMonth }: ConnectDragValueOptions) => [number, number];
|
|
726
970
|
/**
|
|
@@ -777,32 +1021,52 @@ export declare const calculateLabelSlant: (lowPct: number, highPct: number, trac
|
|
|
777
1021
|
*/
|
|
778
1022
|
export type MacroWindowMotion = "pan" | "resize";
|
|
779
1023
|
/**
|
|
780
|
-
*
|
|
781
|
-
*
|
|
1024
|
+
* Whether a vernier row's rail is discrete: only the value `true` turns a row discrete.
|
|
1025
|
+
* ノギスの行のレールが離散か (行を離散にするのは値 `true` だけ)。
|
|
782
1026
|
*
|
|
783
|
-
*
|
|
784
|
-
*
|
|
785
|
-
*
|
|
786
|
-
*
|
|
787
|
-
*
|
|
1027
|
+
* The component and the vernier hooks read the row flags through this one rule, so the slider a hook renders never reads
|
|
1028
|
+
* a row as discrete, and validates its candidate list, when the hook read that row as continuous. Any other value,
|
|
1029
|
+
* including a truthy non-boolean such as `1` from an untyped host, leaves the row continuous, as an omitted flag does.
|
|
1030
|
+
* 本体とノギスのフックは行のフラグをすべてこの 1 つの規則で読む (フックが連続と読んだ行を、それを描くスライダーが離散と読んで候補の一覧を検証することがない)。
|
|
1031
|
+
* それ以外の値 (型の無いホストが渡す `1` のような、真と評価される真偽値以外の値を含む) は、省略したフラグと同じく行を連続のままにする。
|
|
1032
|
+
*
|
|
1033
|
+
* @param row - Row whose flag to read / フラグを読む行
|
|
1034
|
+
* @param props - Props carrying the row flags / 行のフラグを持つ Props
|
|
1035
|
+
* @returns True only when the row's flag is `true` / 行のフラグが `true` のときだけ true
|
|
788
1036
|
*/
|
|
1037
|
+
export declare const isVernierRowDiscrete: (row: "macro" | "micro", props: {
|
|
1038
|
+
readonly macroIsDiscrete?: boolean;
|
|
1039
|
+
readonly microIsDiscrete?: boolean;
|
|
1040
|
+
}) => boolean;
|
|
789
1041
|
/**
|
|
790
|
-
* Resolves the candidate list a vernier row's rail reads: the row's own list when
|
|
791
|
-
*
|
|
1042
|
+
* Resolves the candidate list a vernier row's rail reads, with its origin: the row's own list when supplied, otherwise the shared `allowedDates`.
|
|
1043
|
+
* ノギスの行のレールが読む候補の一覧を出所付きで解決する関数 (行の一覧が指定されていればそれ、無ければ共有の `allowedDates`)。
|
|
792
1044
|
*
|
|
793
1045
|
* The component, the vernier hooks and their step targets all read a row's candidates through this one rule, so a row
|
|
794
|
-
* that inherits the shared list cannot resolve to a different list in one of them.
|
|
1046
|
+
* that inherits the shared list cannot resolve to a different list in one of them. Only an omitted (`undefined`) row list
|
|
1047
|
+
* inherits: `null` is a supplied value, read as the row's own list and rejected by name where the list is validated.
|
|
795
1048
|
* 本体・ノギスのフック・その 1 歩の行き先は、行の候補をすべてこの 1 つの規則で読む (共有の一覧を継ぐ行が、どこか 1 か所でだけ別の一覧に解決されることがない)。
|
|
1049
|
+
* 継ぐのは省略 (`undefined`) した行の一覧だけで、`null` は指定値として行自身の一覧になり、一覧を検証する所で名指しで拒否される。
|
|
796
1050
|
*
|
|
797
1051
|
* @param row - Row whose candidates to read / 候補を読む行
|
|
798
1052
|
* @param props - Props carrying the row lists and the shared list / 行の一覧と共有の一覧を持つ Props
|
|
799
|
-
* @returns The row's
|
|
1053
|
+
* @returns The row's own list when supplied, else the shared list inherited by the row (its list `undefined` when that is omitted too) / 行の一覧 (指定時)、無ければ行が継いだ共有の一覧 (それも省略なら一覧は `undefined`)
|
|
800
1054
|
*/
|
|
801
1055
|
export declare const resolveVernierRowAllowedDates: (row: "macro" | "micro", props: {
|
|
802
1056
|
readonly macroAllowedDates?: Date[];
|
|
803
1057
|
readonly microAllowedDates?: Date[];
|
|
804
1058
|
readonly allowedDates?: Date[];
|
|
805
|
-
}) =>
|
|
1059
|
+
}) => CandidateList;
|
|
1060
|
+
/**
|
|
1061
|
+
* Places one held pair on a rail according to how that rail's window moved.
|
|
1062
|
+
* 窓の動き方に応じて、保持している対 1 組をレール上へ配置する関数。
|
|
1063
|
+
*
|
|
1064
|
+
* @param motion - How the macro window moved / マクロ窓の動き方
|
|
1065
|
+
* @param rail - Drawn values of the rail the pair lands on / 対が載るレールの描画値
|
|
1066
|
+
* @param low - Encoded lower end of the held pair / 保持している対の符号化済み下端
|
|
1067
|
+
* @param high - Encoded upper end of the held pair / 保持している対の符号化済み上端
|
|
1068
|
+
* @returns Placed [low, high] pair, or null when the rail draws nothing / 配置後の [下端, 上端] の対 (レールが何も描かないときは null)
|
|
1069
|
+
*/
|
|
806
1070
|
export declare const placePairIntoMacroWindow: (motion: MacroWindowMotion, rail: DrawnValues, low: number, high: number) => [number, number] | null;
|
|
807
1071
|
/**
|
|
808
1072
|
* Grabbable part of a vernier slider, naming both the rail and the element on it.
|
|
@@ -911,6 +1175,17 @@ export declare const VernierKnobSvg: React.NamedExoticComponent<{
|
|
|
911
1175
|
isVertical?: boolean;
|
|
912
1176
|
isLeft?: boolean;
|
|
913
1177
|
}>;
|
|
1178
|
+
/**
|
|
1179
|
+
* Validates a BCP 47 language tag prop and fails fast on a tag Intl cannot use; the one check PeriodSlider and the three selectors share.
|
|
1180
|
+
* BCP 47 言語タグ Props を検証し、Intl が解釈できないタグで即座に失敗させる関数 (本体と 3 セレクタが共有する唯一の検査)。
|
|
1181
|
+
*
|
|
1182
|
+
* @param owner - Component named at the head of the message / メッセージの先頭で名乗るコンポーネント
|
|
1183
|
+
* @param propName - Prop name quoted in the error message / エラーメッセージへ埋め込む Props 名
|
|
1184
|
+
* @param tag - Raw prop value supplied by the consumer / 利用側が指定した生の Props 値
|
|
1185
|
+
* @returns Nothing; the function only throws or returns normally / 戻り値なし (正常時は無返却)
|
|
1186
|
+
* @throws RangeError `<owner>: <propName> must be a valid BCP 47 language tag (received: ...)` when the value is not a structurally valid language tag / 値が構造的に妥当な言語タグでない場合
|
|
1187
|
+
*/
|
|
1188
|
+
export declare const assertLocaleTag: (owner: string, propName: string, tag: unknown) => void;
|
|
914
1189
|
/**
|
|
915
1190
|
* Layout size of a rendered element in CSS pixels, unaffected by any CSS transform.
|
|
916
1191
|
* CSS トランスフォームの影響を受けない描画済み要素のレイアウトサイズ (CSS ピクセル)。
|
|
@@ -1034,6 +1309,8 @@ export declare const arePeriodSliderPropsEqual: (prev: PeriodSliderProps, next:
|
|
|
1034
1309
|
*
|
|
1035
1310
|
* Re-renders only when arePeriodSliderPropsEqual reports a functional difference.
|
|
1036
1311
|
* arePeriodSliderPropsEqual が機能的差分を報告した場合にのみ再描画。
|
|
1312
|
+
*
|
|
1313
|
+
* @throws RangeError during render when a prop is missing, malformed or outside the domain (README "実行時バリデーション (Fail Fast)"); the units are judged first, before yearStartMonth and the domain: `unit` in every mode, then in vernier mode a supplied `macroUnit` and `microUnit`, each rejected when it is not "year", "month" or "day" (`null` included; only an omitted row unit means `unit`) with `PeriodSlider: <prop> must be one of "year", "month", "day" (received: ...)` / Props が欠落・不正・定義域外の場合に描画中に送出 (README「実行時バリデーション (Fail Fast)」)。単位は年の開始月・定義域より先に判定する (全モードの `unit`、続いてノギスで指定された `macroUnit`・`microUnit`。"year"・"month"・"day" でなければ `null` も含めて拒否し、`unit` になるのは行の単位を省略したときだけ)
|
|
1037
1314
|
*/
|
|
1038
1315
|
export declare const PeriodSlider: React.NamedExoticComponent<PeriodSliderProps>;
|
|
1039
1316
|
export {};
|