Skip to content

Commit 1e6774f

Browse files
committed
codecleanup
1 parent 97c0d2f commit 1e6774f

7 files changed

Lines changed: 8 additions & 17 deletions

TimePicker/ControlManifest.Input.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<manifest>
3-
<control namespace="DR" constructor="TimePicker" version="1.0.8" display-name-key="TimePicker" description-key="TimePicker control based on React time Picker (rc-time-picker)" control-type="standard" preview-image="img/timepicker-preview.png">
3+
<control namespace="DR" constructor="TimePicker" version="1.0.9" display-name-key="TimePicker" description-key="TimePicker control based on React time Picker (rc-time-picker)" control-type="standard" preview-image="img/timepicker-preview.png">
44
<!-- property node identifies a specific, configurable piece of data that the control expects from CDS -->
55
<property name="hourvalue" display-name-key="Hour Value Field" description-key="Bind this property to the field where you want to store the hour value" of-type="Whole.None" usage="bound" required="true" />
66
<property name="minutevalue" display-name-key="Minute Value Field" description-key="Bind this property to the field where you want to store the minute value" of-type="Whole.None" usage="bound" required="true" />

TimePicker/TimePickerTextBox.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ const TimePickerTextBox = (props : IProps): JSX.Element => {
3737

3838
if(props.hourvalue !== undefined && props.minutevalue !== undefined)
3939
{
40-
//console.log("EFFECT [props.hourvalue, props.minutevalue] : setTimevalue " + props.hourvalue + ":" + props.minutevalue);
40+
4141
let newTimevalue:Moment = moment().hour(props.hourvalue).minute(props.minutevalue);
4242
if(newTimevalue !== timevalue)
4343
{
4444
setTimevalue(newTimevalue);
4545
}
4646

4747
}else{
48-
//console.log("EFFECT [props.hourvalue, props.minutevalue] : setTimevalue undefined");
48+
4949
setTimevalue(undefined);
5050
}
5151
}, [props.hourvalue, props.minutevalue]);

TimePicker/index.ts

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,30 +50,21 @@ export class TimePicker implements ComponentFramework.StandardControl<IInputs, I
5050
*/
5151
public updateView(context: ComponentFramework.Context<IInputs>): void
5252
{
53-
//Visibility of the main attribute on the form
54-
let isVisible = context.mode.isVisible
55-
53+
5654
// If the bound attribute is disabled because it is inactive or the user doesn't have access
5755
let isReadOnly = context.mode.isControlDisabled;
5856

5957
let isMasked = false;
6058
// When a field has FLS enabled, the security property on the attribute parameter is set
6159
if (context.parameters.hourvalue.security) {
62-
isReadOnly = isReadOnly || !context.parameters.hourvalue.security.editable;
63-
isVisible = isVisible && context.parameters.hourvalue.security.readable;
64-
isMasked = isVisible && !context.parameters.hourvalue.security.readable
60+
isReadOnly = isReadOnly || !context.parameters.hourvalue.security.editable;
61+
isMasked = !context.parameters.hourvalue.security.readable
6562
}
6663

67-
if(!isVisible){
68-
return;
69-
}
70-
71-
72-
7364
//Prepare props for component rendering
7465
this._hourvalue = context.parameters.hourvalue.raw !== null ? context.parameters.hourvalue.raw : undefined;
7566
this._minutevalue = context.parameters.minutevalue.raw !== null ? context.parameters.minutevalue.raw : undefined;
76-
console.log("before render : " + this._hourvalue + ":" + this._minutevalue + ", props "+ this._props.hourvalue + ":" + this._props.minutevalue);
67+
7768
//RENDER ONLY IF DIFFERENT
7869
if(this.shouldRender())
7970
{
@@ -119,7 +110,7 @@ export class TimePicker implements ComponentFramework.StandardControl<IInputs, I
119110

120111
//Function called when props is signaling an update
121112
private notifyChange(hourvalue:number|undefined, minutevalue:number|undefined) {
122-
console.log("notifyChange : " + hourvalue + ":" + minutevalue);
113+
123114
this._hourvalue = hourvalue;
124115
this._minutevalue = minutevalue;
125116
this._notifyOutputChanged(); //=> will trigger getOutputs

TimePickerPCF_1_0_0_5.zip

-403 KB
Binary file not shown.

TimePickerPCF_1_0_0_5_managed.zip

-403 KB
Binary file not shown.

TimePickerPCF_1_0_0_6.zip

402 KB
Binary file not shown.

TimePickerPCF_1_0_0_6_managed.zip

402 KB
Binary file not shown.

0 commit comments

Comments
 (0)