@talxis/base-controls 1.2409.4 → 1.2410.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Lookup/Lookup.js +17 -2
- package/dist/components/Lookup/Lookup.js.map +1 -1
- package/dist/components/Lookup/hooks/useFetchXml.d.ts +4 -1
- package/dist/components/Lookup/hooks/useFetchXml.js +2 -2
- package/dist/components/Lookup/hooks/useFetchXml.js.map +1 -1
- package/dist/components/Lookup/hooks/useLookup.d.ts +7 -2
- package/dist/components/Lookup/hooks/useLookup.js +10 -5
- package/dist/components/Lookup/hooks/useLookup.js.map +1 -1
- package/dist/components/Lookup/interfaces.d.ts +33 -0
- package/dist/index.d.ts +39 -2
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ import { getLookupStyles } from './styles.js';
|
|
|
9
9
|
import { RecordCreator } from './components/RecordCreator.js';
|
|
10
10
|
import { useFocusIn } from '../../hooks/useFocusIn.js';
|
|
11
11
|
import { useControlSizing } from '../../hooks/useControlSizing.js';
|
|
12
|
+
import dayjs from 'dayjs';
|
|
12
13
|
|
|
13
14
|
const Lookup = (props) => {
|
|
14
15
|
const context = props.context;
|
|
@@ -91,6 +92,20 @@ const Lookup = (props) => {
|
|
|
91
92
|
const isComponentActive = () => {
|
|
92
93
|
return mouseOver || isFocused;
|
|
93
94
|
};
|
|
95
|
+
const getSecondaryName = (result, metadata) => {
|
|
96
|
+
//polymorphic, selected all
|
|
97
|
+
if (!entities.find(x => x.selected)) {
|
|
98
|
+
return metadata?.DisplayName;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
let text = result.entityData[result.layout?.Rows?.[0]?.Cells?.[1]?.Name];
|
|
102
|
+
const dateRegex = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z/;
|
|
103
|
+
if (typeof text === 'string' && text.match(dateRegex)) {
|
|
104
|
+
text = props.context.formatting.formatTime(dayjs(text).toDate(), 1);
|
|
105
|
+
}
|
|
106
|
+
return text;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
94
109
|
const onResolveSuggestions = async (filter, selectedItems) => {
|
|
95
110
|
//TODO: onResolveSuggestions gets called when the record gets selected resulting in unnecessary call
|
|
96
111
|
const results = await getSearchResults(filter);
|
|
@@ -102,8 +117,8 @@ const Lookup = (props) => {
|
|
|
102
117
|
const metadata = await entities.find(x => x.entityName === result.entityType)?.metadata;
|
|
103
118
|
suggestions.push({
|
|
104
119
|
key: result.id,
|
|
105
|
-
text: result.name
|
|
106
|
-
secondaryText: metadata
|
|
120
|
+
text: result.name,
|
|
121
|
+
secondaryText: getSecondaryName(result, metadata),
|
|
107
122
|
'data-entity': result.entityType
|
|
108
123
|
});
|
|
109
124
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Lookup.js","sources":["../../../src/components/Lookup/Lookup.tsx"],"sourcesContent":["\nimport { ILookup } from \"./interfaces\";\nimport { useLookup } from \"./hooks/useLookup\";\nimport React, { useEffect, useRef, useState } from 'react';\nimport { ThemeProvider } from \"@fluentui/react\";\nimport { IItemProps, TagPicker } from \"@talxis/react-components\";\nimport { TargetSelector } from \"./components/TargetSelector\";\nimport { useMouseOver } from \"../../hooks/useMouseOver\";\nimport { getLookupStyles } from \"./styles\";\nimport { IBasePicker } from \"@fluentui/react/lib/components/pickers/BasePicker.types\";\nimport { ITag } from \"@fluentui/react/lib/components/pickers/TagPicker/TagPicker.types\";\nimport { RecordCreator } from \"./components/RecordCreator\";\nimport { useFocusIn } from \"../../hooks/useFocusIn\";\nimport { useControlSizing } from \"../../hooks/useControlSizing\";\n\nexport const Lookup = (props: ILookup) => {\n const context = props.context;\n const ref = useRef<HTMLDivElement>(null);\n const componentRef = useRef<IBasePicker<ITag>>(null);\n const itemLimit = props.parameters.MultipleEnabled?.raw === true ? Infinity : 1\n const { height } = useControlSizing(props.context.mode);\n const [value, entities, labels, records, selectEntity, getSearchResults, theme] = useLookup(props);\n const styles = getLookupStyles(theme, itemLimit === 1, height);\n const mouseOver = useMouseOver(ref);\n const isFocused = useFocusIn(ref, 100);\n const firstRenderRef = useRef(true);\n const shouldFocusRef = useRef(false);\n const [placeholder, setPlaceholder] = useState('---');\n const onOverrideComponentProps = props.onOverrideComponentProps ?? ((props) => props);\n\n\n useEffect(() => {\n if (firstRenderRef.current) {\n firstRenderRef.current = false;\n return;\n }\n //@ts-ignore\n if (componentRef.current.state.suggestionsVisible) {\n //if the suggestions callout is open and the selected target changes, refresh the results\n forceSearch();\n }\n }, [entities])\n\n useEffect(() => {\n const onKeyPress = (ev: KeyboardEvent) => {\n if (context.mode.isControlDisabled) {\n return;\n }\n if (ev.key === 'Backspace') {\n const picker = ref.current?.querySelector('[class*=\"TALXIS__tag-picker__root\"]');\n if ((document.activeElement === picker) && value.length === 1) {\n records.select(undefined);\n setTimeout(() => {\n componentRef.current?.focusInput()\n }, 200)\n }\n }\n }\n document.addEventListener('keydown', onKeyPress)\n return () => {\n document.removeEventListener('keydown', onKeyPress);\n }\n }, [value]);\n\n useEffect(() => {\n if (props.parameters.AutoFocus?.raw === true) {\n focus();\n }\n }, []);\n\n const focus = () => {\n if(componentRef.current?.items?.length === itemLimit) {\n const el = ref.current?.querySelector(':scope>div') as HTMLDivElement;\n el?.click();\n el?.focus();\n return;\n }\n componentRef.current?.focusInput();\n }\n\n const forceSearch = async () => {\n //@ts-ignore - We need to use internal methods to show and fill the suggestions on entity change\n componentRef.current.suggestionStore.updateSuggestions([]);\n //@ts-ignore - ^^same as above\n componentRef.current.setState({\n suggestionsVisible: true,\n suggestionsLoading: true,\n });\n //@ts-ignore - ^^same as above\n const results = await onResolveSuggestions(componentRef.current.input.current.value)\n //@ts-ignore - ^^same as above\n componentRef.current.updateSuggestionsList(results);\n //@ts-ignore - ^^same above\n componentRef.current.setState({\n isMostRecentlyUsedVisible: false,\n suggestionsVisible: true,\n moreSuggestionsAvailable: false,\n });\n }\n\n const isComponentActive = () => {\n return mouseOver || isFocused;\n }\n\n const onResolveSuggestions = async (filter: string, selectedItems?: IItemProps[] | undefined): Promise<IItemProps[]> => {\n //TODO: onResolveSuggestions gets called when the record gets selected resulting in unnecessary call\n const results = await getSearchResults(filter);\n const suggestions: IItemProps[] = [];\n for (const result of results) {\n if (selectedItems?.find(x => x.key === result.id)) {\n continue;\n }\n const metadata = await entities.find(x => x.entityName === result.entityType)?.metadata;\n suggestions.push({\n key: result.id,\n text: result.name || labels.noName(),\n secondaryText: metadata?.DisplayName,\n 'data-entity': result.entityType\n })\n }\n return suggestions;\n }\n const componentProps = onOverrideComponentProps({\n ref: componentRef,\n readOnly: context.mode.isControlDisabled,\n resolveDelay: 200,\n stackItems: itemLimit === 1,\n errorMessage: props.parameters.value.errorMessage,\n hideErrorMessage: !props.parameters.ShowErrorMessage?.raw,\n pickerCalloutProps: {\n layerProps: {\n eventBubblingEnabled: true\n },\n className: styles.suggestions\n },\n\n inputProps: {\n placeholder: placeholder,\n onMouseEnter: () => {\n if (context.mode.isControlDisabled) {\n return;\n }\n setPlaceholder(`${labels.placeholder()} ${props.parameters.value.attributes.DisplayName}`);\n },\n onMouseLeave: () => {\n setPlaceholder(\"---\");\n }\n },\n pickerSuggestionsProps: {\n loadingText: labels.searching(),\n noResultsFoundText: labels.noRecordsFound(),\n // @ts-ignore\n suggestionsHeaderText: (\n <>\n {props.parameters.IsInlineNewEnabled?.raw !== false && (\n <RecordCreator labels={labels} entities={entities} onCreateRecord={records.create} />\n )}\n {props.parameters.value.attributes.Targets.length > 1 && (\n <TargetSelector\n labels={labels}\n entities={entities}\n onEntitySelected={(entityName) => {\n selectEntity(entityName);\n }}\n />\n )}\n </>\n )\n },\n transparent: itemLimit === 1,\n onChange: (items) => {\n records.select(\n items?.map((item) => {\n return {\n entityType: item['data-entity'],\n id: item.key,\n name: item.text\n };\n })\n );\n },\n searchBtnProps: {\n key: 'search',\n iconProps: {\n iconName: 'Search'\n },\n showOnlyOnHover: true\n },\n selectedItems: value.map((lookup) => {\n return {\n key: lookup.id,\n text: lookup.name || labels.noName(),\n 'data-entity': lookup.entityType,\n 'data-navigation-enabled': props.parameters.EnableNavigation?.raw !== false,\n onClick: () => {\n if (props.parameters.EnableNavigation?.raw === false) {\n return;\n }\n context.navigation.openForm({\n entityName: lookup.entityType,\n entityId: lookup.id\n });\n },\n deleteButtonProps:\n isComponentActive() || itemLimit > 1\n ? {\n key: 'delete',\n iconProps: {\n iconName: 'Cancel',\n },\n onClick: () => {\n shouldFocusRef.current = false;\n records.deselect(lookup);\n setTimeout(() => {\n focus();\n }, 200);\n }\n }\n : undefined\n };\n }),\n itemLimit: itemLimit,\n onEmptyResolveSuggestions: !context.mode.isControlDisabled ? (selectedItems) => onResolveSuggestions(\"\", selectedItems as IItemProps[]) as any : undefined,\n onResolveSuggestions: onResolveSuggestions\n });\n\n return (\n <ThemeProvider applyTo=\"none\" theme={theme} className={`talxis__lookupControl ${styles.root}`} ref={ref}>\n <TagPicker {...componentProps} />\n </ThemeProvider>\n );\n};"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;;;;;;;;AAea,MAAA,MAAM,GAAG,CAAC,KAAc,KAAI;AACrC,IAAA,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;AAC9B,IAAA,MAAM,GAAG,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;AACzC,IAAA,MAAM,YAAY,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;AACrD,IAAA,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,eAAe,EAAE,GAAG,KAAK,IAAI,GAAG,QAAQ,GAAG,CAAC,CAAA;AAC/E,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,KAAK,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,CAA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BACxB,UAAU,EAAE,MAAM,CAAC,UAAU;wBAC7B,QAAQ,EAAE,MAAM,CAAC,EAAE;AACtB,qBAAA,CAAC,CAAC;iBACN;AACD,gBAAA,iBAAiB,EACb,iBAAiB,EAAE,IAAI,SAAS,GAAG,CAAC;AAChC,sBAAE;AACE,wBAAA,GAAG,EAAE,QAAQ;AACb,wBAAA,SAAS,EAAE;AACP,4BAAA,QAAQ,EAAE,QAAQ;AACrB,yBAAA;wBACD,OAAO,EAAE,MAAK;AACV,4BAAA,cAAc,CAAC,OAAO,GAAG,KAAK,CAAC;AAC/B,4BAAA,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;4BACzB,UAAU,CAAC,MAAK;AACZ,gCAAA,KAAK,EAAE,CAAC;6BACX,EAAE,GAAG,CAAC,CAAC;yBACX;AACJ,qBAAA;AACD,sBAAE,SAAS;aACtB,CAAC;AACN,SAAC,CAAC;AACF,QAAA,SAAS,EAAE,SAAS;QACpB,yBAAyB,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,GAAG,CAAC,aAAa,KAAK,oBAAoB,CAAC,EAAE,EAAE,aAA6B,CAAQ,GAAG,SAAS;AAC1J,QAAA,oBAAoB,EAAE,oBAAoB;AAC7C,KAAA,CAAC,CAAC;AAEH,IAAA,QACIA,GAAA,CAAC,aAAa,EAAA,EAAC,OAAO,EAAC,MAAM,EAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA,sBAAA,EAAyB,MAAM,CAAC,IAAI,CAAA,CAAE,EAAE,GAAG,EAAE,GAAG,EAAA,QAAA,EACnGA,GAAC,CAAA,SAAS,EAAK,EAAA,GAAA,cAAc,EAAI,CAAA,EAAA,CACrB,EAClB;AACN;;;;"}
|
|
1
|
+
{"version":3,"file":"Lookup.js","sources":["../../../src/components/Lookup/Lookup.tsx"],"sourcesContent":["\nimport { ILayout, ILookup, IMetadata } from \"./interfaces\";\nimport { useLookup } from \"./hooks/useLookup\";\nimport React, { useEffect, useRef, useState } from 'react';\nimport { ThemeProvider } from \"@fluentui/react\";\nimport { IItemProps, TagPicker } from \"@talxis/react-components\";\nimport { TargetSelector } from \"./components/TargetSelector\";\nimport { useMouseOver } from \"../../hooks/useMouseOver\";\nimport { getLookupStyles } from \"./styles\";\nimport { IBasePicker } from \"@fluentui/react/lib/components/pickers/BasePicker.types\";\nimport { ITag } from \"@fluentui/react/lib/components/pickers/TagPicker/TagPicker.types\";\nimport { RecordCreator } from \"./components/RecordCreator\";\nimport { useFocusIn } from \"../../hooks/useFocusIn\";\nimport { useControlSizing } from \"../../hooks/useControlSizing\";\nimport dayjs from \"dayjs\";\n\nexport const Lookup = (props: ILookup) => {\n const context = props.context;\n const ref = useRef<HTMLDivElement>(null);\n const componentRef = useRef<IBasePicker<ITag>>(null);\n const itemLimit = props.parameters.MultipleEnabled?.raw === true ? Infinity : 1\n const { height } = useControlSizing(props.context.mode);\n const [value, entities, labels, records, selectEntity, getSearchResults, theme] = useLookup(props);\n const styles = getLookupStyles(theme, itemLimit === 1, height);\n const mouseOver = useMouseOver(ref);\n const isFocused = useFocusIn(ref, 100);\n const firstRenderRef = useRef(true);\n const shouldFocusRef = useRef(false);\n const [placeholder, setPlaceholder] = useState('---');\n const onOverrideComponentProps = props.onOverrideComponentProps ?? ((props) => props);\n\n\n useEffect(() => {\n if (firstRenderRef.current) {\n firstRenderRef.current = false;\n return;\n }\n //@ts-ignore\n if (componentRef.current.state.suggestionsVisible) {\n //if the suggestions callout is open and the selected target changes, refresh the results\n forceSearch();\n }\n }, [entities])\n\n useEffect(() => {\n const onKeyPress = (ev: KeyboardEvent) => {\n if (context.mode.isControlDisabled) {\n return;\n }\n if (ev.key === 'Backspace') {\n const picker = ref.current?.querySelector('[class*=\"TALXIS__tag-picker__root\"]');\n if ((document.activeElement === picker) && value.length === 1) {\n records.select(undefined);\n setTimeout(() => {\n componentRef.current?.focusInput()\n }, 200)\n }\n }\n }\n document.addEventListener('keydown', onKeyPress)\n return () => {\n document.removeEventListener('keydown', onKeyPress);\n }\n }, [value]);\n\n useEffect(() => {\n if (props.parameters.AutoFocus?.raw === true) {\n focus();\n }\n }, []);\n\n const focus = () => {\n if (componentRef.current?.items?.length === itemLimit) {\n const el = ref.current?.querySelector(':scope>div') as HTMLDivElement;\n el?.click();\n el?.focus();\n return;\n }\n componentRef.current?.focusInput();\n }\n\n const forceSearch = async () => {\n //@ts-ignore - We need to use internal methods to show and fill the suggestions on entity change\n componentRef.current.suggestionStore.updateSuggestions([]);\n //@ts-ignore - ^^same as above\n componentRef.current.setState({\n suggestionsVisible: true,\n suggestionsLoading: true,\n });\n //@ts-ignore - ^^same as above\n const results = await onResolveSuggestions(componentRef.current.input.current.value)\n //@ts-ignore - ^^same as above\n componentRef.current.updateSuggestionsList(results);\n //@ts-ignore - ^^same above\n componentRef.current.setState({\n isMostRecentlyUsedVisible: false,\n suggestionsVisible: true,\n moreSuggestionsAvailable: false,\n });\n }\n\n const isComponentActive = () => {\n return mouseOver || isFocused;\n }\n\n const getSecondaryName = (result: ComponentFramework.LookupValue & {\n entityData: {\n [key: string]: any;\n };\n layout: ILayout;\n }, metadata?: IMetadata) => {\n //polymorphic, selected all\n if (!entities.find(x => x.selected)) {\n return metadata?.DisplayName;\n }\n else {\n let text: string | undefined = result.entityData[result.layout?.Rows?.[0]?.Cells?.[1]?.Name];\n const dateRegex = /\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z/;\n if(typeof text === 'string' && text.match(dateRegex)) {\n text = props.context.formatting.formatTime(dayjs(text).toDate(), 1);\n }\n return text;\n }\n }\n\n const onResolveSuggestions = async (filter: string, selectedItems?: IItemProps[] | undefined): Promise<IItemProps[]> => {\n //TODO: onResolveSuggestions gets called when the record gets selected resulting in unnecessary call\n const results = await getSearchResults(filter);\n const suggestions: IItemProps[] = [];\n for (const result of results) {\n if (selectedItems?.find(x => x.key === result.id)) {\n continue;\n }\n const metadata = await entities.find(x => x.entityName === result.entityType)?.metadata;\n suggestions.push({\n key: result.id,\n text: result.name,\n secondaryText: getSecondaryName(result, metadata),\n 'data-entity': result.entityType\n })\n }\n return suggestions;\n }\n const componentProps = onOverrideComponentProps({\n ref: componentRef,\n readOnly: context.mode.isControlDisabled,\n resolveDelay: 200,\n stackItems: itemLimit === 1,\n errorMessage: props.parameters.value.errorMessage,\n hideErrorMessage: !props.parameters.ShowErrorMessage?.raw,\n pickerCalloutProps: {\n layerProps: {\n eventBubblingEnabled: true\n },\n className: styles.suggestions\n },\n\n inputProps: {\n placeholder: placeholder,\n onMouseEnter: () => {\n if (context.mode.isControlDisabled) {\n return;\n }\n setPlaceholder(`${labels.placeholder()} ${props.parameters.value.attributes.DisplayName}`);\n },\n onMouseLeave: () => {\n setPlaceholder(\"---\");\n }\n },\n pickerSuggestionsProps: {\n loadingText: labels.searching(),\n noResultsFoundText: labels.noRecordsFound(),\n // @ts-ignore\n suggestionsHeaderText: (\n <>\n {props.parameters.IsInlineNewEnabled?.raw !== false && (\n <RecordCreator labels={labels} entities={entities} onCreateRecord={records.create} />\n )}\n {props.parameters.value.attributes.Targets.length > 1 && (\n <TargetSelector\n labels={labels}\n entities={entities}\n onEntitySelected={(entityName) => {\n selectEntity(entityName);\n }}\n />\n )}\n </>\n )\n },\n transparent: itemLimit === 1,\n onChange: (items) => {\n records.select(\n items?.map((item) => {\n return {\n entityType: item['data-entity'],\n id: item.key,\n name: item.text\n };\n })\n );\n },\n searchBtnProps: {\n key: 'search',\n iconProps: {\n iconName: 'Search'\n },\n showOnlyOnHover: true\n },\n selectedItems: value.map((lookup) => {\n return {\n key: lookup.id,\n text: lookup.name || labels.noName(),\n 'data-entity': lookup.entityType,\n 'data-navigation-enabled': props.parameters.EnableNavigation?.raw !== false,\n onClick: () => {\n if (props.parameters.EnableNavigation?.raw === false) {\n return;\n }\n context.navigation.openForm({\n entityName: lookup.entityType,\n entityId: lookup.id\n });\n },\n deleteButtonProps:\n isComponentActive() || itemLimit > 1\n ? {\n key: 'delete',\n iconProps: {\n iconName: 'Cancel',\n },\n onClick: () => {\n shouldFocusRef.current = false;\n records.deselect(lookup);\n setTimeout(() => {\n focus();\n }, 200);\n }\n }\n : undefined\n };\n }),\n itemLimit: itemLimit,\n onEmptyResolveSuggestions: !context.mode.isControlDisabled ? (selectedItems) => onResolveSuggestions(\"\", selectedItems as IItemProps[]) as any : undefined,\n onResolveSuggestions: onResolveSuggestions\n });\n\n return (\n <ThemeProvider applyTo=\"none\" theme={theme} className={`talxis__lookupControl ${styles.root}`} ref={ref}>\n <TagPicker {...componentProps} />\n </ThemeProvider>\n );\n};"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;;;;;;;;;AAgBa,MAAA,MAAM,GAAG,CAAC,KAAc,KAAI;AACrC,IAAA,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;AAC9B,IAAA,MAAM,GAAG,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;AACzC,IAAA,MAAM,YAAY,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;AACrD,IAAA,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,eAAe,EAAE,GAAG,KAAK,IAAI,GAAG,QAAQ,GAAG,CAAC,CAAA;AAC/E,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,KAAK,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;AACnG,IAAA,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,EAAE,SAAS,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;AAC/D,IAAA,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACvC,IAAA,MA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C,KAAA,CAAC,CAAC;AAEH,IAAA,QACIA,GAAA,CAAC,aAAa,EAAA,EAAC,OAAO,EAAC,MAAM,EAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA,sBAAA,EAAyB,MAAM,CAAC,IAAI,CAAA,CAAE,EAAE,GAAG,EAAE,GAAG,EAAA,QAAA,EACnGA,GAAC,CAAA,SAAS,EAAK,EAAA,GAAA,cAAc,EAAI,CAAA,EAAA,CACrB,EAClB;AACN;;;;"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
/// <reference types="powerapps-component-framework" />
|
|
2
2
|
import { IEntity } from "../interfaces";
|
|
3
|
-
export declare const useFetchXml: (context: ComponentFramework.Context<any>) => [(viewId: string) => Promise<
|
|
3
|
+
export declare const useFetchXml: (context: ComponentFramework.Context<any>) => [(viewId: string) => Promise<{
|
|
4
|
+
fetchxml: string;
|
|
5
|
+
layoutjson: string;
|
|
6
|
+
}>, (entity: IEntity, fetchXml: string, query: string) => Promise<string>];
|
|
@@ -5,9 +5,9 @@ const useFetchXml = (context) => {
|
|
|
5
5
|
const cachedFetchXml = useRef({});
|
|
6
6
|
const get = async (viewId) => {
|
|
7
7
|
if (!cachedFetchXml.current[viewId]) {
|
|
8
|
-
cachedFetchXml.current[viewId] = context.webAPI.retrieveRecord('savedquery', viewId, '?$select=fetchxml');
|
|
8
|
+
cachedFetchXml.current[viewId] = context.webAPI.retrieveRecord('savedquery', viewId, '?$select=fetchxml,layoutjson');
|
|
9
9
|
}
|
|
10
|
-
return
|
|
10
|
+
return cachedFetchXml.current[viewId];
|
|
11
11
|
};
|
|
12
12
|
const applyLookupQuery = async (entity, fetchXml, query) => {
|
|
13
13
|
if (!query) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchXml.js","sources":["../../../../src/components/Lookup/hooks/useFetchXml.ts"],"sourcesContent":["import { useRef } from \"react\"\nimport { IEntity } from \"../interfaces\";\nimport { FetchXmlBuilder } from \"@talxis/client-libraries\";\n\nexport const useFetchXml = (context: ComponentFramework.Context<any>): [\n (viewId: string) => Promise<string>,\n (entity: IEntity, fetchXml: string, query: string) => Promise<string>\n] => {\n const cachedFetchXml = useRef<{\n [viewId: string]: Promise<
|
|
1
|
+
{"version":3,"file":"useFetchXml.js","sources":["../../../../src/components/Lookup/hooks/useFetchXml.ts"],"sourcesContent":["import { useRef } from \"react\"\nimport { IEntity } from \"../interfaces\";\nimport { FetchXmlBuilder } from \"@talxis/client-libraries\";\n\nexport const useFetchXml = (context: ComponentFramework.Context<any>): [\n (viewId: string) => Promise<{fetchxml: string, layoutjson: string}>,\n (entity: IEntity, fetchXml: string, query: string) => Promise<string>\n] => {\n const cachedFetchXml = useRef<{\n [viewId: string]: Promise<any>\n }>({});\n\n const get = async (viewId: string): Promise<{fetchxml: string, layoutjson: string}> => {\n if (!cachedFetchXml.current[viewId]) {\n cachedFetchXml.current[viewId] = context.webAPI.retrieveRecord('savedquery', viewId, '?$select=fetchxml,layoutjson');\n }\n\n return cachedFetchXml.current[viewId];\n }\n const applyLookupQuery = async (entity: IEntity, fetchXml: string, query: string): Promise<string> => {\n if (!query) {\n return fetchXml\n }\n const metadata = await entity.metadata;\n const xmlObject = FetchXmlBuilder.fetch.fromXml(fetchXml);\n xmlObject.entity.addFilter(new FetchXmlBuilder.filter(FetchXmlBuilder.FilterType.Or, [\n new FetchXmlBuilder.condition(metadata.PrimaryNameAttribute, FetchXmlBuilder.Operator.Like, [new FetchXmlBuilder.value(`%${query}%`)])\n ]))\n return xmlObject.toXml();\n }\n return [get, applyLookupQuery]\n}"],"names":[],"mappings":";;;AAIa,MAAA,WAAW,GAAG,CAAC,OAAwC,KAGhE;AACA,IAAA,MAAM,cAAc,GAAG,MAAM,CAE1B,EAAE,CAAC,CAAC;AAEP,IAAA,MAAM,GAAG,GAAG,OAAO,MAAc,KAAqD;AAClF,QAAA,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;AACjC,YAAA,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,8BAA8B,CAAC,CAAC;AACxH,SAAA;AAED,QAAA,OAAO,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC1C,KAAC,CAAA;IACD,MAAM,gBAAgB,GAAG,OAAO,MAAe,EAAE,QAAgB,EAAE,KAAa,KAAqB;QACjG,IAAI,CAAC,KAAK,EAAE;AACR,YAAA,OAAO,QAAQ,CAAA;AAClB,SAAA;AACD,QAAA,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC;QACvC,MAAM,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC1D,QAAA,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,eAAe,CAAC,MAAM,CAAC,eAAe,CAAC,UAAU,CAAC,EAAE,EAAE;YACjF,IAAI,eAAe,CAAC,SAAS,CAAC,QAAQ,CAAC,oBAAoB,EAAE,eAAe,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,eAAe,CAAC,KAAK,CAAC,CAAA,CAAA,EAAI,KAAK,CAAA,CAAA,CAAG,CAAC,CAAC,CAAC;AACzI,SAAA,CAAC,CAAC,CAAA;AACH,QAAA,OAAO,SAAS,CAAC,KAAK,EAAE,CAAC;AAC7B,KAAC,CAAA;AACD,IAAA,OAAO,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAA;AAClC;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="powerapps-component-framework" />
|
|
2
2
|
import { ITranslation } from "../../../hooks";
|
|
3
3
|
import { ITheme } from "../../../interfaces/theme";
|
|
4
|
-
import { IEntity, ILookup } from "../interfaces";
|
|
4
|
+
import { IEntity, ILayout, ILookup } from "../interfaces";
|
|
5
5
|
export declare const useLookup: (props: ILookup) => [ComponentFramework.LookupValue[], IEntity[], ITranslation<Partial<import("../../..").ITranslations<{
|
|
6
6
|
search: {
|
|
7
7
|
1033: string;
|
|
@@ -35,4 +35,9 @@ export declare const useLookup: (props: ILookup) => [ComponentFramework.LookupVa
|
|
|
35
35
|
create: (entityName: string) => void;
|
|
36
36
|
select: (record: ComponentFramework.LookupValue[] | undefined) => void;
|
|
37
37
|
deselect: (record: ComponentFramework.LookupValue) => void;
|
|
38
|
-
}, (entityName: string | null) => void, (query: string) => Promise<ComponentFramework.LookupValue
|
|
38
|
+
}, (entityName: string | null) => void, (query: string) => Promise<(ComponentFramework.LookupValue & {
|
|
39
|
+
entityData: {
|
|
40
|
+
[key: string]: any;
|
|
41
|
+
};
|
|
42
|
+
layout: ILayout;
|
|
43
|
+
})[]>, ITheme];
|
|
@@ -33,14 +33,15 @@ const useLookup = (props) => {
|
|
|
33
33
|
value: records
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
|
-
const getSearchFetchXml = async (entityName, query) => {
|
|
36
|
+
const getSearchFetchXml = async (entityName, query, viewIdCallBack) => {
|
|
37
37
|
const response = (await props.parameters.value.getAllViews(entityName)).find(x => x.isDefault);
|
|
38
38
|
if (!response?.viewId) {
|
|
39
39
|
throw new Error(`Entity ${entityName} does not have a default view id!`);
|
|
40
40
|
}
|
|
41
|
+
viewIdCallBack(response.viewId);
|
|
41
42
|
let fetchXml = response?.fetchXml;
|
|
42
43
|
if (!fetchXml) {
|
|
43
|
-
fetchXml = await getFetchXml(response.viewId);
|
|
44
|
+
fetchXml = (await getFetchXml(response.viewId)).fetchxml;
|
|
44
45
|
}
|
|
45
46
|
return applyLookupQuery(entities.find(x => x.entityName === entityName), fetchXml, query);
|
|
46
47
|
};
|
|
@@ -49,12 +50,13 @@ const useLookup = (props) => {
|
|
|
49
50
|
return props.onSearch(selectedEntity ? [selectedEntity?.entityName] : targets, query);
|
|
50
51
|
}
|
|
51
52
|
const fetchXmlMap = new Map();
|
|
53
|
+
const entityViewIdMap = new Map();
|
|
52
54
|
if (selectedEntity) {
|
|
53
|
-
fetchXmlMap.set(selectedEntity.entityName, getSearchFetchXml(selectedEntity.entityName, query));
|
|
55
|
+
fetchXmlMap.set(selectedEntity.entityName, getSearchFetchXml(selectedEntity.entityName, query, (viewId) => entityViewIdMap.set(selectedEntity.entityName, viewId)));
|
|
54
56
|
}
|
|
55
57
|
else {
|
|
56
58
|
for (const entity of targets) {
|
|
57
|
-
fetchXmlMap.set(entity, getSearchFetchXml(entity, query));
|
|
59
|
+
fetchXmlMap.set(entity, getSearchFetchXml(entity, query, (viewId) => entityViewIdMap.set(entity, viewId)));
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
await Promise.all(fetchXmlMap.values());
|
|
@@ -65,12 +67,15 @@ const useLookup = (props) => {
|
|
|
65
67
|
await Promise.all(responsePromiseMap.values());
|
|
66
68
|
const result = [];
|
|
67
69
|
for (const [entityName, response] of responsePromiseMap) {
|
|
70
|
+
const layout = JSON.parse((await getFetchXml(entityViewIdMap.get(entityName))).layoutjson ?? "{}");
|
|
68
71
|
for (const entity of (await response).entities) {
|
|
69
72
|
const entityMetadata = await entities.find(x => x.entityName === entityName).metadata;
|
|
70
73
|
result.push({
|
|
71
74
|
entityType: entityName,
|
|
72
75
|
id: entity[entityMetadata.PrimaryIdAttribute],
|
|
73
|
-
name: entity[entityMetadata.PrimaryNameAttribute]
|
|
76
|
+
name: entity[layout.Rows?.[0]?.Cells?.[0]?.Name] ?? entity[entityMetadata.PrimaryNameAttribute] ?? labels.noName(),
|
|
77
|
+
entityData: entity,
|
|
78
|
+
layout: layout
|
|
74
79
|
});
|
|
75
80
|
}
|
|
76
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLookup.js","sources":["../../../../src/components/Lookup/hooks/useLookup.ts"],"sourcesContent":["import { useState } from \"react\";\nimport { ITranslation, useControl } from \"../../../hooks\";\nimport { ITheme } from \"../../../interfaces/theme\";\nimport { IEntity, ILookup } from \"../interfaces\";\nimport { lookupTranslations } from \"../translations\";\nimport { useFetchXml } from \"./useFetchXml\";\n\nexport const useLookup = (props: ILookup): [\n ComponentFramework.LookupValue[],\n IEntity[],\n ITranslation<Required<ILookup>['translations']>,\n {\n create: (entityName: string) => void,\n select: (record: ComponentFramework.LookupValue[] | undefined) => void,\n deselect: (record: ComponentFramework.LookupValue) => void,\n },\n (entityName: string | null) => void,\n (query: string) => Promise<ComponentFramework.LookupValue[]>,\n ITheme\n] => {\n\n const targets = props.parameters.value.attributes.Targets;\n const boundValue = props.parameters.value.raw;\n const context = props.context;\n const {labels, theme, onNotifyOutputChanged} = useControl('Lookup', props, lookupTranslations);\n const [getFetchXml, applyLookupQuery] = useFetchXml(context);\n \n const [entities, setEntities] = useState<IEntity[]>(() => {\n return targets.map(target => {\n return {\n entityName: target,\n selected: targets.length === 1 ? true : false,\n metadata: props.context.utils.getEntityMetadata(target, []) as any,\n }\n })\n });\n\n const selectedEntity = entities.find(x => x.selected);\n\n const selectEntity = (entityName: string | null) => {\n setEntities([...entities as IEntity[]].map(entity => {\n return {\n entityName: entity.entityName,\n metadata: entity.metadata,\n selected: entity.entityName === entityName\n }\n }))\n }\n\n const selectRecords = (records: ComponentFramework.LookupValue[] | undefined) => {\n onNotifyOutputChanged({\n value: records\n })\n }\n const getSearchFetchXml = async (entityName: string, query: string): Promise<string> => {\n const response = (await props.parameters.value.getAllViews(entityName)).find(x => x.isDefault);\n if (!response?.viewId) {\n throw new Error(`Entity ${entityName} does not have a default view id!`);\n }\n let fetchXml = response?.fetchXml\n if(!fetchXml) {\n fetchXml = await getFetchXml(response.viewId)\n }\n return applyLookupQuery(entities.find(x => x.entityName === entityName)!, fetchXml, query);\n\n }\n const getSearchResults = async (query: string): Promise<ComponentFramework.LookupValue[]> => {\n if(props.onSearch) { \n return props.onSearch(selectedEntity ? [selectedEntity?.entityName] : targets, query);\n }\n const fetchXmlMap = new Map<string, Promise<string>>();\n if(selectedEntity) {\n fetchXmlMap.set(selectedEntity.entityName, getSearchFetchXml(selectedEntity.entityName, query))\n }\n else {\n for (const entity of targets) {\n fetchXmlMap.set(entity, getSearchFetchXml(entity, query))\n }\n }\n await Promise.all(fetchXmlMap.values());\n const responsePromiseMap = new Map<string, Promise<ComponentFramework.WebApi.RetrieveMultipleResponse>>()\n for (const [entityName, fetchXml] of fetchXmlMap) {\n responsePromiseMap.set(entityName, context.webAPI.retrieveMultipleRecords(entityName, `?$top=25&fetchXml=${encodeURIComponent((await fetchXml))}`))\n }\n await Promise.all(responsePromiseMap.values());\n const result: ComponentFramework.LookupValue[] = [];\n for (const [entityName, response] of responsePromiseMap) {\n for (const entity of (await response).entities) {\n const entityMetadata = await entities.find(x => x.entityName === entityName)!.metadata;\n result.push({\n entityType: entityName,\n id: entity[entityMetadata.PrimaryIdAttribute],\n name: entity[entityMetadata.PrimaryNameAttribute]\n });\n }\n }\n return result;\n }\n\n const createRecord = async (entityName: string) => {\n const result = await context.navigation.openForm({\n entityName: entityName,\n useQuickCreateForm: true\n });\n if (!result.savedEntityReference) {\n return;\n }\n onNotifyOutputChanged({\n value: result.savedEntityReference\n })\n }\n\n const deselectRecord = (record: ComponentFramework.LookupValue) => {\n const map = new Map<string, ComponentFramework.LookupValue>(boundValue.map(value => [value.id, value]));\n map.delete(record.id);\n onNotifyOutputChanged({\n value: [...map.values()]\n })\n }\n\n return [\n boundValue, entities, labels, {\n create: createRecord,\n deselect: deselectRecord,\n select: selectRecords\n },\n selectEntity,\n getSearchResults,\n theme\n ];\n};"],"names":[],"mappings":";;;;;AAOa,MAAA,SAAS,GAAG,CAAC,KAAc,KAYpC;IAEA,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC;IAC1D,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC;AAC9C,IAAA,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;AAC9B,IAAA,MAAM,EAAC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I;AAC3B,SAAA,CAAC,CAAC;AACH,QAAA,IAAI,CAAC,MAAM,CAAC,oBAAoB,EAAE;YAC9B,OAAO;AACV,SAAA;AACD,QAAA,qBAAqB,CAAC;YAClB,KAAK,EAAE,MAAM,CAAC,oBAAoB;AACrC,SAAA,CAAC,CAAA;AACN,KAAC,CAAA;AAED,IAAA,MAAM,cAAc,GAAG,CAAC,MAAsC,KAAI;QAC9D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAyC,UAAU,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AACxG,QAAA,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AACtB,QAAA,qBAAqB,CAAC;AAClB,YAAA,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC;AAC3B,SAAA,CAAC,CAAA;AACN,KAAC,CAAA;IAED,OAAO;AACH,QAAA,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE;AAC1B,YAAA,MAAM,EAAE,YAAY;AACpB,YAAA,QAAQ,EAAE,cAAc;AACxB,YAAA,MAAM,EAAE,aAAa;AACxB,SAAA;QACD,YAAY;QACZ,gBAAgB;QAChB,KAAK;KACR,CAAC;AACN;;;;"}
|
|
1
|
+
{"version":3,"file":"useLookup.js","sources":["../../../../src/components/Lookup/hooks/useLookup.ts"],"sourcesContent":["import { useState } from \"react\";\nimport { ITranslation, useControl } from \"../../../hooks\";\nimport { ITheme } from \"../../../interfaces/theme\";\nimport { IEntity, ILayout, ILookup } from \"../interfaces\";\nimport { lookupTranslations } from \"../translations\";\nimport { useFetchXml } from \"./useFetchXml\";\n\nexport const useLookup = (props: ILookup): [\n ComponentFramework.LookupValue[],\n IEntity[],\n ITranslation<Required<ILookup>['translations']>,\n {\n create: (entityName: string) => void,\n select: (record: ComponentFramework.LookupValue[] | undefined) => void,\n deselect: (record: ComponentFramework.LookupValue) => void,\n },\n (entityName: string | null) => void,\n (query: string) => Promise<(ComponentFramework.LookupValue & {entityData: {[key: string]: any}, layout: ILayout})[]>,\n ITheme\n] => {\n\n const targets = props.parameters.value.attributes.Targets;\n const boundValue = props.parameters.value.raw;\n const context = props.context;\n const {labels, theme, onNotifyOutputChanged} = useControl('Lookup', props, lookupTranslations);\n const [getFetchXml, applyLookupQuery] = useFetchXml(context);\n \n const [entities, setEntities] = useState<IEntity[]>(() => {\n return targets.map(target => {\n return {\n entityName: target,\n selected: targets.length === 1 ? true : false,\n metadata: props.context.utils.getEntityMetadata(target, []) as any,\n }\n })\n });\n\n const selectedEntity = entities.find(x => x.selected);\n\n const selectEntity = (entityName: string | null) => {\n setEntities([...entities as IEntity[]].map(entity => {\n return {\n entityName: entity.entityName,\n metadata: entity.metadata,\n selected: entity.entityName === entityName\n }\n }))\n }\n\n const selectRecords = (records: ComponentFramework.LookupValue[] | undefined) => {\n onNotifyOutputChanged({\n value: records\n })\n }\n const getSearchFetchXml = async (entityName: string, query: string, viewIdCallBack: (id: string) => void): Promise<string> => {\n const response = (await props.parameters.value.getAllViews(entityName)).find(x => x.isDefault);\n if (!response?.viewId) {\n throw new Error(`Entity ${entityName} does not have a default view id!`);\n }\n viewIdCallBack(response.viewId);\n let fetchXml = response?.fetchXml\n if(!fetchXml) {\n fetchXml = (await getFetchXml(response.viewId)).fetchxml;\n }\n return applyLookupQuery(entities.find(x => x.entityName === entityName)!, fetchXml, query);\n\n }\n const getSearchResults = async (query: string): Promise<(ComponentFramework.LookupValue & {entityData: {[key: string]: any}, layout: ILayout})[]> => {\n if(props.onSearch) { \n return props.onSearch(selectedEntity ? [selectedEntity?.entityName] : targets, query) as any;\n }\n const fetchXmlMap = new Map<string, Promise<string>>();\n const entityViewIdMap = new Map<string, string>();\n if(selectedEntity) {\n fetchXmlMap.set(selectedEntity.entityName, getSearchFetchXml(selectedEntity.entityName, query, (viewId) => entityViewIdMap.set(selectedEntity.entityName, viewId)))\n }\n else {\n for (const entity of targets) {\n fetchXmlMap.set(entity, getSearchFetchXml(entity, query, (viewId) => entityViewIdMap.set(entity, viewId)))\n }\n }\n await Promise.all(fetchXmlMap.values());\n const responsePromiseMap = new Map<string, Promise<ComponentFramework.WebApi.RetrieveMultipleResponse>>()\n for (const [entityName, fetchXml] of fetchXmlMap) {\n responsePromiseMap.set(entityName, context.webAPI.retrieveMultipleRecords(entityName, `?$top=25&fetchXml=${encodeURIComponent((await fetchXml))}`))\n }\n await Promise.all(responsePromiseMap.values());\n const result: (ComponentFramework.LookupValue & {entityData: {[key: string]: any}, layout: ILayout})[] = [];\n for (const [entityName, response] of responsePromiseMap) {\n const layout: ILayout = JSON.parse((await getFetchXml(entityViewIdMap.get(entityName)!)).layoutjson ?? \"{}\");\n for (const entity of (await response).entities) {\n const entityMetadata = await entities.find(x => x.entityName === entityName)!.metadata;\n result.push({\n entityType: entityName,\n id: entity[entityMetadata.PrimaryIdAttribute],\n name: entity[layout.Rows?.[0]?.Cells?.[0]?.Name] ?? entity[entityMetadata.PrimaryNameAttribute] ?? labels.noName(),\n entityData: entity,\n layout: layout\n });\n }\n }\n return result;\n }\n\n const createRecord = async (entityName: string) => {\n const result = await context.navigation.openForm({\n entityName: entityName,\n useQuickCreateForm: true\n });\n if (!result.savedEntityReference) {\n return;\n }\n onNotifyOutputChanged({\n value: result.savedEntityReference\n })\n }\n\n const deselectRecord = (record: ComponentFramework.LookupValue) => {\n const map = new Map<string, ComponentFramework.LookupValue>(boundValue.map(value => [value.id, value]));\n map.delete(record.id);\n onNotifyOutputChanged({\n value: [...map.values()]\n })\n }\n\n return [\n boundValue, entities, labels, {\n create: createRecord,\n deselect: deselectRecord,\n select: selectRecords\n },\n selectEntity,\n getSearchResults,\n theme\n ];\n};"],"names":[],"mappings":";;;;;AAOa,MAAA,SAAS,GAAG,CAAC,KAAc,KAYpC;IAEA,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC;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C,MAAM,CAAC,EAAE,CAAC,CAAC;AACtB,QAAA,qBAAqB,CAAC;AAClB,YAAA,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC;AAC3B,SAAA,CAAC,CAAA;AACN,KAAC,CAAA;IAED,OAAO;AACH,QAAA,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE;AAC1B,YAAA,MAAM,EAAE,YAAY;AACpB,YAAA,QAAQ,EAAE,cAAc;AACxB,YAAA,MAAM,EAAE,aAAa;AACxB,SAAA;QACD,YAAY;QACZ,gBAAgB;QAChB,KAAK;KACR,CAAC;AACN;;;;"}
|
|
@@ -32,3 +32,36 @@ export interface IEntity {
|
|
|
32
32
|
selected: boolean;
|
|
33
33
|
metadata: Promise<IMetadata>;
|
|
34
34
|
}
|
|
35
|
+
export interface ILayout {
|
|
36
|
+
Name: string;
|
|
37
|
+
Object: number;
|
|
38
|
+
Rows: IRow[];
|
|
39
|
+
CustomControlDescriptions: any[];
|
|
40
|
+
Jump: string;
|
|
41
|
+
Select: boolean;
|
|
42
|
+
Icon: boolean;
|
|
43
|
+
Preview: boolean;
|
|
44
|
+
IconRenderer: string;
|
|
45
|
+
}
|
|
46
|
+
interface IRow {
|
|
47
|
+
Name: string;
|
|
48
|
+
Id: string;
|
|
49
|
+
Cells: ICell[];
|
|
50
|
+
MultiObjectIdField: string;
|
|
51
|
+
LayoutStyle: string;
|
|
52
|
+
}
|
|
53
|
+
interface ICell {
|
|
54
|
+
Name: string;
|
|
55
|
+
Width: number;
|
|
56
|
+
RelatedEntityName: string;
|
|
57
|
+
IsHidden: boolean;
|
|
58
|
+
ImageProviderWebresource: string;
|
|
59
|
+
ImageProviderFunctionName: string;
|
|
60
|
+
DisableSorting?: boolean;
|
|
61
|
+
AddedBy?: string;
|
|
62
|
+
Desc?: string;
|
|
63
|
+
CellType?: string;
|
|
64
|
+
DisableMetaDataBinding?: boolean;
|
|
65
|
+
LabelId?: string;
|
|
66
|
+
}
|
|
67
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -733,6 +733,38 @@ interface IEntity {
|
|
|
733
733
|
selected: boolean;
|
|
734
734
|
metadata: Promise<IMetadata>;
|
|
735
735
|
}
|
|
736
|
+
interface ILayout {
|
|
737
|
+
Name: string;
|
|
738
|
+
Object: number;
|
|
739
|
+
Rows: IRow[];
|
|
740
|
+
CustomControlDescriptions: any[];
|
|
741
|
+
Jump: string;
|
|
742
|
+
Select: boolean;
|
|
743
|
+
Icon: boolean;
|
|
744
|
+
Preview: boolean;
|
|
745
|
+
IconRenderer: string;
|
|
746
|
+
}
|
|
747
|
+
interface IRow {
|
|
748
|
+
Name: string;
|
|
749
|
+
Id: string;
|
|
750
|
+
Cells: ICell[];
|
|
751
|
+
MultiObjectIdField: string;
|
|
752
|
+
LayoutStyle: string;
|
|
753
|
+
}
|
|
754
|
+
interface ICell {
|
|
755
|
+
Name: string;
|
|
756
|
+
Width: number;
|
|
757
|
+
RelatedEntityName: string;
|
|
758
|
+
IsHidden: boolean;
|
|
759
|
+
ImageProviderWebresource: string;
|
|
760
|
+
ImageProviderFunctionName: string;
|
|
761
|
+
DisableSorting?: boolean;
|
|
762
|
+
AddedBy?: string;
|
|
763
|
+
Desc?: string;
|
|
764
|
+
CellType?: string;
|
|
765
|
+
DisableMetaDataBinding?: boolean;
|
|
766
|
+
LabelId?: string;
|
|
767
|
+
}
|
|
736
768
|
|
|
737
769
|
declare const Lookup: (props: ILookup) => JSX.Element;
|
|
738
770
|
|
|
@@ -769,7 +801,12 @@ declare const useLookup: (props: ILookup) => [ComponentFramework.LookupValue[],
|
|
|
769
801
|
create: (entityName: string) => void;
|
|
770
802
|
select: (record: ComponentFramework.LookupValue[] | undefined) => void;
|
|
771
803
|
deselect: (record: ComponentFramework.LookupValue) => void;
|
|
772
|
-
}, (entityName: string | null) => void, (query: string) => Promise<ComponentFramework.LookupValue
|
|
804
|
+
}, (entityName: string | null) => void, (query: string) => Promise<(ComponentFramework.LookupValue & {
|
|
805
|
+
entityData: {
|
|
806
|
+
[key: string]: any;
|
|
807
|
+
};
|
|
808
|
+
layout: ILayout;
|
|
809
|
+
})[]>, ITheme];
|
|
773
810
|
|
|
774
811
|
interface IMultiSelectOptionSet extends IControl<IMultiSelectOptionSetParameters, IMultiSelectOptionSetOutputs, any, IComboBoxProps> {
|
|
775
812
|
}
|
|
@@ -824,4 +861,4 @@ declare class Numeral {
|
|
|
824
861
|
private static get _locales();
|
|
825
862
|
}
|
|
826
863
|
|
|
827
|
-
export { DateTime, Decimal, Duration, Grid, IControl, IControlController, IDatasetProperty, IDateTime, IDateTimeOutputs, IDateTimeParameters, IDateTimeProperty, IDecimal, IDecimalNumberProperty, IDecimalOutputs, IDecimalParameters, IDefaultTranslations, IDuration, IDurationOutputs, IDurationParameters, IEntity, IEntityColumn, IEntityRecord, IGrid, IGridOutputs, IGridParameters, ILookup, ILookupOutputs, ILookupParameters, ILookupProperty, IMetadata, IMultiSelectOptionSet, IMultiSelectOptionSetOutputs, IMultiSelectOptionSetParameters, IMultiSelectOptionSetProperty, IOptionSet, IOptionSetOutputs, IOptionSetParameters, IOptionSetProperty, IOutputs, IParameters$1 as IParameters, IProperty, IStringProperty, ITextField, ITextFieldOutputs, ITextFieldParameters, ITranslation, ITranslations, ITwoOptions, ITwoOptionsOutputs, ITwoOptionsParameters, ITwoOptionsProperty, IWholeNumberProperty, Lookup, MultiSelectOptionSet, Numeral, OptionSet, TextField, TwoOptions, useControl, useControlSizing, useControlTheme, useDateTime, useFocusIn, useInputBasedControl, useLookup, useMouseOver };
|
|
864
|
+
export { DateTime, Decimal, Duration, Grid, IControl, IControlController, IDatasetProperty, IDateTime, IDateTimeOutputs, IDateTimeParameters, IDateTimeProperty, IDecimal, IDecimalNumberProperty, IDecimalOutputs, IDecimalParameters, IDefaultTranslations, IDuration, IDurationOutputs, IDurationParameters, IEntity, IEntityColumn, IEntityRecord, IGrid, IGridOutputs, IGridParameters, ILayout, ILookup, ILookupOutputs, ILookupParameters, ILookupProperty, IMetadata, IMultiSelectOptionSet, IMultiSelectOptionSetOutputs, IMultiSelectOptionSetParameters, IMultiSelectOptionSetProperty, IOptionSet, IOptionSetOutputs, IOptionSetParameters, IOptionSetProperty, IOutputs, IParameters$1 as IParameters, IProperty, IStringProperty, ITextField, ITextFieldOutputs, ITextFieldParameters, ITranslation, ITranslations, ITwoOptions, ITwoOptionsOutputs, ITwoOptionsParameters, ITwoOptionsProperty, IWholeNumberProperty, Lookup, MultiSelectOptionSet, Numeral, OptionSet, TextField, TwoOptions, useControl, useControlSizing, useControlTheme, useDateTime, useFocusIn, useInputBasedControl, useLookup, useMouseOver };
|
package/package.json
CHANGED