ui

Source:

common JavaScript methods for forms

Methods

(private, inner) copyValueToFormIndex(model, item)

Source:

Assign the value to the form element. Use active element to get target tp update value for

Need to have on the item: 'targetLink': 'legend.0', the target tag inside inside target parent and the array index for children 'targetParent': 'av-accordion-toggle', the parent element target class 'default': a default value for the tag when model value is empty

Parameters:
Name Type Description
model Object

value to set

item String

item from the form

(inner) copyValueToModelIndex(modelValue, item, model)

Source:

Copy a value from the model to a model element who contain index

Need to have on the item: 'targetElement': ['layers', 'layerType'], array of keys to to get the element to update 'targetParent': 'av-accordion-content', the parent element target class to find index of

Parameters:
Name Type Description
modelValue Object

model value

item String

form item

model String

model to update

(private, inner) findValues(model, keys, index, returnValues) → {Array}

Source:

Find values from the model element

Parameters:
Name Type Description
model Object

model to find from

keys Array

the path to key

index Integer

index in the array

returnValues Array

array of values

Returns:

returnValues array of values

Type
Array

(inner) initValueToFormIndex(modelArray, classEl, field, targetLink)

Source:

Copy a value from the model to a form element who contain index when form loads

Parameters:
Name Type Description
modelArray Array

model array of values to apply

classEl Array

array of classes/index on the form element to retrieve it

field String

field on the model to get the value to apply

targetLink String

target element info to apply value to

(inner) resestShowAdvance()

Source:

Reset show advance fields if needed when there is a new model or language switch

(inner) setErrorMessage(form, message, variables) → {String}

Source:

Set custom validation error message inside translation.csv the variable to replace needs to be there inside {}

Parameters:
Name Type Description
form Object

form object to get value from

message String

message to get from translation.csv

variables Array

variables to replace

Returns:

mess the updated message

Type
String

(inner) setExtent(type, extentSets)

Source:

Set extent from the viewer itself open in an iFrame

Parameters:
Name Type Description
type String

type of extent ('default', 'full' or 'maximum')

extentSets Array

array of extent set to set the extent for

(inner) showAdvance()

Source:

Show advance fields

(inner) toggleAll(event, collapse)

Source:

Toggle all sections of accordion panel (array of accordion items)

Parameters:
Name Type Description
event Object

event who trigger the action

collapse Bolean

true if collapse false if expand

(inner) toggleSection(event)

Source:

Toggle one section of accordion panel

Parameters:
Name Type Description
event Object

event who trigger the action

(inner) updateLinkValues(scope, keys, link, broadcast)

Source:

Update scope element use inside a dynamic-select drop dowm. The value is use to link field together e.g. in TitleSchema, we have extentSetId who is the value of one extent set id. This function Will populate the scope element with all extent set id so user don't have to type them in

Need an item to have the selection dropdown: { 'key': 'tileSchemas[].extentSetId', 'type': 'dynamic-select', 'optionData': 'extentId', 'model': 'extentSetId' } 'type' must be type-select, it will trigger the add on. 'optionData' is the variable name to create on scope object 'model' must be the last key in the path for this element (it is use inside dynamicSelect.module for ngModel)

Need items with an values to updateModel { 'key': 'extentSets[].id', 'onChange': () => { debounceService.registerDebounce(self.formService.updateLinkValues(scope, ['extentSets', 'id'], 'extentId'), constants.debInput, false); } }, 'onChange' function to use the self.formService.updateLinkValues where scope is the form scope Array of keys made from key element The same variable name created for the first element

For a sample with a broadcast event, look at avLayersIdupdateEvents

Known issue: onChange is not fired on the last item delete inside an array. Will need to find a workaround if need be

Parameters:
Name Type Description
scope Object

form scope

keys Array

the path to the key to get value from

link String

the value to update (need to be the same on optionData as the the field who receive the link)

broadcast String

optional - the event to broadcast. This will be use to update link in another scope model