feat: add additional field options (#2154)

This commit is contained in:
David Nguyen
2025-11-08 23:40:03 +11:00
committed by GitHub
parent 0977c16e33
commit 9fd9613076
46 changed files with 1017 additions and 328 deletions

View File

@ -50,7 +50,7 @@ export const renderDropdownFieldElement = (
field: FieldToRender,
options: RenderFieldElementOptions,
) => {
const { pageWidth, pageHeight, pageLayer, mode, translations } = options;
const { pageWidth, pageHeight, pageLayer, mode, translations, color } = options;
const { fieldWidth, fieldHeight } = calculateFieldPosition(field, pageWidth, pageHeight);
@ -74,6 +74,21 @@ export const renderDropdownFieldElement = (
const fontSize = dropdownMeta?.fontSize || DEFAULT_STANDARD_FONT_SIZE;
// Don't show any labels when exporting.
if (mode === 'export') {
selectedValue = '';
}
// Render the default value if readonly.
if (
dropdownMeta?.readOnly &&
dropdownMeta.defaultValue &&
dropdownMeta.values &&
dropdownMeta.values.some((value) => value.value === dropdownMeta.defaultValue)
) {
selectedValue = dropdownMeta.defaultValue;
}
if (field.inserted) {
selectedValue = field.customText;
}
@ -166,7 +181,9 @@ export const renderDropdownFieldElement = (
pageLayer.batchDraw();
});
createFieldHoverInteraction({ fieldGroup, fieldRect, options });
if (color !== 'readOnly' && mode !== 'export') {
createFieldHoverInteraction({ fieldGroup, fieldRect, options });
}
return {
fieldGroup,