Skip to content

Commit 82c06f3

Browse files
committed
New parameters
- hourstep - minutestep - editenabled
1 parent 6df1ea0 commit 82c06f3

4 files changed

Lines changed: 12 additions & 11 deletions

File tree

TimePicker/ControlManifest.Input.xml

Lines changed: 5 additions & 2 deletions
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.12" 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.15" 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" />
@@ -11,7 +11,10 @@
1111
</property>
1212
<property name="hourstep" display-name-key="Hour Step" description-key="(Optional) Step for hour selector. default = 1" of-type="Whole.None" usage="input" required="false" />
1313
<property name="minutestep" display-name-key="Minute Step" description-key="(Optional) Step for minute selector. default = 1" of-type="Whole.None" usage="input" required="false" />
14-
14+
<property name="editenabled" display-name-key="Edit Enabled" description-key="Manual edit enabled (default = false)" of-type="Enum" usage="input" required="true">
15+
<value name="true" display-name-key="true" description-key="True" >true</value>
16+
<value name="false" display-name-key="false" description-key="False" default="true">false</value>
17+
</property>
1518

1619
<resources>
1720
<code path="index.ts" order="1"/>

TimePicker/TimePickerTextBox.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export interface IProps {
1717
use12Hours:boolean;
1818
hourstep:number;
1919
minutestep:number;
20+
editenabled:boolean;
2021

2122
onChange: (hourvalue:number|undefined,minutevalue:number|undefined) => void;
2223
}
@@ -104,8 +105,9 @@ const TimePickerTextBox = (props : IProps): JSX.Element => {
104105
use12Hours={props.use12Hours}
105106
hourStep={props.hourstep}
106107
minuteStep={props.minutestep}
107-
inputReadOnly
108+
inputReadOnly={!props.editenabled}
108109
disabled={props.readonly}
110+
109111
/>
110112

111113
</div>

TimePicker/css/TimePicker.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
height: 35px;
4747
cursor: text;
4848
font-size: 14px;
49-
font-weight: 600;
49+
font-weight: 400;
5050
line-height: 1.5;
5151
color: rgb(0, 0, 0);
5252
background-color: #fff;
@@ -68,7 +68,7 @@
6868
.rc-time-picker-input[disabled]:hover {
6969
background: rgb(226, 226, 226);
7070
border: 1px solid rgb(226, 226, 226);
71-
font-weight: 600;
71+
font-weight: 400;
7272
cursor: default;
7373
}
7474

TimePicker/index.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ import TimePickerTextBox , {IProps} from "./TimePickerTextBox";
66
export class TimePicker implements ComponentFramework.StandardControl<IInputs, IOutputs> {
77

88
private _root: Root;
9-
private _isFluent2: boolean
109
private _hourvalue:number|undefined;
1110
private _minutevalue:number|undefined;
1211
private _notifyOutputChanged:() => void;
13-
private _container: HTMLDivElement;
1412
private _props: IProps = { hourvalue : undefined,
1513
minutevalue : undefined,
1614
readonly:false,
@@ -19,6 +17,7 @@ export class TimePicker implements ComponentFramework.StandardControl<IInputs, I
1917
use12Hours:true,
2018
hourstep:1,
2119
minutestep:1,
20+
editenabled:false,
2221

2322
onChange : this.notifyChange.bind(this) };
2423

@@ -47,10 +46,6 @@ export class TimePicker implements ComponentFramework.StandardControl<IInputs, I
4746
this._notifyOutputChanged = notifyOutputChanged;
4847
this._root = createRoot(container!)
4948

50-
// context.fluentDesignLanguage will be null if 'New Look' is not turned on
51-
if((context as any).fluentDesignLanguage){
52-
this._isFluent2 = true;
53-
}
5449
}
5550

5651
/**
@@ -85,6 +80,7 @@ export class TimePicker implements ComponentFramework.StandardControl<IInputs, I
8580
this._props.format = display === "12 hrs" ? "h:mm a" : "k:mm";
8681
this._props.hourstep = context.parameters.hourstep?.raw ?? 1;
8782
this._props.minutestep = context.parameters.minutestep?.raw ?? 1;
83+
this._props.editenabled = context.parameters.editenabled?.raw === "true" ?? false;
8884

8985

9086
this._root.render(createElement(TimePickerTextBox, this._props))

0 commit comments

Comments
 (0)