survey-angular-ui 3.0.0 → 3.0.1
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 +210 -54
- package/package.json +15 -8
package/README.md
CHANGED
|
@@ -1,86 +1,242 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img width="1200" height="600" alt="readme_overview_library" src="https://github.com/user-attachments/assets/dfd139b5-9ca5-4cc2-886a-3650dbdbc6cd" />
|
|
4
|
+
|
|
1
5
|
# SurveyJS Angular Form Library
|
|
2
6
|
|
|
3
7
|
[](https://dev.azure.com/SurveyJS/V2%20Libraries/_build/latest?definitionId=130&repoName=surveyjs%2Fsurvey-library&branchName=master)
|
|
4
|
-
[](LICENSE)
|
|
8
|
+
[](https://github.com/surveyjs/survey-library/blob/master/LICENSE)
|
|
5
9
|
[](https://playwright.dev)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
10
|
+
[](https://github.com/surveyjs/survey-library/issues)
|
|
11
|
+
[](https://github.com/surveyjs/survey-library/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aclosed+)
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
<div align="justify">
|
|
15
|
+
|
|
16
|
+
SurveyJS Angular Form Library is a free and open-source Angular component library for rendering dynamic, JSON-driven forms and surveys in Angular applications.
|
|
17
|
+
|
|
18
|
+
The `survey-angular-ui` package integrates SurveyJS Form Library with Angular, renders forms defined with SurveyJS JSON form definitions, and collects user responses in the browser. It works together with the framework-independent [`survey-core`](https://github.com/surveyjs/survey-library/tree/master/packages/survey-core) package, which provides the form model and handles form structure, validation, conditional logic, calculations, navigation, localization, and other core behavior. Installing `survey-angular-ui` brings `survey-core` with it — you build a model from JSON with `survey-core` and bind it to this package's `<survey>` component to display.
|
|
19
|
+
|
|
20
|
+
Use SurveyJS Angular Form Library to build multi-step forms, surveys, quizzes, assessments, calculator forms, and other data-entry tools. Form definitions and submitted responses can be stored and processed in your own backend and database.
|
|
21
|
+
|
|
22
|
+
You can create form definitions manually, generate them with AI, or build them visually with [SurveyJS Creator](https://surveyjs.io/survey-creator/documentation/overview), an embeddable drag-and-drop form builder.
|
|
23
|
+
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
Requires **Angular v12.0.0 or newer** and the `@angular/cdk` package:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
npm install survey-angular-ui
|
|
32
|
+
npm install @angular/cdk --save
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
> Angular v8–v11 are supported by the legacy [`survey-angular`](https://www.npmjs.com/package/survey-angular) package, which depends on Knockout and is obsolete. See [Add SurveyJS Form Library to an Angular v8–v11 Application](https://github.com/surveyjs/code-examples/tree/main/legacy-angular/form-library).
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
Import `SurveyModule` in your `NgModule`:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
// app.module.ts
|
|
43
|
+
import { SurveyModule } from "survey-angular-ui";
|
|
44
|
+
|
|
45
|
+
@NgModule({
|
|
46
|
+
imports: [ /* ... */ SurveyModule ],
|
|
47
|
+
// ...
|
|
48
|
+
})
|
|
49
|
+
export class AppModule { }
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Build a model and bind it to the `<survey>` element:
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
// app.component.ts
|
|
56
|
+
import { Component } from "@angular/core";
|
|
57
|
+
import { Model } from "survey-core";
|
|
58
|
+
|
|
59
|
+
const surveyJson = {
|
|
60
|
+
elements: [
|
|
61
|
+
{ name: "firstName", title: "Enter your first name:", type: "text" },
|
|
62
|
+
{ name: "satisfaction", title: "How satisfied are you?", type: "rating" }
|
|
63
|
+
]
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
@Component({ selector: "app-root", templateUrl: "./app.component.html" })
|
|
67
|
+
export class AppComponent {
|
|
68
|
+
surveyModel = new Model(surveyJson);
|
|
69
|
+
|
|
70
|
+
constructor() {
|
|
71
|
+
this.surveyModel.onComplete.add((sender) => {
|
|
72
|
+
console.log(JSON.stringify(sender.data, null, 2));
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```html
|
|
79
|
+
<!-- app.component.html -->
|
|
80
|
+
<survey [model]="surveyModel"></survey>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Add the style sheet to the `styles` array in `angular.json`:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
"styles": [
|
|
87
|
+
"src/styles.css",
|
|
88
|
+
"node_modules/survey-core/survey-core.min.css"
|
|
89
|
+
]
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
When [using standalone components](https://github.com/surveyjs/code-examples/tree/main/get-started-library/angular-standalone-components), add `SurveyModule` to the component's `imports` array and import the style sheet in the component file instead:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
import "survey-core/survey-core.min.css";
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
This applies the Default theme. For other predefined themes and CSS-variable customization, refer to [Themes & Styles](https://surveyjs.io/form-library/documentation/manage-default-themes-and-styles).
|
|
99
|
+
|
|
100
|
+
## Theme Adapters
|
|
101
|
+
|
|
102
|
+
A theme adapter maps an existing design system's CSS variables onto SurveyJS design tokens, so an embedded survey inherits the look of the host application. Adapters ship with `survey-core` as plain CSS — load one after the base style sheet:
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
"styles": [
|
|
106
|
+
"node_modules/survey-core/survey-core.min.css",
|
|
107
|
+
"node_modules/survey-core/themes/adapters/bootstrap-default.css"
|
|
108
|
+
]
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Adapters are available for [Bootstrap](https://getbootstrap.com) (plus Bootswatch variants), [Material UI](https://mui.com), and [shadcn/ui](https://ui.shadcn.com), with matching icon sets (`survey-core/themes/adapters/icons/lucide`, `.../icons/mui`). See [Theme Adapters](https://surveyjs.io/themes/theme-adapters).
|
|
112
|
+
|
|
113
|
+
## Key Features
|
|
114
|
+
|
|
115
|
+
### Dynamic Forms and Surveys
|
|
116
|
+
|
|
117
|
+
- Render dynamic JSON-driven forms and surveys in Angular applications
|
|
118
|
+
- Multi-step forms, quizzes, assessments, calculator forms, and survey pop-ups
|
|
119
|
+
- Conditional visibility, branching, calculations, and expression-based logic
|
|
120
|
+
- Input validation, [save-and-resume workflows](https://surveyjs.io/form-library/examples/save-and-restore-user-responses-to-complete-survey/angular), and dynamic content
|
|
121
|
+
|
|
122
|
+
### Form Controls
|
|
123
|
+
|
|
124
|
+
- 20+ built-in question and input types
|
|
125
|
+
- Dynamic panels and repeating question groups
|
|
126
|
+
- [Custom question types](https://surveyjs.io/form-library/documentation/customize-question-types/question-customization-options) and reusable components
|
|
127
|
+
- Electronic signature, image capture, file upload, matrices, and other advanced controls
|
|
128
|
+
|
|
129
|
+
### Angular Integration
|
|
130
|
+
|
|
131
|
+
- Native Angular components
|
|
34
132
|
- TypeScript support
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
|
|
38
|
-
|
|
133
|
+
- Framework-independent form model through `survey-core`
|
|
134
|
+
- Client-side rendering without a required SurveyJS backend
|
|
135
|
+
|
|
136
|
+
### Data and Backend Integration
|
|
137
|
+
|
|
138
|
+
- [Connect to any server, API, or database](https://surveyjs.io/documentation/backend-integration)
|
|
139
|
+
- Store form definitions and submitted responses in your own infrastructure
|
|
140
|
+
- [Load choices from web services](https://surveyjs.io/form-library/examples/dropdown-menu-load-data-from-restful-service/angular)
|
|
141
|
+
- Integrate third-party components and services
|
|
142
|
+
- [Backend integration examples for PHP, ASP.NET Core, and Node.js](https://surveyjs.io/backend-integration/examples)
|
|
143
|
+
|
|
144
|
+
### Appearance and Localization
|
|
145
|
+
|
|
146
|
+
- Built-in themes and custom branding
|
|
147
|
+
- [Theme Adapters for Bootstrap, Material UI, and shadcn/ui](https://surveyjs.io/themes/theme-adapters)
|
|
148
|
+
- Multi-language forms and right-to-left language support
|
|
149
|
+
- Community-supported UI localization
|
|
39
150
|
|
|
40
|
-
##
|
|
151
|
+
## Related packages
|
|
41
152
|
|
|
42
|
-
|
|
153
|
+
| Package | Purpose |
|
|
154
|
+
| --- | --- |
|
|
155
|
+
| [`survey-core`](https://www.npmjs.com/package/survey-core) | Platform-independent survey model (installed automatically) |
|
|
156
|
+
| [`survey-react-ui`](https://www.npmjs.com/package/survey-react-ui) | React renderer |
|
|
157
|
+
| [`survey-vue3-ui`](https://www.npmjs.com/package/survey-vue3-ui) | Vue 3 renderer |
|
|
158
|
+
| [`survey-js-ui`](https://www.npmjs.com/package/survey-js-ui) | HTML/CSS/JavaScript renderer |
|
|
43
159
|
|
|
44
160
|
## Resources
|
|
45
161
|
|
|
46
162
|
- [Website](https://surveyjs.io/)
|
|
47
|
-
- [Documentation](https://surveyjs.io/
|
|
48
|
-
- [
|
|
49
|
-
- [
|
|
163
|
+
- [Documentation](https://surveyjs.io/form-library/documentation/overview)
|
|
164
|
+
- [Get Started with Angular](https://surveyjs.io/form-library/documentation/get-started-angular)
|
|
165
|
+
- [Form Library Demos for Angular](https://surveyjs.io/form-library/examples/nps-question/angular)
|
|
166
|
+
- [Release Notes](https://surveyjs.io/stay-updated/release-notes)
|
|
167
|
+
- [Roadmap](https://surveyjs.io/stay-updated/roadmap)
|
|
168
|
+
- [What's New](https://surveyjs.io/stay-updated/major-updates/2025-2026)
|
|
50
169
|
|
|
51
|
-
|
|
170
|
+
For AI coding agents: [https://surveyjs.io/llms.txt](https://surveyjs.io/llms.txt) indexes the documentation. Any documentation page is also available as raw Markdown — append `.md` to its URL, for example [https://surveyjs.io/form-library/documentation/get-started-angular.md](https://surveyjs.io/form-library/documentation/get-started-angular.md).
|
|
52
171
|
|
|
53
|
-
|
|
172
|
+
## SurveyJS Ecosystem
|
|
54
173
|
|
|
55
|
-
|
|
174
|
+
| Product | Purpose | License |
|
|
175
|
+
| --- | --- | --- |
|
|
176
|
+
| [Form Library](https://surveyjs.io/form-library) | Render dynamic forms from JSON (this package) | MIT |
|
|
177
|
+
| [Survey Creator](https://surveyjs.io/survey-creator) | Drag-and-drop form builder UI | Commercial |
|
|
178
|
+
| [Dashboard](https://surveyjs.io/dashboard) | Visualize and analyze collected results | Commercial |
|
|
179
|
+
| [PDF Generator](https://surveyjs.io/pdf-generator) | Render forms and responses as PDF | Commercial |
|
|
180
|
+
| [AI Form Response Extractor](https://surveyjs.io/documentation/combine-paper-and-online-survey-form-data) | Extract responses from paper forms, PDFs, and images into a SurveyJS schema (`ai-form-response-extractor`) | MIT |
|
|
56
181
|
|
|
182
|
+
## Build from Source
|
|
183
|
+
|
|
184
|
+
Requires Node.js 20 or later — CI builds on Node 20.x and 22.x. This monorepo does **not** use npm workspaces: each package installs independently, but a root install is still required for the shared tooling (linting, Playwright).
|
|
185
|
+
|
|
186
|
+
1. **Clone the repo and install shared dependencies**
|
|
187
|
+
|
|
188
|
+
```sh
|
|
189
|
+
git clone https://github.com/surveyjs/survey-library.git
|
|
190
|
+
cd survey-library
|
|
191
|
+
npm install
|
|
57
192
|
```
|
|
58
|
-
|
|
59
|
-
|
|
193
|
+
|
|
194
|
+
2. **Build `survey-core` first**
|
|
195
|
+
|
|
196
|
+
This package resolves `survey-core` from `../survey-core/build`, so the model must be built before this library can be built or tested. Follow [Build from sources](https://github.com/surveyjs/survey-library/blob/master/packages/survey-core/README.md#build-from-sources) in the `survey-core` README.
|
|
197
|
+
|
|
198
|
+
3. **Install dependencies and build this library**
|
|
199
|
+
|
|
200
|
+
```sh
|
|
201
|
+
cd packages/survey-angular-ui
|
|
202
|
+
npm install
|
|
60
203
|
npm run build
|
|
61
204
|
```
|
|
62
205
|
|
|
63
|
-
|
|
206
|
+
Build output goes to the `build` directory.
|
|
64
207
|
|
|
65
|
-
|
|
208
|
+
4. **Run a test application**
|
|
66
209
|
|
|
67
|
-
```
|
|
210
|
+
```sh
|
|
68
211
|
cd example
|
|
69
|
-
npm
|
|
70
|
-
cd
|
|
212
|
+
npm install
|
|
213
|
+
cd ..
|
|
71
214
|
npm run serve:example:dev
|
|
72
215
|
```
|
|
73
216
|
|
|
74
|
-
This
|
|
217
|
+
This runs a local HTTP server at http://localhost:4200/.
|
|
75
218
|
|
|
76
|
-
|
|
219
|
+
5. **Run unit tests**
|
|
77
220
|
|
|
78
|
-
|
|
79
|
-
|
|
221
|
+
Unit tests run through the Angular CLI, which uses [Karma](https://karma-runner.github.io/latest/index.html) and [Jasmine](https://jasmine.github.io/).
|
|
222
|
+
|
|
223
|
+
```sh
|
|
224
|
+
npm run test # single run, headless Chrome
|
|
225
|
+
npm run test:watch # watch mode
|
|
80
226
|
```
|
|
81
227
|
|
|
82
|
-
|
|
228
|
+
6. **Run end-to-end tests**
|
|
229
|
+
|
|
230
|
+
E2E, visual-regression, and accessibility tests are Playwright suites. Angular serves a production build of the example app, so build it first. Do not start an HTTP server yourself — the Playwright config runs `serve:example:prod` itself.
|
|
231
|
+
|
|
232
|
+
```sh
|
|
233
|
+
npm run build:example:prod # produces example/dist
|
|
234
|
+
npm run e2e:ci # e2e
|
|
235
|
+
npm run e2e:ci -- --grep "TestName" # a single test
|
|
236
|
+
npm run scr:ci # visual regression
|
|
237
|
+
npm run accessibility-tests:ci # accessibility
|
|
238
|
+
```
|
|
83
239
|
|
|
84
240
|
## Licensing
|
|
85
241
|
|
|
86
|
-
SurveyJS Form Library is distributed under the [MIT license](https://github.com/surveyjs/survey-library/blob/master/LICENSE).
|
|
242
|
+
SurveyJS Form Library is distributed under the [MIT license](https://github.com/surveyjs/survey-library/blob/master/LICENSE).
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "survey-angular-ui",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"homepage": "https://surveyjs.io/",
|
|
5
5
|
"author": "DevSoft Baltic OU <info@devsoftbaltic.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"description": "
|
|
7
|
+
"description": "Angular form library for rendering dynamic, JSON-based forms and surveys. Collect user responses and store them in your own database.",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"angular",
|
|
10
10
|
"survey",
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"dynamic-form",
|
|
18
18
|
"interactive-form",
|
|
19
19
|
"form-library",
|
|
20
|
-
"form-management",
|
|
21
20
|
"questionnaire",
|
|
22
21
|
"data-collection",
|
|
23
22
|
"data-validation",
|
|
@@ -27,11 +26,19 @@
|
|
|
27
26
|
"json",
|
|
28
27
|
"json-schema",
|
|
29
28
|
"angular-schema-form",
|
|
30
|
-
"survey-renderer",
|
|
31
|
-
"client-side",
|
|
32
|
-
"frontend",
|
|
33
29
|
"javascript",
|
|
34
|
-
"typescript"
|
|
30
|
+
"typescript",
|
|
31
|
+
"schema-form",
|
|
32
|
+
"conditional-logic",
|
|
33
|
+
"quiz",
|
|
34
|
+
"poll",
|
|
35
|
+
"localization",
|
|
36
|
+
"css",
|
|
37
|
+
"shadcn",
|
|
38
|
+
"mui",
|
|
39
|
+
"material-ui",
|
|
40
|
+
"bootstrap",
|
|
41
|
+
"bootswatch"
|
|
35
42
|
],
|
|
36
43
|
"repository": {
|
|
37
44
|
"type": "git",
|
|
@@ -42,7 +49,7 @@
|
|
|
42
49
|
"@angular/cdk": "*",
|
|
43
50
|
"@angular/core": "*",
|
|
44
51
|
"@angular/forms": "*",
|
|
45
|
-
"survey-core": "3.0.
|
|
52
|
+
"survey-core": "3.0.1"
|
|
46
53
|
},
|
|
47
54
|
"overrides": {
|
|
48
55
|
"stylus": "github:stylus/stylus#0.54.8"
|