@jsonforms/examples 3.9.0-alpha.1 → 3.9.0-alpha.3

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.
@@ -0,0 +1,101 @@
1
+ export declare const schema: {
2
+ type: string;
3
+ properties: {
4
+ price: {
5
+ type: string;
6
+ };
7
+ weight: {
8
+ type: string;
9
+ };
10
+ quantity: {
11
+ type: string;
12
+ };
13
+ website: {
14
+ type: string;
15
+ };
16
+ username: {
17
+ type: string;
18
+ };
19
+ voltage: {
20
+ type: string;
21
+ enum: string[];
22
+ };
23
+ frequency: {
24
+ type: string;
25
+ oneOf: {
26
+ const: string;
27
+ title: string;
28
+ }[];
29
+ };
30
+ };
31
+ };
32
+ export declare const uischema: {
33
+ type: string;
34
+ elements: ({
35
+ type: string;
36
+ elements: ({
37
+ type: string;
38
+ scope: string;
39
+ options: {
40
+ startAdornment: string;
41
+ endAdornment?: undefined;
42
+ };
43
+ } | {
44
+ type: string;
45
+ scope: string;
46
+ options: {
47
+ endAdornment: string;
48
+ startAdornment?: undefined;
49
+ };
50
+ })[];
51
+ } | {
52
+ type: string;
53
+ elements: ({
54
+ type: string;
55
+ scope: string;
56
+ options: {
57
+ startAdornment: string;
58
+ endAdornment?: undefined;
59
+ };
60
+ } | {
61
+ type: string;
62
+ scope: string;
63
+ options: {
64
+ startAdornment: string;
65
+ endAdornment: string;
66
+ };
67
+ })[];
68
+ } | {
69
+ type: string;
70
+ elements: ({
71
+ type: string;
72
+ scope: string;
73
+ label: string;
74
+ options: {
75
+ endAdornment: string;
76
+ autocomplete?: undefined;
77
+ };
78
+ } | {
79
+ type: string;
80
+ scope: string;
81
+ label: string;
82
+ options: {
83
+ autocomplete: boolean;
84
+ endAdornment: string;
85
+ };
86
+ } | {
87
+ type: string;
88
+ scope: string;
89
+ options: {
90
+ autocomplete: boolean;
91
+ endAdornment: string;
92
+ };
93
+ label?: undefined;
94
+ })[];
95
+ })[];
96
+ };
97
+ export declare const data: {
98
+ weight: number;
99
+ username: string;
100
+ voltage: string;
101
+ };
@@ -19,16 +19,33 @@ export declare const schema: {
19
19
  enum: string[];
20
20
  };
21
21
  };
22
+ multiSelect: {
23
+ type: string;
24
+ title: string;
25
+ uniqueItems: boolean;
26
+ items: {
27
+ type: string;
28
+ enum: string[];
29
+ };
30
+ };
22
31
  };
23
32
  };
24
33
  export declare const uischema: {
25
34
  type: string;
26
- elements: {
35
+ elements: ({
27
36
  type: string;
28
37
  scope: string;
29
- }[];
38
+ options?: undefined;
39
+ } | {
40
+ type: string;
41
+ scope: string;
42
+ options: {
43
+ format: string;
44
+ };
45
+ })[];
30
46
  };
31
47
  export declare const data: {
32
48
  oneOfMultiEnum: string[];
33
49
  multiEnum: string[];
50
+ multiSelect: string[];
34
51
  };
package/lib/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import * as issue_1884 from './examples/1884';
2
2
  import * as issue_1948 from './examples/1948';
3
3
  import * as additionalErrors from './examples/additional-errors';
4
4
  import * as additionalProperties from './examples/additional-properties';
5
+ import * as adornments from './examples/adornments';
5
6
  import * as allOf from './examples/allOf';
6
7
  import * as anyOf from './examples/anyOf';
7
8
  import * as anyOfOneOfAllOfResolve from './examples/anyOf-oneOf-allOf-resolve';
@@ -63,4 +64,4 @@ export * from './register';
63
64
  import * as ifThenElse from './examples/if_then_else';
64
65
  import * as jsoneditor from './examples/json-editor';
65
66
  import * as jsonschema from './examples/jsonschema';
