2023-10-02 10:46:09 +00:00
|
|
|
import BaseStyle from 'primevue/base/style';
|
|
|
|
import { ObjectUtils } from 'primevue/utils';
|
|
|
|
|
|
|
|
const inlineStyles = {
|
|
|
|
root: { position: 'relative' }
|
|
|
|
};
|
|
|
|
|
|
|
|
const classes = {
|
|
|
|
root: ({ instance, props }) => [
|
|
|
|
'p-autocomplete p-component p-inputwrapper',
|
|
|
|
{
|
|
|
|
'p-disabled': props.disabled,
|
2024-01-30 11:27:56 +00:00
|
|
|
'p-invalid': props.invalid,
|
2023-10-02 10:46:09 +00:00
|
|
|
'p-focus': instance.focused,
|
|
|
|
'p-inputwrapper-filled': props.modelValue || ObjectUtils.isNotEmpty(instance.inputValue),
|
|
|
|
'p-inputwrapper-focus': instance.focused,
|
2024-04-06 20:52:27 +00:00
|
|
|
'p-autocomplete-open': instance.overlayVisible
|
2024-02-02 11:46:26 +00:00
|
|
|
}
|
|
|
|
],
|
2024-04-06 20:52:27 +00:00
|
|
|
input: 'p-autocomplete-input',
|
2024-02-02 11:46:26 +00:00
|
|
|
container: ({ props, instance }) => [
|
2024-04-06 20:52:27 +00:00
|
|
|
'p-autocomplete-chip-group',
|
2024-02-02 11:46:26 +00:00
|
|
|
{
|
|
|
|
'p-variant-filled': props.variant ? props.variant === 'filled' : instance.$primevue.config.inputStyle === 'filled'
|
|
|
|
}
|
|
|
|
],
|
2024-03-18 10:01:24 +00:00
|
|
|
token: ({ instance, i }) => [
|
2024-04-06 20:52:27 +00:00
|
|
|
'p-autocomplete-chip',
|
2024-03-18 10:01:24 +00:00
|
|
|
{
|
|
|
|
'p-focus': instance.focusedMultipleOptionIndex === i
|
|
|
|
}
|
|
|
|
],
|
2024-04-06 20:52:27 +00:00
|
|
|
tokenLabel: 'p-autocomplete-chip-label',
|
|
|
|
removeTokenIcon: 'p-autocomplete-chip-icon',
|
|
|
|
inputToken: 'p-autocomplete-input-chip',
|
2023-10-02 10:46:09 +00:00
|
|
|
loadingIcon: 'p-autocomplete-loader',
|
|
|
|
dropdownButton: 'p-autocomplete-dropdown',
|
2024-03-22 08:58:03 +00:00
|
|
|
panel: ({ instance }) => [
|
2024-04-06 20:52:27 +00:00
|
|
|
'p-autocomplete-overlay p-component',
|
2023-10-02 10:46:09 +00:00
|
|
|
{
|
|
|
|
'p-ripple-disabled': instance.$primevue.config.ripple === false
|
|
|
|
}
|
|
|
|
],
|
2024-04-06 20:52:27 +00:00
|
|
|
list: 'p-autocomplete-list',
|
2024-04-07 09:40:54 +00:00
|
|
|
itemGroup: 'p-autocomplete-option-group',
|
2023-10-02 10:46:09 +00:00
|
|
|
item: ({ instance, option, i, getItemOptions }) => [
|
2024-04-07 09:40:54 +00:00
|
|
|
'p-autocomplete-option',
|
2023-10-02 10:46:09 +00:00
|
|
|
{
|
2024-04-07 09:40:54 +00:00
|
|
|
'p-autocomplete-option-selected': instance.isSelected(option),
|
2023-10-02 10:46:09 +00:00
|
|
|
'p-focus': instance.focusedOptionIndex === instance.getOptionIndex(i, getItemOptions),
|
|
|
|
'p-disabled': instance.isOptionDisabled(option)
|
|
|
|
}
|
|
|
|
],
|
|
|
|
emptyMessage: 'p-autocomplete-empty-message'
|
|
|
|
};
|
|
|
|
|
|
|
|
export default BaseStyle.extend({
|
|
|
|
name: 'autocomplete',
|
|
|
|
classes,
|
|
|
|
inlineStyles
|
|
|
|
});
|