M: Improve search prompt for constituents
This commit is contained in:
parent
9e409c14f0
commit
7cda2c5039
|
|
@ -15,6 +15,17 @@ import { CstMatchMode } from '../../stores/cst-search';
|
||||||
|
|
||||||
import { type DlgEditReferenceProps, type IEditReferenceState } from './dlg-edit-reference';
|
import { type DlgEditReferenceProps, type IEditReferenceState } from './dlg-edit-reference';
|
||||||
|
|
||||||
|
function prepareSelectionPrompt(text: string | undefined): string {
|
||||||
|
if (!text) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
if (text.includes(' ')) {
|
||||||
|
text = text.substring(0, text.indexOf(' '));
|
||||||
|
}
|
||||||
|
text = text.substring(0, text.length - 3);
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
export function TabEntityReference() {
|
export function TabEntityReference() {
|
||||||
const { schemaID, initial } = useDialogsStore(state => state.props as DlgEditReferenceProps);
|
const { schemaID, initial } = useDialogsStore(state => state.props as DlgEditReferenceProps);
|
||||||
const { schema } = useRSFormSuspense({ itemID: schemaID });
|
const { schema } = useRSFormSuspense({ itemID: schemaID });
|
||||||
|
|
@ -32,7 +43,7 @@ export function TabEntityReference() {
|
||||||
<div className='cc-fade-in cc-column'>
|
<div className='cc-fade-in cc-column'>
|
||||||
<PickConstituenta
|
<PickConstituenta
|
||||||
id='dlg_reference_entity_picker'
|
id='dlg_reference_entity_picker'
|
||||||
initialFilter={initial.text}
|
initialFilter={prepareSelectionPrompt(initial.text)}
|
||||||
value={selectedCst}
|
value={selectedCst}
|
||||||
items={schema.items}
|
items={schema.items}
|
||||||
onChange={handleSelectConstituenta}
|
onChange={handleSelectConstituenta}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user