gina 0.0.9-p91c → 0.1.1-alpha.3
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.
- package/INSTALL.md +46 -0
- package/{core/asset/html/static.html → Icon/r} +0 -0
- package/LICENSE +1 -1
- package/README-4Contributors.md +96 -0
- package/README.md +296 -104
- package/bin/cli +287 -0
- package/bin/cli-debug +60 -0
- package/bin/cmd +184 -0
- package/bin/gina +180 -0
- package/config/logger.json +17 -0
- package/doc/framework/cli/doc.json +9 -0
- package/doc/framework/index.md +60 -0
- package/framework/v0.1.1-alpha.3/AUTHORS +7 -0
- package/{core/utils/lib/inherits → framework/v0.1.1-alpha.3}/LICENSE +1 -1
- package/framework/v0.1.1-alpha.3/VERSION +1 -0
- package/{core/locales/dist/language/en.json → framework/v0.1.1-alpha.3/core/asset/html/nolayout.html} +0 -0
- package/{core/locales/dist/language/fr.json → framework/v0.1.1-alpha.3/core/asset/html/static.html} +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/asset/img/android-chrome-192x192.png +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/asset/img/android-chrome-512x512.png +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/asset/img/apple-touch-icon.png +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/asset/img/favicon-16x16.png +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/asset/img/favicon-32x32.png +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/asset/img/favicon.ico +0 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.js +20904 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.js.map +56 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.min.css +1 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.min.css.map +1 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.min.js +736 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.min.js.map +56 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.onload.min.js +5 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.onload.min.js.map +8 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/readme.md +192 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/uuid.json +23 -0
- package/framework/v0.1.1-alpha.3/core/config.js +2308 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/index.js +757 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/lib/connector.js +20 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/lib/connector.v2.js +429 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/lib/connector.v3.js +432 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/lib/n1ql.js +14 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/lib/session-store.js +21 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/lib/session-store.v2.js +258 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/lib/session-store.v3.js +341 -0
- package/{core → framework/v0.1.1-alpha.3/core}/controller/controller.framework.js +3 -2
- package/framework/v0.1.1-alpha.3/core/controller/controller.js +3990 -0
- package/{core → framework/v0.1.1-alpha.3/core}/controller/index.js +5 -5
- package/framework/v0.1.1-alpha.3/core/deps/busboy/.travis.yml +17 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/LICENSE +19 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/README.md +225 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/deps/encoding/encoding-indexes.js +73 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/deps/encoding/encoding.js +2391 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/lib/main.js +89 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/lib/types/multipart.js +328 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/lib/types/urlencoded.js +214 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/lib/utils.js +191 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/package.json +69 -0
- package/framework/v0.1.1-alpha.3/core/deps/swig-client/swig-2.0.0.min.js +5 -0
- package/{core → framework/v0.1.1-alpha.3/core}/dev/index.js +5 -5
- package/{core → framework/v0.1.1-alpha.3/core}/dev/lib/class.js +1 -1
- package/{core → framework/v0.1.1-alpha.3/core}/dev/lib/factory.js +1 -1
- package/{core → framework/v0.1.1-alpha.3/core}/dev/lib/tools.js +0 -0
- package/framework/v0.1.1-alpha.3/core/gna.js +1070 -0
- package/{core → framework/v0.1.1-alpha.3/core}/locales/README.md +41 -2
- package/{core → framework/v0.1.1-alpha.3/core}/locales/currency.json +0 -0
- package/{core/plugins/README.md → framework/v0.1.1-alpha.3/core/locales/dist/language/en.json} +0 -0
- package/{core/plugins/lib/intl/README.md → framework/v0.1.1-alpha.3/core/locales/dist/language/fr.json} +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/locales/dist/region/en.json +0 -0
- package/framework/v0.1.1-alpha.3/core/locales/dist/region/fr.json +9492 -0
- package/{core → framework/v0.1.1-alpha.3/core}/locales/index.js +5 -4
- package/{core → framework/v0.1.1-alpha.3/core}/locales/src/make.js +15 -12
- package/{core → framework/v0.1.1-alpha.3/core}/locales/src/resources/currency.csv +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/locales/src/resources/region.csv +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/locales/src/resources/region.mapping.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/mime.types +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/model/entity.js +156 -196
- package/{core → framework/v0.1.1-alpha.3/core}/model/index.js +67 -48
- package/{core → framework/v0.1.1-alpha.3/core}/model/template/entityFactory.js +2 -2
- package/{core → framework/v0.1.1-alpha.3/core}/model/template/index.js +8 -10
- package/{core/plugins/lib/storage → framework/v0.1.1-alpha.3/core/plugins}/README.md +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/plugins/index.js +3 -3
- package/{core/plugins/lib/validator → framework/v0.1.1-alpha.3/core/plugins/lib/file}/README.md +0 -0
- package/{core/plugins/lib/intl → framework/v0.1.1-alpha.3/core/plugins/lib/file}/build.json +0 -0
- package/framework/v0.1.1-alpha.3/core/plugins/lib/file/package.json +25 -0
- package/{core/utils/lib/collection → framework/v0.1.1-alpha.3/core/plugins/lib/intl}/README.md +0 -0
- package/{core/plugins/lib/storage → framework/v0.1.1-alpha.3/core/plugins/lib/intl}/build.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/plugins/lib/intl/package.json +3 -3
- package/{core → framework/v0.1.1-alpha.3/core}/plugins/lib/intl/src/main.js +17 -1
- package/{core/utils/lib/routing → framework/v0.1.1-alpha.3/core/plugins/lib/storage}/README.md +0 -0
- package/{core/plugins/lib/validator → framework/v0.1.1-alpha.3/core/plugins/lib/storage}/build.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/plugins/lib/storage/package.json +2 -2
- package/{core → framework/v0.1.1-alpha.3/core}/plugins/lib/storage/src/main.js +91 -85
- package/{core/utils/lib/url → framework/v0.1.1-alpha.3/core/plugins/lib/validator}/README.md +0 -0
- package/{core/utils/lib/collection → framework/v0.1.1-alpha.3/core/plugins/lib/validator}/build.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/plugins/lib/validator/package.json +3 -3
- package/framework/v0.1.1-alpha.3/core/plugins/lib/validator/src/form-validator.js +1762 -0
- package/framework/v0.1.1-alpha.3/core/plugins/lib/validator/src/main.js +6917 -0
- package/framework/v0.1.1-alpha.3/core/router.js +664 -0
- package/framework/v0.1.1-alpha.3/core/server.express.js +213 -0
- package/framework/v0.1.1-alpha.3/core/server.isaac.js +386 -0
- package/framework/v0.1.1-alpha.3/core/server.js +3010 -0
- package/{core → framework/v0.1.1-alpha.3/core}/status.codes +8 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/config/app.json +6 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/config/routing.json +11 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/config/settings.json +9 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/config/settings.server.json +30 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/config/templates.json +42 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/controllers/controller.content.js +39 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/controllers/controller.js +30 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/controllers/setup.js +111 -0
- package/{core/template/samples → framework/v0.1.1-alpha.3/core/template/boilerplate}/bundle/index.js +0 -0
- package/{core/template/samples/bundle → framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_namespace}/controllers/controller.js +9 -7
- package/{core/template/views → framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_public}/css/default.css +0 -0
- package/{core/template/views → framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_public}/css/vendor/readme.md +0 -0
- package/{core/template/views → framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_public}/favicon.ico +0 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_public/js/vendor/readme.md +1 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_public/readme.md +1 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_templates/handlers/main.js +24 -0
- package/{core/template/views/html/default.html → framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_templates/html/homepage.html} +0 -0
- package/{core/template/views/html/layout.html → framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_templates/html/layout/main.html} +2 -2
- package/{core → framework/v0.1.1-alpha.3/core}/template/command/gina.bat.tpl +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/command/gina.tpl +1 -1
- package/framework/v0.1.1-alpha.3/core/template/conf/env.json +76 -0
- package/{core/template/conf/project.json → framework/v0.1.1-alpha.3/core/template/conf/manifest.json} +1 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/conf/package.json +2 -2
- package/framework/v0.1.1-alpha.3/core/template/conf/settings.json +92 -0
- package/framework/v0.1.1-alpha.3/core/template/conf/statics.json +10 -0
- package/framework/v0.1.1-alpha.3/core/template/conf/templates.json +37 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/error/client/json/401.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/error/client/json/403.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/error/client/json/404.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/error/server/html/50x.html +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/error/server/json/500.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/error/server/json/503.json +0 -0
- package/{core/utils/lib/routing/build.json → framework/v0.1.1-alpha.3/core/template/extensions/logger/config.json} +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/helpers/console.js +3 -3
- package/{core/utils → framework/v0.1.1-alpha.3}/helpers/context.js +240 -49
- package/framework/v0.1.1-alpha.3/helpers/dateFormat.js +528 -0
- package/framework/v0.1.1-alpha.3/helpers/index.js +79 -0
- package/framework/v0.1.1-alpha.3/helpers/json/README.md +0 -0
- package/framework/v0.1.1-alpha.3/helpers/json/package.json +20 -0
- package/framework/v0.1.1-alpha.3/helpers/json/src/main.js +97 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/helpers/path.js +342 -140
- package/framework/v0.1.1-alpha.3/helpers/plugins/README.md +4 -0
- package/framework/v0.1.1-alpha.3/helpers/plugins/package.json +20 -0
- package/framework/v0.1.1-alpha.3/helpers/plugins/src/api-error.js +160 -0
- package/framework/v0.1.1-alpha.3/helpers/plugins/src/main.js +32 -0
- package/framework/v0.1.1-alpha.3/helpers/prototypes.js +218 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/helpers/task.js +49 -29
- package/{core/utils → framework/v0.1.1-alpha.3}/helpers/text.js +7 -7
- package/framework/v0.1.1-alpha.3/lib/archiver/README.md +0 -0
- package/framework/v0.1.1-alpha.3/lib/archiver/build.json +0 -0
- package/framework/v0.1.1-alpha.3/lib/archiver/package.json +20 -0
- package/framework/v0.1.1-alpha.3/lib/archiver/src/dep/jszip.min.js +15 -0
- package/framework/v0.1.1-alpha.3/lib/archiver/src/main.js +499 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/aliases.json +13 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/add.js +507 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/arguments.json +4 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/copy.js +15 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/cp.js +2 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/help.js +28 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/help.txt +67 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/list.js +129 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/remove.js +229 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/rename.js +4 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/restart.js +235 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/rm.js +2 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/start.js +394 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/status.js +3 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/stop.js +232 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/add.js +436 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/get.js +62 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/help.js +28 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/help.txt +33 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/link-dev.js +80 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/list.js +111 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/remove.js +150 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/rm.js +2 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/set.js +57 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/unset.js +44 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/use.js +79 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/dot.js +70 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/get.js +0 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/help.js +39 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/help.txt +31 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/init.js +514 -0
- package/{core/utils/lib/cmd → framework/v0.1.1-alpha.3/lib/cmd/framework}/msg.json +3 -3
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/open.js +50 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/restart.js +124 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/set.js +161 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/start.js +96 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/status.js +72 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/stop.js +159 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/tail.js +183 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/update.js +0 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/version.js +44 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/gina-dev.1.md +66 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/gina-framework.1.md +100 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/gina.1.md +79 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/helper.js +1147 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/index.js +170 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/msg.json +20 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/port/help.js +28 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/port/help.txt +31 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/port/inc/scan.js +108 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/port/list.js +176 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/port/set.js +0 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/add.js +528 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/arguments.json +9 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/build.js +115 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/help.js +28 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/help.txt +76 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/import.js +2 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/list.js +55 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/move.js +0 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/remove.js +144 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/rename.js +162 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/restart.js +0 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/rm.js +2 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/start.js +0 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/status.js +3 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/stop.js +0 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/protocol/help.js +27 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/protocol/help.txt +57 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/protocol/list.js +239 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/protocol/set.js +631 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/help.js +28 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/help.txt +33 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/link-local.js +80 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/list.js +116 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/remove.js +150 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/rm.js +2 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/set.js +57 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/unset.js +44 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/use.js +79 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/view/add.js +311 -0
- package/framework/v0.1.1-alpha.3/lib/collection/README.md +5 -0
- package/framework/v0.1.1-alpha.3/lib/collection/build.json +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/collection/package.json +2 -2
- package/framework/v0.1.1-alpha.3/lib/collection/src/main.js +1459 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/config.js +49 -34
- package/framework/v0.1.1-alpha.3/lib/cron/README.md +7 -0
- package/framework/v0.1.1-alpha.3/lib/cron/package.json +20 -0
- package/framework/v0.1.1-alpha.3/lib/cron/src/main.js +176 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/generator/index.js +8 -4
- package/framework/v0.1.1-alpha.3/lib/index.js +116 -0
- package/framework/v0.1.1-alpha.3/lib/inherits/LICENSE +19 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/inherits/README.md +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/inherits/example/inheriting_eventemitter.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/inherits/example/protected_inheritance.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/inherits/example/simple_inheritance.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/inherits/example/super_attribute_overridden_by_child_on_init.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/inherits/package.json +2 -2
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/inherits/src/main.js +18 -19
- package/framework/v0.1.1-alpha.3/lib/logger/README.md +7 -0
- package/framework/v0.1.1-alpha.3/lib/logger/package.json +20 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/containers/default/index.js +55 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/containers/file/index.js +251 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/containers/file/lib/logrotator/README.md +100 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/containers/file/lib/logrotator/index.js +274 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/containers/mq/index.js +52 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/containers/mq/listener.js +302 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/containers/mq/speaker.js +118 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/helper.js +131 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/main.js +739 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/math/index.js +58 -35
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/merge/README.md +5 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/merge/example/merge.js +1 -1
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/merge/example/merge_2_literal objects.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/merge/example/merge_and_preserve_first.js +2 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/merge/package.json +2 -2
- package/framework/v0.1.1-alpha.3/lib/merge/src/main.js +531 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/model.js +42 -19
- package/framework/v0.1.1-alpha.3/lib/proc.js +518 -0
- package/framework/v0.1.1-alpha.3/lib/routing/README.md +0 -0
- package/framework/v0.1.1-alpha.3/lib/routing/build.json +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/routing/package.json +2 -2
- package/framework/v0.1.1-alpha.3/lib/routing/src/main.js +1492 -0
- package/framework/v0.1.1-alpha.3/lib/session-store.js +33 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/shell.js +43 -30
- package/framework/v0.1.1-alpha.3/lib/swig-filters/README.md +0 -0
- package/framework/v0.1.1-alpha.3/lib/swig-filters/package.json +20 -0
- package/framework/v0.1.1-alpha.3/lib/swig-filters/src/main.js +322 -0
- package/framework/v0.1.1-alpha.3/lib/url/README.md +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/url/index.js +2 -1
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/url/mocks.json +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/url/routing.json +9 -9
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/url/test.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/validator.js +7 -7
- package/framework/v0.1.1-alpha.3/package.json +14 -0
- package/package.json +35 -33
- package/resources/etc/init.d/debian/gina +117 -0
- package/resources/home/framework/env.json +34 -0
- package/resources/home/framework/locals.json +14 -0
- package/resources/home/framework/project.json +48 -0
- package/resources/home/framework/projects.json +6 -0
- package/resources/home/main.json +47 -0
- package/resources/home/settings.json +22 -0
- package/resources/home/user/extensions/logger/default/config.json +77 -0
- package/resources/home/user/extensions/logger/file/config.json +11 -0
- package/resources/img/android-chrome-192x192.png +0 -0
- package/resources/img/android-chrome-512x512.png +0 -0
- package/resources/img/apple-touch-icon.png +0 -0
- package/resources/img/favicon-16x16.png +0 -0
- package/resources/img/favicon-32x32.png +0 -0
- package/resources/img/favicon.ico +0 -0
- package/resources/package.json.template +50 -0
- package/script/lib.js +24 -0
- package/script/post_install.js +449 -157
- package/script/pre_install.js +277 -36
- package/script/prepare_version.js +425 -0
- package/utils/helper.js +438 -0
- package/utils/prototypes.js +239 -0
- package/utils/prototypes.json_clone.js +175 -0
- package/.npmignore +0 -6
- package/MIDDLEWARE +0 -1
- package/SUCCESS +0 -1
- package/VERSION +0 -1
- package/core/asset/html/nolayout.html +0 -1
- package/core/asset/js/plugin/build.dev.json +0 -28
- package/core/asset/js/plugin/build.json +0 -31
- package/core/asset/js/plugin/dist/gina.min.css +0 -1
- package/core/asset/js/plugin/dist/gina.min.css.map +0 -1
- package/core/asset/js/plugin/dist/gina.min.js +0 -13732
- package/core/asset/js/plugin/dist/gina.min.js.map +0 -42
- package/core/asset/js/plugin/dist/gina.onload.min.js +0 -3
- package/core/asset/js/plugin/dist/gina.onload.min.js.map +0 -8
- package/core/asset/js/plugin/readme.md +0 -152
- package/core/asset/js/plugin/src/gina/main.js +0 -132
- package/core/asset/js/plugin/src/gina/popin/css/design.css +0 -23
- package/core/asset/js/plugin/src/gina/popin/css/main.css +0 -1112
- package/core/asset/js/plugin/src/gina/popin/css/popin.css +0 -3
- package/core/asset/js/plugin/src/gina/popin/css/popin.css.map +0 -1
- package/core/asset/js/plugin/src/gina/popin/doc/TOC.md +0 -29
- package/core/asset/js/plugin/src/gina/popin/doc/css.md +0 -162
- package/core/asset/js/plugin/src/gina/popin/doc/extend.md +0 -663
- package/core/asset/js/plugin/src/gina/popin/doc/faq.md +0 -46
- package/core/asset/js/plugin/src/gina/popin/doc/html.md +0 -227
- package/core/asset/js/plugin/src/gina/popin/doc/js.md +0 -37
- package/core/asset/js/plugin/src/gina/popin/doc/misc.md +0 -178
- package/core/asset/js/plugin/src/gina/popin/doc/usage.md +0 -130
- package/core/asset/js/plugin/src/gina/popin/main.js +0 -783
- package/core/asset/js/plugin/src/gina/popin/sass/config.sass +0 -37
- package/core/asset/js/plugin/src/gina/popin/sass/gina-design.sass +0 -622
- package/core/asset/js/plugin/src/gina/popin/sass/gina-popin.sass +0 -54
- package/core/asset/js/plugin/src/gina/popin/sass/helper.scss +0 -73
- package/core/asset/js/plugin/src/gina/toolbar/.npmignore +0 -19
- package/core/asset/js/plugin/src/gina/toolbar/css/toolbar.css +0 -433
- package/core/asset/js/plugin/src/gina/toolbar/css/toolbar.css.map +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/index.html +0 -285
- package/core/asset/js/plugin/src/gina/toolbar/index.kit +0 -120
- package/core/asset/js/plugin/src/gina/toolbar/jquery-3.1.0.min.js +0 -4
- package/core/asset/js/plugin/src/gina/toolbar/main.js +0 -693
- package/core/asset/js/plugin/src/gina/toolbar/mock.gina.json +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/mock.user.json +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/readme.md +0 -7
- package/core/asset/js/plugin/src/gina/toolbar/sass/toolbar.sass +0 -563
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/Info-color.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/Info-grey.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/error-color.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/error-grey.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/info-optim.svg +0 -13
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/logo-gina.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/settings-big.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/settings.afdesign +0 -0
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/settings.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-calendar-optim.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-calendar.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-card-optim.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-card.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-lock-optim.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-lock.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/warning-color.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/warning-grey.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/test.jpg +0 -0
- package/core/asset/js/plugin/src/gina/toolbar/toolbar.html +0 -104
- package/core/asset/js/plugin/src/gina/utils/dom.js +0 -24
- package/core/asset/js/plugin/src/gina/utils/events.js +0 -201
- package/core/asset/js/plugin/src/gina/utils/loader.js +0 -57
- package/core/asset/js/plugin/src/main.js +0 -235
- package/core/asset/js/plugin/src/vendor/jquery/1.11.1-css-event_alias.min.js +0 -5
- package/core/asset/js/plugin/src/vendor/jquery/1.12.4.min.js +0 -5
- package/core/asset/js/plugin/src/vendor/jquery/2.1.1-css-event_alias-sizzle.min.js +0 -4
- package/core/asset/js/plugin/src/vendor/jquery/README.md +0 -14
- package/core/asset/js/plugin/src/vendor/jquery/slim-3.1.1.min.js +0 -4
- package/core/config.js +0 -1225
- package/core/controller/controller.js +0 -1860
- package/core/gna.js +0 -908
- package/core/plugins/lib/validator/src/form-validator.js +0 -789
- package/core/plugins/lib/validator/src/main.js +0 -2056
- package/core/router.js +0 -717
- package/core/server.js +0 -1363
- package/core/template/conf/env.json +0 -70
- package/core/template/conf/settings.json +0 -48
- package/core/template/conf/statics.json +0 -6
- package/core/template/conf/views.json +0 -16
- package/core/template/samples/bundle/config/app.json +0 -4
- package/core/template/samples/bundle/config/routing.json +0 -9
- package/core/template/samples/bundle/controllers/setup.js +0 -33
- package/core/template/views/js/vendor/readme.md +0 -1
- package/core/template/views/readme.md +0 -1
- package/core/utils/helpers/dateFormat.js +0 -264
- package/core/utils/helpers/index.js +0 -202
- package/core/utils/index.js +0 -75
- package/core/utils/lib/cmd/app.js +0 -686
- package/core/utils/lib/cmd/basic.help.txt +0 -40
- package/core/utils/lib/cmd/basic.js +0 -141
- package/core/utils/lib/cmd/gina-add-bundle.js +0 -328
- package/core/utils/lib/cmd/gina-add-views.js +0 -99
- package/core/utils/lib/cmd/gina-build.js +0 -218
- package/core/utils/lib/cmd/gina-clean.js +0 -26
- package/core/utils/lib/cmd/gina-connect.js +0 -176
- package/core/utils/lib/cmd/gina-delete-bundle.js +0 -176
- package/core/utils/lib/cmd/gina-deploy.js +0 -452
- package/core/utils/lib/cmd/gina-init-project.js +0 -83
- package/core/utils/lib/cmd/gina-start-bundle.js +0 -3
- package/core/utils/lib/cmd/gina-start.js +0 -3
- package/core/utils/lib/cmd/index.js +0 -157
- package/core/utils/lib/cmd/project.js +0 -14
- package/core/utils/lib/collection/src/main.js +0 -650
- package/core/utils/lib/logger/containers/file.js +0 -11
- package/core/utils/lib/logger/index.js +0 -260
- package/core/utils/lib/merge/src/main.js +0 -344
- package/core/utils/lib/proc.js +0 -416
- package/core/utils/lib/routing/src/main.js +0 -165
- package/documentation/css/default.css +0 -3
- package/documentation/html/home.html +0 -6
- package/documentation/html/inc/_footer.html +0 -5
- package/documentation/html/layout.html +0 -21
- package/documentation/img/debug-conf1.png +0 -0
- package/documentation/img/debug-conf2.png +0 -0
- package/documentation/img/debug-conf3.png +0 -0
- package/documentation/img/debug-conf4.png +0 -0
- package/documentation/img/debug-conf5.png +0 -0
- package/documentation/img/debug-conf6.png +0 -0
- package/documentation/img/debug-conf7.png +0 -0
- package/documentation/img/debug-new1.png +0 -0
- package/documentation/img/debug-new2.png +0 -0
- package/documentation/img/debug-start.png +0 -0
- package/documentation/md/api/controller/main.md +0 -74
- package/migration_note.md +0 -7
- package/package-lock.json +0 -611
- package/script/pre_publish.js +0 -207
- package/tutorial/Commands/README.md +0 -56
- package/tutorial/Commands/add-bundle-result.png +0 -0
- package/tutorial/Commands/add-bundle.png +0 -0
- package/tutorial/Commands/delete-bundle.png +0 -0
- package/tutorial/Commands/help.png +0 -0
- package/tutorial/Commands/init-project.png +0 -0
- package/tutorial/Commands/start-bundle-result.png +0 -0
- package/tutorial/Commands/start-bundle-stop.png +0 -0
- package/tutorial/Commands/start-bundle.png +0 -0
- package/tutorial/Commands/version.png +0 -0
- package/tutorial/ETC/README.md +0 -74
- package/tutorial/ETC/add-bundle-result.png +0 -0
- package/tutorial/ETC/add-bundle.png +0 -0
- package/tutorial/ETC/init-project.png +0 -0
- package/tutorial/Install/README.md +0 -54
- package/tutorial/Install/git-get.png +0 -0
- package/tutorial/Install/git-install-end.png +0 -0
- package/tutorial/Install/git-install-result.png +0 -0
- package/tutorial/Install/git-install-start.png +0 -0
- package/tutorial/Install/install-end.png +0 -0
- package/tutorial/Install/install-result.png +0 -0
- package/tutorial/Install/install-start.png +0 -0
- package/tutorial/WebStorm/README.md +0 -30
- package/tutorial/WebStorm/closure-compiler.png +0 -0
- package/tutorial/WebStorm/sass.png +0 -0
|
@@ -1,789 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FormValidatorUtil
|
|
3
|
-
*
|
|
4
|
-
* Dependencies:
|
|
5
|
-
* - utils/merge
|
|
6
|
-
* - utils/helpers
|
|
7
|
-
* - utils/helpers/dateFormat
|
|
8
|
-
*
|
|
9
|
-
* @param {object} data
|
|
10
|
-
* @param {object} [ $fields ] - isGFFCtx only
|
|
11
|
-
* */
|
|
12
|
-
function FormValidatorUtil(data, $fields) {
|
|
13
|
-
|
|
14
|
-
var isGFFCtx = ( ( typeof(module) !== 'undefined' ) && module.exports ) ? false : true;
|
|
15
|
-
|
|
16
|
-
if (isGFFCtx && !$fields )
|
|
17
|
-
throw new Error('No `Validator` instance found.\nTry:\nvar FormValidator = require("gina/validator"):\nvar formValidator = new FormValidator(...);')
|
|
18
|
-
|
|
19
|
-
var merge = (isGFFCtx) ? require('utils/merge') : require('../../../../utils/lib/merge');
|
|
20
|
-
var helpers = (isGFFCtx) ? {} : require('../../../../utils/helpers');
|
|
21
|
-
var dateFormat = (isGFFCtx) ? require('helpers/dateFormat') : helpers.dateFormat;
|
|
22
|
-
|
|
23
|
-
var local = {
|
|
24
|
-
'errors': {},
|
|
25
|
-
'keys': {
|
|
26
|
-
'%l': 'label', // %l => label: needs `data-gina-form-field-label` attribute (frontend only)
|
|
27
|
-
'%n': 'name', // %n => field name
|
|
28
|
-
'%s': 'size' // %s => length
|
|
29
|
-
},
|
|
30
|
-
'errorLabels': {},
|
|
31
|
-
'data': {}, // output to send
|
|
32
|
-
'excluded': []
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
local.errorLabels = {
|
|
36
|
-
'is': 'Condition not satisfied',
|
|
37
|
-
'isEmail': 'A valid email is required',
|
|
38
|
-
'isRequired': 'Cannot be left empty',
|
|
39
|
-
'isBoolean': 'Must be a valid boolean',
|
|
40
|
-
'isNumber': 'Must be a number: allowed values are integers or floats',
|
|
41
|
-
'isNumberLength': 'Must contain %s characters',
|
|
42
|
-
'isNumberMinLength': 'Should be at least %s characters',
|
|
43
|
-
'isNumberMaxLength': 'Should not be more than %s characters',
|
|
44
|
-
'isInteger': 'Must be an integer',
|
|
45
|
-
'isIntegerLength': 'Must have %s characters',
|
|
46
|
-
'isIntegerMinLength': 'Should be at least %s characters',
|
|
47
|
-
'isIntegerMaxLength': 'Should not be more than %s characters',
|
|
48
|
-
'toInteger': 'Could not be converted to integer',
|
|
49
|
-
'isFloat': 'Must be a proper float',
|
|
50
|
-
'isFloatException': 'Float exception found: %n',
|
|
51
|
-
'toFloat': 'Could not be converted to float',
|
|
52
|
-
'toFloatNAN': 'Value must be a valid number',
|
|
53
|
-
'isDate': 'Must be a valid Date',
|
|
54
|
-
'isString': 'Must be a string',
|
|
55
|
-
'isStringLength': 'Must have %s characters',
|
|
56
|
-
'isStringMinLength': 'Should be at least %s characters',
|
|
57
|
-
'isStringMaxLength': 'Should not be more than %s characters'
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
if (!data) {
|
|
61
|
-
throw new Error('missing data param')
|
|
62
|
-
} else {
|
|
63
|
-
// cloning
|
|
64
|
-
var self = JSON.parse( JSON.stringify(data) );
|
|
65
|
-
local.data = JSON.parse( JSON.stringify(data) )
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
var val = null, label = null;
|
|
70
|
-
for (var el in self) {
|
|
71
|
-
|
|
72
|
-
if ( typeof(self[el]) == 'object' ) {
|
|
73
|
-
try {
|
|
74
|
-
val = JSON.parse( JSON.stringify( self[el] ))
|
|
75
|
-
} catch (err) {
|
|
76
|
-
val = self[el]
|
|
77
|
-
}
|
|
78
|
-
} else {
|
|
79
|
-
val = self[el]
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
label = '';
|
|
83
|
-
if ( isGFFCtx && typeof($fields) != 'undefined' ) { // frontend only
|
|
84
|
-
label = $fields[el].getAttribute('data-gina-form-field-label') || '';
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// keys are stringyfied because of the compiler !!!
|
|
88
|
-
self[el] = {
|
|
89
|
-
'target': (isGFFCtx) ? $fields[el] : null,
|
|
90
|
-
'name': el,
|
|
91
|
-
'value': val,
|
|
92
|
-
'valid': false,
|
|
93
|
-
// is name by default, but you should use setLabe(name) to change it if you need to
|
|
94
|
-
'label': label,
|
|
95
|
-
// check as field to exclude while sending datas to the model
|
|
96
|
-
'exclude': false
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
*
|
|
101
|
-
* is(condition) -> validate if value matches `condition`
|
|
102
|
-
*
|
|
103
|
-
* When entered in a JSON rule, you must double the backslashes
|
|
104
|
-
*
|
|
105
|
-
* e.g.:
|
|
106
|
-
* "/\\D+/" -> like [^0-9]
|
|
107
|
-
* "!/^\\\\s+/" -> not starting by white space allow
|
|
108
|
-
* "/^[0-9]+$/" -> only numbers
|
|
109
|
-
* "$field === $fieldOther" -> will be evaluated
|
|
110
|
-
*
|
|
111
|
-
* @param {object|string} condition - RegExp object, or condition to eval, or eval result
|
|
112
|
-
* @param {string} [errorMessage] - error message
|
|
113
|
-
* @param {string} [errorStack] - error stack
|
|
114
|
-
*
|
|
115
|
-
* */
|
|
116
|
-
self[el]['is'] = function(condition, errorMessage, errorStack) {
|
|
117
|
-
var valid = false;
|
|
118
|
-
var errors = {};
|
|
119
|
-
|
|
120
|
-
if ( /\$[-_\[\]a-z 0-9]+|^!\//i.test(condition) ) {
|
|
121
|
-
|
|
122
|
-
var variables = condition.match(/\${0}[-_\[\]a-z0-9]+/ig); // without space(s)
|
|
123
|
-
var compiledCondition = condition;
|
|
124
|
-
var re = null
|
|
125
|
-
for (var i = 0, len = variables.length; i < len; ++i) {
|
|
126
|
-
if ( typeof(self[ variables[i] ]) != 'undefined' && variables[i]) {
|
|
127
|
-
re = new RegExp("\\$"+ variables[i] +"(?!\\S+)", "g");
|
|
128
|
-
if ( self[ variables[i] ].value == "" ) {
|
|
129
|
-
compiledCondition = compiledCondition.replace(re, '"');
|
|
130
|
-
} else if ( typeof(self[ variables[i] ].value) == 'string' ) {
|
|
131
|
-
compiledCondition = compiledCondition.replace(re, '"'+ self[ variables[i] ].value +'"');
|
|
132
|
-
} else {
|
|
133
|
-
compiledCondition = compiledCondition.replace(re, self[ variables[i] ].value);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
try {
|
|
139
|
-
// security checks
|
|
140
|
-
compiledCondition = compiledCondition.replace(/(\(|\)|return)/g, '');
|
|
141
|
-
valid = eval(compiledCondition+'.test("'+ this.value +'")')
|
|
142
|
-
} catch (err) {
|
|
143
|
-
throw new Error(err.stack||err.message)
|
|
144
|
-
}
|
|
145
|
-
} else if ( condition instanceof RegExp ) {
|
|
146
|
-
|
|
147
|
-
valid = condition.test(this.value) ? true : false;
|
|
148
|
-
|
|
149
|
-
} else if( typeof(condition) == 'boolean') {
|
|
150
|
-
|
|
151
|
-
valid = (condition) ? true : false;
|
|
152
|
-
|
|
153
|
-
} else {
|
|
154
|
-
try {
|
|
155
|
-
// TODO - motif /gi to pass to the second argument
|
|
156
|
-
valid = new RegExp(condition.replace(/\//g, '')).test(this.value)
|
|
157
|
-
} catch (err) {
|
|
158
|
-
throw new Error(err.stack||err.message)
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (!valid) {
|
|
163
|
-
errors['is'] = replace(this.error || errorMessage || local.errorLabels['is'], this);
|
|
164
|
-
if ( typeof(errorStack) != 'undefined' )
|
|
165
|
-
errors['stack'] = errorStack;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
this.valid = valid;
|
|
169
|
-
if ( errors.count() > 0 )
|
|
170
|
-
this['errors'] = errors;
|
|
171
|
-
|
|
172
|
-
return self[this.name]
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
self[el]['isEmail'] = function() {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
this.value = local['data'][this.name] = this.value.toLowerCase();
|
|
179
|
-
|
|
180
|
-
var rgx = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
181
|
-
var isValid = rgx.test(this['value']) ? true : false;
|
|
182
|
-
var errors = self[this['name']]['errors'] || {};
|
|
183
|
-
|
|
184
|
-
if ( !errors['isRequired'] && this.value == '' ) {
|
|
185
|
-
isValid = true;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (!isValid) {
|
|
189
|
-
errors['isEmail'] = replace(this['error'] || local.errorLabels['isEmail'], this)
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
this.valid = isValid;
|
|
193
|
-
|
|
194
|
-
if ( errors.count() > 0 )
|
|
195
|
-
this['errors'] = errors;
|
|
196
|
-
|
|
197
|
-
return self[this['name']]
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Check if boolean and convert to `true/false` booloean if value is a string or a number
|
|
202
|
-
* Will include `false` value if isRequired
|
|
203
|
-
* */
|
|
204
|
-
self[el]['isBoolean'] = function() {
|
|
205
|
-
var val = null
|
|
206
|
-
, errors = self[this['name']]['errors'] || {}
|
|
207
|
-
;
|
|
208
|
-
|
|
209
|
-
if ( errors['isRequired'] && this.value == false ) {
|
|
210
|
-
isValid = true;
|
|
211
|
-
delete errors['isRequired'];
|
|
212
|
-
this['errors'] = errors;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
switch(this.value) {
|
|
216
|
-
case 'true':
|
|
217
|
-
case true:
|
|
218
|
-
case 1:
|
|
219
|
-
val = this.value = local.data[this.name] = true;
|
|
220
|
-
break;
|
|
221
|
-
case 'false':
|
|
222
|
-
case false:
|
|
223
|
-
case 0:
|
|
224
|
-
val = this.value = local.data[this.name] = false;
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
var valid = (val !== null) ? true : false;
|
|
228
|
-
|
|
229
|
-
if (!valid) {
|
|
230
|
-
errors['isBoolean'] = replace(this.error || local.errorLabels['isBoolean'], this)
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
this.valid = valid;
|
|
234
|
-
if ( errors.count() > 0 )
|
|
235
|
-
this['errors'] = errors;
|
|
236
|
-
|
|
237
|
-
return self[this.name]
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Check if value is an a Number.
|
|
242
|
-
* - valid if a number is found
|
|
243
|
-
* - cast into a number if a string is found
|
|
244
|
-
* - if string is blank, no transformation will be done: valid if not required
|
|
245
|
-
*
|
|
246
|
-
* @param {number} minLength
|
|
247
|
-
* @param {number} maxLength
|
|
248
|
-
*
|
|
249
|
-
* @return {object} result
|
|
250
|
-
* */
|
|
251
|
-
self[el]['isNumber'] = function(minLength, maxLength) {
|
|
252
|
-
var val = this.value
|
|
253
|
-
, len = 0
|
|
254
|
-
, isValid = false
|
|
255
|
-
, isMinLength = true
|
|
256
|
-
, isMaxLength = true
|
|
257
|
-
, errors = {}
|
|
258
|
-
;
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
// test if val is a number
|
|
262
|
-
try {
|
|
263
|
-
// if val is a string replaces comas by points
|
|
264
|
-
if ( typeof(val) == 'string' && /,/g.test(val) ) {
|
|
265
|
-
val = this.value = parseFloat( val.replace(/,/g, '.').replace(/\s+/g, '') );
|
|
266
|
-
} else if ( typeof(val) == 'string' && val != '') {
|
|
267
|
-
val = this.value = parseInt( val );
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
} catch (err) {
|
|
271
|
-
errors['isNumber'] = replace(this.error || local.errorLabels['isNumber'], this);
|
|
272
|
-
this.valid = false;
|
|
273
|
-
if ( errors.count() > 0 )
|
|
274
|
-
this['errors'] = errors;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
if ( +val === +val ) {
|
|
278
|
-
isValid = true;
|
|
279
|
-
if ( !errors['isRequired'] && val != '' ) {
|
|
280
|
-
len = val.toString().length;
|
|
281
|
-
// if so also test max and min length if defined
|
|
282
|
-
if (minLength && typeof(minLength) == 'number' && len < minLength) {
|
|
283
|
-
isMinLength = false;
|
|
284
|
-
this['size'] = minLength;
|
|
285
|
-
}
|
|
286
|
-
if (maxLength && typeof(maxLength) == 'number' && len > maxLength) {
|
|
287
|
-
isMaxLength = false;
|
|
288
|
-
this['size'] = maxLength;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
// if val is invalid return error message
|
|
294
|
-
if ( !isValid || !isMinLength || !isMaxLength ) {
|
|
295
|
-
|
|
296
|
-
if ( !isValid )
|
|
297
|
-
errors['isNumber'] = replace(this.error || local.errorLabels['isNumber'], this);
|
|
298
|
-
if ( !isMinLength || !isMaxLength ) {
|
|
299
|
-
if ( !isMinLength )
|
|
300
|
-
errors['isNumberLength'] = replace(this.error || local.errorLabels['isNumberMinLength'], this);
|
|
301
|
-
if ( !isMaxLength )
|
|
302
|
-
errors['isNumberLength'] = replace(this.error || local.errorLabels['isNumberMaxLength'], this);
|
|
303
|
-
if ( minLength === maxLength )
|
|
304
|
-
errors['isNumberLength'] = replace(this.error || local.errorLabels['isNumberLength'], this);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
isValid = false;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
this.valid = isValid;
|
|
311
|
-
val = this.value = local.data[this.name] = ( val != '' ) ? Number(val) : val;
|
|
312
|
-
if ( errors.count() > 0 )
|
|
313
|
-
this['errors'] = errors;
|
|
314
|
-
|
|
315
|
-
return self[this.name]
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
self[el]['toInteger'] = function() {
|
|
319
|
-
var val = this.value, errors = {};
|
|
320
|
-
|
|
321
|
-
if (!val) {
|
|
322
|
-
return self[this.name]
|
|
323
|
-
} else {
|
|
324
|
-
try {
|
|
325
|
-
//val = this.value = local.data[this.name] = ~~(val.match(/[0-9]+/g).join(''));
|
|
326
|
-
val = this.value = local.data[this.name] = Math.round(val);
|
|
327
|
-
} catch (err) {
|
|
328
|
-
|
|
329
|
-
errors['toInteger'] = replace(this.error || local.errorLabels['toInteger'], this);
|
|
330
|
-
this.valid = false;
|
|
331
|
-
if ( errors.count() > 0 )
|
|
332
|
-
this['errors'] = errors;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
return self[this.name]
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
self[el]['isInteger'] = function(minLength, maxLength) {
|
|
341
|
-
var val = this.value
|
|
342
|
-
, isValid = false
|
|
343
|
-
, isMinLength = true
|
|
344
|
-
, isMaxLength = true
|
|
345
|
-
, errors = {}
|
|
346
|
-
;
|
|
347
|
-
|
|
348
|
-
// test if val is a number
|
|
349
|
-
if ( +val === +val && val % 1 === 0 ) {
|
|
350
|
-
isValid = true;
|
|
351
|
-
if ( !errors['isRequired'] && val != '' ) {
|
|
352
|
-
// if so also test max and min length if defined
|
|
353
|
-
if (minLength && typeof(minLength) == 'number' && val.length < minLength) {
|
|
354
|
-
isMinLength = false;
|
|
355
|
-
this['size'] = minLength;
|
|
356
|
-
}
|
|
357
|
-
if (maxLength && typeof(maxLength) == 'number' && val.length > maxLength) {
|
|
358
|
-
isMaxLength = false;
|
|
359
|
-
this['size'] = maxLength;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
// if val is invalid return error message
|
|
364
|
-
if ( !isValid || !isMinLength || !isMaxLength ) {
|
|
365
|
-
|
|
366
|
-
if ( !isValid )
|
|
367
|
-
errors['isInteger'] = replace(this.error || local.errorLabels['isInteger'], this);
|
|
368
|
-
|
|
369
|
-
if ( !isMinLength || !isMaxLength ) {
|
|
370
|
-
|
|
371
|
-
if ( !isMinLength ) {
|
|
372
|
-
errors['isIntegerLength'] = replace(this.error || local.errorLabels['isIntegerMinLength'], this);
|
|
373
|
-
isValid = false;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
if ( !isMaxLength ) {
|
|
377
|
-
errors['isIntegerLength'] = replace(this.error || local.errorLabels['isIntegerMaxLength'], this);
|
|
378
|
-
isValid = false;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
if ( minLength === maxLength ) {
|
|
382
|
-
errors['isIntegerLength'] = replace(this.error || local.errorLabels['isIntegerLength'], this);
|
|
383
|
-
isValid = false;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
this.valid = isValid;
|
|
389
|
-
val = this.value = local.data[this.name] = Number(val);
|
|
390
|
-
|
|
391
|
-
if ( errors.count() > 0 )
|
|
392
|
-
this['errors'] = errors;
|
|
393
|
-
|
|
394
|
-
return self[this.name]
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
self[el]['toFloat'] = function(decimals) {
|
|
399
|
-
if ( typeof(this.value) == 'string' ) {
|
|
400
|
-
this.value = this.value.replace(/\s+/g, '');
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
var val = this.value, errors = {}, isValid = true;
|
|
404
|
-
|
|
405
|
-
if (decimals) {
|
|
406
|
-
this['decimals'] = parseInt(decimals)
|
|
407
|
-
} else if ( typeof(this['decimals']) == 'undefined' ) {
|
|
408
|
-
this['decimals'] = 2
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
if (!val) {
|
|
412
|
-
return self[this.name]
|
|
413
|
-
} else {
|
|
414
|
-
if ( this['isNumber']().valid ) {
|
|
415
|
-
try {
|
|
416
|
-
|
|
417
|
-
if ( !Number.isFinite(val) ) {
|
|
418
|
-
val = this.value = local.data[this.name] = new Number(parseFloat(val.match(/[0-9.,]+/g).join('').replace(/,/, '.')));// Number <> number
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
this.target.setAttribute('value', val);
|
|
422
|
-
} catch(err) {
|
|
423
|
-
isValid = false;
|
|
424
|
-
errors['toFloat'] = replace(this.error || local.errorLabels['toFloat'], this);
|
|
425
|
-
this.valid = false;
|
|
426
|
-
if ( errors.count() > 0 )
|
|
427
|
-
this['errors'] = errors;
|
|
428
|
-
}
|
|
429
|
-
} else {
|
|
430
|
-
isValid = false;
|
|
431
|
-
errors['toFloat'] = replace(this.error || local.errorLabels['toFloatNAN'], this)
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
if (this['decimals'] && val && !errors['toFloat']) {
|
|
436
|
-
this.value = local.data[this.name] = parseFloat(this.value.toFixed(this['decimals']));
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
this.valid = isValid;
|
|
440
|
-
if ( errors.count() > 0 )
|
|
441
|
-
this['errors'] = errors;
|
|
442
|
-
|
|
443
|
-
return self[this.name]
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
/**
|
|
447
|
-
* Check if value is float. No transformation is done here.
|
|
448
|
-
* Can be used in combo preceded by *.toFloat(2) to transform data if needed:
|
|
449
|
-
* 1 => 1.0
|
|
450
|
-
* or
|
|
451
|
-
* 3 500,5 => 3500.50
|
|
452
|
-
*
|
|
453
|
-
*
|
|
454
|
-
* @param {number} [ decimals ]
|
|
455
|
-
*
|
|
456
|
-
* TODO - decimals transformation
|
|
457
|
-
* */
|
|
458
|
-
self[el]['isFloat'] = function(decimals) {
|
|
459
|
-
|
|
460
|
-
if ( typeof(this.value) == 'string' ) {
|
|
461
|
-
this.value = this.value.replace(/\s+/g, '');
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
var val = this.value
|
|
465
|
-
, isValid = false
|
|
466
|
-
, errors = {};
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
if ( typeof(val) == 'string' && /\./.test(val) && Number.isFinite( Number(val) ) ) {
|
|
470
|
-
isValid = true
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
// if string replaces comas by points
|
|
474
|
-
if (typeof(val) == 'string' && /,/g.test(val)) {
|
|
475
|
-
val = this.value = local.data[this.name] = Number(val.replace(/,/g, '.'))
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
// test if val is strictly a float
|
|
479
|
-
if ( Number(val) === val && val % 1 !== 0 ) {
|
|
480
|
-
this.value = local.data[this.name] = Number(val);
|
|
481
|
-
isValid = true
|
|
482
|
-
} else {
|
|
483
|
-
isValid = false
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
if ( !errors['isRequired'] && this.value == '' ) {
|
|
487
|
-
isValid = true
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
if (!isValid) {
|
|
491
|
-
errors['isFloat'] = replace(this.error || local.errorLabels['isFloat'], this)
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
this.valid = isValid;
|
|
495
|
-
if ( errors.count() > 0 )
|
|
496
|
-
this['errors'] = errors;
|
|
497
|
-
|
|
498
|
-
return self[this.name]
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
self[el]['isRequired'] = function(isApplicable) {
|
|
502
|
-
|
|
503
|
-
if ( typeof(isApplicable) == 'boolean' && !isApplicable ) {
|
|
504
|
-
|
|
505
|
-
this.valid = true;
|
|
506
|
-
|
|
507
|
-
return self[this.name]
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
// radio group case
|
|
511
|
-
if ( isGFFCtx && this.target.tagName == 'INPUT' && typeof(this.target.type) != 'undefined' && this.target.type == 'radio' ) {
|
|
512
|
-
var radios = document.getElementsByName(this.name);
|
|
513
|
-
for (var i = 0, len = radios.length; i < len; ++i) {
|
|
514
|
-
if (radios[i].checked) {
|
|
515
|
-
if ( /true|false/.test(radios[i].value) ) {
|
|
516
|
-
this.value = local.data[this.name] = ( /true/.test(radios[i].value) ) ? true : false
|
|
517
|
-
} else {
|
|
518
|
-
this.value = local.data[this.name] = radios[i].value;
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
this.valid = true;
|
|
522
|
-
break;
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
var isValid = ( typeof(this.value) != 'undefined' && this.value != null && this.value != '' && !/^\s+/.test(this.value) ) ? true : false;
|
|
529
|
-
var errors = {};
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
if (!isValid) {
|
|
533
|
-
errors['isRequired'] = replace(this.error || local.errorLabels['isRequired'], this)
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
this.valid = isValid;
|
|
537
|
-
if (errors.count() > 0)
|
|
538
|
-
this['errors'] = errors;
|
|
539
|
-
|
|
540
|
-
return self[this.name]
|
|
541
|
-
}
|
|
542
|
-
/**
|
|
543
|
-
*
|
|
544
|
-
* isString() -> validate if value is string
|
|
545
|
-
* isString(10) -> validate if value is at least 10 chars length
|
|
546
|
-
* isString(0, 45) -> no minimum length, but validate if value is maximum 45 chars length
|
|
547
|
-
*
|
|
548
|
-
* @param {number|undefined} [ minLength ]
|
|
549
|
-
* @param {number} [ maxLength ]
|
|
550
|
-
* */
|
|
551
|
-
self[el]['isString'] = function(minLength, maxLength) {
|
|
552
|
-
|
|
553
|
-
var val = this.value
|
|
554
|
-
, isValid = false
|
|
555
|
-
, isMinLength = true
|
|
556
|
-
, isMaxLength = true
|
|
557
|
-
, errors = {}
|
|
558
|
-
;
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
// test if val is a string
|
|
562
|
-
if ( typeof(val) == 'string' ) {
|
|
563
|
-
isValid = true;
|
|
564
|
-
|
|
565
|
-
if ( !errors['isRequired'] && val != '' ) {
|
|
566
|
-
// if so also test max and min length if defined
|
|
567
|
-
if (minLength && typeof(minLength) == 'number' && val.length < minLength) {
|
|
568
|
-
isMinLength = false;
|
|
569
|
-
this['size'] = minLength;
|
|
570
|
-
}
|
|
571
|
-
if (maxLength && typeof(maxLength) == 'number' && val.length > maxLength) {
|
|
572
|
-
isMaxLength = false;
|
|
573
|
-
this['size'] = maxLength;
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
// if val is invalid return error message
|
|
580
|
-
if (!isValid || !isMinLength || !isMaxLength ) {
|
|
581
|
-
|
|
582
|
-
if (!isValid && errors['isRequired'] && val == '') {
|
|
583
|
-
isValid = false;
|
|
584
|
-
errors['isString'] = replace(this['error'] || local.errorLabels['isString'], this);
|
|
585
|
-
} else if (!isValid && !errors['isRequired']) {
|
|
586
|
-
isValid = true;
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
if ( !isMinLength || !isMaxLength) {
|
|
590
|
-
isValid = false;
|
|
591
|
-
|
|
592
|
-
if ( !isMinLength )
|
|
593
|
-
errors['isStringLength'] = replace(this['error'] || local.errorLabels['isStringMinLength'], this);
|
|
594
|
-
if ( !isMaxLength )
|
|
595
|
-
errors['isStringLength'] = replace(this['error'] || local.errorLabels['isStringMaxLength'], this);
|
|
596
|
-
if (minLength === maxLength)
|
|
597
|
-
errors['isStringLength'] = replace(this['error'] || local.errorLabels['isStringLength'], this);
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
this.valid = isValid;
|
|
603
|
-
if ( errors.count() > 0 )
|
|
604
|
-
this['errors'] = errors;
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
return self[this.name]
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
/**
|
|
611
|
-
* Check if date
|
|
612
|
-
*
|
|
613
|
-
* @param {string} [mask] - by default "yyyy-mm-dd"
|
|
614
|
-
*
|
|
615
|
-
* @return {date} date - extended by gina::utils::dateFormat; an adaptation of Steven Levithan's code
|
|
616
|
-
* */
|
|
617
|
-
self[el]['isDate'] = function(mask) {
|
|
618
|
-
var val = this.value
|
|
619
|
-
, isValid = false
|
|
620
|
-
, errors = {}
|
|
621
|
-
;
|
|
622
|
-
if (!val) return self[this.name];
|
|
623
|
-
|
|
624
|
-
var m = mask.match(/[^\/\- ]+/g);
|
|
625
|
-
val = val.match(/[^\/\- ]+/g);
|
|
626
|
-
var dic = {}, d, len;
|
|
627
|
-
for (d=0, len=m.length; d<len; ++d) {
|
|
628
|
-
dic[m[d]] = val[d]
|
|
629
|
-
}
|
|
630
|
-
var newMask = 'yyyy-mm-dd';
|
|
631
|
-
for (var v in dic) {
|
|
632
|
-
newMask = newMask.replace(new RegExp(v, "g"), dic[v])
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
var date = this.value = local.data[this.name] = new Date(newMask);
|
|
636
|
-
|
|
637
|
-
if ( date instanceof Date ) {
|
|
638
|
-
isValid = true;
|
|
639
|
-
} else {
|
|
640
|
-
if ( !errors['isRequired'] && this.value == '' ) {
|
|
641
|
-
isValid = true
|
|
642
|
-
} else {
|
|
643
|
-
errors['isDate'] = replace(this.error || local.errorLabels['isDate'], this);
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
this.valid = isValid;
|
|
647
|
-
if ( errors.count() > 0 )
|
|
648
|
-
this['errors'] = errors;
|
|
649
|
-
|
|
650
|
-
return self[this.name]
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
this.valid = isValid;
|
|
654
|
-
|
|
655
|
-
return date
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
/**
|
|
659
|
-
* Formating date using DateFormatHelper
|
|
660
|
-
* Check out documentation in the helper source: `utils/helpers/dateFormat.js`
|
|
661
|
-
* e.g.:
|
|
662
|
-
* d.start
|
|
663
|
-
* .isDate('dd/mm/yyyy')
|
|
664
|
-
* .format('isoDateTime');
|
|
665
|
-
*
|
|
666
|
-
*
|
|
667
|
-
* */
|
|
668
|
-
self[el]['format'] = function(mask, utc) {
|
|
669
|
-
var val = this.value;
|
|
670
|
-
if (!val) return self[this.name];
|
|
671
|
-
|
|
672
|
-
return val.format(mask, utc)
|
|
673
|
-
};
|
|
674
|
-
|
|
675
|
-
/**
|
|
676
|
-
* Set flash
|
|
677
|
-
*
|
|
678
|
-
* @param {str} flash
|
|
679
|
-
* */
|
|
680
|
-
self[el]['setFlash'] = function(regex, flash) {
|
|
681
|
-
if ( typeof(flash) != 'undefined' && flash != '') {
|
|
682
|
-
this.error = flash
|
|
683
|
-
}
|
|
684
|
-
return self[this.name]
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
/**
|
|
688
|
-
* Set label
|
|
689
|
-
*
|
|
690
|
-
* @param {str} label
|
|
691
|
-
* */
|
|
692
|
-
self[el]['setLabel'] = function(label) {
|
|
693
|
-
if ( typeof(label) != 'undefined' && label != '') {
|
|
694
|
-
this.label = label
|
|
695
|
-
}
|
|
696
|
-
return self[this.name]
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
/**
|
|
700
|
-
* Exclude when converting back to datas
|
|
701
|
-
*
|
|
702
|
-
* @return {object} data
|
|
703
|
-
* */
|
|
704
|
-
self[el]['exclude'] = function(isApplicable) {
|
|
705
|
-
|
|
706
|
-
if ( typeof(isApplicable) == 'boolean' && !isApplicable ) {
|
|
707
|
-
|
|
708
|
-
local.data[this.name] = this.value;
|
|
709
|
-
|
|
710
|
-
return self[this.name]
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
// list field to be purged
|
|
714
|
-
local.excluded.push(this.name);
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
} // EO for (var el in self)
|
|
718
|
-
|
|
719
|
-
/**
|
|
720
|
-
* Check if errors found during validation
|
|
721
|
-
*
|
|
722
|
-
* @return {boolean}
|
|
723
|
-
* */
|
|
724
|
-
self['isValid'] = function() {
|
|
725
|
-
|
|
726
|
-
var i = self['getErrors']().count();
|
|
727
|
-
var valid = true;
|
|
728
|
-
|
|
729
|
-
if (i > 0) {
|
|
730
|
-
valid = false;
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
return valid
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
self['getErrors'] = function() {
|
|
737
|
-
var errors = {};
|
|
738
|
-
|
|
739
|
-
for (var field in self) {
|
|
740
|
-
if ( typeof(self[field]) != 'function' && typeof(self[field]['errors']) != 'undefined' ) {
|
|
741
|
-
if ( self[field]['errors'].count() > 0)
|
|
742
|
-
errors[field] = self[field]['errors'];
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
return errors
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
self['toData'] = function() {
|
|
750
|
-
|
|
751
|
-
// cleaning data
|
|
752
|
-
if (local.excluded.length > 0) {
|
|
753
|
-
for (var i = 0, len = local.excluded.length; i < len; ++i) {
|
|
754
|
-
if ( typeof(local.data[ local.excluded[i] ]) != 'undefined' ) {
|
|
755
|
-
delete local.data[ local.excluded[i] ]
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
return local.data
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
var replace = function(target, fieldObj) {
|
|
764
|
-
var keys = target.match(/%[a-z]+/gi);
|
|
765
|
-
if (keys) {
|
|
766
|
-
for (var k = 0, len = keys.length; k < len; ++k) {
|
|
767
|
-
target = target.replace(new RegExp(keys[k], 'g'), fieldObj[local.keys[keys[k]]])
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
return target
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
self['setErrorLabels'] = function (errorLabels) {
|
|
775
|
-
if ( typeof(errorLabels) != 'undefined') {
|
|
776
|
-
local.errorLabels = merge(errorLabels, local.errorLabels)
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
return self
|
|
781
|
-
};
|
|
782
|
-
|
|
783
|
-
if ( ( typeof(module) !== 'undefined' ) && module.exports ) {
|
|
784
|
-
// Publish as node.js module
|
|
785
|
-
module.exports = FormValidatorUtil
|
|
786
|
-
} else if ( typeof(define) === 'function' && define.amd) {
|
|
787
|
-
// Publish as AMD module
|
|
788
|
-
define(function() { return FormValidatorUtil })
|
|
789
|
-
}
|