66
- export { additionalErrors, additionalProperties, allOf, anyOf, anyOfOneOfAllOfResolve, array, arrayI18n, arrayWithCustomChildLabel, arrayWithDefaults, arrayWithDetail, arrayWithDetailAndRule, arrayWithSorting, arrayWithTranslatedCustomChildLabel, categorization, conditionalSchemaComposition, config, controlOptions, dates, defaultExample, enumExample, enumI18n, enumInArray, generateDynamic, generateSchema, generateUISchema, huge, i18n, ifThenElse, issue_1884, issue_1948, jsoneditor, jsonschema, layout, listWithDetail, listWithDetailPrimitives, listWithDetailRegistered, login, mixed, mixedObject, multiEnum, multiEnumWithLabelAndDesc, nestedArray, nestedCategorization, numbers, object, onChange, oneOf, oneOfArray, oneOfRecursive, person, prependAppendSlots, radioGroupExample, readonly, rule, ruleInheritance, scope, specialPropertyNames, stepper, steppershownav, string, stringArray, text, validationNestedSameName, };
67
+ export { additionalErrors, additionalProperties, adornments, allOf, anyOf, anyOfOneOfAllOfResolve, array, arrayI18n, arrayWithCustomChildLabel, arrayWithDefaults, arrayWithDetail, arrayWithDetailAndRule, arrayWithSorting, arrayWithTranslatedCustomChildLabel, categorization, conditionalSchemaComposition, config, controlOptions, dates, defaultExample, enumExample, enumI18n, enumInArray, generateDynamic, generateSchema, generateUISchema, huge, i18n, ifThenElse, issue_1884, issue_1948, jsoneditor, jsonschema, layout, listWithDetail, listWithDetailPrimitives, listWithDetailRegistered, login, mixed, mixedObject, multiEnum, multiEnumWithLabelAndDesc, nestedArray, nestedCategorization, numbers, object, onChange, oneOf, oneOfArray, oneOfRecursive, person, prependAppendSlots, radioGroupExample, readonly, rule, ruleInheritance, scope, specialPropertyNames, stepper, steppershownav, string, stringArray, text, validationNestedSameName, };
@@ -4,11 +4,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var core = require('@jsonforms/core');
6
6
  var get = require('lodash/get');
7
+ var cloneDeep = require('lodash/cloneDeep');
7
8
  var localize = require('ajv-i18n/localize');
8
9
 
9
10
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
11
 
11
12
  var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
13
+ var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);
12
14
  var localize__default = /*#__PURE__*/_interopDefaultLegacy(localize);
13
15
 
14
16
  var knownExamples = {};
@@ -21,7 +23,7 @@ var getExamples = function () {
21
23
  return examples;
22
24
  };
23
25
 
