Merge branch 'main' into next

This commit is contained in:
Zeke Zhang 2025-01-03 17:03:27 +08:00
commit 122d33aaf5
12 changed files with 145 additions and 56 deletions

View File

@ -520,6 +520,14 @@
"Small": "Small", "Small": "Small",
"Middle": "Middle", "Middle": "Middle",
"Large": "Large", "Large": "Large",
"Size": "Size",
"Oversized": "Oversized",
"Auto": "Auto",
"Object Fit": "Object Fit",
"Cover": "Cover",
"Fill": "Fill",
"Contain": "Contain",
"Scale Down": "Scale Down",
"Menu item title": "Menu item title", "Menu item title": "Menu item title",
"Menu item icon": "Menu item icon", "Menu item icon": "Menu item icon",
"Target": "Target", "Target": "Target",
@ -850,4 +858,4 @@
"Ellipsis overflow content": "Ellipsis overflow content", "Ellipsis overflow content": "Ellipsis overflow content",
"Hide column": "Hide column", "Hide column": "Hide column",
"In configuration mode, the entire column becomes transparent. In non-configuration mode, the entire column will be hidden. Even if the entire column is hidden, its configured default values and other settings will still take effect.": "In configuration mode, the entire column becomes transparent. In non-configuration mode, the entire column will be hidden. Even if the entire column is hidden, its configured default values and other settings will still take effect." "In configuration mode, the entire column becomes transparent. In non-configuration mode, the entire column will be hidden. Even if the entire column is hidden, its configured default values and other settings will still take effect.": "In configuration mode, the entire column becomes transparent. In non-configuration mode, the entire column will be hidden. Even if the entire column is hidden, its configured default values and other settings will still take effect."
} }

View File

@ -489,6 +489,14 @@
"Small": "Pequeño", "Small": "Pequeño",
"Middle": "Medio", "Middle": "Medio",
"Large": "Grande", "Large": "Grande",
"Size": "Tamaño",
"Oversized": "Sobredimensionado",
"Auto": "Automático",
"Object Fit": "Ajuste de objeto",
"Cover": "Cubrir",
"Fill": "Llenar",
"Contain": "Contener",
"Scale Down": "Reducir",
"Menu item title": "Título del elemento del menú", "Menu item title": "Título del elemento del menú",
"Menu item icon": "Icono del elemento del menú", "Menu item icon": "Icono del elemento del menú",
"Target": "Objetivo", "Target": "Objetivo",
@ -771,4 +779,4 @@
"Ellipsis overflow content": "Contenido de desbordamiento de elipsis", "Ellipsis overflow content": "Contenido de desbordamiento de elipsis",
"Hide column": "Ocultar columna", "Hide column": "Ocultar columna",
"In configuration mode, the entire column becomes transparent. In non-configuration mode, the entire column will be hidden. Even if the entire column is hidden, its configured default values and other settings will still take effect.": "En modo de configuración, toda la columna se vuelve transparente. En modo de no configuración, toda la columna se ocultará. Incluso si toda la columna está oculta, sus valores predeterminados configurados y otras configuraciones seguirán tomando efecto." "In configuration mode, the entire column becomes transparent. In non-configuration mode, the entire column will be hidden. Even if the entire column is hidden, its configured default values and other settings will still take effect.": "En modo de configuración, toda la columna se vuelve transparente. En modo de no configuración, toda la columna se ocultará. Incluso si toda la columna está oculta, sus valores predeterminados configurados y otras configuraciones seguirán tomando efecto."
} }

View File

