Skip to content

Commit

Permalink
Quick update to update visibility on updateView
Browse files Browse the repository at this point in the history
  • Loading branch information
Clément OLIVIER committed Jun 23, 2020
1 parent 2bf9c64 commit e870629
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion BICValidator/BicValidator/ControlManifest.Input.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest>
<control namespace="Carfup" constructor="BicValidator" version="0.0.10" display-name-key="Carfup.BicValidator" description-key="BicValidator description" control-type="standard">
<control namespace="Carfup" constructor="BicValidator" version="0.0.11" display-name-key="Carfup.BicValidator" description-key="BicValidator description" control-type="standard">
<!-- property node identifies a specific, configurable piece of data that the control expects from CDS -->
<property name="BICValue" display-name-key="BICValidator_BICValue" description-key="BIC field value" of-type="SingleLine.Text" usage="bound" required="true" />
<property name="IsValid" display-name-key="BICValidator_IsValid" description-key="Is BIC valid" of-type="TwoOptions" usage="bound" required="false" />
Expand Down
6 changes: 6 additions & 0 deletions BICValidator/BicValidator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export class BicValidator implements ComponentFramework.StandardControl<IInputs,
this._valueElement.setAttribute("class", "pcfinputcontrol");
this._valueElement.addEventListener("change", this._valueChanged);
this._valueElement.value = this._value;
// @ts-ignore
this._valueElement.setAttribute("maxlength", context.parameters.BICValue.attributes?.MaxLength)

// img control
this._valueValidationElement = document.createElement("img");
Expand All @@ -75,6 +77,10 @@ export class BicValidator implements ComponentFramework.StandardControl<IInputs,
{
// Add code to update control view
this._valueElement.value = this._value;

if(context.mode.isControlDisabled){
this._valueElement.setAttribute("disabled", "disabled");
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion IbanValidator/IbanValidator/ControlManifest.Input.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest>
<control namespace="Carfup" constructor="IbanValidator" version="0.0.21" display-name-key="Carfup.IbanValidator" description-key="IBAN validator for PCF" control-type="standard">
<control namespace="Carfup" constructor="IbanValidator" version="0.0.22" display-name-key="Carfup.IbanValidator" description-key="IBAN validator for PCF" control-type="standard">
<!-- property node identifies a specific, configurable piece of data that the control expects from CDS -->
<property name="IbanValue" display-name-key="IbanValidator_IbanValue" description-key="IBAN field value" of-type="SingleLine.Text" usage="bound" required="true" />
<property name="IsValidIban" display-name-key="IbanValidator_IsValidIban" description-key="Is IBAN valid" of-type="TwoOptions" usage="bound" required="false" />
Expand Down
7 changes: 5 additions & 2 deletions IbanValidator/IbanValidator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,11 @@ export class IbanValidator implements ComponentFramework.StandardControl<IInputs
{
// Add code to update control view

this._ibanValueElement.value = this._ibanValue;// this._ibanValue = this._context.parameters.IbanValue == undefined ? "" : String(this._context.parameters.IbanValue.raw);
//this._isValidIban = this._context.parameters.IsValidIban == undefined ? false : Boolean(this._context.parameters.IsValidIban.raw);
this._ibanValueElement.value = this._ibanValue;

if(context.mode.isControlDisabled){
this._ibanValueElement.setAttribute("disabled", "disabled");
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion SirenValidator/SirenValidator/ControlManifest.Input.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest>
<control namespace="Carfup" constructor="SirenValidator" version="0.0.17" display-name-key="Carfup.SirenValidator" description-key="Siren Validator for PCF" control-type="standard">
<control namespace="Carfup" constructor="SirenValidator" version="0.0.18" display-name-key="Carfup.SirenValidator" description-key="Siren Validator for PCF" control-type="standard">
<!-- property node identifies a specific, configurable piece of data that the control expects from CDS -->
<property name="SirenValue" display-name-key="SirenValidator_SirenValue" description-key="Siren field value" of-type="SingleLine.Text" usage="bound" required="true" />
<property name="IsValid" display-name-key="SiretValidator_IsValid" description-key="Is Siret valid" of-type="TwoOptions" usage="bound" required="false" />
Expand Down
4 changes: 4 additions & 0 deletions SirenValidator/SirenValidator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ export class SirenValidator implements ComponentFramework.StandardControl<IInput
{
// Add code to update control view
this._valueElement.value = this._value;

if(context.mode.isControlDisabled){
this._valueElement.setAttribute("disabled", "disabled");
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion SiretValidator/SiretValidator/ControlManifest.Input.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest>
<control namespace="Carfup" constructor="SiretValidator" version="0.0.19" display-name-key="Carfup.SiretValidator" description-key="Siret Validator for PCF" control-type="standard">
<control namespace="Carfup" constructor="SiretValidator" version="0.0.20" display-name-key="Carfup.SiretValidator" description-key="Siret Validator for PCF" control-type="standard">
<!-- property node identifies a specific, configurable piece of data that the control expects from CDS -->
<property name="SiretValue" display-name-key="SiretValidator_SiretValue" description-key="Siret field value" of-type="SingleLine.Text" usage="bound" required="true" />
<property name="IsValid" display-name-key="SiretValidator_IsValid" description-key="Is Siret valid" of-type="TwoOptions" usage="bound" required="false" />
Expand Down
4 changes: 4 additions & 0 deletions SiretValidator/SiretValidator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ export class SiretValidator implements ComponentFramework.StandardControl<IInput
{
// Add code to update control view
this._valueElement.value = this._value;

if(context.mode.isControlDisabled){
this._valueElement.setAttribute("disabled", "disabled");
}
}

/**
Expand Down

0 comments on commit e870629

Please sign in to comment.