Updated AdminLTE to 3.04 assets, added search to side bar, added company select drop down on sidebar. removed extra delete under edit contact

This commit is contained in:
johnny@pittpc.com
2020-04-04 20:23:44 -04:00
parent abf7a3b381
commit 7a0ef334a3
1519 changed files with 286395 additions and 36690 deletions

15
plugins/filterizr/ActiveFilter.d.ts vendored Normal file
View File

@@ -0,0 +1,15 @@
import { Filter } from './types';
/**
* ActiveFilter represents the currently active filter over
* the grid.
*
* It can be a plain string value or an array of strings.
*/
export default class ActiveFilter {
private filter;
constructor(filter: Filter);
get(): Filter;
set(targetFilter: Filter): void;
toggle(targetFilter: string): void;
private toggleFilter;
}

16
plugins/filterizr/BrowserWindow.d.ts vendored Normal file
View File

@@ -0,0 +1,16 @@
/**
* A wrapper class around the window object to manage the
* resize event.
*
* When the user resizes the window, Filterizr needs to trigger
* a refiltering of the grid so that the grid items can assume
* their new positions.
*/
export default class BrowserWindow {
private resizeHandler?;
constructor();
private debounceEventHandler;
destroy(): void;
setResizeEventHandler(resizeHandler: EventListener): void;
private removeResizeHandler;
}

12
plugins/filterizr/EventReceiver.d.ts vendored Normal file
View File

@@ -0,0 +1,12 @@
import { Destructible } from './types/interfaces';
declare type Receiver = NodeListOf<Element> | Element | Window;
export default class EventReceiver implements Destructible {
private receiver;
private eventDictionary;
constructor(receiver: Receiver);
on(eventType: string, eventHandler: EventListener): void;
off(eventType: string): void;
destroy(): void;
private removeAllEvents;
}
export {};

36
plugins/filterizr/FilterContainer.d.ts vendored Normal file
View File

@@ -0,0 +1,36 @@
import { RawOptionsCallbacks } from './FilterizrOptions/defaultOptions';
import FilterizrOptions from './FilterizrOptions/FilterizrOptions';
import FilterItems from './FilterItems';
/**
* Resembles the grid of items within Filterizr.
*/
export default class FilterContainer {
node: Element;
options: FilterizrOptions;
filterItems: FilterItems;
dimensions: {
width: number;
height: number;
};
private onTransitionEndHandler?;
constructor(node: Element, options: FilterizrOptions);
destroy(): void;
/**
* Turn the HTML elements in the grid to FilterItem
* instances and return a collection of them.
*/
makeFilterItems(options: FilterizrOptions): FilterItems;
/**
* Inserts a new item into the grid.
* @param node - HTML node to instantiate as FilterItem and append to the grid
* @param options - Filterizr options
*/
insertItem(node: Element, options: FilterizrOptions): void;
calculateColumns(): number;
updateDimensions(): void;
updateHeight(newHeight: number): void;
bindEvents(callbacks: RawOptionsCallbacks): void;
unbindEvents(callbacks: RawOptionsCallbacks): void;
trigger(eventType: string): void;
private updateWidth;
}

View File

@@ -0,0 +1,28 @@
import { FilterizrState } from '../types';
import FilterizrOptions from '../FilterizrOptions';
import FilterItems from '../FilterItems';
import FilterizrElement from '../FilterizrElement';
import StyledFilterContainer from './StyledFilterContainer';
/**
* Resembles the grid of items within Filterizr.
*/
export default class FilterContainer extends FilterizrElement {
filterItems: FilterItems;
protected styledNode: StyledFilterContainer;
private _filterizrState;
constructor(node: Element, options: FilterizrOptions);
readonly styles: StyledFilterContainer;
filterizrState: FilterizrState;
destroy(): void;
/**
* Turn the HTML elements in the grid to FilterItem
* instances and return a collection of them.
* @throws when no filter items are found in the grid.
*/
makeFilterItems(options: FilterizrOptions): FilterItems;
insertItem(node: HTMLElement): void;
removeItem(node: HTMLElement): void;
setHeight(newHeight: number): void;
bindEvents(): void;
unbindEvents(): void;
}

View File

@@ -0,0 +1,6 @@
import StyledFilterizrElement from '../StyledFilterizrElement';
export default class StyledFilterContainer extends StyledFilterizrElement {
initialize(): void;
updatePaddings(): void;
setHeight(newHeight: number): void;
}

View File

@@ -0,0 +1 @@
export { default } from './FilterContainer';

View File

@@ -0,0 +1,4 @@
import FilterizrOptions from '../FilterizrOptions';
export declare const makePaddingStyles: (options: FilterizrOptions) => object;
export declare const makeInitialStyles: (options: FilterizrOptions) => object;
export declare const makeHeightStyles: (height: number) => object;

19
plugins/filterizr/FilterControls.d.ts vendored Normal file
View File

@@ -0,0 +1,19 @@
import Filterizr from './Filterizr';
import { Destructible } from './types/interfaces';
export default class FilterControls implements Destructible {
private filterControls;
private filterizr;
private multiFilterControls;
private searchControls;
private selector;
private shuffleControls;
private sortAscControls;
private sortDescControls;
/**
* @param filterizr keep a ref to the Filterizr object to control actions
* @param selector selector of controls in case of multiple Filterizr instances
*/
constructor(filterizr: Filterizr, selector?: string);
destroy(): void;
private initialize;
}

98
plugins/filterizr/FilterItem.d.ts vendored Normal file
View File

