fui-material 2.2.4 → 2.2.6
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.
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
type FormatOption = "iso" | "ru" | "ru-datetime" | "date" | "time" | "custom";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Настройки форматирования даты, generic по формату F
|
|
4
|
+
*/
|
|
5
|
+
type ConvertDateOptions<F extends FormatOption = FormatOption> = {
|
|
3
6
|
/**
|
|
4
7
|
* Стандартные форматы:
|
|
5
8
|
* - "iso" → YYYY-MM-DD
|
|
@@ -9,12 +12,16 @@ interface ConvertDateOptions {
|
|
|
9
12
|
* - "date" → объект Date
|
|
10
13
|
* - "custom" → использовать `customOptions`
|
|
11
14
|
*/
|
|
12
|
-
format?:
|
|
15
|
+
format?: F;
|
|
13
16
|
/** Локаль для кастомного формата (по умолчанию "ru-RU") */
|
|
14
17
|
locale?: string;
|
|
15
18
|
/** Опции для Intl.DateTimeFormat при `format: "custom"` */
|
|
16
19
|
customOptions?: Intl.DateTimeFormatOptions;
|
|
17
|
-
}
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Тип возвращаемого значения в зависимости от выбранного формата
|
|
23
|
+
*/
|
|
24
|
+
type ConvertDateReturnType<F extends FormatOption | undefined> = F extends "date" ? Date | undefined : string;
|
|
18
25
|
/**
|
|
19
26
|
* Универсальный конвертер даты и времени.
|
|
20
27
|
*
|
|
@@ -28,33 +35,13 @@ interface ConvertDateOptions {
|
|
|
28
35
|
* @returns Отформатированная дата/время или '' / undefined для пустых значений
|
|
29
36
|
*
|
|
30
37
|
* @example
|
|
31
|
-
* //
|
|
32
|
-
* convertDate("2025-10-02T15:30:45", { format: "
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* //
|
|
36
|
-
* convertDate("
|
|
37
|
-
* // "02.10.2025"
|
|
38
|
-
*
|
|
39
|
-
* // Русская дата и время
|
|
40
|
-
* convertDate("2025-10-02T15:30:45", { format: "ru-datetime" });
|
|
41
|
-
* // "02.10.2025 15:30:45"
|
|
42
|
-
*
|
|
43
|
-
* // Только время
|
|
44
|
-
* convertDate(new Date(), { format: "time" });
|
|
45
|
-
* // "14:30:05"
|
|
46
|
-
*
|
|
47
|
-
* // Объект Date
|
|
48
|
-
* convertDate(1696262400000, { format: "date" });
|
|
49
|
-
* // Date object
|
|
50
|
-
*
|
|
51
|
-
* // Кастомный формат
|
|
52
|
-
* convertDate(new Date(), {
|
|
53
|
-
* format: "custom",
|
|
54
|
-
* locale: "en-US",
|
|
55
|
-
* customOptions: { weekday: "long", month: "long", day: "numeric", year: "numeric" }
|
|
56
|
-
* });
|
|
38
|
+
* convertDate("2025-10-02T15:30:45", { format: "iso" }); // "2025-10-02"
|
|
39
|
+
* convertDate("2025-10-02T15:30:45", { format: "ru" }); // "02.10.2025"
|
|
40
|
+
* convertDate("2025-10-02T15:30:45", { format: "ru-datetime" }); // "02.10.2025 15:30:45"
|
|
41
|
+
* convertDate(new Date(), { format: "time" }); // "14:30:05"
|
|
42
|
+
* convertDate(1696262400000, { format: "date" }); // Date object
|
|
43
|
+
* convertDate(new Date(), { format: "custom", locale: "en-US", customOptions: { weekday: "long" } });
|
|
57
44
|
* // "Thursday, October 2, 2025"
|
|
58
45
|
*/
|
|
59
|
-
declare function fConvertDate(input: string | number | Date | null | undefined, options?: ConvertDateOptions):
|
|
46
|
+
declare function fConvertDate<F extends FormatOption = "iso">(input: string | number | Date | null | undefined, options?: ConvertDateOptions<F>): ConvertDateReturnType<F>;
|
|
60
47
|
export default fConvertDate;
|
|
@@ -15,6 +15,11 @@ export interface IFSelectSearchDb<T> {
|
|
|
15
15
|
* Функция, возвращающая строковое представление элемента (для отображения).
|
|
16
16
|
*/
|
|
17
17
|
selectItem: (item: T) => string;
|
|
18
|
+
/**
|
|
19
|
+
* Callback, вызываемый при вводе данных в поле ввода.
|
|
20
|
+
* @param {File[] | null} file - Массив выбранных файлов или `null`, если файлы удалены.
|
|
21
|
+
*/
|
|
22
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
18
23
|
/**
|
|
19
24
|
* Текст метки поля ввода.
|
|
20
25
|
*/
|
|
@@ -135,5 +140,5 @@ export interface IFSelectSearchDb<T> {
|
|
|
135
140
|
*
|
|
136
141
|
* @returns {JSX.Element} — Рендерит поле ввода с выпадающим списком результатов поиска.
|
|
137
142
|
*/
|
|
138
|
-
declare const FSelectSearchDb: <T>({ fetchingFunc, selectedElement, selectItem, st, id, className, disabled, readOnly, fullWidth, label, onBlur, onFocus, errText, helpText, required, defaultValue, type, placeholder, }: IFSelectSearchDb<T>) => import("react/jsx-runtime").JSX.Element;
|
|
143
|
+
declare const FSelectSearchDb: <T>({ fetchingFunc, selectedElement, selectItem, onChange, st, id, className, disabled, readOnly, fullWidth, label, onBlur, onFocus, errText, helpText, required, defaultValue, type, placeholder, }: IFSelectSearchDb<T>) => import("react/jsx-runtime").JSX.Element;
|
|
139
144
|
export default FSelectSearchDb;
|