@ -504,6 +504,14 @@
"Small": "Petite", "Small": "Petite",
"Middle": "Moyenne", "Middle": "Moyenne",
"Large": "Grande", "Large": "Grande",
"Size": "Taille",
"Oversized": "Surdimensionné",
"Auto": "Auto",
"Object Fit": "Ajustement de l'objet",
"Cover": "Couvrir",
"Fill": "Remplir",
"Contain": "Contenir",
"Scale Down": "Réduire",
"Menu item title": "Titre de l'élément de menu", "Menu item title": "Titre de l'élément de menu",
"Menu item icon": "Icône de l'élément de menu", "Menu item icon": "Icône de l'élément de menu",
"Target": "Cible", "Target": "Cible",
@ -768,14 +776,14 @@
"Current object": "Objet actuel", "Current object": "Objet actuel",
"Linkage with form fields": "Lien avec les champs de formulaire", "Linkage with form fields": "Lien avec les champs de formulaire",
"Allow add new, update and delete actions": "Autoriser les actions d'ajout, de mise à jour et de suppression", "Allow add new, update and delete actions": "Autoriser les actions d'ajout, de mise à jour et de suppression",
"Allow add new":"Autoriser les ajouts", "Allow add new": "Autoriser les ajouts",
"loading": "chargement", "loading": "chargement",
"name is required": "le nom est requis", "name is required": "le nom est requis",
"data source": "source de données", "data source": "source de données",
"Data source": "source de données", "Data source": "source de données",
"The {{type}} \"{{name}}\" may have been deleted. Please remove this {{blockType}}.": "Le {{type}} \"{{name}}\" a peut-être été supprimé. Veuillez supprimer ce {{blockType}}.", "The {{type}} \"{{name}}\" may have been deleted. Please remove this {{blockType}}.": "Le {{type}} \"{{name}}\" a peut-être été supprimé. Veuillez supprimer ce {{blockType}}.",
"DataSource": "Source de données", "DataSource": "Source de données",
"Allow selection of existing records":"Permet de sélectionner des données existantes", "Allow selection of existing records": "Permet de sélectionner des données existantes",
"Home page": "Page d'accueil", "Home page": "Page d'accueil",
"Handbook": "Manuel de l'utilisateur", "Handbook": "Manuel de l'utilisateur",
"License": "Licence", "License": "Licence",
@ -791,4 +799,4 @@
"Ellipsis overflow content": "Contenu de débordement avec ellipse", "Ellipsis overflow content": "Contenu de débordement avec ellipse",
"Hide column": "Masquer la colonne", "Hide column": "Masquer la colonne",
"In configuration mode, the entire column becomes transparent. In non-configuration mode, the entire column will be hidden. Even if the entire column is hidden, its configured default values and other settings will still take effect.": "En mode de configuration, toute la colonne devient transparente. En mode de non-configuration, toute la colonne sera masquée. Même si toute la colonne est masquée, ses valeurs par défaut configurées et les autres paramètres resteront toujours en vigueur." "In configuration mode, the entire column becomes transparent. In non-configuration mode, the entire column will be hidden. Even if the entire column is hidden, its configured default values and other settings will still take effect.": "En mode de configuration, toute la colonne devient transparente. En mode de non-configuration, toute la colonne sera masquée. Même si toute la colonne est masquée, ses valeurs par défaut configurées et les autres paramètres resteront toujours en vigueur."
} }

View File

