/*
* Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3 as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*/
import { LookupTable } from './LookupTable';
export interface ContentTypeSection {
title: string;
fields: string[];
description: string;
expandByDefault: boolean;
}
export interface ContentTypeFieldValidation {
id: ValidationKeys;
value: T;
level: 'required' | 'suggestion';
}
export type ValidationKeys =
| 'allowedContentTypeTags'
| 'allowedContentTypes'
| 'allowedEmbeddedContentTypes'
| 'allowedSharedContentTypes'
| 'allowedSharedExistingContentTypes'
| 'minCount'
| 'maxCount'
| 'maxLength'
| 'readOnly'
| 'required'
| 'width'
| 'height'
| 'minWidth'
| 'minHeight'
| 'maxWidth'
| 'maxHeight'
| 'minValue'
| 'maxValue'
| 'dropTargetsNotFound'
| 'registerNotFound'
| 'allowImagesFromRepo'
| 'allowImageUpload'
| 'allowVideosFromRepo'
| 'allowVideoUpload'
| 'allowAudioUpload'
| 'allowAudioFromRepo';
export type ContentTypeFieldValidations = Record;
export interface ValidationResult {
id: string;
level?: 'required' | 'suggestion' | 'info';
values?: object;
}
export interface ContentTypeField {
id: string;
name: string;
description?: string;
type: string;
sortable?: boolean;
validations: Partial;
properties?: LookupTable;
defaultValue: any;
fields?: LookupTable;
values?: {
label: string;
value: string;
}[];
helpText?: string;
}
export interface ContentTypeRepeatField extends ContentTypeField {
fields: LookupTable;
}
export interface DataSource {
id: string;
name: string;
[prop: string]: any;
}
export type LegacyComponentType = 'component' | 'page' | 'file';
export interface ContentType {
id: string;
name: string;
type: LegacyComponentType;
quickCreate: boolean;
quickCreatePath: string;
displayTemplate: string;
sections: ContentTypeSection[];
fields: LookupTable;
dataSources: DataSource[];
mergeStrategy: string;
}
export interface LegacyFormDefinitionProperty {
label?: string;
name: string;
type: string;
value: string;
}
export interface LegacyFormDefinitionField {
constraints: {
constraint: LegacyFormDefinitionProperty | Array;
};
defaultValue: string;
description: string;
help: string;
iceId: string;
id: string;
properties: {
property: LegacyFormDefinitionProperty | Array;
};
title: string;
type: string;
fields?: {
field: LegacyFormDefinitionField | Array;
};
minOccurs?: string;
maxOccurs?: string;
}
export interface LegacyFormDefinitionSection {
defaultOpen: 'true' | 'false';
description: string;
fields: {
field: LegacyFormDefinitionField | Array;
};
title: string;
}
export interface LegacyDataSource {
id: string;
title: string;
type: string;
interface: string;
properties: {
property: LegacyFormDefinitionProperty[] | LegacyFormDefinitionProperty;
};
}
export interface LegacyFormDefinition {
title: string;
'content-type': string;
description: string;
imageThumbnail: string;
objectType: string;
quickCreate: 'true' | 'false';
quickCreatePath: string;
sections: {
section: LegacyFormDefinitionSection | Array;
};
properties: {
property: LegacyFormDefinitionProperty[] | LegacyFormDefinitionProperty;
};
datasources: {
datasource: LegacyDataSource | Array;
};
}
export interface LegacyContentType {
allowedRoles: string[];
contentAsFolder: boolean;
copyDepedencyPattern: string[];
deleteDependencyPattern: string[];
form: string;
formPath: string;
imageThumbnail: string;
label: string;
lastUpdated: string;
modelInstancePath: string;
name: string;
noThumbnail: boolean;
nodeRef: any;
pathExcludes: string[];
pathIncludes: string[];
previewable: boolean;
quickCreate: boolean;
quickCreatePath: string;
type: LegacyComponentType;
useRoundedFolder: string;
}
export interface ComponentsDatasource extends LegacyDataSource {
allowEmbedded: boolean;
allowShared: boolean;
baseBrowsePath: string;
baseRepositoryPath: string;
contentTypes: string;
enableBrowse: boolean;
enableSearch: boolean;
tags: string;
}
export default ContentType;