<!--
/**
 * OData v4 ValueHelp
 * @param metadataContext:entitySet context to the EntitySet
 * @param metadataContext:property context to the property that should be rendered
 * @param idPrefix default 'VH' Prefix for the id
 * @param conditionModel default '' indicator whether the field help is for a filter field
 * @returns
 */
-->

<core:FragmentDefinition xmlns:template="http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1"
	xmlns:core="sap.ui.core"
	xmlns="sap.m"
	xmlns:mdcField="sap.ui.mdc.field"
	xmlns:unittest="http://schemas.sap.com/sapui5/preprocessorextension/sap.fe.unittesting/1"
	xmlns:log="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1"
	template:require="{
		MODEL: 'sap/ui/model/odata/v4/AnnotationHelper',
		FIELD: 'sap/fe/macros/field/FieldHelper',
		ID: 'sap/fe/macros/StableIdHelper'
	}">
	<template:with path="property>" var="originalProperty">
	<template:with path="property>" helper="FIELD.valueHelpProperty" var="property">
	<template:with path="entitySet>@sapui.name" var="esName">
		<template:if test="{=
					${property>@com.sap.vocabularies.Common.v1.ValueListReferences} ||
					${property>@com.sap.vocabularies.Common.v1.ValueListMapping} ||
					${property>@com.sap.vocabularies.Common.v1.ValueList}
				}">
			<!-- Value Help -->
				<template:then>
					<mdcField:FieldValueHelp
						core:require="{ValueListHelper: 'sap/fe/macros/ValueListHelper'}"
						unittest:id="a"
						log:sourcePath="/{esName>}/{property>@@FIELD.propertyName}"
						id="{= ID.generate([${this>idPrefix} || 'VH', ((${originalProperty>@@FIELD.propertyName} !== ${property>@@FIELD.propertyName}) ? (${originalProperty>@@FIELD.propertyName} + '::' + ${property>@@FIELD.propertyName}) : ${property>@@FIELD.propertyName})]) }"
						showConditionPanel="true"
						noDialog="{= ${property>@@MODEL.getValueListType} === 'Fixed'}"
						dataRequested="ValueListHelper.showValueListInfo('/{esName>}/{property>@@FIELD.propertyName}',$\{$source>\},$\{$parameters>/suggestion\},'{this>conditionModel}'))"
						open="ValueListHelper.showValueListInfo('/{esName>}/{property>@@FIELD.propertyName}',$\{$source>\},$\{$parameters>/suggestion\},'{this>conditionModel}'))"
						validateInput="{= (${originalProperty>$Path@Org.OData.Measures.V1.ISOCurrency} || ${originalProperty>$Path@Org.OData.Measures.V1.Unit}) ? 'true' : 'false' }">
					<mdcField:FieldValueHelpMTableWrapper />
					</mdcField:FieldValueHelp>
				</template:then>
			<!-- Date and DateTime Filters-->
				<template:elseif test="{=
						['Edm.Date','Edm.DateTime','Edm.DateTimeOffset'].indexOf(${property>$Type}) &gt; -1
					}">
					<mdcField:FieldValueHelp
					unittest:id="b"
						id="{= ID.generate([${this>idPrefix} || 'VH', ((${originalProperty>@@FIELD.propertyName} !== ${property>@@FIELD.propertyName}) ? (${originalProperty>@@FIELD.propertyName} + '::' + ${property>@@FIELD.propertyName}) : ${property>@@FIELD.propertyName})]) }"
						showConditionPanel="true"
						title="{property>@com.sap.vocabularies.Common.v1.Label}">
					</mdcField:FieldValueHelp>
				</template:elseif>
		</template:if>
	</template:with>
	</template:with>
	</template:with>
</core:FragmentDefinition>