@ -786,6 +786,14 @@
"Small": "スモール", "Small": "スモール",
"Middle": "ミドル", "Middle": "ミドル",
"Large": "ラージ", "Large": "ラージ",
"Size": "サイズ",
"Oversized": "特大",
"Auto": "自動",
"Object Fit": "オブジェクトフィット",
"Cover": "カバー",
"Fill": "フィル",
"Contain": "コンテイン",
"Scale Down": "スケールダウン",
"Identifier for program usage. Support letters, numbers and underscores, must start with an letter.": "プログラム使用のための識別子。文字、数字、...", "Identifier for program usage. Support letters, numbers and underscores, must start with an letter.": "プログラム使用のための識別子。文字、数字、...",
"Style": "スタイル", "Style": "スタイル",
"Allows to configure interface": "インターフェースの設定を許可", "Allows to configure interface": "インターフェースの設定を許可",
@ -1009,4 +1017,4 @@
"Parent object": "親オブジェクト", "Parent object": "親オブジェクト",
"Hide column": "列を非表示", "Hide column": "列を非表示",
"In configuration mode, the entire column becomes transparent. In non-configuration mode, the entire column will be hidden. Even if the entire column is hidden, its configured default values and other settings will still take effect.": "設定モードでは、列全体が透明になります。非設定モードでは、列全体が非表示になります。列全体が非表示になっても、設定されたデフォルト値やその他の設定は依然として有効です。" "In configuration mode, the entire column becomes transparent. In non-configuration mode, the entire column will be hidden. Even if the entire column is hidden, its configured default values and other settings will still take effect.": "設定モードでは、列全体が透明になります。非設定モードでは、列全体が非表示になります。列全体が非表示になっても、設定されたデフォルト値やその他の設定は依然として有効です。"
} }

View File

@ -536,6 +536,14 @@
"Small": "작은", "Small": "작은",
"Middle": "중간", "Middle": "중간",
"Large": "큰", "Large": "큰",
"Size": "크기",
"Oversized": "초대형",
"Auto": "자동",
"Object Fit": "객체 맞춤",
"Cover": "커버",
"Fill": "채우기",
"Contain": "포함",
"Scale Down": "축소",
"Menu item title": "메뉴 항목 제목", "Menu item title": "메뉴 항목 제목",
"Menu item icon": "메뉴 항목 아이콘", "Menu item icon": "메뉴 항목 아이콘",
"Target": "대상", "Target": "대상",
@ -870,16 +878,16 @@
"Home page": "홈페이지", "Home page": "홈페이지",
"Handbook": "사용자 매뉴얼", "Handbook": "사용자 매뉴얼",
"License": "라이선스", "License": "라이선스",
"This variable has been deprecated and can be replaced with \"Current form\"": "변수가 폐기되었습니다. \"현재 폼\"을 대체로 사용할 수 있습니다", "This variable has been deprecated and can be replaced with \"Current form\"": "변수가 폐기되었습니다. \"현재 폼\"을 대체로 사용할 수 있습니다",
"The value of this variable is derived from the query string of the page URL. This variable can only be used normally when the page has a query string.": "이 변수의 값은 페이지 URL의 쿼리 문자열에서 파생됩니다. 이 변수는 페이지에 쿼리 문자열이 있는 경우에만 정상적으로 사용할 수 있습니다.", "The value of this variable is derived from the query string of the page URL. This variable can only be used normally when the page has a query string.": "이 변수의 값은 페이지 URL의 쿼리 문자열에서 파생됩니다. 이 변수는 페이지에 쿼리 문자열이 있는 경우에만 정상적으로 사용할 수 있습니다.",
"URL search params": "URL 검색 매개변수", "URL search params": "URL 검색 매개변수",
"Expand All": "모두 펼치기", "Expand All": "모두 펼치기",
"Clear default value": "기본값 지우기", "Clear default value": "기본값 지우기",
"Open in new window": "새 창에서 열기", "Open in new window": "새 창에서 열기",
"Sorry, the page you visited does not exist.": "죄송합니다. 방문한 페이지가 존재하지 않습니다.", "Sorry, the page you visited does not exist.": "죄송합니다. 방문한 페이지가 존재하지 않습니다.",
"Allow multiple selection": "다중 선택 허용", "Allow multiple selection": "다중 선택 허용",
"Parent object": "부모 객체", "Parent object": "부모 객체",
"Ellipsis overflow content": "생략 부호로 내용 줄임", "Ellipsis overflow content": "생략 부호로 내용 줄임",
"Hide column": "열 숨기기", "Hide column": "열 숨기기",
"In configuration mode, the entire column becomes transparent. In non-configuration mode, the entire column will be hidden. Even if the entire column is hidden, its configured default values and other settings will still take effect.": "구성 모드에서는 전체 열이 투명해집니다. 비구성 모드에서는 전체 열이 숨겨집니다. 전체 열이 숨겨져도 구성된 기본값 및 기타 설정은 여전히 적용됩니다." "In configuration mode, the entire column becomes transparent. In non-configuration mode, the entire column will be hidden. Even if the entire column is hidden, its configured default values and other settings will still take effect.": "구성 모드에서는 전체 열이 투명해집니다. 비구성 모드에서는 전체 열이 숨겨집니다. 전체 열이 숨겨져도 구성된 기본값 및 기타 설정은 여전히 적용됩니다."
} }

