@@ -1060,6 +1060,7 @@ return /******/ (function(modules) { // webpackBootstrap
1060
1060
this . $get = function ( ) {
1061
1061
1062
1062
var service = { } ;
1063
+ var typeDefault = this . defaults ;
1063
1064
1064
1065
service . merge = function ( schema , form , ignore , options , readonly , asyncTemplates ) {
1065
1066
form = form || [ '*' ] ;
@@ -1068,7 +1069,7 @@ return /******/ (function(modules) { // webpackBootstrap
1068
1069
// Get readonly from root object
1069
1070
readonly = readonly || schema . readonly || schema . readOnly ;
1070
1071
1071
- var stdForm = _jsonSchemaFormCore . schemaDefaults . defaultForm ( schema , defaults , ignore , options ) ;
1072
+ var stdForm = _jsonSchemaFormCore . schemaDefaults . defaultForm ( schema , typeDefault , ignore , options ) ;
1072
1073
1073
1074
//simple case, we have a "*", just put the stdForm there
1074
1075
var idx = form . indexOf ( '*' ) ;
@@ -1086,7 +1087,14 @@ return /******/ (function(modules) { // webpackBootstrap
1086
1087
* Create form defaults from schema
1087
1088
*/
1088
1089
service . defaults = _jsonSchemaFormCore . schemaDefaults . defaultForm ;
1090
+
1089
1091
//Utility functions
1092
+ /**
1093
+ * Form defaults for schema by type
1094
+ * As a form is generated from a schema these are the definitions of each json-schema type
1095
+ */
1096
+ service . typeDefault = typeDefault ;
1097
+
1090
1098
/**
1091
1099
* Traverse a schema, applying a function(schema,path) on every sub schema
1092
1100
* i.e. every property of an object.
@@ -1114,8 +1122,9 @@ return /******/ (function(modules) { // webpackBootstrap
1114
1122
/*!
1115
1123
* json-schema-form
1116
1124
* @version 1.0.0-alpha.1
1125
+ * @link https://github.com/json-schema-form/json-schema-form-core
1117
1126
* @license MIT
1118
- * Copyright 2016 JSON Schema Form
1127
+ * Copyright (c) 2016 JSON Schema Form
1119
1128
*/
1120
1129
( function webpackUniversalModuleDefinition ( root , factory ) {
1121
1130
if ( true )
@@ -1879,10 +1888,10 @@ return /******/ (function(modules) { // webpackBootstrap
1879
1888
var _ret = function ( ) {
1880
1889
var f = stdFormObj ( name , schema , options ) ;
1881
1890
f . type = 'fieldset' ;
1891
+ f . key = options . path ;
1882
1892
f . items = [ ] ;
1883
1893
options . lookup [ ( 0 , _sfPath . stringify ) ( options . path ) ] = f ;
1884
1894
1885
- console . log ( 'fieldset' , f , schema ) ;
1886
1895
//recurse down into properties
1887
1896
if ( schema . properties ) {
1888
1897
Object . keys ( schema . properties ) . forEach ( function ( key ) {
@@ -1952,8 +1961,7 @@ return /******/ (function(modules) { // webpackBootstrap
1952
1961
number : [ number ] ,
1953
1962
integer : [ integer ] ,
1954
1963
boolean : [ checkbox ] ,
1955
- array : [ array ] ,
1956
- defaultForm : defaultForm
1964
+ array : [ checkboxes , array ]
1957
1965
} ;
1958
1966
} ;
1959
1967
@@ -1965,6 +1973,7 @@ return /******/ (function(modules) { // webpackBootstrap
1965
1973
var lookup = { } ; //Map path => form obj for fast lookup in merging
1966
1974
ignore = ignore || { } ;
1967
1975
globalOptions = globalOptions || { } ;
1976
+ defaultSchemaTypes = defaultSchemaTypes || createDefaults ( ) ;
1968
1977
1969
1978
if ( schema . properties ) {
1970
1979
Object . keys ( schema . properties ) . forEach ( function ( key ) {
0 commit comments