@mikezimm/npmfunctions
Version:
Functions used in my SPFx webparts
203 lines (199 loc) • 8.28 kB
TypeScript
/***
* .o88b. .d8b. d8888b. d8888b. .d88b. d888888b
* d8P Y8 d8' `8b 88 `8D 88 `8D .8P Y8. `~~88~~'
* 8P 88ooo88 88oobY' 88oobY' 88 88 88
* 8b 88~~~88 88`8b 88`8b 88 88 88
* Y8b d8 88 88 88 `88. 88 `88. `8b d8' 88
* `Y88P' YP YP 88 YD 88 YD `Y88P' YP
*
*
import { IFoamTree } from '@mikezimm/npmfunctions/dist/Carrot/IFoamTree';
*/
/**
* Some tricks:
* Disappear in animated fashion: Set dataObject = null and provide pullbackDuration
*/
export declare type IFoamTreeLayout = 'relaxed' | 'ordered' | 'squarified';
export declare type IFoamTreeFillType = 'none' | 'plain' | 'gradient';
export declare type IFoamTreeStacking = 'hierarchical' | 'flattened';
export declare const FoamTreeLayouts: IFoamTreeLayout[];
export declare const FoamTreeFillType: IFoamTreeFillType[];
export declare const FoamTreeStacking: IFoamTreeStacking[];
export declare type IDescriptionGroup = 'auto' | 'always';
export declare type IDescriptionGroupType = 'stab' | 'floating';
export declare const DescriptionGroupType: IDescriptionGroupType[];
export declare type IRelaxationInitializer = 'fisheye' | 'blackhole' | 'ordered' | 'squarified' | 'random';
export declare type IGroupGrowingEasing = 'linear' | 'bounce' | 'squareIn' | 'squareOut' | 'squareInOut' | 'cubicIn' | 'cubicOut' | 'cubicInOut' | 'quadIn' | 'quadOut' | 'quadInOut';
export declare type IRolloutStartPoint = 'center' | 'topleft' | 'bottomright' | 'random';
export declare type IRolloutMethod = 'groups' | 'individual';
export declare const RolloutStartPoint: IRolloutStartPoint[];
export declare const RolloutMethod: IRolloutMethod[];
export interface IFoamTree {
id?: string;
dataObject: IFoamTreeDataObject;
layout: IFoamTreeLayout;
logging?: boolean;
stacking?: IFoamTreeStacking;
layoutByWeightOrder?: boolean;
relaxationVisible?: boolean;
relaxationQualityThreshold?: number;
relaxationMaxDuration?: number;
relaxationInitializer?: IRelaxationInitializer;
groupFillType?: IFoamTreeFillType;
maxGroupLevelsDrawn?: number;
maxGroupLabelLevelsDrawn?: number;
descriptionGroup?: IDescriptionGroup;
descriptionGroupType?: IDescriptionGroupType;
descriptionGroupSize?: number;
groupLabelLineHeight?: number;
attributionPosition?: number;
descriptionGroupMinHeight?: number;
descriptionGroupMaxHeight?: number;
descriptionGroupPosition?: number;
descriptionGroupDistanceFromCenter?: 0 | 1;
showZeroWeightGroups?: boolean;
descriptionGroupPolygonDrawn?: boolean;
groupMinDiameter?: number;
maxGroups?: number;
groupGrowingDuration?: number;
groupGrowingEasing?: IGroupGrowingEasing;
groupGrowingDrag?: number;
groupResizingBudget?: number;
groupBorderRadius?: number;
groupBorderWidth?: number;
groupBorderWidthScaling?: number;
groupInsetWidth?: number;
groupBorderRadiusCorrection?: number;
groupFillGradientRadius?: number;
groupFillGradientCenterHueShift?: number;
groupFillGradientCenterSaturationShift?: number;
groupFillGradientCenterLightnessShift?: number;
groupFillGradientRimHueShift?: number;
groupFillGradientRimSaturationShift?: number;
groupFillGradientRimLightnessShift?: number;
groupStrokeType?: IFoamTreeFillType;
groupStrokeWidth?: number;
groupStrokePlainHueShift?: number;
groupStrokePlainSaturationShift?: number;
/**
* Skipped a bunch here
*/
groupSelectionOutlineColor?: string;
groupSelectionOutlineWidth?: number;
groupSelectionOutlineShadowSize?: number;
groupSelectionOutlineShadowColor?: string;
/**
* Skipped a bunch here
*/
groupHoverFillHueShift?: number;
groupHoverFillSaturationShift?: number;
groupHoverFillLightnessShift?: number;
groupHoverStrokeHueShift?: number;
groupHoverStrokeSaturationShift?: number;
groupHoverStrokeLightnessShift?: number;
groupLabelFontFamily?: string;
groupLabelFontStyle?: string;
groupLabelFontWeight?: string;
groupLabelFontVariant?: string;
groupLabelMinFontSize?: number;
openCloseDuration?: number;
rainbowStartColor?: string;
rainbowEndColor?: string;
rainbowColorDistribution?: string;
/**
* Skipped a bunch here
*/
rolloutStartPoint?: IRolloutStartPoint;
rolloutMethod?: IRolloutMethod;
rolloutDuration?: number;
rolloutEasing?: IGroupGrowingEasing;
rolloutScalingStrength?: number;
rolloutTranslationXStrength?: number;
rolloutTranslationYStrength?: number;
rolloutRotationStrength?: number;
rolloutTransformationCenter?: number;
rolloutPolygonDrag?: number;
rolloutPolygonDuration?: number;
rolloutLabelDelay?: number;
rolloutLabelDrag?: number;
rolloutLabelDuration?: number;
rolloutChildGroupsDelay?: number;
rolloutChildGroupsDrag?: number;
pullbackStartPoint?: IRolloutStartPoint;
pullbackMethod?: IRolloutMethod;
pullbackDuration?: number;
pullbackEasing?: IGroupGrowingEasing;
pullbackScalingStrength?: number;
pullbackTranslationXStrength?: number;
pullbackTranslationYStrength?: number;
pullbackRotationStrength?: number;
pullbackTransformationCenter?: number;
pullbackPolygonDrag?: number;
pullbackPolygonDuration?: number;
pullbackLabelDelay?: number;
pullbackLabelDrag?: number;
pullbackLabelDuration?: number;
pullbackChildGroupsDelay?: number;
pullbackChildGroupsDrag?: number;
fadeDuration?: number;
fadeEasing?: IGroupGrowingEasing;
zoomMouseWheelFactor?: number;
zoomMouseWheelDuration?: number;
zoomMouseWheelEasing?: IGroupGrowingEasing;
titleBarFontFamily?: string;
titleBarFontStyle?: string;
titleBarFontWeight?: string;
titleBarFontVariant?: string;
titleBarMinFontSize?: number;
titleBarMaxFontSize?: number;
titleBarBackgroundColor?: string;
titleBarTextColor?: string;
titleBarTextPaddingLeftRight?: number;
titleBarTextPaddingTopBottom?: number;
titleBarDecorator?: any;
}
export interface IFoamTreeGroup {
label: string;
weight: number;
count?: number;
sum?: number;
avg?: number;
min?: number;
max?: number;
trigger?: boolean;
open?: boolean;
selected?: boolean;
color?: string;
groups?: IFoamTreeGroup[];
}
export interface IFoamTreeDataObject {
id?: string;
label?: string;
/**
* weight:
* (optional, Number >= 0) weight of the group relative to other groups. The larger the weight, the more space the group's polygon will occupy on the screen.
* Good values for the weight property could be e.g. the number of documents in a cluster or the score of the cluster.
* Group weights must be non-negative. Zero-weight groups can receive special treatment, see the showZeroWeightGroups option
* If a group's weight is not specified, FoamTree will assume the weight is 1.0.
*/
weight?: number;
groups: IFoamTreeGroup[];
open?: boolean;
/**
* exposed:
* (optional, boolean) if true, the group will get exposed right after the new data is set. This can be useful to visually highlight a certain group (or groups) as the data is loaded. Please note the limitations when relaxation is visible.
*/
exposed?: boolean;
selected?: boolean;
/**
* description:
* Since 3.4.9 (optional, boolean) If true, descriptionGroup option is set to always and stacking is hierarchical, allocates extra space inside this group to show the group's label together with the group's child groups.
*/
description?: boolean;
/**
* initialPosition:
* Since 3.4.10 (optional, object) Determines the initial position of this group. The object must contain two properties: position and distanceFromCenter.
* Please see the attributionPosition and attributionDistanceFromCenter options for semantics of the properties and the Initial positions demo for a complete code example.
*/
initialPosition?: any;
}