Fixed bug in XosFormHelpers._getFieldFormat and correctly parsing data in xosSmartTable

Change-Id: Iee9875d7bcbdac2bf2b716244f0dd16de5fbfc99
diff --git a/dist/xosUiComponents.js b/dist/xosUiComponents.js
index 985ee85..b49db99 100644
--- a/dist/xosUiComponents.js
+++ b/dist/xosUiComponents.js
@@ -28,222 +28,229 @@
 
   angular.module('xos.uiComponents', ['chart.js', 'RecursionHelper']);
 })();
-'use strict';
+//# sourceMappingURL=../maps/ui_components/ui-components.module.js.map
 
-function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
+'use strict';
 
 /**
  * © OpenCORD
  *
  * Visit http://guide.xosproject.org/devguide/addview/ for more information
  *
- * Created by teone on 5/25/16.
+ * Created by teone on 3/24/16.
  */
 
 (function () {
   'use strict';
 
   angular.module('xos.uiComponents')
+
   /**
-    * @ngdoc directive
-    * @name xos.uiComponents.directive:xosField
-    * @restrict E
-    * @description The xos-field directive.
-    * This component decide, give a field wich kind of input it need to print.
-    * @param {string} name The field name
-    * @param {object} field The field configuration:
-    * ```
-    * {
-    *   label: 'Label',
-    *   type: 'number', //typeof field
-    *   validators: {} // see xosForm for more details
-    * }
-    * ```
-    * @param {mixed} ngModel The field value
-    *
-    * @example
-    
-    # Basic Example
-    
-      <example module="sampleField1">
-        <file name="script.js">
-          angular.module('sampleField1', ['xos.uiComponents'])
-          .factory('_', function($window){
-            return $window._;
+  * @ngdoc directive
+  * @name xos.uiComponents.directive:xosSmartTable
+  * @link xos.uiComponents.directive:xosTable xosTable
+  * @link xos.uiComponents.directive:xosForm xosForm
+  * @restrict E
+  * @description The xos-table directive
+  * @param {Object} config The configuration for the component,
+  * it is composed by the name of an angular [$resource](https://docs.angularjs.org/api/ngResource/service/$resource)
+  * and an array of fields that shouldn't be printed.
+  * ```
+  * {
+      resource: 'Users',
+      hiddenFields: []
+    }
+  * ```
+  * @scope
+  * @example
+   <example module="sampleSmartTable">
+    <file name="index.html">
+      <div ng-controller="SampleCtrl as vm">
+        <xos-smart-table config="vm.config"></xos-smart-table>
+      </div>
+    </file>
+    <file name="script.js">
+      angular.module('sampleSmartTable', ['xos.uiComponents', 'ngResource', 'ngMockE2E'])
+      // This is only for documentation purpose
+      .run(function($httpBackend, _){
+        let datas = [{id: 1, name: 'Jhon', surname: 'Doe'}];
+        let count = 1;
+         let paramsUrl = new RegExp(/\/test\/(.+)/);
+         $httpBackend.whenDELETE(paramsUrl, undefined, ['id']).respond((method, url, data, headers, params) => {
+          data = angular.fromJson(data);
+          let id = url.match(paramsUrl)[1];
+          _.remove(datas, (d) => {
+            return d.id === parseInt(id);
           })
-          .controller('SampleCtrl', function(){
-            this.name = 'input-name';
-            this.field = {label: 'My String Value:', type: 'string'};
-            this.model = 'my string';
-          });
-        </file>
-        <file name="index.html">
-          <div ng-controller="SampleCtrl as vm">
-            <xos-field ng-model="vm.model" name="vm.name" field="vm.field"></xos-field>
-          </div>
-        </file>
-      </example>
-      
-      # Possible Values
-       <example module="sampleField2">
-        <file name="script.js">
-          angular.module('sampleField2', ['xos.uiComponents'])
-          .factory('_', function($window){
-            return $window._;
-          })
-          .controller('SampleCtrl', function(){
-            this.field1 = {
-              name: 'number-field',
-              field: {label: 'My Number Value:', type: 'number'},
-              model: 2
-            };
-             this.field2 = {
-              name: 'date-field',
-              field: {label: 'My Date Value:', type: 'date'},
-              model: new Date()
-            };
-             this.field3 = {
-              name: 'boolean-field',
-              field: {label: 'My Boolean Value:', type: 'boolean'},
-              model: true
-            };
-             this.field4 = {
-              name: 'email-field',
-              field: {label: 'My Email Value:', type: 'email'},
-              model: 'sample@domain.us'
-            };
-          });
-        </file>
-        <file name="index.html">
-          <div ng-controller="SampleCtrl as vm">
-            <xos-field ng-model="vm.field1.model" name="vm.field1.name" field="vm.field1.field"></xos-field>
-            <xos-field ng-model="vm.field2.model" name="vm.field2.name" field="vm.field2.field"></xos-field>
-            <xos-field ng-model="vm.field3.model" name="vm.field3.name" field="vm.field3.field"></xos-field>
-            <xos-field ng-model="vm.field4.model" name="vm.field4.name" field="vm.field4.field"></xos-field>
-          </div>
-        </file>
-      </example>
-       # This element is recursive
-       <example module="sampleField3">
-        <file name="script.js">
-          angular.module('sampleField3', ['xos.uiComponents'])
-          .factory('_', function($window){
-            return $window._;
-          })
-          .controller('SampleCtrl', function(){
-            this.name1 = 'input-name';
-            this.field1 = {label: 'My Object Field:', type: 'object'};
-            this.model1 = {
-              name: 'Jhon',
-              age: '25',
-              email: 'jhon@thewall.ru',
-              active: true
-            };
-             this.name2 = 'another-name';
-            this.field2 = {
-              label: 'Empty Object Field',
-              type: 'object',
-              properties: {
-                foo: {
-                  label: 'FooLabel:',
-                  type: 'string',
-                  validators: {
-                    required: true
-                  }
-                },
-                bar: {
-                  type: 'number'
-                }
-              }
-            }
-          });
-        </file>
-        <file name="index.html">
-          <div ng-controller="SampleCtrl as vm">
-            <h4>Autogenerated object field</h4>
-            <xos-field ng-model="vm.model1" name="vm.name1" field="vm.field1"></xos-field>
-             <h4>Configured object field</h4>
-            <xos-field ng-model="vm.model2" name="vm.name2" field="vm.field2"></xos-field>
-          </div>
-        </file>
-      </example>
-    */
-  .component('xosField', {
+          return [204];
+        });
+         $httpBackend.whenGET('/test').respond(200, datas)
+        $httpBackend.whenPOST('/test').respond((method, url, data) => {
+          data = angular.fromJson(data);
+          data.id = ++count;
+          datas.push(data);
+          return [201, data, {}];
+        });
+      })
+      .factory('_', function($window){
+        return $window._;
+      })
+      .service('SampleResource', function($resource){
+        return $resource('/test/:id', {id: '@id'});
+      })
+      // End of documentation purpose, example start
+      .controller('SampleCtrl', function(){
+        this.config = {
+          resource: 'SampleResource'
+        };
+      });
+    </file>
+  </example>
+  */
+
+  .component('xosSmartTable', {
     restrict: 'E',
     bindings: {
-      name: '=',
-      field: '=',
-      ngModel: '='
+      config: '='
     },
-    template: '\n      <label ng-if="vm.field.type !== \'object\'">{{vm.field.label}}</label>\n          <input\n            xos-custom-validator custom-validator="vm.field.validators.custom || null"\n            ng-if="vm.field.type !== \'boolean\' && vm.field.type !== \'object\' && vm.field.type !== \'select\'"\n            type="{{vm.field.type}}"\n            name="{{vm.name}}"\n            class="form-control"\n            ng-model="vm.ngModel"\n            ng-minlength="vm.field.validators.minlength || 0"\n            ng-maxlength="vm.field.validators.maxlength || 2000"\n            ng-required="vm.field.validators.required || false" />\n            <select class="form-control" ng-if ="vm.field.type === \'select\'"\n              name = "{{vm.name}}"\n              ng-options="item.id as item.label for item in vm.field.options"\n              ng-model="vm.ngModel"\n              ng-required="vm.field.validators.required || false">\n              </select>\n          <span class="boolean-field" ng-if="vm.field.type === \'boolean\'">\n            <a href="#"\n              class="btn btn-success"\n              ng-show="vm.ngModel"\n              ng-click="vm.ngModel = false">\n              <i class="glyphicon glyphicon-ok"></i>\n            </a>\n            <a href="#"\n              class="btn btn-danger"\n              ng-show="!vm.ngModel"\n              ng-click="vm.ngModel = true">\n              <i class="glyphicon glyphicon-remove"></i>\n            </a>\n          </span>\n          <div\n            class="panel panel-default object-field"\n            ng-if="vm.field.type == \'object\' && (!vm.isEmptyObject(vm.ngModel) || !vm.isEmptyObject(vm.field.properties))"\n            >\n            <div class="panel-heading">{{vm.field.label}}</div>\n            <div class="panel-body">\n              <div ng-if="!vm.field.properties" ng-repeat="(k, v) in vm.ngModel">\n                <xos-field\n                  name="k"\n                  field="{label: vm.formatLabel(k), type: vm.getType(v)}"\n                  ng-model="v">\n                </xos-field>\n              </div>\n              <div ng-if="vm.field.properties" ng-repeat="(k, v) in vm.field.properties">\n                <xos-field\n                  name="k"\n                  field="{\n                    label: v.label || vm.formatLabel(k),\n                    type: v.type,\n                    validators: v.validators\n                  }"\n                  ng-model="vm.ngModel[k]">\n                </xos-field>\n              </div>\n            </div>\n          </div>\n    ',
+    template: '\n        <div class="row" ng-show="vm.data.length > 0">\n          <div class="col-xs-12 text-right">\n            <a href="" class="btn btn-success" ng-click="vm.createItem()">\n              Add\n            </a>\n          </div>\n        </div>\n        <div class="row">\n          <div class="col-xs-12 table-responsive">\n            <xos-table config="vm.tableConfig" data="vm.data"></xos-table>\n          </div>\n        </div>\n        <div class="panel panel-default" ng-show="vm.detailedItem">\n          <div class="panel-heading">\n            <div class="row">\n              <div class="col-xs-11">\n                <h3 class="panel-title" ng-show="vm.detailedItem.id">Update {{vm.config.resource}} {{vm.detailedItem.id}}</h3>\n                <h3 class="panel-title" ng-show="!vm.detailedItem.id">Create {{vm.config.resource}} item</h3>\n              </div>\n              <div class="col-xs-1">\n                <a href="" ng-click="vm.cleanForm()">\n                  <i class="glyphicon glyphicon-remove pull-right"></i>\n                </a>\n              </div>\n            </div>\n          </div>\n          <div class="panel-body">\n            <xos-form config="vm.formConfig" ng-model="vm.detailedItem"></xos-form>\n          </div>\n        </div>\n        <xos-alert config="{type: \'success\', closeBtn: true}" show="vm.responseMsg">{{vm.responseMsg}}</xos-alert>\n        <xos-alert config="{type: \'danger\', closeBtn: true}" show="vm.responseErr">{{vm.responseErr}}</xos-alert>\n      ',
     bindToController: true,
     controllerAs: 'vm',
-    // the compile cicle is needed to support recursion
-    //compile: function (element) {
-    //  return RecursionHelper.compile(element);
-    //},
-    controller: ["$attrs", "XosFormHelpers", "LabelFormatter", function controller($attrs, XosFormHelpers, LabelFormatter) {
+    controller: ["$injector", "LabelFormatter", "_", "XosFormHelpers", function controller($injector, LabelFormatter, _, XosFormHelpers) {
+      var _this = this;
 
-      if (!this.name) {
-        throw new Error('[xosField] Please provide a field name');
-      }
-      if (!this.field) {
-        throw new Error('[xosField] Please provide a field definition');
-      }
-      if (!this.field.type) {
-        throw new Error('[xosField] Please provide a type in the field definition');
-      }
-      if (!$attrs.ngModel) {
-        throw new Error('[xosField] Please provide an ng-model');
-      }
-      this.getType = XosFormHelpers._getFieldFormat;
-      this.formatLabel = LabelFormatter.format;
+      // TODO
+      // - Validate the config (what if resource does not exist?)
 
-      this.isEmptyObject = function (o) {
-        return o ? Object.keys(o).length === 0 : true;
-      };
-    }]
-  })
+      // NOTE
+      // Corner case
+      // - if response is empty, how can we generate a form ?
 
-  /**
-   * @ngdoc directive
-   * @name xos.uiComponents.directive:xosCustomValidator
-   * @restrict A
-   * @description The xosCustomValidator directive.
-   * This component apply a custom validation function
-   * @param {function} customValidator The function that execute the validation.
-   *
-   * You should do your validation here and return true | false,
-   * or alternatively you can return an array [errorName, true|false]
-   */
-  .directive('xosCustomValidator', function () {
-    return {
-      restrict: 'A',
-      scope: {
-        fn: '=customValidator'
-      },
-      require: 'ngModel',
-      link: function link(scope, element, attr, ctrl) {
-        if (!angular.isFunction(scope.fn)) {
-          return;
-        }
+      this.responseMsg = false;
+      this.responseErr = false;
 
-        function customValidatorWrapper(ngModelValue) {
-          var valid = scope.fn(ngModelValue);
-          if (angular.isArray(valid)) {
-            // ES6 spread rocks over fn.apply()
-            ctrl.$setValidity.apply(ctrl, _toConsumableArray(valid));
-          } else {
-            ctrl.$setValidity('custom', valid);
+      this.tableConfig = {
+        columns: [],
+        actions: [{
+          label: 'delete',
+          icon: 'remove',
+          cb: function cb(item) {
+            _this.Resource.delete({ id: item.id }).$promise.then(function () {
+              _.remove(_this.data, function (d) {
+                return d.id === item.id;
+              });
+              _this.responseMsg = _this.config.resource + ' with id ' + item.id + ' successfully deleted';
+            }).catch(function (err) {
+              _this.responseErr = err.data.detail || 'Error while deleting ' + _this.config.resource + ' with id ' + item.id;
+            });
+          },
+          color: 'red'
+        }, {
+          label: 'details',
+          icon: 'search',
+          cb: function cb(item) {
+            _this.detailedItem = item;
           }
-          return ngModelValue;
+        }],
+        classes: 'table table-striped table-bordered table-responsive',
+        filter: 'field',
+        order: true,
+        pagination: {
+          pageSize: 10
         }
+      };
 
-        ctrl.$parsers.push(customValidatorWrapper);
-      }
-    };
+      this.formConfig = {
+        exclude: this.config.hiddenFields,
+        fields: {},
+        formName: this.config.resource + 'Form',
+        actions: [{
+          label: 'Save',
+          icon: 'ok',
+          cb: function cb(item) {
+            var p = void 0;
+            var isNew = true;
+
+            if (item.id) {
+              p = item.$update();
+              isNew = false;
+            } else {
+              p = item.$save();
+            }
+
+            p.then(function (res) {
+              if (isNew) {
+                _this.data.push(angular.copy(res));
+              }
+              delete _this.detailedItem;
+              _this.responseMsg = _this.config.resource + ' with id ' + item.id + ' successfully saved';
+            }).catch(function (err) {
+              _this.responseErr = err.data.detail || 'Error while saving ' + _this.config.resource + ' with id ' + item.id;
+            });
+          },
+          class: 'success'
+        }]
+      };
+
+      this.cleanForm = function () {
+        delete _this.detailedItem;
+      };
+
+      this.createItem = function () {
+        _this.detailedItem = new _this.Resource();
+      };
+
+      this.Resource = $injector.get(this.config.resource);
+
+      var getData = function getData() {
+        _this.Resource.query().$promise.then(function (res) {
+
+          if (!res[0]) {
+            _this.data = res;
+            return;
+          }
+
+          var item = res[0];
+          var props = Object.keys(item);
+
+          _.remove(props, function (p) {
+            return p === 'id' || p === 'validators';
+          });
+
+          // TODO move out cb,  non sense triggering a lot of times
+          if (angular.isArray(_this.config.hiddenFields)) {
+            props = _.difference(props, _this.config.hiddenFields);
+          }
+
+          props.forEach(function (p) {
+            var fieldConfig = {
+              label: LabelFormatter.format(p),
+              prop: p
+            };
+
+            fieldConfig.type = XosFormHelpers._getFieldFormat(item[p]);
+
+            _this.tableConfig.columns.push(fieldConfig);
+          });
+
+          // build form structure
+          // TODO move in a pure function for testing purposes
+          props.forEach(function (p, i) {
+            _this.formConfig.fields[p] = {
+              label: LabelFormatter.format(p).replace(':', ''),
+              type: XosFormHelpers._getFieldFormat(item[p])
+            };
+          });
+          _this.data = res;
+        });
+      };
+
+      getData();
+    }]
   });
 })();
