@ngx-formly-builder/core 0.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/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ngx-formly-builder/core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Embeddable Angular Formly visual builder component and core APIs.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"angular",
|
|
7
|
+
"formly",
|
|
8
|
+
"form-builder",
|
|
9
|
+
"low-code",
|
|
10
|
+
"json-schema"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/bmickoski/formly-form-builder#readme",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public",
|
|
17
|
+
"registry": "https://registry.npmjs.org/"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"@angular/animations": "^21.0.0",
|
|
21
|
+
"@angular/cdk": "^21.0.0",
|
|
22
|
+
"@angular/common": "^21.0.0",
|
|
23
|
+
"@angular/core": "^21.0.0",
|
|
24
|
+
"@angular/forms": "^21.0.0",
|
|
25
|
+
"@angular/material": "^21.0.0",
|
|
26
|
+
"@angular/platform-browser": "^21.0.0",
|
|
27
|
+
"@angular/router": "^21.0.0",
|
|
28
|
+
"@ngx-formly/bootstrap": "^7.0.0",
|
|
29
|
+
"@ngx-formly/core": "^7.0.0",
|
|
30
|
+
"@ngx-formly/material": "^7.0.0",
|
|
31
|
+
"rxjs": "^7.8.0"
|
|
32
|
+
},
|
|
33
|
+
"peerDependenciesMeta": {
|
|
34
|
+
"@ngx-formly/bootstrap": {
|
|
35
|
+
"optional": true
|
|
36
|
+
},
|
|
37
|
+
"@ngx-formly/material": {
|
|
38
|
+
"optional": true
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"tslib": "^2.6.0"
|
|
43
|
+
},
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "https://github.com/bmickoski/formly-form-builder.git"
|
|
47
|
+
},
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/bmickoski/formly-form-builder/issues"
|
|
50
|
+
},
|
|
51
|
+
"module": "fesm2022/ngx-formly-builder-core.mjs",
|
|
52
|
+
"typings": "types/ngx-formly-builder-core.d.ts",
|
|
53
|
+
"exports": {
|
|
54
|
+
"./package.json": {
|
|
55
|
+
"default": "./package.json"
|
|
56
|
+
},
|
|
57
|
+
".": {
|
|
58
|
+
"types": "./types/ngx-formly-builder-core.d.ts",
|
|
59
|
+
"default": "./fesm2022/ngx-formly-builder-core.mjs"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
import { FormlyFieldConfig } from '@ngx-formly/core';
|
|
2
|
+
import * as _angular_core from '@angular/core';
|
|
3
|
+
import { InjectionToken, OnInit, OnChanges, EventEmitter, SimpleChanges } from '@angular/core';
|
|
4
|
+
import * as _ngx_formly_builder_core from '@ngx-formly-builder/core';
|
|
5
|
+
|
|
6
|
+
type BuilderNodeType = 'field' | 'panel' | 'row' | 'col' | 'tabs' | 'stepper' | 'accordion';
|
|
7
|
+
type PreviewRenderer = 'material' | 'bootstrap';
|
|
8
|
+
type FieldKind = 'input' | 'textarea' | 'checkbox' | 'radio' | 'select' | 'date' | 'number' | 'email' | 'password' | 'tel' | 'url' | 'file' | 'multiselect' | 'repeater';
|
|
9
|
+
type AsyncUniqueSourceType = 'url' | 'lookup';
|
|
10
|
+
type ValidatorPresetParamType = 'string' | 'number' | 'boolean';
|
|
11
|
+
type ValidatorPresetParamValue = string | number | boolean;
|
|
12
|
+
interface AsyncUniqueValidator {
|
|
13
|
+
sourceType: AsyncUniqueSourceType;
|
|
14
|
+
url?: string;
|
|
15
|
+
lookupKey?: string;
|
|
16
|
+
listPath?: string;
|
|
17
|
+
valueKey?: string;
|
|
18
|
+
caseSensitive?: boolean;
|
|
19
|
+
message?: string;
|
|
20
|
+
}
|
|
21
|
+
interface BuilderValidators {
|
|
22
|
+
required?: boolean;
|
|
23
|
+
minLength?: number | null;
|
|
24
|
+
maxLength?: number | null;
|
|
25
|
+
min?: number | null;
|
|
26
|
+
max?: number | null;
|
|
27
|
+
pattern?: string | null;
|
|
28
|
+
email?: boolean;
|
|
29
|
+
asyncUnique?: AsyncUniqueValidator;
|
|
30
|
+
customExpression?: string;
|
|
31
|
+
customExpressionMessage?: string;
|
|
32
|
+
presetId?: string;
|
|
33
|
+
presetParams?: Record<string, ValidatorPresetParamValue>;
|
|
34
|
+
}
|
|
35
|
+
interface OptionItem {
|
|
36
|
+
label: string;
|
|
37
|
+
value: string;
|
|
38
|
+
}
|
|
39
|
+
type RuleOperator = 'truthy' | 'falsy' | 'eq' | 'ne' | 'contains' | 'gt' | 'lt';
|
|
40
|
+
interface ConditionalRule {
|
|
41
|
+
dependsOnKey: string;
|
|
42
|
+
operator: RuleOperator;
|
|
43
|
+
value?: string;
|
|
44
|
+
}
|
|
45
|
+
type OptionsSourceType = 'static' | 'url' | 'lookup';
|
|
46
|
+
interface OptionsSource {
|
|
47
|
+
type: OptionsSourceType;
|
|
48
|
+
url?: string;
|
|
49
|
+
lookupKey?: string;
|
|
50
|
+
listPath?: string;
|
|
51
|
+
labelKey?: string;
|
|
52
|
+
valueKey?: string;
|
|
53
|
+
}
|
|
54
|
+
interface CommonProps {
|
|
55
|
+
label?: string;
|
|
56
|
+
description?: string;
|
|
57
|
+
placeholder?: string;
|
|
58
|
+
disabled?: boolean;
|
|
59
|
+
hidden?: boolean;
|
|
60
|
+
searchable?: boolean;
|
|
61
|
+
}
|
|
62
|
+
interface FieldProps extends CommonProps {
|
|
63
|
+
key?: string;
|
|
64
|
+
defaultValue?: unknown;
|
|
65
|
+
options?: OptionItem[];
|
|
66
|
+
optionsSource?: OptionsSource;
|
|
67
|
+
multiple?: boolean;
|
|
68
|
+
repeaterItemLabel?: string;
|
|
69
|
+
repeaterItemPlaceholder?: string;
|
|
70
|
+
visibleRule?: ConditionalRule;
|
|
71
|
+
enabledRule?: ConditionalRule;
|
|
72
|
+
visibleExpression?: string;
|
|
73
|
+
enabledExpression?: string;
|
|
74
|
+
/** Custom Formly type name override (from PaletteItem.formlyType). Overrides fieldKind-based type in adapter. */
|
|
75
|
+
customType?: string;
|
|
76
|
+
}
|
|
77
|
+
interface ContainerProps extends CommonProps {
|
|
78
|
+
title?: string;
|
|
79
|
+
colSpan?: number;
|
|
80
|
+
}
|
|
81
|
+
interface BuilderNodeBase {
|
|
82
|
+
id: string;
|
|
83
|
+
type: BuilderNodeType;
|
|
84
|
+
parentId: string | null;
|
|
85
|
+
children: string[];
|
|
86
|
+
}
|
|
87
|
+
interface FieldNode extends BuilderNodeBase {
|
|
88
|
+
type: 'field';
|
|
89
|
+
fieldKind: FieldKind;
|
|
90
|
+
props: FieldProps;
|
|
91
|
+
validators: BuilderValidators;
|
|
92
|
+
}
|
|
93
|
+
interface ContainerNode extends BuilderNodeBase {
|
|
94
|
+
type: 'panel' | 'row' | 'col' | 'tabs' | 'stepper' | 'accordion';
|
|
95
|
+
props: ContainerProps;
|
|
96
|
+
}
|
|
97
|
+
type BuilderNode = FieldNode | ContainerNode;
|
|
98
|
+
interface BuilderDocument {
|
|
99
|
+
schemaVersion: number;
|
|
100
|
+
rootId: string;
|
|
101
|
+
renderer?: PreviewRenderer;
|
|
102
|
+
nodes: Record<string, BuilderNode>;
|
|
103
|
+
selectedId: string | null;
|
|
104
|
+
}
|
|
105
|
+
interface DropLocation {
|
|
106
|
+
containerId: string;
|
|
107
|
+
index: number;
|
|
108
|
+
}
|
|
109
|
+
declare function isContainerNode(n: BuilderNode): n is ContainerNode;
|
|
110
|
+
declare function isFieldNode(n: BuilderNode): n is FieldNode;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Maps builder domain tree to FormlyFieldConfig[] for runtime rendering/export.
|
|
114
|
+
*/
|
|
115
|
+
declare function builderToFormly(doc: BuilderDocument): FormlyFieldConfig[];
|
|
116
|
+
|
|
117
|
+
type DiagnosticSeverity = 'error' | 'warning';
|
|
118
|
+
interface BuilderDiagnostic {
|
|
119
|
+
severity: DiagnosticSeverity;
|
|
120
|
+
code: string;
|
|
121
|
+
message: string;
|
|
122
|
+
nodeId?: string;
|
|
123
|
+
}
|
|
124
|
+
interface BuilderDiagnosticsReport {
|
|
125
|
+
diagnostics: BuilderDiagnostic[];
|
|
126
|
+
errorCount: number;
|
|
127
|
+
warningCount: number;
|
|
128
|
+
}
|
|
129
|
+
interface BuildDiagnosticsOptions {
|
|
130
|
+
knownValidatorPresetIds?: ReadonlySet<string>;
|
|
131
|
+
}
|
|
132
|
+
declare function buildDiagnostics(doc: BuilderDocument, options?: BuildDiagnosticsOptions): BuilderDiagnosticsReport;
|
|
133
|
+
|
|
134
|
+
type ParseResult = {
|
|
135
|
+
ok: true;
|
|
136
|
+
doc: BuilderDocument;
|
|
137
|
+
warnings: string[];
|
|
138
|
+
} | {
|
|
139
|
+
ok: false;
|
|
140
|
+
error: string;
|
|
141
|
+
};
|
|
142
|
+
declare function parseBuilderDocument(json: string): ParseResult;
|
|
143
|
+
declare function parseBuilderDocumentObject(rawDoc: unknown): ParseResult;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Converts Formly config into builder domain JSON using a best-effort layout mapping.
|
|
147
|
+
*/
|
|
148
|
+
declare function formlyToBuilder(fields: FormlyFieldConfig[], renderer?: BuilderDocument['renderer']): BuilderDocument;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Creates readable unique ids for builder nodes.
|
|
152
|
+
*/
|
|
153
|
+
declare function uid(prefix?: string): string;
|
|
154
|
+
/**
|
|
155
|
+
* Normalizes a node id to a safe Formly field key.
|
|
156
|
+
*/
|
|
157
|
+
declare function toFieldKey(id: string): string;
|
|
158
|
+
|
|
159
|
+
declare const DEFAULT_LOOKUP_REGISTRY: Record<string, OptionItem[]>;
|
|
160
|
+
declare const BUILDER_LOOKUP_REGISTRY: InjectionToken<Record<string, OptionItem[]>>;
|
|
161
|
+
|
|
162
|
+
interface SchemaMigrationStep {
|
|
163
|
+
from: number;
|
|
164
|
+
to: number;
|
|
165
|
+
run: (doc: Record<string, unknown>) => Record<string, unknown>;
|
|
166
|
+
}
|
|
167
|
+
declare function toSchemaVersion(value: unknown): number;
|
|
168
|
+
declare function migrateBuilderSchema(rawDoc: Record<string, unknown>): {
|
|
169
|
+
migrated: Record<string, unknown>;
|
|
170
|
+
warnings: string[];
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
declare const DEFAULT_PALETTE_CATEGORIES: {
|
|
174
|
+
readonly common: "Common Fields";
|
|
175
|
+
readonly advanced: "Advanced Fields";
|
|
176
|
+
readonly layout: "Layout";
|
|
177
|
+
};
|
|
178
|
+
interface PaletteItem {
|
|
179
|
+
id: string;
|
|
180
|
+
category: string;
|
|
181
|
+
title: string;
|
|
182
|
+
nodeType: BuilderNodeType;
|
|
183
|
+
fieldKind?: FieldKind;
|
|
184
|
+
/** Override the emitted Formly type name (e.g. 'my-datepicker'). Persisted as FieldProps.customType. */
|
|
185
|
+
formlyType?: string;
|
|
186
|
+
/** Optional hint shown in the inspector for custom field types. */
|
|
187
|
+
inspectorHint?: string;
|
|
188
|
+
defaults: {
|
|
189
|
+
props: FieldProps | ContainerProps;
|
|
190
|
+
validators?: BuilderValidators;
|
|
191
|
+
childrenTemplate?: string[];
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
/** Built-in palette used when no custom plugin or DI override is provided. */
|
|
195
|
+
declare const PALETTE: PaletteItem[];
|
|
196
|
+
/** Runtime palette token. Default value composes built-in palette with `BUILDER_PLUGINS` palette items. */
|
|
197
|
+
declare const BUILDER_PALETTE: InjectionToken<readonly PaletteItem[]>;
|
|
198
|
+
/** Normalizes a palette category into deterministic CDK drop-list id. */
|
|
199
|
+
declare function paletteListIdForCategory(category: string): string;
|
|
200
|
+
|
|
201
|
+
type PaletteValidationResult = {
|
|
202
|
+
ok: true;
|
|
203
|
+
palette: PaletteItem[];
|
|
204
|
+
} | {
|
|
205
|
+
ok: false;
|
|
206
|
+
errors: string[];
|
|
207
|
+
};
|
|
208
|
+
declare function parsePaletteConfig(json: string): PaletteValidationResult;
|
|
209
|
+
declare function validatePaletteConfig(value: unknown): PaletteValidationResult;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Default validation presets for field kinds.
|
|
213
|
+
* Users can override these in the inspector.
|
|
214
|
+
*/
|
|
215
|
+
declare const FIELD_VALIDATION_PATTERNS: {
|
|
216
|
+
readonly tel: "^\\+?[1-9]\\d{7,14}$";
|
|
217
|
+
readonly url: "^https?:\\/\\/.+";
|
|
218
|
+
};
|
|
219
|
+
/** Baseline validator presets for built-in field kinds. */
|
|
220
|
+
declare const DEFAULT_FIELD_VALIDATION_PRESETS: Partial<Record<FieldKind, BuilderValidators>>;
|
|
221
|
+
interface ValidatorPresetParamSchema {
|
|
222
|
+
key: string;
|
|
223
|
+
label: string;
|
|
224
|
+
type: ValidatorPresetParamType;
|
|
225
|
+
required?: boolean;
|
|
226
|
+
description?: string;
|
|
227
|
+
defaultValue?: ValidatorPresetParamValue;
|
|
228
|
+
}
|
|
229
|
+
interface ValidatorPresetDefinition {
|
|
230
|
+
id: string;
|
|
231
|
+
label: string;
|
|
232
|
+
description?: string;
|
|
233
|
+
fieldKinds?: readonly FieldKind[];
|
|
234
|
+
params?: readonly ValidatorPresetParamSchema[];
|
|
235
|
+
resolve: (params: Record<string, ValidatorPresetParamValue>) => Partial<BuilderValidators>;
|
|
236
|
+
}
|
|
237
|
+
/** Built-in validator preset definitions available in inspector and plugin extension points. */
|
|
238
|
+
declare const DEFAULT_VALIDATOR_PRESET_DEFINITIONS: readonly ValidatorPresetDefinition[];
|
|
239
|
+
/** Runtime validator preset token composed from built-ins and plugin contributions. */
|
|
240
|
+
declare const BUILDER_VALIDATOR_PRESETS: InjectionToken<Partial<Record<FieldKind, BuilderValidators>>>;
|
|
241
|
+
/** Runtime validator preset definitions composed from built-ins and plugin contributions (override by id). */
|
|
242
|
+
declare const BUILDER_VALIDATOR_PRESET_DEFINITIONS: InjectionToken<readonly ValidatorPresetDefinition[]>;
|
|
243
|
+
/** Returns default validators for a given field kind using provided (or default) preset map. */
|
|
244
|
+
declare function defaultValidatorsForFieldKind(fieldKind: FieldKind, presets?: Partial<Record<FieldKind, BuilderValidators>>): BuilderValidators;
|
|
245
|
+
declare function validatorPresetDefinitionsForFieldKind(fieldKind: FieldKind, definitions: readonly ValidatorPresetDefinition[]): ValidatorPresetDefinition[];
|
|
246
|
+
declare function applyValidatorPreset(definition: ValidatorPresetDefinition, params?: Record<string, ValidatorPresetParamValue>): Partial<BuilderValidators>;
|
|
247
|
+
declare function defaultParamsForValidatorPreset(definition: ValidatorPresetDefinition): Record<string, ValidatorPresetParamValue>;
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* A subset of Formly's ConfigOption used to register custom types and wrappers.
|
|
251
|
+
* Pass instances via BuilderPlugin.formlyExtensions to register them in the preview dialogs.
|
|
252
|
+
*/
|
|
253
|
+
interface FormlyConfigExtension {
|
|
254
|
+
types?: Array<{
|
|
255
|
+
name: string;
|
|
256
|
+
component: unknown;
|
|
257
|
+
extends?: string;
|
|
258
|
+
wrappers?: string[];
|
|
259
|
+
}>;
|
|
260
|
+
wrappers?: Array<{
|
|
261
|
+
name: string;
|
|
262
|
+
component: unknown;
|
|
263
|
+
}>;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Product extension contract for builder capabilities.
|
|
267
|
+
* Plugins can contribute palette entries, lookup datasets, validator presets, and custom Formly types.
|
|
268
|
+
*/
|
|
269
|
+
interface BuilderPlugin {
|
|
270
|
+
id: string;
|
|
271
|
+
paletteItems?: readonly PaletteItem[];
|
|
272
|
+
lookupRegistry?: Record<string, OptionItem[]>;
|
|
273
|
+
validatorPresets?: Partial<Record<FieldKind, BuilderValidators>>;
|
|
274
|
+
validatorPresetDefinitions?: readonly ValidatorPresetDefinition[];
|
|
275
|
+
/** Custom Formly types/wrappers to register in the preview dialogs. */
|
|
276
|
+
formlyExtensions?: readonly FormlyConfigExtension[];
|
|
277
|
+
}
|
|
278
|
+
/** Multi-plugin injection token used to compose runtime extensions. */
|
|
279
|
+
declare const BUILDER_PLUGINS: InjectionToken<readonly BuilderPlugin[]>;
|
|
280
|
+
/** Composes base palette with plugin palette contributions (override by `id`, otherwise append). */
|
|
281
|
+
declare function composePalette(base: readonly PaletteItem[], plugins: readonly BuilderPlugin[]): PaletteItem[];
|
|
282
|
+
/** Composes base lookup registry with plugin lookup contributions (override by key). */
|
|
283
|
+
declare function composeLookupRegistry(base: Record<string, OptionItem[]>, plugins: readonly BuilderPlugin[]): Record<string, OptionItem[]>;
|
|
284
|
+
/** Composes validator presets by field kind (shallow merge by field kind key). */
|
|
285
|
+
declare function composeValidatorPresets(base: Partial<Record<FieldKind, BuilderValidators>>, plugins: readonly BuilderPlugin[]): Partial<Record<FieldKind, BuilderValidators>>;
|
|
286
|
+
/** Composes named validator preset definitions (override by id, stable order). */
|
|
287
|
+
declare function composeValidatorPresetDefinitions(base: readonly ValidatorPresetDefinition[], plugins: readonly BuilderPlugin[]): ValidatorPresetDefinition[];
|
|
288
|
+
/** Collects all formlyExtensions from plugins into a flat array. */
|
|
289
|
+
declare function composeFormlyExtensions(plugins: readonly BuilderPlugin[]): FormlyConfigExtension[];
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Builder document schema versioning.
|
|
293
|
+
* Increment CURRENT when making backward-incompatible JSON shape changes.
|
|
294
|
+
*/
|
|
295
|
+
declare const LEGACY_BUILDER_SCHEMA_VERSION = 0;
|
|
296
|
+
declare const CURRENT_BUILDER_SCHEMA_VERSION = 2;
|
|
297
|
+
|
|
298
|
+
type BuilderPresetId = 'simple' | 'complex' | 'advanced' | 'advancedLogic';
|
|
299
|
+
interface BuilderPresetMeta {
|
|
300
|
+
id: BuilderPresetId;
|
|
301
|
+
title: string;
|
|
302
|
+
description: string;
|
|
303
|
+
highlights: string[];
|
|
304
|
+
thumbnailRows: number[];
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Signal-based state container for the form builder editor.
|
|
309
|
+
* Mutations are delegated to pure command helpers for maintainability.
|
|
310
|
+
*/
|
|
311
|
+
declare class BuilderStore {
|
|
312
|
+
private readonly defaultPalette;
|
|
313
|
+
private readonly defaultLookupRegistry;
|
|
314
|
+
private readonly defaultValidatorPresets;
|
|
315
|
+
private readonly defaultValidatorPresetDefinitions;
|
|
316
|
+
private readonly palette;
|
|
317
|
+
private readonly _lookupRegistry;
|
|
318
|
+
private readonly _validatorPresets;
|
|
319
|
+
private readonly _validatorPresetDefinitions;
|
|
320
|
+
private readonly _doc;
|
|
321
|
+
private readonly _clipboard;
|
|
322
|
+
private readonly _past;
|
|
323
|
+
private readonly _future;
|
|
324
|
+
private readonly _pastLabels;
|
|
325
|
+
private readonly _futureLabels;
|
|
326
|
+
private readonly _formlyExtensions;
|
|
327
|
+
private readonly maxHistory;
|
|
328
|
+
private historyGroup;
|
|
329
|
+
constructor();
|
|
330
|
+
readonly doc: _angular_core.Signal<BuilderDocument>;
|
|
331
|
+
readonly nodes: _angular_core.Signal<Record<string, _ngx_formly_builder_core.BuilderNode>>;
|
|
332
|
+
readonly rootId: _angular_core.Signal<string>;
|
|
333
|
+
readonly selectedId: _angular_core.Signal<string | null>;
|
|
334
|
+
readonly canUndo: _angular_core.Signal<boolean>;
|
|
335
|
+
readonly canRedo: _angular_core.Signal<boolean>;
|
|
336
|
+
/** Past history labels, newest first (index 0 = most recent undoable action). */
|
|
337
|
+
readonly pastLabels: _angular_core.Signal<string[]>;
|
|
338
|
+
/** Future (redoable) labels, most-recently-undone first (index 0 = next redo). */
|
|
339
|
+
readonly futureLabels: _angular_core.Signal<string[]>;
|
|
340
|
+
readonly hasClipboard: _angular_core.Signal<boolean>;
|
|
341
|
+
readonly renderer: _angular_core.Signal<_ngx_formly_builder_core.PreviewRenderer>;
|
|
342
|
+
readonly presets: readonly BuilderPresetMeta[];
|
|
343
|
+
readonly paletteItems: _angular_core.Signal<readonly PaletteItem[]>;
|
|
344
|
+
readonly lookupRegistry: _angular_core.Signal<Record<string, _ngx_formly_builder_core.OptionItem[]>>;
|
|
345
|
+
readonly validatorPresetDefinitions: _angular_core.Signal<readonly _ngx_formly_builder_core.ValidatorPresetDefinition[]>;
|
|
346
|
+
readonly formlyExtensions: _angular_core.Signal<FormlyConfigExtension[]>;
|
|
347
|
+
readonly diagnostics: _angular_core.Signal<_ngx_formly_builder_core.BuilderDiagnosticsReport>;
|
|
348
|
+
readonly selectedNode: _angular_core.Signal<_ngx_formly_builder_core.BuilderNode | null>;
|
|
349
|
+
readonly paletteByCategory: _angular_core.Signal<Map<string, PaletteItem[]>>;
|
|
350
|
+
readonly paletteDropListIds: _angular_core.Signal<string[]>;
|
|
351
|
+
/** Updates the active preview renderer. */
|
|
352
|
+
setRenderer(renderer: 'material' | 'bootstrap'): void;
|
|
353
|
+
/** Selects a node in canvas/inspector. */
|
|
354
|
+
select(id: string | null): void;
|
|
355
|
+
/** Resets builder state to a new empty document. */
|
|
356
|
+
clear(): void;
|
|
357
|
+
/** Serializes builder document as formatted JSON. */
|
|
358
|
+
exportDocument(): string;
|
|
359
|
+
/** Imports and validates builder JSON into current state. */
|
|
360
|
+
importDocument(json: string): {
|
|
361
|
+
ok: true;
|
|
362
|
+
} | {
|
|
363
|
+
ok: false;
|
|
364
|
+
error: string;
|
|
365
|
+
};
|
|
366
|
+
/** Replaces current canvas with a predefined starter preset. */
|
|
367
|
+
applyPreset(presetId: BuilderPresetId): void;
|
|
368
|
+
/** Restores previous snapshot from history. */
|
|
369
|
+
undo(): void;
|
|
370
|
+
/** Reapplies an undone snapshot from history. */
|
|
371
|
+
redo(): void;
|
|
372
|
+
/** Removes currently selected node if removable. */
|
|
373
|
+
removeSelected(): void;
|
|
374
|
+
/** Removes a node and all descendants. */
|
|
375
|
+
removeNode(id: string): void;
|
|
376
|
+
/** Copies node subtree into builder clipboard. */
|
|
377
|
+
copyNode(id: string): void;
|
|
378
|
+
/** Copies currently selected node into builder clipboard. */
|
|
379
|
+
copySelected(): void;
|
|
380
|
+
/** Duplicates selected node subtree next to current node. */
|
|
381
|
+
duplicateSelected(): void;
|
|
382
|
+
/** Pastes clipboard subtree relative to current selection or root. */
|
|
383
|
+
pasteFromClipboard(): void;
|
|
384
|
+
/** Applies partial props patch to a node. */
|
|
385
|
+
updateNodeProps(id: string, patch: Record<string, unknown>, historyLabel?: string): void;
|
|
386
|
+
/** Applies partial validator patch to a field node. */
|
|
387
|
+
updateNodeValidators(id: string, patch: Record<string, unknown>, historyLabel?: string): void;
|
|
388
|
+
/** Applies grouped props updates so rapid typing becomes one undo step. */
|
|
389
|
+
updateNodePropsGrouped(id: string, patch: Record<string, unknown>, groupKey: string, historyWindowMs?: number, historyLabel?: string): void;
|
|
390
|
+
/** Applies grouped validator updates so rapid typing becomes one undo step. */
|
|
391
|
+
updateNodeValidatorsGrouped(id: string, patch: Record<string, unknown>, groupKey: string, historyWindowMs?: number, historyLabel?: string): void;
|
|
392
|
+
/** Adds a new palette item instance at drop location. */
|
|
393
|
+
addFromPalette(paletteId: string, loc: DropLocation): void;
|
|
394
|
+
getPaletteItem(paletteId: string): PaletteItem | null;
|
|
395
|
+
/** Replaces runtime palette with a validated custom collection. */
|
|
396
|
+
setPalette(items: readonly PaletteItem[]): void;
|
|
397
|
+
/** Restores runtime palette back to DI/default composed palette. */
|
|
398
|
+
resetPalette(): void;
|
|
399
|
+
/** Applies runtime plugin/palette extensions for embeddable component scenarios. */
|
|
400
|
+
configureRuntimeExtensions(options?: {
|
|
401
|
+
plugins?: readonly BuilderPlugin[];
|
|
402
|
+
palette?: readonly PaletteItem[];
|
|
403
|
+
}): void;
|
|
404
|
+
/** Restores runtime extensions back to DI/default-resolved values. */
|
|
405
|
+
resetRuntimeExtensions(): void;
|
|
406
|
+
/** Moves existing node between containers/reorder targets. */
|
|
407
|
+
moveNode(nodeId: string, to: DropLocation): void;
|
|
408
|
+
/** Reorders children within the same container. */
|
|
409
|
+
reorderWithin(containerId: string, fromIndex: number, toIndex: number): void;
|
|
410
|
+
/** Appends a column to an existing row. */
|
|
411
|
+
addColumnToRow(rowId: string, span?: number): void;
|
|
412
|
+
/** Rebalances row child columns so spans sum to 12. */
|
|
413
|
+
rebalanceRowColumns(rowId: string): void;
|
|
414
|
+
/** Splits one column into a nested row with N columns. */
|
|
415
|
+
splitColumn(columnId: string, parts?: number): void;
|
|
416
|
+
private apply;
|
|
417
|
+
private defaultValidatorsForFieldKind;
|
|
418
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<BuilderStore, never>;
|
|
419
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<BuilderStore>;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
declare class BuilderTemplatesService {
|
|
423
|
+
private readonly _templates;
|
|
424
|
+
readonly templates: _angular_core.Signal<PaletteItem[]>;
|
|
425
|
+
toPaletteItems(): PaletteItem[];
|
|
426
|
+
exportJson(): string;
|
|
427
|
+
importJson(json: string): {
|
|
428
|
+
ok: true;
|
|
429
|
+
count: number;
|
|
430
|
+
} | {
|
|
431
|
+
ok: false;
|
|
432
|
+
error: string;
|
|
433
|
+
};
|
|
434
|
+
saveFieldTemplate(field: FieldNode): string;
|
|
435
|
+
clear(): void;
|
|
436
|
+
private nextTemplateId;
|
|
437
|
+
private slugify;
|
|
438
|
+
private load;
|
|
439
|
+
private persist;
|
|
440
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<BuilderTemplatesService, never>;
|
|
441
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<BuilderTemplatesService>;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
declare class BuilderPageComponent implements OnInit, OnChanges {
|
|
445
|
+
readonly store: BuilderStore;
|
|
446
|
+
private readonly dialog;
|
|
447
|
+
private readonly snackBar;
|
|
448
|
+
private readonly templates;
|
|
449
|
+
readonly diagnosticsOpen: _angular_core.WritableSignal<boolean>;
|
|
450
|
+
private readonly paletteOverride;
|
|
451
|
+
private readonly ready;
|
|
452
|
+
private hasRestoredAutosave;
|
|
453
|
+
private isApplyingInputConfig;
|
|
454
|
+
config: BuilderDocument | null;
|
|
455
|
+
plugins: readonly BuilderPlugin[];
|
|
456
|
+
palette: readonly PaletteItem[] | null;
|
|
457
|
+
autosave: boolean;
|
|
458
|
+
autosaveKey: string;
|
|
459
|
+
readonly configChange: EventEmitter<BuilderDocument>;
|
|
460
|
+
readonly diagnosticsChange: EventEmitter<BuilderDiagnosticsReport>;
|
|
461
|
+
constructor();
|
|
462
|
+
ngOnInit(): void;
|
|
463
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
464
|
+
openPreview(): void;
|
|
465
|
+
openExport(): void;
|
|
466
|
+
openExportBuilder(): void;
|
|
467
|
+
openExportJsonSchema(): void;
|
|
468
|
+
openImport(): void;
|
|
469
|
+
openImportFormly(): void;
|
|
470
|
+
openImportPalette(): void;
|
|
471
|
+
resetPalette(): void;
|
|
472
|
+
canSaveTemplate(): boolean;
|
|
473
|
+
saveSelectedAsTemplate(): void;
|
|
474
|
+
openExportTemplates(): void;
|
|
475
|
+
openImportTemplates(): void;
|
|
476
|
+
toggleDiagnostics(): void;
|
|
477
|
+
diagnosticsSummary(): string;
|
|
478
|
+
canCopyOrDuplicate(): boolean;
|
|
479
|
+
clear(): Promise<void>;
|
|
480
|
+
applyPresetById(id: string): Promise<void>;
|
|
481
|
+
private canExport;
|
|
482
|
+
private notifyError;
|
|
483
|
+
private confirmAction;
|
|
484
|
+
onKeyDown(e: KeyboardEvent): void;
|
|
485
|
+
private applyRuntimeExtensions;
|
|
486
|
+
private applyExternalConfig;
|
|
487
|
+
private saveToAutosave;
|
|
488
|
+
private restoreFromAutosave;
|
|
489
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<BuilderPageComponent, never>;
|
|
490
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<BuilderPageComponent, "app-builder-page, formly-builder", never, { "config": { "alias": "config"; "required": false; }; "plugins": { "alias": "plugins"; "required": false; }; "palette": { "alias": "palette"; "required": false; }; "autosave": { "alias": "autosave"; "required": false; }; "autosaveKey": { "alias": "autosaveKey"; "required": false; }; }, { "configChange": "configChange"; "diagnosticsChange": "diagnosticsChange"; }, never, never, true, never>;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
export { BUILDER_LOOKUP_REGISTRY, BUILDER_PALETTE, BUILDER_PLUGINS, BUILDER_VALIDATOR_PRESETS, BUILDER_VALIDATOR_PRESET_DEFINITIONS, BuilderPageComponent, BuilderStore, BuilderTemplatesService, CURRENT_BUILDER_SCHEMA_VERSION, DEFAULT_FIELD_VALIDATION_PRESETS, DEFAULT_LOOKUP_REGISTRY, DEFAULT_PALETTE_CATEGORIES, DEFAULT_VALIDATOR_PRESET_DEFINITIONS, FIELD_VALIDATION_PATTERNS, BuilderPageComponent as FormlyBuilderComponent, LEGACY_BUILDER_SCHEMA_VERSION, PALETTE, applyValidatorPreset, buildDiagnostics, builderToFormly, composeFormlyExtensions, composeLookupRegistry, composePalette, composeValidatorPresetDefinitions, composeValidatorPresets, defaultParamsForValidatorPreset, defaultValidatorsForFieldKind, formlyToBuilder, isContainerNode, isFieldNode, migrateBuilderSchema, paletteListIdForCategory, parseBuilderDocument, parseBuilderDocumentObject, parsePaletteConfig, toFieldKey, toSchemaVersion, uid, validatePaletteConfig, validatorPresetDefinitionsForFieldKind };
|
|
494
|
+
export type { AsyncUniqueSourceType, AsyncUniqueValidator, BuildDiagnosticsOptions, BuilderDiagnostic, BuilderDiagnosticsReport, BuilderDocument, BuilderNode, BuilderNodeBase, BuilderNodeType, BuilderPlugin, BuilderPresetId, BuilderValidators, CommonProps, ConditionalRule, ContainerNode, ContainerProps, DiagnosticSeverity, DropLocation, FieldKind, FieldNode, FieldProps, FormlyConfigExtension, OptionItem, OptionsSource, OptionsSourceType, PaletteItem, PaletteValidationResult, PreviewRenderer, RuleOperator, SchemaMigrationStep, ValidatorPresetDefinition, ValidatorPresetParamSchema, ValidatorPresetParamType, ValidatorPresetParamValue };
|
|
495
|
+
//# sourceMappingURL=ngx-formly-builder-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngx-formly-builder-core.d.ts","sources":["../../../src/app/builder-core/model.ts","../../../src/app/builder-core/adapter.ts","../../../src/app/builder-core/diagnostics.ts","../../../src/app/builder-core/document.ts","../../../src/app/builder-core/formly-import.ts","../../../src/app/builder-core/ids.ts","../../../src/app/builder-core/lookup-registry.ts","../../../src/app/builder-core/migrations.ts","../../../src/app/builder-core/registry.ts","../../../src/app/builder-core/palette-config.ts","../../../src/app/builder-core/validation-presets.ts","../../../src/app/builder-core/plugins.ts","../../../src/app/builder-core/schema.ts","../../../src/app/builder-core/presets.ts","../../../src/app/builder-core/store.ts","../../../src/app/builder/builder-templates.service.ts","../../../src/app/builder/builder-page.component.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["__presets.BuilderPresetMeta"],"mappings":";;;;;;;AAIM,KAAA,SAAA;;AAiBA,KAAA,wBAAA;AACA,KAAA,yBAAA;;;;;;;;;AAUL;;;AAIC;AACA;AACA;AACA;AACA;;;;;;;AAOD;;;;AAKA;;;;;;AAQA;AAEK,KAAA,iBAAA;;;;;;;;AASL;;;;;;;;AASA;AAEK,UAAA,UAAA,SAAA,WAAA;;;AAGJ,cAAA,UAAA;;;;;;;;;;;AAWD;AAEK,UAAA,cAAA,SAAA,WAAA;;;AAGL;;;;AAKC;;AAED;AAEK,UAAA,SAAA,SAAA,eAAA;;;;;AAKL;AAEK,UAAA,aAAA,SAAA,eAAA;AACJ;;AAED;;;;;;AAQC,WAAA,MAAA,SAAA,WAAA;AACA;AACD;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