@@ -0,0 +1,98 @@
import { Dictionary } from './types/interfaces/Dictionary';
import FilterizrOptions from './FilterizrOptions/FilterizrOptions';
export interface Position {
left: number;
top: number;
}
/**
* Resembles an item in the grid of Filterizr.
*/
export default class FilterItem {
node: Element;
options: FilterizrOptions;
dimensions: {
width: number;
height: number;
};
private data;
private sortData;
private index;
private filteredOut;
private lastPosition;
private onTransitionEndHandler;
constructor(node: Element, index: number, options: FilterizrOptions);
/**
* Destroys the FilterItem instance
*/
destroy(): void;
/**
* Filters in a specific FilterItem out of the grid.
* @param targetPosition the position towards which the element should animate
* @param cssOptions for the animation
*/
filterIn(targetPosition: Position, cssOptions: Dictionary): void;
/**
* Filters out a specific FilterItem out of the grid.
* @param cssOptions for the animation
*/
filterOut(cssOptions: Dictionary): void;
/**
* Helper method to calculate the animation delay for a given grid item
* @param delay in ms
* @param delayMode can be 'alternate' or 'progressive'
*/
getTransitionDelay(delay: number, delayMode: 'progressive' | 'alternate'): number;
/**
* Returns true if the text contents of the FilterItem match the search term
* @param searchTerm to look up
* @return if the innerText matches the term
*/
contentsMatchSearch(searchTerm: string): boolean;
/**
* Recalculates the dimensions of the element and updates them in the state
*/
updateDimensions(): void;
/**
* Returns all categories of the grid items data-category attribute
* with a regexp regarding all whitespace.
* @return {String[]} an array of the categories the item belongs to
*/
getCategories(): string[];
/**
* Returns the value of the sort attribute
* @param sortAttribute "index", "sortData" or custom user data-attribute by which to sort
*/
getSortAttribute(sortAttribute: string): string | number;
/**
* Helper method for the search method of Filterizr
* @return {String} innerText of the FilterItem in lowercase
*/
private getContentsLowercase;
/**
* Sets up the events related to the FilterItem instance
*/
private bindEvents;
/**
* Removes all events related to the FilterItem instance
*/
private unbindEvents;
/**
* Calculates and returns the transition css property based on options.
*/
private getTransitionStyle;
/**
* Sets the transition css property as an inline style on the FilterItem.
*
* The idea here is that during the very first render items should assume
* their positions directly.
*
* Following renders should actually trigger the transitions, which is why
* we need to delay setting the transition property.
*
* Unfortunately, JavaScript code executes on the same thread as the
* browser's rendering. Everything that needs to be drawn waits for
* JavaScript execution to complete. Thus, we need to use a setTimeout
* here to defer setting the transition style at the first rendering cycle.
*/
private setTransitionStyle;
}

View File

@@ -0,0 +1,44 @@
import { Position } from '../types/interfaces';
import FilterizrOptions from '../FilterizrOptions';
import FilterizrElement from '../FilterizrElement';
import StyledFilterItem from './StyledFilterItem';
/**
* Resembles an item in the grid of Filterizr.
*/
export default class FilterItem extends FilterizrElement {
protected styledNode: StyledFilterItem;
private filteredOut;
private lastPosition;
private sortData;
constructor(node: Element, index: number, options: FilterizrOptions);
readonly styles: StyledFilterItem;
/**
* Destroys the FilterItem instance
*/
destroy(): void;
/**
* Filters in a specific FilterItem out of the grid.
*/
filterIn(targetPosition: Position): void;
/**
* Filters out a specific FilterItem out of the grid.
*/
filterOut(): void;
/**
* Returns true if the text contents of the FilterItem match the search term
* @param searchTerm to look up
*/
contentsMatchSearch(searchTerm: string): boolean;
/**
* Returns all categories of the grid items data-category attribute
* with a regexp regarding all whitespace.
*/
getCategories(): string[];
/**
* Returns the value of the sort attribute
* @param sortAttribute "index", "sortData" or custom user data-attribute by which to sort
*/
getSortAttribute(sortAttribute: string): string | number;
protected bindEvents(): void;
protected unbindEvents(): void;
}

View File

@@ -0,0 +1,30 @@
import { Position } from './../types/interfaces';
import StyledFilterizrElement from '../StyledFilterizrElement';
import FilterizrOptions from '../FilterizrOptions';
export default class StyledFilterItem extends StyledFilterizrElement {
private _index;
constructor(node: HTMLElement, index: number, options: FilterizrOptions);
initialize(): void;
setFilteredStyles(position: Position, cssOptions: object): void;
updateTransitionStyle(): void;
updateWidth(): void;
/**
* Sets the transition css property as an inline style on the FilterItem.
*
* The idea here is that during the very first render items should assume
* their positions directly.
*
* Following renders should actually trigger the transitions, which is why
* we need to delay setting the transition property.
*
* Unfortunately, JavaScript code executes on the same thread as the
* browser's rendering. Everything that needs to be drawn waits for
* JavaScript execution to complete. Thus, we need to use a setTimeout
* here to defer setting the transition style at the first rendering cycle.
*/
enableTransitions(): Promise<void>;
disableTransitions(): void;
setZIndex(zIndex: number): void;
removeZIndex(): void;
removeWidth(): void;
}

View File

@@ -0,0 +1 @@
export { default } from './FilterItem';

View File

@@ -0,0 +1,5 @@
import FilterizrOptions from '../FilterizrOptions';
import { Dictionary, Position } from '../types/interfaces';
export declare const makeInitialStyles: (options: FilterizrOptions) => object;
export declare const makeFilteringStyles: (targetPosition: Position, cssOptions: Dictionary) => object;
export declare const makeTransitionStyles: (index: number, options: FilterizrOptions) => object;

