123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542 |
- !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)
- (["1"], [], function($__System) {
- !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}}}))}();
- $__System.register("2", [], function (_export) {
- "use strict";
- return {
- setters: [],
- execute: function () {
- _export("default", window.angular);
- }
- };
- });
- $__System.registerDynamic("3", [], true, function($__require, exports, module) {
- ;
- var global = this,
- __define = global.define;
- global.define = undefined;
- 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>";
- global.define = __define;
- return module.exports;
- });
- $__System.register('4', [], function (_export) {
- /* global angular */
- 'use strict';
- var EMPTY_FIELD_MODEL, emptyEdaFieldsModel, returnAttributeDataModelIfNotEmpty, returnAttributeConfigurationLinesIfNotEmpty;
- return {
- setters: [],
- execute: function () {
- EMPTY_FIELD_MODEL = [{
- 'line': 1,
- 'activeColumn': 1,
- 'columns': [{
- 'numColumn': 1,
- 'exist': true,
- 'control': {
- 'type': 'none',
- 'key': 'none'
- }
- }]
- }];
- /**
- * empty fields model : to display at least an empty line
- * otherwise would look like ugly empty line like it were a bug
- */
- emptyEdaFieldsModel = function emptyEdaFieldsModel() {
- return angular.copy(EMPTY_FIELD_MODEL);
- };
- returnAttributeDataModelIfNotEmpty = function returnAttributeDataModelIfNotEmpty(edaEasyFormGeneratorModel) {
- var dataModelToReturn = angular.isArray(edaEasyFormGeneratorModel.dataModel) ? edaEasyFormGeneratorModel.dataModel.length > 0 ? edaEasyFormGeneratorModel.dataModel : [] : [];
- return dataModelToReturn;
- };
- returnAttributeConfigurationLinesIfNotEmpty = function returnAttributeConfigurationLinesIfNotEmpty(loadedFieldModel) {
- var edaEasyFormGeneratorModelToReturn = angular.isArray(loadedFieldModel) ? loadedFieldModel.length > 0 ? loadedFieldModel : emptyEdaFieldsModel() : emptyEdaFieldsModel();
- return edaEasyFormGeneratorModelToReturn;
- };
- _export('emptyEdaFieldsModel', emptyEdaFieldsModel);
- _export('returnAttributeDataModelIfNotEmpty', returnAttributeDataModelIfNotEmpty);
- _export('returnAttributeConfigurationLinesIfNotEmpty', returnAttributeConfigurationLinesIfNotEmpty);
- }
- };
- });
- $__System.register('5', ['3', '4', '6'], function (_export) {
- /* global angular */
- 'use strict';
- var easyFormViewerTemplate, returnAttributeConfigurationLinesIfNotEmpty, EASY_FORM_VIEWER_CONTROLLER, EASY_FORM_VIEWER_CONTROLLERAS, EASY_FORM_VIEWER_DIRECTIVE_NAME;
- function edaFormViewerDirective($modelsTranslator) {
- var directive = {
- restrict: 'E',
- scope: {
- edaEasyFormViewerDataModel: '=?',
- edaEasyFormViewerEasyFormGeneratorFieldsModel: '=?',
- edaEasyFormViewerSubmitButtonText: '@?',
- edaEasyFormViewerCancelButtonText: '@?',
- edaEasyFormViewerSubmitFormEvent: '&?',
- edaEasyFormViewerCancelFormEvent: '&?'
- },
- replace: false,
- controller: EASY_FORM_VIEWER_CONTROLLER,
- controllerAs: EASY_FORM_VIEWER_CONTROLLERAS,
- template: easyFormViewerTemplate,
- link: linkFct
- };
- return directive;
- function linkFct(scope) {
- scope.vm.model = {};
- scope.vm.fields = loadFieldsModel();
- scope.vm.submitText = scope.edaEasyFormViewerSubmitButtonText || 'Submit';
- scope.vm.cancelText = scope.edaEasyFormViewerCancelButtonText || 'Cancel';
- scope.$watch(fieldsModelToWatch, fieldsModelWatcher, true);
- scope.$watch(dataModelToWatch, dataModelWatcher, true);
- scope.$watch(submitBtnTextToWatch, submitBtnTextWatcher);
- scope.$watch(cancelBtnTextToWatch, cancelBtnTextWatcher);
- scope.$watch(submitEventToWatch, submitEventWatcher);
- scope.$watch(cancelEventToWatch, cancelEventWatcher);
- function dataModelToWatch() {
- return scope.vm.model;
- }
- function fieldsModelToWatch() {
- return scope.edaEasyFormViewerEasyFormGeneratorFieldsModel;
- }
- function submitBtnTextToWatch() {
- return scope.edaEasyFormViewerSubmitButtonText;
- }
- function cancelBtnTextToWatch() {
- return scope.edaEasyFormViewerCancelButtonText;
- }
- function submitEventToWatch() {
- return scope.vm.hasJustSumitted;
- }
- function cancelEventToWatch() {
- return scope.vm.hasJustCancelled;
- }
- function fieldsModelWatcher(newFieldsModel) {
- scope.vm.fields = loadExistingConfigurationModel(newFieldsModel);
- }
- function submitBtnTextWatcher(newSubmitBtntext, oldSubmitBtntext) {
- if (newSubmitBtntext !== oldSubmitBtntext) {
- scope.vm.submitText = newSubmitBtntext || 'Submit';
- }
- }
- function cancelBtnTextWatcher(newCancelBtntext, oldCancelBtntext) {
- if (newCancelBtntext !== oldCancelBtntext) {
- scope.vm.cancelText = newCancelBtntext || 'Submit';
- }
- }
- function dataModelWatcher(newDataModel) {
- scope.edaEasyFormViewerDataModel = newDataModel;
- }
- function submitEventWatcher(newSubmitEvent) {
- if (newSubmitEvent === true) {
- if (angular.isFunction(scope.edaEasyFormViewerSubmitFormEvent)) {
- var _dataModelSubmitted = scope.vm.model;
- scope.edaEasyFormViewerSubmitFormEvent({ dataModelSubmitted: _dataModelSubmitted });
- }
- }
- scope.vm.hasJustSumitted = false;
- }
- function cancelEventWatcher(newCancelEvent) {
- if (newCancelEvent === true) {
- if (angular.isFunction(scope.edaEasyFormViewerCancelFormEvent)) {
- scope.edaEasyFormViewerCancelFormEvent();
- }
- }
- scope.vm.hasJustCancelled = false;
- }
- /**
- * TODO : check if formly or easy form generato fields model
- *
- * by default or if both -> easy for generator is chosen
- */
- function loadFieldsModel() {
- var initialFieldsModel = angular.isArray(scope.edaEasyFormViewerEasyFormGeneratorFieldsModel) ?
- //translate easy form generator to formly fields model
- loadExistingConfigurationModel(scope.edaEasyFormViewerEasyFormGeneratorFieldsModel) : {};
- return initialFieldsModel;
- }
- function loadExistingConfigurationModel(loadedFieldModel) {
- if (angular.isArray(loadedFieldModel)) {
- var configlines = returnAttributeConfigurationLinesIfNotEmpty(loadedFieldModel);
- var formlyFieldsModel = [];
- scope.configurationLoaded = {};
- $modelsTranslator.bindConfigurationLines(scope.configurationLoaded, configlines);
- /**
- * rebind special control properties :
- *
- * formly expression properties
- * Validators
- * Validation
- */
- $modelsTranslator.refreshControlFormlyExpressionProperties(scope.configurationLoaded);
- $modelsTranslator.refreshControlFormlyValidators(scope.configurationLoaded);
- $modelsTranslator.refreshControlFormlyValidation(scope.configurationLoaded);
- //apply configuration model
- scope.configuration = angular.copy(scope.configurationLoaded);
- //apply formly model
- $modelsTranslator.applyConfigurationToformlyModel(scope.configurationLoaded, formlyFieldsModel, scope.vm.model);
- return formlyFieldsModel;
- }
- }
- }
- }
- return {
- setters: [function (_) {
- easyFormViewerTemplate = _['default'];
- }, function (_2) {
- returnAttributeConfigurationLinesIfNotEmpty = _2.returnAttributeConfigurationLinesIfNotEmpty;
- }, function (_3) {
- EASY_FORM_VIEWER_CONTROLLER = _3.EASY_FORM_VIEWER_CONTROLLER;
- EASY_FORM_VIEWER_CONTROLLERAS = _3.EASY_FORM_VIEWER_CONTROLLERAS;
- }],
- execute: function () {
- EASY_FORM_VIEWER_DIRECTIVE_NAME = 'edaEasyFormViewer';
- edaFormViewerDirective.$inject = ['$modelsTranslator'];
- _export('default', edaFormViewerDirective);
- _export('EASY_FORM_VIEWER_DIRECTIVE_NAME', EASY_FORM_VIEWER_DIRECTIVE_NAME);
- }
- };
- });
- $__System.register('6', ['7', '8'], function (_export) {
- var _createClass, _classCallCheck, EASY_FORM_VIEWER_CONTROLLER, EASY_FORM_VIEWER_CONTROLLERAS, edaEasyFormViewerController;
- return {
- setters: [function (_) {
- _createClass = _['default'];
- }, function (_2) {
- _classCallCheck = _2['default'];
- }],
- execute: function () {
- 'use strict';
- EASY_FORM_VIEWER_CONTROLLER = 'edaEasyFormViewerCtrl';
- EASY_FORM_VIEWER_CONTROLLERAS = 'vm';
- edaEasyFormViewerController = (function () {
- function edaEasyFormViewerController() {
- _classCallCheck(this, edaEasyFormViewerController);
- this.init();
- }
- _createClass(edaEasyFormViewerController, [{
- key: 'init',
- value: function init() {
- this.model = {};
- this.fields = {};
- this.hasJustSumitted = false;
- this.hasJustCancelled = false;
- }
- }, {
- key: 'edaSubmitThisDataModel',
- value: function edaSubmitThisDataModel() {
- this.hasJustSumitted = true;
- }
- }, {
- key: 'edaCancelEvent',
- value: function edaCancelEvent() {
- this.hasJustCancelled = true;
- }
- }]);
- return edaEasyFormViewerController;
- })();
- edaEasyFormViewerController.$inject = [];
- _export('default', edaEasyFormViewerController);
- _export('EASY_FORM_VIEWER_CONTROLLER', EASY_FORM_VIEWER_CONTROLLER);
- _export('EASY_FORM_VIEWER_CONTROLLERAS', EASY_FORM_VIEWER_CONTROLLERAS);
- }
- };
- });
- $__System.register('9', ['5', '6'], function (_export) {
- /* global angular */
- 'use strict';
- var edaFormViewerDirective, EASY_FORM_VIEWER_DIRECTIVE_NAME, edaEasyFormViewerController, EASY_FORM_VIEWER_CONTROLLER, FORM_VIEWER_MAIN_MODULE_NAME;
- return {
- setters: [function (_) {
- edaFormViewerDirective = _['default'];
- EASY_FORM_VIEWER_DIRECTIVE_NAME = _.EASY_FORM_VIEWER_DIRECTIVE_NAME;
- }, function (_2) {
- edaEasyFormViewerController = _2['default'];
- EASY_FORM_VIEWER_CONTROLLER = _2.EASY_FORM_VIEWER_CONTROLLER;
- }],
- execute: function () {
- FORM_VIEWER_MAIN_MODULE_NAME = 'edaFormViewerMainModule';
- _export('default', angular.module(FORM_VIEWER_MAIN_MODULE_NAME, []).directive(EASY_FORM_VIEWER_DIRECTIVE_NAME, edaFormViewerDirective).controller(EASY_FORM_VIEWER_CONTROLLER, edaEasyFormViewerController));
- }
- };
- });
- $__System.register('a', [], function (_export) {
- 'use strict';
- var CORE_MODULES, FORMVIEWER_CORE_MODULE_NAME;
- return {
- setters: [],
- execute: function () {
- CORE_MODULES = ['textAngular', 'formly', 'ngAnimate', 'formlyBootstrap', 'ui.bootstrap', 'nya.bootstrap.select'];
- FORMVIEWER_CORE_MODULE_NAME = 'edaEasyFormViewerCore.module';
- _export('default', angular.module(FORMVIEWER_CORE_MODULE_NAME, CORE_MODULES));
- }
- };
- });
- $__System.registerDynamic("b", [], true, function($__require, exports, module) {
- ;
- var global = this,
- __define = global.define;
- global.define = undefined;
- var $Object = Object;
- module.exports = {
- create: $Object.create,
- getProto: $Object.getPrototypeOf,
- isEnum: {}.propertyIsEnumerable,
- getDesc: $Object.getOwnPropertyDescriptor,
- setDesc: $Object.defineProperty,
- setDescs: $Object.defineProperties,
- getKeys: $Object.keys,
- getNames: $Object.getOwnPropertyNames,
- getSymbols: $Object.getOwnPropertySymbols,
- each: [].forEach
- };
- global.define = __define;
- return module.exports;
- });
- $__System.registerDynamic("c", ["b"], true, function($__require, exports, module) {
- ;
- var global = this,
- __define = global.define;
- global.define = undefined;
- var $ = $__require('b');
- module.exports = function defineProperty(it, key, desc) {
- return $.setDesc(it, key, desc);
- };
- global.define = __define;
- return module.exports;
- });
- $__System.registerDynamic("d", ["c"], true, function($__require, exports, module) {
- ;
- var global = this,
- __define = global.define;
- global.define = undefined;
- module.exports = {
- "default": $__require('c'),
- __esModule: true
- };
- global.define = __define;
- return module.exports;
- });
- $__System.registerDynamic("7", ["d"], true, function($__require, exports, module) {
- "use strict";
- ;
- var global = this,
- __define = global.define;
- global.define = undefined;
- var _Object$defineProperty = $__require('d')["default"];
- exports["default"] = (function() {
- function defineProperties(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor)
- descriptor.writable = true;
- _Object$defineProperty(target, descriptor.key, descriptor);
- }
- }
- return function(Constructor, protoProps, staticProps) {
- if (protoProps)
- defineProperties(Constructor.prototype, protoProps);
- if (staticProps)
- defineProperties(Constructor, staticProps);
- return Constructor;
- };
- })();
- exports.__esModule = true;
- global.define = __define;
- return module.exports;
- });
- $__System.registerDynamic("8", [], true, function($__require, exports, module) {
- "use strict";
- ;
- var global = this,
- __define = global.define;
- global.define = undefined;
- exports["default"] = function(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- };
- exports.__esModule = true;
- global.define = __define;
- return module.exports;
- });
- $__System.register('e', [], function (_export) {
- /* global angular */
- 'use strict';
- var resetNyaSelect, getConfigurationModelInit, getEmptyConfigModelResult, resetDataModel, getErrorObject, getMessageObject, resetFormlyModel, extractTemplateOptionDescription, extractTemplateOptionPlaceholder, extractTemplateOptionType, extractTemplateOptionLabel, extractTemplateOptionDatepickerOptions, extractFormlyExpressionProperties, extractFormlyValidators, extractFormlyValidation, extractTemplateOptionRequired, extractTemplateOptionOptions, addDatepickerOptionsProperty, addOneColumnHeader, addOneColumnControl, addTwoColumnControl, addThreeColumnControl;
- return {
- setters: [],
- execute: function () {
- resetNyaSelect = function resetNyaSelect(nyaSelectObj) {
- var newNyaSelectObj = {
- controls: [{
- id: 'empty',
- name: 'no control',
- subtitle: 'no control',
- group: 'Blank',
- formlyType: 'blank',
- formlySubtype: '',
- formlyLabel: '',
- formlyRequired: false,
- formlyDesciption: '',
- formlyOptions: [],
- formlyExpressionProperties: {},
- formlyValidators: {},
- formlyValidation: {}
- }, {
- id: 'Header',
- name: 'Header',
- subtitle: 'no control',
- group: 'Decoration',
- formlyType: 'header',
- formlySubtype: '',
- formlyLabel: '',
- formlyRequired: false,
- formlyDesciption: '',
- formlyOptions: [],
- formlyExpressionProperties: {},
- formlyValidators: {},
- formlyValidation: {}
- }, {
- id: 'Subtitle',
- name: 'Subtitle',
- subtitle: 'no control',
- group: 'Decoration',
- formlyType: 'subTitle',
- formlySubtype: '',
- formlyLabel: '',
- formlyRequired: false,
- formlyDesciption: '',
- formlyOptions: [],
- formlyExpressionProperties: {},
- formlyValidators: {},
- formlyValidation: {}
- }, {
- id: 'TextInput',
- name: 'Text input',
- subtitle: 'Text input',
- group: 'input',
- formlyType: 'input',
- formlySubtype: '',
- formlyLabel: '',
- formlyRequired: false,
- formlyDesciption: '',
- formlyOptions: [],
- formlyExpressionProperties: {},
- formlyValidators: {},
- formlyValidation: {
- messages: {
- required: function required(viewValue, modelValue, scope) {
- //return a required validation message :
- //-> '<label as name> is required '
- //-> or if not exists or empty just 'this field is required'
- var defaultReturnMsg = 'this Text input field is required';
- var returnMsg = typeof scope.to.label !== 'undefined' ? scope.to.label !== '' ? scope.to.label + ' is required' : defaultReturnMsg : defaultReturnMsg;
- return returnMsg;
- }
- }
- }
- }, {
- id: 'Password',
- name: 'Password',
- subtitle: 'Password',
- group: 'input',
- formlyType: 'input',
- formlySubtype: 'password',
- formlyLabel: '',
- formlyRequired: false,
- formlyDesciption: '',
- formlyOptions: [],
- formlyExpressionProperties: {},
- formlyValidators: {},
- formlyValidation: {
- messages: {
- required: function required(viewValue, modelValue, scope) {
- //return a required validation message :
- //-> '<label as name> is required '
- //-> or if not exists or empty just 'this field is required'
- var defaultReturnMsg = 'this Password field is required';
- var returnMsg = typeof scope.to.label !== 'undefined' ? scope.to.label !== '' ? scope.to.label + ' is required' : defaultReturnMsg : defaultReturnMsg;
- return returnMsg;
- }
- }
- }
- }, {
- id: 'Email',
- name: 'Email',
- subtitle: 'Email',
- group: 'input',
- formlyType: 'input',
- formlySubtype: 'email',
- formlyLabel: '',
- formlyRequired: false,
- formlyDesciption: '',
- formlyOptions: [],
- formlyExpressionProperties: {},
- formlyValidators: {
- emailShape: {
- expression: function expression(viewValue, modelValue) {
- var value = modelValue || viewValue;
- return (/^[a-z]+[a-z0-9._]+@[a-z]+\.[a-z.]{2,5}$/.test(value)
- );
- },
- message: '$viewValue + \' is not a valid email\''
- }
- },
- formlyValidation: {
- messages: {
- required: function required(viewValue, modelValue, scope) {
- //return a required validation message :
- //-> '<label as name> is required '
- //-> or if not exists or empty just 'this field is required'
- var defaultReturnMsg = 'this Email field is required';
- var returnMsg = typeof scope.to.label !== 'undefined' ? scope.to.label !== '' ? scope.to.label + ' is required' : defaultReturnMsg : defaultReturnMsg;
- //check if validation is really dued to require validation
- //and not another validation like emailShape validator
- if (scope.to.required) return returnMsg;
- }
- }
- }
- }, {
- id: 'Date',
- name: 'Date',
- subtitle: 'Date',
- group: 'input',
- formlyType: 'datepicker',
- formlySubtype: '',
- formlyLabel: '',
- formlyRequired: false,
- formlyDesciption: '',
- formlyOptions: [],
- datepickerOptions: { format: 'dd-MMMM-yyyy' },
- formlyExpressionProperties: {},
- formlyValidators: {},
- formlyValidation: {
- messages: {
- required: function required(viewValue, modelValue, scope) {
- //return a required validation message :
- //-> '<label as name> is required '
- //-> or if not exists or empty just 'this field is required'
- var defaultReturnMsg = 'this Date field is required';
- var returnMsg = typeof scope.to.label !== 'undefined' ? scope.to.label !== '' ? scope.to.label + ' is required' : defaultReturnMsg : defaultReturnMsg;
- return returnMsg;
- }
- }
- }
- }, {
- id: 'Texarea',
- name: 'Textarea',
- subtitle: 'Textarea',
- group: 'Textarea',
- formlyType: 'textarea',
- formlySubtype: '',
- formlyLabel: '',
- formlyRequired: false,
- formlyDesciption: '',
- formlyOptions: [],
- formlyExpressionProperties: {},
- formlyValidators: {},
- formlyValidation: {
- messages: {
- required: function required(viewValue, modelValue, scope) {
- //return a required validation message :
- //-> '<label as name> is required '
- //-> or if not exists or empty just 'this field is required'
- var defaultReturnMsg = 'this Textarea field is required';
- var returnMsg = typeof scope.to.label !== 'undefined' ? scope.to.label !== '' ? scope.to.label + ' is required' : defaultReturnMsg : defaultReturnMsg;
- return returnMsg;
- }
- }
- }
- }, {
- id: 'RichTextEditor',
- name: 'RichTextEditor',
- subtitle: 'RichTextEditor',
- group: 'Textarea',
- formlyType: 'richEditor',
- formlySubtype: '',
- formlyLabel: '',
- formlyRequired: false,
- formlyDesciption: '',
- formlyOptions: [],
- formlyExpressionProperties: {},
- formlyValidators: {},
- formlyValidation: {
- messages: {
- required: function required(viewValue, modelValue, scope) {
- //return a required validation message :
- //-> '<label as name> is required '
- //-> or if not exists or empty just 'this field is required'
- var defaultReturnMsg = 'this RichTextEditor field is required';
- var returnMsg = typeof scope.to.label !== 'undefined' ? scope.to.label !== '' ? scope.to.label + ' is required' : defaultReturnMsg : defaultReturnMsg;
- return returnMsg;
- }
- }
- }
- }, {
- id: 'Radio',
- name: 'Radio',
- subtitle: 'Radio',
- options: [],
- group: 'Radio',
- formlyType: 'radio',
- formlySubtype: '',
- formlyLabel: '',
- formlyRequired: false,
- formlyDesciption: '',
- formlyOptions: [],
- formlyExpressionProperties: {},
- formlyValidators: {},
- formlyValidation: {
- messages: {
- required: function required(viewValue, modelValue, scope) {
- //return a required validation message :
- //-> '<label as name> is required '
- //-> or if not exists or empty just 'this field is required'
- var defaultReturnMsg = 'this Password field is required';
- var returnMsg = typeof scope.to.label !== 'undefined' ? scope.to.label !== '' ? scope.to.label + ' is required' : defaultReturnMsg : defaultReturnMsg;
- return returnMsg;
- }
- }
- }
- }, {
- id: 'Checkbox',
- name: 'Checkbox',
- subtitle: 'Checkbox',
- group: 'Checkbox',
- formlyType: 'checkbox',
- formlySubtype: '',
- formlyLabel: '',
- formlyRequired: false,
- formlyDesciption: '',
- formlyOptions: [],
- formlyExpressionProperties: {},
- formlyValidators: {},
- formlyValidation: {
- messages: {
- required: function required(viewValue, modelValue, scope) {
- //return a required validation message :
- //-> '<label as name> is required '
- //-> or if not exists or empty just 'this field is required'
- var defaultReturnMsg = 'this Checkbox field is required';
- var returnMsg = typeof scope.to.label !== 'undefined' ? scope.to.label !== '' ? scope.to.label + ' is required' : defaultReturnMsg : defaultReturnMsg;
- return returnMsg;
- }
- }
- }
- }, {
- id: 'BasicSelect',
- name: 'Basic select',
- subtitle: 'Basic select',
- options: [],
- group: 'Select',
- formlyType: 'basicSelect',
- formlySubtype: '',
- formlyLabel: '',
- formlyRequired: false,
- formlyDesciption: '',
- formlyOptions: [],
- formlyExpressionProperties: {},
- formlyValidators: {},
- formlyValidation: {
- messages: {
- required: function required(viewValue, modelValue, scope) {
- //return a required validation message :
- //-> '<label as name> is required '
- //-> or if not exists or empty just 'this field is required'
- var defaultReturnMsg = 'this Basic select field is required';
- var returnMsg = typeof scope.to.label !== 'undefined' ? scope.to.label !== '' ? scope.to.label + ' is required' : defaultReturnMsg : defaultReturnMsg;
- return returnMsg;
- }
- }
- }
- }, {
- id: 'GroupedSelect',
- name: 'Grouped Select',
- subtitle: 'Grouped Select',
- options: [],
- group: 'Select',
- formlyType: 'groupedSelect',
- formlySubtype: '',
- formlyLabel: '',
- formlyRequired: false,
- formlyDesciption: '',
- formlyOptions: [],
- formlyExpressionProperties: {},
- formlyValidators: {},
- formlyValidation: {
- messages: {
- required: function required(viewValue, modelValue, scope) {
- //return a required validation message :
- //-> '<label as name> is required '
- //-> or if not exists or empty just 'this field is required'
- var defaultReturnMsg = 'this Grouped Select field is required';
- var returnMsg = typeof scope.to.label !== 'undefined' ? scope.to.label !== '' ? scope.to.label + ' is required' : defaultReturnMsg : defaultReturnMsg;
- return returnMsg;
- }
- }
- }
- }],
- selectedControl: 'none',
- temporyConfig: {
- selectedControl: 'none',
- formlyLabel: 'label',
- formlyRequired: false,
- formlyDesciption: '',
- formlyPlaceholder: '',
- formlyOptions: [],
- //expressions/validation fields
- formlyExpressionProperties: {},
- formlyValidators: {},
- formlyValidation: {}
- }
- };
- //reset
- angular.copy(newNyaSelectObj, nyaSelectObj);
- return true;
- };
- /**
- * equivalent to formFielManage service in easy form generator
- */
- getConfigurationModelInit = function getConfigurationModelInit() {
- var configurationModelInit = {
- activeLine: 1,
- listConfigStep: ['init', 'first', 'second', 'third'],
- stepIndicators: [true, false, false, false],
- configStepCounter: 0,
- submitButtonText: 'submit',
- cancelButtonText: 'cancel',
- lines: [{
- line: 1,
- activeColumn: 1,
- columns: [{
- numColumn: 1,
- exist: true,
- control: {
- type: 'none',
- key: 'none'
- // templateOptions: {
- // label: 'none',
- // placeholder: 'none',
- // required: false,
- // description: 'Descriptive text'
- // }
- }
- }]
- }]
- };
- return configurationModelInit;
- };
- getEmptyConfigModelResult = function getEmptyConfigModelResult() {
- var configurationModelResult = {
- activeLine: 1,
- listConfigStep: ['init', 'first', 'second', 'third'],
- stepIndicators: [true, false, false, false],
- configStepCounter: 0,
- submitButtonText: 'submit',
- cancelButtonText: 'cancel',
- lines: []
- };
- return angular.copy(configurationModelResult);
- };
- resetDataModel = function resetDataModel(obj) {
- var emptyDataModel = {};
- angular.copy(emptyDataModel, obj);
- return true;
- };
- getErrorObject = function getErrorObject(errorTitle, errorMessage) {
- var messageObj = {
- noError: false,
- title: '',
- Message: ''
- };
- messageObj.noError = false;
- messageObj.title = errorTitle;
- messageObj.Message = errorMessage;
- return messageObj;
- };
- getMessageObject = function getMessageObject(messageTitle, messageBody) {
- var messageObj = {
- noError: false,
- title: '',
- Message: ''
- };
- messageObj.noError = true;
- messageObj.title = messageTitle;
- messageObj.Message = messageBody;
- return messageObj;
- };
- resetFormlyModel = function resetFormlyModel(formlyModel) {
- var resetformly = [];
- angular.copy(resetformly, formlyModel);
- };
- extractTemplateOptionDescription = function extractTemplateOptionDescription(obj) {
- return typeof obj.templateOptions !== 'undefined' ? typeof obj.templateOptions.description !== 'undefined' ? obj.templateOptions.description : '' : '';
- };
- extractTemplateOptionPlaceholder = function extractTemplateOptionPlaceholder(obj) {
- return typeof obj.templateOptions !== 'undefined' ? typeof obj.templateOptions.placeholder !== 'undefined' ? obj.templateOptions.placeholder : '' : '';
- };
- extractTemplateOptionType = function extractTemplateOptionType(obj) {
- return typeof obj.subtype !== 'undefined' ? obj.subtype : '';
- };
- // const isTemplateOptionDefined = (obj) => typeof obj.templateOptions !== 'undefined' ? true : false;
- extractTemplateOptionLabel = function extractTemplateOptionLabel(obj) {
- return typeof obj.templateOptions !== 'undefined' ? typeof obj.templateOptions.label !== 'undefined' ? obj.templateOptions.label : '' : '';
- };
- extractTemplateOptionDatepickerOptions = function extractTemplateOptionDatepickerOptions(obj) {
- return typeof obj.templateOptions !== 'undefined' ? typeof obj.templateOptions.datepickerOptions !== 'undefined' ? angular.copy(obj.templateOptions.datepickerOptions) : '' : '';
- };
- extractFormlyExpressionProperties = function extractFormlyExpressionProperties(obj) {
- return typeof obj.formlyExpressionProperties !== 'undefined' ? angular.copy(obj.formlyExpressionProperties) : {};
- };
- extractFormlyValidators = function extractFormlyValidators(obj) {
- return typeof obj.formlyValidators !== 'undefined' ? angular.copy(obj.formlyValidators) : {};
- };
- extractFormlyValidation = function extractFormlyValidation(obj) {
- return typeof obj.formlyValidation !== 'undefined' ? angular.copy(obj.formlyValidation) : {};
- };
- extractTemplateOptionRequired = function extractTemplateOptionRequired(obj) {
- return typeof obj.templateOptions !== 'undefined' ? typeof obj.templateOptions.required !== 'undefined' ? obj.templateOptions.required : '' : '';
- };
- extractTemplateOptionOptions = function extractTemplateOptionOptions(obj) {
- return typeof obj.templateOptions !== 'undefined' ? typeof obj.templateOptions.options !== 'undefined' ? obj.templateOptions.options : '' : '';
- };
- addDatepickerOptionsProperty = function addDatepickerOptionsProperty(fieldToPush, configurationModel, lineIndex) {
- return fieldToPush.templateOptions.datepickerOptions = extractTemplateOptionDatepickerOptions(configurationModel.lines[lineIndex].columns[0].control);
- };
- addOneColumnHeader = function addOneColumnHeader(formlyModel, configurationModel, lineIndex) {
- /**
- * text header is stored in "description" in templateOtion model
- */
- 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/>';
- formlyModel.push({
- template: typeof configurationModel.lines[lineIndex].columns[0].control.type !== 'undefined' ? configurationModel.lines[lineIndex].columns[0].control.type === 'header' ? headerTemplateCol0 : '<div></div>' : '<div></div>'
- });
- };
- addOneColumnControl = function addOneColumnControl(formlyModel, configurationModel, lineIndex) {
- var fieldToPush = {
- className: 'col-xs-12',
- 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',
- key: typeof configurationModel.lines[lineIndex].columns[0].control.key !== 'undefined' ? configurationModel.lines[lineIndex].columns[0].control.key : 'blank' + Date.now(),
- templateOptions: {
- type: extractTemplateOptionType(configurationModel.lines[lineIndex].columns[0].control),
- label: extractTemplateOptionLabel(configurationModel.lines[lineIndex].columns[0].control),
- required: extractTemplateOptionRequired(configurationModel.lines[lineIndex].columns[0].control),
- placeholder: extractTemplateOptionPlaceholder(configurationModel.lines[lineIndex].columns[0].control),
- description: extractTemplateOptionDescription(configurationModel.lines[lineIndex].columns[0].control),
- options: extractTemplateOptionOptions(configurationModel.lines[lineIndex].columns[0].control)
- },
- expressionProperties: extractFormlyExpressionProperties(configurationModel.lines[lineIndex].columns[0].control),
- validators: extractFormlyValidators(configurationModel.lines[lineIndex].columns[0].control),
- validation: extractFormlyValidation(configurationModel.lines[lineIndex].columns[0].control)
- };
- //////////////////////////////////////////////
- //datepicker additionnal particular property
- //////////////////////////////////////////////
- if (configurationModel.lines[lineIndex].columns[0].control.type === 'datepicker') addDatepickerOptionsProperty(fieldToPush, configurationModel, lineIndex);
- formlyModel.push(fieldToPush);
- };
- addTwoColumnControl = function addTwoColumnControl(formlyModel, configurationModel, lineIndex) {
- //text header is stored in "description" in templateOtion model
- var headerTemplateCol0 = {
- className: 'col-xs-6',
- template: '<div class="row"><div class=""><h2 class="text-center">' + extractTemplateOptionDescription(configurationModel.lines[lineIndex].columns[0].control) + '<h2><hr/></div></div>'
- };
- var headerTemplateCol1 = {
- className: 'col-xs-6',
- template: '<div class="row"><div class=""><h2 class="text-center">' + extractTemplateOptionDescription(configurationModel.lines[lineIndex].columns[1].control) + '<h2><hr/></div></div>'
- };
- var controlCol0 = {
- className: 'col-xs-6',
- 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',
- key: typeof configurationModel.lines[lineIndex].columns[0].control.key !== 'undefined' ? configurationModel.lines[lineIndex].columns[0].control.key : 'blank' + Date.now(),
- templateOptions: {
- type: extractTemplateOptionType(configurationModel.lines[lineIndex].columns[0].control),
- label: extractTemplateOptionLabel(configurationModel.lines[lineIndex].columns[0].control),
- required: extractTemplateOptionRequired(configurationModel.lines[lineIndex].columns[0].control),
- placeholder: extractTemplateOptionPlaceholder(configurationModel.lines[lineIndex].columns[0].control),
- description: extractTemplateOptionDescription(configurationModel.lines[lineIndex].columns[0].control),
- options: extractTemplateOptionOptions(configurationModel.lines[lineIndex].columns[0].control)
- },
- expressionProperties: extractFormlyExpressionProperties(configurationModel.lines[lineIndex].columns[0].control),
- validators: extractFormlyValidators(configurationModel.lines[lineIndex].columns[0].control),
- validation: extractFormlyValidation(configurationModel.lines[lineIndex].columns[0].control)
- };
- //////////////////////////////////////////////
- //datepicker additionnal particular property
- //////////////////////////////////////////////
- if (configurationModel.lines[lineIndex].columns[0].control.type === 'datepicker') addDatepickerOptionsProperty(controlCol0, configurationModel, lineIndex);
- var controlCol1 = {
- className: 'col-xs-6',
- 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',
- key: typeof configurationModel.lines[lineIndex].columns[1].control.key !== 'undefined' ? configurationModel.lines[lineIndex].columns[1].control.key : 'blank' + Date.now(),
- templateOptions: {
- type: extractTemplateOptionType(configurationModel.lines[lineIndex].columns[1].control),
- label: extractTemplateOptionLabel(configurationModel.lines[lineIndex].columns[1].control),
- required: extractTemplateOptionRequired(configurationModel.lines[lineIndex].columns[1].control),
- placeholder: extractTemplateOptionPlaceholder(configurationModel.lines[lineIndex].columns[1].control),
- description: extractTemplateOptionDescription(configurationModel.lines[lineIndex].columns[1].control),
- options: extractTemplateOptionOptions(configurationModel.lines[lineIndex].columns[1].control)
- },
- expressionProperties: extractFormlyExpressionProperties(configurationModel.lines[lineIndex].columns[1].control),
- validators: extractFormlyValidators(configurationModel.lines[lineIndex].columns[1].control),
- validation: extractFormlyValidation(configurationModel.lines[lineIndex].columns[1].control)
- };
- //////////////////////////////////////////////
- //datepicker additionnal particular property
- //////////////////////////////////////////////
- if (configurationModel.lines[lineIndex].columns[1].control.type === 'datepicker') addDatepickerOptionsProperty(controlCol1, configurationModel, lineIndex);
- var FieldGroup = [];
- if (configurationModel.lines[lineIndex].columns[0].control.type === 'header') {
- FieldGroup.push(headerTemplateCol0);
- } else {
- FieldGroup.push(controlCol0);
- }
- if (configurationModel.lines[lineIndex].columns[1].control.type === 'header') {
- FieldGroup.push(headerTemplateCol1);
- } else {
- FieldGroup.push(controlCol1);
- }
- formlyModel.push({
- className: 'row',
- fieldGroup: FieldGroup
- });
- };
- addThreeColumnControl = function addThreeColumnControl(formlyModel, configurationModel, lineIndex) {
- //text header is stored in "description" in templateOtion model
- var headerTemplateCol0 = {
- className: 'col-xs-4',
- template: '<div class="row"><div class=""><h2 class="text-center">' + extractTemplateOptionDescription(configurationModel.lines[lineIndex].columns[0].control) + '<h2><hr/></div></div>'
- };
- var headerTemplateCol1 = {
- className: 'col-xs-4',
- template: '<div class="row"><div class=""><h2 class="text-center">' + extractTemplateOptionDescription(configurationModel.lines[lineIndex].columns[1].control) + '<h2><hr/></div></div>'
- };
- var headerTemplateCol2 = {
- className: 'col-xs-4',
- template: '<div class="row"><div class=""><h2 class="text-center">' + extractTemplateOptionDescription(configurationModel.lines[lineIndex].columns[2].control) + '<h2><hr/></div></div>'
- };
- var controlCol0 = {
- className: 'col-xs-4',
- 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',
- key: typeof configurationModel.lines[lineIndex].columns[0].control.key !== 'undefined' ? configurationModel.lines[lineIndex].columns[0].control.key : 'blank' + Date.now(),
- templateOptions: {
- type: extractTemplateOptionType(configurationModel.lines[lineIndex].columns[0].control),
- label: extractTemplateOptionLabel(configurationModel.lines[lineIndex].columns[0].control),
- required: extractTemplateOptionRequired(configurationModel.lines[lineIndex].columns[0].control),
- placeholder: extractTemplateOptionPlaceholder(configurationModel.lines[lineIndex].columns[0].control),
- description: extractTemplateOptionDescription(configurationModel.lines[lineIndex].columns[0].control),
- options: extractTemplateOptionOptions(configurationModel.lines[lineIndex].columns[0].control)
- },
- expressionProperties: extractFormlyExpressionProperties(configurationModel.lines[lineIndex].columns[0].control),
- validators: extractFormlyValidators(configurationModel.lines[lineIndex].columns[0].control),
- validation: extractFormlyValidation(configurationModel.lines[lineIndex].columns[0].control)
- };
- //////////////////////////////////////////////
- //datepicker additionnal particular property
- //////////////////////////////////////////////
- if (configurationModel.lines[lineIndex].columns[0].control.type === 'datepicker') addDatepickerOptionsProperty(controlCol0, configurationModel, lineIndex);
- var controlCol1 = {
- className: 'col-xs-4',
- 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',
- key: typeof configurationModel.lines[lineIndex].columns[1].control.key !== 'undefined' ? configurationModel.lines[lineIndex].columns[1].control.key : 'blank' + Date.now(),
- templateOptions: {
- type: extractTemplateOptionType(configurationModel.lines[lineIndex].columns[1].control),
- label: extractTemplateOptionLabel(configurationModel.lines[lineIndex].columns[1].control),
- required: extractTemplateOptionRequired(configurationModel.lines[lineIndex].columns[1].control),
- placeholder: extractTemplateOptionPlaceholder(configurationModel.lines[lineIndex].columns[1].control),
- description: extractTemplateOptionDescription(configurationModel.lines[lineIndex].columns[1].control),
- options: extractTemplateOptionOptions(configurationModel.lines[lineIndex].columns[1].control)
- },
- expressionProperties: extractFormlyExpressionProperties(configurationModel.lines[lineIndex].columns[1].control),
- validators: extractFormlyValidators(configurationModel.lines[lineIndex].columns[1].control),
- validation: extractFormlyValidation(configurationModel.lines[lineIndex].columns[1].control)
- };
- //////////////////////////////////////////////
- //datepicker additionnal particular property
- //////////////////////////////////////////////
- if (configurationModel.lines[lineIndex].columns[1].control.type === 'datepicker') addDatepickerOptionsProperty(controlCol1, configurationModel, lineIndex);
- var controlCol2 = {
- className: 'col-xs-4',
- 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',
- key: typeof configurationModel.lines[lineIndex].columns[2].control.key !== 'undefined' ? configurationModel.lines[lineIndex].columns[2].control.key : 'blank' + Date.now(),
- templateOptions: {
- type: extractTemplateOptionType(configurationModel.lines[lineIndex].columns[2].control),
- label: extractTemplateOptionLabel(configurationModel.lines[lineIndex].columns[2].control),
- required: extractTemplateOptionRequired(configurationModel.lines[lineIndex].columns[2].control),
- placeholder: extractTemplateOptionPlaceholder(configurationModel.lines[lineIndex].columns[2].control),
- description: extractTemplateOptionDescription(configurationModel.lines[lineIndex].columns[2].control),
- options: extractTemplateOptionOptions(configurationModel.lines[lineIndex].columns[2].control)
- },
- expressionProperties: extractFormlyExpressionProperties(configurationModel.lines[lineIndex].columns[2].control),
- validators: extractFormlyValidators(configurationModel.lines[lineIndex].columns[2].control),
- validation: extractFormlyValidation(configurationModel.lines[lineIndex].columns[2].control)
- };
- //////////////////////////////////////////////
- //datepicker additionnal particular property
- //////////////////////////////////////////////
- if (configurationModel.lines[lineIndex].columns[2].control.type === 'datepicker') addDatepickerOptionsProperty(controlCol2, configurationModel, lineIndex);
- var FieldGroup = [];
- if (configurationModel.lines[lineIndex].columns[0].control.type === 'header') {
- FieldGroup.push(headerTemplateCol0);
- } else {
- FieldGroup.push(controlCol0);
- }
- if (configurationModel.lines[lineIndex].columns[1].control.type === 'header') {
- FieldGroup.push(headerTemplateCol1);
- } else {
- FieldGroup.push(controlCol1);
- }
- if (configurationModel.lines[lineIndex].columns[2].control.type === 'header') {
- FieldGroup.push(headerTemplateCol2);
- } else {
- FieldGroup.push(controlCol2);
- }
- formlyModel.push({
- className: 'row',
- fieldGroup: FieldGroup
- });
- };
- _export('resetNyaSelect', resetNyaSelect);
- _export('getConfigurationModelInit', getConfigurationModelInit);
- _export('getEmptyConfigModelResult', getEmptyConfigModelResult);
- _export('resetDataModel', resetDataModel);
- _export('getErrorObject', getErrorObject);
- _export('getMessageObject', getMessageObject);
- _export('resetFormlyModel', resetFormlyModel);
- _export('addOneColumnHeader', addOneColumnHeader);
- _export('addOneColumnControl', addOneColumnControl);
- _export('addTwoColumnControl', addTwoColumnControl);
- _export('addThreeColumnControl', addThreeColumnControl);
- }
- };
- });
- $__System.register('f', ['7', '8', 'e'], function (_export) {
- var _createClass, _classCallCheck, resetNyaSelect, getEmptyConfigModelResult, resetDataModel, getErrorObject, getMessageObject, resetFormlyModel, addOneColumnHeader, addOneColumnControl, addTwoColumnControl, addThreeColumnControl, MODEL_TRANSLATOR_SERVICE, $modelsTranslator;
- return {
- setters: [function (_) {
- _createClass = _['default'];
- }, function (_2) {
- _classCallCheck = _2['default'];
- }, function (_e) {
- resetNyaSelect = _e.resetNyaSelect;
- getEmptyConfigModelResult = _e.getEmptyConfigModelResult;
- resetDataModel = _e.resetDataModel;
- getErrorObject = _e.getErrorObject;
- getMessageObject = _e.getMessageObject;
- resetFormlyModel = _e.resetFormlyModel;
- addOneColumnHeader = _e.addOneColumnHeader;
- addOneColumnControl = _e.addOneColumnControl;
- addTwoColumnControl = _e.addTwoColumnControl;
- addThreeColumnControl = _e.addThreeColumnControl;
- }],
- execute: function () {
- /* global angular */
- 'use strict';
- MODEL_TRANSLATOR_SERVICE = '$modelsTranslator';
- $modelsTranslator = (function () {
- function $modelsTranslator() {
- _classCallCheck(this, $modelsTranslator);
- }
- _createClass($modelsTranslator, [{
- key: 'initNyaSelect',
- value: function initNyaSelect(nyaSelectObj) {
- return resetNyaSelect(nyaSelectObj);
- }
- /**
- * get all controls definition (nyaSelectObj)
- *
- * needed to bind these properties :
- *
- * formlyExpressionProperties: {},
- * formlyValidators: {},
- * formlyValidation
- */
- }, {
- key: 'getControlsDefinition',
- value: function getControlsDefinition() {
- var controls = {};
- resetNyaSelect(controls);
- return controls;
- }
- /**
- * loading forms will not be able to retrieve formlyExpressionProperties
- * -> here does the job
- */
- }, {
- key: 'refreshControlFormlyExpressionProperties',
- value: function refreshControlFormlyExpressionProperties(configurationModel) {
- var _this = this;
- if (angular.isObject(configurationModel)) {
- //iterates lines
- angular.forEach(configurationModel.lines, function (line) {
- angular.forEach(line.columns, function (column) {
- var _controlsDefinition = _this.getControlsDefinition();
- angular.forEach(_controlsDefinition.controls, function (aControl) {
- if (column.control.type === aControl.formlyType && column.control.subtype === aControl.formlySubtype) {
- //----> update control formlyExpressionProperties property
- column.control.formlyExpressionProperties = aControl.formlyExpressionProperties;
- }
- });
- });
- });
- }
- }
- /**
- * loading forms will not be able to retrieve formlyValidators
- * -> here does the job
- */
- }, {
- key: 'refreshControlFormlyValidators',
- value: function refreshControlFormlyValidators(configurationModel) {
- var _this2 = this;
- if (angular.isObject(configurationModel)) {
- //iterates lines
- angular.forEach(configurationModel.lines, function (line) {
- angular.forEach(line.columns, function (column) {
- var _controlsDefinition = _this2.getControlsDefinition();
- angular.forEach(_controlsDefinition.controls, function (aControl) {
- if (column.control.type === aControl.formlyType && column.control.subtype === aControl.formlySubtype) {
- //----> update control formlyValidators property
- column.control.formlyValidators = aControl.formlyValidators;
- }
- });
- });
- });
- }
- }
- /**
- * loading forms will not be able to retrieve formlyValidation
- * -> here does the job
- */
- }, {
- key: 'refreshControlFormlyValidation',
- value: function refreshControlFormlyValidation(configurationModel) {
- var _this3 = this;
- if (angular.isObject(configurationModel)) {
- //iterates lines
- angular.forEach(configurationModel.lines, function (line) {
- angular.forEach(line.columns, function (column) {
- var _controlsDefinition = _this3.getControlsDefinition();
- angular.forEach(_controlsDefinition.controls, function (aControl) {
- if (column.control.type === aControl.formlyType && column.control.subtype === aControl.formlySubtype) {
- //----> update control formlyValidation property
- column.control.formlyValidation = aControl.formlyValidation;
- }
- });
- });
- });
- }
- }
- // initConfigurationEditFromScratch(configurationModel) {
- // configurationModel = angular.copy(getConfigurationModelInit());
- // }
- }, {
- key: 'bindConfigurationLines',
- value: function bindConfigurationLines(configurationModel, lines) {
- if (angular.isArray(lines)) {
- var configurationModelResult = getEmptyConfigModelResult();
- configurationModelResult.lines = [].concat(lines);
- angular.copy(configurationModelResult, configurationModel);
- return getMessageObject('configuration model is bound', 'lines are bound to configuration model.');
- } else {
- return getErrorObject('lines is not an array', 'Checks lines type, it is not an array.');
- }
- }
- }, {
- key: 'applyConfigurationToformlyModel',
- value: function applyConfigurationToformlyModel(configurationModel, formlyModel, formlyDataModel) {
- resetFormlyModel(formlyModel);
- resetDataModel(formlyDataModel);
- /**
- * manage header here line0
- */
- var lineNumber = configurationModel.lines.length;
- for (var i = 0; i < lineNumber; i++) {
- //1 column line control
- if (configurationModel.lines[i].columns.length === 1) {
- //test if template control = header
- if (configurationModel.lines[i].columns[0].control.type === 'header') {
- addOneColumnHeader(formlyModel, configurationModel, i);
- } else {
- addOneColumnControl(formlyModel, configurationModel, i);
- }
- }
- if (configurationModel.lines[i].columns.length === 2) {
- addTwoColumnControl(formlyModel, configurationModel, i);
- }
- if (configurationModel.lines[i].columns.length === 3) {
- addThreeColumnControl(formlyModel, configurationModel, i);
- }
- }
- }
- }]);
- return $modelsTranslator;
- })();
- $modelsTranslator.$inject = [];
- _export('default', $modelsTranslator);
- _export('MODEL_TRANSLATOR_SERVICE', MODEL_TRANSLATOR_SERVICE);
- }
- };
- });
- // getConfigurationModelInit,
- $__System.register('10', ['f'], function (_export) {
- /* global angular */
- 'use strict';
- var $modelsTranslator, MODEL_TRANSLATOR_SERVICE, FORM_VIEWER_MODEL_TRANSLATOR_MODULE_NAME;
- return {
- setters: [function (_f) {
- $modelsTranslator = _f['default'];
- MODEL_TRANSLATOR_SERVICE = _f.MODEL_TRANSLATOR_SERVICE;
- }],
- execute: function () {
- FORM_VIEWER_MODEL_TRANSLATOR_MODULE_NAME = 'edaFormViewerModelTranslatorModule';
- _export('default', angular.module(FORM_VIEWER_MODEL_TRANSLATOR_MODULE_NAME, []).service(MODEL_TRANSLATOR_SERVICE, $modelsTranslator));
- }
- };
- });
- $__System.register("11", [], function (_export) {
- "use strict";
- var richTextTemplate, blankTemplate, subTitleTemplate, basicSelectTemplate, groupedSelectTemplate, datepickerTemplate, validationTemplate;
- return {
- setters: [],
- execute: function () {
- richTextTemplate = "\n\t<text-angular name=\"{{id}}\"\n\t\tclass=\"richTextAngular\"\n\t\tng-model=\"model[options.key || index]\">\n\t</text-angular>";
- blankTemplate = "<div></div>";
- 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>";
- 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>";
- 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>";
- datepickerTemplate = "\n <p class=\"input-group\">\n <span class=\"input-group-btn\">\n <button\n type=\"button\"\n class=\"btn btn-default\"\n ng-click=\"formlyDatePicker.open($event)\">\n <i class=\"glyphicon glyphicon-calendar\"></i>\n </button>\n </span>\n <input type=\"text\"\n id=\"{{::id}}\"\n name=\"{{::id}}\"\n ng-model=\"model[options.key]\"\n class=\"form-control\"\n ng-click=\"datepicker.open($event)\"\n uib-datepicker-popup=\"{{to.datepickerOptions.format}}\"\n is-open=\"datepicker.opened\"\n datepicker-options=\"to.datepickerOptions\"\n />\n </p>\n ";
- 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>";
- _export("richTextTemplate", richTextTemplate);
- _export("blankTemplate", blankTemplate);
- _export("subTitleTemplate", subTitleTemplate);
- _export("basicSelectTemplate", basicSelectTemplate);
- _export("groupedSelectTemplate", groupedSelectTemplate);
- _export("datepickerTemplate", datepickerTemplate);
- _export("validationTemplate", validationTemplate);
- }
- };
- });
- $__System.register('12', ['11'], function (_export) {
- 'use strict';
- var richTextTemplate, blankTemplate, subTitleTemplate, basicSelectTemplate, groupedSelectTemplate, datepickerTemplate, validationTemplate;
- function edaEasyFormViewerConfig(formlyConfigProvider) {
- formlyConfigProvider.setType({
- name: 'richEditor',
- template: richTextTemplate,
- wrapper: ['bootstrapLabel', 'bootstrapHasError']
- });
- formlyConfigProvider.setType({
- name: 'blank',
- template: blankTemplate
- });
- formlyConfigProvider.setType({
- name: 'subTitle',
- template: subTitleTemplate
- });
- formlyConfigProvider.setType({
- name: 'basicSelect',
- template: basicSelectTemplate,
- wrapper: ['bootstrapLabel', 'bootstrapHasError']
- });
- formlyConfigProvider.setType({
- name: 'groupedSelect',
- template: groupedSelectTemplate,
- wrapper: ['bootstrapLabel', 'bootstrapHasError']
- });
- ////////////////////////////
- // angular UI date picker
- ////////////////////////////
- // thx Kent C. Dodds
- 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'];
- var bindings = ['datepicker-mode', 'min-date', 'max-date'];
- var ngModelAttrs = {};
- angular.forEach(attributes, function (attr) {
- ngModelAttrs[camelize(attr)] = { attribute: attr };
- });
- angular.forEach(bindings, function (binding) {
- ngModelAttrs[camelize(binding)] = { bound: binding };
- });
- formlyConfigProvider.setType({
- name: 'datepicker',
- template: datepickerTemplate,
- defaultOptions: {
- ngModelAttrs: ngModelAttrs,
- templateOptions: {
- datepickerOptions: {
- format: 'dd/MM/yyyy',
- initDate: new Date(),
- showWeeks: false
- }
- }
- },
- wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- controller: ['$scope', function ($scope) {
- // console.info('ui calendar init');
- $scope.datepicker = {};
- // make sure the initial value is of type DATE!
- var currentModelVal = $scope.model[$scope.options.key];
- if (typeof currentModelVal == 'string') {
- $scope.model[$scope.options.key] = new Date(currentModelVal);
- }
- $scope.datepicker.opened = false;
- $scope.datepicker.open = function ($event) {
- $event.preventDefault();
- $event.stopPropagation();
- // console.info('ui calendar open event');
- $scope.datepicker.opened = !$scope.datepicker.opened;
- };
- }]
- });
- /**
- * wrappers to show validation errors
- * without having to rewrite formly types
- */
- formlyConfigProvider.setWrapper([{
- template: validationTemplate
- }]);
- function camelize(string) {
- string = string.replace(/[\-_\s]+(.)?/g, function (match, chr) {
- return chr ? chr.toUpperCase() : '';
- });
- // Ensure 1st char is always lowercase
- return string.replace(/^([A-Z])/, function (match, chr) {
- return chr ? chr.toLowerCase() : '';
- });
- }
- }
- return {
- setters: [function (_) {
- richTextTemplate = _.richTextTemplate;
- blankTemplate = _.blankTemplate;
- subTitleTemplate = _.subTitleTemplate;
- basicSelectTemplate = _.basicSelectTemplate;
- groupedSelectTemplate = _.groupedSelectTemplate;
- datepickerTemplate = _.datepickerTemplate;
- validationTemplate = _.validationTemplate;
- }],
- execute: function () {
- edaEasyFormViewerConfig.$inject = ['formlyConfigProvider'];
- _export('default', edaEasyFormViewerConfig);
- }
- };
- });
- $__System.registerDynamic("13", [], true, function($__require, exports, module) {
- ;
- var global = this,
- __define = global.define;
- global.define = undefined;
- module.exports = {
- "stepway": {"version": "1.2.0"},
- "dragdropway": {"version": "1.2.0"},
- "formviewer": {"version": "1.2.0"}
- };
- global.define = __define;
- return module.exports;
- });
- $__System.register('1', ['2', '9', '10', '12', '13', 'a'], function (_export) {
- 'use strict';
- 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;
- return {
- setters: [function (_) {}, function (_2) {
- edaFormViewerMainModule = _2['default'];
- }, function (_3) {
- edaFormViewerModelTranslatorModule = _3['default'];
- }, function (_4) {
- edaEasyFormViewerConfig = _4['default'];
- }, function (_5) {
- easyFormConfig = _5['default'];
- }, function (_a) {
- edaFormViewerCoreModule = _a['default'];
- }],
- execute: function () {
- DEP_TO_INJECT_IN_MAIN = [edaFormViewerMainModule.name, edaFormViewerCoreModule.name, edaFormViewerModelTranslatorModule.name];
- EASY_FORM_VIEWER_VERSION_NAME = 'easyFormViewerVersion';
- EASY_FORM_VIEWER_VERSION_VALUE = easyFormConfig.formviewer.version;
- MAIN_MODULE_NAME = 'eda.easyFormViewer';
- mainModule = angular.module(MAIN_MODULE_NAME, DEP_TO_INJECT_IN_MAIN).config(edaEasyFormViewerConfig).value(EASY_FORM_VIEWER_VERSION_NAME, EASY_FORM_VIEWER_VERSION_VALUE);
- _export('default', mainModule);
- }
- };
- });
- })
- (function(factory) {
- factory();
- });
- //# sourceMappingURL=eda.easyFormViewer.js.map
|