Skip to content

Instantly share code, notes, and snippets.

@kohki-shikata
Last active October 21, 2024 06:45
Show Gist options
  • Save kohki-shikata/df3833608da63bc992c5dc3f4e31f9b1 to your computer and use it in GitHub Desktop.
Save kohki-shikata/df3833608da63bc992c5dc3f4e31f9b1 to your computer and use it in GitHub Desktop.
Yoshinani Form difinition setting file type
type FormContent = {
type: 'formElement' | 'formField' | 'html' | 'string';
content: FormElement[] | FormField[] | HTMLElement[] | string;
};
type FormField = {
legend: string;
isLegendIndicateRequired: boolean;
formElements: FormElement[];
};
type AssistMessage = {
message: string;
}
type errorMessage = {
message: string;
}
type Option = {
type: 'optgroup' | 'option';
element: {
label: string;
value: string | number | Option[];
disabled: boolean;
selected: boolean;
}
};
type FormElement = {
type: string; // default is 'text'
name: string; // default is ''
label: string | null; // default is ''
id: string | null; // default is ''
placeholder: string | null; // default is ''
value: string | number | boolean | null; // default is ''
minlength: number | null; // default is null
maxlength: number | null; // default is null
min: number | null; // default is null
max: number | null; // default is null
options: Option[] | null; // default is null
pattern: string | null; // default is null
required: boolean | null; // default is null
readonly: boolean | null; // default is null
disabled: boolean | null; // default is null
checked: boolean | null; // default is null
size: number | null; // default is null
autocomplete: string | null; // default is null
inputmode: string | null; // default is null
ysfIsInline: boolean | null; // default is null
ysfRegex: string | null; // default is null
ysfMatchTarget: string | null; // default is null
ysfIsValid: boolean | null; // default is null
ysfExecFunc: string | null; // default is null
ysfAssistMessages: AssistMessage[] | null; // default is null
ysfErrorMessages: ErrorMessage[] | null; // default is null
};
type YoshinaniFormDifinition = {
initialSetting: {
ysfSmtpAuth: boolean | null; // default is null
ysfSmtpEncryption: boolean | null; // default is null
ysfStepNavigation: boolean | null; // default is null
ysfReceipientMailSubject: string | null; // default is null
formId: string | null; // defualt is null
formClass: string | null; // default is 'ysf-form'
ysfRequiredDisplayType: 'none' | 'tipLeft' | 'tipRight' | 'asterisk'; // default is 'tipLeft'
ysfOptionalDisplayType: 'none' | 'tip'; // default is 'tip'
ysfFrontendFormValidateType: 'none' | 'thisForm' | string; // default is 'thisForm'
};
formContents: FormContent[];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment