File manager - Edit - /home/c14075/dragmet-ural.ru/www/bitrix/js/landing/ui/field/sourcefield/src/internal/prepare-sources.js
Back
import {Type, Runtime} from 'main.core'; import getFilterStub from './filter-stub'; export type SourceItem = { name: string, value: string, filter?: Array<{key: string, name: string, value: any}>, sort?: { items: Array<{name: string, value: string}>, }, url?: string, settings?: { detailPage?: boolean, }, }; export default function prepareSources(sources: Array<SourceItem>) { if (Type.isArray(sources)) { return sources.reduce((acc, item) => { if ( Type.isPlainObject(item) && Type.isString(item.name) && Type.isString(item.value) ) { const source = Runtime.clone(item); if ( !Type.isArray(source.filter) || source.filter.length <= 0 ) { source.filter = [Runtime.clone(getFilterStub())]; } if ( !Type.isPlainObject(source.sort) || !Type.isArray(source.sort.items) ) { source.sort = {items: []}; } return [...acc, source]; } return acc; }, []); } return []; }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.29 |
proxy
|
phpinfo
|
Settings