ag-studio-angular 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.html +7143 -0
- package/README.md +183 -0
- package/esm2022/lib/ag-studio.component.mjs +41 -8
- package/esm2022/lib/angularFrameworkComponentWrapper.mjs +107 -0
- package/esm2022/lib/angularFrameworkOverrides.mjs +8 -1
- package/esm2022/lib/interfaces.mjs +2 -0
- package/esm2022/public-api.mjs +3 -1
- package/fesm2022/ag-studio-angular.mjs +152 -10
- package/fesm2022/ag-studio-angular.mjs.map +1 -1
- package/lib/ag-studio.component.d.ts +34 -12
- package/lib/angularFrameworkComponentWrapper.d.ts +25 -0
- package/lib/angularFrameworkOverrides.d.ts +1 -0
- package/lib/interfaces.d.ts +31 -0
- package/package.json +2 -2
- package/public-api.d.ts +2 -0
|
@@ -21,6 +21,7 @@ export declare class AngularFrameworkOverrides extends _VanillaFrameworkOverride
|
|
|
21
21
|
* This means users can update templates and use binding without having to do anything extra.
|
|
22
22
|
*/
|
|
23
23
|
wrapOutgoing: <T>(callback: () => T) => T;
|
|
24
|
+
isFrameworkComponent(comp: any): boolean;
|
|
24
25
|
runInsideAngular<T>(callback: () => T): T;
|
|
25
26
|
runOutsideAngular<T>(callback: () => T, source?: FrameworkOverridesIncomingSource): T;
|
|
26
27
|
static ɵfac: i0.ɵɵFactoryDeclaration<AngularFrameworkOverrides, never>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Type } from '@angular/core';
|
|
2
|
+
import type { AgBaseRegistry, AgBaseWidgetDefinition, AgDefaultWidgetType, AgMaybePromise, AgTypeScriptComponent, AgWidgetData, AgWidgetDataFormat, AgWidgetParams, AgWidgetRegistry } from 'ag-studio';
|
|
3
|
+
export interface AgCustomComponent<TParams, TReturn = void> {
|
|
4
|
+
/** Called once on initialisation with params for rendering this component. */
|
|
5
|
+
agInit(params: TParams): AgMaybePromise<TReturn>;
|
|
6
|
+
/** Called for every subsequent params update. */
|
|
7
|
+
refresh?(params: TParams): AgMaybePromise<TReturn>;
|
|
8
|
+
}
|
|
9
|
+
export interface AgWidgetDefinition<TWidgetType extends string = string, TIn extends AgWidgetData<unknown, AgWidgetDataFormat<unknown>> = any, TOut extends AgWidgetData<unknown, AgWidgetDataFormat<unknown>> = TIn, TOptions = unknown> extends AgBaseWidgetDefinition<TWidgetType, TIn, TOut, TOptions> {
|
|
10
|
+
/**
|
|
11
|
+
* Custom component. Either:
|
|
12
|
+
* - A `string` that matches a custom component in the studio `components` property
|
|
13
|
+
* - A custom Angular component class
|
|
14
|
+
* - A custom TypeScript component (no Angular; working directly with the DOM)
|
|
15
|
+
*/
|
|
16
|
+
comp: string | Type<AgCustomComponent<AgWidgetParams<TOut>>> | (new () => AgTypeScriptComponent<AgWidgetParams<TOut>>);
|
|
17
|
+
}
|
|
18
|
+
type StringCompWidgetType<TDef extends AgBaseWidgetDefinition> = TDef['comp'] extends string ? TDef : never;
|
|
19
|
+
type ExtractStateFromDef<TDef> = TDef extends AgWidgetDefinition<any, any, infer TState> ? TState : never;
|
|
20
|
+
type MatchingDef<TDef, TWidgetType> = TDef extends {
|
|
21
|
+
id: TWidgetType;
|
|
22
|
+
} ? TDef : never;
|
|
23
|
+
type WidgetCustomComp<TParams extends AgWidgetParams> = Type<AgCustomComponent<TParams>> | (new () => AgTypeScriptComponent<TParams>);
|
|
24
|
+
export type AgCustomComponentDefs<TRegistry extends AgBaseRegistry> = {
|
|
25
|
+
[K in Exclude<StringCompWidgetType<AgWidgetRegistry<TRegistry>>['comp'], AgDefaultWidgetType>]?: WidgetCustomComp<AgWidgetParams<ExtractStateFromDef<MatchingDef<AgWidgetRegistry<TRegistry>, K>>>>;
|
|
26
|
+
};
|
|
27
|
+
export interface AgRegistry extends AgBaseRegistry {
|
|
28
|
+
widgets: readonly AgWidgetDefinition[];
|
|
29
|
+
components: AgCustomComponentDefs<this>;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ag-studio-angular",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "AG Studio Angular Component",
|
|
5
5
|
"license": "Commercial",
|
|
6
6
|
"peerDependencies": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"@angular/core": ">= 18.0.0"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"ag-studio": "1.
|
|
11
|
+
"ag-studio": "1.1.0",
|
|
12
12
|
"tslib": "^2.3.0"
|
|
13
13
|
},
|
|
14
14
|
"bugs": {
|