(
ecModel: GlobalModel,
finderInput: ModelFinder,
opt?: {
// If no main type specified, use this main type.
defaultMainType?: ComponentMainType;
// If pervided, types out of this list will be ignored.
includeMainTypes?: ComponentMainType[];
enableAll?: boolean;
enableNone?: boolean;
}
)
| 826 | * The same behavior as `component.getReferringComponents`. |
| 827 | */ |
| 828 | export function parseFinder( |
| 829 | ecModel: GlobalModel, |
| 830 | finderInput: ModelFinder, |
| 831 | opt?: { |
| 832 | // If no main type specified, use this main type. |
| 833 | defaultMainType?: ComponentMainType; |
| 834 | // If pervided, types out of this list will be ignored. |
| 835 | includeMainTypes?: ComponentMainType[]; |
| 836 | enableAll?: boolean; |
| 837 | enableNone?: boolean; |
| 838 | } |
| 839 | ): ParsedModelFinder { |
| 840 | const { mainTypeSpecified, queryOptionMap, others } = preParseFinder(finderInput, opt); |
| 841 | const result = others as ParsedModelFinderKnown; |
| 842 | |
| 843 | const defaultMainType = opt ? opt.defaultMainType : null; |
| 844 | if (!mainTypeSpecified && defaultMainType) { |
| 845 | queryOptionMap.set(defaultMainType, {}); |
| 846 | } |
| 847 | |
| 848 | queryOptionMap.each(function (queryOption, mainType) { |
| 849 | const queryResult = queryReferringComponents( |
| 850 | ecModel, |
| 851 | mainType, |
| 852 | queryOption, |
| 853 | { |
| 854 | useDefault: defaultMainType === mainType, |
| 855 | enableAll: (opt && opt.enableAll != null) ? opt.enableAll : true, |
| 856 | enableNone: (opt && opt.enableNone != null) ? opt.enableNone : true |
| 857 | } |
| 858 | ); |
| 859 | result[mainType + 'Models'] = queryResult.models; |
| 860 | result[mainType + 'Model'] = queryResult.models[0]; |
| 861 | }); |
| 862 | |
| 863 | return result; |
| 864 | } |
| 865 | |
| 866 | export function preParseFinder( |
| 867 | finderInput: ModelFinder, |
no test coverage detected
searching dependent graphs…