View File

@ -452,6 +452,14 @@
"Small": "Pequeno", "Small": "Pequeno",
"Middle": "Médio", "Middle": "Médio",
"Large": "Grande", "Large": "Grande",
"Size": "Tamanho",
"Oversized": "Exagerado",
"Auto": "Automático",
"Object Fit": "Ajuste do Objeto",
"Cover": "Cobrir",
"Fill": "Preencher",
"Contain": "Contém",
"Scale Down": "Reduzir",
"Menu item title": "Título do item de menu", "Menu item title": "Título do item de menu",
"Menu item icon": "Ícone do item de menu", "Menu item icon": "Ícone do item de menu",
"Target": "Destino", "Target": "Destino",
@ -664,7 +672,7 @@
"Plugin starting...": "Plugin iniciando...", "Plugin starting...": "Plugin iniciando...",
"Plugin stopping...": "Plugin parando...", "Plugin stopping...": "Plugin parando...",
"Are you sure to delete this plugin?": "Tem certeza de que deseja excluir este plugin?", "Are you sure to delete this plugin?": "Tem certeza de que deseja excluir este plugin?",
"Are you sure to delete this plugin":"Tem a certeza que deseja desactivar este plugin", "Are you sure to delete this plugin": "Tem a certeza que deseja desactivar este plugin",
"re-download file": "re-fazer download do arquivo", "re-download file": "re-fazer download do arquivo",
"Not enabled": "Não habilitado", "Not enabled": "Não habilitado",
"Search plugin": "Pesquisar plugin", "Search plugin": "Pesquisar plugin",
@ -723,14 +731,14 @@
"Not found": "Não encontrado", "Not found": "Não encontrado",
"Add": "Adicionar", "Add": "Adicionar",
"Automatically drop objects that depend on the collection (such as views), and in turn all objects that depend on those objects": "Excluir automaticamente objetos que dependem desta tabela, bem como objetos que dependem desses objetos", "Automatically drop objects that depend on the collection (such as views), and in turn all objects that depend on those objects": "Excluir automaticamente objetos que dependem desta tabela, bem como objetos que dependem desses objetos",
"Allow add new":"Permitir novas adições", "Allow add new": "Permitir novas adições",
"loading": "carregando", "loading": "carregando",
"name is required": "nome é obrigatório", "name is required": "nome é obrigatório",
"data source": "fonte de dados", "data source": "fonte de dados",
"Data source": "fonte de dados", "Data source": "fonte de dados",
"DataSource": "Fonte de dados", "DataSource": "Fonte de dados",
"The {{type}} \"{{name}}\" may have been deleted. Please remove this {{blockType}}.": "O {{type}} \"{{name}}\" pode ter sido excluído. Por favor, remova este {{blockType}}.", "The {{type}} \"{{name}}\" may have been deleted. Please remove this {{blockType}}.": "O {{type}} \"{{name}}\" pode ter sido excluído. Por favor, remova este {{blockType}}.",
"Allow selection of existing records":"Permitir a selecção dos registos existentes", "Allow selection of existing records": "Permitir a selecção dos registos existentes",
"Home page": "Página inicial", "Home page": "Página inicial",
"Handbook": "Manual do usuário", "Handbook": "Manual do usuário",
"License": "Licença", "License": "Licença",
@ -748,4 +756,4 @@
"Ellipsis overflow content": "Conteúdo de transbordamento com reticências", "Ellipsis overflow content": "Conteúdo de transbordamento com reticências",
"Hide column": "Ocultar coluna", "Hide column": "Ocultar coluna",
"In configuration mode, the entire column becomes transparent. In non-configuration mode, the entire column will be hidden. Even if the entire column is hidden, its configured default values and other settings will still take effect.": "Em modo de configuração, a coluna inteira se torna transparente. Em modo de não configuração, a coluna inteira será ocultada. Mesmo se a coluna inteira estiver oculta, seus valores padrão configurados e outras configurações ainda terão efeito." "In configuration mode, the entire column becomes transparent. In non-configuration mode, the entire column will be hidden. Even if the entire column is hidden, its configured default values and other settings will still take effect.": "Em modo de configuração, a coluna inteira se torna transparente. Em modo de não configuração, a coluna inteira será ocultada. Mesmo se a coluna inteira estiver oculta, seus valores padrão configurados e outras configurações ainda terão efeito."
} }