+//# sourceMappingURL=../../../maps/ui_components/smartComponents/smartTable/smartTable.component.js.map
+
 'use strict';
 
 /**
@@ -338,106 +345,8 @@
     }
   });
 })();
-'use strict';
+//# sourceMappingURL=../../../maps/ui_components/dumbComponents/validation/validation.component.js.map
 
-/**
- * © OpenCORD
- *
- * Visit http://guide.xosproject.org/devguide/addview/ for more information
- *
- * Created by teone on 4/15/16.
- */
-
-(function () {
-  'use strict';
-
-  angular.module('xos.uiComponents')
-
-  /**
-    * @ngdoc directive
-    * @name xos.uiComponents.directive:xosPagination
-    * @restrict E
-    * @description The xos-table directive
-    * @param {Number} pageSize Number of elements per page
-    * @param {Number} totalElements Number of total elements in the collection
-    * @param {Function} change The callback to be triggered on page change.
-    * * @element ANY
-    * @scope
-    * @example
-  <example module="samplePagination">
-    <file name="index.html">
-      <div ng-controller="SampleCtrl1 as vm">
-        <xos-pagination
-          page-size="vm.pageSize"
-          total-elements="vm.totalElements"
-          change="vm.change">
-        </xos-pagination>
-      </div>
-    </file>
-    <file name="script.js">
-      angular.module('samplePagination', ['xos.uiComponents'])
-      .controller('SampleCtrl1', function(){
-        this.pageSize = 10;
-        this.totalElements = 35;
-        this.change = (pageNumber) => {
-          console.log(pageNumber);
-        }
-      });
-    </file>
-  </example>
-  **/
-
-  .component('xosPagination', {
-    restrict: 'E',
-    bindings: {
-      pageSize: '=',
-      totalElements: '=',
-      change: '='
-    },
-    template: '\n      <div class="row" ng-if="vm.pageList.length > 1">\n        <div class="col-xs-12 text-center">\n          <ul class="pagination">\n            <li\n              ng-click="vm.goToPage(vm.currentPage - 1)"\n              ng-class="{disabled: vm.currentPage == 0}">\n              <a href="" aria-label="Previous">\n                  <span aria-hidden="true">&laquo;</span>\n              </a>\n            </li>\n            <li ng-repeat="i in vm.pageList" ng-class="{active: i === vm.currentPage}">\n              <a href="" ng-click="vm.goToPage(i)">{{i + 1}}</a>\n            </li>\n            <li\n              ng-click="vm.goToPage(vm.currentPage + 1)"\n              ng-class="{disabled: vm.currentPage == vm.pages - 1}">\n              <a href="" aria-label="Next">\n                  <span aria-hidden="true">&raquo;</span>\n              </a>\n            </li>\n          </ul>\n        </div>\n      </div>\n    ',
-    bindToController: true,
-    controllerAs: 'vm',
-    controller: ["$scope", function controller($scope) {
-      var _this = this;
-
-      this.currentPage = 0;
-
-      this.goToPage = function (n) {
-        if (n < 0 || n === _this.pages) {
-          return;
-        }
-        _this.currentPage = n;
-        _this.change(n);
-      };
-
-      this.createPages = function (pages) {
-        var arr = [];
-        for (var i = 0; i < pages; i++) {
-          arr.push(i);
-        }
-        return arr;
-      };
-
-      // watch for data changes
-      $scope.$watch(function () {
-        return _this.totalElements;
-      }, function () {
-        if (_this.totalElements) {
-          _this.pages = Math.ceil(_this.totalElements / _this.pageSize);
-          _this.pageList = _this.createPages(_this.pages);
-        }
-      });
-    }]
-  }).filter('pagination', function () {
-    return function (input, start) {
-      if (!input || !angular.isArray(input)) {
-        return input;
-      }
-      start = parseInt(start, 10);
-      return input.slice(start);
-    };
-  });
-})();
 'use strict';
 
 /**
@@ -683,6 +592,8 @@
     }]
   });
 })();
+//# sourceMappingURL=../../../maps/ui_components/smartComponents/smartPie/smartPie.component.js.map
+
 'use strict';
 
 /**
@@ -1013,7 +924,7 @@
       data: '=',
       config: '='
     },
-    template: '\n        <div ng-show="vm.data.length > 0 && vm.loader == false">\n          <div class="row" ng-if="vm.config.filter == \'fulltext\'">\n            <div class="col-xs-12">\n              <input\n                class="form-control"\n                placeholder="Type to search.."\n                type="text"\n                ng-model="vm.query"/>\n            </div>\n          </div>\n          <table ng-class="vm.classes" ng-hide="vm.data.length == 0">\n            <thead>\n              <tr>\n                <th ng-repeat="col in vm.columns">\n                  {{col.label}}\n                  <span ng-if="vm.config.order">\n                    <a href="" ng-click="vm.orderBy = col.prop; vm.reverse = false">\n                      <i class="glyphicon glyphicon-chevron-up"></i>\n                    </a>\n                    <a href="" ng-click="vm.orderBy = col.prop; vm.reverse = true">\n                      <i class="glyphicon glyphicon-chevron-down"></i>\n                    </a>\n                  </span>\n                </th>\n                <th ng-if="vm.config.actions">Actions:</th>\n              </tr>\n            </thead>\n            <tbody ng-if="vm.config.filter == \'field\'">\n              <tr>\n                <td ng-repeat="col in vm.columns">\n                  <input\n                    ng-if="col.type !== \'boolean\' && col.type !== \'array\' && col.type !== \'object\' && col.type !== \'custom\'"\n                    class="form-control"\n                    placeholder="Type to search by {{col.label}}"\n                    type="text"\n                    ng-model="vm.query[col.prop]"/>\n                  <select\n                    ng-if="col.type === \'boolean\'"\n                    class="form-control"\n                    ng-model="vm.query[col.prop]">\n                    <option value="">-</option>\n                    <option value="true">True</option>\n                    <option value="false">False</option>\n                  </select>\n                </td>\n                <td ng-if="vm.config.actions"></td>\n              </tr>\n            </tbody>\n            <tbody>\n              <tr ng-repeat="item in vm.data | filter:vm.query:vm.comparator | orderBy:vm.orderBy:vm.reverse | pagination:vm.currentPage * vm.config.pagination.pageSize | limitTo: (vm.config.pagination.pageSize || vm.data.length) track by $index">\n                <td ng-repeat="col in vm.columns" xos-link-wrapper>\n                  <span ng-if="!col.type">{{item[col.prop]}}</span>\n                  <span ng-if="col.type === \'boolean\'">\n                    <i class="glyphicon"\n                      ng-class="{\'glyphicon-ok\': item[col.prop], \'glyphicon-remove\': !item[col.prop]}">\n                    </i>\n                  </span>\n                  <span ng-if="col.type === \'date\'">\n                    {{item[col.prop] | date:\'H:mm MMM d, yyyy\'}}\n                  </span>\n                  <span ng-if="col.type === \'array\'">\n                    {{item[col.prop] | arrayToList}}\n                  </span>\n                  <span ng-if="col.type === \'object\'">\n                    <dl class="dl-horizontal">\n                      <span ng-repeat="(k,v) in item[col.prop]">\n                        <dt>{{k}}</dt>\n                        <dd>{{v}}</dd>\n                      </span>\n                    </dl>\n                  </span>\n                  <span ng-if="col.type === \'custom\'">\n                    {{col.formatter(item)}}\n                  </span>\n                  <span ng-if="col.type === \'icon\'">\n                    <i class="glyphicon glyphicon-{{col.formatter(item)}}">\n                    </i>\n                  </span>\n                </td>\n                <td ng-if="vm.config.actions">\n                  <a href=""\n                    ng-repeat="action in vm.config.actions"\n                    ng-click="action.cb(item)"\n                    title="{{action.label}}">\n                    <i\n                      class="glyphicon glyphicon-{{action.icon}}"\n                      style="color: {{action.color}};"></i>\n                  </a>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n          <xos-pagination\n            ng-if="vm.config.pagination"\n            page-size="vm.config.pagination.pageSize"\n            total-elements="vm.data.length"\n            change="vm.goToPage">\n            </xos-pagination>\n        </div>\n        <div ng-show="(vm.data.length == 0 || !vm.data) && vm.loader == false">\n           <xos-alert config="{type: \'info\'}">\n            No data to show.\n          </xos-alert>\n        </div>\n        <div ng-show="vm.loader == true">\n          <div class="loader"></div>\n        </div>\n      ',
+    template: '\n        <div ng-show="vm.data.length > 0 && vm.loader == false">\n          <div class="row" ng-if="vm.config.filter == \'fulltext\'">\n            <div class="col-xs-12">\n              <input\n                class="form-control"\n                placeholder="Type to search.."\n                type="text"\n                ng-model="vm.query"/>\n            </div>\n          </div>\n          <table ng-class="vm.classes" ng-hide="vm.data.length == 0">\n            <thead>\n              <tr>\n                <th ng-repeat="col in vm.columns">\n                  {{col.label}}\n                  <span ng-if="vm.config.order">\n                    <a href="" ng-click="vm.orderBy = col.prop; vm.reverse = false">\n                      <i class="glyphicon glyphicon-chevron-up"></i>\n                    </a>\n                    <a href="" ng-click="vm.orderBy = col.prop; vm.reverse = true">\n                      <i class="glyphicon glyphicon-chevron-down"></i>\n                    </a>\n                  </span>\n                </th>\n                <th ng-if="vm.config.actions">Actions:</th>\n              </tr>\n            </thead>\n            <tbody ng-if="vm.config.filter == \'field\'">\n              <tr>\n                <td ng-repeat="col in vm.columns">\n                  <input\n                    ng-if="col.type !== \'boolean\' && col.type !== \'array\' && col.type !== \'object\' && col.type !== \'custom\'"\n                    class="form-control"\n                    placeholder="Type to search by {{col.label}}"\n                    type="text"\n                    ng-model="vm.query[col.prop]"/>\n                  <select\n                    ng-if="col.type === \'boolean\'"\n                    class="form-control"\n                    ng-model="vm.query[col.prop]">\n                    <option value="">-</option>\n                    <option value="true">True</option>\n                    <option value="false">False</option>\n                  </select>\n                </td>\n                <td ng-if="vm.config.actions"></td>\n              </tr>\n            </tbody>\n            <tbody>\n              <tr ng-repeat="item in vm.data | filter:vm.query:vm.comparator | orderBy:vm.orderBy:vm.reverse | pagination:vm.currentPage * vm.config.pagination.pageSize | limitTo: (vm.config.pagination.pageSize || vm.data.length) track by $index">\n                <td ng-repeat="col in vm.columns" xos-link-wrapper>\n                  <span ng-if="!col.type || col.type === \'text\'">{{item[col.prop]}}</span>\n                  <span ng-if="col.type === \'boolean\'">\n                    <i class="glyphicon"\n                      ng-class="{\'glyphicon-ok\': item[col.prop], \'glyphicon-remove\': !item[col.prop]}">\n                    </i>\n                  </span>\n                  <span ng-if="col.type === \'date\'">\n                    {{item[col.prop] | date:\'H:mm MMM d, yyyy\'}}\n                  </span>\n                  <span ng-if="col.type === \'array\'">\n                    {{item[col.prop] | arrayToList}}\n                  </span>\n                  <span ng-if="col.type === \'object\'">\n                    <dl class="dl-horizontal">\n                      <span ng-repeat="(k,v) in item[col.prop]">\n                        <dt>{{k}}</dt>\n                        <dd>{{v}}</dd>\n                      </span>\n                    </dl>\n                  </span>\n                  <span ng-if="col.type === \'custom\'">\n                    {{col.formatter(item)}}\n                  </span>\n                  <span ng-if="col.type === \'icon\'">\n                    <i class="glyphicon glyphicon-{{col.formatter(item)}}">\n                    </i>\n                  </span>\n                </td>\n                <td ng-if="vm.config.actions">\n                  <a href=""\n                    ng-repeat="action in vm.config.actions"\n                    ng-click="action.cb(item)"\n                    title="{{action.label}}">\n                    <i\n                      class="glyphicon glyphicon-{{action.icon}}"\n                      style="color: {{action.color}};"></i>\n                  </a>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n          <xos-pagination\n            ng-if="vm.config.pagination"\n            page-size="vm.config.pagination.pageSize"\n            total-elements="vm.data.length"\n            change="vm.goToPage">\n            </xos-pagination>\n        </div>\n        <div ng-show="(vm.data.length == 0 || !vm.data) && vm.loader == false">\n           <xos-alert config="{type: \'info\'}">\n            No data to show.\n          </xos-alert>\n        </div>\n        <div ng-show="vm.loader == true">\n          <div class="loader"></div>\n        </div>\n      ',
     bindToController: true,
     controllerAs: 'vm',
     controller: ["_", "$scope", "Comparator", function controller(_, $scope, Comparator) {
@@ -1113,6 +1024,8 @@
     };
   });
 })();
+//# sourceMappingURL=../../../maps/ui_components/dumbComponents/table/table.component.js.map
+
 'use strict';
 
 /**
@@ -1370,6 +1283,328 @@
     }]
   });
 })();
+//# sourceMappingURL=../../../maps/ui_components/dumbComponents/form/form.component.js.map
+
+'use strict';
+
+/**
+ * © OpenCORD
+ *
+ * Visit http://guide.xosproject.org/devguide/addview/ for more information
+ *
+ * Created by teone on 4/15/16.
+ */
+
+(function () {
+  'use strict';
+
+  angular.module('xos.uiComponents')
+
+  /**
+    * @ngdoc directive
+    * @name xos.uiComponents.directive:xosPagination
+    * @restrict E
+    * @description The xos-table directive
+    * @param {Number} pageSize Number of elements per page
+    * @param {Number} totalElements Number of total elements in the collection
+    * @param {Function} change The callback to be triggered on page change.
+    * * @element ANY
+    * @scope
+    * @example
+  <example module="samplePagination">
+    <file name="index.html">
+      <div ng-controller="SampleCtrl1 as vm">
+        <xos-pagination
+          page-size="vm.pageSize"
+          total-elements="vm.totalElements"
+          change="vm.change">
+        </xos-pagination>
+      </div>
+    </file>
+    <file name="script.js">
+      angular.module('samplePagination', ['xos.uiComponents'])
+      .controller('SampleCtrl1', function(){
+        this.pageSize = 10;
+        this.totalElements = 35;
+        this.change = (pageNumber) => {
+          console.log(pageNumber);
+        }
+      });
+    </file>
+  </example>
+  **/
+
+  .component('xosPagination', {
+    restrict: 'E',
+    bindings: {
+      pageSize: '=',
+      totalElements: '=',
+      change: '='
+    },
+    template: '\n      <div class="row" ng-if="vm.pageList.length > 1">\n        <div class="col-xs-12 text-center">\n          <ul class="pagination">\n            <li\n              ng-click="vm.goToPage(vm.currentPage - 1)"\n              ng-class="{disabled: vm.currentPage == 0}">\n              <a href="" aria-label="Previous">\n                  <span aria-hidden="true">&laquo;</span>\n              </a>\n            </li>\n            <li ng-repeat="i in vm.pageList" ng-class="{active: i === vm.currentPage}">\n              <a href="" ng-click="vm.goToPage(i)">{{i + 1}}</a>\n            </li>\n            <li\n              ng-click="vm.goToPage(vm.currentPage + 1)"\n              ng-class="{disabled: vm.currentPage == vm.pages - 1}">\n              <a href="" aria-label="Next">\n                  <span aria-hidden="true">&raquo;</span>\n              </a>\n            </li>\n          </ul>\n        </div>\n      </div>\n    ',
+    bindToController: true,
+    controllerAs: 'vm',
+    controller: ["$scope", function controller($scope) {
+      var _this = this;
+
+      this.currentPage = 0;
+
+      this.goToPage = function (n) {
+        if (n < 0 || n === _this.pages) {
+          return;
+        }
+        _this.currentPage = n;
+        _this.change(n);
+      };
+
+      this.createPages = function (pages) {
+        var arr = [];
+        for (var i = 0; i < pages; i++) {
+          arr.push(i);
+        }
+        return arr;
+      };
+
+      // watch for data changes
+      $scope.$watch(function () {
+        return _this.totalElements;
+      }, function () {
+        if (_this.totalElements) {
+          _this.pages = Math.ceil(_this.totalElements / _this.pageSize);
+          _this.pageList = _this.createPages(_this.pages);
+        }
+      });
+    }]
+  }).filter('pagination', function () {
+    return function (input, start) {
+      if (!input || !angular.isArray(input)) {
+        return input;
+      }
+      start = parseInt(start, 10);
+      return input.slice(start);
+    };
+  });
+})();
+//# sourceMappingURL=../../../maps/ui_components/dumbComponents/pagination/pagination.component.js.map
+
+'use strict';
+
+function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
+
+/**
+ * © OpenCORD
+ *
+ * Visit http://guide.xosproject.org/devguide/addview/ for more information
+ *
+ * Created by teone on 5/25/16.
+ */
+
+(function () {
+  'use strict';
+
+  angular.module('xos.uiComponents')
+  /**
+    * @ngdoc directive
+    * @name xos.uiComponents.directive:xosField
+    * @restrict E
+    * @description The xos-field directive.
+    * This component decide, give a field wich kind of input it need to print.
+    * @param {string} name The field name
+    * @param {object} field The field configuration:
+    * ```
+    * {
+    *   label: 'Label',
+    *   type: 'number', //typeof field
+    *   validators: {} // see xosForm for more details
+    * }
+    * ```
+    * @param {mixed} ngModel The field value
+    *
+    * @example
+    
+    # Basic Example
+    
+      <example module="sampleField1">
+        <file name="script.js">
+          angular.module('sampleField1', ['xos.uiComponents'])
+          .factory('_', function($window){
+            return $window._;
+          })
+          .controller('SampleCtrl', function(){
+            this.name = 'input-name';
+            this.field = {label: 'My String Value:', type: 'string'};
+            this.model = 'my string';
+          });
+        </file>
+        <file name="index.html">
+          <div ng-controller="SampleCtrl as vm">
+            <xos-field ng-model="vm.model" name="vm.name" field="vm.field"></xos-field>
+          </div>
+        </file>
+      </example>
+      
+      # Possible Values
+       <example module="sampleField2">
+        <file name="script.js">
+          angular.module('sampleField2', ['xos.uiComponents'])
+          .factory('_', function($window){
+            return $window._;
+          })
+          .controller('SampleCtrl', function(){
+            this.field1 = {
+              name: 'number-field',
+              field: {label: 'My Number Value:', type: 'number'},
+              model: 2
+            };
+             this.field2 = {
+              name: 'date-field',
+              field: {label: 'My Date Value:', type: 'date'},
+              model: new Date()
+            };
+             this.field3 = {
+              name: 'boolean-field',
+              field: {label: 'My Boolean Value:', type: 'boolean'},
+              model: true
+            };
+             this.field4 = {
+              name: 'email-field',
+              field: {label: 'My Email Value:', type: 'email'},
+              model: 'sample@domain.us'
+            };
+          });
+        </file>
+        <file name="index.html">
+          <div ng-controller="SampleCtrl as vm">
+            <xos-field ng-model="vm.field1.model" name="vm.field1.name" field="vm.field1.field"></xos-field>
+            <xos-field ng-model="vm.field2.model" name="vm.field2.name" field="vm.field2.field"></xos-field>
+            <xos-field ng-model="vm.field3.model" name="vm.field3.name" field="vm.field3.field"></xos-field>
+            <xos-field ng-model="vm.field4.model" name="vm.field4.name" field="vm.field4.field"></xos-field>
+          </div>
+        </file>
+      </example>
+       # This element is recursive
+       <example module="sampleField3">
+        <file name="script.js">
+          angular.module('sampleField3', ['xos.uiComponents'])
+          .factory('_', function($window){
+            return $window._;
+          })
+          .controller('SampleCtrl', function(){
+            this.name1 = 'input-name';
+            this.field1 = {label: 'My Object Field:', type: 'object'};
+            this.model1 = {
+              name: 'Jhon',
+              age: '25',
+              email: 'jhon@thewall.ru',
+              active: true
+            };
+             this.name2 = 'another-name';
+            this.field2 = {
+              label: 'Empty Object Field',
+              type: 'object',
+              properties: {
+                foo: {
+                  label: 'FooLabel:',
+                  type: 'string',
+                  validators: {
+                    required: true
+                  }
+                },
+                bar: {
+                  type: 'number'
+                }
+              }
+            }
+          });
+        </file>
+        <file name="index.html">
+          <div ng-controller="SampleCtrl as vm">
+            <h4>Autogenerated object field</h4>
+            <xos-field ng-model="vm.model1" name="vm.name1" field="vm.field1"></xos-field>
+             <h4>Configured object field</h4>
+            <xos-field ng-model="vm.model2" name="vm.name2" field="vm.field2"></xos-field>
+          </div>
+        </file>
+      </example>
+    */
+  .component('xosField', {
+    restrict: 'E',
+    bindings: {
+      name: '=',
+      field: '=',
+      ngModel: '='
+    },
+    template: '\n      <label ng-if="vm.field.type !== \'object\'">{{vm.field.label}}</label>\n          <input\n            xos-custom-validator custom-validator="vm.field.validators.custom || null"\n            ng-if="vm.field.type !== \'boolean\' && vm.field.type !== \'object\' && vm.field.type !== \'select\'"\n            type="{{vm.field.type}}"\n            name="{{vm.name}}"\n            class="form-control"\n            ng-model="vm.ngModel"\n            ng-minlength="vm.field.validators.minlength || 0"\n            ng-maxlength="vm.field.validators.maxlength || 2000"\n            ng-required="vm.field.validators.required || false" />\n            <select class="form-control" ng-if ="vm.field.type === \'select\'"\n              name = "{{vm.name}}"\n              ng-options="item.id as item.label for item in vm.field.options"\n              ng-model="vm.ngModel"\n              ng-required="vm.field.validators.required || false">\n              </select>\n          <span class="boolean-field" ng-if="vm.field.type === \'boolean\'">\n            <a href="#"\n              class="btn btn-success"\n              ng-show="vm.ngModel"\n              ng-click="vm.ngModel = false">\n              <i class="glyphicon glyphicon-ok"></i>\n            </a>\n            <a href="#"\n              class="btn btn-danger"\n              ng-show="!vm.ngModel"\n              ng-click="vm.ngModel = true">\n              <i class="glyphicon glyphicon-remove"></i>\n            </a>\n          </span>\n          <div\n            class="panel panel-default object-field"\n            ng-if="vm.field.type == \'object\' && (!vm.isEmptyObject(vm.ngModel) || !vm.isEmptyObject(vm.field.properties))"\n            >\n            <div class="panel-heading">{{vm.field.label}}</div>\n            <div class="panel-body">\n              <div ng-if="!vm.field.properties" ng-repeat="(k, v) in vm.ngModel">\n                <xos-field\n                  name="k"\n                  field="{label: vm.formatLabel(k), type: vm.getType(v)}"\n                  ng-model="v">\n                </xos-field>\n              </div>\n              <div ng-if="vm.field.properties" ng-repeat="(k, v) in vm.field.properties">\n                <xos-field\n                  name="k"\n                  field="{\n                    label: v.label || vm.formatLabel(k),\n                    type: v.type,\n                    validators: v.validators\n                  }"\n                  ng-model="vm.ngModel[k]">\n                </xos-field>\n              </div>\n            </div>\n          </div>\n    ',
+    bindToController: true,
+    controllerAs: 'vm',
+    // the compile cicle is needed to support recursion
+    //compile: function (element) {
+    //  return RecursionHelper.compile(element);
+    //},
+    controller: ["$attrs", "XosFormHelpers", "LabelFormatter", function controller($attrs, XosFormHelpers, LabelFormatter) {
+
+      if (!this.name) {
+        throw new Error('[xosField] Please provide a field name');
+      }
+      if (!this.field) {
+        throw new Error('[xosField] Please provide a field definition');
+      }
+      if (!this.field.type) {
+        throw new Error('[xosField] Please provide a type in the field definition');
+      }
+      if (!$attrs.ngModel) {
+        throw new Error('[xosField] Please provide an ng-model');
+      }
+      this.getType = XosFormHelpers._getFieldFormat;
+      this.formatLabel = LabelFormatter.format;
+
+      this.isEmptyObject = function (o) {
+        return o ? Object.keys(o).length === 0 : true;
+      };
+    }]
+  })
+
+  /**
+   * @ngdoc directive
+   * @name xos.uiComponents.directive:xosCustomValidator
+   * @restrict A
+   * @description The xosCustomValidator directive.
+   * This component apply a custom validation function
+   * @param {function} customValidator The function that execute the validation.
+   *
+   * You should do your validation here and return true | false,
+   * or alternatively you can return an array [errorName, true|false]
+   */
+  .directive('xosCustomValidator', function () {
+    return {
+      restrict: 'A',
+      scope: {
+        fn: '=customValidator'
+      },
+      require: 'ngModel',
+      link: function link(scope, element, attr, ctrl) {
+        if (!angular.isFunction(scope.fn)) {
+          return;
+        }
+
+        function customValidatorWrapper(ngModelValue) {
+          var valid = scope.fn(ngModelValue);
+          if (angular.isArray(valid)) {
+            // ES6 spread rocks over fn.apply()
+            ctrl.$setValidity.apply(ctrl, _toConsumableArray(valid));
+          } else {
+            ctrl.$setValidity('custom', valid);
+          }
+          return ngModelValue;
+        }
+
+        ctrl.$parsers.push(customValidatorWrapper);
+      }
+    };
+  });
+})();
+//# sourceMappingURL=../../../maps/ui_components/dumbComponents/field/field.component.js.map
+
 'use strict';
 
 /**
@@ -1505,234 +1740,8 @@
     }]
   });
 })();
-'use strict';
+//# sourceMappingURL=../../../maps/ui_components/dumbComponents/alert/alert.component.js.map
 
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
-
-/**
- * © OpenCORD
- *
- * Visit http://guide.xosproject.org/devguide/addview/ for more information
- *
- * Created by teone on 3/24/16.
- */
-
-(function () {
-  'use strict';
-
-  angular.module('xos.uiComponents')
-
-  /**
-  * @ngdoc directive
-  * @name xos.uiComponents.directive:xosSmartTable
-  * @link xos.uiComponents.directive:xosTable xosTable
-  * @link xos.uiComponents.directive:xosForm xosForm
-  * @restrict E
-  * @description The xos-table directive
-  * @param {Object} config The configuration for the component,
-  * it is composed by the name of an angular [$resource](https://docs.angularjs.org/api/ngResource/service/$resource)
-  * and an array of fields that shouldn't be printed.
-  * ```
-  * {
-      resource: 'Users',
-      hiddenFields: []
-    }
-  * ```
-  * @scope
-  * @example
-   <example module="sampleSmartTable">
-    <file name="index.html">
-      <div ng-controller="SampleCtrl as vm">
-        <xos-smart-table config="vm.config"></xos-smart-table>
-      </div>
-    </file>
-    <file name="script.js">
-      angular.module('sampleSmartTable', ['xos.uiComponents', 'ngResource', 'ngMockE2E'])
-      // This is only for documentation purpose
-      .run(function($httpBackend, _){
-        let datas = [{id: 1, name: 'Jhon', surname: 'Doe'}];
-        let count = 1;
-         let paramsUrl = new RegExp(/\/test\/(.+)/);
-         $httpBackend.whenDELETE(paramsUrl, undefined, ['id']).respond((method, url, data, headers, params) => {
-          data = angular.fromJson(data);
-          let id = url.match(paramsUrl)[1];
-          _.remove(datas, (d) => {
-            return d.id === parseInt(id);
-          })
-          return [204];
-        });
-         $httpBackend.whenGET('/test').respond(200, datas)
-        $httpBackend.whenPOST('/test').respond((method, url, data) => {
-          data = angular.fromJson(data);
-          data.id = ++count;
-          datas.push(data);
-          return [201, data, {}];
-        });
-      })
-      .factory('_', function($window){
-        return $window._;
-      })
-      .service('SampleResource', function($resource){
-        return $resource('/test/:id', {id: '@id'});
-      })
-      // End of documentation purpose, example start
-      .controller('SampleCtrl', function(){
-        this.config = {
-          resource: 'SampleResource'
-        };
-      });
-    </file>
-  </example>
-  */
-
-  .component('xosSmartTable', {
-    restrict: 'E',
-    bindings: {
-      config: '='
-    },
-    template: '\n        <div class="row" ng-show="vm.data.length > 0">\n          <div class="col-xs-12 text-right">\n            <a href="" class="btn btn-success" ng-click="vm.createItem()">\n              Add\n            </a>\n          </div>\n        </div>\n        <div class="row">\n          <div class="col-xs-12 table-responsive">\n            <xos-table config="vm.tableConfig" data="vm.data"></xos-table>\n          </div>\n        </div>\n        <div class="panel panel-default" ng-show="vm.detailedItem">\n          <div class="panel-heading">\n            <div class="row">\n              <div class="col-xs-11">\n                <h3 class="panel-title" ng-show="vm.detailedItem.id">Update {{vm.config.resource}} {{vm.detailedItem.id}}</h3>\n                <h3 class="panel-title" ng-show="!vm.detailedItem.id">Create {{vm.config.resource}} item</h3>\n              </div>\n              <div class="col-xs-1">\n                <a href="" ng-click="vm.cleanForm()">\n                  <i class="glyphicon glyphicon-remove pull-right"></i>\n                </a>\n              </div>\n            </div>\n          </div>\n          <div class="panel-body">\n            <xos-form config="vm.formConfig" ng-model="vm.detailedItem"></xos-form>\n          </div>\n        </div>\n        <xos-alert config="{type: \'success\', closeBtn: true}" show="vm.responseMsg">{{vm.responseMsg}}</xos-alert>\n        <xos-alert config="{type: \'danger\', closeBtn: true}" show="vm.responseErr">{{vm.responseErr}}</xos-alert>\n      ',
-    bindToController: true,
-    controllerAs: 'vm',
-    controller: ["$injector", "LabelFormatter", "_", "XosFormHelpers", function controller($injector, LabelFormatter, _, XosFormHelpers) {
-      var _this = this;
-
-      // TODO
-      // - Validate the config (what if resource does not exist?)
-
-      // NOTE
-      // Corner case
-      // - if response is empty, how can we generate a form ?
-
-      this.responseMsg = false;
-      this.responseErr = false;
-
-      this.tableConfig = {
-        columns: [],
-        actions: [{
-          label: 'delete',
-          icon: 'remove',
-          cb: function cb(item) {
-            _this.Resource.delete({ id: item.id }).$promise.then(function () {
-              _.remove(_this.data, function (d) {
-                return d.id === item.id;
-              });
-              _this.responseMsg = _this.config.resource + ' with id ' + item.id + ' successfully deleted';
-            }).catch(function (err) {
-              _this.responseErr = err.data.detail || 'Error while deleting ' + _this.config.resource + ' with id ' + item.id;
-            });
-          },
-          color: 'red'
-        }, {
-          label: 'details',
-          icon: 'search',
-          cb: function cb(item) {
-            _this.detailedItem = item;
-          }
-        }],
-        classes: 'table table-striped table-bordered table-responsive',
-        filter: 'field',
-        order: true,
-        pagination: {
-          pageSize: 10
-        }
-      };
-
-      this.formConfig = {
-        exclude: this.config.hiddenFields,
-        fields: {},
-        formName: this.config.resource + 'Form',
-        actions: [{
-          label: 'Save',
-          icon: 'ok',
-          cb: function cb(item) {
-            var p = void 0;
-            var isNew = true;
-
-            if (item.id) {
-              p = item.$update();
-              isNew = false;
-            } else {
-              p = item.$save();
-            }
-
-            p.then(function (res) {
-              if (isNew) {
-                _this.data.push(angular.copy(res));
-              }
-              delete _this.detailedItem;
-              _this.responseMsg = _this.config.resource + ' with id ' + item.id + ' successfully saved';
-            }).catch(function (err) {
-              _this.responseErr = err.data.detail || 'Error while saving ' + _this.config.resource + ' with id ' + item.id;
-            });
-          },
-          class: 'success'
-        }]
-      };
-
-      this.cleanForm = function () {
-        delete _this.detailedItem;
-      };
-
-      this.createItem = function () {
-        _this.detailedItem = new _this.Resource();
-      };
-
-      this.Resource = $injector.get(this.config.resource);
-
-      var getData = function getData() {
-        _this.Resource.query().$promise.then(function (res) {
-
-          if (!res[0]) {
-            _this.data = res;
-            return;
-          }
-
-          var item = res[0];
-          var props = Object.keys(item);
-
-          _.remove(props, function (p) {
-            return p === 'id' || p === 'validators';
-          });
-
-          // TODO move out cb,  non sense triggering a lot of times
-          if (angular.isArray(_this.config.hiddenFields)) {
-            props = _.difference(props, _this.config.hiddenFields);
-          }
-
-          var labels = props.map(function (p) {
-            return LabelFormatter.format(p);
-          });
-
-          props.forEach(function (p, i) {
-            var fieldConfig = {
-              label: labels[i],
-              prop: p
-            };
-
-            if (angular.isString(item[p]) && typeof item[p] !== 'undefined') {
-              fieldConfig.type = _typeof(item[p]);
-            }
-
-            _this.tableConfig.columns.push(fieldConfig);
-          });
-
-          // build form structure
-          // TODO move in a pure function for testing purposes
-          props.forEach(function (p, i) {
-            _this.formConfig.fields[p] = {
-              label: LabelFormatter.format(labels[i]).replace(':', ''),
-              type: XosFormHelpers._getFieldFormat(item[p])
-            };
-          });
-
-          _this.data = res;
-        });
-      };
-
-      getData();
-    }]
-  });
-})();
 'use strict';
 
 (function () {
@@ -1831,6 +1840,8 @@
     };
   }
 })();
