mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-15082][AAE-15081] Resolve the options coming from a json variabl… (#8673)
* [AAE-15082][AAE-15081] Resolve the options coming from a json variable for a dropdown * split method to smaller parts and remove duplications in units * fix unit tests * get variables from API call * [AAE-15082] Add handle form variable * replace variableId by variableName * improve code
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 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 VariableConfig {
|
||||
variableName: string;
|
||||
optionsPath?: string;
|
||||
optionsId?: string;
|
||||
optionsLabel?: string;
|
||||
}
|
@@ -27,6 +27,7 @@ import { FormWidgetModel } from './form-widget.model';
|
||||
import { FormFieldRule } from './form-field-rule';
|
||||
import { ProcessFormModel } from './process-form-model.interface';
|
||||
import { isNumberValue } from './form-field-utils';
|
||||
import { VariableConfig } from './form-field-variable-options';
|
||||
|
||||
// Maps to FormFieldRepresentation
|
||||
export class FormFieldModel extends FormWidgetModel {
|
||||
@@ -66,7 +67,7 @@ export class FormFieldModel extends FormWidgetModel {
|
||||
restLabelProperty: string;
|
||||
hasEmptyValue: boolean;
|
||||
className: string;
|
||||
optionType: 'rest' | 'manual' ;
|
||||
optionType: 'rest' | 'manual' | 'variable';
|
||||
params: FormFieldMetadata = {};
|
||||
hyperlinkUrl: string;
|
||||
displayText: string;
|
||||
@@ -81,6 +82,7 @@ export class FormFieldModel extends FormWidgetModel {
|
||||
selectLoggedUser: boolean;
|
||||
groupsRestriction: string[];
|
||||
leftLabels: boolean = false;
|
||||
variableConfig: VariableConfig;
|
||||
|
||||
// container model members
|
||||
numberOfColumns: number = 1;
|
||||
@@ -194,6 +196,7 @@ export class FormFieldModel extends FormWidgetModel {
|
||||
this.rule = json.rule;
|
||||
this.selectLoggedUser = json.selectLoggedUser;
|
||||
this.groupsRestriction = json.groupsRestriction?.groups;
|
||||
this.variableConfig = json.variableConfig;
|
||||
|
||||
if (json.placeholder && json.placeholder !== '' && json.placeholder !== 'null') {
|
||||
this.placeholder = json.placeholder;
|
||||
|
@@ -46,6 +46,7 @@
|
||||
"UPLOAD": "UPLOAD",
|
||||
"REQUIRED": "This is a required field",
|
||||
"REST_API_FAILED": "The server `{{ hostname }}` is not reachable",
|
||||
"VARIABLE_DROPDOWN_OPTIONS_FAILED": "There was a problem loading dropdown elements. Please contact administrator.",
|
||||
"FILE_NAME": "File Name",
|
||||
"NO_FILE_ATTACHED": "No file attached",
|
||||
"VALIDATOR": {
|
||||
|
Reference in New Issue
Block a user