ende 0.2.3 → 0.2.4
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.
- checksums.yaml +4 -4
- data/component.json +2 -1
- data/lib/assets/javascripts/aura/extensions/devise.js.coffee +3 -2
- data/lib/assets/javascripts/aura/extensions/models.js.coffee.erb +1 -2
- data/lib/assets/javascripts/aura/extensions/widget/lifecycleable.js.coffee +37 -16
- data/lib/assets/javascripts/ende.js.coffee +1 -1
- data/lib/assets/javascripts/widgets/dialog/main.js.coffee +100 -0
- data/lib/assets/javascripts/widgets/dialog/presenter.js.coffee +18 -0
- data/lib/assets/javascripts/widgets/dialog/states/default.html +2 -0
- data/lib/assets/javascripts/widgets/dialog/states/index.js.coffee +2 -0
- data/lib/assets/javascripts/widgets/list/main.js.coffee +1 -0
- data/lib/assets/stylesheets/ende.styl +1 -0
- data/lib/ende/version.rb +1 -1
- data/lib/ende.rb +6 -2
- data/vendor/assets/components/build.css +111 -0
- data/vendor/{components/indefinido-indemma/build/release.js → assets/components/build.js} +25468 -17590
- data/vendor/assets/components/ende_build.css +111 -0
- data/vendor/assets/components/ende_build.js +29571 -0
- data/vendor/assets/javascripts/ende/build.js +1962 -0
- data/vendor/components/component-classes/component.json +19 -0
- data/vendor/components/component-classes/index.js +165 -0
- data/vendor/components/component-css/component.json +18 -0
- data/vendor/components/component-css/index.js +34 -0
- data/vendor/components/component-delegate/component.json +2 -2
- data/vendor/components/component-delegate/index.js +4 -4
- data/vendor/components/component-dialog/component.json +23 -0
- data/vendor/components/component-dialog/dialog.css +92 -0
- data/vendor/components/component-dialog/index.js +292 -0
- data/vendor/components/component-dialog/template.js +1 -0
- data/vendor/components/component-dom/component.json +33 -0
- data/vendor/components/component-dom/index.js +725 -0
- data/vendor/components/component-domify/component.json +22 -0
- data/vendor/components/component-domify/index.js +71 -0
- data/vendor/components/component-emitter/component.json +13 -0
- data/vendor/components/component-emitter/index.js +156 -0
- data/vendor/components/component-event/index.js +8 -11
- data/vendor/components/component-indexof/component.json +15 -0
- data/vendor/components/component-indexof/index.js +10 -0
- data/vendor/components/component-overlay/component.json +22 -0
- data/vendor/components/component-overlay/index.js +111 -0
- data/vendor/components/component-overlay/overlay.css +19 -0
- data/vendor/components/component-overlay/template.js +1 -0
- data/vendor/components/component-query/component.json +2 -1
- data/vendor/components/component-sort/component.json +20 -0
- data/vendor/components/component-sort/index.js +43 -0
- data/vendor/components/component-value/component.json +25 -0
- data/vendor/components/component-value/index.js +95 -0
- data/vendor/components/indefinido-indemma/component.json +2 -3
- data/vendor/components/indefinido-indemma/lib/record/resource.js +2 -4
- data/vendor/components/mikeric-rivets/component.json +1 -1
- data/vendor/components/mikeric-rivets/dist/rivets.js +64 -44
- data/vendor/components/paulmillr-es6-shim/component.json +1 -1
- data/vendor/components/paulmillr-es6-shim/es6-shim.js +22 -11
- data/vendor/components/pluma-assimilate/component.json +1 -1
- data/vendor/components/pluma-assimilate/dist/assimilate.js +103 -63
- metadata +35 -246
- data/lib/tasks/component.thor +0 -63
- data/vendor/assets/components/KapIT-observe-utils/component.json +0 -16
- data/vendor/assets/components/KapIT-observe-utils/lib/observe-utils.js +0 -780
- data/vendor/assets/components/chaijs-assertion-error/component.json +0 -18
- data/vendor/assets/components/chaijs-assertion-error/index.js +0 -110
- data/vendor/assets/components/chaijs-chai/component.json +0 -47
- data/vendor/assets/components/chaijs-chai/index.js +0 -1
- data/vendor/assets/components/chaijs-chai/lib/chai/assertion.js +0 -130
- data/vendor/assets/components/chaijs-chai/lib/chai/core/assertions.js +0 -1270
- data/vendor/assets/components/chaijs-chai/lib/chai/interface/assert.js +0 -1080
- data/vendor/assets/components/chaijs-chai/lib/chai/interface/expect.js +0 -12
- data/vendor/assets/components/chaijs-chai/lib/chai/interface/should.js +0 -76
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/addChainableMethod.js +0 -94
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/addMethod.js +0 -37
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/addProperty.js +0 -40
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/flag.js +0 -32
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/getActual.js +0 -19
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/getEnumerableProperties.js +0 -25
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/getMessage.js +0 -49
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/getName.js +0 -20
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/getPathValue.js +0 -102
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/getProperties.js +0 -35
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/index.js +0 -108
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/inspect.js +0 -320
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/objDisplay.js +0 -48
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/overwriteMethod.js +0 -51
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/overwriteProperty.js +0 -54
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/test.js +0 -26
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/transferFlags.js +0 -44
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/type.js +0 -45
- data/vendor/assets/components/chaijs-chai/lib/chai.js +0 -80
- data/vendor/assets/components/chaijs-deep-eql/component.json +0 -18
- data/vendor/assets/components/chaijs-deep-eql/lib/eql.js +0 -257
- data/vendor/assets/components/chaijs-type-detect/component.json +0 -16
- data/vendor/assets/components/chaijs-type-detect/lib/type.js +0 -142
- data/vendor/assets/components/component-bind/component.json +0 -14
- data/vendor/assets/components/component-bind/index.js +0 -24
- data/vendor/assets/components/component-delegate/component.json +0 -19
- data/vendor/assets/components/component-delegate/index.js +0 -42
- data/vendor/assets/components/component-event/component.json +0 -13
- data/vendor/assets/components/component-event/index.js +0 -40
- data/vendor/assets/components/component-jquery/component.json +0 -14
- data/vendor/assets/components/component-jquery/index.js +0 -9601
- data/vendor/assets/components/component-link-delegate/component.json +0 -23
- data/vendor/assets/components/component-link-delegate/index.js +0 -60
- data/vendor/assets/components/component-matches-selector/component.json +0 -20
- data/vendor/assets/components/component-matches-selector/index.js +0 -45
- data/vendor/assets/components/component-query/component.json +0 -21
- data/vendor/assets/components/component-query/index.js +0 -21
- data/vendor/assets/components/component-type/component.json +0 -18
- data/vendor/assets/components/component-type/index.js +0 -32
- data/vendor/assets/components/component-url/component.json +0 -17
- data/vendor/assets/components/component-url/index.js +0 -63
- data/vendor/assets/components/discore-closest/component.json +0 -14
- data/vendor/assets/components/discore-closest/index.js +0 -18
- data/vendor/assets/components/indefinido-advisable/component.json +0 -21
- data/vendor/assets/components/indefinido-advisable/index.js +0 -1
- data/vendor/assets/components/indefinido-advisable/lib/advisable.js +0 -60
- data/vendor/assets/components/indefinido-indemma/component.json +0 -40
- data/vendor/assets/components/indefinido-indemma/index.js +0 -1
- data/vendor/assets/components/indefinido-indemma/lib/extensions/rivets.js +0 -23
- data/vendor/assets/components/indefinido-indemma/lib/record/associable.js +0 -217
- data/vendor/assets/components/indefinido-indemma/lib/record/maid.js +0 -24
- data/vendor/assets/components/indefinido-indemma/lib/record/resource.js +0 -104
- data/vendor/assets/components/indefinido-indemma/lib/record/rest.js +0 -36
- data/vendor/assets/components/indefinido-indemma/lib/record/restfulable.js +0 -326
- data/vendor/assets/components/indefinido-indemma/lib/record/scopable.js +0 -279
- data/vendor/assets/components/indefinido-indemma/lib/record/translationable.js +0 -19
- data/vendor/assets/components/indefinido-indemma/lib/record/validatable.js +0 -216
- data/vendor/assets/components/indefinido-indemma/lib/record/validations/associated.js +0 -30
- data/vendor/assets/components/indefinido-indemma/lib/record/validations/confirmation.js +0 -19
- data/vendor/assets/components/indefinido-indemma/lib/record/validations/cpf.js +0 -60
- data/vendor/assets/components/indefinido-indemma/lib/record/validations/presence.js +0 -19
- data/vendor/assets/components/indefinido-indemma/lib/record/validations/remote.js +0 -71
- data/vendor/assets/components/indefinido-indemma/lib/record.js +0 -167
- data/vendor/assets/components/indefinido-indemma/vendor/sinon.js +0 -4290
- data/vendor/assets/components/indefinido-indemma/vendor/stampit.js +0 -392
- data/vendor/assets/components/indefinido-observable/component.json +0 -25
- data/vendor/assets/components/indefinido-observable/components/cjohansen-sinon/sinon.js +0 -4290
- data/vendor/assets/components/indefinido-observable/index.js +0 -1
- data/vendor/assets/components/indefinido-observable/lib/adapters/rivets.js +0 -26
- data/vendor/assets/components/indefinido-observable/lib/observable.js +0 -320
- data/vendor/assets/components/indefinido-observable/vendor/shims/accessors-legacy.js +0 -92
- data/vendor/assets/components/indefinido-observable/vendor/shims/accessors.js +0 -173
- data/vendor/assets/components/indefinido-observable/vendor/shims/array.indexOf.js +0 -8
- data/vendor/assets/components/indefinido-observable/vendor/shims/object.create.js +0 -77
- data/vendor/assets/components/mikeric-rivets/component.json +0 -15
- data/vendor/assets/components/mikeric-rivets/dist/rivets.js +0 -1020
- data/vendor/assets/components/paulmillr-es6-shim/component.json +0 -17
- data/vendor/assets/components/paulmillr-es6-shim/es6-shim.js +0 -985
- data/vendor/assets/components/pluma-assimilate/component.json +0 -25
- data/vendor/assets/components/pluma-assimilate/dist/assimilate.js +0 -87
- data/vendor/assets/components/segmentio-extend/component.json +0 -13
- data/vendor/assets/components/segmentio-extend/index.js +0 -15
- data/vendor/components/chaijs-assertion-error/component.json +0 -18
- data/vendor/components/chaijs-assertion-error/index.js +0 -110
- data/vendor/components/chaijs-chai/component.json +0 -47
- data/vendor/components/chaijs-chai/index.js +0 -1
- data/vendor/components/chaijs-chai/lib/chai/assertion.js +0 -130
- data/vendor/components/chaijs-chai/lib/chai/core/assertions.js +0 -1270
- data/vendor/components/chaijs-chai/lib/chai/interface/assert.js +0 -1080
- data/vendor/components/chaijs-chai/lib/chai/interface/expect.js +0 -12
- data/vendor/components/chaijs-chai/lib/chai/interface/should.js +0 -76
- data/vendor/components/chaijs-chai/lib/chai/utils/addChainableMethod.js +0 -94
- data/vendor/components/chaijs-chai/lib/chai/utils/addMethod.js +0 -37
- data/vendor/components/chaijs-chai/lib/chai/utils/addProperty.js +0 -40
- data/vendor/components/chaijs-chai/lib/chai/utils/flag.js +0 -32
- data/vendor/components/chaijs-chai/lib/chai/utils/getActual.js +0 -19
- data/vendor/components/chaijs-chai/lib/chai/utils/getEnumerableProperties.js +0 -25
- data/vendor/components/chaijs-chai/lib/chai/utils/getMessage.js +0 -49
- data/vendor/components/chaijs-chai/lib/chai/utils/getName.js +0 -20
- data/vendor/components/chaijs-chai/lib/chai/utils/getPathValue.js +0 -102
- data/vendor/components/chaijs-chai/lib/chai/utils/getProperties.js +0 -35
- data/vendor/components/chaijs-chai/lib/chai/utils/index.js +0 -108
- data/vendor/components/chaijs-chai/lib/chai/utils/inspect.js +0 -320
- data/vendor/components/chaijs-chai/lib/chai/utils/objDisplay.js +0 -48
- data/vendor/components/chaijs-chai/lib/chai/utils/overwriteMethod.js +0 -51
- data/vendor/components/chaijs-chai/lib/chai/utils/overwriteProperty.js +0 -54
- data/vendor/components/chaijs-chai/lib/chai/utils/test.js +0 -26
- data/vendor/components/chaijs-chai/lib/chai/utils/transferFlags.js +0 -44
- data/vendor/components/chaijs-chai/lib/chai/utils/type.js +0 -45
- data/vendor/components/chaijs-chai/lib/chai.js +0 -80
- data/vendor/components/chaijs-deep-eql/component.json +0 -18
- data/vendor/components/chaijs-deep-eql/lib/eql.js +0 -257
- data/vendor/components/chaijs-type-detect/component.json +0 -16
- data/vendor/components/chaijs-type-detect/lib/type.js +0 -142
- data/vendor/components/component-link-delegate/component.json +0 -23
- data/vendor/components/component-link-delegate/index.js +0 -60
- data/vendor/components/component-url/component.json +0 -17
- data/vendor/components/component-url/index.js +0 -63
- data/vendor/components/discore-closest/component.json +0 -14
- data/vendor/components/discore-closest/index.js +0 -18
- data/vendor/components/indefinido-indemma/.gitignore +0 -14
- data/vendor/components/indefinido-indemma/.ruby-gemset +0 -1
- data/vendor/components/indefinido-indemma/.ruby-version +0 -1
- data/vendor/components/indefinido-indemma/Gemfile +0 -13
- data/vendor/components/indefinido-indemma/Guardfile +0 -39
- data/vendor/components/indefinido-indemma/History.md +0 -0
- data/vendor/components/indefinido-indemma/Readme.md +0 -443
- data/vendor/components/indefinido-indemma/build/development.js +0 -331
- data/vendor/components/indefinido-indemma/build/test.js +0 -331
- data/vendor/components/indefinido-indemma/components/chaijs-assertion-error/component.json +0 -18
- data/vendor/components/indefinido-indemma/components/chaijs-assertion-error/index.js +0 -110
- data/vendor/components/indefinido-indemma/components/chaijs-chai/component.json +0 -47
- data/vendor/components/indefinido-indemma/components/chaijs-chai/index.js +0 -1
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/assertion.js +0 -130
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/core/assertions.js +0 -1270
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/interface/assert.js +0 -1080
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/interface/expect.js +0 -12
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/interface/should.js +0 -76
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/addChainableMethod.js +0 -94
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/addMethod.js +0 -37
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/addProperty.js +0 -40
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/eql.js +0 -129
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/flag.js +0 -32
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getActual.js +0 -19
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getEnumerableProperties.js +0 -25
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getMessage.js +0 -49
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getName.js +0 -20
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getPathValue.js +0 -102
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getProperties.js +0 -35
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/index.js +0 -108
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/inspect.js +0 -320
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/objDisplay.js +0 -48
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/overwriteMethod.js +0 -51
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/overwriteProperty.js +0 -54
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/test.js +0 -26
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/transferFlags.js +0 -44
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/type.js +0 -45
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai.js +0 -80
- data/vendor/components/indefinido-indemma/components/component-bind/component.json +0 -14
- data/vendor/components/indefinido-indemma/components/component-bind/index.js +0 -24
- data/vendor/components/indefinido-indemma/components/component-jquery/component.json +0 -14
- data/vendor/components/indefinido-indemma/components/component-jquery/index.js +0 -9601
- data/vendor/components/indefinido-indemma/components/component-type/component.json +0 -18
- data/vendor/components/indefinido-indemma/components/component-type/index.js +0 -32
- data/vendor/components/indefinido-indemma/components/indefinido-advisable/component.json +0 -21
- data/vendor/components/indefinido-indemma/components/indefinido-advisable/index.js +0 -1
- data/vendor/components/indefinido-indemma/components/indefinido-advisable/lib/advisable.js +0 -60
- data/vendor/components/indefinido-indemma/components/indefinido-observable/component.json +0 -25
- data/vendor/components/indefinido-indemma/components/indefinido-observable/components/cjohansen-sinon/sinon.js +0 -4290
- data/vendor/components/indefinido-indemma/components/indefinido-observable/index.js +0 -1
- data/vendor/components/indefinido-indemma/components/indefinido-observable/lib/adapters/rivets.js +0 -26
- data/vendor/components/indefinido-indemma/components/indefinido-observable/lib/observable.js +0 -323
- data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/accessors-legacy.js +0 -92
- data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/accessors.js +0 -173
- data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/array.indexOf.js +0 -8
- data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/object.create.js +0 -77
- data/vendor/components/indefinido-indemma/components/kapit-observe-utils/component.json +0 -13
- data/vendor/components/indefinido-indemma/components/pluma-assimilate/component.json +0 -25
- data/vendor/components/indefinido-indemma/components/pluma-assimilate/dist/assimilate.js +0 -87
- data/vendor/components/indefinido-indemma/karma.conf.js +0 -86
- data/vendor/components/indefinido-indemma/lib/record/errors.js +0 -1
- data/vendor/components/indefinido-indemma/spec/record/associable_spec.js +0 -76
- data/vendor/components/indefinido-indemma/spec/record/resource_spec.js +0 -90
- data/vendor/components/indefinido-indemma/spec/record/rest_spec.js +0 -32
- data/vendor/components/indefinido-indemma/spec/record/restfulable_spec.js +0 -232
- data/vendor/components/indefinido-indemma/spec/record/scopable_spec.js +0 -201
- data/vendor/components/indefinido-indemma/spec/record/translationable.js +0 -28
- data/vendor/components/indefinido-indemma/spec/record/validatable_spec.js +0 -111
- data/vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js +0 -43
- data/vendor/components/indefinido-indemma/spec/record/validations/confirmation_spec.js +0 -36
- data/vendor/components/indefinido-indemma/spec/record/validations/cpf_spec.js +0 -35
- data/vendor/components/indefinido-indemma/spec/record/validations/presence_spec.js +0 -28
- data/vendor/components/indefinido-indemma/spec/record/validations/remote_spec.js +0 -86
- data/vendor/components/indefinido-indemma/spec/record/validations/type_spec.js +0 -48
- data/vendor/components/indefinido-indemma/spec/record_spec.js +0 -37
- data/vendor/components/indefinido-indemma/spec/spec_helper.js +0 -11
- data/vendor/components/indefinido-indemma/spec/support/value_objects/phone.js +0 -45
- data/vendor/components/indefinido-indemma/src/lib/extensions/rivets.coffee +0 -17
- data/vendor/components/indefinido-indemma/src/lib/record/associable.coffee +0 -173
- data/vendor/components/indefinido-indemma/src/lib/record/errors.coffee +0 -20
- data/vendor/components/indefinido-indemma/src/lib/record/maid.coffee +0 -16
- data/vendor/components/indefinido-indemma/src/lib/record/resource.coffee +0 -103
- data/vendor/components/indefinido-indemma/src/lib/record/rest.coffee +0 -28
- data/vendor/components/indefinido-indemma/src/lib/record/restfulable.coffee +0 -314
- data/vendor/components/indefinido-indemma/src/lib/record/scopable.coffee +0 -266
- data/vendor/components/indefinido-indemma/src/lib/record/translationable.coffee +0 -18
- data/vendor/components/indefinido-indemma/src/lib/record/validatable.coffee +0 -209
- data/vendor/components/indefinido-indemma/src/lib/record/validations/associated.coffee +0 -32
- data/vendor/components/indefinido-indemma/src/lib/record/validations/confirmation.coffee +0 -19
- data/vendor/components/indefinido-indemma/src/lib/record/validations/cpf.coffee +0 -58
- data/vendor/components/indefinido-indemma/src/lib/record/validations/presence.coffee +0 -19
- data/vendor/components/indefinido-indemma/src/lib/record/validations/remote.coffee +0 -65
- data/vendor/components/indefinido-indemma/src/lib/record/validations/type.coffee +0 -32
- data/vendor/components/indefinido-indemma/src/lib/record.coffee +0 -123
- data/vendor/components/indefinido-indemma/src/spec/record/associable_spec.coffee +0 -63
- data/vendor/components/indefinido-indemma/src/spec/record/resource_spec.coffee +0 -64
- data/vendor/components/indefinido-indemma/src/spec/record/rest_spec.coffee +0 -22
- data/vendor/components/indefinido-indemma/src/spec/record/restfulable_spec.coffee +0 -164
- data/vendor/components/indefinido-indemma/src/spec/record/scopable_spec.coffee +0 -181
- data/vendor/components/indefinido-indemma/src/spec/record/translationable.coffee +0 -19
- data/vendor/components/indefinido-indemma/src/spec/record/validatable_spec.coffee +0 -100
- data/vendor/components/indefinido-indemma/src/spec/record/validations/associated_spec.coffee +0 -35
- data/vendor/components/indefinido-indemma/src/spec/record/validations/confirmation_spec.coffee +0 -25
- data/vendor/components/indefinido-indemma/src/spec/record/validations/cpf_spec.coffee +0 -28
- data/vendor/components/indefinido-indemma/src/spec/record/validations/presence_spec.coffee +0 -24
- data/vendor/components/indefinido-indemma/src/spec/record/validations/remote_spec.coffee +0 -72
- data/vendor/components/indefinido-indemma/src/spec/record/validations/type_spec.coffee +0 -33
- data/vendor/components/indefinido-indemma/src/spec/record_spec.coffee +0 -23
- data/vendor/components/indefinido-indemma/src/spec/spec_helper.coffee +0 -9
- data/vendor/components/indefinido-indemma/src/spec/support/value_objects/phone.coffee +0 -30
- data/vendor/components/indefinido-indemma/vendor/owl/pluralize.js +0 -190
|
@@ -1,780 +0,0 @@
|
|
|
1
|
-
// Copyright 2012 Kap IT (http://www.kapit.fr/)
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the 'License');
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an 'AS IS' BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
// Author : François de Campredon (http://francois.de-campredon.fr/),
|
|
15
|
-
|
|
16
|
-
// ObjectUtils
|
|
17
|
-
// ===========
|
|
18
|
-
|
|
19
|
-
(function (global) {
|
|
20
|
-
'use strict';
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @namespace
|
|
24
|
-
*/
|
|
25
|
-
var ObserveUtils;
|
|
26
|
-
if (typeof exports !== 'undefined') {
|
|
27
|
-
ObserveUtils = exports;
|
|
28
|
-
} else {
|
|
29
|
-
ObserveUtils = global.ObserveUtils = {};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Utilities
|
|
33
|
-
// ---------
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// borrowing some array methods
|
|
37
|
-
var slice = Function.call.bind(Array.prototype.slice),
|
|
38
|
-
map = Function.call.bind(Array.prototype.map);
|
|
39
|
-
|
|
40
|
-
// return true if the given property descriptor contains accessor
|
|
41
|
-
function isAccessorDescriptor(desc) {
|
|
42
|
-
if (typeof desc === 'undefined') {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
return ('get' in desc || 'set' in desc);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// getPropertyDescriptor shim
|
|
51
|
-
// copied from [es6-shim](https://github.com/paulmillr/es6-shim)
|
|
52
|
-
function getPropertyDescriptor(target, name) {
|
|
53
|
-
var pd = Object.getOwnPropertyDescriptor(target, name),
|
|
54
|
-
proto = Object.getPrototypeOf(target);
|
|
55
|
-
while (typeof pd === 'undefined' && proto !== null) {
|
|
56
|
-
pd = Object.getOwnPropertyDescriptor(proto, name);
|
|
57
|
-
proto = Object.getPrototypeOf(proto);
|
|
58
|
-
}
|
|
59
|
-
return pd;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
// egal shim
|
|
65
|
-
// copied from [the ecmascript wiki](http://wiki.ecmascript.org/doku.php?id=harmony:egal)
|
|
66
|
-
function sameValue(x, y) {
|
|
67
|
-
if (x === y) {
|
|
68
|
-
// 0 === -0, but they are not identical
|
|
69
|
-
return x !== 0 || 1 / x === 1 / y;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// NaN !== NaN, but they are identical.
|
|
73
|
-
// NaNs are the only non-reflexive value, i.e., if x !== x,
|
|
74
|
-
// then x is a NaN.
|
|
75
|
-
// isNaN is broken: it converts its argument to number, so
|
|
76
|
-
// isNaN('foo') => true
|
|
77
|
-
return x !== x && y !== y;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// cast a value as number, and test if the obtained result
|
|
81
|
-
// is a positive finite integer, throw an error otherwise
|
|
82
|
-
function isPositiveFiniteInteger(value, errorMessage) {
|
|
83
|
-
value = Number(value);
|
|
84
|
-
if (isNaN(value) || !isFinite(value) || value < 0 || value % 1 !== 0) {
|
|
85
|
-
throw new RangeError(errorMessage.replace('$', value));
|
|
86
|
-
}
|
|
87
|
-
return value;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// defineObservableProperties Implementation
|
|
91
|
-
// ------------------------------------------
|
|
92
|
-
|
|
93
|
-
// Uid generation helper
|
|
94
|
-
var uidCounter = 0;
|
|
95
|
-
|
|
96
|
-
// Define a property on an object that will call the Notifier.notify method when updated
|
|
97
|
-
function defineObservableProperty(target, property, originalValue) {
|
|
98
|
-
|
|
99
|
-
//we store the value in an non-enumerable property with generated unique name
|
|
100
|
-
var internalPropName = '_' + (uidCounter++) + property;
|
|
101
|
-
|
|
102
|
-
Object.defineProperty(target, internalPropName, {
|
|
103
|
-
value: originalValue,
|
|
104
|
-
writable: true,
|
|
105
|
-
enumerable: false,
|
|
106
|
-
configurable: true
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
//then we create accessor method for our 'hidden' property,
|
|
110
|
-
// that dispatch changesRecords when the value is updated
|
|
111
|
-
Object.defineProperty(target, property, {
|
|
112
|
-
get: function () {
|
|
113
|
-
return this[internalPropName];
|
|
114
|
-
},
|
|
115
|
-
set: function (value) {
|
|
116
|
-
if (!sameValue(value, this[internalPropName])) {
|
|
117
|
-
var oldValue = this[internalPropName];
|
|
118
|
-
Object.defineProperty(target, internalPropName, {
|
|
119
|
-
value: value,
|
|
120
|
-
writable: true,
|
|
121
|
-
enumerable: false,
|
|
122
|
-
configurable: true
|
|
123
|
-
});
|
|
124
|
-
var notifier = Object.getNotifier(this);
|
|
125
|
-
notifier.notify({ type: 'updated', name: property, oldValue: oldValue });
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
enumerable: true,
|
|
129
|
-
configurable: true
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
// call defineObservableProperty for each property name passed as 'rest argument'
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Define observable properties on the given object an return it.
|
|
138
|
-
*
|
|
139
|
-
* @param {Object} target
|
|
140
|
-
* @param {...string} properties
|
|
141
|
-
* @returns {Object}
|
|
142
|
-
*/
|
|
143
|
-
ObserveUtils.defineObservableProperties = function (target, properties) {
|
|
144
|
-
if (Object(target) !== target) {
|
|
145
|
-
throw new TypeError('target must be an Object, given ' + target);
|
|
146
|
-
}
|
|
147
|
-
properties = slice(arguments, 1);
|
|
148
|
-
while (properties.length > 0) {
|
|
149
|
-
var property = properties.shift(),
|
|
150
|
-
descriptor = getPropertyDescriptor(target, property);
|
|
151
|
-
|
|
152
|
-
if (!descriptor || !isAccessorDescriptor(descriptor)) {
|
|
153
|
-
var originalValue = descriptor && descriptor.value;
|
|
154
|
-
defineObservableProperty(target, property, originalValue);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
return target;
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
// List Implementation
|
|
163
|
-
// ------------------------------------------
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
*
|
|
167
|
-
* @param length
|
|
168
|
-
* @returns {*}
|
|
169
|
-
* @constructor
|
|
170
|
-
* @function
|
|
171
|
-
*/
|
|
172
|
-
function List(length) {
|
|
173
|
-
if (arguments.length === 0) {
|
|
174
|
-
length = 0;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// in this case we create a list with a given length
|
|
178
|
-
if (arguments.length <= 1 && typeof length === 'number') {
|
|
179
|
-
if (this instanceof List) {
|
|
180
|
-
this.length = length;
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
return new List(length);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
//here we create a list with initial values
|
|
188
|
-
if (!(this instanceof List)) {
|
|
189
|
-
return List.fromArray(slice(arguments));
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
for (var i = 0, l = arguments.length ; i < l ; i++) {
|
|
193
|
-
this[i] = arguments[i];
|
|
194
|
-
}
|
|
195
|
-
this.length = arguments.length;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Observe a list
|
|
202
|
-
* @param {List} list
|
|
203
|
-
* @param {function} observer
|
|
204
|
-
*/
|
|
205
|
-
List.observe = function observe(list, observer) {
|
|
206
|
-
Object.observe(list, observer, ['new', 'updated', 'deleted', 'splice']);
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Unobserve a list
|
|
212
|
-
* @param {List} list
|
|
213
|
-
* @param {function} observer
|
|
214
|
-
*/
|
|
215
|
-
List.unobserve = function unobserve(list, observer) {
|
|
216
|
-
Object.unobserve(list, observer);
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Create a list from a given array
|
|
221
|
-
* @param array
|
|
222
|
-
* @returns {List}
|
|
223
|
-
*/
|
|
224
|
-
List.fromArray = function (array) {
|
|
225
|
-
if (!Array.isArray(array)) {
|
|
226
|
-
throw new Error();
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
var list = new List();
|
|
230
|
-
for (var i = 0, l = array.length ; i < l ; i++) {
|
|
231
|
-
list[i] = array[i];
|
|
232
|
-
}
|
|
233
|
-
list.length = array.length;
|
|
234
|
-
return list;
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
Object.defineProperties(List.prototype, {
|
|
238
|
-
/**
|
|
239
|
-
* hidden value holder for the length property
|
|
240
|
-
* @private
|
|
241
|
-
*/
|
|
242
|
-
'_length' : {
|
|
243
|
-
value : 0,
|
|
244
|
-
enumerable: false,
|
|
245
|
-
configurable: true,
|
|
246
|
-
writable: true
|
|
247
|
-
},
|
|
248
|
-
/**
|
|
249
|
-
* the length of the list
|
|
250
|
-
* @property {number} length
|
|
251
|
-
*/
|
|
252
|
-
'length' : {
|
|
253
|
-
get : function () {
|
|
254
|
-
return this._length;
|
|
255
|
-
},
|
|
256
|
-
set : function (value) {
|
|
257
|
-
value = isPositiveFiniteInteger(value, 'Invalid list length : $');
|
|
258
|
-
var notifier = Object.getNotifier(this),
|
|
259
|
-
oldValue = this._length,
|
|
260
|
-
removed = [],
|
|
261
|
-
self = this;
|
|
262
|
-
if (value !== oldValue) {
|
|
263
|
-
notifier.performChange('splice', function () {
|
|
264
|
-
Object.defineProperty(self, '_length', {
|
|
265
|
-
value : value,
|
|
266
|
-
enumerable: false,
|
|
267
|
-
configurable: true,
|
|
268
|
-
writable: true
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
if (oldValue > value) {
|
|
272
|
-
//delete values if the length have been decreased
|
|
273
|
-
for (var i = value; i < oldValue; i++) {
|
|
274
|
-
removed.push(self[i]);
|
|
275
|
-
self.delete(i);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
notifier.notify({ type: 'updated', name: 'length', oldValue: oldValue });
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
if (oldValue > value) {
|
|
283
|
-
notifier.notify({
|
|
284
|
-
type: 'splice',
|
|
285
|
-
index : value,
|
|
286
|
-
removed : removed,
|
|
287
|
-
addedCount: 0
|
|
288
|
-
});
|
|
289
|
-
} else {
|
|
290
|
-
notifier.notify({
|
|
291
|
-
type: 'splice',
|
|
292
|
-
index : oldValue,
|
|
293
|
-
removed : removed,
|
|
294
|
-
addedCount: value - oldValue
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
},
|
|
299
|
-
enumerable: true,
|
|
300
|
-
configurable : true
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Returns an Array copy of the list
|
|
306
|
-
* @returns {Array}
|
|
307
|
-
*/
|
|
308
|
-
List.prototype.toArray = function () {
|
|
309
|
-
return slice(this);
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* Returns an string representation of the list
|
|
314
|
-
* @returns {string}
|
|
315
|
-
*/
|
|
316
|
-
List.prototype.toString = function () {
|
|
317
|
-
return this.toArray().toString();
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* Returns an json representation of the list
|
|
323
|
-
* @returns {string}
|
|
324
|
-
*/
|
|
325
|
-
List.prototype.toJSON = function () {
|
|
326
|
-
return JSON.stringify(this.toArray());
|
|
327
|
-
};
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* set the givent value at the specified index.
|
|
331
|
-
* @param {number} index
|
|
332
|
-
* @param {*} value
|
|
333
|
-
* @return {*}
|
|
334
|
-
*/
|
|
335
|
-
List.prototype.set = function (index, value) {
|
|
336
|
-
index = isPositiveFiniteInteger(index, 'Invalid index : $');
|
|
337
|
-
|
|
338
|
-
var notifier = Object.getNotifier(this),
|
|
339
|
-
len = this.length,
|
|
340
|
-
self = this;
|
|
341
|
-
if (index >= len) {
|
|
342
|
-
notifier.performChange('splice', function () {
|
|
343
|
-
self[index] = value;
|
|
344
|
-
notifier.notify({ type: 'new', name: index});
|
|
345
|
-
Object.defineProperty(self, '_length', {
|
|
346
|
-
value : index + 1,
|
|
347
|
-
enumerable: false,
|
|
348
|
-
configurable: true,
|
|
349
|
-
writable: true
|
|
350
|
-
});
|
|
351
|
-
notifier.notify({ type: 'updated', name: 'length', oldValue: len });
|
|
352
|
-
});
|
|
353
|
-
|
|
354
|
-
notifier.notify({
|
|
355
|
-
type: 'splice',
|
|
356
|
-
index : len,
|
|
357
|
-
removed : [],
|
|
358
|
-
addedCount: this.length - len
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
else if (!sameValue(value, this[index])) {
|
|
362
|
-
var oldValue = this[index];
|
|
363
|
-
this[index] = value;
|
|
364
|
-
notifier.notify({ type: 'updated', name: index, oldValue: oldValue });
|
|
365
|
-
}
|
|
366
|
-
return value;
|
|
367
|
-
};
|
|
368
|
-
|
|
369
|
-
/**
|
|
370
|
-
* delete the value at the specified index.
|
|
371
|
-
* @param {number} index
|
|
372
|
-
* @return {boolean}
|
|
373
|
-
*/
|
|
374
|
-
List.prototype.delete = function (index) {
|
|
375
|
-
index = isPositiveFiniteInteger(index, 'Invalid index : $');
|
|
376
|
-
if (this.hasOwnProperty(index)) {
|
|
377
|
-
var oldValue = this[index];
|
|
378
|
-
if (delete this[index]) {
|
|
379
|
-
var notifier = Object.getNotifier(this);
|
|
380
|
-
notifier.notify({ type: 'deleted', name: index, oldValue: oldValue });
|
|
381
|
-
return true;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
return false;
|
|
385
|
-
};
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* create a new list resulting of the concatenation of all the List and array
|
|
389
|
-
* passed as parameter with the addition of other values passed as parameter
|
|
390
|
-
* @param {...*} args
|
|
391
|
-
* @return {List}
|
|
392
|
-
*/
|
|
393
|
-
List.prototype.concat = function (args) {
|
|
394
|
-
args = map(arguments, function (item) {
|
|
395
|
-
return (item instanceof List) ? item.toArray() : item;
|
|
396
|
-
});
|
|
397
|
-
return List.fromArray(Array.prototype.concat.apply(this.toArray(), args));
|
|
398
|
-
};
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
* Joins all elements of a List into a string.
|
|
402
|
-
* @param {string} [separator]
|
|
403
|
-
* @return {string}
|
|
404
|
-
*/
|
|
405
|
-
List.prototype.join = function (separator) {
|
|
406
|
-
return this.toArray().join(separator);
|
|
407
|
-
};
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
* Removes the last element from a List and returns that element.
|
|
412
|
-
* @return {*}
|
|
413
|
-
*/
|
|
414
|
-
List.prototype.pop = function () {
|
|
415
|
-
if (Object(this) !== this) {
|
|
416
|
-
throw new TypeError('TODO');
|
|
417
|
-
}
|
|
418
|
-
var len = isPositiveFiniteInteger(this.length, 'TODO');
|
|
419
|
-
if (len === 0) {
|
|
420
|
-
return void(0);
|
|
421
|
-
} else {
|
|
422
|
-
var newLen = len - 1,
|
|
423
|
-
element = this[newLen],
|
|
424
|
-
notifier = Object.getNotifier(this),
|
|
425
|
-
self = this;
|
|
426
|
-
notifier.performChange('splice', function () {
|
|
427
|
-
delete self[newLen];
|
|
428
|
-
notifier.notify({ type: 'deleted', name: newLen, oldValue: element });
|
|
429
|
-
Object.defineProperty(self, '_length', {
|
|
430
|
-
value : newLen,
|
|
431
|
-
enumerable: false,
|
|
432
|
-
configurable: true,
|
|
433
|
-
writable: true
|
|
434
|
-
});
|
|
435
|
-
notifier.notify({ type: 'updated', name: 'length', oldValue: len });
|
|
436
|
-
});
|
|
437
|
-
|
|
438
|
-
notifier.notify({
|
|
439
|
-
type: 'splice',
|
|
440
|
-
index : newLen,
|
|
441
|
-
removed : [element],
|
|
442
|
-
addedCount: 0
|
|
443
|
-
});
|
|
444
|
-
|
|
445
|
-
return element;
|
|
446
|
-
}
|
|
447
|
-
};
|
|
448
|
-
|
|
449
|
-
/**
|
|
450
|
-
* Mutates a List by appending the given elements and returning the new length of the array.
|
|
451
|
-
* @param {...*} items
|
|
452
|
-
* @return {number}
|
|
453
|
-
*/
|
|
454
|
-
List.prototype.push = function () {
|
|
455
|
-
if (arguments.length > 0) {
|
|
456
|
-
var argumentsLength = arguments.length,
|
|
457
|
-
elements = arguments,
|
|
458
|
-
len = this.length,
|
|
459
|
-
notifier = Object.getNotifier(this),
|
|
460
|
-
self = this,
|
|
461
|
-
i, index;
|
|
462
|
-
notifier.performChange('splice', function () {
|
|
463
|
-
for (i = 0; i < argumentsLength; i++) {
|
|
464
|
-
index = len + i;
|
|
465
|
-
// avoid the usage of the set function and manually
|
|
466
|
-
// set the value and notify the changes to avoid the notification of
|
|
467
|
-
// multiple length modification
|
|
468
|
-
self[index] = elements[i];
|
|
469
|
-
notifier.notify({
|
|
470
|
-
type : 'new',
|
|
471
|
-
name : index
|
|
472
|
-
});
|
|
473
|
-
}
|
|
474
|
-
Object.defineProperty(self, '_length', {
|
|
475
|
-
value : len + argumentsLength,
|
|
476
|
-
enumerable: false,
|
|
477
|
-
configurable: true,
|
|
478
|
-
writable: true
|
|
479
|
-
});
|
|
480
|
-
notifier.notify({ type: 'updated', name: 'length', oldValue: len });
|
|
481
|
-
});
|
|
482
|
-
|
|
483
|
-
notifier.notify({
|
|
484
|
-
type: 'splice',
|
|
485
|
-
index : len,
|
|
486
|
-
removed : [],
|
|
487
|
-
addedCount: argumentsLength
|
|
488
|
-
});
|
|
489
|
-
}
|
|
490
|
-
return this.length;
|
|
491
|
-
};
|
|
492
|
-
|
|
493
|
-
/**
|
|
494
|
-
* Reverses a List in place. The first List element becomes the last and the last becomes the first.
|
|
495
|
-
* @return {List}
|
|
496
|
-
*/
|
|
497
|
-
List.prototype.reverse = function () {
|
|
498
|
-
var copy = this.toArray(),
|
|
499
|
-
arr = copy.slice().reverse(),
|
|
500
|
-
notifier = Object.getNotifier(this),
|
|
501
|
-
self = this;
|
|
502
|
-
|
|
503
|
-
notifier.performChange('splice', function () {
|
|
504
|
-
for (var i = 0, l = arr.length; i < l; i++) {
|
|
505
|
-
self.set(i, arr[i]);
|
|
506
|
-
}
|
|
507
|
-
});
|
|
508
|
-
|
|
509
|
-
notifier.notify({
|
|
510
|
-
type: 'splice',
|
|
511
|
-
index : 0,
|
|
512
|
-
removed : copy,
|
|
513
|
-
addedCount: this.length
|
|
514
|
-
});
|
|
515
|
-
|
|
516
|
-
return this;
|
|
517
|
-
};
|
|
518
|
-
|
|
519
|
-
/**
|
|
520
|
-
* Removes the first element from a List and returns that element. This method changes the length of the List.
|
|
521
|
-
* @return {*}
|
|
522
|
-
*/
|
|
523
|
-
List.prototype.shift = function () {
|
|
524
|
-
if (this.length === 0) {
|
|
525
|
-
return void(0);
|
|
526
|
-
}
|
|
527
|
-
var arr = this.toArray(),
|
|
528
|
-
element = arr.shift(),
|
|
529
|
-
notifier = Object.getNotifier(this),
|
|
530
|
-
self = this, len = this.length;
|
|
531
|
-
notifier.performChange('splice', function () {
|
|
532
|
-
for (var i = 0, l = arr.length; i < l; i++) {
|
|
533
|
-
self.set(i, arr[i]);
|
|
534
|
-
}
|
|
535
|
-
self.delete(len - 1);
|
|
536
|
-
|
|
537
|
-
Object.defineProperty(self, '_length', {
|
|
538
|
-
value : len - 1,
|
|
539
|
-
enumerable: false,
|
|
540
|
-
configurable: true,
|
|
541
|
-
writable: true
|
|
542
|
-
});
|
|
543
|
-
notifier.notify({ type: 'updated', name: 'length', oldValue: len });
|
|
544
|
-
});
|
|
545
|
-
|
|
546
|
-
notifier.notify({
|
|
547
|
-
type: 'splice',
|
|
548
|
-
index : 0,
|
|
549
|
-
removed : [element],
|
|
550
|
-
addedCount: 0
|
|
551
|
-
});
|
|
552
|
-
|
|
553
|
-
return element;
|
|
554
|
-
};
|
|
555
|
-
|
|
556
|
-
/**
|
|
557
|
-
* Returns a shallow copy of a portion of an List.
|
|
558
|
-
* @param {number} [start]
|
|
559
|
-
* @param {number} [end]
|
|
560
|
-
* @return {List}
|
|
561
|
-
*/
|
|
562
|
-
List.prototype.slice = function (start, end) {
|
|
563
|
-
return List.fromArray(this.toArray().slice(start, end));
|
|
564
|
-
};
|
|
565
|
-
|
|
566
|
-
/**
|
|
567
|
-
* Sorts the elements of a List in place and returns the List.
|
|
568
|
-
* @param {function} [compareFn]
|
|
569
|
-
* @return {List}
|
|
570
|
-
*/
|
|
571
|
-
List.prototype.sort = function (compareFn) {
|
|
572
|
-
var copy = this.toArray(),
|
|
573
|
-
arr = copy.slice().sort(compareFn),
|
|
574
|
-
notifier = Object.getNotifier(this),
|
|
575
|
-
self = this;
|
|
576
|
-
notifier.performChange('splice', function () {
|
|
577
|
-
for (var i = 0, l = arr.length; i < l; i++) {
|
|
578
|
-
self.set(i, arr[i]);
|
|
579
|
-
}
|
|
580
|
-
});
|
|
581
|
-
|
|
582
|
-
notifier.notify({
|
|
583
|
-
type: 'splice',
|
|
584
|
-
index : 0,
|
|
585
|
-
removed : copy,
|
|
586
|
-
addedCount: this.length
|
|
587
|
-
});
|
|
588
|
-
return this;
|
|
589
|
-
};
|
|
590
|
-
|
|
591
|
-
/**
|
|
592
|
-
* Changes the content of a List, adding new elements while removing old elements.
|
|
593
|
-
* @return {List}
|
|
594
|
-
*/
|
|
595
|
-
List.prototype.splice = function () {
|
|
596
|
-
var returnValue = [];
|
|
597
|
-
if (arguments.length > 0) {
|
|
598
|
-
var arr = this.toArray(),
|
|
599
|
-
notifier = Object.getNotifier(this),
|
|
600
|
-
len = this.length,
|
|
601
|
-
self = this,
|
|
602
|
-
i, l;
|
|
603
|
-
|
|
604
|
-
returnValue = Array.prototype.splice.apply(arr, arguments);
|
|
605
|
-
notifier.performChange('splice', function () {
|
|
606
|
-
for (i = 0, l = arr.length; i < l; i++) {
|
|
607
|
-
var oldValue = self[i];
|
|
608
|
-
if (!sameValue(oldValue, arr[i])) {
|
|
609
|
-
self[i] = arr[i];
|
|
610
|
-
notifier.notify(
|
|
611
|
-
i >= len ?
|
|
612
|
-
{type : 'new', name : i}:
|
|
613
|
-
{type : 'updated', name : i, oldValue : oldValue}
|
|
614
|
-
);
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
if (len !== arr.length) {
|
|
618
|
-
if (len > arr.length) {
|
|
619
|
-
//delete values if the length have been decreased
|
|
620
|
-
for (i = arr.length; i < len; i++) {
|
|
621
|
-
self.delete(i);
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
Object.defineProperty(self, '_length', {
|
|
625
|
-
value : arr.length,
|
|
626
|
-
enumerable: false,
|
|
627
|
-
configurable: true,
|
|
628
|
-
writable: true
|
|
629
|
-
});
|
|
630
|
-
notifier.notify({ type: 'updated', name: 'length', oldValue: len });
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
});
|
|
634
|
-
|
|
635
|
-
if (returnValue.length > 0 || arguments.length > 2) {
|
|
636
|
-
notifier.notify({
|
|
637
|
-
type: 'splice',
|
|
638
|
-
index : arguments[0],
|
|
639
|
-
removed : returnValue,
|
|
640
|
-
addedCount: arguments.length - 2
|
|
641
|
-
});
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
return List.fromArray(returnValue);
|
|
645
|
-
};
|
|
646
|
-
|
|
647
|
-
/**
|
|
648
|
-
* Adds one or more elements to the beginning of a List and returns the new length of the List.
|
|
649
|
-
* @return {number}
|
|
650
|
-
*/
|
|
651
|
-
List.prototype.unshift = function () {
|
|
652
|
-
if (arguments.length > 0) {
|
|
653
|
-
var arr = this.toArray(),
|
|
654
|
-
notifier = Object.getNotifier(this),
|
|
655
|
-
len = this.length,
|
|
656
|
-
self = this;
|
|
657
|
-
|
|
658
|
-
Array.prototype.unshift.apply(arr, arguments);
|
|
659
|
-
notifier.performChange('splice', function () {
|
|
660
|
-
for (var i = 0, l = arr.length; i < l; i++) {
|
|
661
|
-
var oldValue = self[i];
|
|
662
|
-
if (!sameValue(oldValue, arr[i])) {
|
|
663
|
-
// avoid the usage of the set function and manually
|
|
664
|
-
// set the value and notify the changes to avoid the notification of
|
|
665
|
-
// multiple length modification
|
|
666
|
-
self[i] = arr[i];
|
|
667
|
-
notifier.notify(
|
|
668
|
-
i >= len ?
|
|
669
|
-
{type : 'new', name : i}:
|
|
670
|
-
{type : 'updated', name : i, oldValue : oldValue}
|
|
671
|
-
);
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
if (len !== arr.length) {
|
|
676
|
-
if (len > arr.length) {
|
|
677
|
-
//delete values if the length have been decreased
|
|
678
|
-
for (i = arr.length; i < len; i++) {
|
|
679
|
-
self.delete(i);
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
Object.defineProperty(self, '_length', {
|
|
683
|
-
value : arr.length,
|
|
684
|
-
enumerable: false,
|
|
685
|
-
configurable: true,
|
|
686
|
-
writable: true
|
|
687
|
-
});
|
|
688
|
-
notifier.notify({ type: 'updated', name: 'length', oldValue: len });
|
|
689
|
-
}
|
|
690
|
-
});
|
|
691
|
-
|
|
692
|
-
notifier.notify({
|
|
693
|
-
type: 'splice',
|
|
694
|
-
index : 0,
|
|
695
|
-
removed : [],
|
|
696
|
-
addedCount: arguments.length
|
|
697
|
-
});
|
|
698
|
-
}
|
|
699
|
-
return this.length;
|
|
700
|
-
};
|
|
701
|
-
|
|
702
|
-
/**
|
|
703
|
-
* Apply a function against an accumulator and each value of the List (from left-to-right) as to reduce it to a single value.
|
|
704
|
-
* @param {function} callback
|
|
705
|
-
* @param {Object} [initialValue]
|
|
706
|
-
* @return {Object}
|
|
707
|
-
*/
|
|
708
|
-
List.prototype.reduce = Array.prototype.reduce;
|
|
709
|
-
|
|
710
|
-
/**
|
|
711
|
-
* Apply a function simultaneously against two values of the array (from right-to-left) as to reduce it to a single value.
|
|
712
|
-
* @param {function} callback
|
|
713
|
-
* @param {Object} [initialValue]
|
|
714
|
-
* @return {Object}
|
|
715
|
-
*/
|
|
716
|
-
List.prototype.reduceRight = Array.prototype.reduceRight;
|
|
717
|
-
|
|
718
|
-
/**
|
|
719
|
-
* Returns the first index at which a given element can be found in the List, or -1 if it is not present.
|
|
720
|
-
* @param {Object} searchElement
|
|
721
|
-
* @param {number} [fromIndex]
|
|
722
|
-
* @return {number}
|
|
723
|
-
*/
|
|
724
|
-
List.prototype.indexOf = Array.prototype.indexOf;
|
|
725
|
-
|
|
726
|
-
/**
|
|
727
|
-
* Returns the last index at which a given element can be found in the List, or -1 if it is not present. The List is searched backwards, starting at fromIndex.
|
|
728
|
-
* @param {Object} searchElement
|
|
729
|
-
* @param {number} [fromIndex]
|
|
730
|
-
* @return {number}
|
|
731
|
-
*/
|
|
732
|
-
List.prototype.lastIndexOf = Array.prototype.lastIndexOf;
|
|
733
|
-
|
|
734
|
-
/**
|
|
735
|
-
* Tests whether all elements in the List pass the test implemented by the provided function.
|
|
736
|
-
* @param {function} callback
|
|
737
|
-
* @param {Object} [thisObject]
|
|
738
|
-
* @return {boolean}
|
|
739
|
-
*/
|
|
740
|
-
List.prototype.every = Array.prototype.every;
|
|
741
|
-
|
|
742
|
-
/**
|
|
743
|
-
* Creates a new List with all elements that pass the test implemented by the provided function
|
|
744
|
-
* @param {function} callback
|
|
745
|
-
* @param {Object} [thisObject]
|
|
746
|
-
* @return {List}
|
|
747
|
-
*/
|
|
748
|
-
List.prototype.filter = function (callback, thisObject) {
|
|
749
|
-
return List.fromArray(this.toArray().filter(callback, thisObject));
|
|
750
|
-
};
|
|
751
|
-
|
|
752
|
-
/**
|
|
753
|
-
* Executes a provided function once per List element.
|
|
754
|
-
* @param {function} callback
|
|
755
|
-
* @param {Object} [thisObject]
|
|
756
|
-
* @return {void}
|
|
757
|
-
*/
|
|
758
|
-
List.prototype.forEach = Array.prototype.forEach;
|
|
759
|
-
|
|
760
|
-
/**
|
|
761
|
-
* Creates a new List with the results of calling a provided function on every element in this List.
|
|
762
|
-
* @param {function} callback
|
|
763
|
-
* @param {Object} [thisObject]
|
|
764
|
-
* @return {List}
|
|
765
|
-
*/
|
|
766
|
-
List.prototype.map = function (callback, thisObject) {
|
|
767
|
-
return List.fromArray(this.toArray().map(callback, thisObject));
|
|
768
|
-
};
|
|
769
|
-
|
|
770
|
-
/**
|
|
771
|
-
* Tests whether some element in the List passes the test implemented by the provided function.
|
|
772
|
-
* @param {function} callback
|
|
773
|
-
* @param {Object} [thisObject]
|
|
774
|
-
* @return {boolean}
|
|
775
|
-
*/
|
|
776
|
-
List.prototype.some = Array.prototype.some;
|
|
777
|
-
|
|
778
|
-
ObserveUtils.List = List;
|
|
779
|
-
|
|
780
|
-
})(this);
|