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.
Files changed (110) hide show
  1. package/README.md +269 -0
  2. package/fesm2022/ngx-form-designer.mjs +26762 -0
  3. package/fesm2022/ngx-form-designer.mjs.map +1 -0
  4. package/index.d.ts +5 -0
  5. package/lib/data/data-catalog.d.ts +44 -0
  6. package/lib/data/data-provider.d.ts +58 -0
  7. package/lib/data/data-source-client.d.ts +59 -0
  8. package/lib/data/data-source-parsers.d.ts +5 -0
  9. package/lib/data/file-upload-client.d.ts +19 -0
  10. package/lib/data/http-data-source-client.d.ts +31 -0
  11. package/lib/data/in-memory-data-catalog.service.d.ts +12 -0
  12. package/lib/data/tree-utils.d.ts +28 -0
  13. package/lib/email-renderer/email-renderer.component.d.ts +21 -0
  14. package/lib/form-core/form-engine.d.ts +48 -0
  15. package/lib/form-core/form-event-runner.d.ts +15 -0
  16. package/lib/form-core/models.d.ts +255 -0
  17. package/lib/form-core/plugin-metadata.d.ts +10 -0
  18. package/lib/form-core/rule-evaluation.service.d.ts +18 -0
  19. package/lib/form-core/schema-factory.d.ts +11 -0
  20. package/lib/form-core/schema-guard.d.ts +18 -0
  21. package/lib/form-designer/data-panel/data-panel.component.d.ts +73 -0
  22. package/lib/form-designer/designer-context.service.d.ts +29 -0
  23. package/lib/form-designer/designer-state.service.d.ts +133 -0
  24. package/lib/form-designer/dynamic-properties/dynamic-properties.component.d.ts +89 -0
  25. package/lib/form-designer/events-panel/events-panel.component.d.ts +21 -0
  26. package/lib/form-designer/field-palette.component.d.ts +99 -0
  27. package/lib/form-designer/form-designer-shell.component.d.ts +46 -0
  28. package/lib/form-designer/form-preview.component.d.ts +21 -0
  29. package/lib/form-designer/form-settings-inspector.component.d.ts +14 -0
  30. package/lib/form-designer/global-data-manager.component.d.ts +32 -0
  31. package/lib/form-designer/inspector-sections/inspector-advanced-section.component.d.ts +17 -0
  32. package/lib/form-designer/inspector-sections/inspector-backgrounds-section.component.d.ts +14 -0
  33. package/lib/form-designer/inspector-sections/inspector-borders-section.component.d.ts +45 -0
  34. package/lib/form-designer/inspector-sections/inspector-effects-section.component.d.ts +22 -0
  35. package/lib/form-designer/inspector-sections/inspector-layout-section.component.d.ts +33 -0
  36. package/lib/form-designer/inspector-sections/inspector-position-section.component.d.ts +28 -0
  37. package/lib/form-designer/inspector-sections/inspector-size-section.component.d.ts +18 -0
  38. package/lib/form-designer/inspector-sections/inspector-spacing-section.component.d.ts +12 -0
  39. package/lib/form-designer/inspector-sections/inspector-typography-section.component.d.ts +21 -0
  40. package/lib/form-designer/json-form-designer.component.d.ts +12 -0
  41. package/lib/form-designer/layer-tree/layer-tree.component.d.ts +24 -0
  42. package/lib/form-designer/layout-canvas.component.d.ts +70 -0
  43. package/lib/form-designer/page-style.d.ts +2 -0
  44. package/lib/form-designer/properties-panel.component.d.ts +68 -0
  45. package/lib/form-designer/rules-editor/query-builder/query-builder.component.d.ts +23 -0
  46. package/lib/form-designer/rules-editor/rules-panel/rules-panel.component.d.ts +14 -0
  47. package/lib/form-designer/services/widget-definition-resolver.service.d.ts +38 -0
  48. package/lib/form-designer/template-library.d.ts +9 -0
  49. package/lib/form-designer/widget-inspector.component.d.ts +27 -0
  50. package/lib/form-renderer/json-form-renderer.component.d.ts +50 -0
  51. package/lib/form-renderer/layout-node.component.d.ts +85 -0
  52. package/lib/plugins/core-plugins.d.ts +5 -0
  53. package/lib/plugins/designer-plugin.d.ts +15 -0
  54. package/lib/plugins/plugin-context.d.ts +18 -0
  55. package/lib/plugins/plugin-providers.d.ts +3 -0
  56. package/lib/plugins/section-definition.d.ts +16 -0
  57. package/lib/theme/theme.service.d.ts +15 -0
  58. package/lib/ui/json-schema-editor.component.d.ts +27 -0
  59. package/lib/ui/monaco-editor.component.d.ts +24 -0
  60. package/lib/ui/ui-accordion.component.d.ts +11 -0
  61. package/lib/ui/ui-box-model.component.d.ts +55 -0
  62. package/lib/ui/ui-color-swatch.component.d.ts +12 -0
  63. package/lib/ui/ui-dimension.component.d.ts +21 -0
  64. package/lib/ui/ui-edge-box.component.d.ts +20 -0
  65. package/lib/ui/ui-field-wrapper.component.d.ts +8 -0
  66. package/lib/ui/ui-icon.module.d.ts +7 -0
  67. package/lib/ui/ui-input.component.d.ts +17 -0
  68. package/lib/ui/ui-range-number.component.d.ts +16 -0
  69. package/lib/ui/ui-select-icon.component.d.ts +18 -0
  70. package/lib/ui/ui-tabs.component.d.ts +25 -0
  71. package/lib/website/website-brick-studio.component.d.ts +67 -0
  72. package/lib/website/website-designer-shell.component.d.ts +53 -0
  73. package/lib/website/website-preview-shell.component.d.ts +25 -0
  74. package/lib/website/website-project.models.d.ts +78 -0
  75. package/lib/website/website-project.service.d.ts +50 -0
  76. package/lib/website/website-section-library.d.ts +6 -0
  77. package/lib/widgets/email-widgets/email-button-widget.component.d.ts +15 -0
  78. package/lib/widgets/email-widgets/email-heading-widget.component.d.ts +15 -0
  79. package/lib/widgets/email-widgets/email-text-widget.component.d.ts +13 -0
  80. package/lib/widgets/email-widgets.d.ts +2 -0
  81. package/lib/widgets/field-widgets/checkbox/checkbox-widget.component.d.ts +28 -0
  82. package/lib/widgets/field-widgets/checkbox-group/checkbox-group-widget.component.d.ts +40 -0
  83. package/lib/widgets/field-widgets/file-upload/file-upload-widget.component.d.ts +45 -0
  84. package/lib/widgets/field-widgets/radio/radio-widget.component.d.ts +39 -0
  85. package/lib/widgets/field-widgets/select/select-widget.component.d.ts +36 -0
  86. package/lib/widgets/field-widgets/text-field/text-field.component.d.ts +29 -0
  87. package/lib/widgets/field-widgets/tree-select/tree-select-widget.component.d.ts +47 -0
  88. package/lib/widgets/page-link-context.d.ts +8 -0
  89. package/lib/widgets/page-widgets/brick-settings.component.d.ts +23 -0
  90. package/lib/widgets/page-widgets/brick-widget.component.d.ts +47 -0
  91. package/lib/widgets/page-widgets/button-link-settings.component.d.ts +23 -0
  92. package/lib/widgets/page-widgets/button-widget.component.d.ts +21 -0
  93. package/lib/widgets/page-widgets/heading-widget.component.d.ts +22 -0
  94. package/lib/widgets/page-widgets/inline-quill-editor.component.d.ts +34 -0
  95. package/lib/widgets/page-widgets/table-inspector.component.d.ts +17 -0
  96. package/lib/widgets/page-widgets/table-widget.component.d.ts +35 -0
  97. package/lib/widgets/page-widgets/text-block-widget.component.d.ts +22 -0
  98. package/lib/widgets/page-widgets.d.ts +2 -0
  99. package/lib/widgets/static-widgets/image/image-widget.component.d.ts +18 -0
  100. package/lib/widgets/style-helpers.d.ts +8 -0
  101. package/lib/widgets/style-properties.d.ts +28 -0
  102. package/lib/widgets/style-sections.d.ts +1 -0
  103. package/lib/widgets/table-widget.d.ts +2 -0
  104. package/lib/widgets/widget-definition.d.ts +76 -0
  105. package/lib/widgets/widget-editor-context.d.ts +8 -0
  106. package/lib/widgets/widget-packs.d.ts +4 -0
  107. package/lib/widgets/widgets.d.ts +2 -0
  108. package/package.json +47 -0
  109. package/public-api.d.ts +68 -0
  110. package/tailwind.preset.js +51 -0