+//# sourceMappingURL=../../../maps/services/helpers/ui/label_formatter.service.js.map
+
 'use strict';
 
 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
@@ -1881,7 +1892,9 @@
       }
 
       // check if is date
-      if (_.isDate(value) || !Number.isNaN(Date.parse(value)) && new Date(value).getTime() > 631180800000) {
+      if (angular.isDate(value) || !Number.isNaN(Date.parse(value)) && // Date.parse is a number
+      /^\d+-\d+-\d+\D\d+:\d+:\d+\.\d+\D/.test(value) // the format match ISO dates
+      ) {
         return 'date';
       }
 
@@ -1987,6 +2000,8 @@
     };
   }]);
 })();
+//# sourceMappingURL=../../../maps/services/helpers/ui/form.helpers.js.map
+
 'use strict';
 
 (function () {
@@ -2083,6 +2098,8 @@
     };
   }
 })();
+//# sourceMappingURL=../../../maps/services/helpers/ui/comparator.service.js.map
+
 'use strict';
 
 (function () {
@@ -2124,6 +2141,8 @@
     $resourceProvider.defaults.stripTrailingSlashes = false;
   }
 })();
+//# sourceMappingURL=maps/xosHelpers.module.js.map
+
 'use strict';
 
 (function () {
@@ -2139,6 +2158,8 @@
     return $resource('/api/service/vsg/');
   }]);
 })();
