ngx-form-designer 0.0.6
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/README.md +269 -0
- package/fesm2022/ngx-form-designer.mjs +26762 -0
- package/fesm2022/ngx-form-designer.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/data/data-catalog.d.ts +44 -0
- package/lib/data/data-provider.d.ts +58 -0
- package/lib/data/data-source-client.d.ts +59 -0
- package/lib/data/data-source-parsers.d.ts +5 -0
- package/lib/data/file-upload-client.d.ts +19 -0
- package/lib/data/http-data-source-client.d.ts +31 -0
- package/lib/data/in-memory-data-catalog.service.d.ts +12 -0
- package/lib/data/tree-utils.d.ts +28 -0
- package/lib/email-renderer/email-renderer.component.d.ts +21 -0
- package/lib/form-core/form-engine.d.ts +48 -0
- package/lib/form-core/form-event-runner.d.ts +15 -0
- package/lib/form-core/models.d.ts +255 -0
- package/lib/form-core/plugin-metadata.d.ts +10 -0
- package/lib/form-core/rule-evaluation.service.d.ts +18 -0
- package/lib/form-core/schema-factory.d.ts +11 -0
- package/lib/form-core/schema-guard.d.ts +18 -0
- package/lib/form-designer/data-panel/data-panel.component.d.ts +73 -0
- package/lib/form-designer/designer-context.service.d.ts +29 -0
- package/lib/form-designer/designer-state.service.d.ts +133 -0
- package/lib/form-designer/dynamic-properties/dynamic-properties.component.d.ts +89 -0
- package/lib/form-designer/events-panel/events-panel.component.d.ts +21 -0
- package/lib/form-designer/field-palette.component.d.ts +99 -0
- package/lib/form-designer/form-designer-shell.component.d.ts +46 -0
- package/lib/form-designer/form-preview.component.d.ts +21 -0
- package/lib/form-designer/form-settings-inspector.component.d.ts +14 -0
- package/lib/form-designer/global-data-manager.component.d.ts +32 -0
- package/lib/form-designer/inspector-sections/inspector-advanced-section.component.d.ts +17 -0
- package/lib/form-designer/inspector-sections/inspector-backgrounds-section.component.d.ts +14 -0
- package/lib/form-designer/inspector-sections/inspector-borders-section.component.d.ts +45 -0
- package/lib/form-designer/inspector-sections/inspector-effects-section.component.d.ts +22 -0
- package/lib/form-designer/inspector-sections/inspector-layout-section.component.d.ts +33 -0
- package/lib/form-designer/inspector-sections/inspector-position-section.component.d.ts +28 -0
- package/lib/form-designer/inspector-sections/inspector-size-section.component.d.ts +18 -0
- package/lib/form-designer/inspector-sections/inspector-spacing-section.component.d.ts +12 -0
- package/lib/form-designer/inspector-sections/inspector-typography-section.component.d.ts +21 -0
- package/lib/form-designer/json-form-designer.component.d.ts +12 -0
- package/lib/form-designer/layer-tree/layer-tree.component.d.ts +24 -0
- package/lib/form-designer/layout-canvas.component.d.ts +70 -0
- package/lib/form-designer/page-style.d.ts +2 -0
- package/lib/form-designer/properties-panel.component.d.ts +68 -0
- package/lib/form-designer/rules-editor/query-builder/query-builder.component.d.ts +23 -0
- package/lib/form-designer/rules-editor/rules-panel/rules-panel.component.d.ts +14 -0
- package/lib/form-designer/services/widget-definition-resolver.service.d.ts +38 -0
- package/lib/form-designer/template-library.d.ts +9 -0
- package/lib/form-designer/widget-inspector.component.d.ts +27 -0
- package/lib/form-renderer/json-form-renderer.component.d.ts +50 -0
- package/lib/form-renderer/layout-node.component.d.ts +85 -0
- package/lib/plugins/core-plugins.d.ts +5 -0
- package/lib/plugins/designer-plugin.d.ts +15 -0
- package/lib/plugins/plugin-context.d.ts +18 -0
- package/lib/plugins/plugin-providers.d.ts +3 -0
- package/lib/plugins/section-definition.d.ts +16 -0
- package/lib/theme/theme.service.d.ts +15 -0
- package/lib/ui/json-schema-editor.component.d.ts +27 -0
- package/lib/ui/monaco-editor.component.d.ts +24 -0
- package/lib/ui/ui-accordion.component.d.ts +11 -0
- package/lib/ui/ui-box-model.component.d.ts +55 -0
- package/lib/ui/ui-color-swatch.component.d.ts +12 -0
- package/lib/ui/ui-dimension.component.d.ts +21 -0
- package/lib/ui/ui-edge-box.component.d.ts +20 -0
- package/lib/ui/ui-field-wrapper.component.d.ts +8 -0
- package/lib/ui/ui-icon.module.d.ts +7 -0
- package/lib/ui/ui-input.component.d.ts +17 -0
- package/lib/ui/ui-range-number.component.d.ts +16 -0
- package/lib/ui/ui-select-icon.component.d.ts +18 -0
- package/lib/ui/ui-tabs.component.d.ts +25 -0
- package/lib/website/website-brick-studio.component.d.ts +67 -0
- package/lib/website/website-designer-shell.component.d.ts +53 -0
- package/lib/website/website-preview-shell.component.d.ts +25 -0
- package/lib/website/website-project.models.d.ts +78 -0
- package/lib/website/website-project.service.d.ts +50 -0
- package/lib/website/website-section-library.d.ts +6 -0
- package/lib/widgets/email-widgets/email-button-widget.component.d.ts +15 -0
- package/lib/widgets/email-widgets/email-heading-widget.component.d.ts +15 -0
- package/lib/widgets/email-widgets/email-text-widget.component.d.ts +13 -0
- package/lib/widgets/email-widgets.d.ts +2 -0
- package/lib/widgets/field-widgets/checkbox/checkbox-widget.component.d.ts +28 -0
- package/lib/widgets/field-widgets/checkbox-group/checkbox-group-widget.component.d.ts +40 -0
- package/lib/widgets/field-widgets/file-upload/file-upload-widget.component.d.ts +45 -0
- package/lib/widgets/field-widgets/radio/radio-widget.component.d.ts +39 -0
- package/lib/widgets/field-widgets/select/select-widget.component.d.ts +36 -0
- package/lib/widgets/field-widgets/text-field/text-field.component.d.ts +29 -0
- package/lib/widgets/field-widgets/tree-select/tree-select-widget.component.d.ts +47 -0
- package/lib/widgets/page-link-context.d.ts +8 -0
- package/lib/widgets/page-widgets/brick-settings.component.d.ts +23 -0
- package/lib/widgets/page-widgets/brick-widget.component.d.ts +47 -0
- package/lib/widgets/page-widgets/button-link-settings.component.d.ts +23 -0
- package/lib/widgets/page-widgets/button-widget.component.d.ts +21 -0
- package/lib/widgets/page-widgets/heading-widget.component.d.ts +22 -0
- package/lib/widgets/page-widgets/inline-quill-editor.component.d.ts +34 -0
- package/lib/widgets/page-widgets/table-inspector.component.d.ts +17 -0
- package/lib/widgets/page-widgets/table-widget.component.d.ts +35 -0
- package/lib/widgets/page-widgets/text-block-widget.component.d.ts +22 -0
- package/lib/widgets/page-widgets.d.ts +2 -0
- package/lib/widgets/static-widgets/image/image-widget.component.d.ts +18 -0
- package/lib/widgets/style-helpers.d.ts +8 -0
- package/lib/widgets/style-properties.d.ts +28 -0
- package/lib/widgets/style-sections.d.ts +1 -0
- package/lib/widgets/table-widget.d.ts +2 -0
- package/lib/widgets/widget-definition.d.ts +76 -0
- package/lib/widgets/widget-editor-context.d.ts +8 -0
- package/lib/widgets/widget-packs.d.ts +4 -0
- package/lib/widgets/widgets.d.ts +2 -0
- package/package.json +47 -0
- package/public-api.d.ts +68 -0
- package/tailwind.preset.js +51 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines a global data source available in the application.
|
|
3
|
+
*/
|
|
4
|
+
export interface DataSourceDefinition {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
type: 'csv' | 'excel' | 'json' | 'api';
|
|
8
|
+
version?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
tags?: string[];
|
|
11
|
+
schema?: Record<string, 'string' | 'number' | 'boolean' | 'date' | 'any'>;
|
|
12
|
+
url?: string;
|
|
13
|
+
fileId?: string;
|
|
14
|
+
resultPath?: string;
|
|
15
|
+
labelKey?: string;
|
|
16
|
+
valueKey?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Abstract contract for a global data catalog.
|
|
20
|
+
* Implementation will live in the host app or a future adapter.
|
|
21
|
+
*/
|
|
22
|
+
export declare abstract class DataCatalog {
|
|
23
|
+
/**
|
|
24
|
+
* Return all registered data sources available to the designer/runtime.
|
|
25
|
+
*/
|
|
26
|
+
abstract listSources(): DataSourceDefinition[];
|
|
27
|
+
/**
|
|
28
|
+
* Look up a single data source by its ID.
|
|
29
|
+
*/
|
|
30
|
+
abstract getSourceById(id: string): DataSourceDefinition | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Return all rows for a given source ID.
|
|
33
|
+
* Implementation can fetch from memory, storage, or a backend in the host app.
|
|
34
|
+
*/
|
|
35
|
+
abstract getRows(id: string): any[];
|
|
36
|
+
/**
|
|
37
|
+
* Optional: Add or update a data source.
|
|
38
|
+
*/
|
|
39
|
+
abstract upsert?(def: DataSourceDefinition, rows: any[]): void;
|
|
40
|
+
/**
|
|
41
|
+
* Optional: Remove a data source.
|
|
42
|
+
*/
|
|
43
|
+
abstract remove?(id: string): void;
|
|
44
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
import { FieldSchema, DataSourceConfig, OptionSchema } from '../form-core/models';
|
|
3
|
+
import { FormEngine } from '../form-core/form-engine';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Central abstraction for resolving data for widgets.
|
|
7
|
+
* Implementations can be overridden by host apps if needed.
|
|
8
|
+
*/
|
|
9
|
+
export interface OptionsQuery {
|
|
10
|
+
term?: string;
|
|
11
|
+
limit?: number;
|
|
12
|
+
columns?: string[];
|
|
13
|
+
}
|
|
14
|
+
export declare abstract class DataProvider {
|
|
15
|
+
abstract getOptions(field: FieldSchema, engine?: FormEngine): Promise<OptionSchema[]>;
|
|
16
|
+
abstract getList(field: FieldSchema, engine?: FormEngine): Promise<any[]>;
|
|
17
|
+
abstract getValue(field: FieldSchema, engine?: FormEngine): Promise<any>;
|
|
18
|
+
abstract resolveValue(field: FieldSchema, value: any): Promise<string>;
|
|
19
|
+
queryOptions(field: FieldSchema, query: {
|
|
20
|
+
term: string;
|
|
21
|
+
limit?: number;
|
|
22
|
+
}, engine?: FormEngine): Promise<any[]>;
|
|
23
|
+
queryList(field: FieldSchema, query: ListQuery, engine?: FormEngine): Promise<ListResult>;
|
|
24
|
+
}
|
|
25
|
+
export interface ListQuery {
|
|
26
|
+
term?: string;
|
|
27
|
+
limit?: number;
|
|
28
|
+
offset?: number;
|
|
29
|
+
sort?: {
|
|
30
|
+
column: string;
|
|
31
|
+
dir: 'asc' | 'desc';
|
|
32
|
+
}[];
|
|
33
|
+
}
|
|
34
|
+
export interface ListResult {
|
|
35
|
+
rows: any[];
|
|
36
|
+
total: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Helper to safely get the effective DataSourceConfig for a field.
|
|
40
|
+
*/
|
|
41
|
+
export declare function getEffectiveDataConfig(field: FieldSchema): DataSourceConfig;
|
|
42
|
+
export declare const DATA_PROVIDER: InjectionToken<DataProvider>;
|
|
43
|
+
export declare class DefaultDataProvider extends DataProvider {
|
|
44
|
+
private client;
|
|
45
|
+
getOptions(field: FieldSchema, engine?: FormEngine): Promise<OptionSchema[]>;
|
|
46
|
+
queryOptions(field: FieldSchema, query: OptionsQuery, engine?: FormEngine): Promise<OptionSchema[]>;
|
|
47
|
+
getList(field: FieldSchema, engine?: FormEngine): Promise<any[]>;
|
|
48
|
+
queryList(field: FieldSchema, query: ListQuery, engine?: FormEngine): Promise<ListResult>;
|
|
49
|
+
getValue(field: FieldSchema, engine?: FormEngine): Promise<any>;
|
|
50
|
+
resolveValue(field: FieldSchema, value: any): Promise<string>;
|
|
51
|
+
private getRawRows;
|
|
52
|
+
private getGlobalRows;
|
|
53
|
+
private applyRowFilters;
|
|
54
|
+
private resolveFilters;
|
|
55
|
+
private resolveFilterValue;
|
|
56
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DefaultDataProvider, never>;
|
|
57
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DefaultDataProvider>;
|
|
58
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
import { DataSourceDefinition } from './data-catalog';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export interface DataSourceColumn {
|
|
5
|
+
name: string;
|
|
6
|
+
type?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface DataSourceQueryFilter {
|
|
9
|
+
column: string;
|
|
10
|
+
op: 'eq' | 'neq' | 'in' | 'contains' | 'startsWith' | 'endsWith' | 'gt' | 'gte' | 'lt' | 'lte' | 'like';
|
|
11
|
+
value: any;
|
|
12
|
+
}
|
|
13
|
+
export interface DataSourceQuery {
|
|
14
|
+
select?: string[];
|
|
15
|
+
filters?: DataSourceQueryFilter[];
|
|
16
|
+
search?: {
|
|
17
|
+
term: string;
|
|
18
|
+
columns?: string[];
|
|
19
|
+
};
|
|
20
|
+
sort?: {
|
|
21
|
+
column: string;
|
|
22
|
+
dir: 'asc' | 'desc';
|
|
23
|
+
}[];
|
|
24
|
+
page?: {
|
|
25
|
+
limit?: number;
|
|
26
|
+
offset?: number;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface DataSourceQueryResult {
|
|
30
|
+
rows: any[];
|
|
31
|
+
total: number;
|
|
32
|
+
}
|
|
33
|
+
export type UploadSourceType = 'json' | 'csv';
|
|
34
|
+
export interface CreateSourceRequest {
|
|
35
|
+
id?: string;
|
|
36
|
+
label?: string;
|
|
37
|
+
type: UploadSourceType;
|
|
38
|
+
rawData: string;
|
|
39
|
+
}
|
|
40
|
+
export interface DataSourceClient {
|
|
41
|
+
listSources(): Promise<DataSourceDefinition[]>;
|
|
42
|
+
getSourceById(id: string): Promise<DataSourceDefinition | undefined>;
|
|
43
|
+
getColumns(id: string): Promise<DataSourceColumn[]>;
|
|
44
|
+
query(id: string, q?: DataSourceQuery): Promise<DataSourceQueryResult>;
|
|
45
|
+
createSource?(req: CreateSourceRequest): Promise<DataSourceDefinition>;
|
|
46
|
+
deleteSource?(sourceId: string): Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
export declare const DATA_SOURCE_CLIENT: InjectionToken<DataSourceClient>;
|
|
49
|
+
export declare class DefaultDataSourceClient implements DataSourceClient {
|
|
50
|
+
private catalog;
|
|
51
|
+
listSources(): Promise<DataSourceDefinition[]>;
|
|
52
|
+
getSourceById(id: string): Promise<DataSourceDefinition | undefined>;
|
|
53
|
+
getColumns(id: string): Promise<DataSourceColumn[]>;
|
|
54
|
+
query(id: string, q?: DataSourceQuery): Promise<DataSourceQueryResult>;
|
|
55
|
+
createSource(req: CreateSourceRequest): Promise<DataSourceDefinition>;
|
|
56
|
+
deleteSource(sourceId: string): Promise<void>;
|
|
57
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DefaultDataSourceClient, never>;
|
|
58
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DefaultDataSourceClient>;
|
|
59
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DataSourceDefinition } from './data-catalog';
|
|
2
|
+
export declare function parseJsonArray(raw: string): any[];
|
|
3
|
+
export declare function parseCsv(raw: string): any[];
|
|
4
|
+
export declare function inferSchema(rows: any[]): DataSourceDefinition['schema'];
|
|
5
|
+
export declare function slugifyId(input: string): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
import { UploadedFileRef } from '../form-core/models';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export interface FileUploadRequest {
|
|
5
|
+
endpoint: string;
|
|
6
|
+
fieldId: string;
|
|
7
|
+
fieldName: string;
|
|
8
|
+
fieldKey?: string;
|
|
9
|
+
headers?: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
export interface FileUploadClient {
|
|
12
|
+
upload(files: File[], request: FileUploadRequest): Promise<UploadedFileRef[]>;
|
|
13
|
+
}
|
|
14
|
+
export declare const FILE_UPLOAD_CLIENT: InjectionToken<FileUploadClient>;
|
|
15
|
+
export declare class DefaultFileUploadClient implements FileUploadClient {
|
|
16
|
+
upload(files: File[], request: FileUploadRequest): Promise<UploadedFileRef[]>;
|
|
17
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DefaultFileUploadClient, never>;
|
|
18
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DefaultFileUploadClient>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { InjectionToken, Provider, EnvironmentProviders } from '@angular/core';
|
|
2
|
+
import { DataSourceClient, DataSourceColumn, DataSourceQuery, DataSourceQueryResult, CreateSourceRequest } from './data-source-client';
|
|
3
|
+
import { DataSourceDefinition } from './data-catalog';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export interface HttpDataSourceClientConfig {
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
headers?: Record<string, string>;
|
|
8
|
+
getHeaders?: () => Record<string, string> | Promise<Record<string, string>>;
|
|
9
|
+
cacheTtlMs?: {
|
|
10
|
+
sources?: number;
|
|
11
|
+
columns?: number;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export declare const HTTP_DATA_SOURCE_CLIENT_CONFIG: InjectionToken<HttpDataSourceClientConfig>;
|
|
15
|
+
export declare class HttpDataSourceClient implements DataSourceClient {
|
|
16
|
+
private http;
|
|
17
|
+
private config;
|
|
18
|
+
private sourceCache;
|
|
19
|
+
private columnCache;
|
|
20
|
+
listSources(): Promise<DataSourceDefinition[]>;
|
|
21
|
+
getSourceById(id: string): Promise<DataSourceDefinition | undefined>;
|
|
22
|
+
getColumns(id: string): Promise<DataSourceColumn[]>;
|
|
23
|
+
query(id: string, q?: DataSourceQuery): Promise<DataSourceQueryResult>;
|
|
24
|
+
createSource(req: CreateSourceRequest): Promise<DataSourceDefinition>;
|
|
25
|
+
deleteSource(sourceId: string): Promise<void>;
|
|
26
|
+
private stripTrailingSlash;
|
|
27
|
+
private mergeHeaders;
|
|
28
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HttpDataSourceClient, never>;
|
|
29
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<HttpDataSourceClient>;
|
|
30
|
+
}
|
|
31
|
+
export declare function provideHttpDataSourceClient(config: HttpDataSourceClientConfig): (Provider | EnvironmentProviders)[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DataCatalog, DataSourceDefinition } from './data-catalog';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class InMemoryDataCatalogService extends DataCatalog {
|
|
4
|
+
private sources;
|
|
5
|
+
listSources(): DataSourceDefinition[];
|
|
6
|
+
getSourceById(id: string): DataSourceDefinition | undefined;
|
|
7
|
+
getRows(id: string): any[];
|
|
8
|
+
upsert(def: DataSourceDefinition, rows: any[]): void;
|
|
9
|
+
remove(id: string): void;
|
|
10
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<InMemoryDataCatalogService, never>;
|
|
11
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<InMemoryDataCatalogService>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for handling tree data structures.
|
|
3
|
+
*/
|
|
4
|
+
export interface TreeNode {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
value: any;
|
|
8
|
+
data: any;
|
|
9
|
+
children?: TreeNode[];
|
|
10
|
+
parent?: TreeNode;
|
|
11
|
+
expanded?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface TreeConfig {
|
|
14
|
+
idKey: string;
|
|
15
|
+
parentKey: string;
|
|
16
|
+
labelKey: string;
|
|
17
|
+
valueKey: string;
|
|
18
|
+
rootValue?: any;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Builds a hierarchical tree from a flat list of rows.
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildTree(rows: any[], config: TreeConfig): TreeNode[];
|
|
24
|
+
/**
|
|
25
|
+
* Filters a tree structure, returning a new tree with only matching nodes and their ancestors.
|
|
26
|
+
* Expand matching paths.
|
|
27
|
+
*/
|
|
28
|
+
export declare function filterTree(nodes: TreeNode[], term: string): TreeNode[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FormSchema, LayoutNode, WidgetNode, RowNode, ColumnNode } from '../form-core/models';
|
|
2
|
+
import { FormEngine } from '../form-core/form-engine';
|
|
3
|
+
import { WidgetDefinition } from '../widgets/widget-definition';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class EmailRendererComponent {
|
|
6
|
+
schema: FormSchema;
|
|
7
|
+
engine?: FormEngine;
|
|
8
|
+
private widgetDefs;
|
|
9
|
+
constructor(_widgetDefs: WidgetDefinition[][]);
|
|
10
|
+
isRowNode(node: LayoutNode): node is RowNode;
|
|
11
|
+
isWidgetNode(node: LayoutNode): node is WidgetNode;
|
|
12
|
+
get layoutNodes(): RowNode[];
|
|
13
|
+
getColumns(node: RowNode): ColumnNode[];
|
|
14
|
+
getColumnWidth(col: ColumnNode, totalColumns: number): number;
|
|
15
|
+
private renderWidgets;
|
|
16
|
+
private renderWidget;
|
|
17
|
+
private renderWidgetToHtml;
|
|
18
|
+
private getHeadingStyles;
|
|
19
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EmailRendererComponent, never>;
|
|
20
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EmailRendererComponent, "app-email-renderer", never, { "schema": { "alias": "schema"; "required": true; }; "engine": { "alias": "engine"; "required": false; }; }, {}, never, never, true, never>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { FormSchema } from './models';
|
|
2
|
+
/**
|
|
3
|
+
* A framework-agnostic engine to handle form state, validation, and visibility logic.
|
|
4
|
+
*/
|
|
5
|
+
import { Observable } from 'rxjs';
|
|
6
|
+
export interface UiEvent {
|
|
7
|
+
fieldId: string;
|
|
8
|
+
fieldName?: string;
|
|
9
|
+
type: 'focus' | 'blur' | 'change' | 'click' | 'dirty' | 'touched';
|
|
10
|
+
value?: any;
|
|
11
|
+
ts: number;
|
|
12
|
+
}
|
|
13
|
+
export declare class FormEngine {
|
|
14
|
+
private schema;
|
|
15
|
+
private values;
|
|
16
|
+
private errors;
|
|
17
|
+
private ruleEvaluator;
|
|
18
|
+
private valueSubject;
|
|
19
|
+
valueChanges$: Observable<Record<string, any>>;
|
|
20
|
+
private eventSubject;
|
|
21
|
+
events$: Observable<UiEvent>;
|
|
22
|
+
private submitSubject;
|
|
23
|
+
submitted$: Observable<void>;
|
|
24
|
+
get formGroup(): {
|
|
25
|
+
value: Record<string, any>;
|
|
26
|
+
valueChanges: Observable<Record<string, any>>;
|
|
27
|
+
};
|
|
28
|
+
constructor(schema: FormSchema, initialValues?: Record<string, any>);
|
|
29
|
+
getSchema(): FormSchema;
|
|
30
|
+
updateSchema(schema: FormSchema): void;
|
|
31
|
+
getValue(fieldName: string): any;
|
|
32
|
+
setValue(fieldName: string, value: any): void;
|
|
33
|
+
getValues(): Record<string, any>;
|
|
34
|
+
getErrors(): Record<string, string[]>;
|
|
35
|
+
getError(fieldName: string): string | null;
|
|
36
|
+
emitUiEvent(event: Omit<UiEvent, 'ts'>): void;
|
|
37
|
+
submit(): void;
|
|
38
|
+
validate(): Record<string, string[]>;
|
|
39
|
+
isFieldVisible(fieldId: string): boolean;
|
|
40
|
+
isFieldEnabled(fieldId: string): boolean;
|
|
41
|
+
isFieldRequired(fieldId: string): boolean;
|
|
42
|
+
private getFieldById;
|
|
43
|
+
private getFieldByName;
|
|
44
|
+
private validateField;
|
|
45
|
+
private evaluateDependencyRules;
|
|
46
|
+
private evaluateEnterpriseRules;
|
|
47
|
+
}
|
|
48
|
+
export declare function createFormEngine(schema: FormSchema, initialValues?: Record<string, any>): FormEngine;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FormEngine } from './form-engine';
|
|
2
|
+
export interface FormEventLogger {
|
|
3
|
+
log(message: string, data?: unknown): void;
|
|
4
|
+
warn(message: string, data?: unknown): void;
|
|
5
|
+
}
|
|
6
|
+
export declare class FormEventRunner {
|
|
7
|
+
private engine;
|
|
8
|
+
private logger;
|
|
9
|
+
private sub;
|
|
10
|
+
private processingDepth;
|
|
11
|
+
constructor(engine: FormEngine, logger?: FormEventLogger);
|
|
12
|
+
dispose(): void;
|
|
13
|
+
private handleEvent;
|
|
14
|
+
private handleSetValue;
|
|
15
|
+
}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
export type FieldType = 'text' | 'textarea' | 'number' | 'email' | 'password' | 'tel' | 'date' | 'time' | 'datetime-local' | 'checkbox' | 'radio' | 'select' | 'multiselect' | 'file' | 'image' | 'heading' | 'paragraph' | 'cta-button' | 'table' | (string & {});
|
|
2
|
+
export interface Html5ValidationProps {
|
|
3
|
+
required?: boolean;
|
|
4
|
+
min?: number | string;
|
|
5
|
+
max?: number | string;
|
|
6
|
+
step?: number;
|
|
7
|
+
minLength?: number;
|
|
8
|
+
maxLength?: number;
|
|
9
|
+
pattern?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ValidationRule {
|
|
12
|
+
id?: string;
|
|
13
|
+
type: 'builtin' | 'expression';
|
|
14
|
+
name?: string;
|
|
15
|
+
expression?: string;
|
|
16
|
+
message: string;
|
|
17
|
+
when?: string;
|
|
18
|
+
}
|
|
19
|
+
export type LogicOperator = 'AND' | 'OR';
|
|
20
|
+
export type ConditionOperator = 'eq' | 'neq' | 'gt' | 'lt' | 'gte' | 'lte' | 'contains' | 'startsWith' | 'endsWith' | 'empty' | 'notEmpty' | 'truthy';
|
|
21
|
+
export type RuleAction = 'visible' | 'hidden' | 'enable' | 'disable' | 'required' | 'optional';
|
|
22
|
+
export interface LogicCondition {
|
|
23
|
+
fieldId: string;
|
|
24
|
+
operator: ConditionOperator;
|
|
25
|
+
value?: any;
|
|
26
|
+
}
|
|
27
|
+
export interface LogicGroup {
|
|
28
|
+
operator: LogicOperator;
|
|
29
|
+
conditions: (LogicCondition | LogicGroup)[];
|
|
30
|
+
}
|
|
31
|
+
export interface FormRule {
|
|
32
|
+
id: string;
|
|
33
|
+
name?: string;
|
|
34
|
+
conditions: LogicGroup;
|
|
35
|
+
action: RuleAction;
|
|
36
|
+
}
|
|
37
|
+
export interface WidgetStyleSchema {
|
|
38
|
+
width?: string | number;
|
|
39
|
+
height?: string | number;
|
|
40
|
+
minWidth?: string | number;
|
|
41
|
+
minHeight?: string | number;
|
|
42
|
+
maxWidth?: string | number;
|
|
43
|
+
maxHeight?: string | number;
|
|
44
|
+
alignX?: 'left' | 'center' | 'right' | 'stretch';
|
|
45
|
+
alignY?: 'top' | 'middle' | 'bottom' | 'stretch';
|
|
46
|
+
margin?: string;
|
|
47
|
+
marginTop?: string | number;
|
|
48
|
+
marginRight?: string | number;
|
|
49
|
+
marginBottom?: string | number;
|
|
50
|
+
marginLeft?: string | number;
|
|
51
|
+
padding?: string;
|
|
52
|
+
paddingTop?: string | number;
|
|
53
|
+
paddingRight?: string | number;
|
|
54
|
+
paddingBottom?: string | number;
|
|
55
|
+
paddingLeft?: string | number;
|
|
56
|
+
backgroundColor?: string;
|
|
57
|
+
color?: string;
|
|
58
|
+
borderRadius?: string | number;
|
|
59
|
+
borderWidth?: string | number;
|
|
60
|
+
borderColor?: string;
|
|
61
|
+
borderStyle?: 'solid' | 'dashed' | 'dotted' | 'none';
|
|
62
|
+
fontSize?: string | number;
|
|
63
|
+
fontWeight?: string | number;
|
|
64
|
+
lineHeight?: string | number;
|
|
65
|
+
textAlign?: 'left' | 'center' | 'right' | 'justify';
|
|
66
|
+
transformX?: number;
|
|
67
|
+
transformY?: number;
|
|
68
|
+
transformZ?: number;
|
|
69
|
+
rotate?: number;
|
|
70
|
+
scale?: number;
|
|
71
|
+
opacity?: number;
|
|
72
|
+
boxShadow?: string;
|
|
73
|
+
[key: string]: any;
|
|
74
|
+
}
|
|
75
|
+
export interface UploadedFileRef {
|
|
76
|
+
id?: string;
|
|
77
|
+
name?: string;
|
|
78
|
+
size?: number;
|
|
79
|
+
type?: string;
|
|
80
|
+
url?: string;
|
|
81
|
+
}
|
|
82
|
+
export type FileUploadValue = UploadedFileRef | UploadedFileRef[] | null;
|
|
83
|
+
export interface FieldSchema {
|
|
84
|
+
id: string;
|
|
85
|
+
widgetId?: string;
|
|
86
|
+
name: string;
|
|
87
|
+
type: FieldType;
|
|
88
|
+
groupKey?: string;
|
|
89
|
+
label?: string;
|
|
90
|
+
placeholder?: string;
|
|
91
|
+
helpText?: string;
|
|
92
|
+
tooltip?: string;
|
|
93
|
+
defaultValue?: any;
|
|
94
|
+
accept?: string;
|
|
95
|
+
multiple?: boolean;
|
|
96
|
+
uploadUrl?: string;
|
|
97
|
+
uploadFieldName?: string;
|
|
98
|
+
appearance?: 'outline' | 'fill' | 'standard';
|
|
99
|
+
readonly?: boolean;
|
|
100
|
+
disabled?: boolean;
|
|
101
|
+
prefixIcon?: string;
|
|
102
|
+
suffixIcon?: string;
|
|
103
|
+
html5?: Html5ValidationProps;
|
|
104
|
+
validation?: ValidationRule[];
|
|
105
|
+
dependencies?: DependencyRule[];
|
|
106
|
+
conditionalVisibility?: ConditionalVisibility;
|
|
107
|
+
rules?: FormRule[];
|
|
108
|
+
dataConfig?: DataSourceConfig;
|
|
109
|
+
events?: WidgetEventBinding[];
|
|
110
|
+
dataSourceId?: string;
|
|
111
|
+
staticOptions?: OptionSchema[];
|
|
112
|
+
style?: WidgetStyleSchema;
|
|
113
|
+
metadata?: Record<string, unknown>;
|
|
114
|
+
[key: string]: any;
|
|
115
|
+
}
|
|
116
|
+
export interface DataSourceConfig {
|
|
117
|
+
type: 'static' | 'api' | 'context' | 'global' | 'source';
|
|
118
|
+
staticValue?: any;
|
|
119
|
+
staticOptions?: OptionSchema[];
|
|
120
|
+
endpoint?: string;
|
|
121
|
+
method?: 'GET' | 'POST';
|
|
122
|
+
headers?: Record<string, string>;
|
|
123
|
+
resultPath?: string;
|
|
124
|
+
labelKey?: string;
|
|
125
|
+
valueKey?: string;
|
|
126
|
+
contextKey?: string;
|
|
127
|
+
sourceId?: string;
|
|
128
|
+
dependsOn?: DataDependencyBinding[];
|
|
129
|
+
filters?: DataFilter[];
|
|
130
|
+
treeIdKey?: string;
|
|
131
|
+
treeParentKey?: string;
|
|
132
|
+
treeRootValue?: any;
|
|
133
|
+
searchEnabled?: boolean;
|
|
134
|
+
searchColumns?: string[];
|
|
135
|
+
optionsLimit?: number;
|
|
136
|
+
pageSize?: number;
|
|
137
|
+
sort?: {
|
|
138
|
+
column: string;
|
|
139
|
+
dir: 'asc' | 'desc';
|
|
140
|
+
}[];
|
|
141
|
+
}
|
|
142
|
+
export type DataFilterOperator = 'eq' | 'neq' | 'in' | 'contains' | 'startsWith' | 'endsWith' | 'gt' | 'gte' | 'lt' | 'lte' | 'like';
|
|
143
|
+
export interface DataFilter {
|
|
144
|
+
column: string;
|
|
145
|
+
op: DataFilterOperator;
|
|
146
|
+
valueFrom?: 'field' | 'literal';
|
|
147
|
+
fieldId?: string;
|
|
148
|
+
valueLiteral?: any;
|
|
149
|
+
}
|
|
150
|
+
export type WidgetEventType = 'focus' | 'blur' | 'change' | 'click' | 'dirty' | 'touched';
|
|
151
|
+
export interface WidgetEventActionSetValue {
|
|
152
|
+
type: 'setValue';
|
|
153
|
+
targetFieldId: string;
|
|
154
|
+
valueFrom: 'literal' | 'field' | 'event';
|
|
155
|
+
valueLiteral?: any;
|
|
156
|
+
sourceFieldId?: string;
|
|
157
|
+
}
|
|
158
|
+
export interface WidgetEventActionLog {
|
|
159
|
+
type: 'log';
|
|
160
|
+
message?: string;
|
|
161
|
+
}
|
|
162
|
+
export type WidgetEventAction = WidgetEventActionSetValue | WidgetEventActionLog;
|
|
163
|
+
export interface WidgetEventBinding {
|
|
164
|
+
id: string;
|
|
165
|
+
on: WidgetEventType;
|
|
166
|
+
enabled?: boolean;
|
|
167
|
+
actions: WidgetEventAction[];
|
|
168
|
+
}
|
|
169
|
+
export interface DataDependencyBinding {
|
|
170
|
+
fieldId: string;
|
|
171
|
+
paramKey: string;
|
|
172
|
+
}
|
|
173
|
+
export interface ConditionalVisibility {
|
|
174
|
+
fieldName: string;
|
|
175
|
+
operator: 'equals' | 'notEquals' | 'contains' | 'isEmpty' | 'isNotEmpty' | 'greaterThan' | 'lessThan';
|
|
176
|
+
value?: any;
|
|
177
|
+
}
|
|
178
|
+
export interface OptionSchema {
|
|
179
|
+
label: string;
|
|
180
|
+
value: string | number;
|
|
181
|
+
}
|
|
182
|
+
export interface DependencyRule {
|
|
183
|
+
effect: 'show' | 'hide' | 'enable' | 'disable' | 'require' | 'optional';
|
|
184
|
+
when: string;
|
|
185
|
+
}
|
|
186
|
+
export type WidgetKind = 'field' | 'image' | 'text' | 'table' | 'button';
|
|
187
|
+
export interface ResponsiveSpan {
|
|
188
|
+
xs?: number;
|
|
189
|
+
sm?: number;
|
|
190
|
+
md?: number;
|
|
191
|
+
lg?: number;
|
|
192
|
+
xl?: number;
|
|
193
|
+
'2xl'?: number;
|
|
194
|
+
}
|
|
195
|
+
export type LayoutNode = RowNode | ColumnNode | WidgetNode;
|
|
196
|
+
export interface BaseNode {
|
|
197
|
+
id: string;
|
|
198
|
+
type: 'row' | 'col' | 'widget';
|
|
199
|
+
style?: StyleTokenSet;
|
|
200
|
+
parent?: string;
|
|
201
|
+
}
|
|
202
|
+
export interface RowNode extends BaseNode {
|
|
203
|
+
type: 'row';
|
|
204
|
+
children: ColumnNode[];
|
|
205
|
+
maxColumns?: number;
|
|
206
|
+
}
|
|
207
|
+
export interface ColumnNode extends BaseNode {
|
|
208
|
+
type: 'col';
|
|
209
|
+
responsive: ResponsiveSpan;
|
|
210
|
+
children: LayoutNode[];
|
|
211
|
+
}
|
|
212
|
+
export interface WidgetNode extends BaseNode {
|
|
213
|
+
type: 'widget';
|
|
214
|
+
widgetKind: WidgetKind;
|
|
215
|
+
refId: string;
|
|
216
|
+
}
|
|
217
|
+
export type SpacingToken = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
218
|
+
export interface StyleTokenSet {
|
|
219
|
+
fontFamily?: string;
|
|
220
|
+
fontSize?: string;
|
|
221
|
+
fontWeight?: string;
|
|
222
|
+
textAlign?: 'left' | 'center' | 'right';
|
|
223
|
+
padding?: SpacingToken | string;
|
|
224
|
+
margin?: SpacingToken | string;
|
|
225
|
+
borderRadius?: string;
|
|
226
|
+
borderColor?: string;
|
|
227
|
+
backgroundColor?: string;
|
|
228
|
+
minHeight?: string;
|
|
229
|
+
marginBottom?: SpacingToken | string;
|
|
230
|
+
gap?: SpacingToken | string;
|
|
231
|
+
width?: string;
|
|
232
|
+
height?: string;
|
|
233
|
+
[key: string]: any;
|
|
234
|
+
}
|
|
235
|
+
export interface FormUIConfig {
|
|
236
|
+
themeId?: string;
|
|
237
|
+
baseStyle?: StyleTokenSet;
|
|
238
|
+
}
|
|
239
|
+
export type DesignerFlavor = 'form' | 'web' | 'email' | 'pdf';
|
|
240
|
+
export declare const CURRENT_SCHEMA_VERSION = "1.0.0";
|
|
241
|
+
export interface FormSchema {
|
|
242
|
+
id: string;
|
|
243
|
+
version: string;
|
|
244
|
+
schemaVersion?: string;
|
|
245
|
+
flavor?: DesignerFlavor;
|
|
246
|
+
title?: string;
|
|
247
|
+
description?: string;
|
|
248
|
+
metadata?: Record<string, unknown>;
|
|
249
|
+
fields: FieldSchema[];
|
|
250
|
+
layout: LayoutNode;
|
|
251
|
+
ui?: FormUIConfig;
|
|
252
|
+
submitButtonText?: string;
|
|
253
|
+
resetButtonText?: string;
|
|
254
|
+
showResetButton?: boolean;
|
|
255
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FormSchema, FieldSchema } from './models';
|
|
2
|
+
/**
|
|
3
|
+
* Helper methodology for plugins to store JSON data on the schema/fields.
|
|
4
|
+
* pluginId should be the same ID used in DesignerPlugin.id and in defineWidget(pluginId, ...).
|
|
5
|
+
* This keeps everything portable and AI-friendly.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getPluginSchemaMeta<T = unknown>(schema: FormSchema, pluginId: string): T | undefined;
|
|
8
|
+
export declare function setPluginSchemaMeta<T = unknown>(schema: FormSchema, pluginId: string, value: T): FormSchema;
|
|
9
|
+
export declare function getPluginFieldMeta<T = unknown>(field: FieldSchema, pluginId: string): T | undefined;
|
|
10
|
+
export declare function setPluginFieldMeta<T = unknown>(field: FieldSchema, pluginId: string, value: T): FieldSchema;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FormRule } from './models';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class RuleEvaluationService {
|
|
4
|
+
constructor();
|
|
5
|
+
/**
|
|
6
|
+
* Evaluates a single rule against the current form data.
|
|
7
|
+
* Returns true if the rule's conditions are met.
|
|
8
|
+
*/
|
|
9
|
+
evaluateRule(rule: FormRule, formData: any): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Recursively evaluates a LogicGroup (AND/OR).
|
|
12
|
+
*/
|
|
13
|
+
private evaluateGroup;
|
|
14
|
+
private evaluateConditionOrGroup;
|
|
15
|
+
private evaluateCondition;
|
|
16
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RuleEvaluationService, never>;
|
|
17
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<RuleEvaluationService>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FormSchema, DesignerFlavor } from './models';
|
|
2
|
+
/**
|
|
3
|
+
* Metadata field is intended for AI/LLM and project-level information (prompts, generation parameters, tags).
|
|
4
|
+
* SchemaVersion will be used for future migrations as more flavors (audio/video/image editors, tables, etc.) are added.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createEmptySchema(flavor?: DesignerFlavor, opts?: {
|
|
7
|
+
title?: string;
|
|
8
|
+
id?: string;
|
|
9
|
+
}): FormSchema;
|
|
10
|
+
export declare function serializeSchema(schema: FormSchema): string;
|
|
11
|
+
export declare function parseSchema(json: string): FormSchema;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FormSchema } from './models';
|
|
2
|
+
export interface SchemaGuardIssue {
|
|
3
|
+
level: 'warn' | 'error';
|
|
4
|
+
message: string;
|
|
5
|
+
fieldId?: string;
|
|
6
|
+
fieldName?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Checks the schema for violations of the "API-Only Source" architecture.
|
|
10
|
+
* This is a read-only check that does not mutate the schema.
|
|
11
|
+
*/
|
|
12
|
+
export declare function checkSchemaForApiOnlySources(schema: FormSchema): SchemaGuardIssue[];
|
|
13
|
+
/**
|
|
14
|
+
* Manually sanitizes a schema by removing embedded data from source-backed fields.
|
|
15
|
+
* Returns a deep copy of the modified schema.
|
|
16
|
+
* use this for debugging only.
|
|
17
|
+
*/
|
|
18
|
+
export declare function stripEmbeddedSourceData(schema: FormSchema): FormSchema;
|