package/README.md ADDED
@@ -0,0 +1,269 @@
1
+ # NgxFormDesigner
2
+
3
+ A visual Form Designer for Angular applications, featuring a drag-and-drop interface, responsive layout management, and an enterprise-grade rules engine.
4
+
5
+ ## Features
6
+ - **Drag & Drop**: Intuitive canvas for arranging widgets.
7
+ - **Responsive Layout**: Row/Column system with breakpoint support.
8
+ - **Rules Engine**: Conditional logic (show/hide, validation, disabling) based on field values.
9
+ - **JSON Schema**: Export/Import forms as simple JSON.
10
+ - **Modern UI**: Built with Tailwind CSS and lucide-angular icons.
11
+
12
+ ## Documentation
13
+
14
+ Full beginner-friendly docs live in `projects/ngx-form-designer/docs/README.md`:
15
+
16
+ - `projects/ngx-form-designer/docs/GETTING_STARTED.md`
17
+ - `projects/ngx-form-designer/docs/PUBLIC_API.md`
18
+ - `projects/ngx-form-designer/docs/ARCHITECTURE.md`
19
+ - `projects/ngx-form-designer/docs/SCHEMA_REFERENCE.md`
20
+ - `projects/ngx-form-designer/docs/WIDGETS.md`
21
+ - `projects/ngx-form-designer/docs/PLUGINS.md`
22
+ - `projects/ngx-form-designer/docs/DATA_SOURCES.md`
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ npm install ngx-form-designer
28
+ ```
29
+
30
+ ## Dependencies
31
+
32
+ This library relies on **Tailwind CSS** and **lucide-angular** for UI styling and iconography.
33
+
34
+ 1. **Tailwind CSS**: The library uses Tailwind utility classes.
35
+
36
+ **Option A: Using the Preset (Recommended)**
37
+ In your `tailwind.config.js` (or similar), add the preset:
38
+
39
+ ```javascript
40
+ module.exports = {
41
+ presets: [
42
+ require('ngx-form-designer/tailwind.preset.js')
43
+ ],
44
+ content: [
45
+ "./src/**/*.{html,ts}",
46
+ "./node_modules/ngx-form-designer/**/*.{html,ts,mjs}"
47
+ ],
48
+ }
49
+ ```
50
+
51
+ **Option B: Manual Configuration**
52
+ If you prefer to manually copy the theme tokens, see `projects/ngx-form-designer/docs/STYLING_AND_THEME.md`.
53
+
54
+ **Design tokens (recommended):** The demo/theme uses Tailwind tokens like `accent-*`, `ink-*`, `slate-*`, `shadow-card`, and `shadow-popover`. If your app doesn’t define them, the UI will still work but can look different. See `projects/ngx-form-designer/docs/STYLING_AND_THEME.md`.
55
+
56
+ 2. **lucide-angular**: Install and configure lucide-angular icons:
57
+
58
+ ```bash
59
+ npm install lucide-angular
60
+ ```
61
+
62
+ In your `app.config.ts`, import and provide the icons you need:
63
+ ```typescript
64
+ import { LucideAngularModule, icons } from 'lucide-angular';
65
+
66
+ export const appConfig: ApplicationConfig = {
67
+ providers: [
68
+ // ... other providers
69
+ importProvidersFrom(LucideAngularModule.pick(icons))
70
+ ]
71
+ };
72
+ ```
73
+
74
+ ## Usage
75
+
76
+ Import `JsonFormDesignerComponent` (standalone) into your component or route.
77
+
78
+ ```typescript
79
+ import { Component } from '@angular/core';
80
+ import { JsonFormDesignerComponent } from 'ngx-form-designer';
81
+
82
+ @Component({
83
+ standalone: true,
84
+ imports: [JsonFormDesignerComponent],
85
+ template: `<app-json-form-designer></app-json-form-designer>`
86
+ })
87
+ export class MyComponent {}
88
+ ```
89
+
90
+ If you want the full scaffolded UI (top bar + template library) with minimal setup, use the shell component:
91
+
92
+ ```typescript
93
+ import { Component } from '@angular/core';
94
+ import { FormDesignerShellComponent } from 'ngx-form-designer';
95
+
96
+ @Component({
97
+ standalone: true,
98
+ imports: [FormDesignerShellComponent],
99
+ template: `<app-form-designer-shell></app-form-designer-shell>`
100
+ })
101
+ export class MyDesignerPage {}
102
+ ```
103
+
104
+ ## Provider setup (required)
105
+
106
+ Widgets are registered via plugins. The simplest setup is to register the built-in plugin pack:
107
+
108
+ ```ts
109
+ import { ApplicationConfig } from '@angular/core';
110
+ import { CORE_DESIGNER_PLUGINS, provideDesignerPlugins } from 'ngx-form-designer';
111
+
112
+ export const appConfig: ApplicationConfig = {
113
+ providers: [
114
+ ...provideDesignerPlugins(CORE_DESIGNER_PLUGINS),
115
+ ]
116
+ };
117
+ ```
118
+
119
+ Without this, the palette will be empty and the renderer can’t resolve widgets.
120
+
121
+ ## Publishing
122
+
123
+ Build the library:
124
+ ```bash
125
+ ng build ngx-form-designer
126
+ ```
127
+
128
+ Publish from dist:
129
+ ```bash
130
+ cd dist/ngx-form-designer
131
+ npm publish
132
+ ```
133
+ ## Data Sources (API-only)
134
+
135
+ The library uses a "Data Sources over APIs" architecture. This means widgets do not store large datasets (like CSVs or JSON arrays) directly in the form schema. Instead, they reference a `sourceId` and delegate data fetching to a registered `DataProvider`.
136
+
137
+ Full guide: `projects/ngx-form-designer/docs/DATA_SOURCES.md`.
138
+
139
+ ### Concepts
140
+
141
+ 1. **Source ID**: A stable string identifier (e.g., `countries`, `users`, `products`) representing a dataset.
142
+ 2. **DataProvider Pipeline**: Widgets request data via the `DataProvider` service.
143
+ - `DataProvider` delegates to `DataSourceClient`.
144
+ - `DataSourceClient` is an abstraction you implement (or use the default) to fetch data.
145
+ 3. **Designer & Runtime Consistency**: The Form Designer uses the exact same pipeline to render "Live Previews" of data in the configuration panel.
146
+
147
+ ### Backend API Contract
148
+
149
+ If you use the HTTP-based `DataSourceClient`, your backend should implement these endpoints:
150
+
151
+ | Method | Endpoint | Description |
152
+ | :--- | :--- | :--- |
153
+ | `GET` | `/data-sources` | List available data sources (id, label) |
154
+ | `GET` | `/data-sources/{sourceId}` | Get details for a specific source |
155
+ | `GET` | `/data-sources/{sourceId}/columns` | Get column definitions (name, type) |
156
+ | `POST` | `/data-sources/{sourceId}/query` | query rows with filtering/sorting/paging |
157
+
158
+ **Query Payload Example:**
159
+ ```json
160
+ {
161
+ "page": { "limit": 50, "offset": 0 },
162
+ "search": { "term": "foo", "columns": ["name"] },
163
+ "filters": [
164
+ { "column": "category", "op": "eq", "value": "active" }
165
+ ],
166
+ "sort": [ { "column": "name", "dir": "asc" } ]
167
+ }
168
+ ```
169
+
170
+ ### Host App Setup
171
+
172
+ #### 1. In-Memory / Mock Setup
173
+ Use this for rapid prototyping or testing without a real backend.
174
+
175
+ ```typescript
176
+ import { DataCatalog, InMemoryDataCatalogService } from 'ngx-form-designer';
177
+
178
+ // in app.config.ts
179
+ providers: [
180
+ { provide: DataCatalog, useExisting: InMemoryDataCatalogService }
181
+ ]
182
+ ```
183
+
184
+ #### 2. HTTP Backend Setup
185
+ Use this to connect to your real API.
186
+
187
+ ```typescript
188
+ import { provideHttpDataSourceClient } from 'ngx-form-designer';
189
+
190
+ // in app.config.ts
191
+ providers: [
192
+ provideHttpDataSourceClient({
193
+ baseUrl: 'https://api.example.com',
194
+ getHeaders: () => ({ Authorization: 'Bearer ' + myAuthService.getToken() })
195
+ })
196
+ ]
197
+ ```
198
+
199
+ ### Configuration Examples
200
+
201
+ #### Basic Dropdown (Select)
202
+ Fetches data from `countries` source, uses `name` as label and `isoCode` as value.
203
+
204
+ ```json
205
+ {
206
+ "type": "select",
207
+ "dataConfig": {
208
+ "type": "source",
209
+ "sourceId": "countries",
210
+ "labelKey": "name",
211
+ "valueKey": "isoCode"
212
+ }
213
+ }
214
+ ```
215
+
216
+ #### Search-Enabled Dropdown
217
+ Enables server-side search to handle large datasets.
218
+
219
+ ```json
220
+ {
221
+ "type": "select",
222
+ "dataConfig": {
223
+ "type": "source",
224
+ "sourceId": "products",
225
+ "labelKey": "productName",
226
+ "valueKey": "id",
227
+ "searchEnabled": true,
228
+ "optionsLimit": 20,
229
+ "searchColumns": ["productName", "sku"]
230
+ }
231
+ }
232
+ ```
233
+
234
+ #### Tree Select (Hierarchical)
235
+ Expects a flat list of nodes where each node has an ID and a Parent ID.
236
+
237
+ ```json
238
+ {
239
+ "type": "tree-select",
240
+ "dataConfig": {
241
+ "type": "source",
242
+ "sourceId": "departments",
243
+ "labelKey": "title",
244
+ "valueKey": "id",
245
+ "treeIdKey": "id",
246
+ "treeParentKey": "parentId"
247
+ }
248
+ }
249
+ ```
250
+
251
+ #### Data Table
252
+ Paged table view with server-side sorting.
253
+
254
+ ```json
255
+ {
256
+ "type": "table",
257
+ "dataConfig": {
258
+ "type": "source",
259
+ "sourceId": "orders",
260
+ "pageSize": 10,
261
+ "sort": [{ "column": "createdAt", "dir": "desc" }]
262
+ },
263
+ "columns": [
264
+ { "key": "id", "label": "Order ID" },
265
+ { "key": "total", "label": "Amount" },
266
+ { "key": "status", "label": "Status" }
267
+ ]
268
+ }
269
+ ```