+//# sourceMappingURL=../../maps/services/rest/vSG.js.map
+
 'use strict';
 
 (function () {
@@ -2156,6 +2177,8 @@
     });
   }]);
 })();
+//# sourceMappingURL=../../maps/services/rest/vOLT.js.map
+
 'use strict';
 
 (function () {
@@ -2179,6 +2202,8 @@
     return $resource('/api/utility/logout/');
   }]);
 })();
+//# sourceMappingURL=../../maps/services/rest/Utility.js.map
+
 'use strict';
 
 (function () {
@@ -2196,6 +2221,8 @@
     });
   }]);
 })();
+//# sourceMappingURL=../../maps/services/rest/Users.js.map
+
 'use strict';
 
 (function () {
@@ -2213,6 +2240,8 @@
     });
   }]);
 })();
+//# sourceMappingURL=../../maps/services/rest/Truckroll.js.map
+
 'use strict';
 
 (function () {
@@ -2230,6 +2259,8 @@
     });
   }]);
 })();
+//# sourceMappingURL=../../maps/services/rest/Tenant.js.map
+
 'use strict';
 
 (function () {
@@ -2379,6 +2410,8 @@
     });
   }]);
 })();
+//# sourceMappingURL=../../maps/services/rest/Subscribers.js.map
+
 'use strict';
 
 (function () {
@@ -2416,6 +2449,8 @@
     };
   }]);
 })();