24
- var schema$W = {
26
+ var schema$X = {
25
27
  type: 'object',
26
28
  required: ['age'],
27
29
  properties: {
@@ -76,7 +78,7 @@ var schema$W = {
76
78
  },
77
79
  },
78
80
  };
79
- var uischema$W = {
81
+ var uischema$X = {
80
82
  type: 'VerticalLayout',
81
83
  elements: [
82
84
  {
@@ -169,7 +171,7 @@ var uischema$W = {
169
171
  },
170
172
  ],
171
173
  };
172
- var data$Y = {
174
+ var data$Z = {
173
175
  firstName: 'Max',
174
176
  lastName: 'Power',
175
177
  committer: false,
@@ -178,20 +180,20 @@ registerExamples([
178
180
  {
179
181
  name: '1884',
180
182
  label: 'Issue 1884 - Nested enable/disable',
181
- data: data$Y,
182
- schema: schema$W,
183
- uischema: uischema$W,
183
+ data: data$Z,
184
+ schema: schema$X,
185
+ uischema: uischema$X,
184
186
  },
185
187
  ]);
186
188
 
187
189
  var _1884 = /*#__PURE__*/Object.freeze({
188
190
  __proto__: null,
189
- schema: schema$W,
190
- uischema: uischema$W,
191
- data: data$Y
191
+ schema: schema$X,
192
+ uischema: uischema$X,
193
+ data: data$Z
192
194
  });
193
195
 
194
- var schema$V = {
196
+ var schema$W = {
195
197
  type: 'object',
196
198
  definitions: {
197
199
  import: {
@@ -222,8 +224,8 @@ var schema$V = {
222
224
  },
223
225
  },
224
226
  };
225
- var uischema$V = undefined;
226
- var data$X = {
227
+ var uischema$W = undefined;
228
+ var data$Y = {
227
229
  import: [
228
230
  {
229
231
  document: 'Document1',
@@ -236,24 +238,24 @@ registerExamples([
236
238
  {
237
239
  name: '1948_with',
238
240
  label: 'Issue 1948 - Array renderer selection (with schema)',
239
- data: data$X,
240
- schema: schema$V,
241
- uischema: uischema$V,
241
+ data: data$Y,
242
+ schema: schema$W,
243
+ uischema: uischema$W,
242
244
  },
243
245
  {
244
246
  name: '1948_without',
245
247
  label: 'Issue 1948 - Array renderer selection (w/o schema)',
246
- data: data$X,
248
+ data: data$Y,
247
249
  schema: undefined,
248
- uischema: uischema$V,
250
+ uischema: uischema$W,
249
251
  },
250
252
  ]);
251
253
 
252
254
  var _1948 = /*#__PURE__*/Object.freeze({
253
255
  __proto__: null,
254
- schema: schema$V,
255
- uischema: uischema$V,
256
- data: data$X
256
+ schema: schema$W,
257
+ uischema: uischema$W,
258
+ data: data$Y
257
259
  });
258
260
 
259
261
  /******************************************************************************
@@ -319,7 +321,7 @@ var personCoreSchema = {
319
321
  },
320
322
  },
321
323
  };
322
- var schema$U = {
324
+ var schema$V = {
323
325
  type: 'object',
324
326
  properties: __assign(__assign({}, personCoreSchema.properties), { personalData: {
325
327
  type: 'object',
@@ -352,7 +354,7 @@ var schema$U = {
352
354
  } }),
353
355
  required: ['occupation', 'nationality'],
354
356
  };
355
- var uischema$U = {
357
+ var uischema$V = {
356
358
  type: 'VerticalLayout',
357
359
  elements: [
358
360
  {
@@ -407,7 +409,7 @@ var uischema$U = {
407
409
  },
408
410
  ],
409
411
  };
410
- var data$W = {
412
+ var data$X = {
411
413
  name: 'John Doe',
412
414
  vegetarian: false,
413
415
  birthDate: '1985-06-02',
@@ -420,18 +422,18 @@ registerExamples([
420
422
  {
421
423
  name: 'person',
422
424
  label: 'Person',
423
- data: data$W,
424
- schema: schema$U,
425
- uischema: uischema$U,
425
+ data: data$X,
426
+ schema: schema$V,
427
+ uischema: uischema$V,
426
428
  },
427
429
  ]);
428
430
 
429
431
  var person = /*#__PURE__*/Object.freeze({
430
432
  __proto__: null,
431
433
  personCoreSchema: personCoreSchema,
432
- schema: schema$U,
433
- uischema: uischema$U,
434
- data: data$W
434
+ schema: schema$V,
435
+ uischema: uischema$V,
436
+ data: data$X
435
437
  });
436
438
 
437
439
  var additionalErrors = [];
@@ -454,9 +456,9 @@ registerExamples([
454
456
  {
455
457
  name: 'additional-errors',
456
458
  label: 'Additional errors',
457
- data: data$W,
458
- schema: schema$U,
459
- uischema: uischema$U,
459
+ data: data$X,
460
+ schema: schema$V,
461
+ uischema: uischema$V,
460
462
  actions: actions$7,
461
463
  },
462
464
  ]);
@@ -467,7 +469,7 @@ var additionalErrors$1 = /*#__PURE__*/Object.freeze({
467
469
  actions: actions$7
468
470
  });
469
471
 
470
- var schema$T = {
472
+ var schema$U = {
471
473
  $schema: 'http://json-schema.org/draft-07/schema#',
472
474
  type: 'object',
473
475
  properties: {
@@ -541,11 +543,11 @@ var schema$T = {
541
543
  },
542
544
  maxProperties: 15,
543
545
  };
544
- var uischema$T = {
546
+ var uischema$U = {
545
547
  type: 'Control',
546
548
  scope: '#/',
547
549
  };
548
- var data$V = {
550
+ var data$W = {
549
551
  propertiesString: 'data',
550
552
  string: 'string value',
551
553
  number: 10.2,
@@ -564,16 +566,131 @@ registerExamples([
564
566
  {
565
567
  name: 'additional-properties',
566
568
  label: 'Additional Properties',
569
+ data: data$W,
570
+ schema: schema$U,
571
+ uischema: uischema$U,
572
+ },
573
+ ]);
574
+
575
+ var additionalProperties = /*#__PURE__*/Object.freeze({
576
+ __proto__: null,
577
+ schema: schema$U,
578
+ uischema: uischema$U
579
+ });
580
+
581
+ var schema$T = {
582
+ type: 'object',
583
+ properties: {
584
+ price: {
585
+ type: 'number',
586
+ },
587
+ weight: {
588
+ type: 'number',
589
+ },
590
+ quantity: {
591
+ type: 'integer',
592
+ },
593
+ website: {
594
+ type: 'string',
595
+ },
596
+ username: {
597
+ type: 'string',
598
+ },
599
+ voltage: {
600
+ type: 'string',
601
+ enum: ['110', '230', '400'],
602
+ },
603
+ frequency: {
604
+ type: 'string',
605
+ oneOf: [
606
+ { const: '50', title: '50' },
607
+ { const: '60', title: '60' },
608
+ ],
609
+ },
610
+ },
611
+ };
612
+ var uischema$T = {
613
+ type: 'VerticalLayout',
614
+ elements: [
615
+ {
616
+ type: 'HorizontalLayout',
617
+ elements: [
618
+ {
619
+ type: 'Control',
620
+ scope: '#/properties/price',
621
+ options: { startAdornment: '€' },
622
+ },
623
+ {
624
+ type: 'Control',
625
+ scope: '#/properties/weight',
626
+ options: { endAdornment: 'kg' },
627
+ },
628
+ {
629
+ type: 'Control',
630
+ scope: '#/properties/quantity',
631
+ options: { endAdornment: 'pcs' },
632
+ },
633
+ ],
634
+ },
635
+ {
636
+ type: 'HorizontalLayout',
637
+ elements: [
638
+ {
639
+ type: 'Control',
640
+ scope: '#/properties/website',
641
+ options: { startAdornment: 'https://' },
642
+ },
643
+ {
644
+ type: 'Control',
645
+ scope: '#/properties/username',
646
+ options: { startAdornment: '@', endAdornment: '.example.com' },
647
+ },
648
+ ],
649
+ },
650
+ {
651
+ type: 'HorizontalLayout',
652
+ elements: [
653
+ {
654
+ type: 'Control',
655
+ scope: '#/properties/voltage',
656
+ label: 'Voltage (autocomplete)',
657
+ options: { endAdornment: 'V' },
658
+ },
659
+ {
660
+ type: 'Control',
661
+ scope: '#/properties/voltage',
662
+ label: 'Voltage (select)',
663
+ options: { autocomplete: false, endAdornment: 'V' },
664
+ },
665
+ {
666
+ type: 'Control',
667
+ scope: '#/properties/frequency',
668
+ options: { autocomplete: false, endAdornment: 'Hz' },
669
+ },
670
+ ],
671
+ },
672
+ ],
673
+ };
674
+ var data$V = {
675
+ weight: 12.5,
676
+ username: 'jane',
677
+ voltage: '230',
678
+ };
679
+ registerExamples([
680
+ {
681
+ name: 'adornments',
682
+ label: 'Adornments',
567
683
  data: data$V,
568
684
  schema: schema$T,
569
685
  uischema: uischema$T,
570
686
  },
571
687
  ]);
572
688
 
573
- var additionalProperties = /*#__PURE__*/Object.freeze({
689
+ var adornments = /*#__PURE__*/Object.freeze({
574
690
  __proto__: null,
575
691
  schema: schema$T,
576
- uischema: uischema$T
692
+ uischema: uischema$T,
693
+ data: data$V
577
694
  });
578
695
 
579
696
  var schema$S = {
@@ -2016,6 +2133,62 @@ var uischema_1713 = {
2016
2133
  },
2017
2134
  ],
2018
2135
  };
2136
+ var schema_2343 = {
2137
+ type: 'object',
2138
+ properties: {
2139
+ parc: {
2140
+ type: 'array',
2141
+ items: {
2142
+ type: 'object',
2143
+ properties: {
2144
+ id: {
2145
+ type: 'string',
2146
+ },
2147
+ },
2148
+ },
2149
+ },
2150
+ },
2151
+ };
2152
+ var arrayControl_2343 = {
2153
+ type: 'Control',
2154
+ scope: '#/properties/parc',
2155
+ options: {
2156
+ detail: {
2157
+ type: 'VerticalLayout',
2158
+ elements: [
2159
+ {
2160
+ type: 'HorizontalLayout',
2161
+ elements: [
2162
+ {
2163
+ type: 'Control',
2164
+ scope: '#/properties/id',
2165
+ },
2166
+ ],
2167
+ },
2168
+ ],
2169
+ },
2170
+ },
2171
+ };
2172
+ var uischema_2343 = {
2173
+ type: 'VerticalLayout',
2174
+ elements: [
2175
+ {
2176
+ type: 'Categorization',
2177
+ elements: [
2178
+ {
2179
+ type: 'Category',
2180
+ label: 'A1',
2181
+ elements: [cloneDeep__default["default"](arrayControl_2343)],
2182
+ },
2183
+ {
2184
+ type: 'Category',
2185
+ label: 'A2',
2186
+ elements: [cloneDeep__default["default"](arrayControl_2343)],
2187
+ },
2188
+ ],
2189
+ },
2190
+ ],
2191
+ };
2019
2192
  var translations$2 = {
2020
2193
  categoryLabelKey: 'Basic',
2021
2194
  address: {
@@ -2042,6 +2215,13 @@ registerExamples([
2042
2215
  schema: schema_1713,
2043
2216
  uischema: uischema_1713,
2044
2217
  },
2218
+ {
2219
+ name: 'categorization_2343',
2220
+ label: 'Categorization - Issue 2343',
2221
+ data: {},
2222
+ schema: schema_2343,
2223
+ uischema: uischema_2343,
2224
+ },
2045
2225
  ]);
2046
2226
 
2047
2227
  var categorization = /*#__PURE__*/Object.freeze({
@@ -2870,6 +3050,15 @@ var schema$y = {
2870
3050
  enum: ['foo', 'bar', 'foobar'],
2871
3051
  },
2872
3052
  },
3053
+ multiSelect: {
3054
+ type: 'array',
3055
+ title: 'Select Fruits',
3056
+ uniqueItems: true,
3057
+ items: {
3058
+ type: 'string',
3059
+ enum: ['Apple', 'Banana', 'Cherry', 'Date', 'Elderberry'],
3060
+ },
3061
+ },
2873
3062
  },
2874
3063
  };
2875
3064
  var uischema$y = {
@@ -2883,9 +3072,20 @@ var uischema$y = {
2883
3072
  type: 'Control',
2884
3073
  scope: '#/properties/multiEnum',
2885
3074
  },
3075
+ {
3076
+ type: 'Control',
3077
+ scope: '#/properties/multiSelect',
3078
+ options: {
3079
+ format: 'multiselect',
3080
+ },
3081
+ },
2886
3082
  ],
2887
3083
  };
2888
- var data$A = { oneOfMultiEnum: ['foo'], multiEnum: ['bar'] };
3084
+ var data$A = {
3085
+ oneOfMultiEnum: ['foo'],
3086
+ multiEnum: ['bar'],
3087
+ multiSelect: ['Banana', 'Cherry'],
3088
+ };
2889
3089
  registerExamples([
2890
3090
  {
2891
3091
  name: 'multi-enum',
@@ -3126,7 +3326,7 @@ var enumInArray = /*#__PURE__*/Object.freeze({
3126
3326
 
3127
3327
  var schema$u = undefined;
3128
3328
  var uischema$u = undefined;
3129
- var data$w = data$W;
3329
+ var data$w = data$X;
3130
3330
  registerExamples([
3131
3331
  {
3132
3332
  name: 'generate',
@@ -3170,7 +3370,7 @@ var generateDynamic = /*#__PURE__*/Object.freeze({
3170
3370
 
3171
3371
  var schema$t = personCoreSchema;
3172
3372
  var uischema$t = undefined;
3173
- var data$v = data$W;
3373
+ var data$v = data$X;
3174
3374
  registerExamples([
3175
3375
  {
3176
3376
  name: 'generate-ui',
@@ -4638,7 +4838,7 @@ var i18n = /*#__PURE__*/Object.freeze({
4638
4838
  translate: translate
4639
4839
  });
4640
4840
 
4641
- var schema$r = schema$U;
4841
+ var schema$r = schema$V;
4642
4842
  var uischemaVertical = {
4643
4843
  type: 'VerticalLayout',
4644
4844
  elements: [
@@ -4726,7 +4926,7 @@ var uischemaComplex = {
4726
4926
  },
4727
4927
  ],
4728
4928
  };
4729
- var data$s = data$W;
4929
+ var data$s = data$X;
4730
4930
  registerExamples([
4731
4931
  {
4732
4932
  name: 'layout-vertical',
@@ -7728,6 +7928,7 @@ var jsonschema = /*#__PURE__*/Object.freeze({
7728
7928
 
7729
7929
  exports.additionalErrors = additionalErrors$1;
7730
7930
  exports.additionalProperties = additionalProperties;
7931
+ exports.adornments = adornments;
7731
7932
  exports.allOf = allOf;
7732
7933
  exports.anyOf = anyOf;
7733
7934
  exports.anyOfOneOfAllOfResolve = anyOfOneOfAllOfResolve;