Skip to content

Commit

Permalink
Merge branch 'release/v1.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Kisiela committed Nov 20, 2015
2 parents 6b361ee + e47b5af commit 9afb368
Show file tree
Hide file tree
Showing 7 changed files with 246 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [1.2.2] - 2015-11-20
### Fixed
- missing dist files

## [1.2.1] - 2015-11-20
### Fixed
- npm package name
Expand Down Expand Up @@ -52,6 +56,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## 0.0.1 - 2015-11-09

[1.2.2]: https://github.com/wieldo/angular-formly-transformer/compare/v1.2.1...v1.2.2
[1.2.1]: https://github.com/wieldo/angular-formly-transformer/compare/v1.2.0...v1.2.1
[1.2.0]: https://github.com/wieldo/angular-formly-transformer/compare/v1.1.2...v1.2.0
[1.1.2]: https://github.com/wieldo/angular-formly-transformer/compare/v1.1.1...v1.1.2
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-formly-transformer",
"version": "1.2.1",
"version": "1.2.2",
"description": "Automate configuration of fields in Angular-Formly",
"main": "dist/formly-transformer.js",
"authors": [
Expand Down
234 changes: 234 additions & 0 deletions dist/formly-transformer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("angular"), require("angular2now"), require("angular-formly"));
else if(typeof define === 'function' && define.amd)
define(["angular", "angular2now", "angular-formly"], factory);
else if(typeof exports === 'object')
exports["ngFormlyTransformer"] = factory(require("angular"), require("angular2now"), require("angular-formly"));
else
root["ngFormlyTransformer"] = factory(root["angular"], root["angular2now"], root["ngFormly"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};

/******/ // The require function
/******/ function __webpack_require__(moduleId) {

/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;

/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };

/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

/******/ // Flag the module as loaded
/******/ module.loaded = true;

/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }


/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;

/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;

/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";

/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {

'use strict';

__webpack_require__(1);

var _require = __webpack_require__(2);

var SetModule = _require.SetModule;

// set module
SetModule('formlyTransformer', [__webpack_require__(3)]);

// load service
__webpack_require__(4);

/***/ },
/* 1 */
/***/ function(module, exports) {

module.exports = __WEBPACK_EXTERNAL_MODULE_1__;

/***/ },
/* 2 */
/***/ function(module, exports) {

module.exports = __WEBPACK_EXTERNAL_MODULE_2__;

/***/ },
/* 3 */
/***/ function(module, exports) {

module.exports = __WEBPACK_EXTERNAL_MODULE_3__;

/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {

'use strict';

var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

var _require = __webpack_require__(2);

var SetModule = _require.SetModule;
var Service = _require.Service;
var Inject = _require.Inject;

SetModule('formlyTransformer');

/**
* AngularJS Service
*
* @property formlyTransformer
*/

var formlyTransformer = (function () {
function formlyTransformer(formlyConfig) {
var _this = this;

_classCallCheck(this, _formlyTransformer);

this._transformers = [];

this.formlyConfig = formlyConfig;

if (!angular.isArray(this.formlyConfig.extras.fieldTransform)) {
this.formlyConfig.extras.fieldTransform = [];
}

// push to fieldTransform
this.formlyConfig.extras.fieldTransform.push(function () {
return _this.run.apply(_this, arguments);
});
}

/**
* Register transformer
*
* @method formlyTransformer.register
*
* @param {function} transformer - modification function (see formlyConfig.extras.fieldTransform)
*/

_createClass(formlyTransformer, [{
key: 'register',
value: function register(transformer) {
if ("function" !== typeof transformer) {
throw this.createError('Transformer is not a function');
}
this._transformers.push(transformer);
}

/**
* Runs all registered transformers and returns the modified fields array.
* You can use it manually and with custom arguments but it is being triggered automatically by angular-formly module
*
* @method formlyTransformer.run
* @param {array} fields - see formlyConfig.extras.fieldTransform
* @param {object} model - see formlyConfig.extras.fieldTransform
* @param {object} form - see formlyConfig.extras.fieldTransform
* @param {object} formOptions - see formlyConfig.extras.fieldTransform
* @returns {array}
*/
}, {
key: 'run',
value: function run(fields) {
var _this2 = this;

for (var _len = arguments.length, formlyFieldTransformArgs = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
formlyFieldTransformArgs[_key - 1] = arguments[_key];
}

// add transformers object to all fields
if (angular.isArray(fields)) {
fields.forEach(function (field) {
if (!field.transformers) {
field.transformers = {};
}
});
}

// run all transformers
this._transformers.forEach(function (transformer) {
transformer.call.apply(transformer, [{
createError: function createError(msg) {
return _this2.createError(msg);
}
}, fields].concat(formlyFieldTransformArgs));
});

// remove transformers
fields.forEach(function (field) {
delete field.transformers;
});

return fields;
}

//
// helpers
//

/**
* Create Error object with prefixed message
*
* @method formlyTransformer.createError
*
* @param {string} msg - error message
* @returns {Error}
*/
}, {
key: 'createError',
value: function createError(msg) {
return new Error('[formlyTransformer] ' + msg);
}
}]);

var _formlyTransformer = formlyTransformer;
formlyTransformer = Inject(['formlyConfig'])(formlyTransformer) || formlyTransformer;
formlyTransformer = Service({
name: 'formlyTransformer'
})(formlyTransformer) || formlyTransformer;
return formlyTransformer;
})();

// injectables

/**
*
* @type {array}
* @private
*/

/***/ }
/******/ ])
});
;
2 changes: 2 additions & 0 deletions dist/formly-transformer.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/formly-transformer.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var client = 'client';
Package.describe({
name: "wieldo:angular-formly-transformer",
summary: "Automate configuration of fields in Angular-Formly",
version: "1.2.1",
version: "1.2.2",

documentation: 'README.md',
git: 'https://github.com/wieldo/angular-formly-transformer.git'
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "angular-formly-transformer",
"version": "1.2.1",
"version": "1.2.2",
"description": "Automate configuration of fields in Angular-Formly",
"main": "dist/angular-formly-transformer.js",
"main": "dist/formly-transformer.js",
"authors": [
"Kamil Kisiela <[email protected]>"
],
Expand Down

0 comments on commit 9afb368

Please sign in to comment.