+//# sourceMappingURL=../../maps/services/rest/Slices_plus.js.map
+
 'use strict';
 
 (function () {
@@ -2433,6 +2468,8 @@
     });
   }]);
 })();
+//# sourceMappingURL=../../maps/services/rest/Slices.js.map
+
 'use strict';
 
 (function () {
@@ -2450,6 +2487,8 @@
     });
   }]);
 })();
+//# sourceMappingURL=../../maps/services/rest/Sites.js.map
+
 'use strict';
 
 (function () {
@@ -2467,6 +2506,8 @@
     });
   }]);
 })();
+//# sourceMappingURL=../../maps/services/rest/Services.js.map
+
 'use strict';
 
 (function () {
@@ -2482,6 +2523,8 @@
     return $resource('/api/service/onos/');
   }]);
 })();
+//# sourceMappingURL=../../maps/services/rest/ONOS-Services.js.map
+
 'use strict';
 
 (function () {
@@ -2497,6 +2540,8 @@
     return $resource('/api/tenant/onos/app/');
   }]);
 })();
+//# sourceMappingURL=../../maps/services/rest/ONOS-Apps.js.map
+
 'use strict';
 
 (function () {
@@ -2514,6 +2559,8 @@
     });
   }]);
 })();
+//# sourceMappingURL=../../maps/services/rest/Nodes.js.map
+
 'use strict';
 
 (function () {
@@ -2531,6 +2578,8 @@
     });
   }]);
 })();
