@@ -483,10 +483,15 @@ module.exports = function (it, tag, stat) {
483
483
484
484
"use strict" ;
485
485
Object . defineProperty ( __webpack_exports__ , "__esModule" , { value : true } ) ;
486
+ /* harmony export (immutable) */ __webpack_exports__ [ "deepClone" ] = deepClone ;
486
487
/* harmony export (immutable) */ __webpack_exports__ [ "getExtendibleLeaf" ] = getExtendibleLeaf ;
487
488
/* harmony export (immutable) */ __webpack_exports__ [ "getChild" ] = getChild ;
488
489
/* harmony export (immutable) */ __webpack_exports__ [ "initChild" ] = initChild ;
489
490
/* harmony export (immutable) */ __webpack_exports__ [ "setVal" ] = setVal ;
491
+ function deepClone ( obj ) {
492
+ return JSON . parse ( JSON . stringify ( obj ) ) ;
493
+ }
494
+
490
495
function getExtendibleLeaf ( obj , n , initIt ) {
491
496
const v = obj [ n ] ;
492
497
if ( v && typeof v === 'object' && ! Array . isArray ( v ) ) {
@@ -700,13 +705,10 @@ module.exports = function normalizeComponent (
700
705
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_toConsumableArray___default = __webpack_require__ . n ( __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_toConsumableArray__ ) ;
701
706
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_keys__ = __webpack_require__ ( 62 ) ;
702
707
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_keys___default = __webpack_require__ . n ( __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_keys__ ) ;
703
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_json_stringify__ = __webpack_require__ ( 66 ) ;
704
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_json_stringify___default = __webpack_require__ . n ( __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_json_stringify__ ) ;
705
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_extends__ = __webpack_require__ ( 68 ) ;
706
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_extends___default = __webpack_require__ . n ( __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_extends__ ) ;
707
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__parser__ = __webpack_require__ ( 75 ) ;
708
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils__ = __webpack_require__ ( 28 ) ;
709
-
708
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_extends__ = __webpack_require__ ( 66 ) ;
709
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_extends___default = __webpack_require__ . n ( __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_extends__ ) ;
710
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__parser__ = __webpack_require__ ( 73 ) ;
711
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils__ = __webpack_require__ ( 28 ) ;
710
712
711
713
712
714
@@ -728,7 +730,7 @@ var components = {
728
730
option : { component : 'option' , option : option } ,
729
731
button : {
730
732
component : 'button' ,
731
- option : __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_extends___default ( ) ( { } , option , {
733
+ option : __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_extends___default ( ) ( { } , option , {
732
734
type : 'submit' ,
733
735
label : 'Submit'
734
736
} )
@@ -740,6 +742,13 @@ var components = {
740
742
} ;
741
743
var defaultInput = { component : 'input' , option : option } ;
742
744
var defaultGroup = { component : 'div' , option : option } ;
745
+
746
+ /**
747
+ * Edit JSON in UI form with JSON Schema and Vue.js `<json-editor>` component.
748
+ *
749
+ * @author Yourtion
750
+ * @license MIT
751
+ */
743
752
/* harmony default export */ __webpack_exports__ [ "a" ] = ( {
744
753
name : 'JsonEditor' ,
745
754
props : {
@@ -758,11 +767,11 @@ var defaultGroup = { component: 'div', option: option };
758
767
/**
759
768
* This property indicates whether the value of the control can be automatically completed by the browser. Possible values are: `off` and `on`.
760
769
*/
761
- autocomplete : { type : String } ,
770
+ autoComplete : { type : String } ,
762
771
/**
763
772
* This Boolean attribute indicates that the form is not to be validated when submitted.
764
773
*/
765
- novalidate : { type : Boolean } ,
774
+ noValidate : { type : Boolean } ,
766
775
/**
767
776
* Define the inputs wrapping class. Leave `undefined` to disable input wrapping.
768
777
*/
@@ -777,9 +786,9 @@ var defaultGroup = { component: 'div', option: option };
777
786
} ;
778
787
} ,
779
788
created : function created ( ) {
780
- Object ( __WEBPACK_IMPORTED_MODULE_5__parser__ [ "a" /* loadFields */ ] ) ( this , JSON . parse ( __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_json_stringify___default ( ) ( this . schema ) ) ) ;
781
- this . default = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_extends___default ( ) ( { } , this . value ) ;
782
- this . data = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_extends___default ( ) ( { } , this . value ) ;
789
+ Object ( __WEBPACK_IMPORTED_MODULE_4__parser__ [ "a" /* loadFields */ ] ) ( this , Object ( __WEBPACK_IMPORTED_MODULE_5__utils__ [ "deepClone" ] ) ( this . schema ) ) ;
790
+ this . default = Object ( __WEBPACK_IMPORTED_MODULE_5__utils__ [ "deepClone" ] ) ( this . value ) ;
791
+ this . data = Object ( __WEBPACK_IMPORTED_MODULE_5__utils__ [ "deepClone" ] ) ( this . value ) ;
783
792
} ,
784
793
render : function render ( createElement ) {
785
794
var _this3 = this ;
@@ -808,7 +817,7 @@ var defaultGroup = { component: 'div', option: option };
808
817
809
818
var node = void 0 ;
810
819
if ( sub ) {
811
- node = Object ( __WEBPACK_IMPORTED_MODULE_6__utils__ [ "setVal" ] ) ( formNode , sub , [ ] ) ;
820
+ node = Object ( __WEBPACK_IMPORTED_MODULE_5__utils__ [ "setVal" ] ) ( formNode , sub . pop ( ) , { } ) ;
812
821
} else {
813
822
node = formNode . root ;
814
823
}
@@ -822,28 +831,28 @@ var defaultGroup = { component: 'div', option: option };
822
831
return createForm . call ( _this , field , sub ? [ ] . concat ( __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_toConsumableArray___default ( ) ( sub ) , [ key ] ) : [ key ] ) ;
823
832
}
824
833
var fieldName = field . name ;
825
- var fieldValue = Object ( __WEBPACK_IMPORTED_MODULE_6__utils__ [ "getChild" ] ) ( _this . value , field . name . split ( '.' ) ) ;
834
+
835
+ var fieldValue = Object ( __WEBPACK_IMPORTED_MODULE_5__utils__ [ "getChild" ] ) ( _this . value , fieldName . split ( '.' ) ) ;
826
836
if ( ! field . value ) {
827
837
field . value = fieldValue ;
828
838
}
829
- var customComponent = field . compoment ? { compoment : field . compoment , option : { native : true } } : undefined ;
839
+ var customComponent = field . component ? { component : field . component , option : { } } : undefined ;
830
840
// eslint-disable-next-line
831
- var element = field . compoment ? customComponent : field . hasOwnProperty ( 'items' ) && field . type !== 'select' ? components [ field . type + 'group' ] || defaultGroup : components [ field . type ] || defaultInput ;
841
+ var element = field . component ? customComponent : field . hasOwnProperty ( 'items' ) && field . type !== 'select' ? components [ field . type + 'group' ] || defaultGroup : components [ field . type ] || defaultInput ;
832
842
var fieldOptions = _this . elementOptions ( element , field , field ) ;
833
843
var children = [ ] ;
834
- var hasMultitpleElements = false ;
835
844
836
- var input = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_extends___default ( ) ( {
845
+ var input = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_extends___default ( ) ( {
837
846
ref : fieldName ,
838
847
domProps : {
839
848
value : fieldValue
840
849
} ,
841
850
on : {
842
851
input : function input ( event ) {
843
852
var value = event && event . target ? event . target . value : event ;
844
- var ns = field . name . split ( '.' ) ;
853
+ var ns = fieldName . split ( '.' ) ;
845
854
var n = ns . pop ( ) ;
846
- var ret = ns . length > 0 ? Object ( __WEBPACK_IMPORTED_MODULE_6__utils__ [ "initChild" ] ) ( _this . data , ns ) : _this . data ;
855
+ var ret = ns . length > 0 ? Object ( __WEBPACK_IMPORTED_MODULE_5__utils__ [ "initChild" ] ) ( _this . data , ns ) : _this . data ;
847
856
_this . $set ( ret , n , value ) ;
848
857
/**
849
858
* Fired synchronously when the value of an element is changed.
@@ -877,15 +886,15 @@ var defaultGroup = { component: 'div', option: option };
877
886
var optionOptions = _this . elementOptions ( components . option , {
878
887
value : option . value
879
888
} , field ) ;
880
- children . push ( createElement ( components . option . component , __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_extends___default ( ) ( {
889
+ children . push ( createElement ( components . option . component , __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_extends___default ( ) ( {
881
890
domProps : {
882
891
value : option . value
883
892
}
884
893
} , optionOptions ) , option . label ) ) ;
885
894
} ) ;
886
895
break ;
887
896
}
888
- var inputElement = hasMultitpleElements ? createElement ( element . component , input , children ) : createElement ( element . component , input , children ) ;
897
+ var inputElement = createElement ( element . component , input , children ) ;
889
898
890
899
var formControlsNodes = [ ] ;
891
900
if ( field . label && ! option . disableWrappingLabel ) {
@@ -920,11 +929,7 @@ var defaultGroup = { component: 'div', option: option };
920
929
return formNodes . push ( node ) ;
921
930
} ) ;
922
931
}
923
- if ( sub ) {
924
- node . push ( formNodes [ 0 ] ) ;
925
- } else {
926
- node [ key ] = formNodes [ 0 ] ;
927
- }
932
+ node [ key ] = formNodes [ 0 ] ;
928
933
} ) ;
929
934
}
930
935
}
@@ -933,22 +938,26 @@ var defaultGroup = { component: 'div', option: option };
933
938
function createNode ( fields , sub ) {
934
939
var _this2 = this ;
935
940
936
- if ( sub ) {
937
- allFormNodes . push ( createElement ( 'div' , {
938
- class : 'sub-' + sub . length
939
- } , formNode [ sub [ sub . length - 1 ] ] ) ) ;
940
- }
941
+ var nodes = [ ] ;
942
+ var subName = sub && sub . pop ( ) ;
941
943
__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_keys___default ( ) ( fields ) . forEach ( function ( key ) {
942
944
if ( key === '$sub' ) return ;
943
945
var field = fields [ key ] ;
944
946
if ( field . $sub ) {
945
- createNode . call ( _this2 , field , sub ? [ ] . concat ( __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_toConsumableArray___default ( ) ( sub ) , [ key ] ) : [ key ] ) ;
946
- } else if ( formNode . root [ key ] ) {
947
- allFormNodes . push ( formNode . root [ key ] ) ;
947
+ var node = createNode . call ( _this2 , field , sub ? [ ] . concat ( __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_toConsumableArray___default ( ) ( sub ) , [ key ] ) : [ key ] ) ;
948
+ nodes . push ( createElement ( 'div' , {
949
+ class : 'sub'
950
+ } , node ) ) ;
951
+ } else if ( subName ) {
952
+ nodes . push ( Object ( __WEBPACK_IMPORTED_MODULE_5__utils__ [ "getChild" ] ) ( formNode , subName . split ( '.' ) ) [ key ] ) ;
953
+ } else {
954
+ nodes . push ( formNode . root [ key ] ) ;
948
955
}
949
956
} ) ;
957
+ return nodes ;
950
958
}
951
- createNode . call ( this , this . fields ) ;
959
+ var formNodes = createNode . call ( this , this . fields ) ;
960
+ allFormNodes . push ( formNodes ) ;
952
961
953
962
var labelOptions = this . elementOptions ( components . label ) ;
954
963
var button = this . $slots . hasOwnProperty ( 'default' ) ? { component : this . $slots . default , option : option } : components . button ;
@@ -963,7 +972,7 @@ var defaultGroup = { component: 'div', option: option };
963
972
autocomplete : this . autocomplete ,
964
973
novalidate : this . novalidate
965
974
} ) ;
966
- nodes . push ( createElement ( components . form . component , __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_extends___default ( ) ( {
975
+ nodes . push ( createElement ( components . form . component , __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_extends___default ( ) ( {
967
976
ref : '__form' ,
968
977
on : {
969
978
submit : function submit ( event ) {
@@ -1003,9 +1012,9 @@ var defaultGroup = { component: 'div', option: option };
1003
1012
var item = arguments . length > 3 && arguments [ 3 ] !== undefined ? arguments [ 3 ] : { } ;
1004
1013
1005
1014
var attrName = element . option . native ? 'attrs' : 'props' ;
1006
- var elementProps = typeof element . option === 'function' ? element . option : __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_extends___default ( ) ( { } , element . option , { native : undefined } ) ;
1015
+ var elementProps = typeof element . option === 'function' ? element . option : __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_extends___default ( ) ( { } , element . option , { native : undefined } ) ;
1007
1016
var options = this . optionValue ( field , elementProps , item ) ;
1008
- return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_defineProperty___default ( ) ( { } , attrName , __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_extends___default ( ) ( { } , extendingOptions , options ) ) ;
1017
+ return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_defineProperty___default ( ) ( { } , attrName , __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_extends___default ( ) ( { } , extendingOptions , options ) ) ;
1009
1018
} ,
1010
1019
1011
1020
/**
@@ -1056,11 +1065,11 @@ var defaultGroup = { component: 'div', option: option };
1056
1065
* Reset the value of all elements of the parent form.
1057
1066
*/
1058
1067
reset : function reset ( ) {
1059
- for ( var key in this . default ) {
1068
+ for ( var key in this . data ) {
1060
1069
var ns = key . split ( '.' ) ;
1061
1070
var n = ns . pop ( ) ;
1062
- var ret = ns . length > 0 ? Object ( __WEBPACK_IMPORTED_MODULE_6__utils__ [ "initChild" ] ) ( this . data , ns ) : this . data ;
1063
- var value = Object ( __WEBPACK_IMPORTED_MODULE_6__utils__ [ "getChild" ] ) ( this . default , key . split ( '.' ) ) ;
1071
+ var ret = ns . length > 0 ? Object ( __WEBPACK_IMPORTED_MODULE_5__utils__ [ "initChild" ] ) ( this . data , ns ) : this . data ;
1072
+ var value = Object ( __WEBPACK_IMPORTED_MODULE_5__utils__ [ "getChild" ] ) ( this . default , key . split ( '.' ) ) ;
1064
1073
this . $set ( ret , n , value ) ;
1065
1074
}
1066
1075
} ,
@@ -1755,29 +1764,12 @@ module.exports = function (KEY, exec) {
1755
1764
/* 66 */
1756
1765
/***/ ( function ( module , exports , __webpack_require__ ) {
1757
1766
1758
- module . exports = { "default" : __webpack_require__ ( 67 ) , __esModule : true } ;
1759
-
1760
- /***/ } ) ,
1761
- /* 67 */
1762
- /***/ ( function ( module , exports , __webpack_require__ ) {
1763
-
1764
- var core = __webpack_require__ ( 0 ) ;
1765
- var $JSON = core . JSON || ( core . JSON = { stringify : JSON . stringify } ) ;
1766
- module . exports = function stringify ( it ) { // eslint-disable-line no-unused-vars
1767
- return $JSON . stringify . apply ( $JSON , arguments ) ;
1768
- } ;
1769
-
1770
-
1771
- /***/ } ) ,
1772
- /* 68 */
1773
- /***/ ( function ( module , exports , __webpack_require__ ) {
1774
-
1775
1767
"use strict" ;
1776
1768
1777
1769
1778
1770
exports . __esModule = true ;
1779
1771
1780
- var _assign = __webpack_require__ ( 69 ) ;
1772
+ var _assign = __webpack_require__ ( 67 ) ;
1781
1773
1782
1774
var _assign2 = _interopRequireDefault ( _assign ) ;
1783
1775
@@ -1798,39 +1790,39 @@ exports.default = _assign2.default || function (target) {
1798
1790
} ;
1799
1791
1800
1792
/***/ } ) ,
1801
- /* 69 */
1793
+ /* 67 */
1802
1794
/***/ ( function ( module , exports , __webpack_require__ ) {
1803
1795
1804
- module . exports = { "default" : __webpack_require__ ( 70 ) , __esModule : true } ;
1796
+ module . exports = { "default" : __webpack_require__ ( 68 ) , __esModule : true } ;
1805
1797
1806
1798
/***/ } ) ,
1807
- /* 70 */
1799
+ /* 68 */
1808
1800
/***/ ( function ( module , exports , __webpack_require__ ) {
1809
1801
1810
- __webpack_require__ ( 71 ) ;
1802
+ __webpack_require__ ( 69 ) ;
1811
1803
module . exports = __webpack_require__ ( 0 ) . Object . assign ;
1812
1804
1813
1805
1814
1806
/***/ } ) ,
1815
- /* 71 */
1807
+ /* 69 */
1816
1808
/***/ ( function ( module , exports , __webpack_require__ ) {
1817
1809
1818
1810
// 19.1.3.1 Object.assign(target, source)
1819
1811
var $export = __webpack_require__ ( 2 ) ;
1820
1812
1821
- $export ( $export . S + $export . F , 'Object' , { assign : __webpack_require__ ( 72 ) } ) ;
1813
+ $export ( $export . S + $export . F , 'Object' , { assign : __webpack_require__ ( 70 ) } ) ;
1822
1814
1823
1815
1824
1816
/***/ } ) ,
1825
- /* 72 */
1817
+ /* 70 */
1826
1818
/***/ ( function ( module , exports , __webpack_require__ ) {
1827
1819
1828
1820
"use strict" ;
1829
1821
1830
1822
// 19.1.2.1 Object.assign(target, source, ...)
1831
1823
var getKeys = __webpack_require__ ( 16 ) ;
1832
- var gOPS = __webpack_require__ ( 73 ) ;
1833
- var pIE = __webpack_require__ ( 74 ) ;
1824
+ var gOPS = __webpack_require__ ( 71 ) ;
1825
+ var pIE = __webpack_require__ ( 72 ) ;
1834
1826
var toObject = __webpack_require__ ( 10 ) ;
1835
1827
var IObject = __webpack_require__ ( 21 ) ;
1836
1828
var $assign = Object . assign ;
@@ -1863,21 +1855,21 @@ module.exports = !$assign || __webpack_require__(8)(function () {
1863
1855
1864
1856
1865
1857
/***/ } ) ,
1866
- /* 73 */
1858
+ /* 71 */
1867
1859
/***/ ( function ( module , exports ) {
1868
1860
1869
1861
exports . f = Object . getOwnPropertySymbols ;
1870
1862
1871
1863
1872
1864
/***/ } ) ,
1873
- /* 74 */
1865
+ /* 72 */
1874
1866
/***/ ( function ( module , exports ) {
1875
1867
1876
1868
exports . f = { } . propertyIsEnumerable ;
1877
1869
1878
1870
1879
1871
/***/ } ) ,
1880
- /* 75 */
1872
+ /* 73 */
1881
1873
/***/ ( function ( module , __webpack_exports__ , __webpack_require__ ) {
1882
1874
1883
1875
"use strict" ;
@@ -1892,6 +1884,7 @@ const setCommonFields = (schema, field, schemaName) => {
1892
1884
? schema . default
1893
1885
: field . hasOwnProperty ( 'value' ) ? field . value : '' ;
1894
1886
1887
+ field . component = schema . component ;
1895
1888
field . schemaType = schema . type ;
1896
1889
field . label = schema . title || '' ;
1897
1890
field . description = schema . description || '' ;
0 commit comments