@jsonforms/core 3.0.0-beta.0 → 3.0.0-beta.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.
- package/docs/assets/js/search.json +1 -1
- package/docs/globals.html +318 -209
- package/docs/index.html +13 -4
- package/docs/interfaces/addcellrendereraction.html +3 -3
- package/docs/interfaces/addrendereraction.html +3 -3
- package/docs/interfaces/adduischemaaction.html +3 -3
- package/docs/interfaces/arraycontrolprops.html +21 -21
- package/docs/interfaces/arraylayoutprops.html +21 -21
- package/docs/interfaces/cellprops.html +12 -12
- package/docs/interfaces/combinatorrendererprops.html +143 -36
- package/docs/interfaces/controlprops.html +16 -16
- package/docs/interfaces/controlstate.html +2 -2
- package/docs/interfaces/controlwithdetailprops.html +17 -17
- package/docs/interfaces/dispatchcellprops.html +10 -10
- package/docs/interfaces/dispatchcellstateprops.html +10 -10
- package/docs/interfaces/dispatchpropsofarraycontrol.html +4 -4
- package/docs/interfaces/dispatchpropsofcontrol.html +1 -1
- package/docs/interfaces/dispatchpropsofmultienumcontrol.html +2 -2
- package/docs/interfaces/enumcellprops.html +13 -13
- package/docs/interfaces/enumoption.html +2 -2
- package/docs/interfaces/initactionoptions.html +14 -0
- package/docs/interfaces/jsonformscore.html +17 -3
- package/docs/interfaces/jsonformsprops.html +9 -9
- package/docs/interfaces/layoutprops.html +10 -10
- package/docs/interfaces/ownpropsofcell.html +9 -9
- package/docs/interfaces/ownpropsofcontrol.html +9 -12
- package/docs/interfaces/ownpropsofenum.html +1 -1
- package/docs/interfaces/ownpropsofenumcell.html +10 -10
- package/docs/interfaces/ownpropsofjsonformsrenderer.html +8 -8
- package/docs/interfaces/ownpropsoflayout.html +9 -9
- package/docs/interfaces/ownpropsofmasterlistitem.html +6 -6
- package/docs/interfaces/ownpropsofrenderer.html +8 -8
- package/docs/interfaces/registerdefaultdataaction.html +3 -3
- package/docs/interfaces/removecellrendereraction.html +3 -3
- package/docs/interfaces/removerendereraction.html +3 -3
- package/docs/interfaces/removeuischemaaction.html +2 -2
- package/docs/interfaces/rendererprops.html +9 -9
- package/docs/interfaces/setajvaction.html +2 -2
- package/docs/interfaces/setconfigaction.html +2 -2
- package/docs/interfaces/setlocaleaction.html +2 -2
- package/docs/interfaces/setschemaaction.html +2 -2
- package/docs/interfaces/settranslatoraction.html +3 -3
- package/docs/interfaces/setuischemaaction.html +2 -2
- package/docs/interfaces/setvalidationmodeaction.html +2 -2
- package/docs/interfaces/statepropsofarraycontrol.html +17 -17
- package/docs/interfaces/statepropsofarraylayout.html +17 -17
- package/docs/interfaces/statepropsofcell.html +11 -11
- package/docs/interfaces/statepropsofcombinator.html +147 -40
- package/docs/interfaces/statepropsofcontrol.html +18 -15
- package/docs/interfaces/statepropsofcontrolwithdetail.html +16 -16
- package/docs/interfaces/statepropsofenumcell.html +12 -12
- package/docs/interfaces/statepropsofjsonformsrenderer.html +9 -9
- package/docs/interfaces/statepropsoflayout.html +10 -10
- package/docs/interfaces/statepropsofmasteritem.html +7 -7
- package/docs/interfaces/statepropsofrenderer.html +9 -9
- package/docs/interfaces/statepropsofscopedrenderer.html +12 -12
- package/docs/interfaces/unregisterdefaultdataaction.html +2 -2
- package/docs/interfaces/updatei18naction.html +4 -4
- package/docs/interfaces/withclassname.html +1 -1
- package/lib/actions/actions.d.ts +1 -0
- package/lib/jsonforms-core.cjs.js +191 -176
- package/lib/jsonforms-core.cjs.js.map +1 -1
- package/lib/jsonforms-core.esm.js +174 -164
- package/lib/jsonforms-core.esm.js.map +1 -1
- package/lib/reducers/core.d.ts +1 -0
- package/lib/reducers/reducers.d.ts +2 -2
- package/lib/testers/testers.d.ts +8 -7
- package/lib/util/combinators.d.ts +0 -1
- package/lib/util/path.d.ts +10 -0
- package/lib/util/renderer.d.ts +2 -2
- package/lib/util/resolvers.d.ts +1 -1
- package/lib/util/util.d.ts +1 -1
- package/package.json +2 -2
- package/src/actions/actions.ts +1 -0
- package/src/generators/uischema.ts +4 -4
- package/src/i18n/i18nUtil.ts +5 -5
- package/src/reducers/core.ts +30 -3
- package/src/reducers/reducers.ts +12 -4
- package/src/testers/testers.ts +60 -33
- package/src/util/combinators.ts +17 -32
- package/src/util/label.ts +2 -2
- package/src/util/path.ts +18 -6
- package/src/util/renderer.ts +20 -32
- package/src/util/resolvers.ts +57 -68
- package/src/util/util.ts +1 -1
- package/stats.html +1 -1
- package/test/generators/uischema.test.ts +18 -0
- package/test/reducers/core.test.ts +203 -1
- package/test/testers.test.ts +208 -120
- package/test/util/path.test.ts +37 -20
- package/test/util/resolvers.test.ts +99 -8
|
@@ -386,6 +386,16 @@ function __rest(s, e) {
|
|
|
386
386
|
t[p[i]] = s[p[i]];
|
|
387
387
|
}
|
|
388
388
|
return t;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
function __spreadArray(to, from, pack) {
|
|
392
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
393
|
+
if (ar || !(i in from)) {
|
|
394
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
395
|
+
ar[i] = from[i];
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
389
399
|
}
|
|
390
400
|
|
|
391
401
|
var cellReducer = function (state, _a) {
|
|
@@ -440,6 +450,7 @@ var initState = {
|
|
|
440
450
|
validator: undefined,
|
|
441
451
|
ajv: undefined,
|
|
442
452
|
validationMode: 'ValidateAndShow',
|
|
453
|
+
additionalErrors: []
|
|
443
454
|
};
|
|
444
455
|
var reuseAjvForSchema = function (ajv, schema) {
|
|
445
456
|
if (schema.hasOwnProperty('id') || schema.hasOwnProperty('$id')) {
|
|
@@ -483,6 +494,18 @@ var hasValidationModeOption = function (option) {
|
|
|
483
494
|
}
|
|
484
495
|
return false;
|
|
485
496
|
};
|
|
497
|
+
var hasAdditionalErrorsOption = function (option) {
|
|
498
|
+
if (option) {
|
|
499
|
+
return option.additionalErrors !== undefined;
|
|
500
|
+
}
|
|
501
|
+
return false;
|
|
502
|
+
};
|
|
503
|
+
var getAdditionalErrors = function (state, action) {
|
|
504
|
+
if (action && hasAdditionalErrorsOption(action.options)) {
|
|
505
|
+
return action.options.additionalErrors;
|
|
506
|
+
}
|
|
507
|
+
return state.additionalErrors;
|
|
508
|
+
};
|
|
486
509
|
var coreReducer = function (state, action) {
|
|
487
510
|
if (state === void 0) { state = initState; }
|
|
488
511
|
switch (action.type) {
|
|
@@ -491,7 +514,8 @@ var coreReducer = function (state, action) {
|
|
|
491
514
|
var validationMode = getValidationMode(state, action);
|
|
492
515
|
var v = validationMode === 'NoValidation' ? undefined : thisAjv.compile(action.schema);
|
|
493
516
|
var e = validate(v, action.data);
|
|
494
|
-
|
|
517
|
+
var additionalErrors = getAdditionalErrors(state, action);
|
|
518
|
+
return __assign(__assign({}, state), { data: action.data, schema: action.schema, uischema: action.uischema, additionalErrors: additionalErrors, errors: e, validator: v, ajv: thisAjv, validationMode: validationMode });
|
|
495
519
|
}
|
|
496
520
|
case UPDATE_CORE: {
|
|
497
521
|
var thisAjv = getOrCreateAjv(state, action);
|
|
@@ -510,15 +534,17 @@ var coreReducer = function (state, action) {
|
|
|
510
534
|
else if (state.data !== action.data) {
|
|
511
535
|
errors = validate(validator, action.data);
|
|
512
536
|
}
|
|
537
|
+
var additionalErrors = getAdditionalErrors(state, action);
|
|
513
538
|
var stateChanged = state.data !== action.data ||
|
|
514
539
|
state.schema !== action.schema ||
|
|
515
540
|
state.uischema !== action.uischema ||
|
|
516
541
|
state.ajv !== thisAjv ||
|
|
517
542
|
state.errors !== errors ||
|
|
518
543
|
state.validator !== validator ||
|
|
519
|
-
state.validationMode !== validationMode
|
|
544
|
+
state.validationMode !== validationMode ||
|
|
545
|
+
state.additionalErrors !== additionalErrors;
|
|
520
546
|
return stateChanged
|
|
521
|
-
? __assign(__assign({}, state), { data: action.data, schema: action.schema, uischema: action.uischema, ajv: thisAjv, errors: isEqual__default["default"](errors, state.errors) ? state.errors : errors, validator: validator, validationMode: validationMode }) : state;
|
|
547
|
+
? __assign(__assign({}, state), { data: action.data, schema: action.schema, uischema: action.uischema, ajv: thisAjv, errors: isEqual__default["default"](errors, state.errors) ? state.errors : errors, validator: validator, validationMode: validationMode, additionalErrors: additionalErrors }) : state;
|
|
522
548
|
}
|
|
523
549
|
case SET_AJV: {
|
|
524
550
|
var currentAjv = action.ajv;
|
|
@@ -628,7 +654,10 @@ var isObjectSchema$1 = function (schema) {
|
|
|
628
654
|
};
|
|
629
655
|
var filteredErrorKeywords = ['additionalProperties', 'allOf', 'anyOf', 'oneOf'];
|
|
630
656
|
var getErrorsAt = function (instancePath, schema, matchPath) { return function (state) {
|
|
631
|
-
|
|
657
|
+
var _a, _b;
|
|
658
|
+
var errors = (_a = state.errors) !== null && _a !== void 0 ? _a : [];
|
|
659
|
+
var additionalErrors = (_b = state.additionalErrors) !== null && _b !== void 0 ? _b : [];
|
|
660
|
+
return errorsAt(instancePath, schema, matchPath)(state.validationMode === 'ValidateAndHide' ? additionalErrors : __spreadArray(__spreadArray([], errors), additionalErrors));
|
|
632
661
|
}; };
|
|
633
662
|
var errorAt = function (instancePath, schema) {
|
|
634
663
|
return getErrorsAt(instancePath, schema, function (path) { return path === instancePath; });
|
|
@@ -670,27 +699,27 @@ var defaultTranslator = function (_id, defaultMessage) { return defaultMessage;
|
|
|
670
699
|
var defaultErrorTranslator = function (error, t, uischema) {
|
|
671
700
|
var _a;
|
|
672
701
|
var i18nKey = getI18nKey(error.parentSchema, uischema, getControlPath(error), "error." + error.keyword);
|
|
673
|
-
var specializedKeywordMessage = t(i18nKey, undefined);
|
|
702
|
+
var specializedKeywordMessage = t(i18nKey, undefined, { error: error });
|
|
674
703
|
if (specializedKeywordMessage !== undefined) {
|
|
675
704
|
return specializedKeywordMessage;
|
|
676
705
|
}
|
|
677
|
-
var genericKeywordMessage = t("error." + error.keyword, undefined);
|
|
706
|
+
var genericKeywordMessage = t("error." + error.keyword, undefined, { error: error });
|
|
678
707
|
if (genericKeywordMessage !== undefined) {
|
|
679
708
|
return genericKeywordMessage;
|
|
680
709
|
}
|
|
681
|
-
var messageCustomization = t(error.message, undefined);
|
|
710
|
+
var messageCustomization = t(error.message, undefined, { error: error });
|
|
682
711
|
if (messageCustomization !== undefined) {
|
|
683
712
|
return messageCustomization;
|
|
684
713
|
}
|
|
685
714
|
if (error.keyword === 'required' && ((_a = error.message) === null || _a === void 0 ? void 0 : _a.startsWith('must have required property'))) {
|
|
686
|
-
return t('is a required property', 'is a required property');
|
|
715
|
+
return t('is a required property', 'is a required property', { error: error });
|
|
687
716
|
}
|
|
688
717
|
return error.message;
|
|
689
718
|
};
|
|
690
719
|
var getCombinedErrorMessage = function (errors, et, t, schema, uischema, path) {
|
|
691
720
|
if (errors.length > 0 && t) {
|
|
692
721
|
var customErrorKey = getI18nKey(schema, uischema, path, 'error.custom');
|
|
693
|
-
var specializedErrorMessage = t(customErrorKey, undefined);
|
|
722
|
+
var specializedErrorMessage = t(customErrorKey, undefined, { schema: schema, uischema: uischema, path: path, errors: errors });
|
|
694
723
|
if (specializedErrorMessage !== undefined) {
|
|
695
724
|
return specializedErrorMessage;
|
|
696
725
|
}
|
|
@@ -765,7 +794,7 @@ var NOT_APPLICABLE = -1;
|
|
|
765
794
|
var isControl = function (uischema) {
|
|
766
795
|
return !isEmpty__default["default"](uischema) && uischema.scope !== undefined;
|
|
767
796
|
};
|
|
768
|
-
var schemaMatches = function (predicate) { return function (uischema, schema) {
|
|
797
|
+
var schemaMatches = function (predicate) { return function (uischema, schema, rootSchema) {
|
|
769
798
|
if (isEmpty__default["default"](uischema) || !isControl(uischema)) {
|
|
770
799
|
return false;
|
|
771
800
|
}
|
|
@@ -778,27 +807,27 @@ var schemaMatches = function (predicate) { return function (uischema, schema) {
|
|
|
778
807
|
}
|
|
779
808
|
var currentDataSchema = schema;
|
|
780
809
|
if (hasType(schema, 'object')) {
|
|
781
|
-
currentDataSchema = resolveSchema(schema, schemaPath);
|
|
810
|
+
currentDataSchema = resolveSchema(schema, schemaPath, rootSchema);
|
|
782
811
|
}
|
|
783
812
|
if (currentDataSchema === undefined) {
|
|
784
813
|
return false;
|
|
785
814
|
}
|
|
786
|
-
return predicate(currentDataSchema);
|
|
815
|
+
return predicate(currentDataSchema, rootSchema);
|
|
787
816
|
}; };
|
|
788
|
-
var schemaSubPathMatches = function (subPath, predicate) { return function (uischema, schema) {
|
|
817
|
+
var schemaSubPathMatches = function (subPath, predicate) { return function (uischema, schema, rootSchema) {
|
|
789
818
|
if (isEmpty__default["default"](uischema) || !isControl(uischema)) {
|
|
790
819
|
return false;
|
|
791
820
|
}
|
|
792
821
|
var schemaPath = uischema.scope;
|
|
793
822
|
var currentDataSchema = schema;
|
|
794
823
|
if (hasType(schema, 'object')) {
|
|
795
|
-
currentDataSchema = resolveSchema(schema, schemaPath);
|
|
824
|
+
currentDataSchema = resolveSchema(schema, schemaPath, rootSchema);
|
|
796
825
|
}
|
|
797
826
|
currentDataSchema = get__default["default"](currentDataSchema, subPath);
|
|
798
827
|
if (currentDataSchema === undefined) {
|
|
799
828
|
return false;
|
|
800
829
|
}
|
|
801
|
-
return predicate(currentDataSchema);
|
|
830
|
+
return predicate(currentDataSchema, rootSchema);
|
|
802
831
|
}; };
|
|
803
832
|
var schemaTypeIs = function (expectedType) {
|
|
804
833
|
return schemaMatches(function (schema) { return !isEmpty__default["default"](schema) && hasType(schema, expectedType); });
|
|
@@ -836,23 +865,23 @@ var and = function () {
|
|
|
836
865
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
837
866
|
testers[_i] = arguments[_i];
|
|
838
867
|
}
|
|
839
|
-
return function (uischema, schema) { return testers.reduce(function (acc, tester) { return acc && tester(uischema, schema); }, true); };
|
|
868
|
+
return function (uischema, schema, rootSchema) { return testers.reduce(function (acc, tester) { return acc && tester(uischema, schema, rootSchema); }, true); };
|
|
840
869
|
};
|
|
841
870
|
var or = function () {
|
|
842
871
|
var testers = [];
|
|
843
872
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
844
873
|
testers[_i] = arguments[_i];
|
|
845
874
|
}
|
|
846
|
-
return function (uischema, schema) { return testers.reduce(function (acc, tester) { return acc || tester(uischema, schema); }, false); };
|
|
875
|
+
return function (uischema, schema, rootSchema) { return testers.reduce(function (acc, tester) { return acc || tester(uischema, schema, rootSchema); }, false); };
|
|
847
876
|
};
|
|
848
|
-
var rankWith = function (rank, tester) { return function (uischema, schema) {
|
|
849
|
-
if (tester(uischema, schema)) {
|
|
877
|
+
var rankWith = function (rank, tester) { return function (uischema, schema, rootSchema) {
|
|
878
|
+
if (tester(uischema, schema, rootSchema)) {
|
|
850
879
|
return rank;
|
|
851
880
|
}
|
|
852
881
|
return NOT_APPLICABLE;
|
|
853
882
|
}; };
|
|
854
|
-
var withIncreasedRank = function (by, rankedTester) { return function (uischema, schema) {
|
|
855
|
-
var rank = rankedTester(uischema, schema);
|
|
883
|
+
var withIncreasedRank = function (by, rankedTester) { return function (uischema, schema, rootSchema) {
|
|
884
|
+
var rank = rankedTester(uischema, schema, rootSchema);
|
|
856
885
|
if (rank === NOT_APPLICABLE) {
|
|
857
886
|
return NOT_APPLICABLE;
|
|
858
887
|
}
|
|
@@ -875,33 +904,42 @@ var isMultiLineControl = and(uiTypeIs('Control'), optionIs('multi', true));
|
|
|
875
904
|
var isDateControl = and(uiTypeIs('Control'), or(formatIs('date'), optionIs('format', 'date')));
|
|
876
905
|
var isTimeControl = and(uiTypeIs('Control'), or(formatIs('time'), optionIs('format', 'time')));
|
|
877
906
|
var isDateTimeControl = and(uiTypeIs('Control'), or(formatIs('date-time'), optionIs('format', 'date-time')));
|
|
878
|
-
var isObjectArray = and(schemaMatches(function (schema) { return hasType(schema, 'array') && !Array.isArray(schema
|
|
879
|
-
), schemaSubPathMatches('items', function (schema
|
|
907
|
+
var isObjectArray = and(schemaMatches(function (schema, rootSchema) { return hasType(schema, 'array') && !Array.isArray(resolveSchema(schema, 'items', rootSchema)); }
|
|
908
|
+
), schemaSubPathMatches('items', function (schema, rootSchema) {
|
|
909
|
+
var resolvedSchema = schema.$ref ? resolveSchema(rootSchema, schema.$ref, rootSchema) : schema;
|
|
910
|
+
return hasType(resolvedSchema, 'object');
|
|
911
|
+
}));
|
|
880
912
|
var isObjectArrayControl = and(uiTypeIs('Control'), isObjectArray);
|
|
881
|
-
var traverse = function (any, pred) {
|
|
913
|
+
var traverse = function (any, pred, rootSchema) {
|
|
882
914
|
if (isArray__default["default"](any)) {
|
|
883
|
-
return reduce__default["default"](any, function (acc, el) { return acc || traverse(el, pred); }, false);
|
|
915
|
+
return reduce__default["default"](any, function (acc, el) { return acc || traverse(el, pred, rootSchema); }, false);
|
|
884
916
|
}
|
|
885
917
|
if (pred(any)) {
|
|
886
918
|
return true;
|
|
887
919
|
}
|
|
920
|
+
if (any.$ref) {
|
|
921
|
+
var toTraverse = resolveSchema(rootSchema, any.$ref, rootSchema);
|
|
922
|
+
if (toTraverse && !toTraverse.$ref) {
|
|
923
|
+
return traverse(toTraverse, pred, rootSchema);
|
|
924
|
+
}
|
|
925
|
+
}
|
|
888
926
|
if (any.items) {
|
|
889
|
-
return traverse(any.items, pred);
|
|
927
|
+
return traverse(any.items, pred, rootSchema);
|
|
890
928
|
}
|
|
891
929
|
if (any.properties) {
|
|
892
930
|
return reduce__default["default"](toPairs__default["default"](any.properties), function (acc, _a) {
|
|
893
931
|
_a[0]; var val = _a[1];
|
|
894
|
-
return acc || traverse(val, pred);
|
|
932
|
+
return acc || traverse(val, pred, rootSchema);
|
|
895
933
|
}, false);
|
|
896
934
|
}
|
|
897
935
|
return false;
|
|
898
936
|
};
|
|
899
|
-
var isObjectArrayWithNesting = function (uischema, schema) {
|
|
900
|
-
if (!uiTypeIs('Control')(uischema, schema)) {
|
|
937
|
+
var isObjectArrayWithNesting = function (uischema, schema, rootSchema) {
|
|
938
|
+
if (!uiTypeIs('Control')(uischema, schema, rootSchema)) {
|
|
901
939
|
return false;
|
|
902
940
|
}
|
|
903
941
|
var schemaPath = uischema.scope;
|
|
904
|
-
var resolvedSchema = resolveSchema(schema, schemaPath);
|
|
942
|
+
var resolvedSchema = resolveSchema(schema, schemaPath, rootSchema !== null && rootSchema !== void 0 ? rootSchema : schema);
|
|
905
943
|
var wantedNestingByType = {
|
|
906
944
|
object: 2,
|
|
907
945
|
array: 1
|
|
@@ -911,6 +949,9 @@ var isObjectArrayWithNesting = function (uischema, schema) {
|
|
|
911
949
|
if (val === schema) {
|
|
912
950
|
return false;
|
|
913
951
|
}
|
|
952
|
+
if (val.$ref !== undefined) {
|
|
953
|
+
return false;
|
|
954
|
+
}
|
|
914
955
|
if (typeof val.type !== 'string') {
|
|
915
956
|
return true;
|
|
916
957
|
}
|
|
@@ -920,7 +961,7 @@ var isObjectArrayWithNesting = function (uischema, schema) {
|
|
|
920
961
|
}
|
|
921
962
|
wantedNestingByType[val.type] = typeCount - 1;
|
|
922
963
|
return wantedNestingByType[val.type] === 0;
|
|
923
|
-
})) {
|
|
964
|
+
}, rootSchema)) {
|
|
924
965
|
return true;
|
|
925
966
|
}
|
|
926
967
|
if (uischema.options && uischema.options.detail) {
|
|
@@ -936,9 +977,13 @@ var isObjectArrayWithNesting = function (uischema, schema) {
|
|
|
936
977
|
return false;
|
|
937
978
|
};
|
|
938
979
|
var isArrayObjectControl = isObjectArrayControl;
|
|
939
|
-
var isPrimitiveArrayControl = and(uiTypeIs('Control'), schemaMatches(function (schema) {
|
|
940
|
-
|
|
941
|
-
|
|
980
|
+
var isPrimitiveArrayControl = and(uiTypeIs('Control'), schemaMatches(function (schema, rootSchema) {
|
|
981
|
+
return deriveTypes(schema).length !== 0 &&
|
|
982
|
+
!Array.isArray(resolveSchema(schema, 'items', rootSchema));
|
|
983
|
+
}
|
|
984
|
+
), schemaSubPathMatches('items', function (schema, rootSchema) {
|
|
985
|
+
var resolvedSchema = schema.$ref ? resolveSchema(rootSchema, schema.$ref, rootSchema) : schema;
|
|
986
|
+
var types = deriveTypes(resolvedSchema);
|
|
942
987
|
return (types.length === 1 &&
|
|
943
988
|
includes__default["default"](['integer', 'number', 'boolean', 'string'], types[0]));
|
|
944
989
|
}));
|
|
@@ -965,7 +1010,7 @@ var hasCategory = function (categorization) {
|
|
|
965
1010
|
var categorizationHasCategory = function (uischema) {
|
|
966
1011
|
return hasCategory(uischema);
|
|
967
1012
|
};
|
|
968
|
-
var not = function (tester) { return function (uischema, schema) { return !tester(uischema, schema); }; };
|
|
1013
|
+
var not = function (tester) { return function (uischema, schema, rootSchema) { return !tester(uischema, schema, rootSchema); }; };
|
|
969
1014
|
|
|
970
1015
|
var index$1 = /*#__PURE__*/Object.freeze({
|
|
971
1016
|
__proto__: null,
|
|
@@ -1046,12 +1091,15 @@ var jsonFormsReducerConfig = {
|
|
|
1046
1091
|
defaultData: defaultDataReducer,
|
|
1047
1092
|
i18n: i18nReducer,
|
|
1048
1093
|
};
|
|
1049
|
-
var findUISchema = function (uischemas, schema, schemaPath, path,
|
|
1050
|
-
if (
|
|
1094
|
+
var findUISchema = function (uischemas, schema, schemaPath, path, fallback, control, rootSchema) {
|
|
1095
|
+
if (fallback === void 0) { fallback = 'VerticalLayout'; }
|
|
1051
1096
|
if (control && control.options && control.options.detail) {
|
|
1052
1097
|
if (typeof control.options.detail === 'string') {
|
|
1053
1098
|
if (control.options.detail.toUpperCase() === 'GENERATE') {
|
|
1054
|
-
|
|
1099
|
+
if (typeof fallback === "function") {
|
|
1100
|
+
return fallback();
|
|
1101
|
+
}
|
|
1102
|
+
return Generate.uiSchema(schema, fallback);
|
|
1055
1103
|
}
|
|
1056
1104
|
}
|
|
1057
1105
|
else if (typeof control.options.detail === 'object') {
|
|
@@ -1063,7 +1111,10 @@ var findUISchema = function (uischemas, schema, schemaPath, path, fallbackLayout
|
|
|
1063
1111
|
}
|
|
1064
1112
|
var uiSchema = findMatchingUISchema(uischemas)(schema, schemaPath, path);
|
|
1065
1113
|
if (uiSchema === undefined) {
|
|
1066
|
-
|
|
1114
|
+
if (typeof fallback === 'function') {
|
|
1115
|
+
return fallback();
|
|
1116
|
+
}
|
|
1117
|
+
return Generate.uiSchema(schema, fallback, '#', rootSchema);
|
|
1067
1118
|
}
|
|
1068
1119
|
return uiSchema;
|
|
1069
1120
|
};
|
|
@@ -1095,6 +1146,44 @@ var getRenderers = function (state) { return get__default["default"](state, 'jso
|
|
|
1095
1146
|
var getCells = function (state) { return get__default["default"](state, 'jsonforms.cells'); };
|
|
1096
1147
|
var getUISchemas = function (state) { return get__default["default"](state, 'jsonforms.uischemas'); };
|
|
1097
1148
|
|
|
1149
|
+
var compose = function (path1, path2) {
|
|
1150
|
+
var p1 = path1;
|
|
1151
|
+
if (!isEmpty__default["default"](path1) && !isEmpty__default["default"](path2) && !path2.startsWith('[')) {
|
|
1152
|
+
p1 = path1 + '.';
|
|
1153
|
+
}
|
|
1154
|
+
if (isEmpty__default["default"](p1)) {
|
|
1155
|
+
return path2;
|
|
1156
|
+
}
|
|
1157
|
+
else if (isEmpty__default["default"](path2)) {
|
|
1158
|
+
return p1;
|
|
1159
|
+
}
|
|
1160
|
+
else {
|
|
1161
|
+
return "" + p1 + path2;
|
|
1162
|
+
}
|
|
1163
|
+
};
|
|
1164
|
+
var toDataPathSegments = function (schemaPath) {
|
|
1165
|
+
var s = schemaPath
|
|
1166
|
+
.replace(/(anyOf|allOf|oneOf)\/[\d]\//g, '')
|
|
1167
|
+
.replace(/(then|else)\//g, '');
|
|
1168
|
+
var segments = s.split('/');
|
|
1169
|
+
var decodedSegments = segments.map(decode);
|
|
1170
|
+
var startFromRoot = decodedSegments[0] === '#' || decodedSegments[0] === '';
|
|
1171
|
+
var startIndex = startFromRoot ? 2 : 1;
|
|
1172
|
+
return range__default["default"](startIndex, decodedSegments.length, 2).map(function (idx) { return decodedSegments[idx]; });
|
|
1173
|
+
};
|
|
1174
|
+
var toDataPath = function (schemaPath) {
|
|
1175
|
+
return toDataPathSegments(schemaPath).join('.');
|
|
1176
|
+
};
|
|
1177
|
+
var composeWithUi = function (scopableUi, path) {
|
|
1178
|
+
var segments = toDataPathSegments(scopableUi.scope);
|
|
1179
|
+
if (isEmpty__default["default"](segments) && path === undefined) {
|
|
1180
|
+
return '';
|
|
1181
|
+
}
|
|
1182
|
+
return isEmpty__default["default"](segments) ? path : compose(path, segments.join('.'));
|
|
1183
|
+
};
|
|
1184
|
+
var encode = function (segment) { return segment === null || segment === void 0 ? void 0 : segment.replace(/~/g, '~0').replace(/\//g, '~1'); };
|
|
1185
|
+
var decode = function (pointerSegment) { return pointerSegment === null || pointerSegment === void 0 ? void 0 : pointerSegment.replace(/~1/g, '/').replace(/~0/, '~'); };
|
|
1186
|
+
|
|
1098
1187
|
var isObjectSchema = function (schema) {
|
|
1099
1188
|
return schema.properties !== undefined;
|
|
1100
1189
|
};
|
|
@@ -1147,92 +1236,42 @@ var invalidSegment = function (pathSegment) {
|
|
|
1147
1236
|
return pathSegment === '#' || pathSegment === undefined || pathSegment === '';
|
|
1148
1237
|
};
|
|
1149
1238
|
var resolveSchema = function (schema, schemaPath, rootSchema) {
|
|
1150
|
-
var
|
|
1239
|
+
var segments = schemaPath === null || schemaPath === void 0 ? void 0 : schemaPath.split('/').map(decode);
|
|
1240
|
+
return resolveSchemaWithSegments(schema, segments, rootSchema);
|
|
1241
|
+
};
|
|
1242
|
+
var resolveSchemaWithSegments = function (schema, pathSegments, rootSchema) {
|
|
1243
|
+
var _a, _b, _c, _d, _e;
|
|
1151
1244
|
if (isEmpty__default["default"](schema)) {
|
|
1152
1245
|
return undefined;
|
|
1153
1246
|
}
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
for (var i = 0; i < validPathSegments.length; i++) {
|
|
1157
|
-
var pathSegment = validPathSegments[i];
|
|
1158
|
-
resultSchema =
|
|
1159
|
-
resultSchema === undefined || resultSchema.$ref === undefined
|
|
1160
|
-
? resultSchema
|
|
1161
|
-
: resolveSchema(schema, resultSchema.$ref);
|
|
1162
|
-
if (invalidSegment(pathSegment)) {
|
|
1163
|
-
continue;
|
|
1164
|
-
}
|
|
1165
|
-
var curSchema = get__default["default"](resultSchema, pathSegment);
|
|
1166
|
-
if (!curSchema) {
|
|
1167
|
-
var schemas = [].concat((_a = resultSchema === null || resultSchema === void 0 ? void 0 : resultSchema.oneOf) !== null && _a !== void 0 ? _a : [], (_b = resultSchema === null || resultSchema === void 0 ? void 0 : resultSchema.allOf) !== null && _b !== void 0 ? _b : [], (_c = resultSchema === null || resultSchema === void 0 ? void 0 : resultSchema.anyOf) !== null && _c !== void 0 ? _c : []);
|
|
1168
|
-
for (var _i = 0, schemas_1 = schemas; _i < schemas_1.length; _i++) {
|
|
1169
|
-
var item = schemas_1[_i];
|
|
1170
|
-
curSchema = resolveSchema(item, validPathSegments.slice(i).join('/'));
|
|
1171
|
-
if (curSchema) {
|
|
1172
|
-
break;
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
if (curSchema) {
|
|
1176
|
-
resultSchema = curSchema;
|
|
1177
|
-
break;
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
resultSchema = curSchema;
|
|
1181
|
-
}
|
|
1182
|
-
if (resultSchema !== undefined && resultSchema.$ref !== undefined) {
|
|
1183
|
-
try {
|
|
1184
|
-
return retrieveResolvableSchema(schema, resultSchema.$ref);
|
|
1185
|
-
}
|
|
1186
|
-
catch (e) {
|
|
1187
|
-
return retrieveResolvableSchema(rootSchema, resultSchema.$ref);
|
|
1188
|
-
}
|
|
1189
|
-
}
|
|
1190
|
-
return resultSchema;
|
|
1191
|
-
};
|
|
1192
|
-
function retrieveResolvableSchema(full, reference) {
|
|
1193
|
-
var child = resolveSchema(full, reference);
|
|
1194
|
-
var allRefs = findAllRefs(child);
|
|
1195
|
-
var innerSelfReference = allRefs[reference];
|
|
1196
|
-
if (innerSelfReference !== undefined) {
|
|
1197
|
-
innerSelfReference.$ref = '#';
|
|
1198
|
-
}
|
|
1199
|
-
return child;
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
var compose = function (path1, path2) {
|
|
1203
|
-
var p1 = path1;
|
|
1204
|
-
if (!isEmpty__default["default"](path1) && !isEmpty__default["default"](path2) && !path2.startsWith('[')) {
|
|
1205
|
-
p1 = path1 + '.';
|
|
1247
|
+
if (schema.$ref) {
|
|
1248
|
+
schema = resolveSchema(rootSchema, schema.$ref, rootSchema);
|
|
1206
1249
|
}
|
|
1207
|
-
if (
|
|
1208
|
-
return
|
|
1250
|
+
if (!pathSegments || pathSegments.length === 0) {
|
|
1251
|
+
return schema;
|
|
1209
1252
|
}
|
|
1210
|
-
|
|
1211
|
-
|
|
1253
|
+
var segment = pathSegments[0], remainingSegments = pathSegments.slice(1);
|
|
1254
|
+
if (invalidSegment(segment)) {
|
|
1255
|
+
return resolveSchemaWithSegments(schema, remainingSegments, rootSchema);
|
|
1212
1256
|
}
|
|
1213
|
-
|
|
1214
|
-
|
|
1257
|
+
var singleSegmentResolveSchema = get__default["default"](schema, segment);
|
|
1258
|
+
var resolvedSchema = resolveSchemaWithSegments(singleSegmentResolveSchema, remainingSegments, rootSchema);
|
|
1259
|
+
if (resolvedSchema) {
|
|
1260
|
+
return resolvedSchema;
|
|
1215
1261
|
}
|
|
1216
|
-
|
|
1217
|
-
var
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
var toDataPath = function (schemaPath) {
|
|
1228
|
-
return toDataPathSegments(schemaPath).join('.');
|
|
1229
|
-
};
|
|
1230
|
-
var composeWithUi = function (scopableUi, path) {
|
|
1231
|
-
var segments = toDataPathSegments(scopableUi.scope);
|
|
1232
|
-
if (isEmpty__default["default"](segments) && path === undefined) {
|
|
1233
|
-
return '';
|
|
1262
|
+
if (segment === 'properties' || segment === 'items') {
|
|
1263
|
+
var alternativeResolveResult = undefined;
|
|
1264
|
+
var subSchemas = [].concat((_a = schema.oneOf) !== null && _a !== void 0 ? _a : [], (_b = schema.allOf) !== null && _b !== void 0 ? _b : [], (_c = schema.anyOf) !== null && _c !== void 0 ? _c : [], (_d = schema.then) !== null && _d !== void 0 ? _d : [], (_e = schema.else) !== null && _e !== void 0 ? _e : []);
|
|
1265
|
+
for (var _i = 0, subSchemas_1 = subSchemas; _i < subSchemas_1.length; _i++) {
|
|
1266
|
+
var subSchema = subSchemas_1[_i];
|
|
1267
|
+
alternativeResolveResult = resolveSchemaWithSegments(subSchema, __spreadArray([segment], remainingSegments), rootSchema);
|
|
1268
|
+
if (alternativeResolveResult) {
|
|
1269
|
+
break;
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
return alternativeResolveResult;
|
|
1234
1273
|
}
|
|
1235
|
-
return
|
|
1274
|
+
return undefined;
|
|
1236
1275
|
};
|
|
1237
1276
|
|
|
1238
1277
|
var isOrCondition = function (condition) {
|
|
@@ -1417,7 +1456,7 @@ var deriveLabel = function (controlElement, schemaElement) {
|
|
|
1417
1456
|
}
|
|
1418
1457
|
if (typeof controlElement.scope === 'string') {
|
|
1419
1458
|
var ref = controlElement.scope;
|
|
1420
|
-
var label = ref.substr(ref.lastIndexOf('/') + 1);
|
|
1459
|
+
var label = decode(ref.substr(ref.lastIndexOf('/') + 1));
|
|
1421
1460
|
return startCase__default["default"](label);
|
|
1422
1461
|
}
|
|
1423
1462
|
return '';
|
|
@@ -1447,32 +1486,6 @@ var labelDescription = function (text, show) { return ({
|
|
|
1447
1486
|
show: show
|
|
1448
1487
|
}); };
|
|
1449
1488
|
|
|
1450
|
-
var createLabel = function (subSchema, subSchemaIndex, keyword) {
|
|
1451
|
-
if (subSchema.title) {
|
|
1452
|
-
return subSchema.title;
|
|
1453
|
-
}
|
|
1454
|
-
else {
|
|
1455
|
-
return keyword + '-' + subSchemaIndex;
|
|
1456
|
-
}
|
|
1457
|
-
};
|
|
1458
|
-
var resolveSubSchemas = function (schema, rootSchema, keyword) {
|
|
1459
|
-
var _a;
|
|
1460
|
-
var schemas = schema[keyword];
|
|
1461
|
-
if (schemas.findIndex(function (e) { return e.$ref !== undefined; }) !== -1) {
|
|
1462
|
-
return __assign(__assign({}, schema), (_a = {}, _a[keyword] = schema[keyword].map(function (e) {
|
|
1463
|
-
return e.$ref ? resolveSchema(rootSchema, e.$ref) : e;
|
|
1464
|
-
}), _a));
|
|
1465
|
-
}
|
|
1466
|
-
return schema;
|
|
1467
|
-
};
|
|
1468
|
-
var createCombinatorRenderInfos = function (combinatorSubSchemas, rootSchema, keyword, control, path, uischemas) {
|
|
1469
|
-
return combinatorSubSchemas.map(function (subSchema, subSchemaIndex) { return ({
|
|
1470
|
-
schema: subSchema,
|
|
1471
|
-
uischema: findUISchema(uischemas, subSchema, control.scope, path, undefined, control, rootSchema),
|
|
1472
|
-
label: createLabel(subSchema, subSchemaIndex, keyword)
|
|
1473
|
-
}); });
|
|
1474
|
-
};
|
|
1475
|
-
|
|
1476
1489
|
var isRequired = function (schema, schemaPath, rootSchema) {
|
|
1477
1490
|
var pathSegments = schemaPath.split('/');
|
|
1478
1491
|
var lastSegment = pathSegments[pathSegments.length - 1];
|
|
@@ -1570,8 +1583,8 @@ var mapStateToControlProps = function (state, ownProps) {
|
|
|
1570
1583
|
var schema = resolvedSchema !== null && resolvedSchema !== void 0 ? resolvedSchema : rootSchema;
|
|
1571
1584
|
var t = getTranslator()(state);
|
|
1572
1585
|
var te = getErrorTranslator()(state);
|
|
1573
|
-
var i18nLabel = t(getI18nKey(schema, uischema, path, 'label'), label);
|
|
1574
|
-
var i18nDescription = t(getI18nKey(schema, uischema, path, 'description'), description);
|
|
1586
|
+
var i18nLabel = t(getI18nKey(schema, uischema, path, 'label'), label, { schema: schema, uischema: uischema, path: path, errors: errors });
|
|
1587
|
+
var i18nDescription = t(getI18nKey(schema, uischema, path, 'description'), description, { schema: schema, uischema: uischema, path: path, errors: errors });
|
|
1575
1588
|
var i18nErrorMessage = getCombinedErrorMessage(errors, te, t, schema, uischema, path);
|
|
1576
1589
|
return {
|
|
1577
1590
|
data: data,
|
|
@@ -1735,13 +1748,13 @@ var mapStateToLayoutProps = function (state, ownProps) {
|
|
|
1735
1748
|
var enabled = isInherentlyEnabled(state, ownProps, uischema, undefined,
|
|
1736
1749
|
rootData, config);
|
|
1737
1750
|
return __assign(__assign({}, layoutDefaultProps), { renderers: ownProps.renderers || getRenderers(state), cells: ownProps.cells || getCells(state), visible: visible,
|
|
1738
|
-
enabled: enabled, path: ownProps.path, data: data, uischema: ownProps.uischema, schema: ownProps.schema, direction: (_a = ownProps.direction) !== null && _a !== void 0 ? _a : getDirection(uischema) });
|
|
1751
|
+
enabled: enabled, path: ownProps.path, data: data, uischema: ownProps.uischema, schema: ownProps.schema, direction: (_a = ownProps.direction) !== null && _a !== void 0 ? _a : getDirection(uischema), config: config });
|
|
1739
1752
|
};
|
|
1740
1753
|
var mapStateToJsonFormsRendererProps = function (state, ownProps) {
|
|
1741
1754
|
var uischema = ownProps.uischema;
|
|
1742
1755
|
if (uischema === undefined) {
|
|
1743
1756
|
if (ownProps.schema) {
|
|
1744
|
-
uischema = findUISchema(state.jsonforms.uischemas, ownProps.schema, undefined, ownProps.path);
|
|
1757
|
+
uischema = findUISchema(state.jsonforms.uischemas, ownProps.schema, undefined, ownProps.path, undefined, undefined, state.jsonforms.core.schema);
|
|
1745
1758
|
}
|
|
1746
1759
|
else {
|
|
1747
1760
|
uischema = getUiSchema(state);
|
|
@@ -1758,18 +1771,9 @@ var mapStateToJsonFormsRendererProps = function (state, ownProps) {
|
|
|
1758
1771
|
};
|
|
1759
1772
|
var controlDefaultProps = __assign(__assign({}, layoutDefaultProps), { errors: [] });
|
|
1760
1773
|
var mapStateToCombinatorRendererProps = function (state, ownProps, keyword) {
|
|
1761
|
-
var
|
|
1762
|
-
var
|
|
1763
|
-
var rootSchema = getSchema(state);
|
|
1764
|
-
var resolvedSchema = Resolve.schema(ownProps.schema || rootSchema, uischema.scope, rootSchema);
|
|
1765
|
-
var visible = ownProps.visible === undefined || hasShowRule(uischema)
|
|
1766
|
-
? isVisible(uischema, getData(state), ownProps.path, getAjv(state))
|
|
1767
|
-
: ownProps.visible;
|
|
1768
|
-
var id = ownProps.id;
|
|
1769
|
-
var data = Resolve.data(getData(state), path);
|
|
1774
|
+
var _a;
|
|
1775
|
+
var _b = mapStateToControlProps(state, ownProps), data = _b.data, schema = _b.schema, props = __rest(_b, ["data", "schema"]);
|
|
1770
1776
|
var ajv = state.jsonforms.core.ajv;
|
|
1771
|
-
var schema = resolvedSchema || rootSchema;
|
|
1772
|
-
var _schema = resolveSubSchemas(schema, rootSchema, keyword);
|
|
1773
1777
|
var structuralKeywords = [
|
|
1774
1778
|
'required',
|
|
1775
1779
|
'additionalProperties',
|
|
@@ -1783,9 +1787,9 @@ var mapStateToCombinatorRendererProps = function (state, ownProps, keyword) {
|
|
|
1783
1787
|
!errors.find(function (e) { return structuralKeywords.indexOf(e.keyword) !== -1; }));
|
|
1784
1788
|
};
|
|
1785
1789
|
var indexOfFittingSchema;
|
|
1786
|
-
for (var i = 0; i <
|
|
1790
|
+
for (var i = 0; i < ((_a = schema[keyword]) === null || _a === void 0 ? void 0 : _a.length); i++) {
|
|
1787
1791
|
try {
|
|
1788
|
-
var valFn = ajv.compile(
|
|
1792
|
+
var valFn = ajv.compile(schema[keyword][i]);
|
|
1789
1793
|
valFn(data);
|
|
1790
1794
|
if (dataIsValid(valFn.errors)) {
|
|
1791
1795
|
indexOfFittingSchema = i;
|
|
@@ -1796,17 +1800,8 @@ var mapStateToCombinatorRendererProps = function (state, ownProps, keyword) {
|
|
|
1796
1800
|
console.debug("Combinator subschema is not self contained, can't hand it over to AJV");
|
|
1797
1801
|
}
|
|
1798
1802
|
}
|
|
1799
|
-
return {
|
|
1800
|
-
|
|
1801
|
-
path: path,
|
|
1802
|
-
schema: schema,
|
|
1803
|
-
rootSchema: rootSchema,
|
|
1804
|
-
visible: visible,
|
|
1805
|
-
id: id,
|
|
1806
|
-
indexOfFittingSchema: indexOfFittingSchema,
|
|
1807
|
-
uischemas: state.jsonforms.uischemas,
|
|
1808
|
-
uischema: uischema
|
|
1809
|
-
};
|
|
1803
|
+
return __assign(__assign({ data: data,
|
|
1804
|
+
schema: schema }, props), { indexOfFittingSchema: indexOfFittingSchema, uischemas: getUISchemas(state) });
|
|
1810
1805
|
};
|
|
1811
1806
|
var mapStateToAllOfProps = function (state, ownProps) {
|
|
1812
1807
|
return mapStateToCombinatorRendererProps(state, ownProps, 'allOf');
|
|
@@ -1899,6 +1894,25 @@ function (dispatch, ownProps) {
|
|
|
1899
1894
|
};
|
|
1900
1895
|
};
|
|
1901
1896
|
|
|
1897
|
+
var createLabel = function (subSchema, subSchemaIndex, keyword) {
|
|
1898
|
+
if (subSchema.title) {
|
|
1899
|
+
return subSchema.title;
|
|
1900
|
+
}
|
|
1901
|
+
else {
|
|
1902
|
+
return keyword + '-' + subSchemaIndex;
|
|
1903
|
+
}
|
|
1904
|
+
};
|
|
1905
|
+
var createCombinatorRenderInfos = function (combinatorSubSchemas, rootSchema, keyword, control, path, uischemas) {
|
|
1906
|
+
return combinatorSubSchemas.map(function (subSchema, subSchemaIndex) {
|
|
1907
|
+
var schema = subSchema.$ref ? Resolve.schema(rootSchema, subSchema.$ref, rootSchema) : subSchema;
|
|
1908
|
+
return {
|
|
1909
|
+
schema: schema,
|
|
1910
|
+
uischema: findUISchema(uischemas, schema, control.scope, path, undefined, control, rootSchema),
|
|
1911
|
+
label: createLabel(subSchema, subSchemaIndex, keyword)
|
|
1912
|
+
};
|
|
1913
|
+
});
|
|
1914
|
+
};
|
|
1915
|
+
|
|
1902
1916
|
var usedIds = new Set();
|
|
1903
1917
|
var makeId = function (idBase, iteration) {
|
|
1904
1918
|
return iteration <= 1 ? idBase : idBase + iteration.toString();
|
|
@@ -2002,7 +2016,7 @@ var isCombinator = function (jsonSchema) {
|
|
|
2002
2016
|
};
|
|
2003
2017
|
var generateUISchema = function (jsonSchema, schemaElements, currentRef, schemaName, layoutType, rootSchema) {
|
|
2004
2018
|
if (!isEmpty__default["default"](jsonSchema) && jsonSchema.$ref !== undefined) {
|
|
2005
|
-
return generateUISchema(resolveSchema(rootSchema, jsonSchema.$ref), schemaElements, currentRef, schemaName, layoutType, rootSchema);
|
|
2019
|
+
return generateUISchema(resolveSchema(rootSchema, jsonSchema.$ref, rootSchema), schemaElements, currentRef, schemaName, layoutType, rootSchema);
|
|
2006
2020
|
}
|
|
2007
2021
|
if (isCombinator(jsonSchema)) {
|
|
2008
2022
|
var controlObject = createControlElement(currentRef);
|
|
@@ -2028,9 +2042,9 @@ var generateUISchema = function (jsonSchema, schemaElements, currentRef, schemaN
|
|
|
2028
2042
|
var nextRef_1 = currentRef + '/properties';
|
|
2029
2043
|
Object.keys(jsonSchema.properties).map(function (propName) {
|
|
2030
2044
|
var value = jsonSchema.properties[propName];
|
|
2031
|
-
var ref = nextRef_1 + "/" + propName;
|
|
2045
|
+
var ref = nextRef_1 + "/" + encode(propName);
|
|
2032
2046
|
if (value.$ref !== undefined) {
|
|
2033
|
-
value = resolveSchema(rootSchema, value.$ref);
|
|
2047
|
+
value = resolveSchema(rootSchema, value.$ref, rootSchema);
|
|
2034
2048
|
}
|
|
2035
2049
|
generateUISchema(value, layout_1.elements, ref, propName, layoutType, rootSchema);
|
|
2036
2050
|
});
|
|
@@ -2288,6 +2302,7 @@ exports.createControlElement = createControlElement;
|
|
|
2288
2302
|
exports.createDefaultValue = createDefaultValue;
|
|
2289
2303
|
exports.createId = createId;
|
|
2290
2304
|
exports.createLabelDescriptionFrom = createLabelDescriptionFrom;
|
|
2305
|
+
exports.decode = decode;
|
|
2291
2306
|
exports.defaultDataReducer = defaultDataReducer;
|
|
2292
2307
|
exports.defaultErrorTranslator = defaultErrorTranslator;
|
|
2293
2308
|
exports.defaultJsonFormsI18nState = defaultJsonFormsI18nState;
|
|
@@ -2295,6 +2310,7 @@ exports.defaultMapDispatchToControlProps = defaultMapDispatchToControlProps;
|
|
|
2295
2310
|
exports.defaultMapStateToEnumCellProps = defaultMapStateToEnumCellProps;
|
|
2296
2311
|
exports.defaultTranslator = defaultTranslator;
|
|
2297
2312
|
exports.deriveTypes = deriveTypes;
|
|
2313
|
+
exports.encode = encode;
|
|
2298
2314
|
exports.enumToEnumOptionMapper = enumToEnumOptionMapper;
|
|
2299
2315
|
exports.errorAt = errorAt;
|
|
2300
2316
|
exports.errorsAt = errorsAt;
|
|
@@ -2410,7 +2426,6 @@ exports.removeId = removeId;
|
|
|
2410
2426
|
exports.rendererReducer = rendererReducer;
|
|
2411
2427
|
exports.resolveData = resolveData;
|
|
2412
2428
|
exports.resolveSchema = resolveSchema;
|
|
2413
|
-
exports.resolveSubSchemas = resolveSubSchemas;
|
|
2414
2429
|
exports.schemaMatches = schemaMatches;
|
|
2415
2430
|
exports.schemaSubPathMatches = schemaSubPathMatches;
|
|
2416
2431
|
exports.schemaTypeIs = schemaTypeIs;
|