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.
Files changed (2) hide show
  1. package/README.md +210 -54
  2. 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
  [![Build Status](https://dev.azure.com/SurveyJS/V2%20Libraries/_apis/build/status%2Flibrary%2FLibrary%20Main?repoName=surveyjs%2Fsurvey-library&branchName=master)](https://dev.azure.com/SurveyJS/V2%20Libraries/_build/latest?definitionId=130&repoName=surveyjs%2Fsurvey-library&branchName=master)
4
- [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE)
8
+ [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](https://github.com/surveyjs/survey-library/blob/master/LICENSE)
5
9
  [![Tested with Playwright](https://img.shields.io/badge/tested%20with-Playwright-2fa4cf.svg)](https://playwright.dev)
6
- <a href="https://github.com/surveyjs/survey-library/issues">
7
- <img alt="Issues" title="Open Issues" src="https://img.shields.io/github/issues/surveyjs/survey-library.svg">
8
- </a>
9
- <a href="https://github.com/surveyjs/survey-library/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aclosed+">
10
- <img alt="Closed issues" title="Closed Issues" src="https://img.shields.io/github/issues-closed/surveyjs/survey-library.svg">
11
- </a>
12
-
13
- A free and open-source MIT-licensed JavaScript form builder library that allows you to design dynamic, data-driven, multi-language survey forms and run them in your Angular applications.
14
-
15
- > **NOTE**: SurveyJS for Angular requires Angular v12.0.0 or newer and depends on the `@angular/cdk` package. If your project does not include it yet, run the following command:
16
- >
17
- > ```cmd
18
- > npm install @angular/cdk@^12.0.0 --save
19
- > ```
20
- >
21
- > Earlier Angular versions are supported by the [`survey-angular`](https://www.npmjs.com/package/survey-angular) package. It depends on Knockout and is now obsolete. However, you can use it in your Angular v8&ndash;v11 projects. Refer to the following examples on GitHub for more information:
22
- >
23
- > - [Add SurveyJS Form Library to an Angular v8&ndash;v11 Application](https://github.com/surveyjs/code-examples/tree/main/legacy-angular/form-library)
24
- > - [Add Survey Creator to an Angular v8&ndash;v11 Application](https://github.com/surveyjs/code-examples/tree/main/legacy-angular/survey-creator).
25
-
26
-
27
- ## Features
28
-
29
- - Dynamic forms, surveys, polls, and quizzes for your JavaScript application
30
- - Integration with React, Angular, Vue, jQuery, and Knockout
31
- - 20+ built-in question types and support for custom question types
32
- - Built-in themes and CSS customization
33
- - Answer validation
10
+ [![Open Issues](https://img.shields.io/github/issues/surveyjs/survey-library.svg)](https://github.com/surveyjs/survey-library/issues)
11
+ [![Closed Issues](https://img.shields.io/github/issues-closed/surveyjs/survey-library.svg)](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&ndash;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&ndash;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
- - Community-supported UI localization to 50+ languages
36
- - Integration with any backend framework (examples for PHP, NodeJS, and ASP.NET included)
37
- - Compatibility with any server + database combination
38
- - Third-party component integration
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
- ## Get Started
151
+ ## Related packages
41
152
 
42
- To get started with SurveyJS Angular Form Library, refer to the following tutorial: [Add a Survey to an Angular Application](https://surveyjs.io/Documentation/Library?id=get-started-angular).
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/Documentation/Library)
48
- - [Live Examples](https://surveyjs.io/form-library/examples/nps-question/angular)
49
- - [What's New](https://surveyjs.io/WhatsNew)
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
- ## Build SurveyJS Angular Form Library from Sources
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
- 1. [**Build the platform-independent part**](../survey-core/README.md#survey-model-platform-independent-part)
172
+ ## SurveyJS Ecosystem
54
173
 
55
- 2. **Install SurveyJS Angular Form Library dependencies and build this library**
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
- cd ../survey-angular-ui
59
- npm i
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
- You can find the built scripts in folders under the `build` directory.
206
+ Build output goes to the `build` directory.
64
207
 
65
- 3. **Run a test application**
208
+ 4. **Run a test application**
66
209
 
67
- ```
210
+ ```sh
68
211
  cd example
69
- npm i
70
- cd ../
212
+ npm install
213
+ cd ..
71
214
  npm run serve:example:dev
72
215
  ```
73
216
 
74
- This command runs a local HTTP server at http://localhost:4200/.
217
+ This runs a local HTTP server at http://localhost:4200/.
75
218
 
76
- 4. **Run unit tests**
219
+ 5. **Run unit tests**
77
220
 
78
- ```
79
- npm run test
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
- The unit tests use [Karma](https://karma-runner.github.io/6.3/index.html).
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.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": "A free MIT-licensed Angular UI component that renders dynamic, interactive JSON-based forms and surveys. You can use it to collect responses from users and send them to your own database.",
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.0"
52
+ "survey-core": "3.0.1"
46
53
  },
47
54
  "overrides": {
48
55
  "stylus": "github:stylus/stylus#0.54.8"