1
1
/*!
2
2
* angular-schema-form
3
- * @version 1.0.0-alpha.3
4
- * @date Sun, 02 Apr 2017 13:11:29 GMT
3
+ * @version 1.0.0-alpha.4
4
+ * @date Mon, 03 Apr 2017 12:57:49 GMT
5
5
* @link https://github.com/json-schema-form/angular-schema-form
6
6
* @license MIT
7
7
* Copyright (c) 2014-2017 JSON Schema Form
71
71
/******/ __webpack_require__ . p = "" ;
72
72
/******/
73
73
/******/ // Load entry module and return exports
74
- /******/ return __webpack_require__ ( __webpack_require__ . s = 21 ) ;
74
+ /******/ return __webpack_require__ ( __webpack_require__ . s = 19 ) ;
75
75
/******/ } )
76
76
/************************************************************************/
77
77
/******/ ( [
@@ -2729,7 +2729,7 @@ module.exports = __webpack_require__(4);
2729
2729
/***/ } )
2730
2730
/******/ ] ) ;
2731
2731
//# sourceMappingURL=json-schema-form-core.js.map
2732
- /* WEBPACK VAR INJECTION */ } . call ( exports , __webpack_require__ ( 2 ) , __webpack_require__ ( 19 ) . setImmediate ) )
2732
+ /* WEBPACK VAR INJECTION */ } . call ( exports , __webpack_require__ ( 2 ) , __webpack_require__ ( 18 ) . setImmediate ) )
2733
2733
2734
2734
/***/ } ) ,
2735
2735
/* 2 */
@@ -2759,8 +2759,7 @@ module.exports = g;
2759
2759
2760
2760
2761
2761
/***/ } ) ,
2762
- /* 3 */ ,
2763
- /* 4 */
2762
+ /* 3 */
2764
2763
/***/ ( function ( module , __webpack_exports__ , __webpack_require__ ) {
2765
2764
2766
2765
"use strict" ;
@@ -2769,18 +2768,18 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
2769
2768
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_json_schema_form_core___default = __webpack_require__ . n ( __WEBPACK_IMPORTED_MODULE_0_json_schema_form_core__ ) ;
2770
2769
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_angular__ = __webpack_require__ ( 0 ) ;
2771
2770
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_angular___default = __webpack_require__ . n ( __WEBPACK_IMPORTED_MODULE_1_angular__ ) ;
2772
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_sf_builder_provider__ = __webpack_require__ ( 14 ) ;
2773
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_schema_form_decorators_provider__ = __webpack_require__ ( 12 ) ;
2774
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_schema_form_provider__ = __webpack_require__ ( 13 ) ;
2775
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_sf_error_message_provider__ = __webpack_require__ ( 15 ) ;
2776
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_sf_path_provider__ = __webpack_require__ ( 16 ) ;
2777
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_sf_changed_directive__ = __webpack_require__ ( 7 ) ;
2778
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_sf_field_directive__ = __webpack_require__ ( 8 ) ;
2779
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_sf_message_directive__ = __webpack_require__ ( 10 ) ;
2780
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_sf_array_directive__ = __webpack_require__ ( 6 ) ;
2781
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_sf_key_directive__ = __webpack_require__ ( 9 ) ;
2782
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12_sf_schema_directive__ = __webpack_require__ ( 11 ) ;
2783
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13_schema_validate_directive__ = __webpack_require__ ( 5 ) ;
2771
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_sf_builder_provider__ = __webpack_require__ ( 13 ) ;
2772
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_schema_form_decorators_provider__ = __webpack_require__ ( 11 ) ;
2773
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_schema_form_provider__ = __webpack_require__ ( 12 ) ;
2774
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_sf_error_message_provider__ = __webpack_require__ ( 14 ) ;
2775
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_sf_path_provider__ = __webpack_require__ ( 15 ) ;
2776
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_sf_changed_directive__ = __webpack_require__ ( 6 ) ;
2777
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_sf_field_directive__ = __webpack_require__ ( 7 ) ;
2778
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_sf_message_directive__ = __webpack_require__ ( 9 ) ;
2779
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_sf_array_directive__ = __webpack_require__ ( 5 ) ;
2780
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_sf_key_directive__ = __webpack_require__ ( 8 ) ;
2781
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12_sf_schema_directive__ = __webpack_require__ ( 10 ) ;
2782
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13_schema_validate_directive__ = __webpack_require__ ( 4 ) ;
2784
2783
2785
2784
2786
2785
@@ -2834,7 +2833,7 @@ __WEBPACK_IMPORTED_MODULE_1_angular___default.a.module('schemaForm', deps)
2834
2833
. directive ( 'sfChanged' , __WEBPACK_IMPORTED_MODULE_7_sf_changed_directive__ [ "a" /* default */ ] ) . directive ( 'sfField' , [ '$parse' , '$compile' , '$http' , '$templateCache' , '$interpolate' , '$q' , 'sfErrorMessage' , 'sfPath' , 'sfSelect' , __WEBPACK_IMPORTED_MODULE_8_sf_field_directive__ [ "a" /* default */ ] ] ) . directive ( 'sfMessage' , [ '$injector' , 'sfErrorMessage' , __WEBPACK_IMPORTED_MODULE_9_sf_message_directive__ [ "a" /* default */ ] ] ) . directive ( 'sfNewArray' , [ 'sfSelect' , 'sfPath' , 'schemaForm' , __WEBPACK_IMPORTED_MODULE_10_sf_array_directive__ [ "a" /* default */ ] ] ) . directive ( 'sfSchema' , [ '$compile' , '$http' , '$templateCache' , '$q' , 'schemaForm' , 'schemaFormDecorators' , 'sfSelect' , 'sfPath' , 'sfBuilder' , __WEBPACK_IMPORTED_MODULE_12_sf_schema_directive__ [ "a" /* default */ ] ] ) . directive ( 'schemaValidate' , [ 'sfValidator' , '$parse' , 'sfSelect' , __WEBPACK_IMPORTED_MODULE_13_schema_validate_directive__ [ "a" /* default */ ] ] ) . directive ( 'sfKeyController' , [ 'schemaForm' , 'sfPath' , __WEBPACK_IMPORTED_MODULE_11_sf_key_directive__ [ "a" /* default */ ] ] ) ;
2835
2834
2836
2835
/***/ } ) ,
2837
- /* 5 */
2836
+ /* 4 */
2838
2837
/***/ ( function ( module , __webpack_exports__ , __webpack_require__ ) {
2839
2838
2840
2839
"use strict" ;
@@ -3024,12 +3023,14 @@ __WEBPACK_IMPORTED_MODULE_1_angular___default.a.module('schemaForm', deps)
3024
3023
} ;
3025
3024
3026
3025
/***/ } ) ,
3027
- /* 6 */
3026
+ /* 5 */
3028
3027
/***/ ( function ( module , __webpack_exports__ , __webpack_require__ ) {
3029
3028
3030
3029
"use strict" ;
3031
3030
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_angular__ = __webpack_require__ ( 0 ) ;
3032
3031
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_angular___default = __webpack_require__ . n ( __WEBPACK_IMPORTED_MODULE_0_angular__ ) ;
3032
+ var _typeof = typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ? function ( obj ) { return typeof obj ; } : function ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ;
3033
+
3033
3034
3034
3035
3035
3036
/**
@@ -3044,6 +3045,11 @@ __WEBPACK_IMPORTED_MODULE_1_angular___default.a.module('schemaForm', deps)
3044
3045
link : function link ( scope , element , attrs ) {
3045
3046
scope . min = 0 ;
3046
3047
3048
+ scope . trackBy = function ( item , index ) {
3049
+ if ( item && ( typeof item === 'undefined' ? 'undefined' : _typeof ( item ) ) === 'object' ) return item ;
3050
+ return index ;
3051
+ } ;
3052
+
3047
3053
scope . modelArray = scope . $eval ( attrs . sfNewArray ) ;
3048
3054
3049
3055
// We need to have a ngModel to hook into validation. It doesn't really play well with
@@ -3201,11 +3207,17 @@ __WEBPACK_IMPORTED_MODULE_1_angular___default.a.module('schemaForm', deps)
3201
3207
return model ;
3202
3208
} ;
3203
3209
3204
- scope . deleteFromArray = function ( index ) {
3210
+ scope . deleteFromArray = function ( item ) {
3211
+ var index = scope . modelArray . indexOf ( item ) ;
3205
3212
var model = scope . modelArray ;
3206
3213
if ( model ) {
3207
3214
model . splice ( index , 1 ) ;
3208
3215
}
3216
+
3217
+ if ( item . $$hashKey ) {
3218
+ scope . destroyed = item . $$hashKey ;
3219
+ }
3220
+
3209
3221
return model ;
3210
3222
} ;
3211
3223
@@ -3255,7 +3267,7 @@ __WEBPACK_IMPORTED_MODULE_1_angular___default.a.module('schemaForm', deps)
3255
3267
} ;
3256
3268
3257
3269
/***/ } ) ,
3258
- /* 7 */
3270
+ /* 6 */
3259
3271
/***/ ( function ( module , __webpack_exports__ , __webpack_require__ ) {
3260
3272
3261
3273
"use strict" ;
@@ -3301,7 +3313,7 @@ __WEBPACK_IMPORTED_MODULE_1_angular___default.a.module('schemaForm', deps)
3301
3313
} ;
3302
3314
3303
3315
/***/ } ) ,
3304
- /* 8 */
3316
+ /* 7 */
3305
3317
/***/ ( function ( module , __webpack_exports__ , __webpack_require__ ) {
3306
3318
3307
3319
"use strict" ;
@@ -3586,9 +3598,10 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
3586
3598
// in the form definition.
3587
3599
scope . $on ( '$destroy' , function ( ) {
3588
3600
var key = scope . getKey ( ) ;
3601
+ var arrayIndex = typeof scope . arrayIndex == 'number' ? scope . arrayIndex + 1 : 0 ;
3589
3602
3590
3603
// If the entire schema form is destroyed we don't touch the model
3591
- if ( ! scope . externalDestructionInProgress ) {
3604
+ if ( ! scope . externalDestructionInProgress && ( ! scope . model . $$hashKey || scope . model . $$hashKey === scope . destroyed ) ) {
3592
3605
var destroyStrategy = form . destroyStrategy || scope . options && scope . options . destroyStrategy || 'remove' ;
3593
3606
// No key no model, and we might have strategy 'retain'
3594
3607
if ( key && destroyStrategy !== 'retain' ) {
@@ -3630,7 +3643,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
3630
3643
} ;
3631
3644
3632
3645
/***/ } ) ,
3633
- /* 9 */
3646
+ /* 8 */
3634
3647
/***/ ( function ( module , __webpack_exports__ , __webpack_require__ ) {
3635
3648
3636
3649
"use strict" ;
@@ -3669,7 +3682,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
3669
3682
} ; ;
3670
3683
3671
3684
/***/ } ) ,
3672
- /* 10 */
3685
+ /* 9 */
3673
3686
/***/ ( function ( module , __webpack_exports__ , __webpack_require__ ) {
3674
3687
3675
3688
"use strict" ;
@@ -3773,7 +3786,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
3773
3786
} ;
3774
3787
3775
3788
/***/ } ) ,
3776
- /* 11 */
3789
+ /* 10 */
3777
3790
/***/ ( function ( module , __webpack_exports__ , __webpack_require__ ) {
3778
3791
3779
3792
"use strict" ;
@@ -4003,7 +4016,7 @@ FIXME: real documentation
4003
4016
} ;
4004
4017
4005
4018
/***/ } ) ,
4006
- /* 12 */
4019
+ /* 11 */
4007
4020
/***/ ( function ( module , __webpack_exports__ , __webpack_require__ ) {
4008
4021
4009
4022
"use strict" ;
@@ -4546,7 +4559,7 @@ FIXME: real documentation
4546
4559
} ; ;
4547
4560
4548
4561
/***/ } ) ,
4549
- /* 13 */
4562
+ /* 12 */
4550
4563
/***/ ( function ( module , __webpack_exports__ , __webpack_require__ ) {
4551
4564
4552
4565
"use strict" ;
@@ -4685,7 +4698,7 @@ FIXME: real documentation
4685
4698
} ;
4686
4699
4687
4700
/***/ } ) ,
4688
- /* 14 */
4701
+ /* 13 */
4689
4702
/***/ ( function ( module , __webpack_exports__ , __webpack_require__ ) {
4690
4703
4691
4704
"use strict" ;
@@ -5013,7 +5026,7 @@ FIXME: real documentation
5013
5026
} ;
5014
5027
5015
5028
/***/ } ) ,
5016
- /* 15 */
5029
+ /* 14 */
5017
5030
/***/ ( function ( module , __webpack_exports__ , __webpack_require__ ) {
5018
5031
5019
5032
"use strict" ;
@@ -5150,7 +5163,7 @@ FIXME: real documentation
5150
5163
} ;
5151
5164
5152
5165
/***/ } ) ,
5153
- /* 16 */
5166
+ /* 15 */
5154
5167
/***/ ( function ( module , __webpack_exports__ , __webpack_require__ ) {
5155
5168
5156
5169
"use strict" ;
@@ -5190,7 +5203,7 @@ var sfPathProviderClass = function () {
5190
5203
/* harmony default export */ __webpack_exports__ [ "a" ] = sfPathProviderClass ;
5191
5204
5192
5205
/***/ } ) ,
5193
- /* 17 */
5206
+ /* 16 */
5194
5207
/***/ ( function ( module , exports ) {
5195
5208
5196
5209
// shim for using process in browser
@@ -5376,7 +5389,7 @@ process.umask = function() { return 0; };
5376
5389
5377
5390
5378
5391
/***/ } ) ,
5379
- /* 18 */
5392
+ /* 17 */
5380
5393
/***/ ( function ( module , exports , __webpack_require__ ) {
5381
5394
5382
5395
/* WEBPACK VAR INJECTION */ ( function ( global , process ) { ( function ( global , undefined ) {
@@ -5566,10 +5579,10 @@ process.umask = function() { return 0; };
5566
5579
attachTo . clearImmediate = clearImmediate ;
5567
5580
} ( typeof self === "undefined" ? typeof global === "undefined" ? this : global : self ) ) ;
5568
5581
5569
- /* WEBPACK VAR INJECTION */ } . call ( exports , __webpack_require__ ( 2 ) , __webpack_require__ ( 17 ) ) )
5582
+ /* WEBPACK VAR INJECTION */ } . call ( exports , __webpack_require__ ( 2 ) , __webpack_require__ ( 16 ) ) )
5570
5583
5571
5584
/***/ } ) ,
5572
- /* 19 */
5585
+ /* 18 */
5573
5586
/***/ ( function ( module , exports , __webpack_require__ ) {
5574
5587
5575
5588
var apply = Function . prototype . apply ;
@@ -5622,18 +5635,17 @@ exports._unrefActive = exports.active = function(item) {
5622
5635
} ;
5623
5636
5624
5637
// setimmediate attaches itself to the global object
5625
- __webpack_require__ ( 18 ) ;
5638
+ __webpack_require__ ( 17 ) ;
5626
5639
exports . setImmediate = setImmediate ;
5627
5640
exports . clearImmediate = clearImmediate ;
5628
5641
5629
5642
5630
5643
/***/ } ) ,
5631
- /* 20 */ ,
5632
- /* 21 */
5644
+ /* 19 */
5633
5645
/***/ ( function ( module , exports , __webpack_require__ ) {
5634
5646
5635
5647
__webpack_require__ ( 1 ) ;
5636
- module . exports = __webpack_require__ ( 4 ) ;
5648
+ module . exports = __webpack_require__ ( 3 ) ;
5637
5649
5638
5650
5639
5651
/***/ } )
0 commit comments