Support custom display length for labels and fix trunc length bug
This commit is contained in:
Родитель
902d4a9011
Коммит
0f047c8761
|
@ -104,6 +104,14 @@
|
|||
"dataType": "Boolean",
|
||||
"isRequired": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"id":"LabelDisplayLength",
|
||||
"name": "Set the maximum display length for each option's label. Defaults to 35 if not set.",
|
||||
"validation": {
|
||||
"dataType": "Number",
|
||||
"isRequired": false
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ export class MultiValueControl extends React.Component<IMultiValueControlProps,
|
|||
|
||||
private readonly _unfocusedTimeout = BrowserCheckUtils.isSafari() ? 2000 : 1;
|
||||
private readonly _allowCustom: boolean = VSS.getConfiguration().witInputs.AllowCustom;
|
||||
private readonly _labelDisplayLength: number = VSS.getConfiguration().witInputs.LabelDisplayLength ? VSS.getConfiguration().witInputs.LabelDisplayLength : 35;
|
||||
private _setUnfocused = new DelayedFunction(null, this._unfocusedTimeout, "", () => {
|
||||
this.setState({focused: false, filter: ""});
|
||||
});
|
||||
|
@ -104,13 +105,14 @@ export class MultiValueControl extends React.Component<IMultiValueControlProps,
|
|||
}}
|
||||
onChange={() => this._toggleOption(o)}
|
||||
label={this._wrapText(o)}
|
||||
title={o}
|
||||
/>)}
|
||||
</FocusZone>
|
||||
</div>;
|
||||
}
|
||||
|
||||
private _wrapText(text: string){
|
||||
return text.length > 15 ? `${text.slice(0,35)}...` : text;
|
||||
return text.length > this._labelDisplayLength ? `${text.slice(0,this._labelDisplayLength)}...` : text;
|
||||
}
|
||||
private _onInputKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
if (e.altKey || e.shiftKey || e.ctrlKey) {
|
||||
|
|
|
@ -33,6 +33,10 @@ Extension:
|
|||
Data Type: String
|
||||
IsRequired: false
|
||||
|
||||
Id: LabelDisplayLength
|
||||
Description: Set the maximum display length for each option's label. Defaults to 35 if not set.
|
||||
Data Type: Number
|
||||
IsRequired: false
|
||||
|
||||
Note: For more information on work item extensions use the following topic:
|
||||
http://go.microsoft.com/fwlink/?LinkId=816513
|
||||
|
@ -104,6 +108,11 @@ You can find the contribution ID and input information within the commented blob
|
|||
Description: Values can be user provided or from suggested values of the backing field
|
||||
Data Type: String
|
||||
IsRequired: false
|
||||
|
||||
Id: LabelDisplayLength
|
||||
Description: Display length of the label. Defaults to 35 if not set.
|
||||
Data Type: Number
|
||||
IsRequired: false
|
||||
```
|
||||
|
||||
For the input tag, the content of the `Id` attribute can be either `FieldName` or `Values`.
|
||||
|
|
Загрузка…
Ссылка в новой задаче