mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-02 17:53:30 +00:00
296 lines
6.8 KiB
TypeScript
296 lines
6.8 KiB
TypeScript
/*!
|
|
* @license
|
|
* Copyright © 2005-2026 Hyland Software, Inc. and its affiliates. All rights reserved.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
export interface FormContent {
|
|
formRepresentation: FormRepresentation;
|
|
}
|
|
|
|
export interface FormRepresentation {
|
|
id: string;
|
|
name: string;
|
|
description: string;
|
|
version?: number;
|
|
formDefinition?: FormDefinition;
|
|
standAlone?: boolean;
|
|
displayMode?: string;
|
|
}
|
|
|
|
export interface FormTab {
|
|
id: string;
|
|
title: string;
|
|
visibilityCondition: VisibilityCondition | null;
|
|
}
|
|
|
|
export interface FormTheme {
|
|
form: {
|
|
[key: string]: string;
|
|
};
|
|
widgets: {
|
|
[key: string]: {
|
|
[key: string]: {
|
|
[key: string]: string;
|
|
};
|
|
};
|
|
};
|
|
}
|
|
|
|
export interface FormOutcome {
|
|
id: string;
|
|
name: string;
|
|
}
|
|
|
|
export interface FormDefinition {
|
|
tabs: FormTab[];
|
|
fields: Container[] | HeaderRepresentation[];
|
|
outcomes: FormOutcome[];
|
|
metadata: any;
|
|
variables: any[];
|
|
theme?: FormTheme;
|
|
}
|
|
|
|
export interface Container {
|
|
id: string;
|
|
type: string;
|
|
tab: string;
|
|
name: string;
|
|
numberOfColumns: number;
|
|
fields: {
|
|
[key: string]: FormFieldRepresentation[];
|
|
};
|
|
}
|
|
|
|
export type FormFieldRepresentation =
|
|
| DateField
|
|
| DateTimeField
|
|
| TextField
|
|
| AttachFileField
|
|
| DropDownField
|
|
| RadioField
|
|
| TypeaheadField
|
|
| PeopleField
|
|
| AmountField
|
|
| NumberField
|
|
| CheckboxField
|
|
| HyperlinkField;
|
|
|
|
export interface AttachFileField extends FormField {
|
|
required: boolean;
|
|
}
|
|
|
|
export interface TypeaheadField extends RestField {
|
|
required: boolean;
|
|
}
|
|
|
|
export interface RestField extends FormField {
|
|
required: boolean;
|
|
restUrl: string;
|
|
restResponsePath: string;
|
|
restIdProperty: string;
|
|
restLabelProperty: string;
|
|
}
|
|
|
|
export interface HeaderRepresentation extends Container {
|
|
numberOfColumns: number;
|
|
params: {
|
|
[key: string]: any;
|
|
};
|
|
visibilityCondition: VisibilityCondition;
|
|
}
|
|
|
|
export interface ColumnDefinitionRepresentation extends Container {
|
|
id: string;
|
|
name: string;
|
|
type: string;
|
|
value: any;
|
|
required: boolean;
|
|
editable: boolean;
|
|
sortable: boolean;
|
|
visible: boolean;
|
|
}
|
|
|
|
export interface DynamicTableRepresentation extends FormField {
|
|
required: boolean;
|
|
tab: string;
|
|
placeholder: string;
|
|
columnDefinitions: ColumnDefinitionRepresentation[];
|
|
}
|
|
|
|
export interface VisibilityCondition {
|
|
leftType: string;
|
|
leftValue: string;
|
|
operator: string;
|
|
rightValue: string | number | Date;
|
|
rightType: string;
|
|
nextConditionOperator?: string;
|
|
nextCondition?: VisibilityCondition;
|
|
}
|
|
|
|
export interface FormField {
|
|
id: string;
|
|
name: string;
|
|
value: any;
|
|
type: FormFieldType | string;
|
|
readOnly?: boolean;
|
|
colspan: number;
|
|
params: {
|
|
[anyKey: string]: any;
|
|
};
|
|
visibilityCondition: null | VisibilityCondition;
|
|
style?: string;
|
|
}
|
|
|
|
export interface FormOption {
|
|
id: string;
|
|
name: string;
|
|
}
|
|
|
|
export interface OptionsField {
|
|
value: any;
|
|
restUrl: string | null;
|
|
restResponsePath: string | null;
|
|
restIdProperty: string | null;
|
|
restLabelProperty: string | null;
|
|
optionType: 'manual' | 'rest';
|
|
options: FormOption[];
|
|
}
|
|
|
|
export interface AmountField extends FormField {
|
|
required: boolean;
|
|
placeholder: string | null;
|
|
minValue: number | null;
|
|
maxValue: number | null;
|
|
enableFractions: boolean;
|
|
currency: string;
|
|
}
|
|
|
|
export interface CheckboxField extends FormField {
|
|
required: boolean;
|
|
}
|
|
|
|
export interface DateField extends FormField {
|
|
required: boolean;
|
|
placeholder: string | null;
|
|
minValue: string | null;
|
|
maxValue: string | null;
|
|
dateDisplayFormat: string;
|
|
}
|
|
|
|
export interface DateTimeField extends FormField {
|
|
required: boolean;
|
|
placeholder: string | null;
|
|
minValue: string | null;
|
|
maxValue: string | null;
|
|
dateDisplayFormat: string;
|
|
}
|
|
|
|
export interface DropDownField extends OptionsField, FormField {
|
|
required: boolean;
|
|
}
|
|
|
|
export interface HyperlinkField extends FormField {
|
|
hyperlinkUrl: string | null;
|
|
displayText: string | null;
|
|
}
|
|
|
|
export interface NumberField extends FormField {
|
|
placeholder: string | null;
|
|
minValue: number | null;
|
|
maxValue: number | null;
|
|
required: boolean;
|
|
}
|
|
|
|
export interface RadioField extends OptionsField, FormField {
|
|
required: boolean;
|
|
}
|
|
|
|
export interface TextField extends FormField {
|
|
regexPattern: string | null;
|
|
required: boolean;
|
|
minLength: number;
|
|
maxLength: number;
|
|
placeholder: string | null;
|
|
}
|
|
|
|
export const PeopleModeOptions = {
|
|
single: 'single',
|
|
multiple: 'multiple'
|
|
} as const;
|
|
|
|
export type PeopleModeOptions = (typeof PeopleModeOptions)[keyof typeof PeopleModeOptions];
|
|
|
|
export interface PeopleField extends FormField {
|
|
required: boolean;
|
|
optionType: PeopleModeOptions;
|
|
}
|
|
|
|
export const FormFieldType = {
|
|
text: 'text',
|
|
multiline: 'multi-line-text',
|
|
number: 'integer',
|
|
checkbox: 'boolean',
|
|
date: 'date',
|
|
datetime: 'datetime',
|
|
dropdown: 'dropdown',
|
|
typeahead: 'typeahead',
|
|
amount: 'amount',
|
|
radio: 'radio-buttons',
|
|
people: 'people',
|
|
groupOfPeople: 'functional-group',
|
|
dynamicTable: 'dynamicTable',
|
|
hyperlink: 'hyperlink',
|
|
header: 'group',
|
|
uploadFile: 'upload',
|
|
uploadFolder: 'uploadFolder',
|
|
displayValue: 'readonly',
|
|
displayText: 'readonly-text',
|
|
fileViewer: 'file-viewer',
|
|
button: 'button'
|
|
} as const;
|
|
|
|
export type FormFieldType = (typeof FormFieldType)[keyof typeof FormFieldType];
|
|
|
|
export interface FormCloudDisplayModeConfigurationOptions {
|
|
onCompleteTask(id?: string): void;
|
|
onSaveTask(id?: string): void;
|
|
onDisplayModeOn(id?: string): void;
|
|
onDisplayModeOff(id?: string): void;
|
|
fullscreen?: boolean;
|
|
displayToolbar?: boolean;
|
|
displayCloseButton?: boolean;
|
|
trapFocus?: boolean;
|
|
[key: string]: any;
|
|
}
|
|
|
|
export interface FormCloudDisplayModeConfiguration {
|
|
displayMode: string;
|
|
options?: FormCloudDisplayModeConfigurationOptions;
|
|
default?: boolean;
|
|
}
|
|
|
|
export const FormCloudDisplayMode = {
|
|
inline: 'inline',
|
|
fullScreen: 'fullScreen',
|
|
standalone: 'standalone'
|
|
} as const;
|
|
|
|
export type FormCloudDisplayMode = (typeof FormCloudDisplayMode)[keyof typeof FormCloudDisplayMode];
|
|
|
|
export interface FormCloudDisplayModeChange {
|
|
displayMode: string;
|
|
id?: string;
|
|
}
|