eda.easyFormViewer.js 64 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536
  1. !function(e){function r(e,r,o){return 4===arguments.length?t.apply(this,arguments):void n(e,{declarative:!0,deps:r,declare:o})}function t(e,r,t,o){n(e,{declarative:!1,deps:r,executingRequire:t,execute:o})}function n(e,r){r.name=e,e in p||(p[e]=r),r.normalizedDeps=r.deps}function o(e,r){if(r[e.groupIndex]=r[e.groupIndex]||[],-1==v.call(r[e.groupIndex],e)){r[e.groupIndex].push(e);for(var t=0,n=e.normalizedDeps.length;n>t;t++){var a=e.normalizedDeps[t],u=p[a];if(u&&!u.evaluated){var d=e.groupIndex+(u.declarative!=e.declarative);if(void 0===u.groupIndex||u.groupIndex<d){if(void 0!==u.groupIndex&&(r[u.groupIndex].splice(v.call(r[u.groupIndex],u),1),0==r[u.groupIndex].length))throw new TypeError("Mixed dependency cycle detected");u.groupIndex=d}o(u,r)}}}}function a(e){var r=p[e];r.groupIndex=0;var t=[];o(r,t);for(var n=!!r.declarative==t.length%2,a=t.length-1;a>=0;a--){for(var u=t[a],i=0;i<u.length;i++){var s=u[i];n?d(s):l(s)}n=!n}}function u(e){return x[e]||(x[e]={name:e,dependencies:[],exports:{},importers:[]})}function d(r){if(!r.module){var t=r.module=u(r.name),n=r.module.exports,o=r.declare.call(e,function(e,r){if(t.locked=!0,"object"==typeof e)for(var o in e)n[o]=e[o];else n[e]=r;for(var a=0,u=t.importers.length;u>a;a++){var d=t.importers[a];if(!d.locked)for(var i=0;i<d.dependencies.length;++i)d.dependencies[i]===t&&d.setters[i](n)}return t.locked=!1,r},r.name);t.setters=o.setters,t.execute=o.execute;for(var a=0,i=r.normalizedDeps.length;i>a;a++){var l,s=r.normalizedDeps[a],c=p[s],v=x[s];v?l=v.exports:c&&!c.declarative?l=c.esModule:c?(d(c),v=c.module,l=v.exports):l=f(s),v&&v.importers?(v.importers.push(t),t.dependencies.push(v)):t.dependencies.push(null),t.setters[a]&&t.setters[a](l)}}}function i(e){var r,t=p[e];if(t)t.declarative?c(e,[]):t.evaluated||l(t),r=t.module.exports;else if(r=f(e),!r)throw new Error("Unable to load dependency "+e+".");return(!t||t.declarative)&&r&&r.__useDefault?r["default"]:r}function l(r){if(!r.module){var t={},n=r.module={exports:t,id:r.name};if(!r.executingRequire)for(var o=0,a=r.normalizedDeps.length;a>o;o++){var u=r.normalizedDeps[o],d=p[u];d&&l(d)}r.evaluated=!0;var c=r.execute.call(e,function(e){for(var t=0,n=r.deps.length;n>t;t++)if(r.deps[t]==e)return i(r.normalizedDeps[t]);throw new TypeError("Module "+e+" not declared as a dependency.")},t,n);c&&(n.exports=c),t=n.exports,t&&t.__esModule?r.esModule=t:r.esModule=s(t)}}function s(r){if(r===e)return r;var t={};if("object"==typeof r||"function"==typeof r)if(g){var n;for(var o in r)(n=Object.getOwnPropertyDescriptor(r,o))&&h(t,o,n)}else{var a=r&&r.hasOwnProperty;for(var o in r)(!a||r.hasOwnProperty(o))&&(t[o]=r[o])}return t["default"]=r,h(t,"__useDefault",{value:!0}),t}function c(r,t){var n=p[r];if(n&&!n.evaluated&&n.declarative){t.push(r);for(var o=0,a=n.normalizedDeps.length;a>o;o++){var u=n.normalizedDeps[o];-1==v.call(t,u)&&(p[u]?c(u,t):f(u))}n.evaluated||(n.evaluated=!0,n.module.execute.call(e))}}function f(e){if(D[e])return D[e];if("@node/"==e.substr(0,6))return y(e.substr(6));var r=p[e];if(!r)throw"Module "+e+" not present.";return a(e),c(e,[]),p[e]=void 0,r.declarative&&h(r.module.exports,"__esModule",{value:!0}),D[e]=r.declarative?r.module.exports:r.esModule}var p={},v=Array.prototype.indexOf||function(e){for(var r=0,t=this.length;t>r;r++)if(this[r]===e)return r;return-1},g=!0;try{Object.getOwnPropertyDescriptor({a:0},"a")}catch(m){g=!1}var h;!function(){try{Object.defineProperty({},"a",{})&&(h=Object.defineProperty)}catch(e){h=function(e,r,t){try{e[r]=t.value||t.get.call(e)}catch(n){}}}}();var x={},y="undefined"!=typeof System&&System._nodeRequire||"undefined"!=typeof require&&require.resolve&&"undefined"!=typeof process&&require,D={"@empty":{}};return function(e,n,o){return function(a){a(function(a){for(var u={_nodeRequire:y,register:r,registerDynamic:t,get:f,set:function(e,r){D[e]=r},newModule:function(e){return e}},d=0;d<n.length;d++)(function(e,r){r&&r.__esModule?D[e]=r:D[e]=s(r)})(n[d],arguments[d]);o(u);var i=f(e[0]);if(e.length>1)for(var d=1;d<e.length;d++)f(e[d]);return i.__useDefault?i["default"]:i})}}}("undefined"!=typeof self?self:global)
  2. (["1"], [], function($__System) {
  3. !function(){var t=$__System;if("undefined"!=typeof window&&"undefined"!=typeof document&&window.location)var s=location.protocol+"//"+location.hostname+(location.port?":"+location.port:"");t.set("@@cjs-helpers",t.newModule({getPathVars:function(t){var n,o=t.lastIndexOf("!");n=-1!=o?t.substr(0,o):t;var e=n.split("/");return e.pop(),e=e.join("/"),"file:///"==n.substr(0,8)?(n=n.substr(7),e=e.substr(7),isWindows&&(n=n.substr(1),e=e.substr(1))):s&&n.substr(0,s.length)===s&&(n=n.substr(s.length),e=e.substr(s.length)),{filename:n,dirname:e}}}))}();
  4. $__System.register("2", [], function (_export) {
  5. "use strict";
  6. return {
  7. setters: [],
  8. execute: function () {
  9. _export("default", window.angular);
  10. }
  11. };
  12. });
  13. $__System.registerDynamic("3", [], true, function($__require, exports, module) {
  14. ;
  15. var global = this,
  16. __define = global.define;
  17. global.define = undefined;
  18. module.exports = "<div class=\"easyFormViewer\">\n\t\n\t<form \tng-submit=\"vm.onSubmit()\"\n\t\t\t\t\tname=\"vm.form\"> \n\t\t<formly-form \tmodel=\"vm.model\" \n\t\t\t\t\t\t\t\t\tfields=\"vm.fields\" \n\t\t\t\t\t\t\t\t\tform=\"vm.form\"> \n\t\t\t\n\t\t\t<div class=\"pull-right\">\n\t\t\t\t<button type=\"submit\" class=\"btn btn-primary\" \n\t\t\t\t\t\t\t\tng-disabled=\"vm.form.$invalid\"\n\t\t\t\t\t\t\t\tng-click=\"vm.edaSubmitThisDataModel();\">{{vm.submitText}}</button>\n\t\t\t\t<button type=\"button\" class=\"btn btn-primary\" \n\t\t\t\t\t\t\t\tng-click=\"vm.edaCancelEvent();\">{{vm.cancelText}}</button>\t\t\t\t\n\t\t\t</div>\t\t\t\t\t\t\n\n\t\t</formly-form> \n\t</form>\n\n</div>";
  19. global.define = __define;
  20. return module.exports;
  21. });
  22. $__System.register('4', [], function (_export) {
  23. /* global angular */
  24. 'use strict';
  25. var EMPTY_FIELD_MODEL, emptyEdaFieldsModel, returnAttributeDataModelIfNotEmpty, returnAttributeConfigurationLinesIfNotEmpty;
  26. return {
  27. setters: [],
  28. execute: function () {
  29. EMPTY_FIELD_MODEL = [{
  30. 'line': 1,
  31. 'activeColumn': 1,
  32. 'columns': [{
  33. 'numColumn': 1,
  34. 'exist': true,
  35. 'control': {
  36. 'type': 'none',
  37. 'key': 'none'
  38. }
  39. }]
  40. }];
  41. /**
  42. * empty fields model : to display at least an empty line
  43. * otherwise would look like ugly empty line like it were a bug
  44. */
  45. emptyEdaFieldsModel = function emptyEdaFieldsModel() {
  46. return angular.copy(EMPTY_FIELD_MODEL);
  47. };
  48. returnAttributeDataModelIfNotEmpty = function returnAttributeDataModelIfNotEmpty(edaEasyFormGeneratorModel) {
  49. var dataModelToReturn = angular.isArray(edaEasyFormGeneratorModel.dataModel) ? edaEasyFormGeneratorModel.dataModel.length > 0 ? edaEasyFormGeneratorModel.dataModel : [] : [];
  50. return dataModelToReturn;
  51. };
  52. returnAttributeConfigurationLinesIfNotEmpty = function returnAttributeConfigurationLinesIfNotEmpty(loadedFieldModel) {
  53. var edaEasyFormGeneratorModelToReturn = angular.isArray(loadedFieldModel) ? loadedFieldModel.length > 0 ? loadedFieldModel : emptyEdaFieldsModel() : emptyEdaFieldsModel();
  54. return edaEasyFormGeneratorModelToReturn;
  55. };
  56. _export('emptyEdaFieldsModel', emptyEdaFieldsModel);
  57. _export('returnAttributeDataModelIfNotEmpty', returnAttributeDataModelIfNotEmpty);
  58. _export('returnAttributeConfigurationLinesIfNotEmpty', returnAttributeConfigurationLinesIfNotEmpty);
  59. }
  60. };
  61. });
  62. $__System.register('5', ['3', '4', '6'], function (_export) {
  63. /* global angular */
  64. 'use strict';
  65. var easyFormViewerTemplate, returnAttributeConfigurationLinesIfNotEmpty, EASY_FORM_VIEWER_CONTROLLER, EASY_FORM_VIEWER_CONTROLLERAS, EASY_FORM_VIEWER_DIRECTIVE_NAME;
  66. function edaFormViewerDirective($modelsTranslator) {
  67. var directive = {
  68. restrict: 'E',
  69. scope: {
  70. edaEasyFormViewerDataModel: '=?',
  71. edaEasyFormViewerEasyFormGeneratorFieldsModel: '=?',
  72. edaEasyFormViewerSubmitButtonText: '@?',
  73. edaEasyFormViewerCancelButtonText: '@?',
  74. edaEasyFormViewerSubmitFormEvent: '&?',
  75. edaEasyFormViewerCancelFormEvent: '&?'
  76. },
  77. replace: false,
  78. controller: EASY_FORM_VIEWER_CONTROLLER,
  79. controllerAs: EASY_FORM_VIEWER_CONTROLLERAS,
  80. template: easyFormViewerTemplate,
  81. link: linkFct
  82. };
  83. return directive;
  84. function linkFct(scope) {
  85. scope.vm.model = {};
  86. scope.vm.fields = loadFieldsModel();
  87. scope.vm.submitText = scope.edaEasyFormViewerSubmitButtonText || 'Submit';
  88. scope.vm.cancelText = scope.edaEasyFormViewerCancelButtonText || 'Cancel';
  89. scope.$watch(fieldsModelToWatch, fieldsModelWatcher, true);
  90. scope.$watch(dataModelToWatch, dataModelWatcher, true);
  91. scope.$watch(submitBtnTextToWatch, submitBtnTextWatcher);
  92. scope.$watch(cancelBtnTextToWatch, cancelBtnTextWatcher);
  93. scope.$watch(submitEventToWatch, submitEventWatcher);
  94. scope.$watch(cancelEventToWatch, cancelEventWatcher);
  95. function dataModelToWatch() {
  96. return scope.vm.model;
  97. }
  98. function fieldsModelToWatch() {
  99. return scope.edaEasyFormViewerEasyFormGeneratorFieldsModel;
  100. }
  101. function submitBtnTextToWatch() {
  102. return scope.edaEasyFormViewerSubmitButtonText;
  103. }
  104. function cancelBtnTextToWatch() {
  105. return scope.edaEasyFormViewerCancelButtonText;
  106. }
  107. function submitEventToWatch() {
  108. return scope.vm.hasJustSumitted;
  109. }
  110. function cancelEventToWatch() {
  111. return scope.vm.hasJustCancelled;
  112. }
  113. function fieldsModelWatcher(newFieldsModel) {
  114. scope.vm.fields = loadExistingConfigurationModel(newFieldsModel);
  115. }
  116. function submitBtnTextWatcher(newSubmitBtntext, oldSubmitBtntext) {
  117. if (newSubmitBtntext !== oldSubmitBtntext) {
  118. scope.vm.submitText = newSubmitBtntext || 'Submit';
  119. }
  120. }
  121. function cancelBtnTextWatcher(newCancelBtntext, oldCancelBtntext) {
  122. if (newCancelBtntext !== oldCancelBtntext) {
  123. scope.vm.cancelText = newCancelBtntext || 'Submit';
  124. }
  125. }
  126. function dataModelWatcher(newDataModel) {
  127. scope.edaEasyFormViewerDataModel = newDataModel;
  128. }
  129. function submitEventWatcher(newSubmitEvent) {
  130. if (newSubmitEvent === true) {
  131. if (angular.isFunction(scope.edaEasyFormViewerSubmitFormEvent)) {
  132. var _dataModelSubmitted = scope.vm.model;
  133. scope.edaEasyFormViewerSubmitFormEvent({ dataModelSubmitted: _dataModelSubmitted });
  134. }
  135. }
  136. scope.vm.hasJustSumitted = false;
  137. }
  138. function cancelEventWatcher(newCancelEvent) {
  139. if (newCancelEvent === true) {
  140. if (angular.isFunction(scope.edaEasyFormViewerCancelFormEvent)) {
  141. scope.edaEasyFormViewerCancelFormEvent();
  142. }
  143. }
  144. scope.vm.hasJustCancelled = false;
  145. }
  146. /**
  147. * TODO : check if formly or easy form generato fields model
  148. *
  149. * by default or if both -> easy for generator is chosen
  150. */
  151. function loadFieldsModel() {
  152. var initialFieldsModel = angular.isArray(scope.edaEasyFormViewerEasyFormGeneratorFieldsModel) ?
  153. //translate easy form generator to formly fields model
  154. loadExistingConfigurationModel(scope.edaEasyFormViewerEasyFormGeneratorFieldsModel) : {};
  155. return initialFieldsModel;
  156. }
  157. function loadExistingConfigurationModel(loadedFieldModel) {
  158. if (angular.isArray(loadedFieldModel)) {
  159. var configlines = returnAttributeConfigurationLinesIfNotEmpty(loadedFieldModel);
  160. var formlyFieldsModel = [];
  161. scope.configurationLoaded = {};
  162. $modelsTranslator.bindConfigurationLines(scope.configurationLoaded, configlines);
  163. /**
  164. * rebind special control properties :
  165. *
  166. * formly expression properties
  167. * Validators
  168. * Validation
  169. */
  170. $modelsTranslator.refreshControlFormlyExpressionProperties(scope.configurationLoaded);
  171. $modelsTranslator.refreshControlFormlyValidators(scope.configurationLoaded);
  172. $modelsTranslator.refreshControlFormlyValidation(scope.configurationLoaded);
  173. //apply configuration model
  174. scope.configuration = angular.copy(scope.configurationLoaded);
  175. //apply formly model
  176. $modelsTranslator.applyConfigurationToformlyModel(scope.configurationLoaded, formlyFieldsModel, scope.vm.model);
  177. return formlyFieldsModel;
  178. }
  179. }
  180. }
  181. }
  182. return {
  183. setters: [function (_) {
  184. easyFormViewerTemplate = _['default'];
  185. }, function (_2) {
  186. returnAttributeConfigurationLinesIfNotEmpty = _2.returnAttributeConfigurationLinesIfNotEmpty;
  187. }, function (_3) {
  188. EASY_FORM_VIEWER_CONTROLLER = _3.EASY_FORM_VIEWER_CONTROLLER;
  189. EASY_FORM_VIEWER_CONTROLLERAS = _3.EASY_FORM_VIEWER_CONTROLLERAS;
  190. }],
  191. execute: function () {
  192. EASY_FORM_VIEWER_DIRECTIVE_NAME = 'edaEasyFormViewer';
  193. edaFormViewerDirective.$inject = ['$modelsTranslator'];
  194. _export('default', edaFormViewerDirective);
  195. _export('EASY_FORM_VIEWER_DIRECTIVE_NAME', EASY_FORM_VIEWER_DIRECTIVE_NAME);
  196. }
  197. };
  198. });
  199. $__System.register('6', ['7', '8'], function (_export) {
  200. var _createClass, _classCallCheck, EASY_FORM_VIEWER_CONTROLLER, EASY_FORM_VIEWER_CONTROLLERAS, edaEasyFormViewerController;
  201. return {
  202. setters: [function (_) {
  203. _createClass = _['default'];
  204. }, function (_2) {
  205. _classCallCheck = _2['default'];
  206. }],
  207. execute: function () {
  208. 'use strict';
  209. EASY_FORM_VIEWER_CONTROLLER = 'edaEasyFormViewerCtrl';
  210. EASY_FORM_VIEWER_CONTROLLERAS = 'vm';
  211. edaEasyFormViewerController = (function () {
  212. function edaEasyFormViewerController() {
  213. _classCallCheck(this, edaEasyFormViewerController);
  214. this.init();
  215. }
  216. _createClass(edaEasyFormViewerController, [{
  217. key: 'init',
  218. value: function init() {
  219. this.model = {};
  220. this.fields = {};
  221. this.hasJustSumitted = false;
  222. this.hasJustCancelled = false;
  223. }
  224. }, {
  225. key: 'edaSubmitThisDataModel',
  226. value: function edaSubmitThisDataModel() {
  227. this.hasJustSumitted = true;
  228. }
  229. }, {
  230. key: 'edaCancelEvent',
  231. value: function edaCancelEvent() {
  232. this.hasJustCancelled = true;
  233. }
  234. }]);
  235. return edaEasyFormViewerController;
  236. })();
  237. edaEasyFormViewerController.$inject = [];
  238. _export('default', edaEasyFormViewerController);
  239. _export('EASY_FORM_VIEWER_CONTROLLER', EASY_FORM_VIEWER_CONTROLLER);
  240. _export('EASY_FORM_VIEWER_CONTROLLERAS', EASY_FORM_VIEWER_CONTROLLERAS);
  241. }
  242. };
  243. });
  244. $__System.register('9', ['5', '6'], function (_export) {
  245. /* global angular */
  246. 'use strict';
  247. var edaFormViewerDirective, EASY_FORM_VIEWER_DIRECTIVE_NAME, edaEasyFormViewerController, EASY_FORM_VIEWER_CONTROLLER, FORM_VIEWER_MAIN_MODULE_NAME;
  248. return {
  249. setters: [function (_) {
  250. edaFormViewerDirective = _['default'];
  251. EASY_FORM_VIEWER_DIRECTIVE_NAME = _.EASY_FORM_VIEWER_DIRECTIVE_NAME;
  252. }, function (_2) {
  253. edaEasyFormViewerController = _2['default'];
  254. EASY_FORM_VIEWER_CONTROLLER = _2.EASY_FORM_VIEWER_CONTROLLER;
  255. }],
  256. execute: function () {
  257. FORM_VIEWER_MAIN_MODULE_NAME = 'edaFormViewerMainModule';
  258. _export('default', angular.module(FORM_VIEWER_MAIN_MODULE_NAME, []).directive(EASY_FORM_VIEWER_DIRECTIVE_NAME, edaFormViewerDirective).controller(EASY_FORM_VIEWER_CONTROLLER, edaEasyFormViewerController));
  259. }
  260. };
  261. });
  262. $__System.register('a', [], function (_export) {
  263. 'use strict';
  264. var CORE_MODULES, FORMVIEWER_CORE_MODULE_NAME;
  265. return {
  266. setters: [],
  267. execute: function () {
  268. CORE_MODULES = ['textAngular', 'formly', 'ngAnimate', 'formlyBootstrap', 'ui.bootstrap', 'nya.bootstrap.select'];
  269. FORMVIEWER_CORE_MODULE_NAME = 'edaEasyFormViewerCore.module';
  270. _export('default', angular.module(FORMVIEWER_CORE_MODULE_NAME, CORE_MODULES));
  271. }
  272. };
  273. });
  274. $__System.registerDynamic("b", [], true, function($__require, exports, module) {
  275. ;
  276. var global = this,
  277. __define = global.define;
  278. global.define = undefined;
  279. var $Object = Object;
  280. module.exports = {
  281. create: $Object.create,
  282. getProto: $Object.getPrototypeOf,
  283. isEnum: {}.propertyIsEnumerable,
  284. getDesc: $Object.getOwnPropertyDescriptor,
  285. setDesc: $Object.defineProperty,
  286. setDescs: $Object.defineProperties,
  287. getKeys: $Object.keys,
  288. getNames: $Object.getOwnPropertyNames,
  289. getSymbols: $Object.getOwnPropertySymbols,
  290. each: [].forEach
  291. };
  292. global.define = __define;
  293. return module.exports;
  294. });
  295. $__System.registerDynamic("c", ["b"], true, function($__require, exports, module) {
  296. ;
  297. var global = this,
  298. __define = global.define;
  299. global.define = undefined;
  300. var $ = $__require('b');
  301. module.exports = function defineProperty(it, key, desc) {
  302. return $.setDesc(it, key, desc);
  303. };
  304. global.define = __define;
  305. return module.exports;
  306. });
  307. $__System.registerDynamic("d", ["c"], true, function($__require, exports, module) {
  308. ;
  309. var global = this,
  310. __define = global.define;
  311. global.define = undefined;
  312. module.exports = {
  313. "default": $__require('c'),
  314. __esModule: true
  315. };
  316. global.define = __define;
  317. return module.exports;
  318. });
  319. $__System.registerDynamic("7", ["d"], true, function($__require, exports, module) {
  320. "use strict";
  321. ;
  322. var global = this,
  323. __define = global.define;
  324. global.define = undefined;
  325. var _Object$defineProperty = $__require('d')["default"];
  326. exports["default"] = (function() {
  327. function defineProperties(target, props) {
  328. for (var i = 0; i < props.length; i++) {
  329. var descriptor = props[i];
  330. descriptor.enumerable = descriptor.enumerable || false;
  331. descriptor.configurable = true;
  332. if ("value" in descriptor)
  333. descriptor.writable = true;
  334. _Object$defineProperty(target, descriptor.key, descriptor);
  335. }
  336. }
  337. return function(Constructor, protoProps, staticProps) {
  338. if (protoProps)
  339. defineProperties(Constructor.prototype, protoProps);
  340. if (staticProps)
  341. defineProperties(Constructor, staticProps);
  342. return Constructor;
  343. };
  344. })();
  345. exports.__esModule = true;
  346. global.define = __define;
  347. return module.exports;
  348. });
  349. $__System.registerDynamic("8", [], true, function($__require, exports, module) {
  350. "use strict";
  351. ;
  352. var global = this,
  353. __define = global.define;
  354. global.define = undefined;
  355. exports["default"] = function(instance, Constructor) {
  356. if (!(instance instanceof Constructor)) {
  357. throw new TypeError("Cannot call a class as a function");
  358. }
  359. };
  360. exports.__esModule = true;
  361. global.define = __define;
  362. return module.exports;
  363. });
  364. $__System.register('e', [], function (_export) {
  365. /* global angular */
  366. 'use strict';
  367. var resetNyaSelect, getConfigurationModelInit, getEmptyConfigModelResult, resetDataModel, getErrorObject, getMessageObject, resetFormlyModel, extractTemplateOptionDescription, extractTemplateOptionPlaceholder, extractTemplateOptionType, extractTemplateOptionLabel, extractTemplateOptionDatepickerPopup, extractFormlyExpressionProperties, extractFormlyValidators, extractFormlyValidation, extractTemplateOptionRequired, extractTemplateOptionOptions, addDatepickerPopupProperty, addOneColumnHeader, addOneColumnControl, addTwoColumnControl, addThreeColumnControl;
  368. return {
  369. setters: [],
  370. execute: function () {
  371. resetNyaSelect = function resetNyaSelect(nyaSelectObj) {
  372. var newNyaSelectObj = {
  373. controls: [{
  374. id: 'empty',
  375. name: 'no control',
  376. subtitle: 'no control',
  377. group: 'Blank',
  378. formlyType: 'blank',
  379. formlySubtype: '',
  380. formlyLabel: '',
  381. formlyRequired: false,
  382. formlyDesciption: '',
  383. formlyOptions: [],
  384. formlyExpressionProperties: {},
  385. formlyValidators: {},
  386. formlyValidation: {}
  387. }, {
  388. id: 'Header',
  389. name: 'Header',
  390. subtitle: 'no control',
  391. group: 'Decoration',
  392. formlyType: 'header',
  393. formlySubtype: '',
  394. formlyLabel: '',
  395. formlyRequired: false,
  396. formlyDesciption: '',
  397. formlyOptions: [],
  398. formlyExpressionProperties: {},
  399. formlyValidators: {},
  400. formlyValidation: {}
  401. }, {
  402. id: 'Subtitle',
  403. name: 'Subtitle',
  404. subtitle: 'no control',
  405. group: 'Decoration',
  406. formlyType: 'subTitle',
  407. formlySubtype: '',
  408. formlyLabel: '',
  409. formlyRequired: false,
  410. formlyDesciption: '',
  411. formlyOptions: [],
  412. formlyExpressionProperties: {},
  413. formlyValidators: {},
  414. formlyValidation: {}
  415. }, {
  416. id: 'TextInput',
  417. name: 'Text input',
  418. subtitle: 'Text input',
  419. group: 'input',
  420. formlyType: 'input',
  421. formlySubtype: '',
  422. formlyLabel: '',
  423. formlyRequired: false,
  424. formlyDesciption: '',
  425. formlyOptions: [],
  426. formlyExpressionProperties: {},
  427. formlyValidators: {},
  428. formlyValidation: {
  429. messages: {
  430. required: function required(viewValue, modelValue, scope) {
  431. //return a required validation message :
  432. //-> '<label as name> is required '
  433. //-> or if not exists or empty just 'this field is required'
  434. var defaultReturnMsg = 'this Text input field is required';
  435. var returnMsg = typeof scope.to.label !== 'undefined' ? scope.to.label !== '' ? scope.to.label + ' is required' : defaultReturnMsg : defaultReturnMsg;
  436. return returnMsg;
  437. }
  438. }
  439. }
  440. }, {
  441. id: 'Password',
  442. name: 'Password',
  443. subtitle: 'Password',
  444. group: 'input',
  445. formlyType: 'input',
  446. formlySubtype: 'password',
  447. formlyLabel: '',
  448. formlyRequired: false,
  449. formlyDesciption: '',
  450. formlyOptions: [],
  451. formlyExpressionProperties: {},
  452. formlyValidators: {},
  453. formlyValidation: {
  454. messages: {
  455. required: function required(viewValue, modelValue, scope) {
  456. //return a required validation message :
  457. //-> '<label as name> is required '
  458. //-> or if not exists or empty just 'this field is required'
  459. var defaultReturnMsg = 'this Password field is required';
  460. var returnMsg = typeof scope.to.label !== 'undefined' ? scope.to.label !== '' ? scope.to.label + ' is required' : defaultReturnMsg : defaultReturnMsg;
  461. return returnMsg;
  462. }
  463. }
  464. }
  465. }, {
  466. id: 'Email',
  467. name: 'Email',
  468. subtitle: 'Email',
  469. group: 'input',
  470. formlyType: 'input',
  471. formlySubtype: 'email',
  472. formlyLabel: '',
  473. formlyRequired: false,
  474. formlyDesciption: '',
  475. formlyOptions: [],
  476. formlyExpressionProperties: {},
  477. formlyValidators: {
  478. emailShape: {
  479. expression: function expression(viewValue, modelValue) {
  480. var value = modelValue || viewValue;
  481. return (/^[a-z]+[a-z0-9._]+@[a-z]+\.[a-z.]{2,5}$/.test(value)
  482. );
  483. },
  484. message: '$viewValue + \' is not a valid email\''
  485. }
  486. },
  487. formlyValidation: {
  488. messages: {
  489. required: function required(viewValue, modelValue, scope) {
  490. //return a required validation message :
  491. //-> '<label as name> is required '
  492. //-> or if not exists or empty just 'this field is required'
  493. var defaultReturnMsg = 'this Email field is required';
  494. var returnMsg = typeof scope.to.label !== 'undefined' ? scope.to.label !== '' ? scope.to.label + ' is required' : defaultReturnMsg : defaultReturnMsg;
  495. //check if validation is really dued to require validation
  496. //and not another validation like emailShape validator
  497. if (scope.to.required) return returnMsg;
  498. }
  499. }
  500. }
  501. }, {
  502. id: 'Date',
  503. name: 'Date',
  504. subtitle: 'Date',
  505. group: 'input',
  506. formlyType: 'datepicker',
  507. formlySubtype: '',
  508. formlyLabel: '',
  509. formlyRequired: false,
  510. formlyDesciption: '',
  511. formlyOptions: [],
  512. datepickerPopup: 'dd-MMMM-yyyy',
  513. formlyExpressionProperties: {},
  514. formlyValidators: {},
  515. formlyValidation: {
  516. messages: {
  517. required: function required(viewValue, modelValue, scope) {
  518. //return a required validation message :
  519. //-> '<label as name> is required '
  520. //-> or if not exists or empty just 'this field is required'
  521. var defaultReturnMsg = 'this Date field is required';
  522. var returnMsg = typeof scope.to.label !== 'undefined' ? scope.to.label !== '' ? scope.to.label + ' is required' : defaultReturnMsg : defaultReturnMsg;
  523. return returnMsg;
  524. }
  525. }
  526. }
  527. }, {
  528. id: 'Texarea',
  529. name: 'Textarea',
  530. subtitle: 'Textarea',
  531. group: 'Textarea',
  532. formlyType: 'textarea',
  533. formlySubtype: '',
  534. formlyLabel: '',
  535. formlyRequired: false,
  536. formlyDesciption: '',
  537. formlyOptions: [],
  538. formlyExpressionProperties: {},
  539. formlyValidators: {},
  540. formlyValidation: {
  541. messages: {
  542. required: function required(viewValue, modelValue, scope) {
  543. //return a required validation message :
  544. //-> '<label as name> is required '
  545. //-> or if not exists or empty just 'this field is required'
  546. var defaultReturnMsg = 'this Textarea field is required';
  547. var returnMsg = typeof scope.to.label !== 'undefined' ? scope.to.label !== '' ? scope.to.label + ' is required' : defaultReturnMsg : defaultReturnMsg;
  548. return returnMsg;
  549. }
  550. }
  551. }
  552. }, {
  553. id: 'RichTextEditor',
  554. name: 'RichTextEditor',
  555. subtitle: 'RichTextEditor',
  556. group: 'Textarea',
  557. formlyType: 'richEditor',
  558. formlySubtype: '',
  559. formlyLabel: '',
  560. formlyRequired: false,
  561. formlyDesciption: '',
  562. formlyOptions: [],
  563. formlyExpressionProperties: {},
  564. formlyValidators: {},
  565. formlyValidation: {
  566. messages: {
  567. required: function required(viewValue, modelValue, scope) {
  568. //return a required validation message :
  569. //-> '<label as name> is required '
  570. //-> or if not exists or empty just 'this field is required'
  571. var defaultReturnMsg = 'this RichTextEditor field is required';
  572. var returnMsg = typeof scope.to.label !== 'undefined' ? scope.to.label !== '' ? scope.to.label + ' is required' : defaultReturnMsg : defaultReturnMsg;
  573. return returnMsg;
  574. }
  575. }
  576. }
  577. }, {
  578. id: 'Radio',
  579. name: 'Radio',
  580. subtitle: 'Radio',
  581. options: [],
  582. group: 'Radio',
  583. formlyType: 'radio',
  584. formlySubtype: '',
  585. formlyLabel: '',
  586. formlyRequired: false,
  587. formlyDesciption: '',
  588. formlyOptions: [],
  589. formlyExpressionProperties: {},
  590. formlyValidators: {},
  591. formlyValidation: {
  592. messages: {
  593. required: function required(viewValue, modelValue, scope) {
  594. //return a required validation message :
  595. //-> '<label as name> is required '
  596. //-> or if not exists or empty just 'this field is required'
  597. var defaultReturnMsg = 'this Password field is required';
  598. var returnMsg = typeof scope.to.label !== 'undefined' ? scope.to.label !== '' ? scope.to.label + ' is required' : defaultReturnMsg : defaultReturnMsg;
  599. return returnMsg;
  600. }
  601. }
  602. }
  603. }, {
  604. id: 'Checkbox',
  605. name: 'Checkbox',
  606. subtitle: 'Checkbox',
  607. group: 'Checkbox',
  608. formlyType: 'checkbox',
  609. formlySubtype: '',
  610. formlyLabel: '',
  611. formlyRequired: false,
  612. formlyDesciption: '',
  613. formlyOptions: [],
  614. formlyExpressionProperties: {},
  615. formlyValidators: {},
  616. formlyValidation: {
  617. messages: {
  618. required: function required(viewValue, modelValue, scope) {
  619. //return a required validation message :
  620. //-> '<label as name> is required '
  621. //-> or if not exists or empty just 'this field is required'
  622. var defaultReturnMsg = 'this Checkbox field is required';
  623. var returnMsg = typeof scope.to.label !== 'undefined' ? scope.to.label !== '' ? scope.to.label + ' is required' : defaultReturnMsg : defaultReturnMsg;
  624. return returnMsg;
  625. }
  626. }
  627. }
  628. }, {
  629. id: 'BasicSelect',
  630. name: 'Basic select',
  631. subtitle: 'Basic select',
  632. options: [],
  633. group: 'Select',
  634. formlyType: 'basicSelect',
  635. formlySubtype: '',
  636. formlyLabel: '',
  637. formlyRequired: false,
  638. formlyDesciption: '',
  639. formlyOptions: [],
  640. formlyExpressionProperties: {},
  641. formlyValidators: {},
  642. formlyValidation: {
  643. messages: {
  644. required: function required(viewValue, modelValue, scope) {
  645. //return a required validation message :
  646. //-> '<label as name> is required '
  647. //-> or if not exists or empty just 'this field is required'
  648. var defaultReturnMsg = 'this Basic select field is required';
  649. var returnMsg = typeof scope.to.label !== 'undefined' ? scope.to.label !== '' ? scope.to.label + ' is required' : defaultReturnMsg : defaultReturnMsg;
  650. return returnMsg;
  651. }
  652. }
  653. }
  654. }, {
  655. id: 'GroupedSelect',
  656. name: 'Grouped Select',
  657. subtitle: 'Grouped Select',
  658. options: [],
  659. group: 'Select',
  660. formlyType: 'groupedSelect',
  661. formlySubtype: '',
  662. formlyLabel: '',
  663. formlyRequired: false,
  664. formlyDesciption: '',
  665. formlyOptions: [],
  666. formlyExpressionProperties: {},
  667. formlyValidators: {},
  668. formlyValidation: {
  669. messages: {
  670. required: function required(viewValue, modelValue, scope) {
  671. //return a required validation message :
  672. //-> '<label as name> is required '
  673. //-> or if not exists or empty just 'this field is required'
  674. var defaultReturnMsg = 'this Grouped Select field is required';
  675. var returnMsg = typeof scope.to.label !== 'undefined' ? scope.to.label !== '' ? scope.to.label + ' is required' : defaultReturnMsg : defaultReturnMsg;
  676. return returnMsg;
  677. }
  678. }
  679. }
  680. }],
  681. selectedControl: 'none',
  682. temporyConfig: {
  683. selectedControl: 'none',
  684. formlyLabel: 'label',
  685. formlyRequired: false,
  686. formlyDesciption: '',
  687. formlyPlaceholder: '',
  688. formlyOptions: [],
  689. //expressions/validation fields
  690. formlyExpressionProperties: {},
  691. formlyValidators: {},
  692. formlyValidation: {}
  693. }
  694. };
  695. //reset
  696. angular.copy(newNyaSelectObj, nyaSelectObj);
  697. return true;
  698. };
  699. /**
  700. * equivalent to formFielManage service in easy form generator
  701. */
  702. getConfigurationModelInit = function getConfigurationModelInit() {
  703. var configurationModelInit = {
  704. activeLine: 1,
  705. listConfigStep: ['init', 'first', 'second', 'third'],
  706. stepIndicators: [true, false, false, false],
  707. configStepCounter: 0,
  708. submitButtonText: 'submit',
  709. cancelButtonText: 'cancel',
  710. lines: [{
  711. line: 1,
  712. activeColumn: 1,
  713. columns: [{
  714. numColumn: 1,
  715. exist: true,
  716. control: {
  717. type: 'none',
  718. key: 'none'
  719. // templateOptions: {
  720. // label: 'none',
  721. // placeholder: 'none',
  722. // required: false,
  723. // description: 'Descriptive text'
  724. // }
  725. }
  726. }]
  727. }]
  728. };
  729. return configurationModelInit;
  730. };
  731. getEmptyConfigModelResult = function getEmptyConfigModelResult() {
  732. var configurationModelResult = {
  733. activeLine: 1,
  734. listConfigStep: ['init', 'first', 'second', 'third'],
  735. stepIndicators: [true, false, false, false],
  736. configStepCounter: 0,
  737. submitButtonText: 'submit',
  738. cancelButtonText: 'cancel',
  739. lines: []
  740. };
  741. return angular.copy(configurationModelResult);
  742. };
  743. resetDataModel = function resetDataModel(obj) {
  744. var emptyDataModel = {};
  745. angular.copy(emptyDataModel, obj);
  746. return true;
  747. };
  748. getErrorObject = function getErrorObject(errorTitle, errorMessage) {
  749. var messageObj = {
  750. noError: false,
  751. title: '',
  752. Message: ''
  753. };
  754. messageObj.noError = false;
  755. messageObj.title = errorTitle;
  756. messageObj.Message = errorMessage;
  757. return messageObj;
  758. };
  759. getMessageObject = function getMessageObject(messageTitle, messageBody) {
  760. var messageObj = {
  761. noError: false,
  762. title: '',
  763. Message: ''
  764. };
  765. messageObj.noError = true;
  766. messageObj.title = messageTitle;
  767. messageObj.Message = messageBody;
  768. return messageObj;
  769. };
  770. resetFormlyModel = function resetFormlyModel(formlyModel) {
  771. var resetformly = [];
  772. angular.copy(resetformly, formlyModel);
  773. };
  774. extractTemplateOptionDescription = function extractTemplateOptionDescription(obj) {
  775. return typeof obj.templateOptions !== 'undefined' ? typeof obj.templateOptions.description !== 'undefined' ? obj.templateOptions.description : '' : '';
  776. };
  777. extractTemplateOptionPlaceholder = function extractTemplateOptionPlaceholder(obj) {
  778. return typeof obj.templateOptions !== 'undefined' ? typeof obj.templateOptions.placeholder !== 'undefined' ? obj.templateOptions.placeholder : '' : '';
  779. };
  780. extractTemplateOptionType = function extractTemplateOptionType(obj) {
  781. return typeof obj.subtype !== 'undefined' ? obj.subtype : '';
  782. };
  783. // const isTemplateOptionDefined = (obj) => typeof obj.templateOptions !== 'undefined' ? true : false;
  784. extractTemplateOptionLabel = function extractTemplateOptionLabel(obj) {
  785. return typeof obj.templateOptions !== 'undefined' ? typeof obj.templateOptions.label !== 'undefined' ? obj.templateOptions.label : '' : '';
  786. };
  787. extractTemplateOptionDatepickerPopup = function extractTemplateOptionDatepickerPopup(obj) {
  788. return typeof obj.templateOptions !== 'undefined' ? typeof obj.templateOptions.datepickerPopup !== 'undefined' ? obj.templateOptions.datepickerPopup : '' : '';
  789. };
  790. extractFormlyExpressionProperties = function extractFormlyExpressionProperties(obj) {
  791. return typeof obj.formlyExpressionProperties !== 'undefined' ? angular.copy(obj.formlyExpressionProperties) : {};
  792. };
  793. extractFormlyValidators = function extractFormlyValidators(obj) {
  794. return typeof obj.formlyValidators !== 'undefined' ? angular.copy(obj.formlyValidators) : {};
  795. };
  796. extractFormlyValidation = function extractFormlyValidation(obj) {
  797. return typeof obj.formlyValidation !== 'undefined' ? angular.copy(obj.formlyValidation) : {};
  798. };
  799. extractTemplateOptionRequired = function extractTemplateOptionRequired(obj) {
  800. return typeof obj.templateOptions !== 'undefined' ? typeof obj.templateOptions.required !== 'undefined' ? obj.templateOptions.required : '' : '';
  801. };
  802. extractTemplateOptionOptions = function extractTemplateOptionOptions(obj) {
  803. return typeof obj.templateOptions !== 'undefined' ? typeof obj.templateOptions.options !== 'undefined' ? obj.templateOptions.options : '' : '';
  804. };
  805. addDatepickerPopupProperty = function addDatepickerPopupProperty(fieldToPush, configurationModel, lineIndex) {
  806. return fieldToPush.templateOptions.datepickerPopup = extractTemplateOptionDatepickerPopup(configurationModel.lines[lineIndex].columns[0].control);
  807. };
  808. addOneColumnHeader = function addOneColumnHeader(formlyModel, configurationModel, lineIndex) {
  809. /**
  810. * text header is stored in "description" in templateOtion model
  811. */
  812. var headerTemplateCol0 = '<div class="row"><div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><h2 class="text-center">' + extractTemplateOptionDescription(configurationModel.lines[lineIndex].columns[0].control) + '<h2></div></div><hr/>';
  813. formlyModel.push({
  814. template: typeof configurationModel.lines[lineIndex].columns[0].control.type !== 'undefined' ? configurationModel.lines[lineIndex].columns[0].control.type === 'header' ? headerTemplateCol0 : '<div></div>' : '<div></div>'
  815. });
  816. };
  817. addOneColumnControl = function addOneColumnControl(formlyModel, configurationModel, lineIndex) {
  818. var fieldToPush = {
  819. className: 'col-xs-12',
  820. type: typeof configurationModel.lines[lineIndex].columns[0].control.type !== 'undefined' ? configurationModel.lines[lineIndex].columns[0].control.type === 'none' ? 'blank' : configurationModel.lines[lineIndex].columns[0].control.type : 'blank',
  821. key: typeof configurationModel.lines[lineIndex].columns[0].control.key !== 'undefined' ? configurationModel.lines[lineIndex].columns[0].control.key : 'blank' + Date.now(),
  822. templateOptions: {
  823. type: extractTemplateOptionType(configurationModel.lines[lineIndex].columns[0].control),
  824. label: extractTemplateOptionLabel(configurationModel.lines[lineIndex].columns[0].control),
  825. required: extractTemplateOptionRequired(configurationModel.lines[lineIndex].columns[0].control),
  826. placeholder: extractTemplateOptionPlaceholder(configurationModel.lines[lineIndex].columns[0].control),
  827. description: extractTemplateOptionDescription(configurationModel.lines[lineIndex].columns[0].control),
  828. options: extractTemplateOptionOptions(configurationModel.lines[lineIndex].columns[0].control)
  829. },
  830. expressionProperties: extractFormlyExpressionProperties(configurationModel.lines[lineIndex].columns[0].control),
  831. validators: extractFormlyValidators(configurationModel.lines[lineIndex].columns[0].control),
  832. validation: extractFormlyValidation(configurationModel.lines[lineIndex].columns[0].control)
  833. };
  834. //////////////////////////////////////////////
  835. //datepicker additionnal particular property
  836. //////////////////////////////////////////////
  837. if (configurationModel.lines[lineIndex].columns[0].control.type === 'datepicker') addDatepickerPopupProperty(fieldToPush, configurationModel, lineIndex);
  838. formlyModel.push(fieldToPush);
  839. };
  840. addTwoColumnControl = function addTwoColumnControl(formlyModel, configurationModel, lineIndex) {
  841. //text header is stored in "description" in templateOtion model
  842. var headerTemplateCol0 = {
  843. className: 'col-xs-6',
  844. template: '<div class="row"><div class=""><h2 class="text-center">' + extractTemplateOptionDescription(configurationModel.lines[lineIndex].columns[0].control) + '<h2><hr/></div></div>'
  845. };
  846. var headerTemplateCol1 = {
  847. className: 'col-xs-6',
  848. template: '<div class="row"><div class=""><h2 class="text-center">' + extractTemplateOptionDescription(configurationModel.lines[lineIndex].columns[1].control) + '<h2><hr/></div></div>'
  849. };
  850. var controlCol0 = {
  851. className: 'col-xs-6',
  852. type: typeof configurationModel.lines[lineIndex].columns[0].control.type !== 'undefined' ? configurationModel.lines[lineIndex].columns[0].control.type === 'none' ? 'blank' : configurationModel.lines[lineIndex].columns[0].control.type : 'blank',
  853. key: typeof configurationModel.lines[lineIndex].columns[0].control.key !== 'undefined' ? configurationModel.lines[lineIndex].columns[0].control.key : 'blank' + Date.now(),
  854. templateOptions: {
  855. type: extractTemplateOptionType(configurationModel.lines[lineIndex].columns[0].control),
  856. label: extractTemplateOptionLabel(configurationModel.lines[lineIndex].columns[0].control),
  857. required: extractTemplateOptionRequired(configurationModel.lines[lineIndex].columns[0].control),
  858. placeholder: extractTemplateOptionPlaceholder(configurationModel.lines[lineIndex].columns[0].control),
  859. description: extractTemplateOptionDescription(configurationModel.lines[lineIndex].columns[0].control),
  860. options: extractTemplateOptionOptions(configurationModel.lines[lineIndex].columns[0].control)
  861. },
  862. expressionProperties: extractFormlyExpressionProperties(configurationModel.lines[lineIndex].columns[0].control),
  863. validators: extractFormlyValidators(configurationModel.lines[lineIndex].columns[0].control),
  864. validation: extractFormlyValidation(configurationModel.lines[lineIndex].columns[0].control)
  865. };
  866. //////////////////////////////////////////////
  867. //datepicker additionnal particular property
  868. //////////////////////////////////////////////
  869. if (configurationModel.lines[lineIndex].columns[0].control.type === 'datepicker') addDatepickerPopupProperty(controlCol0, configurationModel, lineIndex);
  870. var controlCol1 = {
  871. className: 'col-xs-6',
  872. type: typeof configurationModel.lines[lineIndex].columns[1].control.type !== 'undefined' ? configurationModel.lines[lineIndex].columns[1].control.type === 'none' ? 'blank' : configurationModel.lines[lineIndex].columns[1].control.type : 'blank',
  873. key: typeof configurationModel.lines[lineIndex].columns[1].control.key !== 'undefined' ? configurationModel.lines[lineIndex].columns[1].control.key : 'blank' + Date.now(),
  874. templateOptions: {
  875. type: extractTemplateOptionType(configurationModel.lines[lineIndex].columns[1].control),
  876. label: extractTemplateOptionLabel(configurationModel.lines[lineIndex].columns[1].control),
  877. required: extractTemplateOptionRequired(configurationModel.lines[lineIndex].columns[1].control),
  878. placeholder: extractTemplateOptionPlaceholder(configurationModel.lines[lineIndex].columns[1].control),
  879. description: extractTemplateOptionDescription(configurationModel.lines[lineIndex].columns[1].control),
  880. options: extractTemplateOptionOptions(configurationModel.lines[lineIndex].columns[1].control)
  881. },
  882. expressionProperties: extractFormlyExpressionProperties(configurationModel.lines[lineIndex].columns[1].control),
  883. validators: extractFormlyValidators(configurationModel.lines[lineIndex].columns[1].control),
  884. validation: extractFormlyValidation(configurationModel.lines[lineIndex].columns[1].control)
  885. };
  886. //////////////////////////////////////////////
  887. //datepicker additionnal particular property
  888. //////////////////////////////////////////////
  889. if (configurationModel.lines[lineIndex].columns[1].control.type === 'datepicker') addDatepickerPopupProperty(controlCol1, configurationModel, lineIndex);
  890. var FieldGroup = [];
  891. if (configurationModel.lines[lineIndex].columns[0].control.type === 'header') {
  892. FieldGroup.push(headerTemplateCol0);
  893. } else {
  894. FieldGroup.push(controlCol0);
  895. }
  896. if (configurationModel.lines[lineIndex].columns[1].control.type === 'header') {
  897. FieldGroup.push(headerTemplateCol1);
  898. } else {
  899. FieldGroup.push(controlCol1);
  900. }
  901. formlyModel.push({
  902. className: 'row',
  903. fieldGroup: FieldGroup
  904. });
  905. };
  906. addThreeColumnControl = function addThreeColumnControl(formlyModel, configurationModel, lineIndex) {
  907. //text header is stored in "description" in templateOtion model
  908. var headerTemplateCol0 = {
  909. className: 'col-xs-4',
  910. template: '<div class="row"><div class=""><h2 class="text-center">' + extractTemplateOptionDescription(configurationModel.lines[lineIndex].columns[0].control) + '<h2><hr/></div></div>'
  911. };
  912. var headerTemplateCol1 = {
  913. className: 'col-xs-4',
  914. template: '<div class="row"><div class=""><h2 class="text-center">' + extractTemplateOptionDescription(configurationModel.lines[lineIndex].columns[1].control) + '<h2><hr/></div></div>'
  915. };
  916. var headerTemplateCol2 = {
  917. className: 'col-xs-4',
  918. template: '<div class="row"><div class=""><h2 class="text-center">' + extractTemplateOptionDescription(configurationModel.lines[lineIndex].columns[2].control) + '<h2><hr/></div></div>'
  919. };
  920. var controlCol0 = {
  921. className: 'col-xs-4',
  922. type: typeof configurationModel.lines[lineIndex].columns[0].control.type !== 'undefined' ? configurationModel.lines[lineIndex].columns[0].control.type === 'none' ? 'blank' : configurationModel.lines[lineIndex].columns[0].control.type : 'blank',
  923. key: typeof configurationModel.lines[lineIndex].columns[0].control.key !== 'undefined' ? configurationModel.lines[lineIndex].columns[0].control.key : 'blank' + Date.now(),
  924. templateOptions: {
  925. type: extractTemplateOptionType(configurationModel.lines[lineIndex].columns[0].control),
  926. label: extractTemplateOptionLabel(configurationModel.lines[lineIndex].columns[0].control),
  927. required: extractTemplateOptionRequired(configurationModel.lines[lineIndex].columns[0].control),
  928. placeholder: extractTemplateOptionPlaceholder(configurationModel.lines[lineIndex].columns[0].control),
  929. description: extractTemplateOptionDescription(configurationModel.lines[lineIndex].columns[0].control),
  930. options: extractTemplateOptionOptions(configurationModel.lines[lineIndex].columns[0].control)
  931. },
  932. expressionProperties: extractFormlyExpressionProperties(configurationModel.lines[lineIndex].columns[0].control),
  933. validators: extractFormlyValidators(configurationModel.lines[lineIndex].columns[0].control),
  934. validation: extractFormlyValidation(configurationModel.lines[lineIndex].columns[0].control)
  935. };
  936. //////////////////////////////////////////////
  937. //datepicker additionnal particular property
  938. //////////////////////////////////////////////
  939. if (configurationModel.lines[lineIndex].columns[0].control.type === 'datepicker') addDatepickerPopupProperty(controlCol0, configurationModel, lineIndex);
  940. var controlCol1 = {
  941. className: 'col-xs-4',
  942. type: typeof configurationModel.lines[lineIndex].columns[1].control.type !== 'undefined' ? configurationModel.lines[lineIndex].columns[1].control.type === 'none' ? 'blank' : configurationModel.lines[lineIndex].columns[1].control.type : 'blank',
  943. key: typeof configurationModel.lines[lineIndex].columns[1].control.key !== 'undefined' ? configurationModel.lines[lineIndex].columns[1].control.key : 'blank' + Date.now(),
  944. templateOptions: {
  945. type: extractTemplateOptionType(configurationModel.lines[lineIndex].columns[1].control),
  946. label: extractTemplateOptionLabel(configurationModel.lines[lineIndex].columns[1].control),
  947. required: extractTemplateOptionRequired(configurationModel.lines[lineIndex].columns[1].control),
  948. placeholder: extractTemplateOptionPlaceholder(configurationModel.lines[lineIndex].columns[1].control),
  949. description: extractTemplateOptionDescription(configurationModel.lines[lineIndex].columns[1].control),
  950. options: extractTemplateOptionOptions(configurationModel.lines[lineIndex].columns[1].control)
  951. },
  952. expressionProperties: extractFormlyExpressionProperties(configurationModel.lines[lineIndex].columns[1].control),
  953. validators: extractFormlyValidators(configurationModel.lines[lineIndex].columns[1].control),
  954. validation: extractFormlyValidation(configurationModel.lines[lineIndex].columns[1].control)
  955. };
  956. //////////////////////////////////////////////
  957. //datepicker additionnal particular property
  958. //////////////////////////////////////////////
  959. if (configurationModel.lines[lineIndex].columns[1].control.type === 'datepicker') addDatepickerPopupProperty(controlCol1, configurationModel, lineIndex);
  960. var controlCol2 = {
  961. className: 'col-xs-4',
  962. type: typeof configurationModel.lines[lineIndex].columns[2].control.type !== 'undefined' ? configurationModel.lines[lineIndex].columns[2].control.type === 'none' ? 'blank' : configurationModel.lines[lineIndex].columns[2].control.type : 'blank',
  963. key: typeof configurationModel.lines[lineIndex].columns[2].control.key !== 'undefined' ? configurationModel.lines[lineIndex].columns[2].control.key : 'blank' + Date.now(),
  964. templateOptions: {
  965. type: extractTemplateOptionType(configurationModel.lines[lineIndex].columns[2].control),
  966. label: extractTemplateOptionLabel(configurationModel.lines[lineIndex].columns[2].control),
  967. required: extractTemplateOptionRequired(configurationModel.lines[lineIndex].columns[2].control),
  968. placeholder: extractTemplateOptionPlaceholder(configurationModel.lines[lineIndex].columns[2].control),
  969. description: extractTemplateOptionDescription(configurationModel.lines[lineIndex].columns[2].control),
  970. options: extractTemplateOptionOptions(configurationModel.lines[lineIndex].columns[2].control)
  971. },
  972. expressionProperties: extractFormlyExpressionProperties(configurationModel.lines[lineIndex].columns[2].control),
  973. validators: extractFormlyValidators(configurationModel.lines[lineIndex].columns[2].control),
  974. validation: extractFormlyValidation(configurationModel.lines[lineIndex].columns[2].control)
  975. };
  976. //////////////////////////////////////////////
  977. //datepicker additionnal particular property
  978. //////////////////////////////////////////////
  979. if (configurationModel.lines[lineIndex].columns[2].control.type === 'datepicker') addDatepickerPopupProperty(controlCol2, configurationModel, lineIndex);
  980. var FieldGroup = [];
  981. if (configurationModel.lines[lineIndex].columns[0].control.type === 'header') {
  982. FieldGroup.push(headerTemplateCol0);
  983. } else {
  984. FieldGroup.push(controlCol0);
  985. }
  986. if (configurationModel.lines[lineIndex].columns[1].control.type === 'header') {
  987. FieldGroup.push(headerTemplateCol1);
  988. } else {
  989. FieldGroup.push(controlCol1);
  990. }
  991. if (configurationModel.lines[lineIndex].columns[2].control.type === 'header') {
  992. FieldGroup.push(headerTemplateCol2);
  993. } else {
  994. FieldGroup.push(controlCol2);
  995. }
  996. formlyModel.push({
  997. className: 'row',
  998. fieldGroup: FieldGroup
  999. });
  1000. };
  1001. _export('resetNyaSelect', resetNyaSelect);
  1002. _export('getConfigurationModelInit', getConfigurationModelInit);
  1003. _export('getEmptyConfigModelResult', getEmptyConfigModelResult);
  1004. _export('resetDataModel', resetDataModel);
  1005. _export('getErrorObject', getErrorObject);
  1006. _export('getMessageObject', getMessageObject);
  1007. _export('resetFormlyModel', resetFormlyModel);
  1008. _export('addOneColumnHeader', addOneColumnHeader);
  1009. _export('addOneColumnControl', addOneColumnControl);
  1010. _export('addTwoColumnControl', addTwoColumnControl);
  1011. _export('addThreeColumnControl', addThreeColumnControl);
  1012. }
  1013. };
  1014. });
  1015. $__System.register('f', ['7', '8', 'e'], function (_export) {
  1016. var _createClass, _classCallCheck, resetNyaSelect, getEmptyConfigModelResult, resetDataModel, getErrorObject, getMessageObject, resetFormlyModel, addOneColumnHeader, addOneColumnControl, addTwoColumnControl, addThreeColumnControl, MODEL_TRANSLATOR_SERVICE, $modelsTranslator;
  1017. return {
  1018. setters: [function (_) {
  1019. _createClass = _['default'];
  1020. }, function (_2) {
  1021. _classCallCheck = _2['default'];
  1022. }, function (_e) {
  1023. resetNyaSelect = _e.resetNyaSelect;
  1024. getEmptyConfigModelResult = _e.getEmptyConfigModelResult;
  1025. resetDataModel = _e.resetDataModel;
  1026. getErrorObject = _e.getErrorObject;
  1027. getMessageObject = _e.getMessageObject;
  1028. resetFormlyModel = _e.resetFormlyModel;
  1029. addOneColumnHeader = _e.addOneColumnHeader;
  1030. addOneColumnControl = _e.addOneColumnControl;
  1031. addTwoColumnControl = _e.addTwoColumnControl;
  1032. addThreeColumnControl = _e.addThreeColumnControl;
  1033. }],
  1034. execute: function () {
  1035. /* global angular */
  1036. 'use strict';
  1037. MODEL_TRANSLATOR_SERVICE = '$modelsTranslator';
  1038. $modelsTranslator = (function () {
  1039. function $modelsTranslator() {
  1040. _classCallCheck(this, $modelsTranslator);
  1041. }
  1042. _createClass($modelsTranslator, [{
  1043. key: 'initNyaSelect',
  1044. value: function initNyaSelect(nyaSelectObj) {
  1045. return resetNyaSelect(nyaSelectObj);
  1046. }
  1047. /**
  1048. * get all controls definition (nyaSelectObj)
  1049. *
  1050. * needed to bind these properties :
  1051. *
  1052. * formlyExpressionProperties: {},
  1053. * formlyValidators: {},
  1054. * formlyValidation
  1055. */
  1056. }, {
  1057. key: 'getControlsDefinition',
  1058. value: function getControlsDefinition() {
  1059. var controls = {};
  1060. resetNyaSelect(controls);
  1061. return controls;
  1062. }
  1063. /**
  1064. * loading forms will not be able to retrieve formlyExpressionProperties
  1065. * -> here does the job
  1066. */
  1067. }, {
  1068. key: 'refreshControlFormlyExpressionProperties',
  1069. value: function refreshControlFormlyExpressionProperties(configurationModel) {
  1070. var _this = this;
  1071. if (angular.isObject(configurationModel)) {
  1072. //iterates lines
  1073. angular.forEach(configurationModel.lines, function (line) {
  1074. angular.forEach(line.columns, function (column) {
  1075. var _controlsDefinition = _this.getControlsDefinition();
  1076. angular.forEach(_controlsDefinition.controls, function (aControl) {
  1077. if (column.control.type === aControl.formlyType && column.control.subtype === aControl.formlySubtype) {
  1078. //----> update control formlyExpressionProperties property
  1079. column.control.formlyExpressionProperties = aControl.formlyExpressionProperties;
  1080. }
  1081. });
  1082. });
  1083. });
  1084. }
  1085. }
  1086. /**
  1087. * loading forms will not be able to retrieve formlyValidators
  1088. * -> here does the job
  1089. */
  1090. }, {
  1091. key: 'refreshControlFormlyValidators',
  1092. value: function refreshControlFormlyValidators(configurationModel) {
  1093. var _this2 = this;
  1094. if (angular.isObject(configurationModel)) {
  1095. //iterates lines
  1096. angular.forEach(configurationModel.lines, function (line) {
  1097. angular.forEach(line.columns, function (column) {
  1098. var _controlsDefinition = _this2.getControlsDefinition();
  1099. angular.forEach(_controlsDefinition.controls, function (aControl) {
  1100. if (column.control.type === aControl.formlyType && column.control.subtype === aControl.formlySubtype) {
  1101. //----> update control formlyValidators property
  1102. column.control.formlyValidators = aControl.formlyValidators;
  1103. }
  1104. });
  1105. });
  1106. });
  1107. }
  1108. }
  1109. /**
  1110. * loading forms will not be able to retrieve formlyValidation
  1111. * -> here does the job
  1112. */
  1113. }, {
  1114. key: 'refreshControlFormlyValidation',
  1115. value: function refreshControlFormlyValidation(configurationModel) {
  1116. var _this3 = this;
  1117. if (angular.isObject(configurationModel)) {
  1118. //iterates lines
  1119. angular.forEach(configurationModel.lines, function (line) {
  1120. angular.forEach(line.columns, function (column) {
  1121. var _controlsDefinition = _this3.getControlsDefinition();
  1122. angular.forEach(_controlsDefinition.controls, function (aControl) {
  1123. if (column.control.type === aControl.formlyType && column.control.subtype === aControl.formlySubtype) {
  1124. //----> update control formlyValidation property
  1125. column.control.formlyValidation = aControl.formlyValidation;
  1126. }
  1127. });
  1128. });
  1129. });
  1130. }
  1131. }
  1132. // initConfigurationEditFromScratch(configurationModel) {
  1133. // configurationModel = angular.copy(getConfigurationModelInit());
  1134. // }
  1135. }, {
  1136. key: 'bindConfigurationLines',
  1137. value: function bindConfigurationLines(configurationModel, lines) {
  1138. if (angular.isArray(lines)) {
  1139. var configurationModelResult = getEmptyConfigModelResult();
  1140. configurationModelResult.lines = [].concat(lines);
  1141. angular.copy(configurationModelResult, configurationModel);
  1142. return getMessageObject('configuration model is bound', 'lines are bound to configuration model.');
  1143. } else {
  1144. return getErrorObject('lines is not an array', 'Checks lines type, it is not an array.');
  1145. }
  1146. }
  1147. }, {
  1148. key: 'applyConfigurationToformlyModel',
  1149. value: function applyConfigurationToformlyModel(configurationModel, formlyModel, formlyDataModel) {
  1150. resetFormlyModel(formlyModel);
  1151. resetDataModel(formlyDataModel);
  1152. /**
  1153. * manage header here line0
  1154. */
  1155. var lineNumber = configurationModel.lines.length;
  1156. for (var i = 0; i < lineNumber; i++) {
  1157. //1 column line control
  1158. if (configurationModel.lines[i].columns.length === 1) {
  1159. //test if template control = header
  1160. if (configurationModel.lines[i].columns[0].control.type === 'header') {
  1161. addOneColumnHeader(formlyModel, configurationModel, i);
  1162. } else {
  1163. addOneColumnControl(formlyModel, configurationModel, i);
  1164. }
  1165. }
  1166. if (configurationModel.lines[i].columns.length === 2) {
  1167. addTwoColumnControl(formlyModel, configurationModel, i);
  1168. }
  1169. if (configurationModel.lines[i].columns.length === 3) {
  1170. addThreeColumnControl(formlyModel, configurationModel, i);
  1171. }
  1172. }
  1173. }
  1174. }]);
  1175. return $modelsTranslator;
  1176. })();
  1177. $modelsTranslator.$inject = [];
  1178. _export('default', $modelsTranslator);
  1179. _export('MODEL_TRANSLATOR_SERVICE', MODEL_TRANSLATOR_SERVICE);
  1180. }
  1181. };
  1182. });
  1183. // getConfigurationModelInit,
  1184. $__System.register('10', ['f'], function (_export) {
  1185. /* global angular */
  1186. 'use strict';
  1187. var $modelsTranslator, MODEL_TRANSLATOR_SERVICE, FORM_VIEWER_MODEL_TRANSLATOR_MODULE_NAME;
  1188. return {
  1189. setters: [function (_f) {
  1190. $modelsTranslator = _f['default'];
  1191. MODEL_TRANSLATOR_SERVICE = _f.MODEL_TRANSLATOR_SERVICE;
  1192. }],
  1193. execute: function () {
  1194. FORM_VIEWER_MODEL_TRANSLATOR_MODULE_NAME = 'edaFormViewerModelTranslatorModule';
  1195. _export('default', angular.module(FORM_VIEWER_MODEL_TRANSLATOR_MODULE_NAME, []).service(MODEL_TRANSLATOR_SERVICE, $modelsTranslator));
  1196. }
  1197. };
  1198. });
  1199. $__System.register("11", [], function (_export) {
  1200. "use strict";
  1201. var richTextTemplate, blankTemplate, subTitleTemplate, basicSelectTemplate, groupedSelectTemplate, datepickerTemplate, validationTemplate;
  1202. return {
  1203. setters: [],
  1204. execute: function () {
  1205. richTextTemplate = "\n\t<text-angular name=\"{{id}}\" \n\t\tclass=\"richTextAngular\" \n\t\tng-model=\"model[options.key || index]\">\n\t</text-angular>";
  1206. blankTemplate = "<div></div>";
  1207. subTitleTemplate = "\n\t<div class=\"row\">\n\t\t<div class=\"\">\n\t\t\t<h4 class=\"text-center\">\n\t\t\t{{options.templateOptions.placeholder}}\n\t\t\t<h4><hr/>\n\t\t</div>\n\t</div>";
  1208. basicSelectTemplate = " \n<ol \n\tclass=\"nya-bs-select col-sm-12 col-xs-12 col-md-12 col-lg12\" \n\tng-model=\"model[options.key || index]\" \n\tid=\"{{id}}\" \n\tdisabled=\"options.templateOptions.options.length === 0\"> \n\t<li class=\"nya-bs-option\" nya-bs-option=\"option in options.templateOptions.options\"> \n\t\t<a>{{option.name}}</a> \n\t</li> \n</ol>";
  1209. groupedSelectTemplate = "\n\t<ol class=\"nya-bs-select col-sm-12 col-xs-12 col-md-12 col-lg12\" \n\t\tng-model=\"model[options.key || index]\" \n\t\tdata-live-search=\"true\" \n\t\tdisabled=\"options.templateOptions.options.length === 0\">\n\t\t<li nya-bs-option=\"option in options.templateOptions.options group by option.group\">\n\t\t\t<span class=\"dropdown-header\">{{$group}}</span> \n\t\t\t<a>\n\t\t\t\t<span>{{option.name}}</span>\n\t\t\t\t<span class=\"glyphicon glyphicon-ok check-mark\"></span>\n\t\t\t</a>\n\t\t</li>\n\t</ol>";
  1210. datepickerTemplate = "\t<input id=\"{{id}}\" \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclass=\"form-control\" \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tng-click=\"open($event)\" \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tng-model=\"model[options.key || index]\" \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tis-open=\"to.isOpen\" \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tng-click=\"to.isOpen = true\" \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdatepicker-options=\"to.datepickerOptions\" />";
  1211. validationTemplate = "\n\t<div class=\"formly-template-wrapper form-group\"\n\t\t\t\t\t\tng-class=\"{'has-error': options.validation.errorExistsAndShouldBeVisible}\">\n\t\t\t\t<formly-transclude></formly-transclude>\n\t\t\t\t<div class=\"validation\"\n\t\t\t\t\t\t\tng-if=\"options.validation.errorExistsAndShouldBeVisible\"\n\t\t\t\t\t\t\tng-messages=\"options.formControl.$error\">\n\t\t\t\t\t<div ng-messages-include=\"validation.html\"></div>\n\t\t\t\t\t<div ng-message=\"{{::name}}\" ng-repeat=\"(name, message) in ::options.validation.messages\">\n\t\t\t\t\t\t{{message(options.formControl.$viewValue, options.formControl.$modelValue, this)}}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>";
  1212. _export("richTextTemplate", richTextTemplate);
  1213. _export("blankTemplate", blankTemplate);
  1214. _export("subTitleTemplate", subTitleTemplate);
  1215. _export("basicSelectTemplate", basicSelectTemplate);
  1216. _export("groupedSelectTemplate", groupedSelectTemplate);
  1217. _export("datepickerTemplate", datepickerTemplate);
  1218. _export("validationTemplate", validationTemplate);
  1219. }
  1220. };
  1221. });
  1222. $__System.register('12', ['11'], function (_export) {
  1223. 'use strict';
  1224. var richTextTemplate, blankTemplate, subTitleTemplate, basicSelectTemplate, groupedSelectTemplate, datepickerTemplate, validationTemplate;
  1225. function edaEasyFormViewerConfig(formlyConfigProvider) {
  1226. formlyConfigProvider.setType({
  1227. name: 'richEditor',
  1228. template: richTextTemplate,
  1229. wrapper: ['bootstrapLabel', 'bootstrapHasError']
  1230. });
  1231. formlyConfigProvider.setType({
  1232. name: 'blank',
  1233. template: blankTemplate
  1234. });
  1235. formlyConfigProvider.setType({
  1236. name: 'subTitle',
  1237. template: subTitleTemplate
  1238. });
  1239. formlyConfigProvider.setType({
  1240. name: 'basicSelect',
  1241. template: basicSelectTemplate,
  1242. wrapper: ['bootstrapLabel', 'bootstrapHasError']
  1243. });
  1244. formlyConfigProvider.setType({
  1245. name: 'groupedSelect',
  1246. template: groupedSelectTemplate,
  1247. wrapper: ['bootstrapLabel', 'bootstrapHasError']
  1248. });
  1249. ////////////////////////////
  1250. // angular UI date picker
  1251. ////////////////////////////
  1252. // thx Kent C. Dodds
  1253. var attributes = ['date-disabled', 'custom-class', 'show-weeks', 'starting-day', 'init-date', 'min-mode', 'max-mode', 'format-day', 'format-month', 'format-year', 'format-day-header', 'format-day-title', 'format-month-title', 'year-range', 'shortcut-propagation', 'datepicker-popup', 'show-button-bar', 'current-text', 'clear-text', 'close-text', 'close-on-date-selection', 'datepicker-append-to-body'];
  1254. var bindings = ['datepicker-mode', 'min-date', 'max-date'];
  1255. var ngModelAttrs = {};
  1256. angular.forEach(attributes, function (attr) {
  1257. ngModelAttrs[camelize(attr)] = { attribute: attr };
  1258. });
  1259. angular.forEach(bindings, function (binding) {
  1260. ngModelAttrs[camelize(binding)] = { bound: binding };
  1261. });
  1262. formlyConfigProvider.setType({
  1263. name: 'datepicker',
  1264. template: datepickerTemplate,
  1265. wrapper: ['bootstrapLabel', 'bootstrapHasError'],
  1266. controller: ['$scope', function ($scope) {
  1267. $scope.open = function ($event) {
  1268. $event.preventDefault();
  1269. $event.stopPropagation();
  1270. $scope.opened = true;
  1271. };
  1272. }],
  1273. defaultOptions: {
  1274. ngModelAttrs: ngModelAttrs,
  1275. templateOptions: {
  1276. addonLeft: {
  1277. 'class': 'glyphicon glyphicon-calendar',
  1278. onClick: function onClick(options) {
  1279. return options.templateOptions.isOpen = !options.templateOptions.isOpen;
  1280. }
  1281. },
  1282. onFocus: function onFocus($viewValue, $modelValue, scope) {
  1283. return scope.to.isOpen = !scope.to.isOpen;
  1284. },
  1285. datepickerOptions: {}
  1286. }
  1287. }
  1288. });
  1289. /**
  1290. * wrappers to show validation errors
  1291. * without having to rewrite formly types
  1292. */
  1293. formlyConfigProvider.setWrapper([{
  1294. template: validationTemplate
  1295. }]);
  1296. function camelize(string) {
  1297. string = string.replace(/[\-_\s]+(.)?/g, function (match, chr) {
  1298. return chr ? chr.toUpperCase() : '';
  1299. });
  1300. // Ensure 1st char is always lowercase
  1301. return string.replace(/^([A-Z])/, function (match, chr) {
  1302. return chr ? chr.toLowerCase() : '';
  1303. });
  1304. }
  1305. }
  1306. return {
  1307. setters: [function (_) {
  1308. richTextTemplate = _.richTextTemplate;
  1309. blankTemplate = _.blankTemplate;
  1310. subTitleTemplate = _.subTitleTemplate;
  1311. basicSelectTemplate = _.basicSelectTemplate;
  1312. groupedSelectTemplate = _.groupedSelectTemplate;
  1313. datepickerTemplate = _.datepickerTemplate;
  1314. validationTemplate = _.validationTemplate;
  1315. }],
  1316. execute: function () {
  1317. edaEasyFormViewerConfig.$inject = ['formlyConfigProvider'];
  1318. _export('default', edaEasyFormViewerConfig);
  1319. }
  1320. };
  1321. });
  1322. $__System.registerDynamic("13", [], true, function($__require, exports, module) {
  1323. ;
  1324. var global = this,
  1325. __define = global.define;
  1326. global.define = undefined;
  1327. module.exports = {
  1328. "stepway": {"version": "1.1.0"},
  1329. "dragdropway": {"version": "1.1.0"},
  1330. "formviewer": {"version": "1.1.0"}
  1331. };
  1332. global.define = __define;
  1333. return module.exports;
  1334. });
  1335. $__System.register('1', ['2', '9', '10', '12', '13', 'a'], function (_export) {
  1336. 'use strict';
  1337. var edaFormViewerMainModule, edaFormViewerModelTranslatorModule, edaEasyFormViewerConfig, easyFormConfig, edaFormViewerCoreModule, DEP_TO_INJECT_IN_MAIN, EASY_FORM_VIEWER_VERSION_NAME, EASY_FORM_VIEWER_VERSION_VALUE, MAIN_MODULE_NAME, mainModule;
  1338. return {
  1339. setters: [function (_) {}, function (_2) {
  1340. edaFormViewerMainModule = _2['default'];
  1341. }, function (_3) {
  1342. edaFormViewerModelTranslatorModule = _3['default'];
  1343. }, function (_4) {
  1344. edaEasyFormViewerConfig = _4['default'];
  1345. }, function (_5) {
  1346. easyFormConfig = _5['default'];
  1347. }, function (_a) {
  1348. edaFormViewerCoreModule = _a['default'];
  1349. }],
  1350. execute: function () {
  1351. DEP_TO_INJECT_IN_MAIN = [edaFormViewerMainModule.name, edaFormViewerCoreModule.name, edaFormViewerModelTranslatorModule.name];
  1352. EASY_FORM_VIEWER_VERSION_NAME = 'easyFormViewerVersion';
  1353. EASY_FORM_VIEWER_VERSION_VALUE = easyFormConfig.formviewer.version;
  1354. MAIN_MODULE_NAME = 'eda.easyFormViewer';
  1355. mainModule = angular.module(MAIN_MODULE_NAME, DEP_TO_INJECT_IN_MAIN).config(edaEasyFormViewerConfig).value(EASY_FORM_VIEWER_VERSION_NAME, EASY_FORM_VIEWER_VERSION_VALUE);
  1356. _export('default', mainModule);
  1357. }
  1358. };
  1359. });
  1360. })
  1361. (function(factory) {
  1362. factory();
  1363. });
  1364. //# sourceMappingURL=eda.easyFormViewer.js.map