@bpmn-io/form-js-editor 1.7.3 → 1.8.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/LICENSE CHANGED
@@ -1,23 +1,23 @@
1
- Copyright (c) 2021-present Camunda Services GmbH
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- this software and associated documentation files (the "Software"), to deal in the
5
- Software without restriction, including without limitation the rights to use, copy,
6
- modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
7
- and to permit persons to whom the Software is furnished to do so, subject to the
8
- following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- The source code responsible for displaying the bpmn.io project watermark that
14
- links back to https://bpmn.io as part of rendered diagrams MUST NOT be
15
- removed or changed. When this software is being used in a website or application,
16
- the watermark must stay fully visible and not visually overlapped by other elements.
17
-
18
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
19
- INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
20
- PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
1
+ Copyright (c) 2021-present Camunda Services GmbH
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in the
5
+ Software without restriction, including without limitation the rights to use, copy,
6
+ modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
7
+ and to permit persons to whom the Software is furnished to do so, subject to the
8
+ following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ The source code responsible for displaying the bpmn.io project watermark that
14
+ links back to https://bpmn.io as part of rendered diagrams MUST NOT be
15
+ removed or changed. When this software is being used in a website or application,
16
+ the watermark must stay fully visible and not visually overlapped by other elements.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
19
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
20
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
23
23
  OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,152 +1,152 @@