+//# sourceMappingURL=../../maps/services/rest/Networkstemplates.js.map
+
 'use strict';
 
 (function () {
@@ -2548,6 +2597,8 @@
     });
   }]);
 })();
+//# sourceMappingURL=../../maps/services/rest/Networks.js.map
+
 'use strict';
 
 (function () {
@@ -2573,6 +2624,8 @@
     };
   }]);
 })();
+//# sourceMappingURL=../../maps/services/rest/Me.js.map
+
 'use strict';
 
 (function () {
@@ -2590,6 +2643,8 @@
     });
   }]);
 })();
+//# sourceMappingURL=../../maps/services/rest/Instances.js.map
+
 'use strict';
 
 (function () {
@@ -2607,6 +2662,8 @@
     });
   }]);
 })();
+//# sourceMappingURL=../../maps/services/rest/Images.js.map
+
 'use strict';
 
 (function () {
@@ -2624,6 +2681,8 @@
     });
   }]);
 })();
+//# sourceMappingURL=../../maps/services/rest/Flavors.js.map
+
 'use strict';
 
 (function () {
@@ -2639,6 +2698,8 @@
     return $resource('/api/service/exampleservice/');
   }]);
 })();
+//# sourceMappingURL=../../maps/services/rest/Example.js.map
+
 'use strict';
 
 (function () {
@@ -2656,6 +2717,8 @@
     });
   }]);
 })();
