Files
ox_lib/package/client/resource/interface/input.ts

46 lines
1.2 KiB
TypeScript
Raw Normal View History

2022-09-14 13:50:32 +02:00
import { IconName, IconPrefix } from '@fortawesome/fontawesome-common-types';
2023-02-15 13:51:46 +01:00
// Should really be improved at some point to only display properties depending on the input type
2022-09-14 13:50:32 +02:00
interface InputDialogRowProps {
2023-02-15 13:51:46 +01:00
type:
| 'input'
| 'number'
| 'checkbox'
| 'select'
| 'multi-select'
| 'slider'
| 'color'
| 'date'
| 'date-range'
| 'time'
| 'text-area';
2022-09-14 13:50:32 +02:00
label: string;
options?: { value: string; label: string; default?: string }[];
password?: boolean;
icon?: IconName | [IconPrefix, IconName];
iconColor?: string;
placeholder?: string;
default?: string | number;
disabled?: boolean;
2022-09-14 13:50:32 +02:00
checked?: boolean;
min?: number;
max?: number;
2023-02-15 13:51:46 +01:00
autosize?: boolean;
2022-09-14 13:50:32 +02:00
step?: number;
2023-02-15 13:51:46 +01:00
required?: boolean;
format?: string;
returnString?: boolean;
description?: string;
2022-09-14 13:50:32 +02:00
}
type inputDialog = (
heading: string,
2023-02-15 13:51:46 +01:00
rows: string[] | InputDialogRowProps[],
options: {
allowCancel?: boolean;
}
2022-09-14 13:50:32 +02:00
) => Promise<Array<string | number | boolean> | undefined>;
export const inputDialog: inputDialog = async (heading, rows) => await exports.ox_lib.inputDialog(heading, rows);
export const closeInputDialog = () => exports.ox_lib.inputDialog();