Show max length in item tooltips
This commit is contained in:
@@ -68,6 +68,7 @@ export type ItemPropertyValueType = 'boolean' | 'text' | 'number' | 'list' | 'so
|
||||
export type ItemPropertyMetadata = {
|
||||
valueType?: ItemPropertyValueType;
|
||||
tooltip?: string;
|
||||
maxLength?: number;
|
||||
range?: {
|
||||
min: number;
|
||||
max: number;
|
||||
@@ -140,6 +141,12 @@ function normalizePropertyMetadataRecord(raw: Record<string, unknown> | undefine
|
||||
if (typeof valueObj.tooltip === 'string' && valueObj.tooltip.trim().length > 0) {
|
||||
metadata.tooltip = valueObj.tooltip.trim();
|
||||
}
|
||||
if (valueObj.maxLength !== undefined) {
|
||||
const maxLength = Number(valueObj.maxLength);
|
||||
if (Number.isFinite(maxLength) && maxLength > 0) {
|
||||
metadata.maxLength = Math.floor(maxLength);
|
||||
}
|
||||
}
|
||||
const range = valueObj.range;
|
||||
if (range && typeof range === 'object') {
|
||||
const rangeObj = range as Record<string, unknown>;
|
||||
|
||||
Reference in New Issue
Block a user