View File

@ -506,6 +506,14 @@
"Small": "Малий", "Small": "Малий",
"Middle": "Середній", "Middle": "Середній",
"Large": "Великий", "Large": "Великий",
"Size": "Розмір",
"Oversized": "Великий",
"Auto": "Авто",
"Object Fit": "Пристосування",
"Cover": "Накрити",
"Fill": "Наповнення",
"Contain": "Вмістити",
"Scale Down": "Зменшити",
"Menu item title": "Заголовок пункту меню", "Menu item title": "Заголовок пункту меню",
"Menu item icon": "Значок пункту меню", "Menu item icon": "Значок пункту меню",
"Target": "Ціль", "Target": "Ціль",
@ -791,4 +799,4 @@
"Ellipsis overflow content": "Вміст з багатокрапкою при переповненні", "Ellipsis overflow content": "Вміст з багатокрапкою при переповненні",
"Hide column": "Сховати стовпець", "Hide column": "Сховати стовпець",
"In configuration mode, the entire column becomes transparent. In non-configuration mode, the entire column will be hidden. Even if the entire column is hidden, its configured default values and other settings will still take effect.": "В режимі конфігурації вся колонка стає прозорою. В режимі не конфігурації вся колонка буде прихована. Якщо вся колонка буде прихована, її налаштовані значення за замовчуванням і інші налаштування все одно будуть діяти." "In configuration mode, the entire column becomes transparent. In non-configuration mode, the entire column will be hidden. Even if the entire column is hidden, its configured default values and other settings will still take effect.": "В режимі конфігурації вся колонка стає прозорою. В режимі не конфігурації вся колонка буде прихована. Якщо вся колонка буде прихована, її налаштовані значення за замовчуванням і інші налаштування все одно будуть діяти."
} }

View File

@ -541,6 +541,14 @@
"Small": "较窄", "Small": "较窄",
"Middle": "中等", "Middle": "中等",
"Large": "较宽", "Large": "较宽",
"Size": "大小",
"Oversized": "超大",
"Auto": "自动",
"Object Fit": "适应",
"Cover": "覆盖",
"Fill": "填充",
"Contain": "包含",
"Scale Down": "缩放",
"Menu item title": "菜单项名称", "Menu item title": "菜单项名称",
"Menu item icon": "菜单项图标", "Menu item icon": "菜单项图标",
"Target": "目标", "Target": "目标",
@ -1040,4 +1048,4 @@
"Please add or select record":"请添加或选择数据", "Please add or select record":"请添加或选择数据",
"No data":"暂无数据", "No data":"暂无数据",
"Fields can only be used correctly if they are defined with an interface.": "只有字段设置了interface字段才能正常使用" "Fields can only be used correctly if they are defined with an interface.": "只有字段设置了interface字段才能正常使用"
} }

View File