22
plugins/filterizr/FilterItems.d.ts vendored Normal file
View File

@@ -0,0 +1,22 @@
import { Filter } from './ActiveFilter';
import FilterItem from './FilterItem';
import FilterizrOptions from './FilterizrOptions/FilterizrOptions';
export default class FilterItems {
private filterItems;
private options;
constructor(filterItems: FilterItem[], options: FilterizrOptions);
readonly length: number;
get(): FilterItem[];
getItem(index: number): FilterItem;
set(filterItems: FilterItem[]): void;
destroy(): void;
updateTransitionStyle(): void;
updateDimensions(): void;
push(filterItem: FilterItem): number;
getFiltered(filter: Filter): FilterItem[];
getFilteredOut(filter: Filter): FilterItem[];
getSorted(sortAttr?: string, sortOrder?: 'asc' | 'desc'): FilterItem[];
getSearched(searchTerm: string): FilterItem[];
getShuffled(): FilterItem[];
private shouldBeFiltered;
}

View File

@@ -0,0 +1,23 @@
import StyledFilterItems from './StyledFilterItems';
import { Filter } from '../types';
import FilterItem from '../FilterItem';
import FilterizrOptions from '../FilterizrOptions/FilterizrOptions';
import { Destructible, Styleable } from '../types/interfaces';
export default class FilterItems implements Destructible, Styleable {
private filterItems;
private styledFilterItems;
private options;
constructor(filterItems: FilterItem[], options: FilterizrOptions);
readonly styles: StyledFilterItems;
readonly length: number;
getItem(index: number): FilterItem;
destroy(): void;
push(filterItem: FilterItem): number;
remove(node: HTMLElement): void;
getFiltered(filter: Filter): FilterItem[];
getFilteredOut(filter: Filter): FilterItem[];
sort(sortAttr?: string, sortOrder?: 'asc' | 'desc'): void;
shuffle(): void;
private search;
private shouldBeFiltered;
}

View File

@@ -0,0 +1,12 @@
import StyledFilterizrElements from '../StyledFilterizrElements';
import FilterItem from '../FilterItem/FilterItem';
export default class StyledFilterItems extends StyledFilterizrElements {
private _filterItems;
constructor(elements: FilterItem[]);
removeWidth(): void;
updateWidth(): void;
updateTransitionStyle(): void;
disableTransitions(): void;
enableTransitions(): Promise<void>;
updateWidthWithTransitionsDisabled(): void;
}

View File

@@ -0,0 +1 @@
export { default } from './FilterItems';

76
plugins/filterizr/Filterizr.d.ts vendored Normal file
View File

@@ -0,0 +1,76 @@
import FilterizrOptions from './FilterizrOptions/FilterizrOptions';
import FilterContainer from './FilterContainer';
import FilterItem from './FilterItem';
import { Filter } from './ActiveFilter';
import { RawOptions } from './FilterizrOptions/defaultOptions';
export default class Filterizr {
/**
* Main Filterizr classes exported as static members
*/
static FilterContainer: typeof FilterContainer;
static FilterItem: typeof FilterItem;
static defaultOptions: RawOptions;
/**
* Static method that receives the jQuery object and extends
* its prototype with a .filterizr method.
*/
static installAsJQueryPlugin: Function;
options: FilterizrOptions;
private browserWindow;
private filterContainer;
private filterControls?;
private filterizrState;
constructor(selectorOrNode?: string | HTMLElement, userOptions?: RawOptions);
private readonly filterItems;
/**
* Filters the items in the grid by a category
* @param category by which to filter
*/
filter(category: Filter): void;
destroy(): void;
/**
* Inserts a new FilterItem in the Filterizr grid
* @param node DOM node to append
*/
insertItem(node: HTMLElement): void;
/**
* Sorts the FilterItems in the grid
* @param sortAttr the attribute by which to perform the sort
* @param sortOrder ascending or descending
*/
sort(sortAttr?: string, sortOrder?: 'asc' | 'desc'): void;
/**
* Searches through the FilterItems for a given string and adds an additional filter layer.
* @param searchTerm the term for which to search
*/
search(searchTerm?: string): void;
/**
* Shuffles the FilterItems in the grid, making sure their positions have changed.
*/
shuffle(): void;
/**
* Updates the perferences of the users for rendering the Filterizr grid,
* additionally performs error checking on the new options passed.
* @param newOptions to override the defaults.
*/
setOptions(newOptions: RawOptions): void;
/**
* Performs multifiltering with AND/OR logic.
* @param toggledFilter the filter to toggle
*/
toggleFilter(toggledFilter: string): void;
private render;
private onTransitionEndCallback;
private rebindFilterContainerEvents;
private bindEvents;
/**
* If it contains images it makes use of the imagesloaded npm package
* to trigger the first render after the images have finished loading
* in the DOM. Otherwise, overlapping can occur if the images do not
* have the height attribute explicitly set on them.
*
* In case the grid contains no images, then a simple render is performed.
*/
private renderWithImagesLoaded;
private updateDimensionsAndRerender;
}

View File

