@jsonforms/examples 3.0.0 → 3.1.0-alpha.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsonforms/examples",
3
- "version": "3.0.0",
3
+ "version": "3.1.0-alpha.1",
4
4
  "description": "JSON Forms Example Data",
5
5
  "repository": "https://github.com/eclipsesource/jsonforms",
6
6
  "bugs": "https://github.com/eclipsesource/jsonforms/issues",
@@ -45,12 +45,12 @@
45
45
  "ajv-i18n": "^3.5.0"
46
46
  },
47
47
  "peerDependencies": {
48
- "@jsonforms/core": "3.0.0"
48
+ "@jsonforms/core": "3.1.0-alpha.1"
49
49
  },
50
50
  "devDependencies": {
51
- "@jsonforms/core": "^3.0.0",
51
+ "@jsonforms/core": "^3.1.0-alpha.1",
52
52
  "rimraf": "^3.0.2",
53
- "rollup": "^2.7.3",
53
+ "rollup": "^2.78.0",
54
54
  "rollup-plugin-cleanup": "^3.2.1",
55
55
  "rollup-plugin-typescript2": "^0.31.1",
56
56
  "rollup-plugin-visualizer": "^5.4.1",
@@ -59,5 +59,5 @@
59
59
  "typedoc": "^0.19.2",
60
60
  "typescript": "4.2.3"
61
61
  },
62
- "gitHead": "20e9e0fd72bb388611d7387e1f533d66b7839041"
62
+ "gitHead": "386174994eabc41758450b8d551e1c859498a468"
63
63
  }
@@ -0,0 +1,135 @@
1
+ /*
2
+ The MIT License
3
+
4
+ Copyright (c) 2017-2019 EclipseSource Munich
5
+ https://github.com/eclipsesource/jsonforms
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
24
+ */
25
+ import { registerExamples } from '../register';
26
+ import { StateProps } from '../example';
27
+
28
+ export const schema = {
29
+ type: 'object',
30
+ properties: {
31
+ comments: {
32
+ type: 'array',
33
+ items: {
34
+ type: 'object',
35
+ properties: {
36
+ date: {
37
+ type: 'string',
38
+ format: 'date'
39
+ },
40
+ message: {
41
+ type: 'string',
42
+ maxLength: 5
43
+ },
44
+ enum: {
45
+ type: 'string',
46
+ const: 'foo'
47
+ }
48
+ }
49
+ }
50
+ },
51
+ foo:{type:'string'}
52
+ }
53
+ };
54
+
55
+ export const uischema = {
56
+ type: 'VerticalLayout',
57
+ elements: [
58
+ {
59
+ type: 'Control',
60
+ scope: '#/properties/foo'
61
+ },
62
+ {
63
+ type: 'Control',
64
+ scope: '#/properties/comments',
65
+ options: {
66
+ showSortButtons: true
67
+ }
68
+ }
69
+ ]
70
+ };
71
+
72
+ export const uischemaWithSorting = {
73
+ type: 'VerticalLayout',
74
+ elements: [
75
+ {
76
+ type: 'Control',
77
+ scope: '#/properties/foo'
78
+ },
79
+ {
80
+ type: 'Control',
81
+ scope: '#/properties/comments',
82
+ options: {
83
+ showSortButtons: true
84
+ }
85
+ }
86
+ ]
87
+ };
88
+
89
+ export const data = {
90
+ comments: [
91
+ {
92
+ date: new Date(2001, 8, 11).toISOString().substr(0, 10),
93
+ message: 'This is an example message With sorting'
94
+ },
95
+ {
96
+ date: new Date().toISOString().substr(0, 10),
97
+ message: 'Get ready for booohay'
98
+ }
99
+ ]
100
+ };
101
+
102
+ const actions = [
103
+ {
104
+ 'label': 'Enable Sorting',
105
+ 'apply': (props: StateProps) => {
106
+ return {
107
+ ...props,
108
+ uischema: uischemaWithSorting
109
+ }
110
+ }
111
+ },
112
+ {
113
+ 'label': 'Disable Sorting',
114
+ 'apply': (props: StateProps) => {
115
+ return {
116
+ ...props,
117
+ uischema: uischema
118
+ }
119
+ }
120
+ },
121
+ ];
122
+
123
+ registerExamples([
124
+ {
125
+ name: 'array-with-sorting',
126
+ label: 'Array with sorting',
127
+ data,
128
+ schema,
129
+ uischema,
130
+ config: {
131
+ withSort: uischemaWithSorting
132
+ },
133
+ actions
134
+ }
135
+ ]);
@@ -61,7 +61,10 @@ export const uischema = {
61
61
  },
62
62
  {
63
63
  type: 'Control',
64
- scope: '#/properties/comments'
64
+ scope: '#/properties/comments',
65
+ options: {
66
+ showSortButtons: false
67
+ }
65
68
  }
66
69
  ]
67
70
  };
@@ -77,7 +80,7 @@ export const uischemaWithSorting = {
77
80
  type: 'Control',
78
81
  scope: '#/properties/comments',
79
82
  options: {
80
- showSortButtons: true
83
+ showSortButtons: false
81
84
  }
82
85
  }
83
86
  ]
@@ -31,7 +31,8 @@ export const schema = {
31
31
  type: 'string'
32
32
  },
33
33
  boolean: {
34
- type: 'boolean'
34
+ type: 'boolean',
35
+ description: 'Boolean description as a tooltip'
35
36
  },
36
37
  number: {
37
38
  type: 'number'
package/src/index.ts CHANGED
@@ -32,6 +32,7 @@ import * as nestedArray from './examples/nestedArrays';
32
32
  import * as arrayWithDetail from './examples/arrays-with-detail';
33
33
  import * as arrayWithDetailAndRule from './examples/arrays-with-detail-and-rule';
34
34
  import * as arrayWithCustomChildLabel from './examples/arrays-with-custom-element-label';
35
+ import * as arrayWithSorting from './examples/arrays-with-sorting';
35
36
  import * as stringArray from './examples/stringArray';
36
37
  import * as categorization from './examples/categorization';
37
38
  import * as stepper from './examples/stepper';
@@ -100,6 +101,7 @@ export {
100
101
  arrayWithDetail,
101
102
  arrayWithDetailAndRule,
102
103
  arrayWithCustomChildLabel,
104
+ arrayWithSorting,
103
105
  categorization,
104
106
  stepper,
105
107
  steppershownav,