@ -537,6 +537,14 @@
"Small": "較窄", "Small": "較窄",
"Middle": "中等", "Middle": "中等",
"Large": "較寬", "Large": "較寬",
"Size": "大小",
"Oversized": "超大",
"Auto": "自動",
"Object Fit": "適應",
"Cover": "覆蓋",
"Fill": "填充",
"Contain": "包含",
"Scale Down": "縮放",
"Menu item title": "選單項目名稱", "Menu item title": "選單項目名稱",
"Menu item icon": "選單項目圖示", "Menu item icon": "選單項目圖示",
"Target": "目標", "Target": "目標",
@ -881,4 +889,4 @@
"Ellipsis overflow content": "省略超出長度的內容", "Ellipsis overflow content": "省略超出長度的內容",
"Hide column": "隱藏列", "Hide column": "隱藏列",
"In configuration mode, the entire column becomes transparent. In non-configuration mode, the entire column will be hidden. Even if the entire column is hidden, its configured default values and other settings will still take effect.": "在配置模式下,整個列會變為透明色。在非配置模式下,整個列將被隱藏。即使整個列被隱藏了,其配置的默認值和其他設置仍然有效。" "In configuration mode, the entire column becomes transparent. In non-configuration mode, the entire column will be hidden. Even if the entire column is hidden, its configured default values and other settings will still take effect.": "在配置模式下,整個列會變為透明色。在非配置模式下,整個列將被隱藏。即使整個列被隱藏了,其配置的默認值和其他設置仍然有效。"
} }

View File

@ -13,11 +13,14 @@ import { useTranslation } from 'react-i18next';
import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings';
import { useColumnSchema, useDesignable } from '../../../../schema-component'; import { useColumnSchema, useDesignable } from '../../../../schema-component';
import { SchemaSettingsItemType } from '../../../../application/schema-settings'; import { SchemaSettingsItemType } from '../../../../application/schema-settings';
// import { createSelectSchemaSettingsItem } from '../../../../application';
// import { fieldComponent } from '../Input.URL/settings';
const size: SchemaSettingsItemType = { const createSettingsItem = (config: {
name: 'size', name: string;
title: string;
options: typeof getSizeOptions | typeof getObjectFitOptions;
defaultValue: string;
}): SchemaSettingsItemType => ({
name: config.name,
type: 'select', type: 'select',
useComponentProps() { useComponentProps() {
const { t } = useTranslation(); const { t } = useTranslation();
@ -26,49 +29,59 @@ const size: SchemaSettingsItemType = {
const { fieldSchema: tableColumnSchema } = useColumnSchema(); const { fieldSchema: tableColumnSchema } = useColumnSchema();
const fieldSchema = tableColumnSchema || schema; const fieldSchema = tableColumnSchema || schema;
const { dn } = useDesignable(); const { dn } = useDesignable();
return { return {
title: t('Size'), title: t(config.title),
options: [ options: config.options(t),
{ value: 'small', label: 'Small' }, value: fieldSchema['x-component-props']?.[config.name] || config.defaultValue,
{ value: 'middle', label: 'Middle' }, onChange(value) {
{ value: 'large', label: 'Large' },
{ value: 'auto', label: 'Auto' },
],
value: fieldSchema['x-component-props']?.['size'] || 'small',
onChange(size) {
const schema = { const schema = {
['x-uid']: fieldSchema['x-uid'], ['x-uid']: fieldSchema['x-uid'],
}; };
fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {}; fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
fieldSchema['x-component-props']['size'] = size; fieldSchema['x-component-props'][config.name] = value;
schema['x-component-props'] = fieldSchema['x-component-props']; schema['x-component-props'] = fieldSchema['x-component-props'];
field.componentProps = field.componentProps || {}; field.componentProps = field.componentProps || {};
field.componentProps.size = size; field.componentProps[config.name] = value;
dn.emit('patch', { dn.emit('patch', {
schema, schema,
}); });
}, },
}; };
}, },
}; });
// const size2 = createSelectSchemaSettingsItem({ const getSizeOptions = (t: (key: string) => any) => [
// name: 'size2', { value: 'small', label: t('Small') },
// title: 'Size2', { value: 'middle', label: t('Middle') },
// type: 'field', { value: 'large', label: t('Large') },
// schemaKey: 'x-component-props.size', { value: 'oversized', label: t('Oversized') },
// options: [ { value: 'auto', label: t('Auto') },
// { value: 'small', label: 'Small' }, ];
// { value: 'middle', label: 'Middle' },
// { value: 'large', label: 'Large' }, const getObjectFitOptions = (t: (key: string) => any) => [
// { value: 'auto', label: 'Auto' }, { value: 'cover', label: t('Cover') },
// ], { value: 'fill', label: t('Fill') },
// }); { value: 'contain', label: t('Contain') },
{ value: 'scale-down', label: t('Scale Down') },
{ value: 'none', label: t('None') },
];
const size = createSettingsItem({
name: 'size',
title: 'Size',
options: getSizeOptions,
defaultValue: 'small',
});
const objectFit = createSettingsItem({
name: 'objectFit',
title: 'Object Fit',
options: getObjectFitOptions,
defaultValue: 'cover',
});
export const inputPreviewComponentFieldSettings = new SchemaSettings({ export const inputPreviewComponentFieldSettings = new SchemaSettings({
name: 'fieldSettings:component:Input.Preview', name: 'fieldSettings:component:Input.Preview',
items: [ items: [size, objectFit],
size,
// size2
],
}); });