+//# sourceMappingURL=../../maps/services/rest/Deployments.js.map
+
 'use strict';
 
 (function () {
@@ -2687,6 +2750,8 @@
     return r;
   }]);
 })();
+//# sourceMappingURL=../../maps/services/rest/Dashboards.js.map
+
 'use strict';
 
 (function () {
@@ -2847,6 +2912,8 @@
     };
   }]);
 })();
+//# sourceMappingURL=../../maps/services/helpers/user-prefs.service.js.map
+
 'use strict';
 
 (function () {
@@ -2888,6 +2955,8 @@
     };
   }]);
 })();
+//# sourceMappingURL=../maps/services/service_graph.service.js.map
+
 'use strict';
 
 /* eslint-disable  angular/ng_window_service*/
@@ -2947,6 +3016,8 @@
     };
   }]);
 })();
+//# sourceMappingURL=../maps/services/notification.service.js.map
+
 'use strict';
 
 (function () {
@@ -2971,6 +3042,8 @@
     };
   }
 })();
+//# sourceMappingURL=../maps/services/noHyperlinks.interceptor.js.map
+
 'use strict';
 
 // TODO write tests for log
@@ -3030,6 +3103,8 @@
     return $delegate;
   }]);
 }]);
+//# sourceMappingURL=../maps/services/log.decorator.js.map
+
 'use strict';
 
 (function () {
@@ -3055,6 +3130,8 @@
     };
   }
 })();
+//# sourceMappingURL=../maps/services/csrfToken.interceptor.js.map
+
 /**
 * @ngdoc overview
 * @name ngXosLib
@@ -3068,4 +3145,5 @@
 * ## Issues
 * Please report issues at https://jira.opencord.org
 **/
-"use strict";
\ No newline at end of file
+"use strict";
+//# sourceMappingURL=maps/index.ngdoc.js.map