diff --git a/dist/amd/can-validate-build.js b/dist/amd/can-validate-build.js new file mode 100644 index 0000000..7eab382 --- /dev/null +++ b/dist/amd/can-validate-build.js @@ -0,0 +1,20 @@ +/*can-validate-build*/ +define([ + 'require', + 'exports', + 'module', + './can-validate', + './map/validate/validate', + './shims/validatejs' +], function (require, exports, module) { + 'use strict'; + var canValidate = require('./can-validate'); + var validate = require('./map/validate/validate'); + var validateJsShim = require('./shims/validatejs'); + module.exports = { + 'can-validate': canValidate, + 'map': { validate: validate }, + 'shims': { 'validatejs.shim': validateJsShim } + }; +}); +//# sourceMappingURL=can-validate-build.js.map \ No newline at end of file diff --git a/dist/amd/can-validate-build.js.map b/dist/amd/can-validate-build.js.map new file mode 100644 index 0000000..482d067 --- /dev/null +++ b/dist/amd/can-validate-build.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../can-validate-build.js"],"names":["canValidate","require","validate","validateJsShim","module","exports"],"mappings":";;;;;;;;;IAAA,a;IACA,IAAIA,WAAA,GAAcC,OAAA,CAAQ,gBAAR,CAAlB,C;IACA,IAAIC,QAAA,GAAWD,OAAA,CAAQ,yBAAR,CAAf,C;IACA,IAAIE,cAAA,GAAiBF,OAAA,CAAQ,oBAAR,CAArB,C;IAEAG,MAAA,CAAOC,OAAP,GAAiB;AAAA,QAChB,gBAAgBL,WADA;AAAA,QAEhB,OAAO,EACNE,QAAA,EAAUA,QADJ,EAFS;AAAA,QAKhB,SAAS,EACR,mBAAmBC,cADX,EALO;AAAA,KAAjB,C","file":"can-validate-build.js"} \ No newline at end of file diff --git a/dist/amd/can-validate.js b/dist/amd/can-validate.js new file mode 100644 index 0000000..c851d73 --- /dev/null +++ b/dist/amd/can-validate.js @@ -0,0 +1,36 @@ +/*can-validate-legacy@2.0.0#can-validate*/ +define([ + 'require', + 'exports', + 'module', + 'can-log/dev', + 'can-namespace' +], function (require, exports, module) { + 'use strict'; + var dev = require('can-log/dev'); + var namespace = require('can-namespace'); + var Validate = { + _validatorId: '', + _validators: {}, + validator: function () { + return this._validators[this._validatorId]; + }, + register: function (id, validator) { + this._validatorId = id; + this._validators[id] = validator; + }, + isValid: function () { + return this.validator().isValid.apply(this, arguments); + }, + once: function () { + return this.validator().once.apply(this, arguments); + }, + validate: function () { + var validateArgs = arguments; + return this.validator().validate.apply(this, validateArgs); + } + }; + namespace.validate = Validate; + module.exports = Validate; +}); +//# sourceMappingURL=can-validate.js.map \ No newline at end of file diff --git a/dist/amd/can-validate.js.map b/dist/amd/can-validate.js.map new file mode 100644 index 0000000..91c10c7 --- /dev/null +++ b/dist/amd/can-validate.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../can-validate.js"],"names":["dev","require","namespace","Validate","_validatorId","_validators","validator","register","id","isValid","apply","arguments","once","validate","validateArgs","module","exports"],"mappings":";;;;;;;;IAAA,a;IACA,IAAIA,GAAA,GAAMC,OAAA,CAAQ,aAAR,CAAV,C;IACA,IAAIC,SAAA,GAAYD,OAAA,CAAQ,eAAR,CAAhB,C;IAGA,IAAIE,QAAA,GAAW;AAAA,QAKdC,YAAA,EAAc,EALA;AAAA,QAUdC,WAAA,EAAa,EAVC;AAAA,QAsBdC,SAAA,EAAW,YAAY;AAAA,YACtB,OAAO,KAAKD,WAAL,CAAiB,KAAKD,YAAtB,CAAP,CADsB;AAAA,SAtBT;AAAA,QAoCdG,QAAA,EAAU,UAAUC,EAAV,EAAcF,SAAd,EAAyB;AAAA,YAClC,KAAKF,YAAL,GAAoBI,EAApB,CADkC;AAAA,YAElC,KAAKH,WAAL,CAAiBG,EAAjB,IAAuBF,SAAvB,CAFkC;AAAA,SApCrB;AAAA,QAqDdG,OAAA,EAAS,YAAY;AAAA,YAEpB,OAAO,KAAKH,SAAL,GAAiBG,OAAjB,CAAyBC,KAAzB,CAA+B,IAA/B,EAAqCC,SAArC,CAAP,CAFoB;AAAA,SArDP;AAAA,QAsEdC,IAAA,EAAM,YAAY;AAAA,YAEjB,OAAO,KAAKN,SAAL,GAAiBM,IAAjB,CAAsBF,KAAtB,CAA4B,IAA5B,EAAkCC,SAAlC,CAAP,CAFiB;AAAA,SAtEJ;AAAA,QAoFdE,QAAA,EAAU,YAAY;AAAA,YACrB,IAAIC,YAAA,GAAeH,SAAnB,CADqB;AAAA,YAGrB,OAAO,KAAKL,SAAL,GAAiBO,QAAjB,CAA0BH,KAA1B,CAAgC,IAAhC,EAAsCI,YAAtC,CAAP,CAHqB;AAAA,SApFR;AAAA,KAAf,C;IA2FAZ,SAAA,CAAUW,QAAV,GAAqBV,QAArB,C;IAEAY,MAAA,CAAOC,OAAP,GAAiBb,QAAjB,C","file":"can-validate.js"} \ No newline at end of file diff --git a/dist/amd/map/validate/validate.js b/dist/amd/map/validate/validate.js new file mode 100644 index 0000000..3f1eb71 --- /dev/null +++ b/dist/amd/map/validate/validate.js @@ -0,0 +1,210 @@ +/*can-validate-legacy@2.0.0#map/validate/validate*/ +define([ + 'require', + 'exports', + 'module', + 'can-assign', + 'can-map', + 'can-reflect', + '../../can-validate', + 'can-compute' +], function (require, exports, module) { + 'use strict'; + var assign = require('can-assign'); + var Map = require('can-map'); + var canReflect = require('can-reflect'); + var validate = require('../../can-validate'); + var compute = require('can-compute'); + var deepAssign = function () { + var objects = [].slice.call(arguments); + var out = {}; + for (var i = 0; i < objects.length; i++) { + assign(out, objects[i]); + } + return out; + }; + var isEmptyObject = function (value) { + return canReflect.size(value) === 0; + }; + var proto = Map.prototype; + var oldSet = proto.__set; + var ErrorsObj; + var defaultValidationOpts; + var config = { + errorKeyName: 'errors', + validateOptionCacheKey: 'validateOptions' + }; + var resolveComputes = function (itemObj, opts) { + var processedObj = {}; + canReflect.eachKey(opts, function (item, key) { + var actualOpts = item; + if (typeof item === 'function') { + actualOpts = item(itemObj.value); + } + processedObj[key] = actualOpts; + }); + return processedObj; + }; + var getPropDefineBehavior = function (behavior, attr, define) { + var prop; + var defaultProp; + if (define) { + prop = define[attr]; + defaultProp = define['*']; + if (prop && prop[behavior] !== undefined) { + return prop[behavior]; + } else { + if (defaultProp && defaultProp[behavior] !== undefined) { + return defaultProp[behavior]; + } + } + } + }; + ErrorsObj = Map.extend({}, { + hasErrors: function () { + return !isEmptyObject(this.attr()); + } + }); + defaultValidationOpts = { + mustValidate: false, + validateOnInit: false + }; + var getValidateFromCache = function () { + var validateCacheKey = '__' + config.validateOptionCacheKey; + if (!this[validateCacheKey]) { + this[validateCacheKey] = {}; + } + return this[validateCacheKey]; + }; + var initProperty = function (key, value) { + var validateOpts; + var mapValidateCache; + var propIniting; + mapValidateCache = getValidateFromCache.call(this); + if (mapValidateCache[key] && !isEmptyObject(mapValidateCache[key])) { + validateOpts = mapValidateCache[key]; + propIniting = false; + } else { + validateOpts = assign({}, getPropDefineBehavior('validate', key, this.define)); + propIniting = true; + } + if (typeof validateOpts !== 'undefined') { + if (propIniting) { + validateOpts = deepAssign(defaultValidationOpts, validateOpts, this._processValidateOpts({ + key: key, + value: value + }, validateOpts)); + mapValidateCache[key] = validateOpts; + } + return true; + } + return false; + }; + var oldSetup = proto.setup; + var oldInit = proto.init; + proto.setup = function () { + this._initValidate = true; + oldSetup.apply(this, arguments); + }; + proto.init = function () { + this._initValidation(); + this._initValidate = false; + if (oldInit) { + oldInit.apply(this, arguments); + } + }; + assign(Map.prototype, { + _initValidation: function () { + var self = this; + var validateCache = getValidateFromCache.call(this); + canReflect.eachKey(this.define, function (props, key) { + if (props.validate && !validateCache[key]) { + initProperty.call(self, key, self[key]); + } + }); + }, + validate: function () { + return this._validate(); + }, + _validate: function () { + var validateOpts = getValidateFromCache.call(this); + var processedOpts = {}; + var self = this; + canReflect.eachKey(this.define, function (value, key) { + if (value.validate) { + processedOpts[key] = resolveComputes({ + key: key, + value: self.attr(key) + }, validateOpts[key]); + } + }); + var errors = validate.validate(this.serialize(), processedOpts); + this.attr('errors', new ErrorsObj(errors)); + return isEmptyObject(errors); + }, + _validateOne: function (item, opts) { + var errors; + var allowSet = true; + errors = validate.once(item.value, assign({}, opts), item.key); + if (errors && errors.length > 0) { + if (!this.attr('errors')) { + this.attr('errors', new ErrorsObj({})); + } + this.attr('errors').attr(item.key, errors); + if (opts.mustValidate === true) { + allowSet = false; + } + } else { + if (this.attr('errors') && this.attr('errors').attr(item.key)) { + this.attr('errors').removeAttr(item.key); + } + } + return allowSet; + }, + _processValidateOpts: function (itemObj, opts) { + var processedObj = {}; + var computes = []; + var self = this; + canReflect.eachKey(opts, function (item, key) { + processedObj[key] = item; + if (typeof item === 'function') { + var newCompute = compute(item.bind(self)); + computes.push({ + key: key, + compute: newCompute + }); + processedObj[key] = newCompute; + } + }); + canReflect.each(computes, function (item) { + item.compute.bind('change', function () { + itemObj.value = self.attr(itemObj.key); + self._validateOne(itemObj, processedObj); + }); + }); + return processedObj; + } + }); + proto.__set = function (prop, value, current, success, error) { + var allowSet = true; + var checkValidate = initProperty.call(this, prop, value); + var validateOpts = getValidateFromCache.call(this)[prop]; + var mapIniting = this._initValidate; + if (checkValidate !== false) { + validateOpts = resolveComputes({ + key: prop, + value: value + }, validateOpts); + if (validateOpts && !mapIniting || validateOpts && mapIniting && validateOpts.validateOnInit) { + allowSet = this._validateOne({ + key: prop, + value: value + }, validateOpts); + } + } + if (allowSet) { + oldSet.call(this, prop, value, current, success, error); + } + }; +}); +//# sourceMappingURL=validate.js.map \ No newline at end of file diff --git a/dist/amd/map/validate/validate.js.map b/dist/amd/map/validate/validate.js.map new file mode 100644 index 0000000..dc53133 --- /dev/null +++ b/dist/amd/map/validate/validate.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../map/validate/validate.js"],"names":["assign","require","Map","canReflect","validate","compute","deepAssign","objects","slice","call","arguments","out","i","length","isEmptyObject","value","size","proto","prototype","oldSet","__set","ErrorsObj","defaultValidationOpts","config","errorKeyName","validateOptionCacheKey","resolveComputes","itemObj","opts","processedObj","eachKey","item","key","actualOpts","getPropDefineBehavior","behavior","attr","define","prop","defaultProp","undefined","extend","hasErrors","mustValidate","validateOnInit","getValidateFromCache","validateCacheKey","initProperty","validateOpts","mapValidateCache","propIniting","_processValidateOpts","oldSetup","setup","oldInit","init","_initValidate","apply","_initValidation","self","validateCache","props","_validate","processedOpts","errors","serialize","_validateOne","allowSet","once","removeAttr","computes","newCompute","bind","push","each","current","success","error","checkValidate","mapIniting"],"mappings":";;;;;;;;;;;IAAA,a;IACA,IAAIA,MAAA,GAASC,OAAA,CAAQ,YAAR,CAAb,C;IAEA,IAAIC,GAAA,GAAMD,OAAA,CAAQ,SAAR,CAAV,C;IACA,IAAIE,UAAA,GAAaF,OAAA,CAAQ,aAAR,CAAjB,C;IACA,IAAIG,QAAA,GAAWH,OAAA,CAAQ,oBAAR,CAAf,C;IACA,IAAII,OAAA,GAAUJ,OAAA,CAAQ,aAAR,CAAd,C;IAEA,IAAIK,UAAA,GAAa,YAAW;AAAA,QAC3B,IAAIC,OAAA,GAAU,GAAGC,KAAH,CAASC,IAAT,CAAcC,SAAd,CAAd,CAD2B;AAAA,QAE3B,IAAIC,GAAA,GAAM,EAAV,CAF2B;AAAA,QAI3B,KAAK,IAAIC,CAAA,GAAE,CAAN,CAAL,CAAcA,CAAA,GAAEL,OAAA,CAAQM,MAAxB,EAAgCD,CAAA,EAAhC,EAAqC;AAAA,YACpCZ,MAAA,CAAOW,GAAP,EAAYJ,OAAA,CAAQK,CAAR,CAAZ,EADoC;AAAA,SAJV;AAAA,QAQ3B,OAAOD,GAAP,CAR2B;AAAA,KAA5B,C;IAWA,IAAIG,aAAA,GAAgB,UAASC,KAAT,EAAgB;AAAA,QACnC,OAAOZ,UAAA,CAAWa,IAAX,CAAgBD,KAAhB,MAA2B,CAAlC,CADmC;AAAA,KAApC,C;IAIA,IAAIE,KAAA,GAAQf,GAAA,CAAIgB,SAAhB,C;IACA,IAAIC,MAAA,GAASF,KAAA,CAAMG,KAAnB,C;IACA,IAAIC,SAAJ,C;IACA,IAAIC,qBAAJ,C;IACA,IAAIC,MAAA,GAAS;AAAA,QACZC,YAAA,EAAc,QADF;AAAA,QAEZC,sBAAA,EAAwB,iBA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AAAA,QAG7D,IAAIW,aAAA,GAAgB/B,YAAA,CAAatC,IAAb,CAAkB,IAAlB,EAAwB6B,IAAxB,EAA8BvB,KAA9B,CAApB,CAH6D;AAAA,QAI7D,IAAIiC,YAAA,GAAeH,oBAAA,CAAqBpC,IAArB,CAA0B,IAA1B,EAAgC6B,IAAhC,CAAnB,CAJ6D;AAAA,QAK7D,IAAIyC,UAAA,GAAa,KAAKvB,aAAtB,CAL6D;AAAA,QAO7D,IAAIsB,aAAA,KAAkB,KAAtB,EAA6B;AAAA,YAC5B9B,YAAA,GAAetB,eAAA,CAAgB;AAAA,gBAACM,GAAA,EAAKM,IAAN;AAAA,gBAAYvB,KAAA,EAAOA,KAAnB;AAAA,aAAhB,EAA2CiC,YAA3C,CAAf,CAD4B;AAAA,YAI5B,IAAKA,YAAA,IAAgB,CAAC+B,UAAlB,IAAkC/B,YAAA,IAAgB+B,UAAhB,IAA8B/B,YAAA,CAAaJ,cAAjF,EAAkG;AAAA,gBAEjGuB,QAAA,GAAW,KAAKD,YAAL,CAAkB;AAAA,oBAAClC,GAAA,EAAKM,IAAN;AAAA,oBAAYvB,KAAA,EAAOA,KAAnB;AAAA,iBAAlB,EAA6CiC,YAA7C,CAAX,CAFiG;AAAA,aAJtE;AAAA,SAPgC;AAAA,QAkB7D,IAAImB,QAAJ,EAAc;AAAA,YACbhD,MAAA,CAAOV,IAAP,CAAY,IAAZ,EAAkB6B,IAAlB,EAAwBvB,KAAxB,EAA+B4D,OAA/B,EAAwCC,OAAxC,EAAiDC,KAAjD,EADa;AAAA,SAlB+C;AAAA,KAA9D,C","file":"validate.js"} \ No newline at end of file diff --git a/dist/amd/shims/validatejs.js b/dist/amd/shims/validatejs.js new file mode 100644 index 0000000..f51d13a --- /dev/null +++ b/dist/amd/shims/validatejs.js @@ -0,0 +1,60 @@ +/*can-validate-legacy@2.0.0#shims/validatejs*/ +define([ + 'require', + 'exports', + 'module', + '../can-validate', + 'validate' +], function (require, exports, module) { + 'use strict'; + var validate = require('../can-validate'); + var validatejs = require('validate'); + var processOptions = function (opts) { + if (typeof opts.required !== 'undefined') { + opts.presence = opts.required; + delete opts.required; + } + if (opts.hasOwnProperty('mustValidate')) { + delete opts.mustValidate; + } + if (opts.hasOwnProperty('validateOnInit')) { + delete opts.validateOnInit; + } + return opts; + }; + var shim = { + once: function (value, options, name) { + var errors = []; + var opts = []; + var validationOpts = []; + if (name) { + opts[name] = value; + validationOpts[name] = processOptions(options); + errors = validatejs(opts, validationOpts); + if (errors) { + errors = errors[name]; + } + } else { + errors = validatejs.single(value, processOptions(options)); + } + return errors; + }, + isValid: function (value, options) { + var errors = validatejs.single(value, processOptions(options)) || []; + return errors.length === 0; + }, + validate: function (values, options) { + var valueKeys = Object.keys(values); + var processedOpts = {}; + for (var i = 0; i < valueKeys.length; i++) { + var prop = valueKeys[i]; + if (options[prop]) { + processedOpts[prop] = processOptions(options[prop]); + } + } + return validatejs(values, processedOpts); + } + }; + validate.register('validatejs', shim); +}); +//# sourceMappingURL=validatejs.js.map \ No newline at end of file diff --git a/dist/amd/shims/validatejs.js.map b/dist/amd/shims/validatejs.js.map new file mode 100644 index 0000000..c769925 --- /dev/null +++ b/dist/amd/shims/validatejs.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../shims/validatejs.js"],"names":["validate","require","validatejs","processOptions","opts","required","presence","hasOwnProperty","mustValidate","validateOnInit","shim","once","value","options","name","errors","validationOpts","single","isValid","length","values","valueKeys","Object","keys","processedOpts","i","prop","register"],"mappings":";;;;;;;;IAAA,a;IACA,IAAIA,QAAA,GAAWC,OAAA,CAAQ,iBAAR,CAAf,C;IACA,IAAIC,UAAA,GAAaD,OAAA,CAAQ,UAAR,CAAjB,C;IAEA,IAAIE,cAAA,GAAiB,UAAUC,IAAV,EAAgB;AAAA,QAEpC,IAAI,OAAOA,IAAA,CAAKC,QAAZ,KAAyB,WAA7B,EAA0C;AAAA,YACzCD,IAAA,CAAKE,QAAL,GAAgBF,IAAA,CAAKC,QA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We,MAAX,CAAkBL,KAAlB,EAAyBT,cAAA,CAAeU,OAAf,CAAzB,KAAqD,EAAlE,CADkC;AAAA,YAGlC,OAAOE,MAAA,CAAOI,MAAP,KAAkB,CAAzB,CAHkC;AAAA,SAnDzB;AAAA,QAmEVnB,QAAA,EAAU,UAAUoB,MAAV,EAAkBP,OAAlB,EAA2B;AAAA,YAEpC,IAAIQ,SAAA,GAAYC,MAAA,CAAOC,IAAP,CAAYH,MAAZ,CAAhB,CAFoC;AAAA,YAGpC,IAAII,aAAA,GAAgB,EAApB,CAHoC;AAAA,YAMpC,KAAK,IAAIC,CAAA,GAAI,CAAR,CAAL,CAAgBA,CAAA,GAAIJ,SAAA,CAAUF,MAA9B,EAAsCM,CAAA,EAAtC,EAA2C;AAAA,gBAC1C,IAAIC,IAAA,GAAOL,SAAA,CAAUI,CAAV,CAAX,CAD0C;AAAA,gBAE1C,IAAIZ,OAAA,CAAQa,IAAR,CAAJ,EAAmB;AAAA,oBAClBF,aAAA,CAAcE,IAAd,IAAsBvB,cAAA,CAAeU,OAAA,CAAQa,IAAR,CAAf,CAAtB,CADkB;AAAA,iBAFuB;AAAA,aANP;AAAA,YAapC,OAAOxB,UAAA,CAAWkB,MAAX,EAAmBI,aAAnB,CAAP,CAboC;AAAA,SAnE3B;AAAA,KAAX,C;IAqFAxB,QAAA,CAAS2B,QAAT,CAAkB,YAAlB,EAAgCjB,IAAhC,E","file":"validatejs.js"} \ No newline at end of file diff --git a/dist/cjs/can-validate-build.js b/dist/cjs/can-validate-build.js new file mode 100644 index 0000000..23821bb --- /dev/null +++ b/dist/cjs/can-validate-build.js @@ -0,0 +1,11 @@ +/*can-validate-build*/ +'use strict'; +var canValidate = require('./can-validate.js'); +var validate = require('./map/validate/validate.js'); +var validateJsShim = require('./shims/validatejs.js'); +module.exports = { + 'can-validate': canValidate, + 'map': { validate: validate }, + 'shims': { 'validatejs.shim': validateJsShim } +}; +//# sourceMappingURL=can-validate-build.js.map \ No newline at end of file diff --git a/dist/cjs/can-validate-build.js.map b/dist/cjs/can-validate-build.js.map new file mode 100644 index 0000000..7249dde --- /dev/null +++ b/dist/cjs/can-validate-build.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../can-validate-build.js"],"names":["canValidate","require","validate","validateJsShim","module","exports"],"mappings":";AAAA;AACA,IAAIA,WAAA,GAAcC,OAAA,CAAQ,mBAAR,CAAlB,CADA;AAEA,IAAIC,QAAA,GAAWD,OAAA,CAAQ,4BAAR,CAAf,CAFA;AAGA,IAAIE,cAAA,GAAiBF,OAAA,CAAQ,uBAAR,CAArB,CAHA;AAKAG,MAAA,CAAOC,OAAP,GAAiB;AAAA,IAChB,gBAAgBL,WADA;AAAA,IAEhB,OAAO,EACNE,QAAA,EAAUA,QADJ,EAFS;AAAA,IAKhB,SAAS,EACR,mBAAmBC,cADX,EALO;AAAA,CAAjB","file":"can-validate-build.js"} \ No newline at end of file diff --git a/dist/cjs/can-validate.js b/dist/cjs/can-validate.js new file mode 100644 index 0000000..27bbc13 --- /dev/null +++ b/dist/cjs/can-validate.js @@ -0,0 +1,28 @@ +/*can-validate-legacy@2.0.0#can-validate*/ +'use strict'; +var dev = require('can-log/dev/dev'); +var namespace = require('can-namespace'); +var Validate = { + _validatorId: '', + _validators: {}, + validator: function () { + return this._validators[this._validatorId]; + }, + register: function (id, validator) { + this._validatorId = id; + this._validators[id] = validator; + }, + isValid: function () { + return this.validator().isValid.apply(this, arguments); + }, + once: function () { + return this.validator().once.apply(this, arguments); + }, + validate: function () { + var validateArgs = arguments; + return this.validator().validate.apply(this, validateArgs); + } +}; +namespace.validate = Validate; +module.exports = Validate; +//# sourceMappingURL=can-validate.js.map \ No newline at end of file diff --git a/dist/cjs/can-validate.js.map b/dist/cjs/can-validate.js.map new file mode 100644 index 0000000..ac7f68d --- /dev/null +++ b/dist/cjs/can-validate.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../can-validate.js"],"names":["dev","require","namespace","Validate","_validatorId","_validators","validator","register","id","isValid","apply","arguments","once","validate","validateArgs","module","exports"],"mappings":";AAAA;AACA,IAAIA,GAAA,GAAMC,OAAA,CAAQ,iBAAR,CAAV,CADA;AAEA,IAAIC,SAAA,GAAYD,OAAA,CAAQ,eAAR,CAAhB,CAFA;AAKA,IAAIE,QAAA,GAAW;AAAA,IAKdC,YAAA,EAAc,EALA;AAAA,IAUdC,WAAA,EAAa,EAVC;AAAA,IAsBdC,SAAA,EAAW,YAAY;AAAA,QACtB,OAAO,KAAKD,WAAL,CAAiB,KAAKD,YAAtB,CAAP,CADsB;AAAA,KAtBT;AAAA,IAoCdG,QAAA,EAAU,UAAUC,EAAV,EAAcF,SAAd,EAAyB;AAAA,QAClC,KAAKF,YAAL,GAAoBI,EAApB,CADkC;AAAA,QAElC,KAAKH,WAAL,CAAiBG,EAAjB,IAAuBF,SAAvB,CAFkC;AAAA,KApCrB;AAAA,IAqDdG,OAAA,EAAS,YAAY;AAAA,QAEpB,OAAO,KAAKH,SAAL,GAAiBG,OAAjB,CAAyBC,KAAzB,CAA+B,IAA/B,EAAqCC,SAArC,CAAP,CAFoB;AAAA,KArDP;AAAA,IAsEdC,IAAA,EAAM,YAAY;AAAA,QAEjB,OAAO,KAAKN,SAAL,GAAiBM,IAAjB,CAAsBF,KAAtB,CAA4B,IAA5B,EAAkCC,SAAlC,CAAP,CAFiB;AAAA,KAtEJ;AAAA,IAoFdE,QAAA,EAAU,YAAY;AAAA,QACrB,IAAIC,YAAA,GAAeH,SAAnB,CADqB;AAAA,QAGrB,OAAO,KAAKL,SAAL,GAAiBO,QAAjB,CAA0BH,KAA1B,CAAgC,IAAhC,EAAsCI,YAAtC,CAAP,CAHqB;AAAA,KApFR;AAAA,CAAf,CALA;AAgGAZ,SAAA,CAAUW,QAAV,GAAqBV,QAArB,CAhGA;AAkGAY,MAAA,CAAOC,OAAP,GAAiBb,QAAjB","file":"can-validate.js"} \ No newline at end of file diff --git a/dist/cjs/map/validate/validate.js b/dist/cjs/map/validate/validate.js new file mode 100644 index 0000000..dd62663 --- /dev/null +++ b/dist/cjs/map/validate/validate.js @@ -0,0 +1,199 @@ +/*can-validate-legacy@2.0.0#map/validate/validate*/ +'use strict'; +var assign = require('can-assign'); +var Map = require('can-map'); +var canReflect = require('can-reflect'); +var validate = require('../../can-validate.js'); +var compute = require('can-compute'); +var deepAssign = function () { + var objects = [].slice.call(arguments); + var out = {}; + for (var i = 0; i < objects.length; i++) { + assign(out, objects[i]); + } + return out; +}; +var isEmptyObject = function (value) { + return canReflect.size(value) === 0; +}; +var proto = Map.prototype; +var oldSet = proto.__set; +var ErrorsObj; +var defaultValidationOpts; +var config = { + errorKeyName: 'errors', + validateOptionCacheKey: 'validateOptions' +}; +var resolveComputes = function (itemObj, opts) { + var processedObj = {}; + canReflect.eachKey(opts, function (item, key) { + var actualOpts = item; + if (typeof item === 'function') { + actualOpts = item(itemObj.value); + } + processedObj[key] = actualOpts; + }); + return processedObj; +}; +var getPropDefineBehavior = function (behavior, attr, define) { + var prop; + var defaultProp; + if (define) { + prop = define[attr]; + defaultProp = define['*']; + if (prop && prop[behavior] !== undefined) { + return prop[behavior]; + } else { + if (defaultProp && defaultProp[behavior] !== undefined) { + return defaultProp[behavior]; + } + } + } +}; +ErrorsObj = Map.extend({}, { + hasErrors: function () { + return !isEmptyObject(this.attr()); + } +}); +defaultValidationOpts = { + mustValidate: false, + validateOnInit: false +}; +var getValidateFromCache = function () { + var validateCacheKey = '__' + config.validateOptionCacheKey; + if (!this[validateCacheKey]) { + this[validateCacheKey] = {}; + } + return this[validateCacheKey]; +}; +var initProperty = function (key, value) { + var validateOpts; + var mapValidateCache; + var propIniting; + mapValidateCache = getValidateFromCache.call(this); + if (mapValidateCache[key] && !isEmptyObject(mapValidateCache[key])) { + validateOpts = mapValidateCache[key]; + propIniting = false; + } else { + validateOpts = assign({}, getPropDefineBehavior('validate', key, this.define)); + propIniting = true; + } + if (typeof validateOpts !== 'undefined') { + if (propIniting) { + validateOpts = deepAssign(defaultValidationOpts, validateOpts, this._processValidateOpts({ + key: key, + value: value + }, validateOpts)); + mapValidateCache[key] = validateOpts; + } + return true; + } + return false; +}; +var oldSetup = proto.setup; +var oldInit = proto.init; +proto.setup = function () { + this._initValidate = true; + oldSetup.apply(this, arguments); +}; +proto.init = function () { + this._initValidation(); + this._initValidate = false; + if (oldInit) { + oldInit.apply(this, arguments); + } +}; +assign(Map.prototype, { + _initValidation: function () { + var self = this; + var validateCache = getValidateFromCache.call(this); + canReflect.eachKey(this.define, function (props, key) { + if (props.validate && !validateCache[key]) { + initProperty.call(self, key, self[key]); + } + }); + }, + validate: function () { + return this._validate(); + }, + _validate: function () { + var validateOpts = getValidateFromCache.call(this); + var processedOpts = {}; + var self = this; + canReflect.eachKey(this.define, function (value, key) { + if (value.validate) { + processedOpts[key] = resolveComputes({ + key: key, + value: self.attr(key) + }, validateOpts[key]); + } + }); + var errors = validate.validate(this.serialize(), processedOpts); + this.attr('errors', new ErrorsObj(errors)); + return isEmptyObject(errors); + }, + _validateOne: function (item, opts) { + var errors; + var allowSet = true; + errors = validate.once(item.value, assign({}, opts), item.key); + if (errors && errors.length > 0) { + if (!this.attr('errors')) { + this.attr('errors', new ErrorsObj({})); + } + this.attr('errors').attr(item.key, errors); + if (opts.mustValidate === true) { + allowSet = false; + } + } else { + if (this.attr('errors') && this.attr('errors').attr(item.key)) { + this.attr('errors').removeAttr(item.key); + } + } + return allowSet; + }, + _processValidateOpts: function (itemObj, opts) { + var processedObj = {}; + var computes = []; + var self = this; + canReflect.eachKey(opts, function (item, key) { + processedObj[key] = item; + if (typeof item === 'function') { + var newCompute = compute(item.bind(self)); + computes.push({ + key: key, + compute: newCompute + }); + processedObj[key] = newCompute; + } + }); + canReflect.each(computes, function (item) { + item.compute.bind('change', function () { + itemObj.value = self.attr(itemObj.key); + self._validateOne(itemObj, processedObj); + }); + }); + return processedObj; + } +}); +proto.__set = function (prop, value, current, success, error) { + var allowSet = true; + var checkValidate = initProperty.call(this, prop, value); + var validateOpts = getValidateFromCache.call(this)[prop]; + var mapIniting = this._initValidate; + if (checkValidate !== false) { + validateOpts = resolveComputes({ + key: prop, + value: value + }, validateOpts); + if (validateOpts && !mapIniting || validateOpts && mapIniting && validateOpts.validateOnInit) { + allowSet = this._validateOne({ + key: prop, + value: value + }, validateOpts); + } + } + if (allowSet) { + oldSet.call(this, prop, value, current, success, error); + } +}; +//# sourceMappingURL=validate.js.map \ No newline at end of file diff --git a/dist/cjs/map/validate/validate.js.map b/dist/cjs/map/validate/validate.js.map new file mode 100644 index 0000000..d85d93e --- /dev/null +++ b/dist/cjs/map/validate/validate.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../map/validate/validate.js"],"names":["assign","require","Map","canReflect","validate","compute","deepAssign","objects","slice","call","arguments","out","i","length","isEmptyObject","value","size","proto","prototype","oldSet","__set","ErrorsObj","defaultValidationOpts","config","errorKeyName","validateOptionCacheKey","resolveComputes","itemObj","opts","processedObj","eachKey","item","key","actualOpts","getPropDefineBehavior","behavior","attr","define","prop","defaultProp","undefined","extend","hasErrors","mustValidate","validateOnInit","getValidateFromCache","validateCacheKey","initProperty","validateOpts","mapValidateCache","propIniting","_processValidateOpts","oldSetup","setup","oldInit","init","_initValidate","apply","_initValidation","self","validateCache","props","_validate","processedOpts","errors","serialize","_validateOne","allowSet","once","removeAttr","computes","newCompute","bind","push","each","current","success","error","checkValidate","mapIniting"],"mappings":";AAAA;AACA,IAAIA,MAAA,GAASC,OAAA,CAAQ,YAAR,CAAb,CADA;AAGA,IAAIC,GAAA,GAAMD,OAAA,CAAQ,SAAR,CAAV,CAHA;AAIA,IAAIE,UAAA,GAAaF,OAAA,CAAQ,aAAR,CAAjB,CAJA;AAKA,IAAIG,QAAA,GAAWH,OAAA,CAAQ,uBAAR,CAAf,CALA;AAMA,IAAII,OAAA,GAAUJ,OAAA,CAAQ,aAAR,CAAd,CANA;AAQA,IAAIK,UAAA,GAAa,YAAW;AAAA,IAC3B,IAAIC,OAAA,GAAU,GAAGC,KAAH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,EAA2CiC,YAA3C,CAAf,CAD4B;AAAA,QAI5B,IAAKA,YAAA,IAAgB,CAAC+B,UAAlB,IAAkC/B,YAAA,IAAgB+B,UAAhB,IAA8B/B,YAAA,CAAaJ,cAAjF,EAAkG;AAAA,YAEjGuB,QAAA,GAAW,KAAKD,YAAL,CAAkB;AAAA,gBAAClC,GAAA,EAAKM,IAAN;AAAA,gBAAYvB,KAAA,EAAOA,KAAnB;AAAA,aAAlB,EAA6CiC,YAA7C,CAAX,CAFiG;AAAA,SAJtE;AAAA,KAPgC;AAAA,IAkB7D,IAAImB,QAAJ,EAAc;AAAA,QACbhD,MAAA,CAAOV,IAAP,CAAY,IAAZ,EAAkB6B,IAAlB,EAAwBvB,KAAxB,EAA+B4D,OAA/B,EAAwCC,OAAxC,EAAiDC,KAAjD,EADa;AAAA,KAlB+C;AAAA,CAA9D","file":"validate.js"} \ No newline at end of file diff --git a/dist/cjs/shims/validatejs.js b/dist/cjs/shims/validatejs.js new file mode 100644 index 0000000..552f5c7 --- /dev/null +++ b/dist/cjs/shims/validatejs.js @@ -0,0 +1,52 @@ +/*can-validate-legacy@2.0.0#shims/validatejs*/ +'use strict'; +var validate = require('../can-validate.js'); +var validatejs = require('validate.js'); +var processOptions = function (opts) { + if (typeof opts.required !== 'undefined') { + opts.presence = opts.required; + delete opts.required; + } + if (opts.hasOwnProperty('mustValidate')) { + delete opts.mustValidate; + } + if (opts.hasOwnProperty('validateOnInit')) { + delete opts.validateOnInit; + } + return opts; +}; +var shim = { + once: function (value, options, name) { + var errors = []; + var opts = []; + var validationOpts = []; + if (name) { + opts[name] = value; + validationOpts[name] = processOptions(options); + errors = validatejs(opts, validationOpts); + if (errors) { + errors = errors[name]; + } + } else { + errors = validatejs.single(value, processOptions(options)); + } + return errors; + }, + isValid: function (value, options) { + var errors = validatejs.single(value, processOptions(options)) || []; + return errors.length === 0; + }, + validate: function (values, options) { + var valueKeys = Object.keys(values); + var processedOpts = {}; + for (var i = 0; i < valueKeys.length; i++) { + var prop = valueKeys[i]; + if (options[prop]) { + processedOpts[prop] = processOptions(options[prop]); + } + } + return validatejs(values, processedOpts); + } +}; +validate.register('validatejs', shim); +//# sourceMappingURL=validatejs.js.map \ No newline at end of file diff --git a/dist/cjs/shims/validatejs.js.map b/dist/cjs/shims/validatejs.js.map new file mode 100644 index 0000000..26959aa --- /dev/null +++ b/dist/cjs/shims/validatejs.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../shims/validatejs.js"],"names":["validate","require","validatejs","processOptions","opts","required","presence","hasOwnProperty","mustValidate","validateOnInit","shim","once","value","options","name","errors","validationOpts","single","isValid","length","values","valueKeys","Object","keys","processedOpts","i","prop","register"],"mappings":";AAAA;AACA,IAAIA,QAAA,GAAWC,OAAA,CAAQ,oBAAR,CAAf,CADA;AAEA,IAAIC,UAAA,GAAaD,OAAA,CAAQ,aAAR,CAAjB,CAFA;AAIA,IAAIE,cAAA,GAAiB,UAAUC,IAAV,EAAgB;AAAA,IAEpC,IAAI,OAAOA,IAAA,CAAKC,QAAZ,KAAyB,WAA7B,EAA0C;AAAA,QACzCD,IAAA,CAAKE,QAAL,GAAgBF,IAAA,CAAKC,QAArB,CADyC;AAAA,QAEzC,OAAOD,IAAA,CAAKC,QAAZ,CAFyC;AAAA,KAFN;AAAA,IAOpC,IAAID,IAAA,CAAKG,cAAL,CAAoB,cAApB,CAAJ,EAAyC;AAAA,QACxC,OAAOH,IAAA,CAAKI,YAAZ,CADwC;AAAA,KAPL;AAAA,IAWpC,IAAIJ,IAAA,CAAKG,cAAL,CAAoB,gBAApB,CAAJ,EAA2C;AAAA,QAC1C,OAAOH,IAAA,CAAKK,cAAZ,CAD0C;AAAA,KAXP;AAAA,IAepC,OAAOL,IAAP,CAfoC;AAAA,CAArC,CAJA;AAsBA,IAAIM,IAAA,GAAO;AAAA,IAaVC,IAAA,EAAM,UAAUC,KAAV,EAAiBC,OAAjB,EAA0BC,IAA1B,EAAgC;AAAA,QACrC,IAAIC,MAAA,GA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AA,CAAUI,CAAV,CAAX,CAD0C;AAAA,YAE1C,IAAIZ,OAAA,CAAQa,IAAR,CAAJ,EAAmB;AAAA,gBAClBF,aAAA,CAAcE,IAAd,IAAsBvB,cAAA,CAAeU,OAAA,CAAQa,IAAR,CAAf,CAAtB,CADkB;AAAA,aAFuB;AAAA,SANP;AAAA,QAapC,OAAOxB,UAAA,CAAWkB,MAAX,EAAmBI,aAAnB,CAAP,CAboC;AAAA,KAnE3B;AAAA,CAAX,CAtBA;AA2GAxB,QAAA,CAAS2B,QAAT,CAAkB,YAAlB,EAAgCjB,IAAhC","file":"validatejs.js"} \ No newline at end of file diff --git a/dist/global/can-validate-legacy.js b/dist/global/can-validate-legacy.js new file mode 100644 index 0000000..9a5b8f4 --- /dev/null +++ b/dist/global/can-validate-legacy.js @@ -0,0 +1,495 @@ +/*[process-shim]*/ +(function(global, env) { + // jshint ignore:line + if (typeof process === "undefined") { + global.process = { + argv: [], + cwd: function() { + return ""; + }, + browser: true, + env: { + NODE_ENV: env || "development" + }, + version: "", + platform: + global.navigator && + global.navigator.userAgent && + /Windows/.test(global.navigator.userAgent) + ? "win" + : "" + }; + } +})( + typeof self == "object" && self.Object == Object + ? self + : typeof process === "object" && + Object.prototype.toString.call(process) === "[object process]" + ? global + : window, + "development" +); + +/*[global-shim-start]*/ +(function(exports, global, doEval) { + // jshint ignore:line + var origDefine = global.define; + + var get = function(name) { + var parts = name.split("."), + cur = global, + i; + for (i = 0; i < parts.length; i++) { + if (!cur) { + break; + } + cur = cur[parts[i]]; + } + return cur; + }; + var set = function(name, val) { + var parts = name.split("."), + cur = global, + i, + part, + next; + for (i = 0; i < parts.length - 1; i++) { + part = parts[i]; + next = cur[part]; + if (!next) { + next = cur[part] = {}; + } + cur = next; + } + part = parts[parts.length - 1]; + cur[part] = val; + }; + var useDefault = function(mod) { + if (!mod || !mod.__esModule) return false; + var esProps = { __esModule: true, default: true }; + for (var p in mod) { + if (!esProps[p]) return false; + } + return true; + }; + + var hasCjsDependencies = function(deps) { + return ( + deps[0] === "require" && deps[1] === "exports" && deps[2] === "module" + ); + }; + + var modules = + (global.define && global.define.modules) || + (global._define && global._define.modules) || + {}; + var ourDefine = (global.define = function(moduleName, deps, callback) { + var module; + if (typeof deps === "function") { + callback = deps; + deps = []; + } + var args = [], + i; + for (i = 0; i < deps.length; i++) { + args.push( + exports[deps[i]] + ? get(exports[deps[i]]) + : modules[deps[i]] || get(deps[i]) + ); + } + // CJS has no dependencies but 3 callback arguments + if (hasCjsDependencies(deps) || (!deps.length && callback.length)) { + module = { exports: {} }; + args[0] = function(name) { + return exports[name] ? get(exports[name]) : modules[name]; + }; + args[1] = module.exports; + args[2] = module; + } else if (!args[0] && deps[0] === "exports") { + // Babel uses the exports and module object. + module = { exports: {} }; + args[0] = module.exports; + if (deps[1] === "module") { + args[1] = module; + } + } else if (!args[0] && deps[0] === "module") { + args[0] = { id: moduleName }; + } + + global.define = origDefine; + var result = callback ? callback.apply(null, args) : undefined; + global.define = ourDefine; + + // Favor CJS module.exports over the return value + result = module && module.exports ? module.exports : result; + modules[moduleName] = result; + + // Set global exports + var globalExport = exports[moduleName]; + if (globalExport && !get(globalExport)) { + if (useDefault(result)) { + result = result["default"]; + } + set(globalExport, result); + } + }); + global.define.orig = origDefine; + global.define.modules = modules; + global.define.amd = true; + ourDefine("@loader", [], function() { + // shim for @@global-helpers + var noop = function() {}; + return { + get: function() { + return { prepareGlobal: noop, retrieveGlobal: noop }; + }, + global: global, + __exec: function(__load) { + doEval(__load.source, global); + } + }; + }); +})( + {}, + typeof self == "object" && self.Object == Object + ? self + : typeof process === "object" && + Object.prototype.toString.call(process) === "[object process]" + ? global + : window, + function(__$source__, __$global__) { + // jshint ignore:line + eval("(function() { " + __$source__ + " \n }).call(__$global__);"); + } +); + +/*can-validate-legacy@2.0.0#can-validate*/ +define('can-validate-legacy', [ + 'require', + 'exports', + 'module', + 'can-log/dev/dev', + 'can-namespace' +], function (require, exports, module) { + 'use strict'; + var dev = require('can-log/dev/dev'); + var namespace = require('can-namespace'); + var Validate = { + _validatorId: '', + _validators: {}, + validator: function () { + return this._validators[this._validatorId]; + }, + register: function (id, validator) { + this._validatorId = id; + this._validators[id] = validator; + }, + isValid: function () { + return this.validator().isValid.apply(this, arguments); + }, + once: function () { + return this.validator().once.apply(this, arguments); + }, + validate: function () { + var validateArgs = arguments; + return this.validator().validate.apply(this, validateArgs); + } + }; + namespace.validate = Validate; + module.exports = Validate; +}); +/*can-validate-legacy@2.0.0#map/validate/validate*/ +define('can-validate-legacy/map/validate/validate', [ + 'require', + 'exports', + 'module', + 'can-assign', + 'can-map', + 'can-reflect', + 'can-validate-legacy', + 'can-compute' +], function (require, exports, module) { + 'use strict'; + var assign = require('can-assign'); + var Map = require('can-map'); + var canReflect = require('can-reflect'); + var validate = require('can-validate-legacy'); + var compute = require('can-compute'); + var deepAssign = function () { + var objects = [].slice.call(arguments); + var out = {}; + for (var i = 0; i < objects.length; i++) { + assign(out, objects[i]); + } + return out; + }; + var isEmptyObject = function (value) { + return canReflect.size(value) === 0; + }; + var proto = Map.prototype; + var oldSet = proto.__set; + var ErrorsObj; + var defaultValidationOpts; + var config = { + errorKeyName: 'errors', + validateOptionCacheKey: 'validateOptions' + }; + var resolveComputes = function (itemObj, opts) { + var processedObj = {}; + canReflect.eachKey(opts, function (item, key) { + var actualOpts = item; + if (typeof item === 'function') { + actualOpts = item(itemObj.value); + } + processedObj[key] = actualOpts; + }); + return processedObj; + }; + var getPropDefineBehavior = function (behavior, attr, define) { + var prop; + var defaultProp; + if (define) { + prop = define[attr]; + defaultProp = define['*']; + if (prop && prop[behavior] !== undefined) { + return prop[behavior]; + } else { + if (defaultProp && defaultProp[behavior] !== undefined) { + return defaultProp[behavior]; + } + } + } + }; + ErrorsObj = Map.extend({}, { + hasErrors: function () { + return !isEmptyObject(this.attr()); + } + }); + defaultValidationOpts = { + mustValidate: false, + validateOnInit: false + }; + var getValidateFromCache = function () { + var validateCacheKey = '__' + config.validateOptionCacheKey; + if (!this[validateCacheKey]) { + this[validateCacheKey] = {}; + } + return this[validateCacheKey]; + }; + var initProperty = function (key, value) { + var validateOpts; + var mapValidateCache; + var propIniting; + mapValidateCache = getValidateFromCache.call(this); + if (mapValidateCache[key] && !isEmptyObject(mapValidateCache[key])) { + validateOpts = mapValidateCache[key]; + propIniting = false; + } else { + validateOpts = assign({}, getPropDefineBehavior('validate', key, this.define)); + propIniting = true; + } + if (typeof validateOpts !== 'undefined') { + if (propIniting) { + validateOpts = deepAssign(defaultValidationOpts, validateOpts, this._processValidateOpts({ + key: key, + value: value + }, validateOpts)); + mapValidateCache[key] = validateOpts; + } + return true; + } + return false; + }; + var oldSetup = proto.setup; + var oldInit = proto.init; + proto.setup = function () { + this._initValidate = true; + oldSetup.apply(this, arguments); + }; + proto.init = function () { + this._initValidation(); + this._initValidate = false; + if (oldInit) { + oldInit.apply(this, arguments); + } + }; + assign(Map.prototype, { + _initValidation: function () { + var self = this; + var validateCache = getValidateFromCache.call(this); + canReflect.eachKey(this.define, function (props, key) { + if (props.validate && !validateCache[key]) { + initProperty.call(self, key, self[key]); + } + }); + }, + validate: function () { + return this._validate(); + }, + _validate: function () { + var validateOpts = getValidateFromCache.call(this); + var processedOpts = {}; + var self = this; + canReflect.eachKey(this.define, function (value, key) { + if (value.validate) { + processedOpts[key] = resolveComputes({ + key: key, + value: self.attr(key) + }, validateOpts[key]); + } + }); + var errors = validate.validate(this.serialize(), processedOpts); + this.attr('errors', new ErrorsObj(errors)); + return isEmptyObject(errors); + }, + _validateOne: function (item, opts) { + var errors; + var allowSet = true; + errors = validate.once(item.value, assign({}, opts), item.key); + if (errors && errors.length > 0) { + if (!this.attr('errors')) { + this.attr('errors', new ErrorsObj({})); + } + this.attr('errors').attr(item.key, errors); + if (opts.mustValidate === true) { + allowSet = false; + } + } else { + if (this.attr('errors') && this.attr('errors').attr(item.key)) { + this.attr('errors').removeAttr(item.key); + } + } + return allowSet; + }, + _processValidateOpts: function (itemObj, opts) { + var processedObj = {}; + var computes = []; + var self = this; + canReflect.eachKey(opts, function (item, key) { + processedObj[key] = item; + if (typeof item === 'function') { + var newCompute = compute(item.bind(self)); + computes.push({ + key: key, + compute: newCompute + }); + processedObj[key] = newCompute; + } + }); + canReflect.each(computes, function (item) { + item.compute.bind('change', function () { + itemObj.value = self.attr(itemObj.key); + self._validateOne(itemObj, processedObj); + }); + }); + return processedObj; + } + }); + proto.__set = function (prop, value, current, success, error) { + var allowSet = true; + var checkValidate = initProperty.call(this, prop, value); + var validateOpts = getValidateFromCache.call(this)[prop]; + var mapIniting = this._initValidate; + if (checkValidate !== false) { + validateOpts = resolveComputes({ + key: prop, + value: value + }, validateOpts); + if (validateOpts && !mapIniting || validateOpts && mapIniting && validateOpts.validateOnInit) { + allowSet = this._validateOne({ + key: prop, + value: value + }, validateOpts); + } + } + if (allowSet) { + oldSet.call(this, prop, value, current, success, error); + } + }; +}); +/*can-validate-legacy@2.0.0#shims/validatejs*/ +define('can-validate-legacy/shims/validatejs', [ + 'require', + 'exports', + 'module', + 'can-validate-legacy', + 'validate.js' +], function (require, exports, module) { + 'use strict'; + var validate = require('can-validate-legacy'); + var validatejs = require('validate.js'); + var processOptions = function (opts) { + if (typeof opts.required !== 'undefined') { + opts.presence = opts.required; + delete opts.required; + } + if (opts.hasOwnProperty('mustValidate')) { + delete opts.mustValidate; + } + if (opts.hasOwnProperty('validateOnInit')) { + delete opts.validateOnInit; + } + return opts; + }; + var shim = { + once: function (value, options, name) { + var errors = []; + var opts = []; + var validationOpts = []; + if (name) { + opts[name] = value; + validationOpts[name] = processOptions(options); + errors = validatejs(opts, validationOpts); + if (errors) { + errors = errors[name]; + } + } else { + errors = validatejs.single(value, processOptions(options)); + } + return errors; + }, + isValid: function (value, options) { + var errors = validatejs.single(value, processOptions(options)) || []; + return errors.length === 0; + }, + validate: function (values, options) { + var valueKeys = Object.keys(values); + var processedOpts = {}; + for (var i = 0; i < valueKeys.length; i++) { + var prop = valueKeys[i]; + if (options[prop]) { + processedOpts[prop] = processOptions(options[prop]); + } + } + return validatejs(values, processedOpts); + } + }; + validate.register('validatejs', shim); +}); +/*can-validate-build*/ +define('can-validate-legacy/can-validate-build', [ + 'require', + 'exports', + 'module', + 'can-validate-legacy', + 'can-validate-legacy/map/validate/validate', + 'can-validate-legacy/shims/validatejs' +], function (require, exports, module) { + 'use strict'; + var canValidate = require('can-validate-legacy'); + var validate = require('can-validate-legacy/map/validate/validate'); + var validateJsShim = require('can-validate-legacy/shims/validatejs'); + module.exports = { + 'can-validate': canValidate, + 'map': { validate: validate }, + 'shims': { 'validatejs.shim': validateJsShim } + }; +}); +/*[global-shim-end]*/ +(function(global) { // jshint ignore:line + global._define = global.define; + global.define = global.define.orig; +} +)(typeof self == "object" && self.Object == Object ? self : (typeof process === "object" && Object.prototype.toString.call(process) === "[object process]") ? global : window); +//# sourceMappingURL=can-validate-build.js.map \ No newline at end of file diff --git a/dist/global/can-validate-legacy.js.map b/dist/global/can-validate-legacy.js.map new file mode 100644 index 0000000..3481b1e --- /dev/null +++ b/dist/global/can-validate-legacy.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../can-validate.js","../../map/validate/validate.js","../../shims/validatejs.js","../../can-validate-build.js"],"names":["dev","require","namespace","Validate","_validatorId","_validators","validator","register","id","isValid","apply","arguments","once","validate","validateArgs","module","exports","assign","Map","canReflect","compute","deepAssign","objects","slice","call","out","i","length","isEmptyObject","value","size","proto","prototype","oldSet","__set","ErrorsObj","defaultValidationOpts","config","errorKeyName","validateOptionCacheKey","resolveComputes","itemObj","opts","processedObj","eachKey","item","key","actualOpts","getPropDefineBehavior","behavior","attr","define","prop","defaultProp","undefined","extend","hasErrors","mustValidate","validateOnInit","getValidateFromCache","validateCacheKey","initProperty","validateOpts","mapValidateCache","propIniting","_processValidateOpts","oldSetup","setup","oldInit","init","_initValidate","_initValidation","self","validateCache","props","_validate","processedOpts","errors","serialize","_validateOne","allowSet","removeAttr","computes","newCompute","bind","push","each","current","success","error","checkValidate","mapIniting","validatejs","processOptions","required","presence","hasOwnProperty","shim","options","name","validationOpts","single","values","valueKeys","Object","keys","canValidate","validateJsShim"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAA,a;IACA,IAAIA,GAAA,GAAMC,OAAA,CAAQ,iBAAR,CAAV,C;IACA,IAAIC,SAAA,GAAYD,OAAA,CAAQ,eAAR,CAAhB,C;IAGA,IAAIE,QAAA,GAAW;AAAA,QAKdC,YAAA,EAAc,EALA;AAAA,QAUdC,WAAA,EAAa,EAVC;AAAA,QAsBdC,SAAA,EAAW,YAAY;AAAA,YACtB,OAAO,KAAKD,WAAL,CAAiB,KAAKD,YAAtB,CAAP,CADsB;AAAA,SAtBT;AAAA,QAoCdG,QAAA,EAAU,UAAUC,EAAV,EAAcF,SAAd,EAAyB;AAAA,YAClC,KAAKF,YAAL,GAAoBI,EAApB,CADkC;AAAA,YAElC,KAAKH,WAAL,CAAiBG,EAAjB,IAAuBF,SAAvB,CAFkC;AAAA,SApCrB;AAAA,QAqDdG,OAAA,EAAS,YAAY;AAAA,YAEpB,OAAO,KAAKH,SAAL,GAAiBG,OAAjB,CAAyBC,KAAzB,CAA+B,IAA/B,EAAqCC,SAArC,CAAP,CAFoB;AAAA,SArDP;AAAA,QAsEdC,IAAA,EAAM,YAAY;AAAA,YAEjB,OAAO,KAAKN,SAAL,GAAiBM,IAAjB,CAAsBF,KAAtB,CAA4B,IAA5B,EAAkCC,SAAlC,CAAP,CAFiB;AAAA,SAtEJ;AAAA,QAoFdE,QAAA,EAAU,YAAY;AAAA,YACrB,IAAIC,YAAA,GAAeH,SAAnB,CADqB;AAAA,YAGrB,OAAO,KAAKL,SAAL,GAAiBO,QAAjB,CAA0B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