diff --git a/lib/core/form/components/widgets/core/form-field-rule.ts b/lib/core/form/components/widgets/core/form-field-rule.ts new file mode 100644 index 0000000000..6e8169522a --- /dev/null +++ b/lib/core/form/components/widgets/core/form-field-rule.ts @@ -0,0 +1,28 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * 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. + */ + +import { FormFieldOption } from './form-field-option'; + +export interface FormFieldRule { + ruleOn: string; + entries: RuleEntry[]; +} + +export interface RuleEntry { + key: string; + options: FormFieldOption[]; +} diff --git a/lib/core/form/components/widgets/core/form-field.model.ts b/lib/core/form/components/widgets/core/form-field.model.ts index 2a5dea5cae..d29905b140 100644 --- a/lib/core/form/components/widgets/core/form-field.model.ts +++ b/lib/core/form/components/widgets/core/form-field.model.ts @@ -26,6 +26,7 @@ import { FormFieldTypes } from './form-field-types'; import { NumberFieldValidator } from './form-field-validator'; import { FormWidgetModel } from './form-widget.model'; import { FormModel } from './form.model'; +import { FormFieldRule } from './form-field-rule'; // Maps to FormFieldRepresentation export class FormFieldModel extends FormWidgetModel { @@ -72,6 +73,7 @@ export class FormFieldModel extends FormWidgetModel { currency: string = null; dateDisplayFormat: string = this.defaultDateFormat; selectionType: 'single' | 'multiple' = null; + rule?: FormFieldRule; // container model members numberOfColumns: number = 1; @@ -178,6 +180,7 @@ export class FormFieldModel extends FormWidgetModel { this.validationSummary = new ErrorMessageModel(); this.tooltip = json.tooltip; this.selectionType = json.selectionType; + this.rule = json.rule; if (json.placeholder && json.placeholder !== '' && json.placeholder !== 'null') { this.placeholder = json.placeholder; diff --git a/lib/core/form/components/widgets/core/index.ts b/lib/core/form/components/widgets/core/index.ts index dd2d3d0bc7..5075159f16 100644 --- a/lib/core/form/components/widgets/core/index.ts +++ b/lib/core/form/components/widgets/core/index.ts @@ -40,3 +40,4 @@ export * from './form-variable.model'; export * from './process-variable.model'; export * from './upload-widget-content-link.model'; export * from './form-field-file-source'; +export * from './form-field-rule'; diff --git a/lib/core/i18n/en.json b/lib/core/i18n/en.json index 72679d0d1e..3452a1161f 100644 --- a/lib/core/i18n/en.json +++ b/lib/core/i18n/en.json @@ -43,6 +43,7 @@ "UPLOAD": "UPLOAD", "REQUIRED": "*Required", "FILE_NAME": "File Name", + "DEPENDS_ON": "Depends on: {{widgetId}}", "NO_FILE_ATTACHED" : "No file attached", "VALIDATOR": { "INVALID_NUMBER": "Use a different number format", diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.html b/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.html index ec010e469b..76678712c4 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.html +++ b/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.html @@ -1,13 +1,21 @@