Files
ox_lib/web/src/interfaces/dialog.ts

66 lines
1.5 KiB
TypeScript
Raw Normal View History

2022-08-27 15:58:36 +02:00
import { IconProp } from '@fortawesome/fontawesome-svg-core';
2023-02-14 11:17:39 +01:00
type BaseField<T, U> = {
type: T;
label: string;
2023-02-14 11:17:39 +01:00
description?: string;
placeholder?: string;
2023-02-14 11:17:39 +01:00
default?: U;
icon?: IconProp;
disabled?: boolean;
2023-01-08 11:35:30 +01:00
required?: boolean;
2023-02-14 11:17:39 +01:00
};
export interface IInput extends BaseField<'input', string> {
password?: boolean;
}
export interface ICheckbox {
2022-08-27 15:58:36 +02:00
type: 'checkbox';
label: string;
checked?: boolean;
disabled?: boolean;
description?: string;
2023-01-08 11:35:30 +01:00
required?: boolean;
}
export type OptionValue = { value: string; label?: string };
2023-02-14 11:17:39 +01:00
export interface ISelect extends BaseField<'select' | 'multi-select', string | string[]> {
options: Array<OptionValue>;
clearable?: boolean;
}
2023-02-14 11:17:39 +01:00
export interface INumber extends BaseField<'number', number> {
2022-08-27 15:58:36 +02:00
min?: number;
max?: number;
}
2023-02-14 11:17:39 +01:00
export interface ISlider extends Omit<BaseField<'slider', number>, 'description' | 'placeholder'> {
min?: number;
max?: number;
step?: number;
}
2023-01-08 11:23:50 +01:00
2023-02-14 11:17:39 +01:00
export interface IColorInput extends BaseField<'color', string> {
2023-01-08 11:23:50 +01:00
format?: 'hex' | 'hexa' | 'rgb' | 'rgba' | 'hsl' | 'hsla';
}
2023-01-13 19:09:07 +01:00
2023-02-14 11:17:39 +01:00
export interface IDateInput
extends Omit<BaseField<'date' | 'date-range', string | [string, string] | true>, 'placeholder'> {
format?: string;
2023-01-14 13:36:30 +01:00
clearable?: boolean;
min?: string;
max?: string;
2023-01-13 19:09:07 +01:00
}
2023-01-15 11:44:14 +01:00
2023-02-14 11:17:39 +01:00
export interface ITimeInput extends Omit<BaseField<'time', string>, 'placeholder'> {
format?: '12' | '24';
clearable?: boolean;
}
2023-02-14 11:17:39 +01:00
export interface ITextarea extends BaseField<'textarea', string> {
2023-01-15 11:44:14 +01:00
autosize?: boolean;
min?: number;
max?: number;
}