File manager - Edit - /home/c14075/dragmet-ural.ru/www/bitrix/modules/ui/install/js/ui/entity-selector/src/search/match-field.js
Back
import { Type } from 'main.core'; import type SearchField from './search-field'; import MatchIndex from './match-index'; import { OrderedArray } from 'main.core.collections'; const comparator = (a: MatchIndex, b: MatchIndex) => { if (a.getStartIndex() === b.getStartIndex()) { return a.getEndIndex() > b.getEndIndex() ? -1 : 1; } else { return a.getStartIndex() > b.getStartIndex() ? 1 : -1; } }; export default class MatchField { field: SearchField = null; matchIndexes: OrderedArray<MatchIndex> = new OrderedArray(comparator); constructor(field: SearchField, indexes: MatchIndex[] = []) { this.field = field; this.addIndexes(indexes); } getField(): SearchField { return this.field; } getMatches(): OrderedArray<MatchIndex> { return this.matchIndexes; } addIndex(matchIndex: MatchIndex): void { this.matchIndexes.add(matchIndex); } addIndexes(matchIndexes: MatchIndex[]): void { if (Type.isArray(matchIndexes)) { matchIndexes.forEach(matchIndex => { this.addIndex(matchIndex); }); } } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.27 |
proxy
|
phpinfo
|
Settings