Aggrid custom

This commit is contained in:
2026-03-17 08:44:54 +01:00
commit 739374d83f
3234 changed files with 1533165 additions and 0 deletions
+74665
View File
File diff suppressed because one or more lines are too long
+1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+73157
View File
File diff suppressed because one or more lines are too long
+62050
View File
File diff suppressed because one or more lines are too long
+64
View File
File diff suppressed because one or more lines are too long
+64
View File
File diff suppressed because one or more lines are too long
+62028
View File
File diff suppressed because one or more lines are too long
+142
View File
@@ -0,0 +1,142 @@
{
"name": "ag-grid-community",
"version": "35.1.0",
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue",
"main": "./dist/package/main.cjs.js",
"types": "./dist/types/src/main.d.ts",
"module": "./dist/package/main.esm.mjs",
"exports": {
".": {
"import": "./dist/package/main.esm.mjs",
"types": "./dist/types/src/main.d.ts",
"require": "./dist/package/main.cjs.js",
"default": "./dist/package/main.cjs.js"
},
"./styles/ag-grid-no-native-widgets.css": "./styles/ag-grid-no-native-widgets.css",
"./styles/ag-grid-no-native-widgets.min.css": "./styles/ag-grid-no-native-widgets.min.css",
"./styles/ag-grid.css": "./styles/ag-grid.css",
"./styles/ag-grid.min.css": "./styles/ag-grid.min.css",
"./styles/ag-theme-alpine-no-font.css": "./styles/ag-theme-alpine-no-font.css",
"./styles/ag-theme-alpine-no-font.min.css": "./styles/ag-theme-alpine-no-font.min.css",
"./styles/ag-theme-alpine.css": "./styles/ag-theme-alpine.css",
"./styles/ag-theme-alpine.min.css": "./styles/ag-theme-alpine.min.css",
"./styles/ag-theme-balham-no-font.css": "./styles/ag-theme-balham-no-font.css",
"./styles/ag-theme-balham-no-font.min.css": "./styles/ag-theme-balham-no-font.min.css",
"./styles/ag-theme-balham.css": "./styles/ag-theme-balham.css",
"./styles/ag-theme-balham.min.css": "./styles/ag-theme-balham.min.css",
"./styles/ag-theme-material-no-font.css": "./styles/ag-theme-material-no-font.css",
"./styles/ag-theme-material-no-font.min.css": "./styles/ag-theme-material-no-font.min.css",
"./styles/ag-theme-material.css": "./styles/ag-theme-material.css",
"./styles/ag-theme-material.min.css": "./styles/ag-theme-material.min.css",
"./styles/ag-theme-quartz-no-font.css": "./styles/ag-theme-quartz-no-font.css",
"./styles/ag-theme-quartz-no-font.min.css": "./styles/ag-theme-quartz-no-font.min.css",
"./styles/ag-theme-quartz.css": "./styles/ag-theme-quartz.css",
"./styles/ag-theme-quartz.min.css": "./styles/ag-theme-quartz.min.css",
"./styles/agGridAlpineFont.css": "./styles/agGridAlpineFont.css",
"./styles/agGridAlpineFont.min.css": "./styles/agGridAlpineFont.min.css",
"./styles/agGridBalhamFont.css": "./styles/agGridBalhamFont.css",
"./styles/agGridBalhamFont.min.css": "./styles/agGridBalhamFont.min.css",
"./styles/agGridClassicFont.css": "./styles/agGridClassicFont.css",
"./styles/agGridClassicFont.min.css": "./styles/agGridClassicFont.min.css",
"./styles/agGridMaterialFont.css": "./styles/agGridMaterialFont.css",
"./styles/agGridMaterialFont.min.css": "./styles/agGridMaterialFont.min.css",
"./styles/agGridQuartzFont.css": "./styles/agGridQuartzFont.css",
"./styles/agGridQuartzFont.min.css": "./styles/agGridQuartzFont.min.css",
"./styles": "./styles/_index.scss"
},
"sideEffects": [
"./styles/ag-grid-no-native-widgets.css",
"./styles/ag-grid-no-native-widgets.min.css",
"./styles/ag-grid.css",
"./styles/ag-grid.min.css",
"./styles/ag-theme-alpine-no-font.css",
"./styles/ag-theme-alpine-no-font.min.css",
"./styles/ag-theme-alpine.css",
"./styles/ag-theme-alpine.min.css",
"./styles/ag-theme-balham-no-font.css",
"./styles/ag-theme-balham-no-font.min.css",
"./styles/ag-theme-balham.css",
"./styles/ag-theme-balham.min.css",
"./styles/ag-theme-material-no-font.css",
"./styles/ag-theme-material-no-font.min.css",
"./styles/ag-theme-material.css",
"./styles/ag-theme-material.min.css",
"./styles/ag-theme-quartz-no-font.css",
"./styles/ag-theme-quartz-no-font.min.css",
"./styles/ag-theme-quartz.css",
"./styles/ag-theme-quartz.min.css",
"./styles/agGridAlpineFont.css",
"./styles/agGridAlpineFont.min.css",
"./styles/agGridBalhamFont.css",
"./styles/agGridBalhamFont.min.css",
"./styles/agGridClassicFont.css",
"./styles/agGridClassicFont.min.css",
"./styles/agGridMaterialFont.css",
"./styles/agGridMaterialFont.min.css",
"./styles/agGridQuartzFont.css",
"./styles/agGridQuartzFont.min.css"
],
"repository": {
"type": "git",
"url": "https://github.com/ag-grid/ag-grid.git"
},
"keywords": [
"ag",
"ag-grid",
"datagrid",
"data-grid",
"data grid",
"datatable",
"data-table",
"data table",
"grid",
"table",
"react",
"table",
"angular",
"angular data grid",
"angular table",
"angular-component",
"react",
"react data grid",
"react table",
"react-component",
"reactjs",
"vue",
"vuejs"
],
"author": "Sean Landsman <sean@thelandsmans.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/ag-grid/ag-grid/issues"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie >= 0",
"not ie_mob >= 0",
"not blackberry > 0"
],
"homepage": "https://www.ag-grid.com/",
"dependencies": {
"ag-charts-types": "13.1.0"
},
"devDependencies": {
"source-map-loader": "^5.0.0",
"ts-loader": "^9.5.1",
"esbuild-loader": "^4.4.0",
"style-loader": "^3.3.4",
"css-loader": "^6.10.0",
"postcss-loader": "^8.1.0",
"webpack-cli": "^5.1.4",
"terser-webpack-plugin": "^5.3.10",
"postcss-preset-env": "^9.5.0",
"web-streams-polyfill": "^3.3.2",
"blob-polyfill": "^7.0.20220408",
"compression-streams-polyfill": "^0.1.7",
"text-encoding-polyfill": "^0.6.7",
"@types/jest": "^29.5.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.7.0"
}
}
+143
View File
@@ -0,0 +1,143 @@
{
"name": "ag-grid-community",
"version": "35.1.0",
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue",
"main": "./dist/package/main.cjs.js",
"types": "./dist/types/src/main.d.ts",
"module": "./dist/package/main.esm.mjs",
"exports": {
".": {
"import": "./dist/package/main.esm.mjs",
"types": "./dist/types/src/main.d.ts",
"require": "./dist/package/main.cjs.js",
"default": "./dist/package/main.cjs.js"
},
"./styles/ag-grid-no-native-widgets.css": "./styles/ag-grid-no-native-widgets.css",
"./styles/ag-grid-no-native-widgets.min.css": "./styles/ag-grid-no-native-widgets.min.css",
"./styles/ag-grid.css": "./styles/ag-grid.css",
"./styles/ag-grid.min.css": "./styles/ag-grid.min.css",
"./styles/ag-theme-alpine-no-font.css": "./styles/ag-theme-alpine-no-font.css",
"./styles/ag-theme-alpine-no-font.min.css": "./styles/ag-theme-alpine-no-font.min.css",
"./styles/ag-theme-alpine.css": "./styles/ag-theme-alpine.css",
"./styles/ag-theme-alpine.min.css": "./styles/ag-theme-alpine.min.css",
"./styles/ag-theme-balham-no-font.css": "./styles/ag-theme-balham-no-font.css",
"./styles/ag-theme-balham-no-font.min.css": "./styles/ag-theme-balham-no-font.min.css",
"./styles/ag-theme-balham.css": "./styles/ag-theme-balham.css",
"./styles/ag-theme-balham.min.css": "./styles/ag-theme-balham.min.css",
"./styles/ag-theme-material-no-font.css": "./styles/ag-theme-material-no-font.css",
"./styles/ag-theme-material-no-font.min.css": "./styles/ag-theme-material-no-font.min.css",
"./styles/ag-theme-material.css": "./styles/ag-theme-material.css",
"./styles/ag-theme-material.min.css": "./styles/ag-theme-material.min.css",
"./styles/ag-theme-quartz-no-font.css": "./styles/ag-theme-quartz-no-font.css",
"./styles/ag-theme-quartz-no-font.min.css": "./styles/ag-theme-quartz-no-font.min.css",
"./styles/ag-theme-quartz.css": "./styles/ag-theme-quartz.css",
"./styles/ag-theme-quartz.min.css": "./styles/ag-theme-quartz.min.css",
"./styles/agGridAlpineFont.css": "./styles/agGridAlpineFont.css",
"./styles/agGridAlpineFont.min.css": "./styles/agGridAlpineFont.min.css",
"./styles/agGridBalhamFont.css": "./styles/agGridBalhamFont.css",
"./styles/agGridBalhamFont.min.css": "./styles/agGridBalhamFont.min.css",
"./styles/agGridClassicFont.css": "./styles/agGridClassicFont.css",
"./styles/agGridClassicFont.min.css": "./styles/agGridClassicFont.min.css",
"./styles/agGridMaterialFont.css": "./styles/agGridMaterialFont.css",
"./styles/agGridMaterialFont.min.css": "./styles/agGridMaterialFont.min.css",
"./styles/agGridQuartzFont.css": "./styles/agGridQuartzFont.css",
"./styles/agGridQuartzFont.min.css": "./styles/agGridQuartzFont.min.css",
"./styles": "./styles/_index.scss"
},
"sideEffects": [
"./styles/ag-grid-no-native-widgets.css",
"./styles/ag-grid-no-native-widgets.min.css",
"./styles/ag-grid.css",
"./styles/ag-grid.min.css",
"./styles/ag-theme-alpine-no-font.css",
"./styles/ag-theme-alpine-no-font.min.css",
"./styles/ag-theme-alpine.css",
"./styles/ag-theme-alpine.min.css",
"./styles/ag-theme-balham-no-font.css",
"./styles/ag-theme-balham-no-font.min.css",
"./styles/ag-theme-balham.css",
"./styles/ag-theme-balham.min.css",
"./styles/ag-theme-material-no-font.css",
"./styles/ag-theme-material-no-font.min.css",
"./styles/ag-theme-material.css",
"./styles/ag-theme-material.min.css",
"./styles/ag-theme-quartz-no-font.css",
"./styles/ag-theme-quartz-no-font.min.css",
"./styles/ag-theme-quartz.css",
"./styles/ag-theme-quartz.min.css",
"./styles/agGridAlpineFont.css",
"./styles/agGridAlpineFont.min.css",
"./styles/agGridBalhamFont.css",
"./styles/agGridBalhamFont.min.css",
"./styles/agGridClassicFont.css",
"./styles/agGridClassicFont.min.css",
"./styles/agGridMaterialFont.css",
"./styles/agGridMaterialFont.min.css",
"./styles/agGridQuartzFont.css",
"./styles/agGridQuartzFont.min.css"
],
"repository": {
"type": "git",
"url": "https://github.com/ag-grid/ag-grid.git"
},
"keywords": [
"ag",
"ag-grid",
"datagrid",
"data-grid",
"data grid",
"datatable",
"data-table",
"data table",
"grid",
"table",
"react",
"table",
"angular",
"angular data grid",
"angular table",
"angular-component",
"react",
"react data grid",
"react table",
"react-component",
"reactjs",
"vue",
"vuejs"
],
"author": "Sean Landsman <sean@thelandsmans.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/ag-grid/ag-grid/issues"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie >= 0",
"not ie_mob >= 0",
"not blackberry > 0"
],
"homepage": "https://www.ag-grid.com/",
"dependencies": {
"ag-charts-types": "13.1.0"
},
"devDependencies": {
"source-map-loader": "^5.0.0",
"ts-loader": "^9.5.1",
"esbuild-loader": "^4.4.0",
"style-loader": "^3.3.4",
"css-loader": "^6.10.0",
"postcss-loader": "^8.1.0",
"webpack-cli": "^5.1.4",
"terser-webpack-plugin": "^5.3.10",
"postcss-preset-env": "^9.5.0",
"web-streams-polyfill": "^3.3.2",
"blob-polyfill": "^7.0.20220408",
"compression-streams-polyfill": "^0.1.7",
"text-encoding-polyfill": "^0.6.7",
"@types/jest": "^29.5.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.7.0"
},
"type": "commonjs"
}
+6
View File
@@ -0,0 +1,6 @@
export declare enum Direction {
Vertical = 0,
Horizontal = 1
}
export type VerticalDirection = 'up' | 'down';
export type HorizontalDirection = 'left' | 'right';
+25
View File
@@ -0,0 +1,25 @@
export declare const KeyCode: {
readonly BACKSPACE: "Backspace";
readonly TAB: "Tab";
readonly ENTER: "Enter";
readonly ESCAPE: "Escape";
readonly SPACE: " ";
readonly LEFT: "ArrowLeft";
readonly UP: "ArrowUp";
readonly RIGHT: "ArrowRight";
readonly DOWN: "ArrowDown";
readonly DELETE: "Delete";
readonly F2: "F2";
readonly PAGE_UP: "PageUp";
readonly PAGE_DOWN: "PageDown";
readonly PAGE_HOME: "Home";
readonly PAGE_END: "End";
readonly A: "KeyA";
readonly C: "KeyC";
readonly D: "KeyD";
readonly V: "KeyV";
readonly X: "KeyX";
readonly Y: "KeyY";
readonly Z: "KeyZ";
};
export declare function _normaliseQwertyAzerty(keyboardEvent: KeyboardEvent): string;
+85
View File
@@ -0,0 +1,85 @@
import { LocalEventService } from '../events/localEventService';
import type { AgBaseBean } from '../interfaces/agBaseBean';
import type { AgBean } from '../interfaces/agBean';
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { AgEvent } from '../interfaces/agEvent';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { IContext } from '../interfaces/iContext';
import type { AgEventService } from '../interfaces/iEvent';
import type { IAgEventEmitter, IEventEmitter, IEventListener } from '../interfaces/iEventEmitter';
import type { LocaleTextFunc } from '../interfaces/iLocaleService';
import type { AgPropertyChangedListener, AgPropertyValueChangedListener, IPropertiesService } from '../interfaces/iProperties';
export type AgBeanStubEvent = 'destroyed';
type AgEventOrDestroyed<TEventType extends string> = TEventType | AgBeanStubEvent;
type EventHandlers<TEventKey extends string, TEvent = any> = {
[K in TEventKey]?: (event?: TEvent) => void;
};
export declare abstract class AgBeanStub<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>, TLocalEventType extends string = AgBeanStubEvent> implements AgBean<TBeanCollection, TProperties, TGlobalEvents, TLocalEventType>, IEventEmitter<AgEventOrDestroyed<TLocalEventType>> {
protected localEventService?: LocalEventService<AgEventOrDestroyed<TLocalEventType>>;
private stubContext;
private destroyFunctions;
private destroyed;
__v_skip: boolean;
protected beans: TBeanCollection;
protected eventSvc: AgEventService<TGlobalEvents, TCommon>;
protected gos: TPropertiesService;
preWireBeans(beans: TBeanCollection): void;
destroy(): void;
/** Add a local event listener against this BeanStub */
addEventListener<T extends TLocalEventType>(eventType: T, listener: IEventListener<T>, async?: boolean): void;
/** Remove a local event listener from this BeanStub */
removeEventListener<T extends TLocalEventType>(eventType: T, listener: IEventListener<T>, async?: boolean): void;
dispatchLocalEvent<TEvent extends AgEvent<TLocalEventType>>(event: TEvent): void;
addManagedElementListeners<TEvent extends keyof HTMLElementEventMap>(object: Element | Document | ShadowRoot, handlers: EventHandlers<TEvent, HTMLElementEventMap[TEvent]>): (() => null)[];
addManagedEventListeners(handlers: {
[K in keyof TGlobalEvents]?: (event: TGlobalEvents[K]) => void;
} | {
[K in keyof BaseEvents]?: (event: BaseEvents[K]) => void;
}): (() => null)[];
addManagedListeners<TEvent extends string>(object: IEventEmitter<TEvent> | IAgEventEmitter<TEvent> | AgEventService<TGlobalEvents, TCommon>, handlers: EventHandlers<TEvent>): (() => null)[];
private _setupListeners;
private _setupListener;
/**
* Setup a managed property listener for the given property.
* However, stores the destroy function in the beanStub so that if this bean
* is a component the destroy function will be called when the component is destroyed
* as opposed to being cleaned up only when the properties service is destroyed.
*/
private setupPropertyListener;
/**
* Setup a managed property listener for the given GridOption property.
* @param event GridOption property to listen to changes for.
* @param listener Listener to run when property value changes
*/
addManagedPropertyListener<K extends keyof TProperties & string>(event: K, listener: AgPropertyValueChangedListener<TProperties, K>): () => null;
private propertyListenerId;
private lastChangeSetIdLookup;
/**
* Setup managed property listeners for the given set of GridOption properties.
* The listener will be run if any of the property changes but will only run once if
* multiple of the properties change within the same framework lifecycle event.
* Works on the basis that GridOptionsService updates all properties *before* any property change events are fired.
* @param events Array of GridOption properties to listen for changes too.
* @param listener Shared listener to run if any of the properties change
*/
addManagedPropertyListeners(events: (keyof TProperties)[], listener: AgPropertyChangedListener<TProperties>): void;
isAlive: () => boolean;
getLocaleTextFunc(): LocaleTextFunc;
addDestroyFunc(func: () => void): void;
/** doesn't throw an error if `bean` is undefined */
createOptionalManagedBean<T extends AgBaseBean<TBeanCollection> | null | undefined>(bean: T, context?: IContext<TBeanCollection>): T | undefined;
createManagedBean<T extends AgBaseBean<TBeanCollection>>(bean: T, context?: IContext<TBeanCollection>): T;
createBean<T extends AgBaseBean<TBeanCollection>>(bean: T, context?: IContext<TBeanCollection> | null, afterPreCreateCallback?: (bean: AgBaseBean<TBeanCollection>) => void): T;
/**
* Destroys a bean and returns undefined to support destruction and clean up in a single line.
* this.dateComp = this.context.destroyBean(this.dateComp);
*/
destroyBean(bean: AgBaseBean<TBeanCollection> | null | undefined, context?: IContext<TBeanCollection>): undefined;
/**
* Destroys an array of beans and returns an empty array to support destruction and clean up in a single line.
* this.dateComps = this.context.destroyBeans(this.dateComps);
*/
protected destroyBeans<T extends AgBaseBean<TBeanCollection>>(beans: (T | null | undefined)[], context?: IContext<TBeanCollection>): T[];
}
export {};
+58
View File
@@ -0,0 +1,58 @@
import type { AgBaseComponent, AgComponent, AgComponentEvent, AgComponentSelector } from '../interfaces/agComponent';
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { IPropertiesService } from '../interfaces/iProperties';
import type { AgElementParams } from '../utils/dom';
import { AgBeanStub } from './agBeanStub';
export declare class AgComponentStub<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>, TComponentSelectorType extends string, TLocalEventType extends string = AgComponentEvent> extends AgBeanStub<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService, TLocalEventType | AgComponentEvent> implements AgComponent<TBeanCollection, TProperties, TGlobalEvents, TLocalEventType> {
private eGui;
private readonly componentSelectors;
private suppressDataRefValidation;
private displayed;
private visible;
private css;
protected parentComponent: AgComponent<TBeanCollection, TProperties, TGlobalEvents, any> | undefined;
private readonly compId;
private readonly cssManager;
constructor(templateOrParams?: string | AgElementParams<TComponentSelectorType>, componentSelectors?: AgComponentSelector<TComponentSelectorType, TBeanCollection>[]);
preConstruct(): void;
private wireTemplate;
getCompId(): number;
private getDataRefAttribute;
private applyElementsToComponent;
private createChildComponentsFromTags;
private createComponentFromElement;
private swapComponentForNode;
protected activateTabIndex(elements?: Element[], overrideTabIndex?: number): void;
protected setTemplate(templateOrParams: AgElementParams<TComponentSelectorType> | string | null | undefined, componentSelectors?: AgComponentSelector<TComponentSelectorType, TBeanCollection>[], paramsMap?: {
[key: string]: any;
}): void;
protected setTemplateFromElement(element: HTMLElement, components?: AgComponentSelector<TComponentSelectorType, TBeanCollection>[], paramsMap?: {
[key: string]: any;
}, suppressDataRefValidation?: boolean): void;
getGui(): HTMLElement;
getFocusableElement(): HTMLElement;
getAriaElement(): Element;
setParentComponent(component: AgComponent<TBeanCollection, TProperties, TGlobalEvents, any>): void;
getParentComponent<T extends AgComponent<TBeanCollection, TProperties, TGlobalEvents, any>>(): T | undefined;
protected setGui(eGui: HTMLElement): void;
protected queryForHtmlElement(cssSelector: string): HTMLElement;
private getContainerAndElement;
prependChild(newChild: HTMLElement | AgBaseComponent<TBeanCollection>, container?: HTMLElement): void;
appendChild(newChild: HTMLElement | AgBaseComponent<TBeanCollection>, container?: HTMLElement): void;
isDisplayed(): boolean;
setVisible(visible: boolean, options?: {
skipAriaHidden?: boolean;
}): void;
setDisplayed(displayed: boolean, options?: {
skipAriaHidden?: boolean;
}): void;
destroy(): void;
addGuiEventListener(event: string, listener: (event: any) => void, options?: AddEventListenerOptions): void;
addCss(className: string): void;
removeCss(className: string): void;
toggleCss(className: string, addOrRemove: boolean): void;
protected registerCSS(css: string): void;
private addGlobalCss;
}
+52
View File
@@ -0,0 +1,52 @@
import type { AgBaseBean } from '../interfaces/agBaseBean';
import type { AgSingletonBean } from '../interfaces/agCoreBean';
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { IContext } from '../interfaces/iContext';
import type { IPropertiesService } from '../interfaces/iProperties';
type BeanComparator<TBeanCollection> = (bean1: AgSingletonBean<TBeanCollection>, bean2: AgSingletonBean<TBeanCollection>) => number;
export interface AgContextParams<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>> {
providedBeanInstances: Partial<TBeanCollection>;
beanClasses: AgSingletonBeanClass<TBeanCollection>[];
derivedBeans?: ((context: AgContext<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService>) => DerivedBean<TBeanCollection, keyof TBeanCollection>)[];
beanInitComparator?: BeanComparator<TBeanCollection>;
beanDestroyComparator?: BeanComparator<TBeanCollection>;
id: string;
destroyCallback?: () => void;
}
export type AgSingletonBeanClass<TBeanCollection> = new () => AgSingletonBean<TBeanCollection>;
interface DerivedBean<TBeanCollection, K extends keyof TBeanCollection> {
beanName: K;
bean: TBeanCollection[K] & AgSingletonBean<TBeanCollection>;
}
export declare class AgContext<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>> implements IContext<TBeanCollection> {
protected beans: TBeanCollection;
private createdBeans;
private readonly beanDestroyComparator?;
private id;
private destroyCallback?;
private destroyed;
readonly instanceId: number;
constructor(params: AgContextParams<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService>);
protected init(params: AgContextParams<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService>): void;
private getBeanInstances;
createBean<T extends AgBaseBean<TBeanCollection>>(bean: T, afterPreCreateCallback?: (bean: AgBaseBean<TBeanCollection>) => void): T;
private initBeans;
getBeans(): TBeanCollection;
getBean<T extends keyof TBeanCollection>(name: T): TBeanCollection[T];
getId(): string;
destroy(): void;
/**
* Destroys a bean and returns undefined to support destruction and clean up in a single line.
* this.dateComp = this.context.destroyBean(this.dateComp);
*/
destroyBean(bean: AgBaseBean<TBeanCollection> | null | undefined): undefined;
/**
* Destroys an array of beans and returns an empty array to support destruction and clean up in a single line.
* this.dateComps = this.context.destroyBeans(this.dateComps);
*/
destroyBeans<T extends AgBaseBean<TBeanCollection>>(beans: (T | null | undefined)[]): T[];
isDestroyed(): boolean;
}
export {};
@@ -0,0 +1,21 @@
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { IAriaAnnouncementService } from '../interfaces/iAriaAnnouncementService';
import type { IPropertiesService } from '../interfaces/iProperties';
import { AgBeanStub } from './agBeanStub';
export declare class BaseAriaAnnouncementService<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>> extends AgBeanStub<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService> implements IAriaAnnouncementService {
beanName: "ariaAnnounce";
private descriptionContainer;
private readonly pendingAnnouncements;
private lastAnnouncement;
constructor();
postConstruct(): void;
/**
* @param key used for debouncing calls
*/
announceValue(value: string, key: string): void;
private updateAnnouncement;
private handleAnnouncementUpdate;
destroy(): void;
}
+53
View File
@@ -0,0 +1,53 @@
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { IComponent } from '../interfaces/iComponent';
import type { AgDragSource, AgDraggingEvent, AgDropTarget, IDragAndDropImage, IDragAndDropService } from '../interfaces/iDragAndDrop';
import type { IPropertiesService } from '../interfaces/iProperties';
import type { AgPromise } from '../utils/promise';
import { AgBeanStub } from './agBeanStub';
export declare abstract class BaseDragAndDropService<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>, TDragSourceType extends number, TDragItem, TDragAndDropIcon extends string, TDraggingEvent extends AgDraggingEvent<TDragSourceType, TDragItem, TDragAndDropIcon, TDraggingEvent>, TDragSource extends AgDragSource<TDragSourceType, TDragItem, TDragAndDropIcon, TDraggingEvent>> extends AgBeanStub<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService> implements IDragAndDropService<TDragSourceType, TDragItem, TDragAndDropIcon, TDraggingEvent, TDragSource> {
beanName: "dragAndDrop";
private readonly dragSourceAndParamsList;
private dragItem;
private dragInitialSourcePointerOffsetX;
private dragInitialSourcePointerOffsetY;
private lastMouseEvent;
private lastDraggingEvent;
private dragSource;
private dragImageCompPromise;
private dragImageComp;
private dragImageLastIcon;
private dragImageLastLabel;
private readonly dropTargets;
private externalDropZoneCount;
private lastDropTarget;
protected abstract createEvent(event: AgDraggingEvent<TDragSourceType, TDragItem, TDragAndDropIcon, TDraggingEvent>): TDraggingEvent;
protected abstract createDragImageComp(dragSource: TDragSource): AgPromise<IDragAndDropImage & IComponent<any>> | undefined;
protected abstract handleEnter(dragSource: TDragSource | null, dragItem: TDragItem | null): void;
protected abstract handleExit(dragSource: TDragSource | null, dragItem: TDragItem | null): void;
protected abstract warnNoBody(): void;
addDragSource(dragSource: TDragSource, allowTouch?: boolean): void;
setDragImageCompIcon(iconName: TDragAndDropIcon | null, shake?: boolean): void;
removeDragSource(dragSource: TDragSource): void;
destroy(): void;
nudge(): void;
private onDragStart;
private onDragStop;
private onDragCancel;
private onDragging;
private clearDragAndDropProperties;
private getAllContainersFromDropTarget;
private isMouseOnDropTarget;
private findCurrentDropTarget;
addDropTarget(dropTarget: AgDropTarget<TDragSourceType, TDragItem, TDragAndDropIcon, TDraggingEvent>): void;
removeDropTarget(dropTarget: AgDropTarget<TDragSourceType, TDragItem, TDragAndDropIcon, TDraggingEvent>): void;
hasExternalDropZones(): boolean;
findExternalZone(container: HTMLElement): AgDropTarget<TDragSourceType, TDragItem, TDragAndDropIcon, TDraggingEvent> | null;
private dropTargetEvent;
private positionDragImageComp;
private removeDragImageComp;
private createAndUpdateDragImageComp;
private appendDragImageComp;
private updateDragImageComp;
}
+38
View File
@@ -0,0 +1,38 @@
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { DragListenerParams, IDragService } from '../interfaces/iDrag';
import type { IPropertiesService } from '../interfaces/iProperties';
import { AgBeanStub } from './agBeanStub';
export declare class BaseDragService<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>> extends AgBeanStub<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService> implements IDragService {
beanName: "dragSvc";
dragging: boolean;
private drag;
private readonly dragSources;
get startTarget(): EventTarget | null;
/** True if there is at least one active pointer drag in any BaseDragService instance in the page */
private isPointer;
hasPointerCapture(): boolean;
destroy(): void;
removeDragSource(params: DragListenerParams): void;
addDragSource(params: DragListenerParams): void;
cancelDrag(eElement?: Element | undefined): void;
protected shouldPreventMouseEvent(mouseEvent: MouseEvent): boolean;
private initDrag;
private destroyDrag;
private onPointerDown;
private onTouchStart;
/** preventEventDefault on the event while dragging only and if the event is cancellable */
private draggingPreventDefault;
private onMouseDown;
private onScroll;
/** only gets called after a mouse down - as this is only added after mouseDown and is removed when mouseUp happens */
private onMouseOrPointerMove;
private onTouchCancel;
private onTouchMove;
private onMove;
private onTouchUp;
private onMouseOrPointerUp;
private onUp;
private onKeyDown;
}
+55
View File
@@ -0,0 +1,55 @@
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { IEnvironment } from '../interfaces/iEnvironment';
import type { IPropertiesService } from '../interfaces/iProperties';
import type { Theme } from '../theming/theme';
import { ThemeImpl } from '../theming/themeImpl';
import type { ParamType } from '../theming/themeTypeUtils';
import { AgBeanStub } from './agBeanStub';
export declare abstract class BaseEnvironment<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>, TChangeKeys extends BaseCssChangeKeys = BaseCssChangeKeys> extends AgBeanStub<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService> implements IEnvironment {
beanName: "environment";
protected eRootDiv: HTMLElement;
eStyleContainer: HTMLElement;
cssLayer: string | undefined;
styleNonce: string | undefined;
private mutationObserver;
private readonly sizeEls;
private readonly lastKnownValues;
private eMeasurementContainer;
sizesMeasured: boolean;
wireBeans(beans: TBeanCollection): void;
private theme;
private readonly globalCSS;
protected abstract initVariables(): void;
protected abstract getAdditionalCss(): Map<string, string[]>;
protected abstract postProcessThemeChange(newTheme: ThemeImpl | undefined, themeProperty?: Theme | 'legacy'): void;
protected abstract getDefaultTheme(): Theme;
protected abstract themeError(theme: Theme | 'legacy'): void;
protected abstract shadowRootError(): void;
protected abstract varError(cssName: string, defaultValue: number): void;
postConstruct(): void;
applyThemeClasses(el: HTMLElement, extraClasses?: string[]): void;
private applyLegacyThemeClasses;
addGlobalCSS(css: string, debugId: string): void;
getDefaultListItemHeight(): number;
protected getCSSVariablePixelValue(variable: CssVariable<TChangeKeys>): number;
private measureSizeEl;
protected getMeasurementContainer(): HTMLElement;
protected getSizeEl(variable: CssVariable<TChangeKeys>): HTMLElement;
protected setSizeElStyles(sizeEl: HTMLElement, variable: CssVariable<TChangeKeys>): string;
private handleThemeChange;
private handleNewTheme;
protected fireStylesChangedEvent(change: keyof TChangeKeys & string): void;
}
export type CssVariable<TChangeKeys extends BaseCssChangeKeys> = {
changeKey: keyof TChangeKeys & string;
type: ParamType;
defaultValue: number;
noWarn?: boolean;
cacheDefault?: boolean;
};
export interface BaseCssChangeKeys {
theme: true;
listItemHeight: true;
}
+14
View File
@@ -0,0 +1,14 @@
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { ClassImp } from '../interfaces/iContext';
import type { IPropertiesService } from '../interfaces/iProperties';
import type { IRegistry } from '../interfaces/iRegistry';
import { AgBeanStub } from './agBeanStub';
export declare abstract class BaseRegistry<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>, TDynamicBeanName extends string> extends AgBeanStub<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService> implements IRegistry<TBeanCollection, TDynamicBeanName> {
beanName: "registry";
private dynamicBeans;
protected registerDynamicBeans(dynamicBeans?: Partial<Record<TDynamicBeanName, ClassImp>>): void;
createDynamicBean<T>(name: TDynamicBeanName, mandatory: boolean, ...args: any[]): T | undefined;
protected abstract getDynamicError(name: TDynamicBeanName, init: boolean): string;
}
+17
View File
@@ -0,0 +1,17 @@
import { AgBeanStub } from '../core/agBeanStub';
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { AgEventService, AgEventServiceGlobalListener, AgEventServiceListener, AgRawEvents } from '../interfaces/iEvent';
import type { IPropertiesService } from '../interfaces/iProperties';
export declare class BaseEventService<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>> extends AgBeanStub<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService, keyof TGlobalEvents & string> implements AgEventService<TGlobalEvents, TCommon> {
beanName: "eventSvc";
eventServiceType: "global";
private readonly globalSvc;
addListener<TEventType extends keyof TGlobalEvents & string>(eventType: TEventType, listener: AgEventServiceListener<TGlobalEvents, TEventType>, async?: boolean): void;
removeListener<TEventType extends keyof TGlobalEvents & string>(eventType: TEventType, listener: AgEventServiceListener<TGlobalEvents, TEventType>, async?: boolean): void;
addGlobalListener(listener: AgEventServiceGlobalListener<keyof TGlobalEvents & string, TGlobalEvents>, async?: boolean): void;
removeGlobalListener(listener: AgEventServiceGlobalListener<keyof TGlobalEvents & string, TGlobalEvents>, async?: boolean): void;
dispatchEvent(event: AgRawEvents<TGlobalEvents, TCommon> | BaseEvents[keyof BaseEvents]): void;
dispatchEventOnce(event: AgRawEvents<TGlobalEvents, TCommon> | BaseEvents[keyof BaseEvents]): void;
}
+26
View File
@@ -0,0 +1,26 @@
import type { AgEvent } from '../interfaces/agEvent';
import type { AgFrameworkOverrides } from '../interfaces/agFrameworkOverrides';
import type { IEventEmitter, IEventListener, IGlobalEventListener } from '../interfaces/iEventEmitter';
export declare class LocalEventService<TEventType extends string> implements IEventEmitter<TEventType> {
private readonly allSyncListeners;
private readonly allAsyncListeners;
private readonly globalSyncListeners;
private readonly globalAsyncListeners;
private frameworkOverrides?;
private asyncFunctionsQueue;
private scheduled;
private firedEvents;
setFrameworkOverrides(frameworkOverrides: AgFrameworkOverrides): void;
private getListeners;
noRegisteredListenersExist(): boolean;
addEventListener<T extends TEventType>(eventType: T, listener: IEventListener<T>, async?: boolean): void;
removeEventListener<T extends TEventType>(eventType: T, listener: IEventListener<T>, async?: boolean): void;
addGlobalListener(listener: IGlobalEventListener<TEventType>, async?: boolean): void;
removeGlobalListener(listener: IGlobalEventListener<TEventType>, async?: boolean): void;
dispatchEvent<TEvent extends AgEvent<TEventType>>(event: TEvent): void;
dispatchEventOnce(event: AgEvent<TEventType>): void;
private dispatchToListeners;
private getGlobalListeners;
private dispatchAsync;
private flushAsyncQueue;
}
+7
View File
@@ -0,0 +1,7 @@
export interface PointerCapture {
eElement: HTMLElement | null;
pointerId: number;
onLost: ((event: PointerEvent) => void) | null;
}
export declare const capturePointer: (eElement: HTMLElement, mouseEvent: Event | Touch) => PointerCapture | null;
export declare const releasePointerCapture: (capture: PointerCapture | null) => void;
+25
View File
@@ -0,0 +1,25 @@
import { AgBeanStub } from '../core/agBeanStub';
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { IPropertiesService } from '../interfaces/iProperties';
export interface ManagedFocusCallbacks {
shouldStopEventPropagation?: (e: KeyboardEvent) => boolean;
onTabKeyDown?: (e: KeyboardEvent) => void;
handleKeyDown?: (e: KeyboardEvent) => void;
onFocusIn?: (e: FocusEvent) => void;
onFocusOut?: (e: FocusEvent) => void;
}
export declare const FOCUS_MANAGED_CLASS = "ag-focus-managed";
export interface StopPropagationCallbacks {
isStopPropagation: (e: Event) => boolean;
stopPropagation: (e: Event) => void;
}
export declare class AgManagedFocusFeature<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>> extends AgBeanStub<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService> {
private readonly eFocusable;
private readonly stopPropagationCallbacks;
private readonly callbacks;
constructor(eFocusable: HTMLElement, stopPropagationCallbacks?: StopPropagationCallbacks, callbacks?: ManagedFocusCallbacks);
postConstruct(): void;
private addKeyDownListeners;
}
+15
View File
@@ -0,0 +1,15 @@
import { AgComponentStub } from '../core/agComponentStub';
import type { AgComponent, AgComponentEvent } from '../interfaces/agComponent';
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { IPropertiesService } from '../interfaces/iProperties';
import type { StopPropagationCallbacks } from './agManagedFocusFeature';
import type { AgTabGuardParams } from './agTabGuardFeature';
import { AgTabGuardFeature } from './agTabGuardFeature';
export declare class AgTabGuardComp<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>, TComponentSelectorType extends string, TLocalEventType extends string = AgComponentEvent> extends AgComponentStub<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService, TComponentSelectorType, TLocalEventType> {
protected tabGuardFeature: AgTabGuardFeature<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService>;
protected initialiseTabGuard(params: AgTabGuardParams, stopPropagationCallbacks?: StopPropagationCallbacks): void;
forceFocusOutOfContainer(up?: boolean): void;
appendChild(newChild: AgComponent<TBeanCollection, TProperties, TGlobalEvents, any> | HTMLElement, container?: HTMLElement | undefined): void;
}
+53
View File
@@ -0,0 +1,53 @@
import { AgBeanStub } from '../core/agBeanStub';
import type { AgComponent } from '../interfaces/agComponent';
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { IPropertiesService } from '../interfaces/iProperties';
import type { StopPropagationCallbacks } from './agManagedFocusFeature';
import { AgTabGuardCtrl } from './tabGuardCtrl';
export interface AgTabGuardParams {
focusInnerElement?: (fromBottom: boolean) => boolean;
shouldStopEventPropagation?: () => boolean;
/**
* @returns `true` to prevent the default onFocusIn behavior
*/
onFocusIn?: (e: FocusEvent) => void;
/**
* @returns `true` to prevent the default onFocusOut behavior
*/
onFocusOut?: (e: FocusEvent) => void;
onTabKeyDown?: (e: KeyboardEvent) => void;
handleKeyDown?: (e: KeyboardEvent) => void;
/**
* By default will check for focusable elements to see if empty.
* Provide this to override.
*/
isEmpty?: () => boolean;
/**
* Set to true to create a circular focus pattern when keyboard tabbing.
*/
focusTrapActive?: boolean;
/**
* Set to true to find a focusable element outside of the TabGuards to focus
*/
forceFocusOutWhenTabGuardsAreEmpty?: boolean;
isFocusableContainer?: boolean;
}
export declare class AgTabGuardFeature<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>> extends AgBeanStub<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService> {
private readonly comp;
private readonly stopPropagationCallbacks?;
private eTopGuard;
private eBottomGuard;
private eFocusableElement;
private tabGuardCtrl;
constructor(comp: AgComponent<TBeanCollection, TProperties, TGlobalEvents, any>, stopPropagationCallbacks?: StopPropagationCallbacks | undefined);
initialiseTabGuard(params: AgTabGuardParams): void;
getTabGuardCtrl(): AgTabGuardCtrl<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService>;
private createTabGuard;
private addTabGuards;
removeAllChildrenExceptTabGuards(): void;
forceFocusOutOfContainer(up?: boolean): void;
appendChild(appendChild: (newChild: HTMLElement | AgComponent<TBeanCollection, TProperties, TGlobalEvents, any>, container?: HTMLElement) => void, newChild: AgComponent<TBeanCollection, TProperties, TGlobalEvents, any> | HTMLElement, container?: HTMLElement | undefined): void;
destroy(): void;
}
+67
View File
@@ -0,0 +1,67 @@
import { AgBeanStub } from '../core/agBeanStub';
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { IPropertiesService } from '../interfaces/iProperties';
import type { StopPropagationCallbacks } from './agManagedFocusFeature';
export declare const TabGuardClassNames: {
readonly TAB_GUARD: "ag-tab-guard";
readonly TAB_GUARD_TOP: "ag-tab-guard-top";
readonly TAB_GUARD_BOTTOM: "ag-tab-guard-bottom";
};
export interface ITabGuard {
setTabIndex(tabIndex?: string): void;
}
export interface TabGuardCtrlParams {
comp: ITabGuard;
eTopGuard: HTMLElement;
eBottomGuard: HTMLElement;
eFocusableElement: HTMLElement;
focusTrapActive?: boolean;
forceFocusOutWhenTabGuardsAreEmpty?: boolean;
isFocusableContainer?: boolean;
focusInnerElement?: (fromBottom: boolean) => boolean;
onFocusIn?: (event: FocusEvent) => void;
onFocusOut?: (event: FocusEvent) => void;
shouldStopEventPropagation?: () => boolean;
onTabKeyDown?: (e: KeyboardEvent) => void;
handleKeyDown?: (e: KeyboardEvent) => void;
isEmpty?: () => boolean;
}
export declare class AgTabGuardCtrl<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>> extends AgBeanStub<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService> {
private readonly stopPropagationCallbacks?;
private readonly comp;
private readonly eTopGuard;
private readonly eBottomGuard;
private readonly eFocusableElement;
private readonly focusTrapActive;
private readonly forceFocusOutWhenTabGuardsAreEmpty;
private readonly isFocusableContainer;
private readonly providedFocusInnerElement?;
private readonly providedFocusIn?;
private readonly providedFocusOut?;
private readonly providedShouldStopEventPropagation?;
private readonly providedOnTabKeyDown?;
private readonly providedHandleKeyDown?;
private readonly providedIsEmpty?;
private skipTabGuardFocus;
private forcingFocusOut;
private allowFocus;
constructor(params: TabGuardCtrlParams, stopPropagationCallbacks?: StopPropagationCallbacks | undefined);
postConstruct(): void;
private handleKeyDown;
private tabGuardsAreActive;
private shouldStopEventPropagation;
private activateTabGuards;
private deactivateTabGuards;
private onFocus;
private findNextElementOutsideAndFocus;
private onFocusIn;
private onFocusOut;
onTabKeyDown(e: KeyboardEvent): void;
focusInnerElement(fromBottom?: boolean): boolean;
getNextFocusableElement(backwards?: boolean): HTMLElement | null;
forceFocusOutOfContainer(up?: boolean): void;
isTabGuard(element: HTMLElement, bottom?: boolean): boolean;
setAllowFocus(allowFocus: boolean): void;
}
+12
View File
@@ -0,0 +1,12 @@
export interface AgBaseBean<TBeanCollection> {
/** AG Grid internal - do not call */
preWireBeans?(beans: TBeanCollection): void;
/** AG Grid internal - do not call */
wireBeans?(beans: TBeanCollection): void;
/** AG Grid internal - do not call */
preConstruct?(): void;
/** AG Grid internal - do not call */
postConstruct?(): void;
/** AG Grid internal - do not call */
destroy?(): void;
}
+35
View File
@@ -0,0 +1,35 @@
import type { AgCoreBean } from './agCoreBean';
import type { AgEvent } from './agEvent';
import type { BaseEvents } from './baseEvents';
import type { BaseProperties } from './baseProperties';
import type { AgEventHandlers } from './iContext';
import type { IAgEventEmitter, IEventEmitter, IEventListener } from './iEventEmitter';
import type { LocaleTextFunc } from './iLocaleService';
import type { AgPropertyChangedListener, AgPropertyValueChangedListener } from './iProperties';
/** Includes bean event and property handling logic */
export interface AgBean<TBeanCollection, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TLocalEventType extends string> extends AgCoreBean<TBeanCollection> {
addEventListener<T extends TLocalEventType>(eventType: T, listener: IEventListener<TLocalEventType>, async?: boolean): void;
removeEventListener<T extends TLocalEventType>(eventType: T, listener: IEventListener<TLocalEventType>, async?: boolean): void;
dispatchLocalEvent<TEvent extends AgEvent<TLocalEventType>>(event: TEvent): void;
addManagedElementListeners<TEvent extends keyof HTMLElementEventMap>(object: Element | Document | ShadowRoot, handlers: AgEventHandlers<TEvent, HTMLElementEventMap[TEvent]>): (() => null)[];
addManagedEventListeners(handlers: {
[K in keyof TGlobalEvents]?: (event: TGlobalEvents[K]) => void;
}): (() => null)[];
addManagedListeners<TEvent extends string>(object: IEventEmitter<TEvent> | IAgEventEmitter<TEvent>, handlers: AgEventHandlers<TEvent>): (() => null)[];
/**
* Setup a managed property listener for the given GridOption property.
* @param event GridOption property to listen to changes for.
* @param listener Listener to run when property value changes
*/
addManagedPropertyListener<K extends keyof TProperties & string>(event: K, listener: AgPropertyValueChangedListener<TProperties, K>): () => null;
/**
* Setup managed property listeners for the given set of GridOption properties.
* The listener will be run if any of the property changes but will only run once if
* multiple of the properties change within the same framework lifecycle event.
* Works on the basis that GridOptionsService updates all properties *before* any property change events are fired.
* @param events Array of GridOption properties to listen for changes too.
* @param listener Shared listener to run if any of the properties change
*/
addManagedPropertyListeners(events: (keyof TProperties)[], listener: AgPropertyChangedListener<TProperties>): void;
getLocaleTextFunc(): LocaleTextFunc;
}
+46
View File
@@ -0,0 +1,46 @@
import type { AgBeanStubEvent } from '../core/agBeanStub';
import type { AgBaseBean } from './agBaseBean';
import type { AgBean } from './agBean';
import type { AgEvent } from './agEvent';
import type { BaseEvents } from './baseEvents';
import type { BaseProperties } from './baseProperties';
export interface AgBaseComponent<TBeanCollection> extends AgBaseBean<TBeanCollection> {
getGui(): HTMLElement;
}
export interface AgComponent<TBeanCollection, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TLocalEventType extends string = AgComponentEvent> extends AgBaseComponent<TBeanCollection>, AgBean<TBeanCollection, TProperties, TGlobalEvents, TLocalEventType> {
getCompId(): number;
getFocusableElement(): HTMLElement;
getAriaElement(): Element;
setParentComponent(component: AgComponent<TBeanCollection, TProperties, TGlobalEvents, any>): void;
getParentComponent<T extends AgComponent<TBeanCollection, TProperties, TGlobalEvents, any>>(): T | undefined;
prependChild(newChild: HTMLElement | AgBaseComponent<TBeanCollection>, container?: HTMLElement): void;
appendChild(newChild: HTMLElement | AgBaseComponent<TBeanCollection>, container?: HTMLElement): void;
isDisplayed(): boolean;
setVisible(visible: boolean, options?: {
skipAriaHidden?: boolean;
}): void;
setDisplayed(displayed: boolean, options?: {
skipAriaHidden?: boolean;
}): void;
addGuiEventListener(event: string, listener: (event: any) => void, options?: AddEventListenerOptions): void;
addCss(className: string): void;
removeCss(className: string): void;
toggleCss(className: string, addOrRemove: boolean): void;
}
/** The RefPlaceholder is used to control when data-ref attribute should be applied to the component
* There are hanging data-refs in the DOM that are not being used internally by the component which we don't want to apply to the component.
* There is also the case where data-refs are solely used for passing parameters to the component and should not be applied to the component.
* It also enables validation to catch typo errors in the data-ref attribute vs component name.
* The value is `null` so that it can be identified in the component and distinguished from just missing with undefined.
* The `null` value also allows for existing falsy checks to work as expected when code can be run before the template is setup.
*/
export declare const RefPlaceholder: any;
export type AgComponentEvent = 'displayChanged' | AgBeanStubEvent;
export interface VisibleChangedEvent extends AgEvent<'displayChanged'> {
visible: boolean;
}
export type AgComponentSelector<TComponentSelectorType extends string, TBeanCollection = any, TComponent extends AgBaseComponent<TBeanCollection> = AgBaseComponent<TBeanCollection>> = {
component: new (params?: any) => TComponent;
selector: TComponentSelectorType;
};
export declare function _isComponent<TBeanCollection>(item: any): item is AgBaseComponent<TBeanCollection>;
+20
View File
@@ -0,0 +1,20 @@
import type { AgBaseBean } from './agBaseBean';
import type { IContext } from './iContext';
export interface AgSingletonBean<TBeanCollection> extends AgBaseBean<TBeanCollection> {
/** AG Grid internal - do not use */
beanName?: keyof TBeanCollection & string;
}
/** Includes bean creation and destruction logic */
export interface AgCoreBean<TBeanCollection> extends AgBaseBean<TBeanCollection> {
isAlive(): boolean;
addDestroyFunc(func: () => void): void;
/** doesn't throw an error if `bean` is undefined */
createOptionalManagedBean<T extends AgBaseBean<TBeanCollection> | null | undefined>(bean: T, context?: IContext<TBeanCollection>): T | undefined;
createManagedBean<T extends AgBaseBean<TBeanCollection>>(bean: T, context?: IContext<TBeanCollection>): T;
createBean<T extends AgBaseBean<TBeanCollection>>(bean: T, context?: IContext<TBeanCollection> | null, afterPreCreateCallback?: (bean: AgBaseBean<TBeanCollection>) => void): T;
/**
* Destroys a bean and returns undefined to support destruction and clean up in a single line.
* this.dateComp = this.context.destroyBean(this.dateComp);
*/
destroyBean<T extends AgBaseBean<TBeanCollection> | null | undefined>(bean: T, context?: IContext<TBeanCollection>): undefined;
}
@@ -0,0 +1,38 @@
import type { AgFrameworkOverrides } from './agFrameworkOverrides';
import type { BaseEvents } from './baseEvents';
import type { BaseProperties } from './baseProperties';
import type { IAriaAnnouncementService } from './iAriaAnnouncementService';
import type { IContext } from './iContext';
import type { IDragService } from './iDrag';
import type { IDragAndDropService } from './iDragAndDrop';
import type { IEnvironment } from './iEnvironment';
import type { AgEventService } from './iEvent';
import type { IIconService } from './iIconService';
import type { ILocaleService } from './iLocaleService';
import type { IPopupService } from './iPopupService';
import type { IPropertiesService } from './iProperties';
import type { IRegistry } from './iRegistry';
export interface AgCoreBeanCollection<TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>> extends UtilBeanCollection {
context: IContext<this>;
eventSvc: AgEventService<TGlobalEvents, TCommon>;
frameworkOverrides: AgFrameworkOverrides;
gos: TPropertiesService;
localeSvc?: ILocaleService;
environment: IEnvironment;
eRootDiv: HTMLElement;
popupSvc?: IPopupService<any>;
registry: IRegistry<this, 'tooltipFeature' | 'highlightTooltipFeature' | 'tooltipStateManager'>;
iconSvc: IIconService<string, any>;
dragSvc?: IDragService;
dragAndDrop?: IDragAndDropService<any, any, any, any, any>;
agChartsExports?: unknown;
ariaAnnounce: IAriaAnnouncementService;
}
/** This is a cut down version to simplify typing for util functions that don't need/want all the generics */
export interface UtilBeanCollection {
eRootDiv: HTMLElement;
gos: {
get<K extends keyof BaseProperties>(prop: K): BaseProperties[K];
isElementInThisInstance(element: HTMLElement): boolean;
};
}
+4
View File
@@ -0,0 +1,4 @@
export interface AgEvent<TEventType extends string = string> {
/** Event identifier */
type: TEventType;
}
@@ -0,0 +1,19 @@
export type FrameworkOverridesIncomingSource = 'resize-observer' | 'ensureVisible' | 'popupPositioning';
export interface AgFrameworkOverrides {
/**
* This method is to cater for Angular's change detection.
* Angular uses Zones, we want to run internal AG Grid outside of Zone JS so that we do not kick off
* Angular change detection. Any event listener or setTimeout() or setInterval() run by our code
* would trigger change detection in Angular.
*
* Before events are returned to the user, those functions are wrapped in Angular's zone
* again so that the user's code triggers change detection as normal. See wrapOutgoing() below.
*/
wrapIncoming: <T>(callback: () => T, source?: FrameworkOverridesIncomingSource) => T;
/**
* This method is to cater for Angular's change detection.
* This is currently used for events that the user provides either via the component or via registration with the grid api.
* This method should not be implemented for the other frameworks to avoid unnecessary overhead.
*/
wrapOutgoing: <T>(callback: () => T) => T;
}
+46
View File
@@ -0,0 +1,46 @@
import type { AgEvent } from './agEvent';
export interface AgCheckboxChangedEvent extends AgEvent<'checkboxChanged'> {
id: string;
name: string;
selected?: boolean;
previousValue: boolean | undefined;
}
export type ScrollDirection = 'horizontal' | 'vertical';
interface AgBodyScrollEvent extends AgEvent<'bodyScroll'> {
direction: ScrollDirection;
left: number;
top: number;
}
interface AgBaseDragEvent<TEventType extends 'dragStarted' | 'dragStopped' | 'dragCancelled'> extends AgEvent<TEventType> {
target: Element;
}
interface AgDragStartedEvent extends AgBaseDragEvent<'dragStarted'> {
}
interface AgDragStoppedEvent extends AgBaseDragEvent<'dragStopped'> {
}
interface AgDragCancelledEvent extends AgBaseDragEvent<'dragCancelled'> {
}
interface AgTooltipEvent<TEventType extends 'tooltipShow' | 'tooltipHide'> extends AgEvent<TEventType> {
parentGui: HTMLElement;
}
interface AgTooltipShowEvent extends AgTooltipEvent<'tooltipShow'> {
tooltipGui: HTMLElement;
}
interface AgTooltipHideEvent extends AgTooltipEvent<'tooltipHide'> {
}
export interface AgStylesChangedEvent extends AgEvent<'stylesChanged'> {
themeChanged?: boolean;
listItemHeightChanged?: boolean;
}
/** Events required by AG Stack */
export interface BaseEvents {
checkboxChanged: AgCheckboxChangedEvent;
bodyScroll: AgBodyScrollEvent;
dragStarted: AgDragStartedEvent;
dragStopped: AgDragStoppedEvent;
dragCancelled: AgDragCancelledEvent;
tooltipShow: AgTooltipShowEvent;
tooltipHide: AgTooltipHideEvent;
stylesChanged: AgStylesChangedEvent;
}
export {};
+22
View File
@@ -0,0 +1,22 @@
import type { Theme } from '../theming/theme';
/** Properties required by AG Stack */
export interface BaseProperties {
tabIndex?: number;
suppressScrollWhenPopupsAreOpen?: boolean;
enableRtl?: boolean;
popupParent?: HTMLElement | null;
theme?: Theme | 'legacy';
loadThemeGoogleFonts?: boolean;
themeCssLayer?: string;
styleNonce?: string;
themeStyleContainer?: HTMLElement | (() => HTMLElement | void);
enableBrowserTooltips?: boolean;
tooltipTrigger?: 'hover' | 'focus';
tooltipShowDelay?: number;
tooltipSwitchShowDelay?: number;
tooltipHideDelay?: number;
tooltipMouseTrack?: boolean;
tooltipInteraction?: boolean;
getDocument?: () => Document;
suppressTouch?: boolean;
}
@@ -0,0 +1,11 @@
export interface AfterGuiAttachedParams<TContainerType extends string> {
/** Where this component is attached to. */
container?: TContainerType;
/**
* Call this to hide the popup.
* i.e useful if your component has an action button and you want to hide the popup after it is pressed.
*/
hidePopup?: () => void;
/** Set to `true` to not have the component focus its default item. */
suppressFocus?: boolean;
}
@@ -0,0 +1,4 @@
export interface IAriaAnnouncementService {
readonly beanName: 'ariaAnnounce';
announceValue(value: string, key: string): void;
}
+10
View File
@@ -0,0 +1,10 @@
import type { AgPromise } from '../utils/promise';
/** This is for User Components only, do not implement this for internal components. */
export interface IComponent<T> {
/** Return the DOM element of your component, this is what the grid puts into the DOM */
getGui(): HTMLElement;
/** Gets called once by grid when the component is being removed; if your component needs to do any cleanup, do it here */
destroy?(): void;
/** The init(params) method is called on the component once. */
init?(params: T): AgPromise<void> | void;
}
+16
View File
@@ -0,0 +1,16 @@
import type { AgBaseBean } from './agBaseBean';
export type AgEventHandlers<TEventKey extends string, TEvent = any> = {
[K in TEventKey]?: (event?: TEvent) => void;
};
export interface IContext<TBeanCollection> {
createBean<T extends AgBaseBean<TBeanCollection>>(bean: T, afterPreCreateCallback?: (bean: AgBaseBean<TBeanCollection>) => void): T;
getBean<T extends keyof TBeanCollection>(name: T): TBeanCollection[T];
getBeans(): TBeanCollection;
destroyBean(bean: AgBaseBean<TBeanCollection> | null | undefined): undefined;
destroyBeans<T extends AgBaseBean<TBeanCollection>>(beans: (T | null | undefined)[]): T[];
getId(): string;
destroy(): void;
isDestroyed(): boolean;
readonly instanceId: number;
}
export type ClassImp = new (...args: []) => object;
+29
View File
@@ -0,0 +1,29 @@
export interface IDragService {
readonly beanName: 'dragSvc';
readonly startTarget: EventTarget | null;
removeDragSource(params: DragListenerParams): void;
addDragSource(params: DragListenerParams): void;
cancelDrag(el?: Element): void;
/** Returns true if the pointer is currently captured. See https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events */
hasPointerCapture(): boolean;
}
export interface DragListenerParams {
/** If true, the pointer will be captured, see https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events */
capturePointer?: boolean;
/** After how many pixels of dragging should the drag operation start. Default is 4px. */
dragStartPixels?: number;
/** Dom element to add the drag handling to */
eElement: Element;
/** Callback for drag starting */
onDragStart?: (mouseEvent: MouseEvent | Touch) => void;
/** Callback for drag stopping */
onDragStop?: (mouseEvent: MouseEvent | Touch) => void;
/** Callback for drag cancel */
onDragCancel?: () => void;
/** Callback for mouse move while dragging */
onDragging?: (mouseEvent: MouseEvent | Touch) => void;
/** Include touch events for this Drag Listener */
includeTouch?: boolean;
/** If `true`, it will stop the propagation of Touch Events */
stopPropagationForTouch?: boolean;
}
+94
View File
@@ -0,0 +1,94 @@
import type { HorizontalDirection, VerticalDirection } from '../constants/direction';
export interface IDragAndDropService<TDragSourceType extends number, TDragItem, TDragAndDropIcon extends string, TDraggingEvent extends AgDraggingEvent<TDragSourceType, TDragItem, TDragAndDropIcon, TDraggingEvent>, TDragSource extends AgDragSource<TDragSourceType, TDragItem, TDragAndDropIcon, TDraggingEvent>> {
readonly beanName: 'dragAndDrop';
addDragSource(dragSource: TDragSource, allowTouch?: boolean): void;
setDragImageCompIcon(iconName: TDragAndDropIcon | null, shake?: boolean): void;
removeDragSource(dragSource: TDragSource): void;
nudge(): void;
addDropTarget(dropTarget: AgDropTarget<TDragSourceType, TDragItem, TDragAndDropIcon, TDraggingEvent>): void;
removeDropTarget(dropTarget: AgDropTarget<TDragSourceType, TDragItem, TDragAndDropIcon, TDraggingEvent>): void;
hasExternalDropZones(): boolean;
findExternalZone(container: HTMLElement): AgDropTarget<TDragSourceType, TDragItem, TDragAndDropIcon, TDraggingEvent> | null;
}
export interface AgDragSource<TDragSourceType extends number, TDragItem, TDragAndDropIcon extends string, TDraggingEvent extends AgDraggingEvent<TDragSourceType, TDragItem, TDragAndDropIcon, TDraggingEvent>> {
/** The type of the drag source, used by the drop target to know where the drag originated from. */
type: TDragSourceType;
/** Can be used to identify a specific component as the source */
sourceId?: string;
/** Element which, when dragged, will kick off the DnD process */
eElement: Element;
/** If eElement is dragged, then the dragItem is the object that gets passed around. */
getDragItem: () => TDragItem;
/** This name appears in the drag and drop image component when dragging. */
dragItemName: ((draggingEvent?: TDraggingEvent | null) => string | null | undefined) | string | null;
/** Icon to show when not over a drop zone */
getDefaultIconName?: () => TDragAndDropIcon;
/** The drag source DOM Data Key, this is useful to detect if the origin grid is the same as the target grid. */
dragSourceDomDataKey?: string;
/** After how many pixels of dragging should the drag operation start. Default is 4. */
dragStartPixels?: number;
/** Callback for drag started */
onDragStarted?: () => void;
/** Callback for drag stopped */
onDragStopped?: () => void;
/** Callback for drag cancelled */
onDragCancelled?: () => void;
}
export interface AgDraggingEvent<TDragSourceType extends number, TDragItem, TDragAndDropIcon extends string, TDraggingEvent extends AgDraggingEvent<TDragSourceType, TDragItem, TDragAndDropIcon, TDraggingEvent>, TDrop = any> {
/** The mouse event that triggered the dragging event */
event: MouseEvent;
/** The X position in pixel relative to the drop target */
x: number;
/** The Y position in pixel relative to the drop target */
y: number;
/** The vertical direction of the drag, can be 'up', 'down' or null */
vDirection: VerticalDirection | null;
/** The horizontal direction of the drag, can be 'left', 'right' or null */
hDirection: HorizontalDirection | null;
/** The x-offset of the pointer from the drag source when the drag operation started */
initialSourcePointerOffsetX: number;
/** The y-offset of the pointer from the drag source when the drag operation started */
initialSourcePointerOffsetY: number;
/** The drag source that initiated the drag */
dragSource: AgDragSource<TDragSourceType, TDragItem, TDragAndDropIcon, TDraggingEvent>;
/** The drag item that is being dragged */
dragItem: TDragItem;
fromNudge: boolean;
/** The target element where the drop is happening */
dropZoneTarget: HTMLElement;
/** Details about the row dragging drop target. */
dropTarget: TDrop | null;
/** True if relevant information about the drop target are changed and the drag ghost need to be updated */
changed: boolean;
}
export interface AgDropTarget<TDragSourceType extends number, TDragItem, TDragAndDropIcon extends string, TDraggingEvent extends AgDraggingEvent<TDragSourceType, TDragItem, TDragAndDropIcon, TDraggingEvent>> {
/** The main container that will get the drop. */
getContainer(): HTMLElement;
/** If any secondary containers. For example when moving columns in AG Grid, we listen for drops
* in the header as well as the body (main rows and pinned rows) of the grid. */
getSecondaryContainers?(): HTMLElement[][];
/** Icon to show when drag is over */
getIconName?(draggingEvent?: TDraggingEvent | null | undefined): TDragAndDropIcon | null | undefined;
isInterestedIn(type: TDragSourceType, el: Element): boolean;
/**
* If `true`, the DragSources will only be allowed to be dragged within the DragTarget that contains them.
* This is useful for changing order of items within a container, and not moving items across containers.
* @default false
*/
targetContainsSource?: boolean;
/** Callback for when drag enters */
onDragEnter?(params: TDraggingEvent): void;
/** Callback for when drag leaves */
onDragLeave?(params: TDraggingEvent): void;
/** Callback for when dragging */
onDragging?(params: TDraggingEvent): void;
/** Callback for when drag stops */
onDragStop?(params: TDraggingEvent): void;
/** Callback for when the drag is cancelled */
onDragCancel?(params: TDraggingEvent): void;
external?: boolean;
}
export interface IDragAndDropImage {
setIcon(iconName: string | null, shake: boolean): void;
setLabel(label: string): void;
}
+6
View File
@@ -0,0 +1,6 @@
export interface IEnvironment {
readonly beanName: 'environment';
addGlobalCSS(css: string, debugId: string): void;
applyThemeClasses(el: HTMLElement): void;
getDefaultListItemHeight(): number;
}
+18
View File
@@ -0,0 +1,18 @@
import type { AgEvent } from './agEvent';
import type { BaseEvents } from './baseEvents';
export type AgEventServiceGlobalListener<TEventType extends keyof TGlobalEvents & string, TGlobalEvents extends BaseEvents> = (eventType: TEventType, event: TGlobalEvents[TEventType] & AgEvent<TEventType>) => void;
export type AgEventServiceListener<TGlobalEvents, TEventType extends keyof TGlobalEvents & string> = (params: TGlobalEvents[TEventType]) => void;
export type WithoutCommon<TCommon, T> = Omit<T, keyof TCommon>;
export type AgRawEvents<TGlobalEvents extends BaseEvents, TCommon> = {
[K in keyof TGlobalEvents]: WithoutCommon<TCommon, TGlobalEvents[K]>;
}[keyof TGlobalEvents];
export interface AgEventService<TGlobalEvents extends BaseEvents, TCommon> {
readonly eventServiceType: 'global';
readonly beanName: 'eventSvc';
addListener<TEventType extends keyof TGlobalEvents & string>(eventType: TEventType, listener: AgEventServiceListener<TGlobalEvents, TEventType>, async?: boolean): void;
removeListener<TEventType extends keyof TGlobalEvents & string>(eventType: TEventType, listener: AgEventServiceListener<TGlobalEvents, TEventType>, async?: boolean): void;
addGlobalListener(listener: AgEventServiceGlobalListener<keyof TGlobalEvents & string, TGlobalEvents>, async?: boolean): void;
removeGlobalListener(listener: AgEventServiceGlobalListener<keyof TGlobalEvents & string, TGlobalEvents>, async?: boolean): void;
dispatchEvent(event: AgRawEvents<TGlobalEvents, TCommon> | BaseEvents[keyof BaseEvents]): void;
dispatchEventOnce(event: AgRawEvents<TGlobalEvents, TCommon> | BaseEvents[keyof BaseEvents]): void;
}
+14
View File
@@ -0,0 +1,14 @@
import type { AgEvent } from './agEvent';
export type IEventListener<TEventType extends string> = (params: AgEvent<TEventType>) => void;
export type IGlobalEventListener<TEventType extends string> = (eventType: TEventType, event: AgEvent<TEventType>) => void;
export interface IEventEmitter<TEventType extends string> {
addEventListener(eventType: TEventType, listener: IEventListener<TEventType>, async?: boolean, options?: AddEventListenerOptions): void;
removeEventListener(eventType: TEventType, listener: IEventListener<TEventType>, async?: boolean, options?: AddEventListenerOptions): void;
}
/** Internal version of IEventEmitter so that we can avoid the public api methods on RowNode and Column that need
* to handle the Angular Zone wrapping of event handlers.
*/
export interface IAgEventEmitter<TEventType extends string> {
__addEventListener(eventType: TEventType, listener: IEventListener<TEventType>, async?: boolean, options?: AddEventListenerOptions): void;
__removeEventListener(eventType: TEventType, listener: IEventListener<TEventType>, async?: boolean, options?: AddEventListenerOptions): void;
}
+1
View File
@@ -0,0 +1 @@
export type IconValue = 'expanded' | 'contracted' | 'tree-closed' | 'tree-open' | 'tree-indeterminate' | 'pin' | 'eye-slash' | 'arrows' | 'left' | 'right' | 'group' | 'aggregation' | 'pivot' | 'not-allowed' | 'chart' | 'cross' | 'cancel' | 'tick' | 'first' | 'previous' | 'next' | 'last' | 'linked' | 'unlinked' | 'color-picker' | 'loading' | 'menu' | 'menu-alt' | 'filter' | 'filter-add' | 'columns' | 'maximize' | 'minimize' | 'copy' | 'cut' | 'paste' | 'grip' | 'save' | 'csv' | 'excel' | 'small-down' | 'small-left' | 'small-right' | 'small-up' | 'asc' | 'desc' | 'aasc' | 'adesc' | 'none' | 'up' | 'down' | 'plus' | 'minus' | 'settings' | 'checkbox-checked' | 'checkbox-indeterminate' | 'checkbox-unchecked' | 'radio-button-on' | 'radio-button-off' | 'eye' | 'column-arrow' | 'un-pin' | 'pinned-bottom' | 'pinned-top' | 'chevron-up' | 'chevron-down' | 'chevron-left' | 'chevron-right' | 'edit';
+4
View File
@@ -0,0 +1,4 @@
export interface IIconService<TIconName extends string, TParams> {
readonly beanName: 'iconSvc';
createIconNoSpan(iconName: TIconName, params?: TParams): Element | undefined;
}
+5
View File
@@ -0,0 +1,5 @@
export interface ILocaleService<TKey extends string = string> {
readonly beanName: 'localeSvc';
getLocaleTextFunc(): LocaleTextFunc<TKey>;
}
export type LocaleTextFunc<TKey extends string = string> = (key: TKey, defaultValue: string, variableValues?: string[]) => string;
+61
View File
@@ -0,0 +1,61 @@
import type { AfterGuiAttachedParams } from './iAfterGuiAttachedParams';
export type AddPopupParams<TContainerType extends string> = LabelAddPopupParams<TContainerType> | OwnsAddPopupParams<TContainerType>;
interface BaseAddPopupParams<TContainerType extends string> {
modal?: boolean;
eChild: HTMLElement;
closeOnEsc?: boolean;
closedCallback?: (e?: MouseEvent | TouchEvent | KeyboardEvent) => void;
click?: MouseEvent | Touch | null;
alwaysOnTop?: boolean;
afterGuiAttached?: (params: AfterGuiAttachedParams<TContainerType>) => void;
positionCallback?: () => void;
anchorToElement?: HTMLElement;
}
interface LabelAddPopupParams<TContainerType extends string> extends BaseAddPopupParams<TContainerType> {
ariaLabel: string;
ariaOwns?: never;
}
interface OwnsAddPopupParams<TContainerType extends string> extends BaseAddPopupParams<TContainerType> {
ariaLabel?: never;
ariaOwns: HTMLElement;
}
export interface PopupEventParams {
originalMouseEvent?: MouseEvent | Touch | null;
mouseEvent?: MouseEvent;
touchEvent?: TouchEvent;
keyboardEvent?: KeyboardEvent;
forceHide?: boolean;
}
export interface AddPopupResult {
hideFunc: (params?: PopupEventParams) => void;
}
interface BasePopupPositionParams<TParams> {
ePopup: HTMLElement;
additionalParams?: TParams;
}
export interface AgPopupPositionParams<TParams> extends BasePopupPositionParams<TParams> {
nudgeX?: number;
nudgeY?: number;
position?: 'over' | 'under';
alignSide?: 'left' | 'right';
keepWithinBounds?: boolean;
skipObserver?: boolean;
updatePosition?: () => {
x: number;
y: number;
};
postProcessCallback?: () => void;
}
export interface AgComponentPopupPositionParams<TParams> extends AgPopupPositionParams<TParams> {
type: string;
eventSource: HTMLElement;
}
export interface AgMousePopupPositionParams<TParams> extends AgPopupPositionParams<TParams> {
type: string;
mouseEvent: MouseEvent | Touch;
}
export interface AgMenuPopupPositionParams<TParams> extends BasePopupPositionParams<TParams> {
eventSource: HTMLElement;
event?: MouseEvent | KeyboardEvent;
}
export {};
+11
View File
@@ -0,0 +1,11 @@
import type { IComponent } from './iComponent';
export interface IPopupComponent<T> extends IComponent<T> {
/** Gets called once after initialised. If you return true, the component will appear in a popup, and it will be
* constrained to the boundaries of the popupParent. This is great if you want to, for example, provide you own
* custom dropdown list for selection. Default is false (ie if you don't provide the method). */
isPopup?(): boolean;
/** Called when focus is within the component */
focusIn?(): void;
/** Called when focus is leaving the component */
focusOut?(): void;
}
+18
View File
@@ -0,0 +1,18 @@
import type { AddPopupParams, AddPopupResult, AgComponentPopupPositionParams, AgMenuPopupPositionParams, AgMousePopupPositionParams, AgPopupPositionParams } from './iPopup';
export interface IPopupService<TPopupPositionParams> {
readonly beanName: 'popupSvc';
getPopupParent(): HTMLElement;
addPopup<TContainerType extends string>(params: AddPopupParams<TContainerType>): AddPopupResult;
positionPopupByComponent(params: AgComponentPopupPositionParams<TPopupPositionParams>): void;
positionPopupUnderMouseEvent(params: AgMousePopupPositionParams<TPopupPositionParams>): void;
positionPopupForMenu(params: AgMenuPopupPositionParams<TPopupPositionParams>): void;
positionPopup(params: AgPopupPositionParams<TPopupPositionParams>): void;
callPostProcessPopup(params: TPopupPositionParams | undefined, type: string, ePopup: HTMLElement, eventSource?: HTMLElement | null, mouseEvent?: MouseEvent | Touch | null): void;
bringPopupToFront(ePopup: HTMLElement): void;
getParentRect(): {
top: number;
left: number;
right: number;
bottom: number;
};
}
+36
View File
@@ -0,0 +1,36 @@
import type { AgEvent } from './agEvent';
import type { BaseProperties } from './baseProperties';
import type { WithoutCommon } from './iEvent';
export type AgPropertyChangedSource = 'api' | 'optionsUpdated';
export interface AgPropertyChangeSet<TProperties extends BaseProperties> {
/** Unique id which can be used to link changes of multiple properties that were updated together.
* i.e a user updated multiple properties at the same time.
*/
id: number;
/** All the properties that have been updated in this change set */
properties: (keyof TProperties)[];
}
export interface AgPropertyChangedEvent<TProperties extends BaseProperties> extends AgEvent {
type: 'propertyChanged';
changeSet: AgPropertyChangeSet<TProperties> | undefined;
source: AgPropertyChangedSource;
}
export type AgPropertyKey<TProperties extends BaseProperties> = keyof TProperties & string;
export interface AgPropertyValueChangedEvent<TProperties extends BaseProperties, K extends AgPropertyKey<TProperties>> extends AgEvent {
type: K;
changeSet: AgPropertyChangeSet<TProperties> | undefined;
currentValue: TProperties[K];
previousValue: TProperties[K];
source: AgPropertyChangedSource;
}
export type AgPropertyChangedListener<TProperties extends BaseProperties> = (event: AgPropertyChangedEvent<TProperties>) => void;
export type AgPropertyValueChangedListener<TProperties extends BaseProperties, K extends AgPropertyKey<TProperties>> = (event: AgPropertyValueChangedEvent<TProperties, K>) => void;
export interface IPropertiesService<TProperties extends BaseProperties, TCommon> {
readonly beanName: 'gos';
addPropertyEventListener<K extends keyof TProperties & string>(event: K, listener: AgPropertyValueChangedListener<TProperties, K>): void;
removePropertyEventListener<K extends keyof TProperties & string>(event: K, listener: AgPropertyValueChangedListener<TProperties, K>): void;
get<K extends AgPropertyKey<TProperties>>(property: K): TProperties[K];
addCommon<T extends TCommon>(params: WithoutCommon<TCommon, T>): T;
setInstanceDomData(element: HTMLElement): void;
isElementInThisInstance(element: HTMLElement): boolean;
}
+5
View File
@@ -0,0 +1,5 @@
import type { AgCoreBean } from './agCoreBean';
export interface IRegistry<TBeanCollection, TDynamicBeanName extends string> {
readonly beanName: 'registry';
createDynamicBean<T extends AgCoreBean<TBeanCollection>>(name: TDynamicBeanName, mandatory: boolean, ...args: any[]): T | undefined;
}
+18
View File
@@ -0,0 +1,18 @@
export interface ITooltipFeature {
setTooltipAndRefresh(tooltip: any): void;
refreshTooltip(clearWithEmptyString?: boolean): void;
attemptToShowTooltip(): void;
attemptToHideTooltip(): void;
destroy(): void;
}
export interface TooltipCtrl<TLocation extends string, TParams> {
getTooltipValue?(): any;
getGui(): HTMLElement;
getLocation?(): TLocation | 'UNKNOWN';
getTooltipShowDelayOverride?(): number;
getTooltipSwitchShowDelayOverride?(): number;
getTooltipHideDelayOverride?(): number;
shouldDisplayTooltip?(): boolean;
/** Additional params to be passed to the tooltip */
getAdditionalParams?(): TParams;
}
+12
View File
@@ -0,0 +1,12 @@
import { AgComponentStub } from '../core/agComponentStub';
import type { AgComponent } from '../interfaces/agComponent';
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { IPopupComponent } from '../interfaces/iPopupComponent';
import type { IPropertiesService } from '../interfaces/iProperties';
export declare class AgPopupComponent<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>, TComponentSelectorType extends string> extends AgComponentStub<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService, TComponentSelectorType> implements IPopupComponent<any> {
isPopup(): boolean;
setParentComponent(container: AgComponent<TBeanCollection, TProperties, TGlobalEvents, any>): void;
destroy(): void;
}
+59
View File
@@ -0,0 +1,59 @@
import { Direction } from '../constants/direction';
import { AgBeanStub } from '../core/agBeanStub';
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { AddPopupParams, AddPopupResult, AgComponentPopupPositionParams, AgMenuPopupPositionParams, AgMousePopupPositionParams, AgPopupPositionParams, PopupEventParams } from '../interfaces/iPopup';
import type { IPopupService } from '../interfaces/iPopupService';
import type { IPropertiesService } from '../interfaces/iProperties';
import { AgPromise } from '../utils/promise';
interface AgPopup {
element: HTMLElement;
wrapper: HTMLElement;
hideFunc: (params?: PopupEventParams) => void;
isAnchored: boolean;
instanceId: number;
alignedToElement?: HTMLElement;
stopAnchoringPromise?: AgPromise<() => void>;
}
export declare abstract class BasePopupService<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>, TPopupPositionParams> extends AgBeanStub<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService> implements IPopupService<TPopupPositionParams> {
beanName: "popupSvc";
protected popupList: AgPopup[];
postConstruct(): void;
getPopupParent(): HTMLElement;
protected abstract getDefaultPopupParent(): HTMLElement;
positionPopupUnderMouseEvent(params: AgMousePopupPositionParams<TPopupPositionParams>): void;
private calculatePointerAlign;
positionPopupByComponent(params: AgComponentPopupPositionParams<TPopupPositionParams>): void;
positionPopupForMenu(params: AgMenuPopupPositionParams<TPopupPositionParams>): void;
private shouldRenderUnderOrAbove;
protected setAlignedStyles(ePopup: HTMLElement, positioned: 'right' | 'left' | 'over' | 'above' | 'under' | null): void;
protected setAlignedTo(eventSource: HTMLElement, ePopup: HTMLElement): void;
abstract callPostProcessPopup(params: TPopupPositionParams | undefined, type: string, ePopup: HTMLElement, eventSource?: HTMLElement | null, mouseEvent?: MouseEvent | Touch | null): void;
positionPopup(params: AgPopupPositionParams<TPopupPositionParams>): void;
getParentRect(): {
top: number;
left: number;
right: number;
bottom: number;
};
protected keepXYWithinBounds(ePopup: HTMLElement, position: number, direction: Direction): number;
addPopup<TContainerType extends string>(params: AddPopupParams<TContainerType>): AddPopupResult;
private initialisePopupPosition;
private createPopupWrapper;
protected abstract isStopPropagation(event: Event): boolean;
private addEventListenersToPopup;
private addPopupToPopupList;
private getPopupIndex;
setPopupPositionRelatedToElement(popupEl: HTMLElement, relativeElement?: HTMLElement | null): AgPromise<() => void> | undefined;
private removePopupFromPopupList;
private keepPopupPositionedRelativeTo;
private isEventFromCurrentPopup;
isElementWithinCustomPopup(el: HTMLElement): boolean;
private getWrapper;
private setAlwaysOnTop;
/** @returns true if moved */
bringPopupToFront(ePopup: HTMLElement): void;
private handleThemeChange;
}
export {};
@@ -0,0 +1,97 @@
import { AgBeanStub } from '../core/agBeanStub';
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { IPopupService } from '../interfaces/iPopupService';
import type { IPropertiesService } from '../interfaces/iProperties';
export interface PositionableOptions {
popup?: boolean;
minWidth?: number | null;
width?: number | string | null;
minHeight?: number | null;
height?: number | string | null;
centered?: boolean | null;
calculateTopBuffer?: () => number;
/**
* Used for when a popup needs to be resized by an element within itself
* In that case, the feature will configured as `popup=false` but the offsetParent
* needs to be the popupParent.
*/
forcePopupParentAsOffsetParent?: boolean;
x?: number | null;
y?: number | null;
}
export type ResizableSides = 'topLeft' | 'top' | 'topRight' | 'right' | 'bottomRight' | 'bottom' | 'bottomLeft' | 'left';
export type ResizableStructure = {
[key in ResizableSides]?: boolean;
};
type PositionableFeatureEvent = 'resize';
export declare class AgPositionableFeature<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>> extends AgBeanStub<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService, PositionableFeatureEvent> {
private readonly element;
protected popupSvc?: IPopupService<any>;
private dragSvc?;
wireBeans(beans: TBeanCollection): void;
private dragStartPosition;
private readonly position;
private readonly lastSize;
private resizerMap;
private minWidth;
private minHeight?;
private positioned;
private resizersAdded;
private readonly config;
private readonly resizeListeners;
private moveElementDragListener;
private offsetParent;
private boundaryEl;
private isResizing;
private isMoving;
private resizable;
private movable;
private currentResizer;
private resizeObserverSubscriber;
constructor(element: HTMLElement, config?: PositionableOptions);
center(postProcessCallback?: () => void): void;
initialisePosition(postProcessCallback?: () => void): void;
isPositioned(): boolean;
getPosition(): {
x: number;
y: number;
};
setMovable(movable: boolean, moveElement: HTMLElement): void;
setResizable(resizable: boolean | ResizableStructure): void;
removeSizeFromEl(): void;
restoreLastSize(): void;
getHeight(): number | undefined;
setHeight(height: number | string): void;
private getAvailableHeight;
getWidth(): number | undefined;
setWidth(width: number | string): void;
offsetElement(x?: number, y?: number, postProcessCallback?: () => void): void;
constrainSizeToAvailableHeight(constrain: boolean): void;
private setPosition;
private updateDragStartPosition;
private calculateMouseMovement;
private shouldSkipX;
private shouldSkipY;
private createResizeMap;
private addResizers;
private removeResizers;
private getResizerElement;
private onResizeStart;
private getSiblings;
private getMinSizeOfSiblings;
private applySizeToSiblings;
isResizable(): boolean;
private onResize;
private onResizeEnd;
private refreshSize;
private onMoveStart;
private onMove;
private onMoveEnd;
private setOffsetParent;
private findBoundaryElement;
private clearResizeListeners;
destroy(): void;
}
export {};
+37
View File
@@ -0,0 +1,37 @@
export declare class AutoScrollService {
private tickingInterval;
private readonly scrollHorizontally;
private readonly scrollVertically;
private tickLeft;
private tickRight;
private tickUp;
private tickDown;
private readonly scrollContainer;
private readonly scrollByTick;
private readonly getVerticalPosition;
private readonly setVerticalPosition;
private readonly getHorizontalPosition;
private readonly setHorizontalPosition;
private readonly shouldSkipVerticalScroll;
private readonly shouldSkipHorizontalScroll;
private readonly onScrollCallback;
private tickCount;
/** True while auto-scrolling */
get scrolling(): boolean;
constructor(params: {
scrollContainer: HTMLElement;
scrollAxis: 'x' | 'y' | 'xy';
scrollByTick?: number;
getVerticalPosition?: () => number;
setVerticalPosition?: (position: number) => void;
getHorizontalPosition?: () => number;
setHorizontalPosition?: (position: number) => void;
shouldSkipVerticalScroll?: () => boolean;
shouldSkipHorizontalScroll?: () => boolean;
onScrollCallback?: () => void;
});
check(mouseEvent: MouseEvent | Touch, forceSkipVerticalScroll?: boolean): void;
private ensureTickingStarted;
private doTick;
ensureCleared(): void;
}
+6
View File
@@ -0,0 +1,6 @@
export declare class CssClassManager {
private readonly getGui;
private cssClassStates;
constructor(getGui: () => HTMLElement | undefined | null);
toggleCss(className: string, addOrRemove: boolean): void;
}
+8
View File
@@ -0,0 +1,8 @@
import type { IEnvironment } from '../interfaces/iEnvironment';
export declare const IS_SSR: boolean;
/** For testing, if true, only Vanilla examples will work and they will use legacy themes. */
export declare const FORCE_LEGACY_THEMES = false;
export declare const _injectGlobalCSS: (css: string, styleContainer: HTMLElement, debugId: string, layer: string | undefined, priority: number, nonce: string | undefined, isParams?: boolean) => void;
export declare const _injectCoreAndModuleCSS: (styleContainer: HTMLElement, layer: string | undefined, nonce: string | undefined, moduleCss: Map<string, string[]> | undefined) => void;
export declare const _useParamsCss: (environment: IEnvironment, paramsCss: string | null, paramsDebugId: string | null, styleContainer: HTMLElement, layer: string | undefined, nonce: string | undefined) => void;
export declare const _unregisterInstanceUsingThemingAPI: (environment: IEnvironment) => void;
+9
View File
@@ -0,0 +1,9 @@
/**
* A collection of CSS styles and default parameter values that can be added to
* a theme. Parts are created with the createPart helper function.
*/
export type Part<TParams = unknown> = {
readonly feature?: string;
readonly modeParams: Record<string, TParams>;
readonly css?: string | (() => string);
};
+56
View File
@@ -0,0 +1,56 @@
import type { Part } from './part';
import type { Feature, WithParamTypes } from './themeTypes';
type AnyString = string & {};
type ExpandTypeKeys<T> = T extends infer O ? {
[K in keyof O]: O[K];
} : never;
type CreatePartArgs<T> = {
/**
* A string feature, e.g. 'iconSet'. Adding a part to a theme will remove
* any existing part with the same feature.
*/
feature?: Feature | AnyString;
/**
* Default parameters for the part.
*/
params?: WithParamTypes<T>;
/**
* Parameters for different theme modes, e.g. 'dark' or 'light'. Setting
* `modeParams: {myMode: {myColor: 'red'}}` on a theme part is the equivalent
* of `theme.withParams({myColor: 'red'}, 'myMode')`.
*/
modeParams?: Record<string, WithParamTypes<T>>;
/**
* CSS styles associated with this part. The CSS will be injected into the
* page when the theme is used by a grid.
*
* The grid uses CSS nested to wrap this CSS in a selector that ensures it
* only applies to grids that are using a theme containing this part.
*/
css?: string | (() => string);
/**
* URLs of CSS files to import before the part's CSS.
*/
cssImports?: string[];
};
/**
* Create a new empty part.
*
* @param feature an The part feature, e.g. 'iconSet'. Adding a part to a theme will remove any existing part with the same feature.
* @param variant an optional identifier for debugging, if omitted one will be generated
*/
export declare const createPart: <T = unknown>(args: CreatePartArgs<T>) => Part<ExpandTypeKeys<WithParamTypes<T>>>;
export declare const defaultModeName = "$default";
export declare class PartImpl implements Part {
feature?: string;
modeParams: Record<string, Record<string, unknown>>;
css?: string | (() => string);
cssImports?: string[];
_inject?: {
css: string;
class: string;
} | false;
constructor({ feature, params, modeParams, css, cssImports }: CreatePartArgs<unknown>);
use(styleContainer: HTMLElement | undefined, layer: string | undefined, nonce: string | undefined): string | false;
}
export {};
+275
View File
@@ -0,0 +1,275 @@
import type { BorderValue, ColorSchemeValue, ColorValue, FontFamilyValue, FontWeightValue, LengthValue, ScaleValue, ShadowValue } from '../themeTypes';
export interface SharedThemeParams {
/**
* The 'brand color' for the grid, used wherever a non-neutral color is required. Selections, focus outlines and checkboxes use the accent color by default.
*/
accentColor: ColorValue;
/**
* Background color of the grid. Many UI elements are semi-transparent, so their color blends with the background color.
*/
backgroundColor: ColorValue;
/**
* Default color for borders.
*/
borderColor: ColorValue;
/**
* Default width for borders.
*/
borderWidth: LengthValue;
/**
* Default corner radius for many UI elements such as menus, dialogs and form widgets.
*/
borderRadius: LengthValue;
/**
* The CSS color-scheme to apply to the grid, which affects the default appearance of browser scrollbars form inputs unless these have been styled with CSS.
*/
browserColorScheme: ColorSchemeValue;
/**
* Default shadow for elements that float above the grid and are intended to appear elevated byt still attached e.g. dropdowns and cell editors
*/
cardShadow: ShadowValue;
/**
* Background color for non-data areas of the grid. Headers, tool panels and menus use this color by default.
*/
chromeBackgroundColor: ColorValue;
/**
* Font size for data in grid rows
*/
dataFontSize: LengthValue;
/**
* Border color popup dialogs such as the integrated charts and the advanced filter builder.
*/
dialogBorder: BorderValue;
/**
* Shadow for popup dialogs such as the integrated charts and the advanced filter builder.
*/
dialogShadow: ShadowValue;
/**
* Background color of the drag and drop image component element when dragging columns or rows
*/
dragAndDropImageBackgroundColor: ColorValue;
/**
* Border color of the drag and drop image component element when dragging columns or rows
*/
dragAndDropImageBorder: BorderValue;
/**
* Border color of the drag and drop image component element when dragging columns or rows
*/
dragAndDropImageNotAllowedBorder: BorderValue;
/**
* Shadow for the drag and drop image component element when dragging columns
*/
dragAndDropImageShadow: ShadowValue;
/**
* Default shadow for dropdown menus
*/
dropdownShadow: ShadowValue;
/**
* Shadow around UI controls that have focus e.g. text inputs and buttons. The value must a valid CSS box-shadow.
*/
focusShadow: ShadowValue;
/**
* 'Shadow around UI controls that have focus and contain validation errors e.g. text inputs, text-areas. The value must a valid CSS box-shadow.',
*/
focusErrorShadow: ShadowValue;
/**
* Default font family for all text. Can be overridden by more specific parameters like `headerFontFamily`
*/
fontFamily: FontFamilyValue;
/**
* Default font size for text throughout the grid UI
*/
fontSize: LengthValue;
/**
* Default color for neutral UI elements. Most text, borders and backgrounds are defined as semi-transparent versions of this color, resulting in a blend between the background and foreground colours.
*/
foregroundColor: ColorValue;
/**
* Background color for header and header-like components
*/
headerBackgroundColor: ColorValue;
/**
* Font family of text in the header and header-like components
*/
headerFontFamily: FontFamilyValue;
/**
* Size of text in the header and header-like components
*/
headerFontSize: LengthValue;
/**
* Font weight of text in the header and header-like components
*/
headerFontWeight: FontWeightValue;
/**
* Height of header and header-like components. NOTE: by default this value is calculated to leave enough room for text, icons and padding. Most applications should leave it as is and use headerVerticalPaddingScale to change padding.
*/
headerHeight: LengthValue;
/**
* Color of text in the header and header-like components
*/
headerTextColor: ColorValue;
/**
* Multiply the header vertical padding by a number, e.g. 1.5 to increase by 50%
*/
headerVerticalPaddingScale: ScaleValue;
/**
* Color for icons, or `inherit` to take on the text color of the containing component
*/
iconColor: ColorValue;
/**
* The size of square icons and icon-buttons
*/
iconSize: LengthValue;
/**
* The color for inputs and UI controls in an invalid state.
*/
invalidColor: ColorValue;
/**
* Height of items in scrolling lists e.g. dropdown select inputs and column menu set filters.
*/
listItemHeight: LengthValue;
/**
* Background color for menus e.g. column menu and right-click context menu
*/
menuBackgroundColor: ColorValue;
/**
* Border around menus e.g. column menu and right-click context menu
*/
menuBorder: BorderValue;
/**
* Color of the dividing line between sections of menus e.g. column menu and right-click context menu
*/
menuSeparatorColor: ColorValue;
/**
* Shadow for menus e.g. column menu and right-click context menu
*/
menuShadow: ShadowValue;
/**
* Text color for menus e.g. column menu and right-click context menu
*/
menuTextColor: ColorValue;
/**
* Background color for panels and dialogs such as the integrated charts and the advanced filter builder.
*/
panelBackgroundColor: ColorValue;
/**
* The height of the title bar of panels and dialogs such as the integrated charts panel and the advanced filter builder.
*/
panelTitleBarHeight: LengthValue;
/**
* Background color for the title bar of panels and dialogs such as the integrated charts and the advanced filter builder.
*/
panelTitleBarBackgroundColor: ColorValue;
/**
* Text color for the title bar of panels and dialogs such as the integrated charts and the advanced filter builder.
*/
panelTitleBarTextColor: ColorValue;
/**
* Icon color for the title bar of panels and dialogs such as the integrated charts and the advanced filter builder.
*/
panelTitleBarIconColor: ColorValue;
/**
* Font family for the title bar of panels and dialogs such as the integrated charts and the advanced filter builder.
*/
panelTitleBarFontFamily: FontFamilyValue;
/**
* Size of text for the title bar of panels and dialogs such as the integrated charts and the advanced filter builder.
*/
panelTitleBarFontSize: LengthValue;
/**
* Font weight for the title bar of panels and dialogs such as the integrated charts and the advanced filter builder.
*/
panelTitleBarFontWeight: FontWeightValue;
/**
* Border below the title bar of panels and dialogs such as the integrated charts and the advanced filter builder.
*/
panelTitleBarBorder: BorderValue;
/**
* Default shadow for elements that float above the grid and are intended to appear separated from it e.g. dialogs and menus
*/
popupShadow: ShadowValue;
/**
* Amount of spacing around and inside UI elements. All padding and margins in the grid are defined as a multiple of this value.
*/
spacing: LengthValue;
/**
* Color of text and UI elements that should stand out less than the default.
*/
subtleTextColor: ColorValue;
/**
* Default color for all text
*/
textColor: ColorValue;
/**
* Width of the whole toggle button component
*/
toggleButtonWidth: LengthValue;
/**
* Height of the whole toggle button component
*/
toggleButtonHeight: LengthValue;
/**
* Color of the toggle button background in its 'off' state
*/
toggleButtonOffBackgroundColor: ColorValue;
/**
* Color of the toggle button background in its 'on' state
*/
toggleButtonOnBackgroundColor: ColorValue;
/**
* Background color of the toggle button switch (the bit that slides from left to right)
*/
toggleButtonSwitchBackgroundColor: ColorValue;
/**
* The amount that the toggle switch is inset from the edge of the button
*/
toggleButtonSwitchInset: LengthValue;
/**
* Background color for tooltips
*/
tooltipBackgroundColor: ColorValue;
/**
* Background color for tooltips showing errors
*/
tooltipErrorBackgroundColor: ColorValue;
/**
* Border for tooltips
*/
tooltipBorder: BorderValue;
/**
* Border for tooltips showing errors
*/
tooltipErrorBorder: BorderValue;
/**
* Text color for tooltips
*/
tooltipTextColor: ColorValue;
/**
* Text color for tooltips showing errors
*/
tooltipErrorTextColor: ColorValue;
/**
* The horizontal padding of containers that contain stacked widgets, such as menus and tool panels
*/
widgetContainerHorizontalPadding: LengthValue;
/**
* The vertical padding of containers that contain stacked widgets, such as menus and tool panels
*/
widgetContainerVerticalPadding: LengthValue;
/**
* The spacing between widgets in containers arrange widgets horizontally
*/
widgetHorizontalSpacing: LengthValue;
/**
* The spacing between widgets in containers arrange widgets vertically
*/
widgetVerticalSpacing: LengthValue;
}
export declare const defaultLightColorSchemeParams: {
readonly backgroundColor: "#fff";
readonly foregroundColor: "#181d1f";
readonly borderColor: ColorValue;
readonly chromeBackgroundColor: ColorValue;
readonly browserColorScheme: "light";
};
export declare const sharedDefaults: Readonly<SharedThemeParams>;
@@ -0,0 +1 @@
export declare const sharedCSS = ":where([class^=ag-]),:where([class^=ag-]):after,:where([class^=ag-]):before{box-sizing:border-box}:where([class^=ag-]):where(button){color:inherit}:where([class^=ag-]):where(div,span,label):focus-visible{box-shadow:inset var(--ag-focus-shadow);outline:none;&:where(.invalid){box-shadow:inset var(--ag-focus-error-shadow)}}:where([class^=ag-]) ::-ms-clear{display:none}.ag-hidden{display:none!important}.ag-invisible{visibility:hidden!important}.ag-tab-guard{display:block;height:0;position:absolute;width:0}.ag-tab-guard-top{top:1px}.ag-tab-guard-bottom{bottom:1px}.ag-measurement-container{height:0;overflow:hidden;visibility:hidden;width:0}.ag-measurement-element-border{display:inline-block}.ag-measurement-element-border:before{border-left:var(--ag-internal-measurement-border);content:\"\";display:block}.ag-popup-child{top:0;z-index:5}.ag-popup-child:where(:not(.ag-tooltip-custom)){box-shadow:var(--ag-popup-shadow)}.ag-input-wrapper,.ag-picker-field-wrapper{align-items:center;display:flex;flex:1 1 auto;line-height:normal;position:relative}.ag-input-field{align-items:center;display:flex;flex-direction:row}.ag-input-field-input:where(:not([type=checkbox],[type=radio])){flex:1 1 auto;min-width:0;width:100%}.ag-chart,.ag-dnd-ghost,.ag-external,.ag-popup,.ag-root-wrapper{cursor:default;line-height:normal;white-space:normal;-webkit-font-smoothing:antialiased;background-color:var(--ag-background-color);color:var(--ag-text-color);color-scheme:var(--ag-browser-color-scheme);font-family:var(--ag-font-family);font-size:var(--ag-font-size);--ag-indentation-level:0}:where(.ag-icon):before{align-items:center;background-color:currentcolor;color:inherit;content:\"\";display:flex;font-family:inherit;font-size:var(--ag-icon-size);font-style:normal;font-variant:normal;height:var(--ag-icon-size);justify-content:center;line-height:var(--ag-icon-size);-webkit-mask-size:contain;mask-size:contain;text-transform:none;width:var(--ag-icon-size)}.ag-icon{background-position:50%;background-repeat:no-repeat;background-size:contain;color:var(--ag-icon-color);display:block;height:var(--ag-icon-size);position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--ag-icon-size)}.ag-disabled .ag-icon,[disabled] .ag-icon{opacity:.5}.ag-icon-grip.ag-disabled,.ag-icon-grip[disabled]{opacity:.35}.ag-resizer{pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:1}:where(.ag-resizer){&.ag-resizer-topLeft{cursor:nwse-resize;height:5px;left:0;top:0;width:5px}&.ag-resizer-top{cursor:ns-resize;height:5px;left:5px;right:5px;top:0}&.ag-resizer-topRight{cursor:nesw-resize;height:5px;right:0;top:0;width:5px}&.ag-resizer-right{bottom:5px;cursor:ew-resize;right:0;top:5px;width:5px}&.ag-resizer-bottomRight{bottom:0;cursor:nwse-resize;height:5px;right:0;width:5px}&.ag-resizer-bottom{bottom:0;cursor:ns-resize;height:5px;left:5px;right:5px}&.ag-resizer-bottomLeft{bottom:0;cursor:nesw-resize;height:5px;left:0;width:5px}&.ag-resizer-left{bottom:5px;cursor:ew-resize;left:0;top:5px;width:5px}}.ag-menu{background-color:var(--ag-menu-background-color);border:var(--ag-menu-border);border-radius:var(--ag-border-radius);box-shadow:var(--ag-menu-shadow);color:var(--ag-menu-text-color);max-height:100%;overflow-y:auto;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}";
+23
View File
@@ -0,0 +1,23 @@
import type { Part } from './part';
export type Theme<TParams = unknown> = {
/**
* Return a new theme that uses an theme part. The part will replace any
* existing part of the same feature
*
* @param part a part, or a no-arg function that returns a part
*/
withPart<TPartParams>(part: Part<TPartParams> | (() => Part<TPartParams>)): Theme<TParams & TPartParams>;
/**
* Return a new theme removes any existing part with a feature.
*
* @param feature the name of the part to remove, e.g. 'checkboxStyle'
*/
withoutPart(feature: string): Theme<TParams>;
/**
* Return a new theme with different default values for the specified
* params.
*
* @param defaults an object containing params e.g. {spacing: 10}
*/
withParams(defaults: Partial<TParams>, mode?: string): Theme<TParams>;
};
+44
View File
@@ -0,0 +1,44 @@
import type { Part } from './part';
import { PartImpl } from './partImpl';
import type { SharedThemeParams } from './shared/shared-css';
import type { Theme } from './theme';
import type { ThemeLogger } from './themeLogger';
import type { WithParamTypes } from './themeTypes';
export declare const _asThemeImpl: <TParams>(theme: Theme<TParams>) => ThemeImpl;
export declare const createSharedTheme: <TParams extends SharedThemeParams>(themeLogger: ThemeLogger, overridePrefix?: string) => Theme<TParams>;
type themeUseArgs = {
loadThemeGoogleFonts: boolean | undefined;
styleContainer: HTMLElement;
cssLayer: string | undefined;
nonce: string | undefined;
moduleCss: Map<string, string[]> | undefined;
};
export declare class ThemeImpl {
private readonly params;
readonly parts: PartImpl[];
constructor(params: {
themeLogger: ThemeLogger;
/**
* If a theme element is nested inside another theme element,
* this allows the child to inherit different variables than the parent
*/
overridePrefix?: string;
}, parts?: PartImpl[]);
withPart(part: Part | (() => Part)): ThemeImpl;
withoutPart(feature: string): ThemeImpl;
withParams(params: WithParamTypes<unknown>, mode?: string): ThemeImpl;
_startUse({ styleContainer, cssLayer, nonce, loadThemeGoogleFonts, moduleCss }: themeUseArgs): void;
private _cssClassCache?;
_getCssClass(this: ThemeImpl): string;
private _paramsClassName?;
_getParamsClassName(): string;
private _paramsCache?;
_getModeParams(): ModalParamValues;
private _paramsCssCache?;
_getParamsCss(): string;
}
type ParamValues = Record<string, unknown>;
type ModalParamValues = {
[mode: string]: ParamValues;
};
export {};
+23
View File
@@ -0,0 +1,23 @@
/** IDs match grid error IDs */
type ThemeErrorMap = {
104: ({ value, param, }: {
value: any;
param: string;
}) => `Numeric value ${number} passed to ${string} param will be interpreted as ${number} seconds. If this is intentional use "${number}s" to silence this warning.`;
107: ({ key, value }: {
key: string;
value: unknown;
}) => `Invalid value for theme param ${string} - ${string}`;
259: ({ part, }: {
part: any;
}) => `the argument to theme.withPart must be a Theming API part object, received: ${any}`;
};
type ThemeErrorId = keyof ThemeErrorMap;
type ThemeErrorValue<TId extends ThemeErrorId | null> = TId extends ThemeErrorId ? ThemeErrorMap[TId] : never;
type GetThemeErrorParams<TId extends ThemeErrorId> = ThemeErrorValue<TId> extends (params: infer P) => any ? (P extends Record<string, any> ? P : undefined) : never;
export type ThemeLogger = {
error: <TId extends ThemeErrorId, TShowMessageAtCallLocation = ThemeErrorMap[TId]>(...args: undefined extends GetThemeErrorParams<TId> ? [id: TId] : [id: TId, params: GetThemeErrorParams<TId>]) => void;
warn: <TId extends ThemeErrorId, TShowMessageAtCallLocation = ThemeErrorMap[TId]>(...args: undefined extends GetThemeErrorParams<TId> ? [id: TId] : [id: TId, params: GetThemeErrorParams<TId>]) => void;
preInitErr: <TId extends ThemeErrorId, TShowMessageAtCallLocation = ThemeErrorMap[TId]>(...args: undefined extends GetThemeErrorParams<TId> ? [id: TId, defaultMessage: string] : [id: TId, defaultMessage: string, params: GetThemeErrorParams<TId>]) => void;
};
export {};
+28
View File
@@ -0,0 +1,28 @@
import type { ThemeLogger } from './themeLogger';
import type { BorderValue, ColorValue, DurationValue, FontFamilyValue, ImageValue, LengthValue, ShadowValue } from './themeTypes';
export declare const paramTypes: readonly ["colorScheme", "color", "length", "scale", "borderStyle", "border", "shadow", "image", "fontFamily", "fontWeight", "duration"];
export type ParamType = (typeof paramTypes)[number];
/**
* Return the ParamType for a given param name,
*/
export declare const getParamType: (arg: string) => "length" | "image" | "colorScheme" | "fontFamily" | "color" | "scale" | "borderStyle" | "border" | "shadow" | "fontWeight" | "duration";
export declare const colorValueToCss: (value: ColorValue) => string | false;
export declare const colorSchemeValueToCss: (value: string | number | {
ref: string;
}) => string | false;
export declare const lengthValueToCss: (value: LengthValue) => string | false;
export declare const scaleValueToCss: (value: string | number | {
ref: string;
}) => string | false;
export declare const borderValueToCss: (value: BorderValue, param: string) => string;
export declare const shadowValueToCss: (value: ShadowValue) => string | false;
export declare const borderStyleValueToCss: (value: string | number | {
ref: string;
}) => string | false;
export declare const fontFamilyValueToCss: (value: FontFamilyValue) => string | false;
export declare const fontWeightValueToCss: (value: string | number | {
ref: string;
}) => string | false;
export declare const imageValueToCss: (value: ImageValue) => string | false;
export declare const durationValueToCss: (value: DurationValue, param: string, themeLogger: ThemeLogger) => string | false;
export declare const paramValueToCss: (param: string, value: unknown, themeLogger: ThemeLogger) => string | false;
+209
View File
@@ -0,0 +1,209 @@
export type Feature = 'colorScheme' | 'iconSet' | 'checkboxStyle' | 'inputStyle' | 'tabStyle';
export type WithParamTypes<T> = {
[K in keyof T]: K extends string ? ParamTypeForLowercaseKey<Lowercase<K>> : LengthValue;
};
type ParamTypeForLowercaseKey<K extends string> = K extends `${string}color` ? ColorValue : K extends `${string}colorscheme` ? ColorSchemeValue : K extends `${string}color` ? ColorValue : K extends `${string}scale` ? ScaleValue : K extends `${string}borderstyle` ? BorderStyleValue : K extends `${string}border` ? BorderValue : K extends `${string}shadow` ? ShadowValue : K extends `${string}image` ? ImageValue : K extends `${string}fontfamily` ? FontFamilyValue : K extends `${string}fontweight` ? FontWeightValue : K extends `${string}duration` ? DurationValue : LengthValue;
type AnyString = string & {};
/**
* The 'brand color' for the grid, used wherever a non-neutral color is
* required. Selections, focus outlines and checkboxes use the accent color by
* default.
*/
export type ColorValue = string | {
/**
* The name of the color parameter to reference
*/
ref: string;
/**
* Enable color mixing. Provide a value between 0 and 1 determining the amount of the referenced color used in the mix.
*
* By default, the referenced color will be mixed with `transparent` so 0 = fully transparent and 1 = fully opaque.
*/
mix?: number;
/**
* Provide a second color reference to mix with instead of `transparent`. This has no effect if `mix` is unspecified.
*/
onto?: string;
};
/**
* A CSS color-scheme value, e.g. "light", "dark", or "inherit" to use the
* same setting as the parent application
*
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
*/
export type ColorSchemeValue = 'light' | 'dark' | 'inherit' | 'normal' | AnyString | {
ref: string;
};
/**
* A CSS dimension value with length units, e.g. "1px" or "2em". Alternatively:
*
* - `4` -> "4px" (a plain JavaScript number will be given pixel units)
* - `{ref: "foo"}` -> use the same value as the `foo` param (`ref` must be a valid param name)
* - `{calc: "foo + bar * 2"}` -> Use a dynamically calculated expression. You can use param names like spacing and fontSize in the expression, as well as built-in CSS math functions like `min(spacing, fontSize)`
*/
export type LengthValue = number | string | {
/**
* An expression that can include param names and maths, e.g.
* "spacing * 2". NOTE: In CSS the `-` character is valid in variable
* names, so leave a space around it.
*/
calc: string;
} | {
ref: string;
};
/**
* A number without units.
*/
export type ScaleValue = number | {
ref: 'string';
};
/**
* A CSS border value e.g. "solid 1px red". Alternatively an object containing optional properties:
*
* - `style` -> a CSS border-style, default `"solid"`
* - `width` -> a width in pixels, default `{ref: "borderWidth"}` (and the default borderWidth is 1)
* - `color` -> a ColorValue as you would pass to any color param, default `{ref: "borderColor"}`
*
* Or a reference:
* - `{ref: "foo"}` -> use the same value as the `foo` param (`ref` must be a valid param name)
*
* Or boolean value
* - `true` -> `{}` (the default border style, equivalent to `{style: "solid", width: 1, color: {ref: "borderColor"}`)
* - `false` -> `"none"` (no border).
*
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/border
*/
export type BorderValue = string | boolean | {
style?: BorderStyleValue;
width?: LengthValue;
color?: ColorValue;
} | {
ref: string;
};
export type ShadowValueParams = {
/**
* Positive values move the shadow to the right, negative values move left
*
* @default 0
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow
*/
offsetX?: LengthValue;
/**
* Positive values move the shadow downwards, negative values move up
*
* @default 0
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow
*/
offsetY?: LengthValue;
/**
* Softness of the shadow. 0 = hard edge, 10 = 10px wide blur.
*
* @default 0
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow
*/
radius?: LengthValue;
/**
* Size of the shadow. 0 = same size as the shadow-casting element. 10 = 10px wider in all directions.
*
* @default 0
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow
*/
spread?: LengthValue;
/**
* Shadow color. Can accept any value that is valid for a color parameter, e.g. 'red' or {ref: 'accentColor'}
*
* @default {ref: 'foregroundColor'}
*/
color?: ColorValue;
/**
* Whether shadow is inset (an inner shadow instead of an outer shadow).
*
* @default false
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow
*/
inset?: boolean;
};
/**
* A CSS box shadow value e.g. "10px 5px 5px red;". Alternatively an object or array of objects containing optional properties:
*
* - `offsetX` -> number of pixels to move the shadow to the right, or a negative value to move left, default 0
* - `offsetY` -> number of pixels to move the shadow downwards, or a negative value to move up, default 0
* - `radius` -> softness of the shadow. 0 = hard edge, 10 = 10px wide blur
* - `spread` -> size of the shadow. 0 = same size as the shadow-casting element. 10 = 10px wider in all directions.
* - `color` -> color of the shadow e.g. `"red"`. Default `{ref: "foregroundColor"}`
* - `inset` -> whether shadow is inset, default false
*
* Or a reference:
* - `{ref: "foo"}` -> use the same value as the `foo` param (`ref` must be a valid param name)
*
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow
*/
export type ShadowValue = string | false | ShadowValueParams | ShadowValueParams[] | {
ref: string;
};
/**
* A CSS line-style value e.g. "solid" or "dashed".
*
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/line-style
*/
export type BorderStyleValue = 'none' | 'solid' | 'dotted' | 'dashed' | 'inset' | 'outset' | AnyString | {
ref: string;
};
/**
* A CSS font-family value consisting of a font name or comma-separated list of fonts in order of preference e.g. `"Roboto, -apple-system, 'Segoe UI', sans-serif"`. Alternatively:
*
* - `["Roboto", "-apple-system", "Segoe UI", "sans-serif"]` -> an array of font names in order of preference
* - `["Dave's Font"]` -> when passing an array, special characters in font names will automatically be escaped
* - `{ref: "foo"}` -> use the same value as `foo` which must be a valid font family param name
*
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/font-family
*/
export type FontFamilyValue = string | {
googleFont: string;
} | Array<string | {
googleFont: string;
}> | {
ref: string;
};
/**
* A CSS font-weight value e.g. `500` or `"bold"`
*
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight
*/
export type FontWeightValue = 'normal' | 'bold' | AnyString | number | {
ref: string;
};
/**
* A CSS image value e.g. `"url(...image-url...)"`. Alternatively:
*
* - `{svg: "...XML source of SVG image..."}` -> embed an SVG as a data: uri
* - `{url: "https://..."}` -> a URL to load an image asset from. Can be a HTTPS URL, or image assets such as PNGs can be converted to data: URLs
* - `{ref: "foo"}` -> use the same value as the `foo` param (`ref` must be a valid param name)
*
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/image
*/
export type ImageValue = string | {
/**
* The URL of an image. data: URLs can be used embed assets.
*/
url: string;
} | {
/**
* The XML text of an SVG file
*/
svg: string;
} | {
ref: string;
};
/**
* A CSS time value with second or millisecond units e.g. `"0.3s"` or `"300ms"`. Alternatively:
*
* - `0.4` -> "0.4s" (a plain JavaScript number is assumed to be a number of seconds.
* - `{ref: "foo"}` -> use the same value as the `foo` param (`ref` must be a valid param name)
*
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/animation-duration
*/
export type DurationValue = number | string | {
ref: string;
};
export {};
+12
View File
@@ -0,0 +1,12 @@
import type { ColorValue } from './themeTypes';
export declare const paramToVariableName: (paramName: string) => string;
export declare const paramToVariableExpression: (paramName: string) => string;
export declare const clamp: (value: number, min: number, max: number) => number;
export declare const memoize: <R, A = void>(fn: (arg: A) => R) => ((arg: A) => R);
export declare const accentMix: (mix: number) => ColorValue;
export declare const foregroundMix: (mix: number) => ColorValue;
export declare const foregroundBackgroundMix: (mix: number) => ColorValue;
export declare const foregroundHeaderBackgroundMix: (mix: number) => ColorValue;
export declare const backgroundColor: ColorValue;
export declare const foregroundColor: ColorValue;
export declare const accentColor: ColorValue;
@@ -0,0 +1,23 @@
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { AgEvent } from '../interfaces/agEvent';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { IEventEmitter } from '../interfaces/iEventEmitter';
import type { IPropertiesService } from '../interfaces/iProperties';
import type { TooltipCtrl } from '../interfaces/iTooltip';
import { AgTooltipFeature } from './agTooltipFeature';
import type { BaseTooltipParams } from './baseTooltipStateManager';
export type HighlightTooltipEventType = 'itemHighlighted';
export interface HighlightTooltipEvent extends AgEvent<HighlightTooltipEventType> {
highlighted: boolean;
}
export declare class AgHighlightTooltipFeature<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>, TTooltipParams extends BaseTooltipParams<TLocation>, TTooltipCtrlParams, TLocation extends string> extends AgTooltipFeature<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService, TTooltipParams, TTooltipCtrlParams, TLocation> {
private readonly highlightTracker;
private tooltipMode;
constructor(ctrl: TooltipCtrl<TLocation, TTooltipCtrlParams>, highlightTracker: IEventEmitter<HighlightTooltipEventType>, beans?: TBeanCollection);
postConstruct(): void;
private wireHighlightListeners;
private onHighlight;
private setTooltipMode;
destroy(): void;
}
+11
View File
@@ -0,0 +1,11 @@
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { IComponent } from '../interfaces/iComponent';
import type { IPropertiesService } from '../interfaces/iProperties';
import { AgPopupComponent } from '../popup/agPopupComponent';
import type { BaseTooltipParams } from './baseTooltipStateManager';
export declare class AgTooltipComponent<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>, TComponentSelectorType extends string, TTooltipParams extends BaseTooltipParams<TLocation>, TLocation extends string> extends AgPopupComponent<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService, TComponentSelectorType> implements IComponent<TTooltipParams> {
constructor();
init(params: TTooltipParams): void;
}
+30
View File
@@ -0,0 +1,30 @@
import { AgBeanStub } from '../core/agBeanStub';
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { IPropertiesService } from '../interfaces/iProperties';
import type { ITooltipFeature, TooltipCtrl } from '../interfaces/iTooltip';
import type { BaseTooltipParams } from './baseTooltipStateManager';
export declare class AgTooltipFeature<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>, TTooltipParams extends BaseTooltipParams<TLocation>, TTooltipCtrlParams, TLocation extends string> extends AgBeanStub<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService> implements ITooltipFeature {
private readonly ctrl;
private tooltip;
private tooltipManager;
private browserTooltips;
constructor(ctrl: TooltipCtrl<TLocation, TTooltipCtrlParams>, beans?: TBeanCollection);
postConstruct(): void;
/**
*
* @param tooltip The tooltip value
* @param allowEmptyString Set it to true to allow the title to be set to `''`. This is necessary
* when the browser adds a default tooltip the element and the tooltip service will be displayed
* next to a browser tooltip causing confusion.
*/
private setBrowserTooltip;
private updateTooltipText;
private createTooltipFeatureIfNeeded;
attemptToShowTooltip(): void;
attemptToHideTooltip(): void;
setTooltipAndRefresh(tooltip: any): void;
refreshTooltip(clearWithEmptyString?: boolean): void;
destroy(): void;
}
@@ -0,0 +1,79 @@
import { AgBeanStub } from '../core/agBeanStub';
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { IComponent } from '../interfaces/iComponent';
import type { IPropertiesService } from '../interfaces/iProperties';
import type { TooltipCtrl } from '../interfaces/iTooltip';
export declare enum TooltipTrigger {
HOVER = 0,
FOCUS = 1
}
export interface BaseTooltipParams<TLocation extends string, TValue = any> {
location: TLocation;
/** The value to be rendered by the tooltip. */
value?: TValue | null;
/** A callback function that hides the tooltip */
hideTooltipCallback?: () => void;
}
export declare abstract class BaseTooltipStateManager<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>, TTooltipParams extends BaseTooltipParams<TLocation>, TTooltipCtrlParams, TLocation extends string> extends AgBeanStub<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService> {
private readonly tooltipCtrl;
private readonly getTooltipValue;
private popupSvc?;
wireBeans(beans: TBeanCollection): void;
private showTooltipTimeoutId;
private hideTooltipTimeoutId;
private interactiveTooltipTimeoutId;
private interactionEnabled;
private isInteractingWithTooltip;
private state;
private lastMouseEvent;
private tooltipComp;
private tooltipPopupDestroyFunc;
private tooltipInstanceCount;
private tooltipMouseTrack;
private tooltipTrigger;
private tooltipMouseEnterListener;
private tooltipMouseLeaveListener;
private tooltipFocusInListener;
private tooltipFocusOutListener;
private onBodyScrollEventCallback;
private onDocumentKeyDownCallback;
constructor(tooltipCtrl: TooltipCtrl<TLocation, TTooltipCtrlParams>, getTooltipValue: () => any);
protected abstract createTooltipComp(params: TTooltipParams, callback: (comp: IComponent<TTooltipParams>) => void): void;
protected abstract setEventHandlers(listener: () => void): void;
protected abstract clearEventHandlers(): void;
postConstruct(): void;
private getGridOptionsTooltipDelay;
private getTooltipDelay;
destroy(): void;
private getTooltipTrigger;
onMouseEnter(e: MouseEvent): void;
private onMouseMove;
private onMouseDown;
private onMouseLeave;
private onFocusIn;
private onFocusOut;
private onKeyDown;
prepareToShowTooltip(mouseEvent?: MouseEvent): void;
private isLastTooltipHiddenRecently;
private setToDoNothing;
private showTooltip;
hideTooltip(forceHide?: boolean): void;
private newTooltipComponentCallback;
private onTooltipMouseEnter;
private onTooltipMouseLeave;
private onTooltipFocusIn;
private isTooltipFocused;
private onTooltipFocusOut;
private positionTooltip;
private destroyTooltipComp;
private clearTooltipListeners;
private lockService;
private unlockService;
private startHideTimeout;
private clearShowTimeout;
private clearHideTimeout;
private clearInteractiveTimeout;
private clearTimeouts;
}
@@ -0,0 +1 @@
export declare const tooltipCSS = ".ag-tooltip{background-color:var(--ag-tooltip-background-color);border:var(--ag-tooltip-border);border-radius:var(--ag-border-radius);color:var(--ag-tooltip-text-color);padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding);position:absolute;white-space:normal;z-index:99999;&:where(.ag-cell-editor-tooltip),&:where(.ag-cell-formula-tooltip){background-color:var(--ag-tooltip-error-background-color);border:var(--ag-tooltip-error-border);color:var(--ag-tooltip-error-text-color);font-weight:500}}.ag-tooltip-custom{position:absolute;z-index:99999}.ag-tooltip-custom:where(:not(.ag-tooltip-interactive)),.ag-tooltip:where(:not(.ag-tooltip-interactive)){pointer-events:none}.ag-tooltip-animate{transition:opacity 1s;&:where(.ag-tooltip-hiding){opacity:0}}";
+49
View File
@@ -0,0 +1,49 @@
import type { LocaleTextFunc } from '../interfaces/iLocaleService';
/** Per https://www.w3.org/TR/wai-aria/#aria-sort](https://www.w3.org/TR/wai-aria/#aria-sort:~:text=integer-,aria%2Dsort%20property,-Indicates%20if%20items */
export type AriaSortState = 'ascending' | 'descending' | 'other' | 'none';
export type DisplaySortDef = SortDef | {
direction: 'mixed';
type: SortType;
};
export type SortDirection = 'asc' | 'desc' | null;
export type SortType = 'absolute' | 'default';
export type SortDef = {
type: SortType;
direction: SortDirection;
};
export declare function _setAriaRole(element: Element, role?: string | null): void;
export declare function _getAriaSortState(directionOrDef: DisplaySortDef | null): AriaSortState;
export declare function _getAriaPosInSet(element: Element): number;
export declare function _getAriaLabel(element: Element): string | null;
export declare function _setAriaLabel(element: Element, label?: string | null): void;
export declare function _setAriaLabelledBy(element: Element, labelledBy?: string): void;
export declare function _setAriaDescribedBy(element: Element, describedby?: string): void;
export declare function _setAriaLive(element: Element, live?: 'polite' | 'assertive' | 'off' | null): void;
export declare function _setAriaAtomic(element: Element, atomic: boolean | null): void;
export declare function _setAriaRelevant(element: Element, relevant: 'additions' | 'additions text' | 'all' | 'removals' | 'text' | null): void;
export declare function _setAriaInvalid(element: Element, invalid: boolean): void;
export declare function _setAriaLevel(element: Element, level: number): void;
export declare function _setAriaDisabled(element: Element, disabled: boolean): void;
export declare function _setAriaHidden(element: Element, hidden: boolean): void;
export declare function _setAriaActiveDescendant(element: Element, descendantId: string | null): void;
export declare function _setAriaExpanded(element: Element, expanded: boolean): void;
export declare function _removeAriaExpanded(element: Element): void;
export declare function _setAriaSetSize(element: Element, setsize: number): void;
export declare function _setAriaPosInSet(element: Element, position: number): void;
export declare function _setAriaMultiSelectable(element: Element, multiSelectable: boolean): void;
export declare function _setAriaRowCount(element: Element, rowCount: number): void;
export declare function _setAriaRowIndex(element: Element, rowIndex: number): void;
export declare function _setAriaRowSpan(element: Element, spanCount: number): void;
export declare function _setAriaColCount(element: Element, colCount: number): void;
export declare function _setAriaColIndex(element: Element, colIndex: number): void;
export declare function _setAriaColSpan(element: Element, colSpan: number): void;
export declare function _setAriaSort(element: Element, sort: AriaSortState): void;
export declare function _removeAriaSort(element: Element): void;
export declare function _setAriaSelected(element: Element, selected?: boolean): void;
export declare function _setAriaChecked(element: Element, checked?: boolean): void;
export declare function _setAriaControls(controllerElement: Element, controlledId?: string | null): void;
export declare function _setAriaControlsAndLabel(controllerElement: Element, controlledElement: Element): void;
export declare function _setAriaOwns(ownerElement: Element, ownedId?: string | null): void;
export declare function _setAriaHasPopup(element: Element, hasPopup: 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' | boolean): void;
export declare function _getAriaCheckboxStateName(translate: LocaleTextFunc, state?: boolean): string;
export declare function _setAriaOrientation(element: Element, orientation?: 'horizontal' | 'vertical'): void;
+20
View File
@@ -0,0 +1,20 @@
/** An array that is always empty and that cannot be modified */
export declare const _EmptyArray: any[];
export declare function _last<T>(arr: readonly T[]): T;
export declare function _last<T extends Node>(arr: NodeListOf<T>): T;
export declare function _areEqual<T>(a: readonly T[] | null | undefined, b: readonly T[] | null | undefined, comparator?: (a: T, b: T) => boolean): boolean;
/**
* Utility that uses the fastest looping approach to apply a callback to each element of the array
* https://jsperf.app/for-for-of-for-in-foreach-comparison
* If callback returns true, exit early.
*/
export declare function _forAll<T>(array: T[] | undefined, callback: (value: T) => boolean | void): true | undefined;
export declare function _removeFromArray<T>(array: T[], object: T): void;
/**
* O(N+M) way to remove M elements from an array of size N. Better than calling _removeFromArray in a loop
*
* Note: this implementation removes _any_ instances of the `elementsToRemove`
*/
export declare function _removeAllFromArray<T>(array: T[], elementsToRemove: readonly T[]): void;
export declare function _moveInArray<T>(array: T[], objectsToMove: T[], toIndex: number): void;
export declare function _flatten<T>(arrays: Array<T[]>): T[];
+1
View File
@@ -0,0 +1 @@
export declare const _parseBigIntOrNull: (value: unknown) => bigint | null;
+8
View File
@@ -0,0 +1,8 @@
export declare function _isBrowserSafari(): boolean;
export declare function _isBrowserFirefox(): boolean;
export declare function _isMacOsUserAgent(): boolean;
export declare function _isIOSUserAgent(): boolean;
export declare function _getTabIndex(el: HTMLElement | null): string | null;
export declare function _getMaxDivHeight(): number;
export declare function _getScrollbarWidth(): number | null;
export declare function _isInvisibleScrollbar(): boolean;
+36
View File
@@ -0,0 +1,36 @@
/**
* Serialises a Date to a string of format `yyyy-MM-ddTHH:mm:ss`.
* An alternative separator can be provided to be used instead of hyphens.
* @param date The date to serialise
* @param includeTime Whether to include the time in the serialised string
* @param separator The separator to use between date and time parts (default 'T')
*/
export declare function _serialiseDate(date: Date | null, includeTime?: boolean, separator?: string): string | null;
/**
* Helper function to get the date parts of a date. Used in set filter.
* @param d The date to get the parts from
* @param includeTime Whether to include the time in the returned array
* @returns The date parts as an array of strings or null if the date is null or undefined
*/
export declare function _getDateParts(d: Date | null | undefined, includeTime?: boolean): null | string[];
export declare const MONTHS: string[];
/**
* Serialises a Date to a string of format the defined format, does not include time.
* @param date The date to serialise
* @param format The string to format the date to, defaults to YYYY-MM-DD
*/
export declare function _dateToFormattedString(date: Date, format?: string): string;
/**
* Helper function to check if a date is valid. Use isValidDateTime() to check if a date is valid and has time parts.
*/
export declare function _isValidDate(value?: string | null, bailIfInvalidTime?: boolean): boolean;
export declare function _isValidDateTime(value?: string | null): boolean;
/**
* Parses a date and time from a string. Expected format is ISO-compatible `yyyy-MM-dd` or `yyyy-MM-ddTHH:mm:ssZ`.
*
* Because of javascript historical reasons, we need to parse the datetime manually:
* Per MDN:
* When the time zone offset is absent, **date-only** forms are interpreted as a UTC time and **date-time** forms are interpreted as a local time.
* The interpretation as a UTC time is due to a historical spec error that was not consistent with ISO 8601 but could not be changed due to web compatibility.
*/
export declare function _parseDateTimeFromString(value?: string | null, bailIfInvalidTime?: boolean, skipValidation?: boolean): Date | null;
+9
View File
@@ -0,0 +1,9 @@
import type { UtilBeanCollection } from '../interfaces/agCoreBeanCollection';
export declare function _getRootNode(beans: UtilBeanCollection): Document | ShadowRoot;
export declare function _getActiveDomElement(beans: UtilBeanCollection): Element | null;
export declare function _getDocument(beans: UtilBeanCollection): Document;
export declare function _isNothingFocused(beans: UtilBeanCollection): boolean;
export declare function _getWindow(beans: UtilBeanCollection): Window & typeof globalThis;
export declare function _getPageBody(beans: UtilBeanCollection): HTMLElement | ShadowRoot;
export declare function _getBodyWidth(beans: UtilBeanCollection): number;
export declare function _getBodyHeight(beans: UtilBeanCollection): number;
+118
View File
@@ -0,0 +1,118 @@
import type { UtilBeanCollection } from '../interfaces/agCoreBeanCollection';
/**
* This method adds a class to an element and remove that class from all siblings.
* Useful for toggling state.
* @param {HTMLElement} element The element to receive the class
* @param {string} elementClass The class to be assigned to the element
* @param {boolean} otherElementClass The class to be assigned to siblings of the element, but not the element itself
*/
export declare function _radioCssClass(element: HTMLElement, elementClass: string | null, otherElementClass?: string | null): void;
export declare const FOCUSABLE_SELECTOR = "[tabindex], input, select, button, textarea, [href]";
export declare const FOCUSABLE_EXCLUDE = "[disabled], .ag-disabled:not(.ag-button), .ag-disabled *";
export declare function _isFocusableFormField(element: Element | null): boolean;
export declare function _setDisplayed(element: Element, displayed: boolean, options?: {
skipAriaHidden?: boolean;
}): void;
export declare function _setVisible(element: HTMLElement, visible: boolean, options?: {
skipAriaHidden?: boolean;
}): void;
export declare function _setDisabled(element: HTMLElement, disabled: boolean): void;
export declare function _isElementChildOfClass(element: HTMLElement | null, cls: string, maxNest?: HTMLElement | number): boolean;
export declare function _getElementSize(el: HTMLElement): {
height: number;
width: number;
borderTopWidth: number;
borderRightWidth: number;
borderBottomWidth: number;
borderLeftWidth: number;
paddingTop: number;
paddingRight: number;
paddingBottom: number;
paddingLeft: number;
marginTop: number;
marginRight: number;
marginBottom: number;
marginLeft: number;
boxSizing: string;
};
export declare function _getInnerHeight(el: HTMLElement): number;
export declare function _getInnerWidth(el: HTMLElement): number;
export declare function _getAbsoluteHeight(el: HTMLElement): number;
export declare function _getAbsoluteWidth(el: HTMLElement): number;
export declare function _getElementRectWithOffset(el: HTMLElement): {
top: number;
left: number;
right: number;
bottom: number;
};
export declare function _getScrollLeft(element: HTMLElement, rtl: boolean): number;
export declare function _setScrollLeft(element: HTMLElement, value: number, rtl: boolean): void;
export declare function _clearElement(el: HTMLElement | null | undefined): void;
export declare function _removeFromParent(node: Element | null | undefined): void;
export declare function _isInDOM(element: Element): element is HTMLElement;
export declare function _isVisible(element: Element): boolean;
/**
* Loads the template and returns it as an element.
* NOTE: Prefer _createElement
* @param {string} template
* @returns {HTMLElement}
*/
export declare function _loadTemplate(template: string | undefined | null): HTMLElement;
export declare function _ensureDomOrder(eContainer: HTMLElement, eChild: HTMLElement, eChildBefore?: HTMLElement | null): void;
export declare function _setDomChildOrder(eContainer: HTMLElement, orderedChildren: (HTMLElement | null)[]): void;
export declare function _addStylesToElement(eElement: any, styles: {
[cssProperty: string]: string | number;
} | null | undefined): void;
export declare function _isElementOverflowingCallback(getElement: () => HTMLElement | undefined): () => boolean;
export declare function _isHorizontalScrollShowing(element: HTMLElement): boolean;
export declare function _setElementWidth(element: HTMLElement, width: string | number): void;
export declare function _setFixedWidth(element: HTMLElement, width: string | number): void;
export declare function _setFixedHeight(element: HTMLElement, height: string | number): void;
export declare function _formatSize(size: number | string): string;
export declare function _isNodeOrElement(o: any): o is Node | Element;
export declare function _addOrRemoveAttribute(element: HTMLElement, name: string, value: string | number | null | undefined): void;
export declare function _placeCaretAtEnd(beans: UtilBeanCollection, contentElement: HTMLElement): void;
export declare function _observeResize(beans: UtilBeanCollection, element: HTMLElement, callback: ResizeObserverCallback): () => void;
export declare function _requestAnimationFrame(beans: UtilBeanCollection, callback: any): void;
type Attributes = {
[key: string]: string;
};
type TagName<SelectorType extends string> = keyof HTMLElementTagNameMap | Lowercase<SelectorType>;
/** Type to help avoid typos, add new roles as required. */
type RoleType = 'button' | 'columnheader' | 'gridcell' | 'heading' | 'listbox' | 'menu' | 'option' | 'presentation' | 'group' | 'row' | 'rowgroup' | 'status' | 'tab' | 'tablist' | 'tabpanel' | 'treeitem';
export type AgElementParams<SelectorType extends string> = {
/** The tag name to use for the element, either browser tag or one of the AG Grid components such as ag-checkbox
*/
tag: TagName<SelectorType>;
/** AG Grid data-ref attribute, should match a property on the class that uses the same name and is initialised with RefPlaceholder
* @example
* ref: 'eLabel'
* private eLabel: HTMLElement = RefPlaceholder;
*/
ref?: string;
/**
* Should be a single string of space-separated class names
* @example
* cls: 'ag-header-cell ag-header-cell-sortable'
*/
cls?: string;
/** The role attribute to add to the dom element */
role?: RoleType;
/** Key Value pair of attributes to add to the dom element via `element.setAttribute(key,value)` */
attrs?: Attributes;
/**
* A single string can be passed to the children property and this will call `element.textContent = children` on the element.
*
* Otherwise an array of children is passed.
* A child element can be an ElementParams / string / (() => Element) / null/undefined.
* - If an ElementParams is passed it will be created and appended to the parent element. It will be wrapped with whitespace to mimic the previous behaviour of multi line strings.
* - If a string is passed it will be appended as a text node.
* - If a function is passed, it will be called and the result appended
* - If null or undefined is passed it will be ignored.
*/
children?: (AgElementParams<SelectorType> | string | (() => Element) | null | undefined)[] | string;
};
/** AG Grid attribute used to automatically assign DOM Elements to class properties */
export declare const DataRefAttribute = "data-ref";
export declare function _createAgElement<T extends HTMLElement = HTMLElement, TComponentSelector extends string = string>(params: AgElementParams<TComponentSelector>): T;
export {};
+32
View File
@@ -0,0 +1,32 @@
import type { UtilBeanCollection } from '../interfaces/agCoreBeanCollection';
export declare const _isEventSupported: (eventName: any) => boolean;
export declare function _isElementInEventPath(element: HTMLElement, event: Event): boolean;
export declare function _addSafePassiveEventListener(eElement: HTMLElement, event: string, listener: (event?: any) => void): void;
/**
* `True` if the event is close to the original event by X pixels either vertically or horizontally.
* we only start dragging after X pixels so this allows us to know if we should start dragging yet.
* @param {MouseEvent | TouchEvent} e1
* @param {MouseEvent | TouchEvent} e2
* @param {number} pixelCount
* @returns {boolean}
*/
export declare function _areEventsNear(e1: MouseEvent | Touch, e2: MouseEvent | Touch, pixelCount: number): boolean;
/**
* Returns the first touch in the touch list that matches the identifier of the provided touch.
* @param touch The touch to match the identifier against.
* @param touchList The list of touches to search.
* @returns The matching touch, or null if not found.
*/
export declare const _getFirstActiveTouch: (touch: Touch, touchList: TouchList) => Touch | null;
export declare function _isEventFromThisInstance(beans: UtilBeanCollection, event: UIEvent): boolean;
export declare function _anchorElementToMouseMoveEvent(element: HTMLElement, mouseMoveEvent: MouseEvent | Touch, beans: UtilBeanCollection): void;
/** Tuple [target, type, listener, options?] */
export type TempEventHandler = [
target: EventTarget,
type: string,
listener: (e: Event) => void,
options?: boolean | AddEventListenerOptions
];
export declare const addTempEventHandlers: (list: TempEventHandler[], ...handlers: TempEventHandler[]) => void;
export declare const clearTempEventHandlers: (list: TempEventHandler[] | null | undefined) => void;
export declare const preventEventDefault: (event: Event) => void;
+7
View File
@@ -0,0 +1,7 @@
import type { UtilBeanCollection } from '../interfaces/agCoreBeanCollection';
export declare function _registerKeyboardFocusEvents(beans: UtilBeanCollection): () => void;
export declare function _isKeyboardMode(): boolean;
export declare function _findFocusableElements(rootNode: HTMLElement, exclude?: string | null, onlyUnmanaged?: boolean): HTMLElement[];
export declare function _focusInto(rootNode: HTMLElement, up?: boolean, onlyUnmanaged?: boolean, excludeTabGuards?: boolean): boolean;
export declare function _findNextFocusableElement(beans: UtilBeanCollection, rootNode: HTMLElement, onlyManaged?: boolean | null, backwards?: boolean): HTMLElement | null;
export declare function _findTabbableParent(node: HTMLElement | null, limit?: number): HTMLElement | null;
+27
View File
@@ -0,0 +1,27 @@
import type { UtilBeanCollection } from '../interfaces/agCoreBeanCollection';
/** If the key was passed before, then doesn't execute the func */
export declare const _doOnce: {
(func: () => void, key: string): void;
/** Expose the internal set for testing purposes */
_set: Set<string>;
};
export declare function _batchCall(func: () => void): void;
export declare function _batchCall(func: () => void, mode: 'raf', beans: UtilBeanCollection): void;
/**
* Creates a debounced function, and attach it to a bean for lifecycle
* @param {Function} func The function to be debounced
* @param {number} delay The time in ms to debounce
* @returns {Function} The debounced function
*/
export declare function _debounce<TArgs extends any[], TContext>(bean: {
isAlive(): boolean;
}, func: (this: TContext, ...args: TArgs) => void, delay: number): (this: TContext, ...args: TArgs) => number;
/**
* @param {Function} func The function to be throttled
* @param {number} wait The time in ms to throttle
* @returns {Function} The throttled function
*/
export declare function _throttle(func: (...args: any[]) => void, wait: number): (...args: any[]) => void;
export declare function _waitUntil(bean: {
addDestroyFunc(func: () => void): void;
}, condition: () => boolean, callback: () => void, timeout?: number): void;
+20
View File
@@ -0,0 +1,20 @@
/**
* This function provides fuzzy matching suggestions based on the input value and a list of all suggestions.
*/
export declare function _fuzzySuggestions(params: {
inputValue: string;
allSuggestions: string[];
hideIrrelevant?: boolean;
filterByPercentageOfBestMatch?: number;
}): {
values: string[];
indices: number[];
};
/**
* This uses Levenshtein Distance to match strings.
* Lower values mean more similar strings.
*
* This function is often being called, so it must be performant.
* {@link|https://github.com/ag-grid/ag-grid/issues/12473}
*/
export declare function _getLevenshteinSimilarityDistance(source: string, target: string): number;
+12
View File
@@ -0,0 +1,12 @@
/**
* If value is undefined, null or blank, returns null, otherwise returns the value
* @param {T} value
* @returns {T | null}
*/
export declare const _makeNull: <T>(value?: T) => T | null;
export declare function _exists(value: string | null | undefined): value is string;
export declare function _exists<T>(value: T): value is NonNullable<T>;
export declare function _missing<T>(value: T | null | undefined): value is Exclude<undefined | null, T>;
export declare const _toStringOrNull: (value: any) => string | null;
export declare const _jsonEquals: <T1, T2>(val1: T1, val2: T2) => boolean;
export declare const _defaultComparator: (valueA: any, valueB: any, accentedCompare?: boolean) => number;
+1
View File
@@ -0,0 +1 @@
export declare function _isEventFromPrintableCharacter(event: KeyboardEvent): boolean;
+13
View File
@@ -0,0 +1,13 @@
import type { ILocaleService, LocaleTextFunc } from '../interfaces/iLocaleService';
export declare function _getLocaleTextFunc<TKey extends string = string>(localeSvc?: ILocaleService<TKey>): LocaleTextFunc<TKey>;
export declare function _translate<T extends Record<string, string | ((variableValues: string[]) => string)>>(bean: {
getLocaleTextFunc(): LocaleTextFunc;
}, localeValues: T, key: keyof T & string, variableValues?: string[]): string;
export declare function _getLocaleTextFromFunc(getLocaleText: (params: {
key: string;
defaultValue: string;
variableValues?: string[];
}) => string): LocaleTextFunc;
export declare function _getLocaleTextFromMap(localeText?: {
[key: string]: string;
}): LocaleTextFunc;
+15
View File
@@ -0,0 +1,15 @@
export declare function _isPromise<T>(fn: any): fn is Promise<T>;
export declare function _wrapInterval(action: any, timeout?: any): AgPromise<number>;
type ResolveAndRejectCallback<T> = (resolve: (value: T | null) => void, reject: (params: any) => void) => void;
export declare class AgPromise<T> {
private status;
private resolution;
private readonly waiters;
static all<T>(promises: AgPromise<T | null>[]): AgPromise<(T | null)[]>;
static resolve<T>(value?: T | null): AgPromise<T>;
constructor(callback: ResolveAndRejectCallback<T>);
then<V>(func: (result: T | null) => V): AgPromise<V>;
private onDone;
private onReject;
}
export {};
+13
View File
@@ -0,0 +1,13 @@
/**
* Calls toString() twice, in case value is an object, where user provides a toString() method.
* The first call to toString() returns back something other than a string (eg a number to render)
*/
export declare function _toString(toEscape?: string | null): string | null;
export declare function _escapeString(toEscape?: string | null): string | null;
export declare function _isExpressionString(value: unknown): value is `=${string}`;
/**
* Converts a camelCase string into startCase
* @param {string} camelCase
* @returns {string}
*/
export declare function _camelCaseToHumanText(camelCase: string | undefined): string | null;
+1
View File
@@ -0,0 +1 @@
export declare function _getValueUsingField(data: any, field: string, fieldContainsDots: boolean): any;
+26
View File
@@ -0,0 +1,26 @@
import type { AgComponentSelector } from '../interfaces/agComponent';
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { IPropertiesService } from '../interfaces/iProperties';
import type { AgElementParams } from '../utils/dom';
import { AgAbstractLabel } from './agAbstractLabel';
import type { AgFieldParams } from './agFieldParams';
export type FieldElement = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
export type AgAbstractFieldEvent = 'fieldValueChanged';
export declare abstract class AgAbstractField<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>, TComponentSelectorType extends string, TValue, TConfig extends AgFieldParams = AgFieldParams, TEventType extends string = AgAbstractFieldEvent> extends AgAbstractLabel<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService, TComponentSelectorType, TConfig, TEventType | AgAbstractFieldEvent> {
protected readonly className?: string | undefined;
protected previousValue: TValue | null | undefined;
protected value: TValue | null | undefined;
constructor(config?: TConfig, template?: AgElementParams<TComponentSelectorType>, components?: AgComponentSelector<TComponentSelectorType>[], className?: string | undefined);
postConstruct(): void;
setLabel(label: string | HTMLElement): this;
protected refreshAriaLabelledBy(): void;
setAriaLabel(label?: string | null): this;
onValueChange(callbackFn: (newValue?: TValue | null) => void): this;
getWidth(): number;
setWidth(width: number): this;
getPreviousValue(): TValue | null | undefined;
getValue(): TValue | null | undefined;
setValue(value?: TValue | null, silent?: boolean): this;
}
@@ -0,0 +1,29 @@
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { IPropertiesService } from '../interfaces/iProperties';
import type { AgAbstractFieldEvent, FieldElement } from './agAbstractField';
import { AgAbstractField } from './agAbstractField';
import type { AgInputFieldParams } from './agFieldParams';
export type AgAbstractInputFieldEvent = AgAbstractFieldEvent;
export declare abstract class AgAbstractInputField<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>, TComponentSelectorType extends string, TElement extends FieldElement, TValue, TConfig extends AgInputFieldParams<TComponentSelectorType> = AgInputFieldParams<TComponentSelectorType>, TEventType extends string = AgAbstractInputFieldEvent> extends AgAbstractField<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService, TComponentSelectorType, TValue, TConfig, AgAbstractInputFieldEvent | TEventType> {
private inputType;
private readonly displayFieldTag;
protected readonly eLabel: HTMLElement;
protected readonly eWrapper: HTMLElement;
protected readonly eInput: TElement;
constructor(config?: TConfig, className?: string, inputType?: string | null | undefined, displayFieldTag?: keyof HTMLElementTagNameMap);
postConstruct(): void;
protected addInputListeners(): void;
setInputType(inputType?: string): void;
getInputElement(): TElement;
getWrapperElement(): HTMLElement;
setInputWidth(width: number | 'flex'): this;
setInputName(name: string): this;
getFocusableElement(): HTMLElement;
setMaxLength(length: number): this;
setInputPlaceholder(placeholder?: string | null): this;
setInputAriaLabel(label?: string | null): this;
setDisabled(disabled: boolean): this;
setAutoComplete(value: boolean | string): this;
}
@@ -0,0 +1 @@
export declare const agAbstractLabelCSS = ".ag-label{white-space:nowrap}:where(.ag-ltr) .ag-label{margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-label{margin-left:var(--ag-spacing)}:where(.ag-label-align-right) .ag-label{order:1}:where(.ag-ltr) :where(.ag-label-align-right) .ag-label{margin-left:var(--ag-spacing)}:where(.ag-rtl) :where(.ag-label-align-right) .ag-label{margin-right:var(--ag-spacing)}:where(.ag-label-align-right){.ag-label,.ag-wrapper{flex:none}}.ag-label-align-top{align-items:flex-start;flex-direction:column}:where(.ag-label-align-top){.ag-label,.ag-wrapper{align-self:stretch}}.ag-label-ellipsis{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:where(.ag-label-align-top) .ag-label{margin-bottom:calc(var(--ag-spacing)*.5)}";
+30
View File
@@ -0,0 +1,30 @@
import { AgComponentStub } from '../core/agComponentStub';
import type { AgComponentEvent, AgComponentSelector } from '../interfaces/agComponent';
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { IPropertiesService } from '../interfaces/iProperties';
import type { AgElementParams } from '../utils/dom';
import type { AgLabelParams, LabelAlignment } from './agFieldParams';
type AgAbstractLabelEvent = AgComponentEvent;
export declare abstract class AgAbstractLabel<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>, TComponentSelectorType extends string, TConfig extends AgLabelParams = AgLabelParams, TEventType extends string = AgAbstractLabelEvent> extends AgComponentStub<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService, TComponentSelectorType, TEventType | AgAbstractLabelEvent> {
protected abstract eLabel: HTMLElement;
protected readonly config: TConfig;
protected labelSeparator: string;
protected labelAlignment: LabelAlignment;
protected disabled: boolean;
private label;
constructor(config?: TConfig, template?: string | AgElementParams<TComponentSelectorType>, components?: AgComponentSelector<TComponentSelectorType>[]);
postConstruct(): void;
protected refreshLabel(): void;
setLabelSeparator(labelSeparator: string): this;
getLabelId(): string;
getLabel(): HTMLElement | string;
setLabel(label: HTMLElement | string): this;
setLabelAlignment(alignment: LabelAlignment): this;
setLabelEllipsis(hasEllipsis: boolean): this;
setLabelWidth(width: number | 'flex'): this;
setDisabled(disabled: boolean): this;
isDisabled(): boolean;
}
export {};
+32
View File
@@ -0,0 +1,32 @@
import type { AgComponentSelector } from '../interfaces/agComponent';
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { IPropertiesService } from '../interfaces/iProperties';
import { AgAbstractInputField } from './agAbstractInputField';
import type { AgCheckboxParams, LabelAlignment } from './agFieldParams';
import type { AgWidgetSelectorType } from './agWidgetSelectorType';
export declare class AgCheckbox<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>, TComponentSelectorType extends string, TConfig extends AgCheckboxParams<TComponentSelectorType> = AgCheckboxParams<TComponentSelectorType>> extends AgAbstractInputField<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService, TComponentSelectorType, HTMLInputElement, boolean, TConfig> {
protected labelAlignment: LabelAlignment;
private selected?;
private readOnly;
private passive;
constructor(config?: TConfig, className?: string, inputType?: string);
postConstruct(): void;
protected addInputListeners(): void;
getNextValue(): boolean;
setPassive(passive: boolean): void;
isReadOnly(): boolean;
setReadOnly(readOnly: boolean): void;
setDisabled(disabled: boolean): this;
toggle(): void;
getValue(): boolean | undefined;
setValue(value?: boolean, silent?: boolean): this;
setName(name: string): this;
protected isSelected(): boolean | undefined;
private setSelected;
private dispatchChange;
private onCheckboxClick;
private refreshSelectedClass;
}
export declare const AgCheckboxSelector: AgComponentSelector<AgWidgetSelectorType>;
@@ -0,0 +1 @@
export declare const agContentEditableFieldCSS = ".ag-content-editable-field{align-items:center;display:flex}.ag-content-editable-field-input{background-color:var(--ag-input-background-color);border:var(--ag-input-border);border-radius:var(--ag-input-border-radius);color:var(--ag-input-text-color);cursor:text;display:block;flex:1 1 auto;line-height:normal;outline:none;overflow:auto;overflow-y:hidden;padding:0 var(--ag-input-padding-start);white-space:nowrap;-ms-overflow-style:none!important;scrollbar-width:none!important}.ag-content-editable-field-input::-webkit-scrollbar{display:none!important}.ag-wrapper.ag-content-editable-field-input{line-height:var(--ag-internal-content-line-height)}.ag-content-editable-field-input:where(:focus,:focus-within){background-color:var(--ag-input-focus-background-color);border:var(--ag-input-focus-border);box-shadow:var(--ag-input-focus-shadow);color:var(--ag-input-focus-text-color)}:where(.ag-content-editable-field.ag-disabled .ag-content-editable-field-input){background-color:var(--ag-input-disabled-background-color);border:var(--ag-input-disabled-border);color:var(--ag-input-disabled-text-color)}.ag-content-editable-field-input:where(.invalid){background-color:var(--ag-input-invalid-background-color);border:var(--ag-input-invalid-border);color:var(--ag-input-invalid-text-color)}";
@@ -0,0 +1,34 @@
import type { AgComponentSelector } from '../interfaces/agComponent';
import type { AgCoreBeanCollection } from '../interfaces/agCoreBeanCollection';
import type { BaseEvents } from '../interfaces/baseEvents';
import type { BaseProperties } from '../interfaces/baseProperties';
import type { IPropertiesService } from '../interfaces/iProperties';
import type { AgAbstractFieldEvent } from './agAbstractField';
import { AgAbstractField } from './agAbstractField';
import type { AgFieldParams } from './agFieldParams';
import type { AgWidgetSelectorType } from './agWidgetSelectorType';
type AgContentEditableFieldEvent = AgAbstractFieldEvent;
interface AgContentEditableFieldParams extends AgFieldParams {
className?: string;
contentEditable?: boolean | 'plaintext-only';
ariaRole?: string;
renderValueToElement?: boolean;
}
export declare class AgContentEditableField<TBeanCollection extends AgCoreBeanCollection<TProperties, TGlobalEvents, TCommon, TPropertiesService>, TProperties extends BaseProperties, TGlobalEvents extends BaseEvents, TCommon, TPropertiesService extends IPropertiesService<TProperties, TCommon>, TComponentSelectorType extends string, TValue, TConfig extends AgContentEditableFieldParams = AgContentEditableFieldParams, TEventType extends string = AgContentEditableFieldEvent> extends AgAbstractField<TBeanCollection, TProperties, TGlobalEvents, TCommon, TPropertiesService, TComponentSelectorType, TValue, TConfig, TEventType | AgContentEditableFieldEvent> {
protected readonly eLabel: HTMLElement;
protected readonly eWrapper: HTMLElement;
private renderValueToElement;
constructor(config?: TConfig);
postConstruct(): void;
protected setupAria(): void;
protected setupEditable(): void;
setValue(value?: TValue | null, silent?: boolean): this;
setRenderValueToElement(render: boolean): void;
setDisplayedValue(value?: string | null): void;
getContentElement(): HTMLElement;
private refreshDisplayedValue;
private syncValueFromDom;
getFocusableElement(): HTMLElement;
}
export declare const AgContentEditableFieldSelector: AgComponentSelector<AgWidgetSelectorType>;
export {};
+29
View File
@@ -0,0 +1,29 @@
import type { AgElementParams } from '../utils/dom';
export type LabelAlignment = 'left' | 'right' | 'top';
export interface AgLabelParams {
label?: HTMLElement | string;
labelWidth?: number | 'flex';
labelSeparator?: string;
labelAlignment?: LabelAlignment;
disabled?: boolean;
labelEllipsis?: boolean;
}
export interface AgFieldParams extends AgLabelParams {
value?: any;
width?: number;
onValueChange?: (value?: any) => void;
ariaLabel?: string | null;
}
export interface AgInputFieldParams<TComponentSelectorType extends string> extends AgFieldParams {
inputName?: string;
inputWidth?: number | 'flex';
template?: AgElementParams<TComponentSelectorType>;
inputPlaceholder?: string;
autoComplete?: boolean;
tabIndex?: number;
}
export interface AgCheckboxParams<TComponentSelectorType extends string> extends AgInputFieldParams<TComponentSelectorType> {
readOnly?: boolean;
passive?: boolean;
name?: string;
}

Some files were not shown because too many files have changed in this diff Show More