@@ -0,0 +1,75 @@
import { Filter } from '../types';
import { RawOptions, Destructible } from '../types/interfaces';
import FilterizrOptions from '../FilterizrOptions';
import FilterContainer from '../FilterContainer';
import FilterItem from '../FilterItem';
export default class Filterizr implements Destructible {
/**
* Main Filterizr classes exported as static members
*/
static FilterContainer: typeof FilterContainer;
static FilterItem: typeof FilterItem;
static defaultOptions: RawOptions;
/**
* Static method that receives the jQuery object and extends
* its prototype with a .filterizr method.
*/
static installAsJQueryPlugin: Function;
options: FilterizrOptions;
private windowEventReceiver;
private filterContainer;
private filterControls?;
private imagesHaveLoaded;
private spinner?;
constructor(selectorOrNode?: string | HTMLElement, userOptions?: RawOptions);
private readonly filterItems;
/**
* Filters the items in the grid by a category
* @param category by which to filter
*/
filter(category: Filter): void;
destroy(): void;
/**
* Inserts a new FilterItem into the grid
*/
insertItem(node: HTMLElement): Promise<void>;
/**
* Removes a FilterItem from the grid
*/
removeItem(node: HTMLElement): void;
/**
* Sorts the FilterItems in the grid
* @param sortAttr the attribute by which to perform the sort
* @param sortOrder ascending or descending
*/
sort(sortAttr?: string, sortOrder?: 'asc' | 'desc'): void;
/**
* Searches through the FilterItems for a given string and adds an additional filter layer.
*/
search(searchTerm?: string): void;
/**
* Shuffles the FilterItems in the grid, making sure their positions have changed.
*/
shuffle(): void;
/**
* Updates the perferences of the users for rendering the Filterizr grid,
* additionally performs error checking on the new options passed.
* @param newOptions to override the defaults.
*/
setOptions(newOptions: RawOptions): void;
/**
* Performs multifiltering with AND/OR logic.
* @param toggledFilter the filter to toggle
*/
toggleFilter(toggledFilter: string): void;
private render;
/**
* Initialization sequence of Filterizr when the grid is first loaded
*/
private initialize;
private bindEvents;
/**
* Resolves when the images of the grid have finished loading into the DOM
*/
private waitForImagesToLoad;
}

View File

@@ -0,0 +1 @@
export { default } from './Filterizr';

View File

@@ -0,0 +1 @@
export default function installAsJQueryPlugin($: any): void;

16
plugins/filterizr/FilterizrElement.d.ts vendored Normal file
View File

@@ -0,0 +1,16 @@
import { Destructible, Dimensions, Resizable, Styleable } from './types/interfaces';
import FilterizrOptions from './FilterizrOptions';
import EventReceiver from './EventReceiver';
import StyledFilterizrElement from './StyledFilterizrElement';
export default abstract class FilterizrElement implements Destructible, Resizable, Styleable {
node: Element;
options: FilterizrOptions;
protected eventReceiver: EventReceiver;
constructor(node: Element, options: FilterizrOptions);
readonly dimensions: Dimensions;
destroy(): void | Promise<void>;
trigger(eventType: string): void;
abstract readonly styles: StyledFilterizrElement;
protected abstract bindEvents(): void;
protected abstract unbindEvents(): void;
}

View File

@@ -0,0 +1,22 @@
import { BaseOptions, RawOptions } from './../types/interfaces';
import ActiveFilter from '../ActiveFilter';
import { Filter } from '../types';
export interface Options extends BaseOptions {
filter: ActiveFilter;
}
export default class FilterizrOptions {
private options;
constructor(userOptions: RawOptions);
readonly isSpinnerEnabled: boolean;
readonly areControlsEnabled: boolean;
readonly controlsSelector: string;
filter: Filter;
toggleFilter(filter: string): void;
searchTerm: string;
get(): Options;
getRaw(): RawOptions;
set(newUserOptions: RawOptions): void;
private convertToFilterizrOptions;
private convertToOptions;
private validate;
}

View File

@@ -0,0 +1,3 @@
import { RawOptions } from '../types/interfaces';
declare const defaultOptions: RawOptions;
export default defaultOptions;

View File

@@ -0,0 +1,2 @@
export { default as defaultOptions } from './defaultOptions';
export { default } from './FilterizrOptions';

13
plugins/filterizr/Spinner/Spinner.d.ts vendored Normal file
View File

@@ -0,0 +1,13 @@
import { Destructible, Styleable } from '../types/interfaces';
import FilterizrOptions from '../FilterizrOptions';
import FilterContainer from '../FilterContainer';
import StyledSpinner from './StyledSpinner';
export default class Spinner implements Destructible, Styleable {
private node;
private styledNode;
private filterContainer;
constructor(filterContainer: FilterContainer, options: FilterizrOptions);
readonly styles: StyledSpinner;
destroy(): Promise<void>;
private initialize;
}

View File

@@ -0,0 +1,5 @@
import StyledFilterizrElement from '../StyledFilterizrElement';
export default class StyledSpinner extends StyledFilterizrElement {
initialize(): void;
fadeOut(): Promise<void>;
}

1
plugins/filterizr/Spinner/index.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export { default } from './Spinner';

View File

@@ -0,0 +1,2 @@
import { SpinnerOptions } from '../types/interfaces';
export declare function makeSpinner({ fillColor }: SpinnerOptions): HTMLElement;

View File

@@ -0,0 +1,12 @@
import { Destructible } from './types/interfaces/Destructible';
import FilterizrOptions from './FilterizrOptions';
export default abstract class StyledFilterizrElement implements Destructible {
protected options: FilterizrOptions;
protected node: HTMLElement;
constructor(node: HTMLElement, options: FilterizrOptions);
destroy(): void;
protected animate(targetStyles: object): Promise<void>;
protected set(targetStyles: object): void;
protected remove(propertyName: string): void;
abstract initialize(): void | Promise<void>;
}

