Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(range-selector): placeholder flush #2607

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,65 +91,65 @@ export const RuleEdit = (props: IRuleEditProps) => {
return defaultType;
}
switch (type) {
case CFRuleType.highlightCell:{
case CFRuleType.highlightCell: {
const subType = props.rule?.rule.subType;
switch (subType) {
case CFSubRuleType.number:
case CFSubRuleType.text:
case CFSubRuleType.duplicateValues:
case CFSubRuleType.uniqueValues:
case CFSubRuleType.timePeriod:{
case CFSubRuleType.timePeriod: {
return '1';
}
case CFSubRuleType.average:
case CFSubRuleType.rank:{
case CFSubRuleType.rank: {
return '2';
}
case CFSubRuleType.formula:{
case CFSubRuleType.formula: {
return '5';
}
}
break;
}
case CFRuleType.dataBar:{
case CFRuleType.dataBar: {
return '3';
}
case CFRuleType.colorScale:{
case CFRuleType.colorScale: {
return '4';
}
case CFRuleType.iconSet:{
case CFRuleType.iconSet: {
return '6';
}
}
return defaultType;
});
const result = useRef < Parameters<IStyleEditorProps['onChange']>>();
const result = useRef<Parameters<IStyleEditorProps['onChange']>>();
const interceptorManager = useMemo(() => {
const _interceptorManager = new InterceptorManager({ beforeSubmit, submit });
return _interceptorManager;
}, []);

const StyleEditor = useMemo(() => {
switch (ruleType) {
case '1':{
case '1': {
return HighlightCellStyleEditor;
}
case '2':{
case '2': {
return RankStyleEditor;
}
case '3':{
case '3': {
return DataBarStyleEditor;
}
case '4':{
case '4': {
return ColorScaleStyleEditor;
}
case '5':{
case '5': {
return FormulaStyleEditor;
}
case '6':{
case '6': {
return IconSet;
}
default :{
default: {
return HighlightCellStyleEditor;
}
}
Expand Down Expand Up @@ -224,7 +224,15 @@ export const RuleEdit = (props: IRuleEditProps) => {
<div className={styles.cfRuleStyleEditor}>
<div className={styleBase.title}>{localeService.t('sheet.cf.panel.range')}</div>
<div className={`${styleBase.mTBase}`}>
<RangeSelector placeholder={localeService.t('sheet.cf.form.rangeSelector')} width={'100%' as unknown as number} openForSheetSubUnitId={subUnitId} openForSheetUnitId={unitId} value={rangeString} id={createInternalEditorID(`${SHEET_CONDITIONAL_FORMATTING_PLUGIN}_rangeSelector`)} onChange={onRangeSelectorChange} />
<RangeSelector
placeholder={localeService.t('sheet.cf.form.rangeSelector')}
width={'100%' as unknown as number}
openForSheetSubUnitId={subUnitId}
openForSheetUnitId={unitId}
value={rangeString}
id={createInternalEditorID(`${SHEET_CONDITIONAL_FORMATTING_PLUGIN}_rangeSelector`)}
onChange={onRangeSelectorChange}
/>
</div>
<div className={styleBase.title}>{localeService.t('sheet.cf.panel.styleType')}</div>
<div className={styleBase.mTBase}>
Expand Down
7 changes: 5 additions & 2 deletions packages/ui/src/components/editor/TextEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ export function TextEditor(props: ITextEditorProps & Omit<MyComponentProps, 'onC

onValid,

placeholder = '',

isValueValid = true,
} = props;

const editorService = useDependency(IEditorService);

const localeService = useDependency(LocaleService);

const [placeholder, placeholderSet] = useState('');

const [validationContent, setValidationContent] = useState<string>('');

const [validationVisible, setValidationVisible] = useState(isValueValid);
Expand Down Expand Up @@ -171,6 +171,9 @@ export function TextEditor(props: ITextEditorProps & Omit<MyComponentProps, 'onC
},
editor);

editorService.setValueNoRefresh(props.value || '', id);
placeholderSet(props.placeholder || '');

const activeChange = debounce((state: boolean) => {
setActive(state);
onActive && onActive(state);
Expand Down
Loading