= {
+ root: {
+ fontSize: "14px",
+ paddingLeft: (footerProps.groupLevel + 1) * 20 + 62,
+ },
+ };
return (
- {
- setGroupsLoading((prevGroupsLoading) => [...prevGroupsLoading, footerProps.group.key]);
- props.onLoadMoreData(Guid.parse(props.termSetInfo.id), footerProps.group.key === props.termSetInfo.id ? Guid.empty : Guid.parse(footerProps.group.key), footerProps.group.data.skiptoken, props.hideDeprecatedTerms)
- .then((loadedTerms) => {
- const grps: IGroup[] = loadedTerms.value.map(term => {
- let termNames = term.labels.filter((termLabel) => (termLabel.languageTag === props.languageTag && termLabel.isDefault === true));
- if (termNames.length === 0) {
- termNames = term.labels.filter((termLabel) => (termLabel.languageTag === props.termStoreInfo.defaultLanguageTag && termLabel.isDefault === true));
- }
- const g: IGroup = {
- name: termNames[0]?.name,
- key: term.id,
- startIndex: -1,
- count: 50,
- level: footerProps.group.level + 1,
- isCollapsed: true,
- data: { skiptoken: '', term: term },
- hasMoreData: term.childrenCount > 0,
- };
- if (g.hasMoreData) {
- g.children = [];
- }
- return g;
- });
- props.setTerms((prevTerms) => {
- const nonExistingTerms = loadedTerms.value.filter((newTerm) => prevTerms.every((prevTerm) => prevTerm.id !== newTerm.id));
- return [...prevTerms, ...nonExistingTerms];
+ {
+ setGroupsLoading((prevGroupsLoading) => [
+ ...prevGroupsLoading,
+ footerProps.group.key,
+ ]);
+ props
+ .onLoadMoreData(
+ Guid.parse(props.termSetInfo.id),
+ footerProps.group.key === props.termSetInfo.id
+ ? Guid.empty
+ : Guid.parse(footerProps.group.key),
+ footerProps.group.data.skiptoken,
+ props.hideDeprecatedTerms
+ )
+ .then((loadedTerms) => {
+ const grps: IGroup[] = loadedTerms.value.map((term) => {
+ let termNames = term.labels.filter(
+ (termLabel) =>
+ termLabel.languageTag === props.languageTag &&
+ termLabel.isDefault === true
+ );
+ if (termNames.length === 0) {
+ termNames = term.labels.filter(
+ (termLabel) =>
+ termLabel.languageTag ===
+ props.termStoreInfo.defaultLanguageTag &&
+ termLabel.isDefault === true
+ );
+ }
+ const g: IGroup = {
+ name: termNames[0]?.name,
+ key: term.id,
+ startIndex: -1,
+ count: 50,
+ level: footerProps.group.level + 1,
+ isCollapsed: true,
+ data: { skiptoken: "", term: term },
+ hasMoreData: term.childrenCount > 0,
+ };
+ if (g.hasMoreData) {
+ g.children = [];
+ }
+ return g;
+ });
+ props.setTerms((prevTerms) => {
+ const nonExistingTerms = loadedTerms.value.filter(
+ (newTerm) =>
+ prevTerms.every(
+ (prevTerm) => prevTerm.id !== newTerm.id
+ )
+ );
+ return [...prevTerms, ...nonExistingTerms];
+ });
+ const nonExistingChildren = grps.filter((grp) =>
+ footerProps.group.children?.every(
+ (child) => child.key !== grp.key
+ )
+ );
+ footerProps.group.children = [
+ ...footerProps.group.children,
+ ...nonExistingChildren,
+ ];
+ footerProps.group.data.skiptoken = loadedTerms.skiptoken;
+ footerProps.group.hasMoreData = loadedTerms.skiptoken !== "";
+ setGroupsLoading((prevGroupsLoading) =>
+ prevGroupsLoading.filter(
+ (value) => value !== footerProps.group.key
+ )
+ );
+ })
+ .catch(() => {
+ // no-op;
});
- const nonExistingChildren = grps.filter((grp) => footerProps.group.children?.every((child) => child.key !== grp.key));
- footerProps.group.children = [...footerProps.group.children, ...nonExistingChildren];
- footerProps.group.data.skiptoken = loadedTerms.skiptoken;
- footerProps.group.hasMoreData = loadedTerms.skiptoken !== '';
- setGroupsLoading((prevGroupsLoading) => prevGroupsLoading.filter((value) => value !== footerProps.group.key));
- })
- .catch(() => {
- // no-op;
- });
- }}
- styles={linkStyles}>
+ }}
+ styles={linkStyles}
+ >
{strings.ModernTaxonomyPickerLoadMoreText}
@@ -575,7 +877,9 @@ export function TaxonomyTree(props: ITaxonomyTreeProps): React.ReactElement): boolean => {
+ const shouldEnterInnerZone = (
+ ev: React.KeyboardEvent
+ ): boolean => {
return ev.which === getRTLSafeKeyCode(KeyCodes.right);
};
@@ -588,7 +892,10 @@ export function TaxonomyTree(props: ITaxonomyTreeProps): React.ReactElement) => false} // eslint-disable-line @typescript-eslint/no-explicit-any
data-is-focusable={true}
- focusZoneProps={{direction: FocusZoneDirection.vertical, shouldEnterInnerZone: shouldEnterInnerZone}}
+ focusZoneProps={{
+ direction: FocusZoneDirection.vertical,
+ shouldEnterInnerZone: shouldEnterInnerZone,
+ }}
/>