View File

@@ -0,0 +1,2 @@
export default abstract class StyledFilterizrElements {
}

6
plugins/filterizr/animate.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
declare class Animator {
static animate(node: HTMLElement, targetStyles: object): Promise<void>;
private static process;
}
declare const _default: typeof Animator.animate;
export default _default;

View File

@@ -0,0 +1,4 @@
/**
* A Regexp to validate potential values for the CSS easing property of transitions.
*/
export declare const cssEasingValuesRegexp: RegExp;

View File

@@ -0,0 +1,11 @@
interface FilterizrState {
IDLE: 'IDLE';
FILTERING: 'FILTERING';
SORTING: 'SORTING';
SHUFFLING: 'SHUFFLING';
}
/**
* Possible animation states for Filterizr
*/
export declare const FILTERIZR_STATE: FilterizrState;
export {};

3
plugins/filterizr/config/index.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
export { FILTERIZR_STATE } from './filterizrState';
export { LAYOUT } from './layout';
export { cssEasingValuesRegexp } from './cssEasingValuesRegexp';

13
plugins/filterizr/config/layout.d.ts vendored Normal file
View File

@@ -0,0 +1,13 @@
interface Layout {
SAME_SIZE: 'sameSize';
SAME_HEIGHT: 'sameHeight';
SAME_WIDTH: 'sameWidth';
PACKED: 'packed';
HORIZONTAL: 'horizontal';
VERTICAL: 'vertical';
}
/**
* Possible grid layout modes
*/
export declare const LAYOUT: Layout;
export {};

12
plugins/filterizr/filterizr.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
import { Position } from './FilterItem';
import FilterContainer from './FilterContainer';
/**
* Calculates and returns an array of objects representing
* the next positions the FilterItems are supposed to assume.
* @param layout name of helper method to be used
* @param filterizr instance
*/
declare const getLayoutPositions: (layout: string, filterContainer: FilterContainer) => Position[];
export default getLayoutPositions;

9
plugins/filterizr/index.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
/**
* Filterizr is a JavaScript library that sorts, shuffles and applies stunning
* filters over responsive galleries using CSS3 transitions and
* custom CSS effects.
* @author Yiotis Kaltsikis
* @see {@link http://yiotis.net/filterizr}
* @license MIT
*/
export { default } from './Filterizr';