View File

@ -555,7 +555,7 @@ const RenderButtonInner = observer(
} = props; } = props;
if (!designable && (field?.data?.hidden || !aclCtx)) { if (!designable && (field?.data?.hidden || !aclCtx)) {
return null; return <div style={{ visibility: 'hidden' }}>&nbsp;</div>;
} }
const actionTitle = title || field?.title; const actionTitle = title || field?.title;

View File

@ -14,10 +14,10 @@ import { Image } from 'antd';
import cls from 'classnames'; import cls from 'classnames';
import _ from 'lodash'; import _ from 'lodash';
import React, { useMemo } from 'react'; import React, { useMemo } from 'react';
import { withPopupWrapper } from '../../common/withPopupWrapper';
import { useCompile } from '../../hooks'; import { useCompile } from '../../hooks';
import { EllipsisWithTooltip } from './EllipsisWithTooltip'; import { EllipsisWithTooltip } from './EllipsisWithTooltip';
import { HTMLEncode } from './shared'; import { HTMLEncode } from './shared';
import { withPopupWrapper } from '../../common/withPopupWrapper';
export type InputReadPrettyComposed = { export type InputReadPrettyComposed = {
Input: React.FC<InputReadPrettyProps>; Input: React.FC<InputReadPrettyProps>;
@ -222,22 +222,26 @@ const sizes = {
small: 24, small: 24,
middle: 48, middle: 48,
large: 72, large: 72,
oversized: 120,
}; };
ReadPretty.Preview = function Preview(props: any) { ReadPretty.Preview = function Preview(props: any) {
const fieldSchema = useFieldSchema(); const fieldSchema = useFieldSchema();
const size = fieldSchema['x-component-props']?.['size'] || 'small'; const size = fieldSchema['x-component-props']?.['size'] || 'small';
const objectFit = fieldSchema['x-component-props']?.['objectFit'] || 'cover';
if (!props.value) { if (!props.value) {
return props.value; return props.value;
} }
return ( return (
<Image <Image
style={ style={
['small', 'middle', 'large'].includes(size) ['small', 'middle', 'large', 'oversized'].includes(size)
? { ? {
width: sizes[size], width: sizes[size],
height: sizes[size], height: sizes[size],
objectFit: 'cover', objectFit,
} }
: {} : {}
} }