Skip to content

Commit

Permalink
avoid interface only files to not confuse webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
sgratzl committed Dec 24, 2018
1 parent 58ab747 commit e71c608
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 37 deletions.
3 changes: 3 additions & 0 deletions src/builder/DataBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import ColumnBuilder from './column/ColumnBuilder';
import LineUpBuilder from './LineUpBuilder';
import RankingBuilder from './RankingBuilder';

export * from './column';
export * from './RankingBuilder';

/**
* builder for a LocalDataProvider along with LineUp configuration options
*/
Expand Down
2 changes: 0 additions & 2 deletions src/builder/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
export * from './DataBuilder';
export * from './column';
export * from './RankingBuilder';
export * from './adapter';
9 changes: 9 additions & 0 deletions src/internal/mathInterfaces.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import * as equalImpl from 'fast-deep-equal';

// keep here to have a "real" export for webpack not just interfaces

/**
* deep equal comparison
*/
export const equal: (a: any, b: any) => boolean = (typeof equalImpl === 'function' ? equalImpl : (<any>equalImpl).default);


export interface INumberBin {
/**
Expand Down
6 changes: 0 additions & 6 deletions src/internal/utils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import * as equalImpl from 'fast-deep-equal';

/**
* deep equal comparison
*/
export const equal: (a: any, b: any) => boolean = (typeof equalImpl === 'function' ? equalImpl : (<any>equalImpl).default);

/** @internal */
export function equalArrays<T>(a: T[], b: T[]) {
Expand Down
4 changes: 2 additions & 2 deletions src/ui/EngineRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {cssClass} from '../styles';
import DialogManager from './dialogs/DialogManager';
import domElementCache from './domElementCache';
import EngineRanking, {IEngineRankingContext} from './EngineRanking';
import {IRankingHeaderContext, IRankingHeaderContextContainer} from './interfaces';
import SlopeGraph, {EMode} from './SlopeGraph';
import {IRankingHeaderContext, IRankingHeaderContextContainer, EMode} from './interfaces';
import SlopeGraph from './SlopeGraph';

/**
* emitted when the highlight changes
Expand Down
7 changes: 1 addition & 6 deletions src/ui/SlopeGraph.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {IExceptionContext, ITableSection, range} from 'lineupengine';
import {IGroupData, IGroupItem, IOrderedGroup, isGroup} from '../model';
import {aria, cssClass, engineCssClass, SLOPEGRAPH_WIDTH} from '../styles';
import {IRankingHeaderContextContainer} from './interfaces';
import {IRankingHeaderContextContainer, EMode} from './interfaces';
import {forEachIndices, filterIndices} from '../model/internal';

interface ISlope {
Expand Down Expand Up @@ -52,11 +52,6 @@ interface IPos {
group: IOrderedGroup;
}

export enum EMode {
ITEM = 'item',
BAND = 'band'
}

export interface ISlopeGraphOptions {
mode: EMode;
}
Expand Down
5 changes: 3 additions & 2 deletions src/ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ export {default as EngineRanking} from './EngineRanking';
export * from './EngineRanking';
export {default as EngineRenderer} from './EngineRenderer';
export * from './interfaces';
export {default as LineUp, default, ILineUpOptions} from './LineUp';
export {default as LineUp} from './LineUp';
export * from './LineUp';
export * from './panel';
export {default as SlopeGraph, EMode} from './SlopeGraph';
export {default as SlopeGraph} from './SlopeGraph';
export * from './taggle';

4 changes: 4 additions & 0 deletions src/ui/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,7 @@ export declare type IRankingHeaderContext = Readonly<IRankingHeaderContextContai

export declare type IRankingContext = Readonly<IRankingBodyContext>;

export enum EMode {
ITEM = 'item',
BAND = 'band'
}
2 changes: 1 addition & 1 deletion src/ui/taggle/Taggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {DataProvider} from '../../provider';
import {cssClass, engineCssClass} from '../../styles';
import {ALineUp} from '../ALineUp';
import SidePanel from '../panel/SidePanel';
import spaceFillingRule from './spaceFillingRule';
import {spaceFillingRule} from './rules';
import TaggleRenderer from './TaggleRenderer';

export {ITaggleOptions} from '../../interfaces';
Expand Down
2 changes: 1 addition & 1 deletion src/ui/taggle/TaggleRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {IRenderContext} from '../../renderer';
import {IEngineRankingContext} from '../EngineRanking';
import EngineRenderer from '../EngineRenderer';
import {IRankingHeaderContext, IRankingHeaderContextContainer} from '../interfaces';
import {IRule} from './interfaces';
import {IRule} from './rules';

/**
* emitted when the highlight changes
Expand Down
3 changes: 1 addition & 2 deletions src/ui/taggle/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from './interfaces';
export {default as spaceFillingRule} from './spaceFillingRule';
export * from './rules';
export {default, default as Taggle} from './Taggle';
export * from './Taggle';
export {default as TaggleRenderer} from './TaggleRenderer';
Expand Down
13 changes: 0 additions & 13 deletions src/ui/taggle/interfaces.ts

This file was deleted.

16 changes: 14 additions & 2 deletions src/ui/taggle/spaceFillingRule.ts → src/ui/taggle/rules.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
import {IGroupData, IGroupItem, isGroup} from '../../model';
import {IRule} from './interfaces';

export default function spaceFillingRule(config: {groupHeight: number, rowHeight: number, groupPadding: number}) {
export interface IRule {
apply(data: (IGroupData | IGroupItem)[], availableHeight: number, selection: Set<number>): IRuleInstance;

levelOfDetail(item: IGroupData | IGroupItem, height: number): 'high' | 'low';
}

export interface IRuleInstance {
item: number | ((item: IGroupItem) => number);
group: number | ((group: IGroupData) => number);
violation?: string;
}


export function spaceFillingRule(config: {groupHeight: number, rowHeight: number, groupPadding: number}) {
function levelOfDetail(item: IGroupData | IGroupItem, height: number): 'high' | 'low' {
const group = isGroup(item);
const maxHeight = group ? config.groupHeight : config.rowHeight;
Expand Down

0 comments on commit e71c608

Please sign in to comment.