10
plugins/filterizr/index.jquery.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Filterizr is a JavaScript library that sorts, shuffles and applies stunning filters over
* responsive galleries using CSS3 transitions and custom CSS effects.
*
* @author Yiotis Kaltsikis
* @see {@link http://yiotis.net/filterizr}
* @license MIT
*/
import Filterizr from './Filterizr';
export default Filterizr;

View File

@@ -0,0 +1 @@
export default function installAsJQueryPlugin($: any): void;

File diff suppressed because one or more lines are too long

30
plugins/filterizr/layouts/Packer.d.ts vendored Normal file
View File

@@ -0,0 +1,30 @@
/**
* Modified version of Jake Gordon's Bin Packing algorithm used for Filterizr's 'packed' layout
* @see {@link https://github.com/jakesgordon/bin-packing}
*/
interface PackerRoot {
x: number;
y: number;
w: number;
h?: number;
used?: boolean;
down?: PackerRoot;
right?: PackerRoot;
}
interface PackerBlock {
x?: number;
y?: number;
w?: number;
h?: number;
fit?: PackerRoot | void;
}
export default class Packer {
root: PackerRoot;
constructor(w: number);
init(w: number): void;
fit(blocks: PackerBlock[]): void;
findNode(root: PackerRoot, w: number, h: number): PackerRoot | void;
splitNode(node: PackerRoot, w: number, h: number): PackerRoot;
growDown(w: number, h: number): PackerRoot | void;
}
export {};

View File

@@ -0,0 +1,8 @@
import { Position } from '../FilterItem';
import FilterContainer from '../FilterContainer';
/**
* Horizontal layout algorithm that arranges all FilterItems in one row. Their width may vary.
* @param filterContainer instance.
*/
declare const getHorizontalLayoutPositions: (filterContainer: FilterContainer) => Position[];
export default getHorizontalLayoutPositions;

View File

@@ -0,0 +1,8 @@
import { Position } from '../FilterItem';
import FilterContainer from '../FilterContainer';
/**
* Packed layout for items that can have varying width as well as varying height.
* @param filterContainer instance.
*/
declare const getPackedLayoutPositions: (filterContainer: FilterContainer) => Position[];
export default getPackedLayoutPositions;

View File

@@ -0,0 +1,8 @@
import { Position } from '../FilterItem';
import FilterContainer from '../FilterContainer';
/**
* Same height layout for items that have the same height, but can have varying width
* @param filterContainer instance.
*/
declare const getSameHeightLayoutPositions: (filterContainer: FilterContainer) => Position[];
export default getSameHeightLayoutPositions;

View File

@@ -0,0 +1,8 @@
import { Position } from '../FilterItem';
import FilterContainer from '../FilterContainer';
/**
* Same size layout for items that have the same width/height
* @param filterContainer instance.
*/
declare const getSameSizeLayoutPosition: (filterContainer: FilterContainer) => Position[];
export default getSameSizeLayoutPosition;

View File

@@ -0,0 +1,8 @@
import { Position } from '../FilterItem';
import FilterContainer from '../FilterContainer';
/**
* Same width layout for items that have the same width, but can have varying height
* @param filterContainer instance.
*/
declare const getSameWidthLayoutPositions: (filterContainer: FilterContainer) => Position[];
export default getSameWidthLayoutPositions;

View File

@@ -0,0 +1,8 @@
import { Position } from '../FilterItem';
import FilterContainer from '../FilterContainer';
/**
* Vertical layout algorithm that arranges all FilterItems in one column. Their height may vary.
* @param filterizr instance.
*/
declare const getVerticalLayoutPositions: (filterContainer: FilterContainer) => Position[];
export default getVerticalLayoutPositions;

View File

@@ -0,0 +1,30 @@
/**
* Modified version of Jake Gordon's Bin Packing algorithm used for Filterizr's 'packed' layout
* @see {@link https://github.com/jakesgordon/bin-packing}
*/
interface PackerRoot {
x: number;
y: number;
w: number;
h?: number;
used?: boolean;
down?: PackerRoot;
right?: PackerRoot;
}
interface PackerBlock {
x?: number;
y?: number;
w?: number;
h?: number;
fit?: PackerRoot | void;
}
export default class Packer {
root: PackerRoot;
constructor(w: number);
init(w: number): void;
fit(blocks: PackerBlock[]): void;
findNode(root: PackerRoot, w: number, h: number): PackerRoot | void;
splitNode(node: PackerRoot, w: number, h: number): PackerRoot;
growDown(w: number, h: number): PackerRoot | void;
}
export {};

View File

@@ -0,0 +1 @@
export { default } from './makeLayoutPositions';

View File

@@ -0,0 +1,6 @@
import { ContainerLayout, Dimensions } from '../types/interfaces';
declare const _default: (itemsDimensions: Dimensions[], gutterPixels: number) => ContainerLayout;
/**
* Horizontal layout algorithm that arranges all FilterItems in one row. Their width may vary.
*/
export default _default;

View File

@@ -0,0 +1,7 @@
import { ContainerLayout, Dimensions, Options } from '../types/interfaces';
declare const _default: (containerWidth: number, itemsDimensions: Dimensions[], { gutterPixels, layout }: Options) => ContainerLayout;
/**
* Creates the specifications of the dimensions of the
* container and items for the next render of Filterizr.
*/
export default _default;

View File

@@ -0,0 +1,6 @@
import { ContainerLayout, Dimensions } from '../types/interfaces';
declare const _default: (containerWidth: number, itemsDimensions: Dimensions[], gutterPixels: number) => ContainerLayout;
/**
* Packed layout for items that can have varying width as well as varying height.
*/
export default _default;

View File

@@ -0,0 +1,6 @@
import { ContainerLayout, Dimensions } from '../types/interfaces';
declare const _default: (containerWidth: number, itemsDimensions: Dimensions[], gutterPixels: number) => ContainerLayout;
/**
* Same height layout for items that have the same height, but can have varying width
*/
export default _default;

View File

@@ -0,0 +1,6 @@
import { ContainerLayout, Dimensions } from '../types/interfaces';
declare const _default: (containerWidth: number, itemsDimensions: Dimensions[], gutterPixels: number) => ContainerLayout;
/**
* Same size layout for items that have the same width/height
*/
export default _default;

View File

@@ -0,0 +1,6 @@
import { ContainerLayout, Dimensions } from '../types/interfaces';
declare const _default: (containerWidth: number, itemsDimensions: Dimensions[], gutterPixels: number) => ContainerLayout;
/**
* Same width layout for items that have the same width and varying height
*/
export default _default;

View File

@@ -0,0 +1,6 @@
import { ContainerLayout, Dimensions } from '../types/interfaces';
declare const _default: (itemsDimensions: Dimensions[], gutterPixels: number) => ContainerLayout;
/**
* Vertical layout algorithm that arranges all FilterItems in one column. Their height may vary.
*/
export default _default;

3
plugins/filterizr/types/index.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
export declare type Filter = string | string[];
export declare type FilterizrState = 'IDLE' | 'FILTERING' | 'SORTING' | 'SHUFFLING';
export declare type Layout = 'horizontal' | 'vertical' | 'sameHeight' | 'sameWidth' | 'sameSize' | 'packed';

View File

@@ -0,0 +1,20 @@
import { SpinnerOptions } from './SpinnerOptions';
import { RawOptionsCallbacks } from './RawOptionsCallbacks';
import { Layout } from '..';
export interface BaseOptions {
animationDuration?: number;
callbacks?: RawOptionsCallbacks;
controlsSelector?: string;
delay?: number;
delayMode?: 'alternate' | 'progressive';
easing?: string;
filterOutCss?: object;
filterInCss?: object;
gridItemsSelector?: string;
gutterPixels?: number;
layout?: Layout;
multifilterLogicalOperator?: 'or' | 'and';
searchTerm?: string;
setupControls?: boolean;
spinner?: SpinnerOptions;
}

View File

@@ -0,0 +1,5 @@
import { Position } from './Position';
export interface ContainerLayout {
containerHeight: number;
itemsPositions: Position[];
}

View File

@@ -0,0 +1,3 @@
export interface Destructible {
destroy(): void | Promise<void>;
}

View File

@@ -0,0 +1,3 @@
export interface Dictionary {
[key: string]: any;
}

View File

@@ -0,0 +1,4 @@
export interface Dimensions {
width: number;
height: number;
}

View File

@@ -0,0 +1,5 @@
import { BaseOptions } from './BaseOptions';
import ActiveFilter from '../../ActiveFilter';
export interface Options extends BaseOptions {
filter: ActiveFilter;
}

View File

@@ -0,0 +1,4 @@
export interface Position {
left: number;
top: number;
}

View File

@@ -0,0 +1,4 @@
import { BaseOptions } from './BaseOptions';
export interface RawOptions extends BaseOptions {
filter?: string | string[];
}

View File

@@ -0,0 +1,10 @@
export interface RawOptionsCallbacks {
onInit?: EventListener;
onFilteringStart?: EventListener;
onFilteringEnd?: EventListener;
onShufflingStart?: EventListener;
onShufflingEnd?: EventListener;
onSortingStart?: EventListener;
onSortingEnd?: EventListener;
onTransitionEnd?: EventListener;
}

View File

@@ -0,0 +1,6 @@
export interface Resizable {
readonly dimensions: {
width: number;
height: number;
};
}

View File

@@ -0,0 +1,6 @@
import { Dictionary } from './Dictionary';
export interface SpinnerOptions {
enabled?: boolean;
fillColor?: string;
styles?: Dictionary;
}

View File

@@ -0,0 +1,5 @@
import StyledFilterizrElement from '../../StyledFilterizrElement';
import StyledFilterizrElements from '../../StyledFilterizrElements';
export interface Styleable {
readonly styles: StyledFilterizrElement | StyledFilterizrElements;
}

View File

@@ -0,0 +1,12 @@
export { BaseOptions } from './BaseOptions';
export { ContainerLayout } from './ContainerLayout';
export { Destructible } from './Destructible';
export { Dictionary } from './Dictionary';
export { Dimensions } from './Dimensions';
export { Options } from './Options';
export { Position } from './Position';
export { RawOptions } from './RawOptions';
export { RawOptionsCallbacks } from './RawOptionsCallbacks';
export { Resizable } from './Resizable';
export { SpinnerOptions } from './SpinnerOptions';
export { Styleable } from './Styleable';

140
plugins/filterizr/utils.d.ts vendored Normal file
View File

@@ -0,0 +1,140 @@
import { Dictionary } from './types/interfaces/Dictionary';
import FilterItem from './FilterItem';
/**
* A function to check that all elements of an array are found within another array.
* @param {Array} arr1 is the array of strings to be checked
* @param {Array} arr2 is the array of strings to check against
* @return {Boolean} whether all string of arr1 are contained in arr2
*/
declare const allStringsOfArray1InArray2: (arr1: string[], arr2: string[]) => boolean;
export { allStringsOfArray1InArray2 };
/**
* Given a CSS prop it will normalize the syntax for JS
* e.g. transform background-color to backgroundColor
* @param {String} cssProp prop name
* @return {String} normalized name
*/
declare const getNormalizedCssPropName: (cssProp: string) => string;
export { getNormalizedCssPropName };
/**
* Set inline styles on an HTML node
* @param {HTMLElement} node - HTML node
* @param {Object} styles - object with styles
* @returns {undefined}
*/
declare function setStylesOnHTMLNode(node: Element, styles: any): void;
export { setStylesOnHTMLNode };
/**
* Returns an object with value/key pairs of all data
* attributes on an HTML element, disregarding the
* two data attributes that are reserved for internal
* usage by Filterizr
* @param {Object} node - HTML node
* @returns {Object} map of data attributes / values
*/
declare function getDataAttributesOfHTMLNode(node: Element): Dictionary;
export { getDataAttributesOfHTMLNode };
/**
* Check that a DOM element has a data-attribute present
* @param {Object} node element
* @param {String} dataAttributeName name of data attribute
* @return {Boolean} data attribute exists
*/
declare function checkDataAttributeExists(node: Element, dataAttributeName: string): boolean;
export { checkDataAttributeExists };
/**
* A very simple function to perform a basic
* deep clone of an object.
* @param {Object} o is the object to perform the deep clone on
* @return {Object} deep clone
*/
declare const makeShallowClone: (o: any) => Dictionary;
export { makeShallowClone };
/**
* A function to recursively merge an object, copying over all
* properties of the old object missing from the target object.
* In case a prop in is an object, the method is called recursively.
* This is a non-mutating method.
* @param {Object} old is the old object from which the missing props are copied.
* @param {Object} target is the target object with the updated values.
*/
declare const merge: (old: any, target: any) => Dictionary;
export { merge };
/**
* A function get the intersection of two arrays. IE9+.
* @param {Array} arr1 is the first array of which to get the intersection
* @param {Array} arr2 is the second array of which to get the intersection
*/
declare const intersection: (arr1: any[], arr2: any[]) => any;
export { intersection };
/**
* Debounce of Underscore.js
*/
declare const debounce: (func: Function, wait: number, immediate: boolean) => Function;
export { debounce };
/**
* Fisher-Yates shuffle ES6 non-mutating implementation.
* @param {Array} array the array to shuffle
* @return {Array} shuffled array without mutating the initial array.
*/
declare const shuffle: (array: any[]) => any[];
export { shuffle };
/**
* Simple method to check if two arrays of FilterItems
* are sorted in the same manner or not.
* @param {Array} arr1 the first array of FilterItems
* @param {Array} arr2 the second array of FilterItems
* @return {Boolean} equality
*/
declare const filterItemArraysHaveSameSorting: (filterItemsA: FilterItem[], filterItemsB: FilterItem[]) => boolean;
export { filterItemArraysHaveSameSorting };
/**
* Simple non-mutating sorting function for arrays of objects by a property
* @param {Array} array to sort
* @param {Function} propFn fetches the property by which to sort
* @return {Array} a new sorted array
*/
declare const sortBy: (array: any[], propFn: Function) => any[];
export { sortBy };
/**
* Error checking method to restrict a prop to some allowed values
* @param {String} name of the option key in the options object
* @param {String|Number|Object|Function|Array|Boolean} value of the option
* @param {String} type of the property
* @param {Array} allowed accepted values for option
* @param {String} furtherHelpLink a link to docs for further help
*/
declare const checkOptionForErrors: (name: string, value: string | number | boolean | object | Function | any[], type?: string, allowed?: RegExp | any[], furtherHelpLink?: string) => void;
export { checkOptionForErrors };
/**
* Wrapper around document.querySelector, will function as
* an identity function if an HTML element is passed in
* @param {HTMLElement|string} nodeOrSelector
*/
declare const getHTMLElement: (selectorOrNode: string | HTMLElement) => HTMLElement;
export { getHTMLElement };
/**
* A Regexp to validate potential values for the CSS easing property of transitions.
*/
declare const cssEasingValuesRegexp: RegExp;
export { cssEasingValuesRegexp };
/**
* Possible animation states for Filterizr
*/
declare const FILTERIZR_STATE: {
IDLE: string;
FILTERING: string;
SORTING: string;
SHUFFLING: string;
};
export { FILTERIZR_STATE };
/**
* Transition end events with vendor prefixing
*/
declare const TRANSITION_END_EVENTS: string[];
export { TRANSITION_END_EVENTS };
/**
* A no-operation function
*/
declare const noop: () => void;
export { noop };

View File

@@ -0,0 +1 @@
export declare const allStringsOfArray1InArray2: (arr1: string[], arr2: string[]) => boolean;

View File

@@ -0,0 +1,9 @@
/**
* Error checking method to restrict a prop to some allowed values
* @param {String} name of the option key in the options object
* @param {String|Number|Object|Function|Array|Boolean} value of the option
* @param {String} type of the property
* @param {Array} allowed accepted values for option
* @param {String} furtherHelpLink a link to docs for further help
*/
export declare const checkOptionForErrors: (name: string, value: string | number | boolean | object | Function | any[], type?: string, allowed?: RegExp | any[], furtherHelpLink?: string) => void;

4
plugins/filterizr/utils/debounce.d.ts vendored Normal file
View File

@@ -0,0 +1,4 @@
/**
* Debounce of Underscore.js
*/
export declare const debounce: (func: Function, wait: number, immediate: boolean) => Function;

View File

@@ -0,0 +1,9 @@
import FilterItem from '../FilterItem';
/**
* Simple method to check if two arrays of FilterItems
* are sorted in the same manner or not.
* @param {Array} arr1 the first array of FilterItems
* @param {Array} arr2 the second array of FilterItems
* @return {Boolean} equality
*/
export declare const filterItemArraysHaveSameSorting: (filterItemsA: FilterItem[], filterItemsB: FilterItem[]) => boolean;

View File

@@ -0,0 +1,2 @@
import { Dictionary } from '../types/interfaces/Dictionary';
export declare function getDataAttributesOfHTMLNode(node: Element): Dictionary;

View File

@@ -0,0 +1,6 @@
/**
* Wrapper around document.querySelector, will function as
* an identity function if an HTML element is passed in
* @param {HTMLElement|string} nodeOrSelector
*/
export declare const getHTMLElement: (selectorOrNode: string | HTMLElement) => HTMLElement;

12
plugins/filterizr/utils/index.d.ts vendored Normal file
View File

@@ -0,0 +1,12 @@
export { allStringsOfArray1InArray2 } from './allStringsOfArray1InArray2';
export { checkOptionForErrors } from './checkOptionForErrors';
export { debounce } from './debounce';
export { filterItemArraysHaveSameSorting, } from './filterItemArraysHaveSameSorting';
export { getDataAttributesOfHTMLNode } from './getDataAttributesOfHTMLNode';
export { getHTMLElement } from './getHTMLElement';
export { intersection } from './intersection';
export { merge } from './merge';
export { noop } from './noop';
export { setStyles } from './setStyles';
export { shuffle } from './shuffle';
export { sortBy } from './sortBy';

View File

@@ -0,0 +1,4 @@
/**
* A function get the intersection of two arrays. IE9+.
*/
export declare const intersection: (arr1: any[], arr2: any[]) => any[];

5
plugins/filterizr/utils/merge.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
import { Dictionary } from '../types/interfaces/Dictionary';
/**
* Deep merge two objects.
*/
export declare function merge(target: Dictionary, ...sources: Dictionary[]): Dictionary;

4
plugins/filterizr/utils/noop.d.ts vendored Normal file
View File

@@ -0,0 +1,4 @@
/**
* A no-operation function
*/
export declare const noop: () => void;

View File

@@ -0,0 +1,7 @@
/**
* Set inline styles on an HTML node
* @param {HTMLElement} node - HTML node
* @param {Object} styles - object with styles
* @returns {undefined}
*/
export declare function setStyles(node: Element, styles: any): void;

6
plugins/filterizr/utils/shuffle.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
/**
* Fisher-Yates shuffle ES6 non-mutating implementation.
* @param {Array} array the array to shuffle
* @return {Array} shuffled array without mutating the initial array.
*/
export declare const shuffle: (array: any[]) => any[];

7
plugins/filterizr/utils/sortBy.d.ts vendored Normal file
View File

@@ -0,0 +1,7 @@
/**
* Simple non-mutating sorting function for arrays of objects by a property
* @param {Array} array to sort
* @param {Function} propFn fetches the property by which to sort
* @return {Array} a new sorted array
*/
export declare const sortBy: (array: any[], propFn: Function) => any[];

File diff suppressed because one or more lines are too long