1
- # @bpmn-io/form-js-editor
2
-
3
- An editor to create forms that can be displayed with the [form-js viewer](../form-js-viewer).
4
-
5
-
6
- ## Installation
7
-
8
- ```
9
- npm install @bpmn-io/form-js-editor
10
- ```
11
-
12
-
13
- ## Usage
14
-
15
- ```javascript
16
- import { FormEditor } from '@bpmn-io/form-js-editor';
17
-
18
- const schema = {
19
- components: [
20
- {
21
- key: 'creditor',
22
- label: 'Creditor',
23
- type: 'textfield',
24
- validate: {
25
- required: true
26
- }
27
- }
28
- ]
29
- };
30
-
31
- const formEditor = new FormEditor({
32
- container: document.querySelector('#form-editor')
33
- });
34
-
35
- await formEditor.importSchema(schema);
36
- ```
37
-
38
- Check out [a full example](https://github.com/bpmn-io/form-js-examples).
39
-
40
-
41
- ## Styling
42
-
43
- For proper styling include the necessary stylesheets, and font used:
44
-
45
- ```html
46
- <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,400;0,600;1,400&display=swap" rel="stylesheet">
47
-
48
- <link rel="stylesheet" href="https://unpkg.com/@bpmn-io/form-js@0.10.0/dist/assets/form-js.css">
49
- <link rel="stylesheet" href="https://unpkg.com/@bpmn-io/form-js@0.10.0/dist/assets/form-js-editor.css">
50
- ```
51
-
52
-
53
- ## API
54
-
55
- ### `FormEditor`
56
-
57
- Create a new form editor with options `{ container?: HTMLElement }`.
58
-
59
- ```javascript
60
- import { FormEditor } from '@bpmn-io/form-js-editor';
61
-
62
- const formEditor = new FormEditor({
63
- container: document.querySelector('#form-editor')
64
- });
65
- ```
66
-
67
-
68
- ### `FormEditor#importSchema(schema: Schema) => Promise<Result, Error>`
69
-
70
- Display and edit a form represented via a form schema.
71
-
72
- ```javascript
73
- try {
74
- await formEditor.importSchema(schema);
75
- } catch (err) {
76
- console.log('importing form failed', err);
77
- }
78
- ```
79
-
80
-
81
- ### `FormEditor#saveSchema() => Schema`
82
-
83
- Export the form schema.
84
-
85
- ```javascript
86
- const schema = formEditor.saveSchema(schema);
87
-
88
- console.log('exported schema', schema);
89
- ```
90
-
91
-
92
- ### `FormEditor#attachTo(parentNode: HTMLElement) => void`
93
-
94
-
95
- Attach the form editor to a parent node.
96
-
97
-
98
- ### `FormEditor#detach() => void`
99
-
100
-
101
- Detach the form editor from its parent node.
102
-
103
-
104
- ### `FormEditor#on(event, fn) => void`
105
-
106
- Subscribe to an [event](#events).
107
-
108
-
109
- ### `FormEditor#destroy() => void`
110
-
111
- Remove form from editor the document.
112
-
113
- ## Events
114
-
115
- ### `selection.changed :: { selection }`
116
-
117
- ### Properties panel events
118
- - `propertiesPanel.focusin`
119
- - `propertiesPanel.focusout`
120
- - `propertiesPanel.showEntry :: { id }`
121
- - `propertiesPanel.updated :: { formField }`
122
-
123
- ### Form lifecycle events
124
- - `detach`
125
- - `attach`
126
- - `rendered`
127
- - `form.init`
128
- - `form.clear`
129
- - `form.destroy`
130
- - `diagram.clear`
131
- - `diagram.destroy`
132
- - `dragula.created`
133
- - `dragula.destroyed`
134
- - `editorActions.init :: { editorActions }`
135
-
136
- ### Drag events
137
- - `drag.start :: { element, source }`
138
- - `drag.end :: { element }`
139
- - `drag.drop :: { element, target, source, sibling }`
140
- - `drag.hover :: { element, container, source }`
141
- - `drag.out :: { element, container, source }`
142
- - `drag.cancel :: { element, container, source }`
143
-
144
- ### Form field events
145
- - `formField.add :: { formField }`
146
- - `formField.remove :: { formField }`
147
- - `formField.updateId :: { formField, newId }`
148
-
149
-
150
- ## License
151
-
152
- Use under the terms of the [bpmn.io license](http://bpmn.io/license).
1
+ # @bpmn-io/form-js-editor
2
+
3
+ An editor to create forms that can be displayed with the [form-js viewer](../form-js-viewer).
4
+
5
+
6
+ ## Installation
7
+
8
+ ```
9
+ npm install @bpmn-io/form-js-editor
10
+ ```
11
+
12
+
13
+ ## Usage
14
+
15
+ ```javascript
16
+ import { FormEditor } from '@bpmn-io/form-js-editor';
17
+
18
+ const schema = {
19
+ components: [
20
+ {
21
+ key: 'creditor',
22
+ label: 'Creditor',
23
+ type: 'textfield',
24
+ validate: {
25
+ required: true
26
+ }
27
+ }
28
+ ]
29
+ };
30
+
31
+ const formEditor = new FormEditor({
32
+ container: document.querySelector('#form-editor')
33
+ });
34
+
35
+ await formEditor.importSchema(schema);
36
+ ```
37
+
38
+ Check out [a full example](https://github.com/bpmn-io/form-js-examples).
39
+
40
+
41
+ ## Styling
42
+
43
+ For proper styling include the necessary stylesheets, and font used:
44
+
45
+ ```html
46
+ <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,400;0,600;1,400&display=swap" rel="stylesheet">
47
+
48
+ <link rel="stylesheet" href="https://unpkg.com/@bpmn-io/form-js@0.10.0/dist/assets/form-js.css">
49
+ <link rel="stylesheet" href="https://unpkg.com/@bpmn-io/form-js@0.10.0/dist/assets/form-js-editor.css">
50
+ ```
51
+
52
+
53
+ ## API
54
+
55
+ ### `FormEditor`
56
+
57
+ Create a new form editor with options `{ container?: HTMLElement }`.
58
+
59
+ ```javascript
60
+ import { FormEditor } from '@bpmn-io/form-js-editor';
61
+
62
+ const formEditor = new FormEditor({
63
+ container: document.querySelector('#form-editor')
64
+ });
65
+ ```
66
+
67
+
68
+ ### `FormEditor#importSchema(schema: Schema) => Promise<Result, Error>`
69
+
70
+ Display and edit a form represented via a form schema.
71
+
72
+ ```javascript
73
+ try {
74
+ await formEditor.importSchema(schema);
75
+ } catch (err) {
76
+ console.log('importing form failed', err);
77
+ }
78
+ ```
79
+
80
+
81
+ ### `FormEditor#saveSchema() => Schema`
82
+
83
+ Export the form schema.
84
+
85
+ ```javascript
86
+ const schema = formEditor.saveSchema(schema);
87
+
88
+ console.log('exported schema', schema);
89
+ ```
90
+
91
+
92
+ ### `FormEditor#attachTo(parentNode: HTMLElement) => void`
93
+
94
+
95
+ Attach the form editor to a parent node.
96
+
97
+
98
+ ### `FormEditor#detach() => void`
99
+
100
+
101
+ Detach the form editor from its parent node.
102
+
103
+
104
+ ### `FormEditor#on(event, fn) => void`
105
+
106
+ Subscribe to an [event](#events).
107
+
108
+
109
+ ### `FormEditor#destroy() => void`
110
+
111
+ Remove form from editor the document.
112
+
113
+ ## Events
114
+
115
+ ### `selection.changed :: { selection }`
116
+
117
+ ### Properties panel events
118
+ - `propertiesPanel.focusin`
119
+ - `propertiesPanel.focusout`
120
+ - `propertiesPanel.showEntry :: { id }`
121
+ - `propertiesPanel.updated :: { formField }`
122
+
123
+ ### Form lifecycle events
124
+ - `detach`
125
+ - `attach`
126
+ - `rendered`
127
+ - `form.init`
128
+ - `form.clear`
129
+ - `form.destroy`
130
+ - `diagram.clear`
131
+ - `diagram.destroy`
132
+ - `dragula.created`
133
+ - `dragula.destroyed`
134
+ - `editorActions.init :: { editorActions }`
135
+
136
+ ### Drag events
137
+ - `drag.start :: { element, source }`
138
+ - `drag.end :: { element }`
139
+ - `drag.drop :: { element, target, source, sibling }`
140
+ - `drag.hover :: { element, container, source }`
141
+ - `drag.out :: { element, container, source }`
142
+ - `drag.cancel :: { element, container, source }`
143
+
144
+ ### Form field events
145
+ - `formField.add :: { formField }`
146
+ - `formField.remove :: { formField }`
147
+ - `formField.updateId :: { formField, newId }`
148
+
149
+
150
+ ## License
151
+
152
+ Use under the terms of the [bpmn.io license](http://bpmn.io/license).
@@ -211,22 +211,6 @@
211
211
  display: flex;
212
212
  }
213
213
 
214
- .fjs-no-json-lint .cm-lint-marker,
215
- .fjs-no-json-lint .cm-lintPoint-error {
216
- display: none;
217
- }
218
-
219
- .fjs-no-json-lint .cm-activeLine,
220
- .fjs-no-json-lint .cm-activeLineGutter {
221
- background: none;
222
- }
223
-
224
- .fjs-no-json-lint .cm-placeholder {
225
- font-size: 12px;
226
- line-height: 16px;
227
- color: var(--cds-text-placeholder, var(--color-grey-225-10-35));
228
- }
229
-
230
214
  .fjs-editor-container .fjs-form-editor {
231
215
  display: flex;
232
216
  flex: 1;
@@ -279,14 +263,21 @@
279
263
  border-color: var(--color-borders-group);
280
264
  }
281
265
 
266
+ .fjs-editor-container .fjs-children .fjs-element.fjs-dashed-outlined {
267
+ border-color: var(--color-borders-group);
268
+ border-style: dashed;
269
+ }
270
+
282
271
  .fjs-editor-container .fjs-children .fjs-element.fjs-editor-selected {
283
272
  border-color: var(--color-children-selected-border) !important;
284
273
  background-color: var(--color-children-selected-background);
274
+ border-style: solid;
285
275
  }
286
276
 
287
277
  .fjs-editor-container .fjs-children .fjs-element:hover.fjs-editor-hovered,
288
278
  .fjs-editor-container .fjs-children .fjs-element:focus {
289
279
  border-color: var(--color-children-hover-border);
280
+ border-style: solid;
290
281
  }
291
282
 
292
283
  .fjs-editor-container .fjs-layout-column:first-child > .fjs-element[data-field-type="group"],
@@ -722,6 +713,34 @@
722
713
  color: var(--color-palette-text);
723
714
  }
724
715
 
716
+ /**
717
+ * JSON Editors
718
+ */
719
+
720
+ .fjs-json-editor .cm-editor {
721
+ font-size: var(--font-size-label);
722
+ line-height: var(--line-height-label);
723
+ letter-spacing: var(--letter-spacing-label);
724
+ }
725
+
726
+ .fjs-json-editor .cm-placeholder {
727
+ color: var(--cds-text-placeholder, var(--color-grey-225-10-35));
728
+ }
729
+
730
+ .fjs-json-editor .cm-placeholder > :first-child {
731
+ margin-top: 0;
732
+ }
733
+
734
+ .fjs-json-editor.fjs-cm-no-lint .cm-lint-marker,
735
+ .fjs-json-editor.fjs-cm-no-lint .cm-lintPoint-error {
736
+ display: none;
737
+ }
738
+
739
+ .fjs-json-editor.fjs-cm-no-lint .cm-activeLine,
740
+ .fjs-json-editor.fjs-cm-no-lint .cm-activeLineGutter {
741
+ background: none;
742
+ }
743
+
725
744
  /**
726
745
  * Properties Panel
727
746
  */
@@ -189,22 +189,6 @@
189
189
  display: flex;
190
190
  }
191
191
 
192
- .fjs-no-json-lint .cm-lint-marker,
193
- .fjs-no-json-lint .cm-lintPoint-error {
194
- display: none;
195
- }
196
-
197
- .fjs-no-json-lint .cm-activeLine,
198
- .fjs-no-json-lint .cm-activeLineGutter {
199
- background: none;
200
- }
201
-
202
- .fjs-no-json-lint .cm-placeholder {
203
- font-size: 12px;
204
- line-height: 16px;
205
- color: var(--cds-text-placeholder, var(--color-grey-225-10-35));
206
- }
207
-
208
192
  .fjs-editor-container .fjs-form-editor {
209
193
  display: flex;
210
194
  flex: 1;
@@ -257,14 +241,21 @@
257
241
  border-color: var(--color-borders-group);
258
242
  }
259
243
 
244
+ .fjs-editor-container .fjs-children .fjs-element.fjs-dashed-outlined {
245
+ border-color: var(--color-borders-group);
246
+ border-style: dashed;
247
+ }
248
+
260
249
  .fjs-editor-container .fjs-children .fjs-element.fjs-editor-selected {
261
250
  border-color: var(--color-children-selected-border) !important;
262
251
  background-color: var(--color-children-selected-background);
252
+ border-style: solid;
263
253
  }
264
254
 
265
255
  .fjs-editor-container .fjs-children .fjs-element:hover.fjs-editor-hovered,
266
256
  .fjs-editor-container .fjs-children .fjs-element:focus {
267
257
  border-color: var(--color-children-hover-border);
258
+ border-style: solid;
268
259
  }
269
260
 
270
261
  .fjs-editor-container .fjs-layout-column:first-child > .fjs-element[data-field-type=group],
@@ -697,6 +688,33 @@
697
688
  color: var(--color-palette-text);
698
689
  }
699
690
 
691
+ /**
692
+ * JSON Editors
693
+ */
694
+ .fjs-json-editor .cm-editor {
695
+ font-size: var(--font-size-label);
696
+ line-height: var(--line-height-label);
697
+ letter-spacing: var(--letter-spacing-label);
698
+ }
699
+
700
+ .fjs-json-editor .cm-placeholder {
701
+ color: var(--cds-text-placeholder, var(--color-grey-225-10-35));
702
+ }
703
+
704
+ .fjs-json-editor .cm-placeholder > :first-child {
705
+ margin-top: 0;
706
+ }
707
+
708
+ .fjs-json-editor.fjs-cm-no-lint .cm-lint-marker,
709
+ .fjs-json-editor.fjs-cm-no-lint .cm-lintPoint-error {
710
+ display: none;
711
+ }
712
+
713
+ .fjs-json-editor.fjs-cm-no-lint .cm-activeLine,
714
+ .fjs-json-editor.fjs-cm-no-lint .cm-activeLineGutter {
715
+ background: none;
716
+ }
717
+
700
718
  /**
701
719
  * Properties Panel
702
720
  */