@stratusjs/angular 0.9.3 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/environment', '@stratusjs/core/misc', '@stratusjs/angularjs/services/model', '@stratusjs/angularjs/services/registry', '@stratusjs/core/events/eventManager', 'html2pdf', 'font-awesome', 'froala-plugins', 'froala-embedly', 'froala-font-awesome', 'froala-image-tui', 'froala-editor', '@stratusjs/core/datastore/xhr', 'toastify-js', '@agentepsilon/decko', '@stratusjs/angular/core/root.component', '@stratusjs/angularjs/services/collection', 'zone.js/dist/zone'], (function (exports) {
2
2
  'use strict';
3
- var Stratus, _, uniqueId$3, snakeCase, head, isEmpty, isUndefined, isString, extend$1, debounce$2, isNumber, isBoolean, isArray$1, clone, isFunction$1, set, isNil, includes, isObject$2, assignIn, forEach, cookie, isJSON, safeUniqueId, Model, Registry, EventManager$1, FroalaEditor, XHR, Toastify, debounce$1, RootComponent$1, Collection;
3
+ var Stratus, _, uniqueId$3, snakeCase, head, isEmpty, isUndefined, isString, extend$1, get, forEach, isObject$2, isArray$1, has$2, sortBy, size, toNumber$1, isNumber, set, assignIn, clone, max, debounce$2, isBoolean, isFunction$1, isNil, includes, cookie, isJSON, safeUniqueId, serializeUrlParams, Model, Registry, EventManager$1, FroalaEditor, XHR, Toastify, debounce$1, RootComponent$1, Collection;
4
4
  return {
5
5
  setters: [function (module) {
6
6
  Stratus = module.Stratus;
@@ -13,23 +13,30 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
13
13
  isUndefined = module.isUndefined;
14
14
  isString = module.isString;
15
15
  extend$1 = module.extend;
16
- debounce$2 = module.debounce;
17
- isNumber = module.isNumber;
18
- isBoolean = module.isBoolean;
16
+ get = module.get;
17
+ forEach = module.forEach;
18
+ isObject$2 = module.isObject;
19
19
  isArray$1 = module.isArray;
20
+ has$2 = module.has;
21
+ sortBy = module.sortBy;
22
+ size = module.size;
23
+ toNumber$1 = module.toNumber;
24
+ isNumber = module.isNumber;
25
+ set = module.set;
26
+ assignIn = module.assignIn;
20
27
  clone = module.clone;
28
+ max = module.max;
29
+ debounce$2 = module.debounce;
30
+ isBoolean = module.isBoolean;
21
31
  isFunction$1 = module.isFunction;
22
- set = module.set;
23
32
  isNil = module.isNil;
24
33
  includes = module.includes;
25
- isObject$2 = module.isObject;
26
- assignIn = module.assignIn;
27
- forEach = module.forEach;
28
34
  }, function (module) {
29
35
  cookie = module.cookie;
30
36
  }, function (module) {
31
37
  isJSON = module.isJSON;
32
38
  safeUniqueId = module.safeUniqueId;
39
+ serializeUrlParams = module.serializeUrlParams;
33
40
  }, function (module) {
34
41
  Model = module.Model;
35
42
  }, function (module) {
@@ -84665,7 +84672,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
84665
84672
  const min$c = !cookie('env') ? '.min' : '';
84666
84673
  const localDir$d = `${Stratus.BaseUrl}${boot.configuration.paths[`${systemPackage}/*`].replace(/[^\/]*$/, '').replace(/\/dist\/$/, '/src/')}`;
84667
84674
  const froalaDir = `${Stratus.BaseUrl}${boot.configuration.paths[froalaPackage].replace(/js\/[^\/]*$/, '')}`;
84668
- const has$2 = (object, path) => _.has(object, path) && !_.isEmpty(_.get(object, path));
84675
+ const has$1 = (object, path) => _.has(object, path) && !_.isEmpty(_.get(object, path));
84669
84676
  let EditorComponent = exports('EditorComponent', class EditorComponent extends RootComponent {
84670
84677
  constructor(sanitizer, ref, elementRef, fb, dialog) {
84671
84678
  super();
@@ -84679,7 +84686,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
84679
84686
  this.debug = !!cookie(`debug_${moduleName$9}`);
84680
84687
  this.editor = 'froala';
84681
84688
  this._ = _;
84682
- this.has = has$2;
84689
+ this.has = has$1;
84683
84690
  this.log = console.log;
84684
84691
  this.Stratus = Stratus;
84685
84692
  this.registry = new Registry();
@@ -123078,7 +123085,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
123078
123085
  const moduleName$6 = 'media-selector';
123079
123086
  const min$9 = !cookie('env') ? '.min' : '';
123080
123087
  const localDir$a = `${Stratus.BaseUrl}${boot.configuration.paths[`${systemDir$6}/*`].replace(/[^/]*$/, '').replace(/\/dist\/$/, '/src/')}`;
123081
- const has$1 = (object, path) => _.has(object, path) && !_.isEmpty(_.get(object, path));
123088
+ const has = (object, path) => _.has(object, path) && !_.isEmpty(_.get(object, path));
123082
123089
  let MediaSelectorComponent = exports('MediaSelectorComponent', class MediaSelectorComponent extends RootComponent {
123083
123090
  constructor(iconRegistry, sanitizer, ref, elementRef, viewportRuler) {
123084
123091
  super();
@@ -123089,7 +123096,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
123089
123096
  this.viewportRuler = viewportRuler;
123090
123097
  this.title = moduleName$6 + '_component';
123091
123098
  this._ = _;
123092
- this.has = has$1;
123099
+ this.has = has;
123093
123100
  this.log = console.log;
123094
123101
  this.Stratus = Stratus;
123095
123102
  this.registry = new Registry();
@@ -123478,7 +123485,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
123478
123485
  const moduleName$5 = 'selector';
123479
123486
  const min$8 = !cookie('env') ? '.min' : '';
123480
123487
  const localDir$9 = `${Stratus.BaseUrl}${boot.configuration.paths[`${systemDir$5}/*`].replace(/[^/]*$/, '').replace(/\/dist\/$/, '/src/')}`;
123481
- const has = (object, path) => _.has(object, path) && !_.isEmpty(_.get(object, path));
123488
+ const hasNotEmpty = (object, path) => has$2(object, path) && !isEmpty(get(object, path));
123482
123489
  let SelectorComponent = exports('SelectorComponent', class SelectorComponent extends RootComponent {
123483
123490
  constructor(iconRegistry, sanitizer, ref, elementRef) {
123484
123491
  super();
@@ -123487,8 +123494,8 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
123487
123494
  this.ref = ref;
123488
123495
  this.elementRef = elementRef;
123489
123496
  this.title = moduleName$5 + '_component';
123490
- this._ = _;
123491
- this.has = has;
123497
+ this.get = get;
123498
+ this.has = hasNotEmpty;
123492
123499
  this.log = console.log;
123493
123500
  this.Stratus = Stratus;
123494
123501
  this.selectCtrl = new FormControl();
@@ -123497,10 +123504,10 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
123497
123504
  this.svgIcons = {};
123498
123505
  this.styled = false;
123499
123506
  this.empty = false;
123500
- this.uid = _.uniqueId(`sa_${_.snakeCase(moduleName$5)}_component_`);
123507
+ this.uid = uniqueId$3(`sa_${snakeCase(moduleName$5)}_component_`);
123501
123508
  Stratus.Instances[this.uid] = this;
123502
123509
  this.dataSub = new Observable(subscriber => this.dataDefer(subscriber));
123503
- _.forEach({
123510
+ forEach({
123504
123511
  selector_delete: `${Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/delete.svg`,
123505
123512
  selector_status: `${Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/visibility.svg`,
123506
123513
  selector_edit: `${Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/edit.svg`
@@ -123508,15 +123515,15 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
123508
123515
  Stratus.Internals.CssLoader(`${localDir$9}${moduleName$5}/${moduleName$5}.component${min$8}.css`)
123509
123516
  .then(() => {
123510
123517
  this.styled = true;
123511
- this.refresh();
123518
+ this.refresh().then();
123512
123519
  })
123513
123520
  .catch((err) => {
123514
123521
  console.warn('Issue detected in CSS Loader for Component:', this);
123515
123522
  console.error(err);
123516
123523
  this.styled = true;
123517
- this.refresh();
123524
+ this.refresh().then();
123518
123525
  });
123519
- this.hydrate(elementRef, sanitizer, ["title", "uid", "target", "targetSuffix", "id", "manifest", "decouple", "direct", "api", "urlRoot", "type", "property", "endpoint", "ignorePriority", "_", "has", "log", "Stratus", "selectCtrl", "registry", "fetched", "data", "collection", "model", "dataSub", "onChange", "subscriber", "svgIcons", "styled", "empty", "iconRegistry", "sanitizer", "ref", "elementRef", "drop", "goToUrl", "toggleStatus", "remove", "fetchData", "dataDefer", "dataRef", "onDataChange", "prioritize", "getSvg", "addSvgIcon", "hydrate", "disableRefresh", "stagger", "reloading", "refresh", "ngOnDestroy"]);
123526
+ this.hydrate(elementRef, sanitizer, ["title", "uid", "target", "targetSuffix", "id", "manifest", "decouple", "direct", "api", "urlRoot", "type", "property", "endpoint", "ignorePriority", "get", "has", "log", "Stratus", "selectCtrl", "registry", "fetched", "data", "collection", "model", "dataSub", "onChange", "subscriber", "svgIcons", "styled", "empty", "iconRegistry", "sanitizer", "ref", "elementRef", "drop", "goToUrl", "toggleStatus", "remove", "fetchData", "dataDefer", "dataRef", "getString", "onDataChange", "prioritize", "getSvg", "addSvgIcon", "hydrate", "disableRefresh", "stagger", "reloading", "refresh", "ngOnDestroy"]);
123520
123527
  this.fetchData()
123521
123528
  .then(data => {
123522
123529
  if (!data || !(data instanceof EventManager$1)) {
@@ -123529,7 +123536,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
123529
123536
  }
123530
123537
  this.dataDefer(this.subscriber);
123531
123538
  this.prioritize();
123532
- this.refresh();
123539
+ this.refresh().then();
123533
123540
  };
123534
123541
  data.on('change', onDataChange);
123535
123542
  onDataChange();
@@ -123543,7 +123550,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
123543
123550
  moveItemInArray(models, event.previousIndex, event.currentIndex);
123544
123551
  if (!this.ignorePriority) {
123545
123552
  let priority = 0;
123546
- _.forEach(models, (model) => model.priority = priority++);
123553
+ forEach(models, (model) => model.priority = priority++);
123547
123554
  }
123548
123555
  this.model.trigger('change');
123549
123556
  }
@@ -123555,6 +123562,10 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
123555
123562
  window.open(model.contentType.editUrl + '?id=' + model.id, '_blank');
123556
123563
  }
123557
123564
  toggleStatus(model) {
123565
+ let meta = {};
123566
+ if (!isUndefined(this.data)) {
123567
+ meta = get(this.data, 'meta.data.api');
123568
+ }
123558
123569
  const statusOriginal = model.status;
123559
123570
  model.status = statusOriginal === 1 ? 0 : 1;
123560
123571
  const xhr = new XHR({
@@ -123562,7 +123573,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
123562
123573
  url: '/Api/Content/' + model.id,
123563
123574
  data: {
123564
123575
  route: {},
123565
- meta: {},
123576
+ meta,
123566
123577
  payload: {
123567
123578
  status: model.status
123568
123579
  }
@@ -123571,18 +123582,17 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
123571
123582
  });
123572
123583
  xhr.send()
123573
123584
  .then((response) => {
123574
- if (!_.isObject(response) || _.get(response, 'meta.status[0].code') !== 'SUCCESS') {
123585
+ if (!isObject$2(response) || get(response, 'meta.status[0].code') !== 'SUCCESS') {
123575
123586
  console.error('error[toggleStatus]:', response);
123576
123587
  model.status = statusOriginal;
123577
- this.refresh();
123588
+ this.refresh().then();
123578
123589
  return;
123579
123590
  }
123580
- console.log('success[toggleStatus]:', response);
123581
123591
  })
123582
123592
  .catch((error) => {
123583
123593
  console.error('error[toggleStatus]:', error);
123584
123594
  model.status = statusOriginal;
123585
- this.refresh();
123595
+ this.refresh().then();
123586
123596
  });
123587
123597
  return;
123588
123598
  }
@@ -123590,7 +123600,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
123590
123600
  const models = this.dataRef();
123591
123601
  if (!models || !models.length) {
123592
123602
  console.error('unable to remove model from selection:', models);
123593
- this.refresh();
123603
+ this.refresh().then();
123594
123604
  return;
123595
123605
  }
123596
123606
  let index = models.indexOf(model);
@@ -123598,8 +123608,8 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
123598
123608
  const mirrorModels = models
123599
123609
  .map((m) => model.id === m.id ? m : null)
123600
123610
  .filter((m) => m);
123601
- if (_.isArray(mirrorModels) && mirrorModels.length) {
123602
- index = models.indexOf(_.first(mirrorModels));
123611
+ if (isArray$1(mirrorModels) && mirrorModels.length) {
123612
+ index = models.indexOf(head(mirrorModels));
123603
123613
  }
123604
123614
  }
123605
123615
  if (index === -1) {
@@ -123626,22 +123636,32 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
123626
123636
  const models = this.dataRef();
123627
123637
  this.empty = !models.length;
123628
123638
  this.subscriber.next(models);
123629
- this.refresh();
123639
+ this.refresh().then();
123630
123640
  }
123631
123641
  dataRef() {
123632
123642
  if (!this.model) {
123633
123643
  return [];
123634
123644
  }
123635
123645
  const models = this.model.get(this.property);
123636
- if (!models || !_.isArray(models)) {
123646
+ if (!models || !isArray$1(models)) {
123637
123647
  return [];
123638
123648
  }
123639
123649
  return models;
123640
123650
  }
123651
+ getString(object, property) {
123652
+ if (!isObject$2(object)) {
123653
+ return null;
123654
+ }
123655
+ const variable = get(object, property);
123656
+ if (!isString(variable)) {
123657
+ return null;
123658
+ }
123659
+ return variable;
123660
+ }
123641
123661
  onDataChange() {
123642
123662
  this.prioritize();
123643
123663
  this.dataDefer(this.subscriber);
123644
- this.refresh();
123664
+ this.refresh().then();
123645
123665
  }
123646
123666
  prioritize() {
123647
123667
  const models = this.dataRef();
@@ -123650,7 +123670,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
123650
123670
  }
123651
123671
  if (!this.ignorePriority) {
123652
123672
  let priority = 0;
123653
- _.forEach(models, (model) => model.priority = priority++);
123673
+ forEach(models, (model) => model.priority = priority++);
123654
123674
  }
123655
123675
  }
123656
123676
  getSvg(url, options) {
@@ -123675,7 +123695,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
123675
123695
  if (!options) {
123676
123696
  options = {};
123677
123697
  }
123678
- const uid = this.svgIcons[url] = _.uniqueId('selector_svg');
123698
+ const uid = this.svgIcons[url] = uniqueId$3('selector_svg');
123679
123699
  this.iconRegistry.addSvgIcon(uid, this.sanitizer.bypassSecurityTrustResourceUrl(url), options);
123680
123700
  return uid;
123681
123701
  }
@@ -123976,7 +123996,6 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
123976
123996
  this.isInitialized = false;
123977
123997
  this.isDestroyed = false;
123978
123998
  this.isStyled = false;
123979
- this._ = _;
123980
123999
  this.Stratus = Stratus;
123981
124000
  this.registry = new Registry();
123982
124001
  this.onChange = new Subject();
@@ -123996,21 +124015,21 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
123996
124015
  this.isDebug = false;
123997
124016
  }
123998
124017
  ngOnInit() {
123999
- this.uid = _.uniqueId(`sa_${_.snakeCase(moduleName$3)}_component_`);
124018
+ this.uid = uniqueId$3(`sa_${snakeCase(moduleName$3)}_component_`);
124000
124019
  Stratus.Instances[this.uid] = this;
124001
- this.hydrate(this.elementRef, this.sanitizer, ["title", "uid", "isInitialized", "isDestroyed", "isStyled", "target", "targetSuffix", "id", "manifest", "decouple", "direct", "api", "urlRoot", "type", "property", "_", "Stratus", "registry", "fetched", "data", "collection", "model", "dataSub", "onChange", "subscriber", "unsettled", "svgIcons", "isSingleClick", "dblClickWait", "dropLists", "dropListIdMap", "dropListMap", "expandedNodeSet", "dragging", "expandTimeout", "expandDelay", "dropData", "cdkDropListSortingDisabled", "tree", "treeMap", "metaMap", "dataSource", "treeControl", "isBorder", "isDebug", "iconRegistry", "sanitizer", "backend", "ref", "elementRef", "document", "ngOnInit", "ngOnDestroy", "refresh", "remove", "removeNode", "nodeIsEqual", "fetchData", "dataDefer", "dataRef", "trackDropLists", "setExpanded", "setExpandedClick", "setExpandedDblClick", "onDragDrop", "onDragMove", "showDragData", "clearDragData", "buildNodePatch", "getSvg", "addSvgIcon", "hydrate", "disableRefresh", "stagger", "reloading"]);
124020
+ this.hydrate(this.elementRef, this.sanitizer, ["title", "uid", "isInitialized", "isDestroyed", "isStyled", "target", "targetSuffix", "id", "manifest", "decouple", "direct", "api", "urlRoot", "type", "property", "Stratus", "registry", "fetched", "data", "collection", "model", "dataSub", "onChange", "subscriber", "unsettled", "svgIcons", "isSingleClick", "dblClickWait", "dropLists", "dropListIdMap", "dropListMap", "expandedNodeSet", "dragging", "expandTimeout", "expandDelay", "dropData", "cdkDropListSortingDisabled", "tree", "treeMap", "metaMap", "dataSource", "treeControl", "isBorder", "isDebug", "iconRegistry", "sanitizer", "backend", "ref", "elementRef", "document", "ngOnInit", "ngOnDestroy", "refresh", "remove", "removeNode", "nodeIsEqual", "fetchData", "dataDefer", "dataRef", "trackDropLists", "setExpanded", "setExpandedClick", "setExpandedDblClick", "onDragDrop", "onDragMove", "showDragData", "clearDragData", "buildNodePatch", "getSvg", "addSvgIcon", "hydrate", "disableRefresh", "stagger", "reloading"]);
124002
124021
  Stratus.Internals.CssLoader(`${localDir$7}/${moduleName$3}/${moduleName$3}.component${min$6}.css`)
124003
124022
  .then(() => {
124004
124023
  this.isStyled = true;
124005
- this.refresh();
124024
+ this.refresh().then();
124006
124025
  })
124007
124026
  .catch((err) => {
124008
124027
  console.warn('Issue detected in CSS Loader for Component:', this);
124009
124028
  console.error(err);
124010
124029
  this.isStyled = true;
124011
- this.refresh();
124030
+ this.refresh().then();
124012
124031
  });
124013
- _.forEach({
124032
+ forEach({
124014
124033
  tree_check: `${Stratus.BaseUrl}sitetheorycore/images/icons/check.svg`,
124015
124034
  tree_add: `${Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/add.svg`,
124016
124035
  tree_delete: `${Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/delete.svg`,
@@ -124028,7 +124047,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124028
124047
  return;
124029
124048
  }
124030
124049
  this.dataDefer(this.subscriber);
124031
- this.refresh();
124050
+ this.refresh().then();
124032
124051
  };
124033
124052
  data.on('change', onDataChange);
124034
124053
  onDataChange();
@@ -124069,7 +124088,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124069
124088
  this.isDebug = JSON.parse(isDebug);
124070
124089
  }
124071
124090
  this.isInitialized = true;
124072
- this.refresh();
124091
+ this.refresh().then();
124073
124092
  }
124074
124093
  ngOnDestroy() {
124075
124094
  this.isDestroyed = true;
@@ -124078,7 +124097,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124078
124097
  if (this.isDestroyed) {
124079
124098
  return new Promise(resolve => resolve());
124080
124099
  }
124081
- _.forEach(this.metaMap, (meta) => {
124100
+ forEach(this.metaMap, (meta) => {
124082
124101
  if (!meta.component || !('refresh' in meta.component)) {
124083
124102
  return;
124084
124103
  }
@@ -124133,24 +124152,24 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124133
124152
  return this.tree;
124134
124153
  }
124135
124154
  let models = this.collection.models;
124136
- if (!models || !_.isArray(models) || !models.length) {
124155
+ if (!models || !isArray$1(models) || !models.length) {
124137
124156
  return [];
124138
124157
  }
124139
- models = _.sortBy(models, ['data.priority']);
124158
+ models = sortBy(models, ['data.priority']);
124140
124159
  this.metaMap = this.metaMap || {};
124141
124160
  this.treeMap = {};
124142
124161
  this.tree = [];
124143
- _.forEach(models, (model) => {
124144
- const modelId = _.get(model, 'data.id');
124145
- const parentId = _.get(model, 'data.nestParent.id');
124162
+ forEach(models, (model) => {
124163
+ const modelId = get(model, 'data.id');
124164
+ const parentId = get(model, 'data.nestParent.id');
124146
124165
  this.dropListIdMap[`${this.uid}_node_${modelId}_drop_list`] = true;
124147
- if (!_.has(this.metaMap, modelId)) {
124166
+ if (!has$2(this.metaMap, modelId)) {
124148
124167
  this.metaMap[modelId] = {
124149
124168
  id: modelId,
124150
124169
  expanded: true
124151
124170
  };
124152
124171
  }
124153
- if (!_.has(this.treeMap, modelId)) {
124172
+ if (!has$2(this.treeMap, modelId)) {
124154
124173
  this.treeMap[modelId] = {
124155
124174
  id: modelId,
124156
124175
  model,
@@ -124161,7 +124180,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124161
124180
  this.treeMap[modelId].model = model;
124162
124181
  this.treeMap[modelId].meta = this.metaMap[modelId];
124163
124182
  if (parentId) {
124164
- if (!_.has(this.treeMap, parentId)) {
124183
+ if (!has$2(this.treeMap, parentId)) {
124165
124184
  this.treeMap[parentId] = {
124166
124185
  id: parentId,
124167
124186
  model: null,
@@ -124180,7 +124199,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124180
124199
  }
124181
124200
  trackDropLists() {
124182
124201
  this.dropLists = [];
124183
- _.forEach(this.dropListIdMap, (value, key) => {
124202
+ forEach(this.dropListIdMap, (value, key) => {
124184
124203
  if (!value) {
124185
124204
  return;
124186
124205
  }
@@ -124197,13 +124216,13 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124197
124216
  });
124198
124217
  }
124199
124218
  setExpanded(expanded) {
124200
- if (!this.metaMap || !_.size(this.metaMap)) {
124219
+ if (!this.metaMap || !size(this.metaMap)) {
124201
124220
  return;
124202
124221
  }
124203
- _.forEach(this.metaMap, (nodeMeta) => {
124222
+ forEach(this.metaMap, (nodeMeta) => {
124204
124223
  nodeMeta.expanded = expanded;
124205
124224
  });
124206
- this.refresh();
124225
+ this.refresh().then();
124207
124226
  }
124208
124227
  setExpandedClick(expanded) {
124209
124228
  this.isSingleClick = true;
@@ -124235,10 +124254,10 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124235
124254
  }
124236
124255
  this.unsettled = true;
124237
124256
  const targetDropNode = (this.dropData.targetId && this.dropData.targetId in this.treeMap) ?
124238
- this.treeMap[_.toNumber(this.dropData.targetId)] : null;
124257
+ this.treeMap[toNumber$1(this.dropData.targetId)] : null;
124239
124258
  if (cookie('env') && this.isDebug) {
124240
124259
  console.group('onDragDrop()');
124241
- _.forEach([
124260
+ forEach([
124242
124261
  `model drop: ${targetNode.model.get('name')}`,
124243
124262
  `list shift: ${event.container.element.nativeElement.id} -> ${event.previousContainer.element.nativeElement.id}`,
124244
124263
  `index change (event): ${event.previousIndex} -> ${event.currentIndex}`,
@@ -124310,10 +124329,10 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124310
124329
  break;
124311
124330
  }
124312
124331
  }
124313
- if (_.isNumber(targetDropIndex)) {
124332
+ if (isNumber(targetDropIndex)) {
124314
124333
  moveItemInArray(branch, event.previousIndex, targetDropIndex);
124315
124334
  let priority = 0;
124316
- _.forEach(branch, (node) => {
124335
+ forEach(branch, (node) => {
124317
124336
  if (!node.model || !node.model.set) {
124318
124337
  return;
124319
124338
  }
@@ -124385,7 +124404,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124385
124404
  return null;
124386
124405
  }
124387
124406
  const nodePatch = {};
124388
- _.forEach([
124407
+ forEach([
124389
124408
  'id',
124390
124409
  'name'
124391
124410
  ], (key) => {
@@ -124393,7 +124412,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124393
124412
  if (!value) {
124394
124413
  return;
124395
124414
  }
124396
- _.set(nodePatch, key, value);
124415
+ set(nodePatch, key, value);
124397
124416
  });
124398
124417
  return nodePatch;
124399
124418
  }
@@ -124419,7 +124438,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124419
124438
  if (!options) {
124420
124439
  options = {};
124421
124440
  }
124422
- const uid = this.svgIcons[url] = _.uniqueId('selector_svg');
124441
+ const uid = this.svgIcons[url] = uniqueId$3('selector_svg');
124423
124442
  this.iconRegistry.addSvgIcon(uid, this.sanitizer.bypassSecurityTrustResourceUrl(url), options);
124424
124443
  return uid;
124425
124444
  }
@@ -124512,17 +124531,22 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124512
124531
  this.isInitialized = false;
124513
124532
  this.isDestroyed = false;
124514
124533
  this.isStyled = false;
124515
- this._ = _;
124534
+ this.get = get;
124516
124535
  this.Stratus = Stratus;
124517
124536
  this.apiBase = '/Api/Content';
124518
124537
  this.isSingleContentLoading = false;
124519
124538
  this.limit = 20;
124520
124539
  this.isContentLoading = false;
124521
124540
  this.isContentLoaded = false;
124522
- this.basicContentQueryAttributes = 'options[isContent]=null&options[isCollection]=null&options[showRoutable]=true&options[showRouting]=true';
124541
+ this.basicContentQueryAttributesObject = {
124542
+ isContent: true,
124543
+ isCollection: null,
124544
+ showRoutable: true,
124545
+ showRouting: true
124546
+ };
124523
124547
  }
124524
124548
  ngOnInit() {
124525
- this.uid = _.uniqueId(`sa_${_.snakeCase(moduleName$2)}_component_`);
124549
+ this.uid = uniqueId$3(`sa_${snakeCase(moduleName$2)}_component_`);
124526
124550
  Stratus.Instances[this.uid] = this;
124527
124551
  Stratus.Internals.CssLoader(`${localDir$6}/${parentModuleName$1}/${moduleName$2}.component${min$5}.css`)
124528
124552
  .then(() => {
@@ -124545,7 +124569,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124545
124569
  .get('contentSelectorInput')
124546
124570
  .valueChanges
124547
124571
  .pipe(debounceTime(300), tap(() => this.isContentLoading = true), switchMap((value) => {
124548
- if (_.isString(value)) {
124572
+ if (isString(value)) {
124549
124573
  this.lastContentSelectorQuery = this.getQueryUrl(value);
124550
124574
  }
124551
124575
  else {
@@ -124569,11 +124593,11 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124569
124593
  .get(this.getQueryUrl(null, this.data.content.id))
124570
124594
  .pipe(finalize(() => this.isSingleContentLoading = false))
124571
124595
  .subscribe((response) => {
124572
- if (!response.ok || response.status !== 200 || _.isEmpty(response.body)) {
124596
+ if (!response.ok || response.status !== 200 || isEmpty(response.body)) {
124573
124597
  return null;
124574
124598
  }
124575
- const payload = _.get(response.body, 'payload') || response.body;
124576
- if (_.isEmpty(payload) || Array.isArray(payload) || !_.isObject(payload)) {
124599
+ const payload = get(response.body, 'payload') || response.body;
124600
+ if (isEmpty(payload) || Array.isArray(payload) || !isObject$2(payload)) {
124577
124601
  return null;
124578
124602
  }
124579
124603
  this.contentEntity = payload;
@@ -124581,7 +124605,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124581
124605
  this.dialogContentForm
124582
124606
  .get('contentSelectorInput')
124583
124607
  .patchValue(this.contentEntity);
124584
- this.refresh();
124608
+ this.refresh().then();
124585
124609
  return this.contentEntity;
124586
124610
  });
124587
124611
  }
@@ -124606,19 +124630,19 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124606
124630
  if (!content) {
124607
124631
  return;
124608
124632
  }
124609
- const routing = _.get(content, 'routing[0].url');
124610
- const routingText = !_.isUndefined(routing) ? ` (/${routing})` : ' (No route!)';
124611
- const contentId = _.get(content, 'id');
124612
- const contentIdText = !_.isUndefined(contentId) ? `Content: ${contentId}` : null;
124613
- return (_.get(content, 'version.title') || contentIdText) + routingText;
124633
+ const routing = get(content, 'routing[0].url');
124634
+ const routingText = !isUndefined(routing) ? ` (/${routing})` : ' (No route!)';
124635
+ const contentId = get(content, 'id');
124636
+ const contentIdText = !isUndefined(contentId) ? `Content: ${contentId}` : null;
124637
+ return (get(content, 'version.title') || contentIdText) + routingText;
124614
124638
  }
124615
124639
  handleContent(response) {
124616
- if (!response.ok || response.status !== 200 || _.isEmpty(response.body)) {
124640
+ if (!response.ok || response.status !== 200 || isEmpty(response.body)) {
124617
124641
  this.filteredContent = [];
124618
124642
  return this.filteredContent;
124619
124643
  }
124620
- const payload = _.get(response.body, 'payload') || response.body;
124621
- if (_.isEmpty(payload) || !Array.isArray(payload)) {
124644
+ const payload = get(response.body, 'payload') || response.body;
124645
+ if (isEmpty(payload) || !Array.isArray(payload)) {
124622
124646
  this.filteredContent = [];
124623
124647
  return this.filteredContent;
124624
124648
  }
@@ -124651,9 +124675,10 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124651
124675
  return this.tree.getSvg(url, options);
124652
124676
  }
124653
124677
  getQueryUrl(query, id) {
124654
- query = (!_.isString(query) || _.isEmpty(query)) ? '' : query;
124655
- id = !_.isString(id) && !_.isNumber(id) ? '' : `/${id}`;
124656
- return `${this.apiBase}${id}?limit=${this.limit}&${this.basicContentQueryAttributes}&q=${query}`;
124678
+ const fullApiOptions = { options: assignIn(this.basicContentQueryAttributesObject, this.data.api) };
124679
+ query = (!isString(query) || isEmpty(query)) ? '' : query;
124680
+ id = !isString(id) && !isNumber(id) ? '' : `/${id}`;
124681
+ return `${this.apiBase}${id}?limit=${this.limit}&${serializeUrlParams(fullApiOptions)}&q=${query}`;
124657
124682
  }
124658
124683
  selectedOnTop(list, selected) {
124659
124684
  if (!list || !list.length) {
@@ -124662,7 +124687,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124662
124687
  if (!selected || !selected.id) {
124663
124688
  return list;
124664
124689
  }
124665
- const orderedList = _.clone(list);
124690
+ const orderedList = clone(list);
124666
124691
  const index = list.findIndex((v) => v.id === selected.id);
124667
124692
  if (index === -1) {
124668
124693
  orderedList.unshift(selected);
@@ -124705,28 +124730,27 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124705
124730
  this.isInitialized = false;
124706
124731
  this.isDestroyed = false;
124707
124732
  this.isStyled = false;
124708
- this._ = _;
124709
124733
  this.Stratus = Stratus;
124710
124734
  this.hasChild = (node) => node.children && node.children.length > 0;
124711
124735
  this.isExpanded = (node) => node.meta ? node.meta.expanded : true;
124712
124736
  }
124713
124737
  ngOnInit() {
124714
- this.uid = _.uniqueId(`sa_${_.snakeCase(moduleName$1)}_component_`);
124738
+ this.uid = uniqueId$3(`sa_${snakeCase(moduleName$1)}_component_`);
124715
124739
  Stratus.Instances[this.uid] = this;
124716
124740
  Stratus.Internals.CssLoader(`${localDir$5}/${parentModuleName}/${moduleName$1}.component${min$4}.css`)
124717
124741
  .then(() => {
124718
124742
  this.isStyled = true;
124719
- this.refresh();
124743
+ this.refresh().then();
124720
124744
  })
124721
124745
  .catch((err) => {
124722
124746
  console.warn('Issue detected in CSS Loader for Component:', this);
124723
124747
  console.error(err);
124724
124748
  this.isStyled = true;
124725
- this.refresh();
124749
+ this.refresh().then();
124726
124750
  });
124727
124751
  this.node.meta.component = this;
124728
124752
  this.isInitialized = true;
124729
- this.refresh();
124753
+ this.refresh().then();
124730
124754
  this.onPostPersist();
124731
124755
  }
124732
124756
  ngOnDestroy() {
@@ -124770,7 +124794,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124770
124794
  if (!this.node || !this.node.model) {
124771
124795
  return;
124772
124796
  }
124773
- this.node.model.destroy();
124797
+ this.node.model.destroy().then();
124774
124798
  });
124775
124799
  return dialog;
124776
124800
  }
@@ -124789,7 +124813,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124789
124813
  return;
124790
124814
  }
124791
124815
  this.node.meta.expanded = !this.node.meta.expanded;
124792
- this.refresh();
124816
+ this.refresh().then();
124793
124817
  }
124794
124818
  toggleExpandedClick() {
124795
124819
  this.isSingleClick = true;
@@ -124805,7 +124829,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124805
124829
  this.toggleExpanded();
124806
124830
  }
124807
124831
  openDialog() {
124808
- if (!this.node.model || !_.has(this.node.model, 'data')) {
124832
+ if (!this.node.model || !has$2(this.node.model, 'data')) {
124809
124833
  return;
124810
124834
  }
124811
124835
  const dialogRef = this.dialog.open(TreeDialogComponent, {
@@ -124821,6 +124845,7 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124821
124845
  id: this.node.model.data.id || null,
124822
124846
  name: this.node.model.data.name || '',
124823
124847
  target: this.node.model.data.url ? 'url' : 'content',
124848
+ api: this.tree.api,
124824
124849
  content: this.node.model.data.content || null,
124825
124850
  url: this.node.model.data.url || null,
124826
124851
  browserTarget: this.node.model.data.browserTarget || null,
@@ -124830,10 +124855,10 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124830
124855
  nestParent: this.node.model.data.nestParent || null,
124831
124856
  }
124832
124857
  });
124833
- this.refresh();
124858
+ this.refresh().then();
124834
124859
  const that = this;
124835
124860
  dialogRef.afterClosed().subscribe((result) => {
124836
- if (!result || _.isEmpty(result)) {
124861
+ if (!result || isEmpty(result)) {
124837
124862
  return;
124838
124863
  }
124839
124864
  this.tree.unsettled = true;
@@ -124845,19 +124870,19 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124845
124870
  'browserTarget'
124846
124871
  ];
124847
124872
  attrs.forEach(attr => {
124848
- if (!_.has(result, attr)) {
124873
+ if (!has$2(result, attr)) {
124849
124874
  return;
124850
124875
  }
124851
124876
  if ('content' === attr) {
124852
- const value = _.get(result, attr);
124853
- this.node.model.set(attr, !value ? null : { id: _.get(value, 'id') });
124877
+ const value = get(result, attr);
124878
+ this.node.model.set(attr, !value ? null : { id: get(value, 'id') });
124854
124879
  return;
124855
124880
  }
124856
- this.node.model.set(attr, _.get(result, attr));
124881
+ this.node.model.set(attr, get(result, attr));
124857
124882
  });
124858
- that.refresh();
124859
- that.tree.refresh();
124860
- this.node.model.save();
124883
+ that.refresh().then();
124884
+ that.tree.refresh().then();
124885
+ this.node.model.save().then();
124861
124886
  this.tree.unsettled = false;
124862
124887
  });
124863
124888
  }
@@ -124883,10 +124908,10 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
124883
124908
  }
124884
124909
  const model = this.node.model;
124885
124910
  model.set('status', model.get('status') ? 0 : 1);
124886
- model.save();
124911
+ model.save().then();
124887
124912
  }
124888
124913
  addChild() {
124889
- let priority = _.max(this.tree.collection.models.filter((model) => {
124914
+ let priority = max(this.tree.collection.models.filter((model) => {
124890
124915
  const nestParent = model.get('nestParent');
124891
124916
  if (!nestParent) {
124892
124917
  return false;
@@ -161371,6 +161396,54 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
161371
161396
  };
161372
161397
  });
161373
161398
 
161399
+ System.register(["quill"], function (exports_1, context_1) {
161400
+ var quill_1, BaseImage, ATTRIBUTES, QuillImageFormatPlugin;
161401
+ context_1 && context_1.id;
161402
+ return {
161403
+ setters: [
161404
+ function (quill_1_1) {
161405
+ quill_1 = quill_1_1;
161406
+ }
161407
+ ],
161408
+ execute: function () {
161409
+ BaseImage = quill_1.default.import('formats/image');
161410
+ ATTRIBUTES = [
161411
+ 'alt',
161412
+ 'height',
161413
+ 'width',
161414
+ 'stratus-src',
161415
+ 'stratusSrc'
161416
+ ];
161417
+ QuillImageFormatPlugin = class QuillImageFormatPlugin extends BaseImage {
161418
+ constructor() {
161419
+ super(...arguments);
161420
+ this.blotName = 'imageCustom';
161421
+ this.tagName = 'IMG';
161422
+ }
161423
+ format(name, value) {
161424
+ console.log('format:', name, value, this.domNode.getAttribute('src'));
161425
+ if (ATTRIBUTES.indexOf(name) === -1) {
161426
+ super.format(name, value);
161427
+ return;
161428
+ }
161429
+ if (!value) {
161430
+ this.domNode.removeAttribute(name);
161431
+ return;
161432
+ }
161433
+ if (name === 'stratus-src') {
161434
+ console.log('stratus-src:', value);
161435
+ }
161436
+ if (name === 'stratusSrc') {
161437
+ console.log('stratusSrc:', value);
161438
+ }
161439
+ this.domNode.setAttribute(name, value);
161440
+ }
161441
+ };
161442
+ exports_1("QuillImageFormatPlugin", QuillImageFormatPlugin);
161443
+ }
161444
+ };
161445
+ });
161446
+
161374
161447
  System.register(["quill"], function (exports_1, context_1) {
161375
161448
  var quill_1, debug, Logger, QuillHtmlEditPlugin;
161376
161449
  context_1 && context_1.id;
@@ -161530,54 +161603,6 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
161530
161603
  };
161531
161604
  });
161532
161605
 
161533
- System.register(["quill"], function (exports_1, context_1) {
161534
- var quill_1, BaseImage, ATTRIBUTES, QuillImageFormatPlugin;
161535
- context_1 && context_1.id;
161536
- return {
161537
- setters: [
161538
- function (quill_1_1) {
161539
- quill_1 = quill_1_1;
161540
- }
161541
- ],
161542
- execute: function () {
161543
- BaseImage = quill_1.default.import('formats/image');
161544
- ATTRIBUTES = [
161545
- 'alt',
161546
- 'height',
161547
- 'width',
161548
- 'stratus-src',
161549
- 'stratusSrc'
161550
- ];
161551
- QuillImageFormatPlugin = class QuillImageFormatPlugin extends BaseImage {
161552
- constructor() {
161553
- super(...arguments);
161554
- this.blotName = 'imageCustom';
161555
- this.tagName = 'IMG';
161556
- }
161557
- format(name, value) {
161558
- console.log('format:', name, value, this.domNode.getAttribute('src'));
161559
- if (ATTRIBUTES.indexOf(name) === -1) {
161560
- super.format(name, value);
161561
- return;
161562
- }
161563
- if (!value) {
161564
- this.domNode.removeAttribute(name);
161565
- return;
161566
- }
161567
- if (name === 'stratus-src') {
161568
- console.log('stratus-src:', value);
161569
- }
161570
- if (name === 'stratusSrc') {
161571
- console.log('stratusSrc:', value);
161572
- }
161573
- this.domNode.setAttribute(name, value);
161574
- }
161575
- };
161576
- exports_1("QuillImageFormatPlugin", QuillImageFormatPlugin);
161577
- }
161578
- };
161579
- });
161580
-
161581
161606
  System.register(["@stratusjs/runtime/stratus", "lodash", "quill"], function (exports_1, context_1) {
161582
161607
  var stratus_1, lodash_1, quill_1, QuillInputButtonPlugin;
161583
161608
  context_1 && context_1.id;
@@ -161715,486 +161740,6 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
161715
161740
  };
161716
161741
  });
161717
161742
 
161718
- System.register(["@angular/forms", "@angular/core", "froala-editor"], function (exports_1, context_1) {
161719
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
161720
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
161721
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
161722
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
161723
- return c > 3 && r && Object.defineProperty(target, key, r), r;
161724
- };
161725
- var __metadata = (this && this.__metadata) || function (k, v) {
161726
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
161727
- };
161728
- var FroalaEditorDirective_1, forms_1, core_1, froala_editor_1, FroalaEditorDirective;
161729
- context_1 && context_1.id;
161730
- return {
161731
- setters: [
161732
- function (forms_1_1) {
161733
- forms_1 = forms_1_1;
161734
- },
161735
- function (core_1_1) {
161736
- core_1 = core_1_1;
161737
- },
161738
- function (froala_editor_1_1) {
161739
- froala_editor_1 = froala_editor_1_1;
161740
- }
161741
- ],
161742
- execute: function () {
161743
- FroalaEditorDirective = FroalaEditorDirective_1 = class FroalaEditorDirective {
161744
- constructor(el, zone) {
161745
- this.zone = zone;
161746
- this._opts = {
161747
- immediateAngularModelUpdate: false,
161748
- angularIgnoreAttrs: null
161749
- };
161750
- this.SPECIAL_TAGS = ['img', 'button', 'input', 'a'];
161751
- this.INNER_HTML_ATTR = 'innerHTML';
161752
- this._hasSpecialTag = false;
161753
- this._editorInitialized = false;
161754
- this._oldModel = null;
161755
- this.froalaModelChange = new core_1.EventEmitter();
161756
- this.froalaInit = new core_1.EventEmitter();
161757
- this.onChange = (_) => {
161758
- };
161759
- this.onTouched = () => {
161760
- };
161761
- const element = el.nativeElement;
161762
- if (this.SPECIAL_TAGS.indexOf(element.tagName.toLowerCase()) != -1) {
161763
- this._hasSpecialTag = true;
161764
- }
161765
- this._element = element;
161766
- this.zone = zone;
161767
- }
161768
- set froalaEditor(opts) {
161769
- this._opts = this.clone(opts || this._opts);
161770
- this._opts = Object.assign({}, this._opts);
161771
- }
161772
- set froalaModel(content) {
161773
- this.updateEditor(content);
161774
- }
161775
- writeValue(content) {
161776
- this.updateEditor(content);
161777
- }
161778
- registerOnChange(fn) {
161779
- this.onChange = fn;
161780
- }
161781
- registerOnTouched(fn) {
161782
- this.onTouched = fn;
161783
- }
161784
- clone(item) {
161785
- const me = this;
161786
- if (!item) {
161787
- return item;
161788
- }
161789
- const types = [Number, String, Boolean];
161790
- let result;
161791
- types.forEach((type) => {
161792
- if (item instanceof type) {
161793
- result = type(item);
161794
- }
161795
- });
161796
- if (typeof result === 'undefined') {
161797
- if (Object.prototype.toString.call(item) === '[object Array]') {
161798
- result = [];
161799
- item.forEach((child, index, array) => {
161800
- result[index] = me.clone(child);
161801
- });
161802
- }
161803
- else if (typeof item === 'object') {
161804
- if (item.nodeType && typeof item.cloneNode === 'function') {
161805
- result = item.cloneNode(true);
161806
- }
161807
- else if (!item.prototype) {
161808
- if (item instanceof Date) {
161809
- result = new Date(item);
161810
- }
161811
- else {
161812
- result = {};
161813
- for (const i in item) {
161814
- result[i] = me.clone(item[i]);
161815
- }
161816
- }
161817
- }
161818
- else {
161819
- {
161820
- result = item;
161821
- }
161822
- }
161823
- }
161824
- else {
161825
- result = item;
161826
- }
161827
- }
161828
- return result;
161829
- }
161830
- updateEditor(content) {
161831
- if (JSON.stringify(this._oldModel) === JSON.stringify(content)) {
161832
- return;
161833
- }
161834
- if (!this._hasSpecialTag) {
161835
- this._oldModel = content;
161836
- }
161837
- else {
161838
- this._model = content;
161839
- }
161840
- if (this._editorInitialized) {
161841
- if (!this._hasSpecialTag) {
161842
- this._editor.html.set(content);
161843
- }
161844
- else {
161845
- this.setContent();
161846
- }
161847
- }
161848
- else {
161849
- if (!this._hasSpecialTag) {
161850
- this._element.innerHTML = content || '';
161851
- }
161852
- else {
161853
- this.setContent();
161854
- }
161855
- }
161856
- }
161857
- updateModel() {
161858
- this.zone.run(() => {
161859
- let modelContent = null;
161860
- if (this._hasSpecialTag) {
161861
- const attributeNodes = this._element.attributes;
161862
- const attrs = {};
161863
- for (let i = 0; i < attributeNodes.length; i++) {
161864
- const attrName = attributeNodes[i].name;
161865
- if (this._opts.angularIgnoreAttrs && this._opts.angularIgnoreAttrs.indexOf(attrName) != -1) {
161866
- continue;
161867
- }
161868
- attrs[attrName] = attributeNodes[i].value;
161869
- }
161870
- if (this._element.innerHTML) {
161871
- attrs[this.INNER_HTML_ATTR] = this._element.innerHTML;
161872
- }
161873
- modelContent = attrs;
161874
- }
161875
- else {
161876
- const returnedHtml = this._editor.html.get();
161877
- if (typeof returnedHtml === 'string') {
161878
- modelContent = returnedHtml;
161879
- }
161880
- }
161881
- if (this._oldModel !== modelContent) {
161882
- this._oldModel = modelContent;
161883
- this.froalaModelChange.emit(modelContent);
161884
- this.onChange(modelContent);
161885
- }
161886
- });
161887
- }
161888
- registerEvent(eventName, callback) {
161889
- if (!eventName || !callback) {
161890
- return;
161891
- }
161892
- if (!this._opts.events) {
161893
- this._opts.events = {};
161894
- }
161895
- this._opts.events[eventName] = callback;
161896
- }
161897
- initListeners() {
161898
- const self = this;
161899
- if (this._editor.events) {
161900
- this._editor.events.on('contentChanged', function () {
161901
- self.updateModel();
161902
- });
161903
- this._editor.events.on('mousedown', function () {
161904
- setTimeout(function () {
161905
- self.onTouched();
161906
- }, 0);
161907
- });
161908
- if (this._opts.immediateAngularModelUpdate) {
161909
- this._editor.events.on('keyup', function () {
161910
- setTimeout(function () {
161911
- self.updateModel();
161912
- }, 0);
161913
- });
161914
- }
161915
- }
161916
- this._editorInitialized = true;
161917
- }
161918
- createEditor() {
161919
- if (this._editorInitialized) {
161920
- return;
161921
- }
161922
- this.setContent(true);
161923
- this.zone.runOutsideAngular(() => {
161924
- if (!this._opts.events) {
161925
- this._opts.events = {};
161926
- }
161927
- this.registerEvent('initialized', this._opts.events && this._opts.events.initialized);
161928
- const existingInitCallback = this._opts.events.initialized;
161929
- if (!this._opts.events.initialized || !this._opts.events.initialized.overridden) {
161930
- this._opts.events.initialized = () => {
161931
- this.initListeners();
161932
- existingInitCallback && existingInitCallback.call(this._editor, this);
161933
- };
161934
- this._opts.events.initialized.overridden = true;
161935
- }
161936
- this._editor = new froala_editor_1.default(this._element, this._opts);
161937
- });
161938
- }
161939
- setHtml() {
161940
- this._editor.html.set(this._model || '');
161941
- this._editor.undo.reset();
161942
- this._editor.undo.saveStep();
161943
- }
161944
- setContent(firstTime = false) {
161945
- const self = this;
161946
- if (this._model || this._model === '') {
161947
- this._oldModel = this._model;
161948
- if (this._hasSpecialTag) {
161949
- const tags = this._model;
161950
- if (tags) {
161951
- for (const attr in tags) {
161952
- if (tags.hasOwnProperty(attr) && attr != this.INNER_HTML_ATTR) {
161953
- this._element.setAttribute(attr, tags[attr]);
161954
- }
161955
- }
161956
- if (tags.hasOwnProperty(this.INNER_HTML_ATTR)) {
161957
- this._element.innerHTML = tags[this.INNER_HTML_ATTR];
161958
- }
161959
- }
161960
- }
161961
- else {
161962
- if (firstTime) {
161963
- this.registerEvent('initialized', function () {
161964
- self.setHtml();
161965
- });
161966
- }
161967
- else {
161968
- self.setHtml();
161969
- }
161970
- }
161971
- }
161972
- }
161973
- destroyEditor() {
161974
- if (this._editorInitialized) {
161975
- this._editor.destroy();
161976
- this._editorInitialized = false;
161977
- }
161978
- }
161979
- getEditor() {
161980
- if (this._element) {
161981
- return this._editor;
161982
- }
161983
- return null;
161984
- }
161985
- generateManualController() {
161986
- const controls = {
161987
- initialize: this.createEditor.bind(this),
161988
- destroy: this.destroyEditor.bind(this),
161989
- getEditor: this.getEditor.bind(this),
161990
- };
161991
- this.froalaInit.emit(controls);
161992
- }
161993
- ngAfterViewInit() {
161994
- if (!this.froalaInit.observers.length) {
161995
- this.createEditor();
161996
- }
161997
- else {
161998
- this.generateManualController();
161999
- }
162000
- }
162001
- ngOnDestroy() {
162002
- this.destroyEditor();
162003
- }
162004
- };
162005
- __decorate([
162006
- core_1.Input(),
162007
- __metadata("design:type", Object),
162008
- __metadata("design:paramtypes", [Object])
162009
- ], FroalaEditorDirective.prototype, "froalaEditor", null);
162010
- __decorate([
162011
- core_1.Input(),
162012
- __metadata("design:type", Object),
162013
- __metadata("design:paramtypes", [Object])
162014
- ], FroalaEditorDirective.prototype, "froalaModel", null);
162015
- __decorate([
162016
- core_1.Output(),
162017
- __metadata("design:type", core_1.EventEmitter)
162018
- ], FroalaEditorDirective.prototype, "froalaModelChange", void 0);
162019
- __decorate([
162020
- core_1.Output(),
162021
- __metadata("design:type", core_1.EventEmitter)
162022
- ], FroalaEditorDirective.prototype, "froalaInit", void 0);
162023
- FroalaEditorDirective = FroalaEditorDirective_1 = __decorate([
162024
- core_1.Directive({
162025
- selector: '[froalaEditor]',
162026
- exportAs: 'froalaEditor',
162027
- providers: [
162028
- {
162029
- provide: forms_1.NG_VALUE_ACCESSOR, useExisting: core_1.forwardRef(() => FroalaEditorDirective_1),
162030
- multi: true
162031
- }
162032
- ]
162033
- }),
162034
- __metadata("design:paramtypes", [core_1.ElementRef, core_1.NgZone])
162035
- ], FroalaEditorDirective);
162036
- exports_1("FroalaEditorDirective", FroalaEditorDirective);
162037
- }
162038
- };
162039
- });
162040
-
162041
- System.register(["@stratusjs/angular/froala/editor/froala-editor.directive", "@stratusjs/angular/froala/editor/froala-editor.module"], function (exports_1, context_1) {
162042
- context_1 && context_1.id;
162043
- return {
162044
- setters: [
162045
- function (froala_editor_directive_1_1) {
162046
- exports_1({
162047
- "FroalaEditorDirective": froala_editor_directive_1_1["FroalaEditorDirective"]
162048
- });
162049
- },
162050
- function (froala_editor_module_1_1) {
162051
- exports_1({
162052
- "FroalaEditorModule": froala_editor_module_1_1["FroalaEditorModule"]
162053
- });
162054
- }
162055
- ],
162056
- execute: function () {
162057
- }
162058
- };
162059
- });
162060
-
162061
- System.register(["@angular/core", "@stratusjs/angular/froala/editor/froala-editor.directive"], function (exports_1, context_1) {
162062
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
162063
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
162064
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
162065
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
162066
- return c > 3 && r && Object.defineProperty(target, key, r), r;
162067
- };
162068
- var FroalaEditorModule_1, core_1, froala_editor_directive_1, FroalaEditorModule;
162069
- context_1 && context_1.id;
162070
- return {
162071
- setters: [
162072
- function (core_1_1) {
162073
- core_1 = core_1_1;
162074
- },
162075
- function (froala_editor_directive_1_1) {
162076
- froala_editor_directive_1 = froala_editor_directive_1_1;
162077
- }
162078
- ],
162079
- execute: function () {
162080
- FroalaEditorModule = FroalaEditorModule_1 = class FroalaEditorModule {
162081
- static forRoot() {
162082
- return { ngModule: FroalaEditorModule_1, providers: [] };
162083
- }
162084
- };
162085
- FroalaEditorModule = FroalaEditorModule_1 = __decorate([
162086
- core_1.NgModule({
162087
- declarations: [froala_editor_directive_1.FroalaEditorDirective],
162088
- exports: [froala_editor_directive_1.FroalaEditorDirective]
162089
- })
162090
- ], FroalaEditorModule);
162091
- exports_1("FroalaEditorModule", FroalaEditorModule);
162092
- }
162093
- };
162094
- });
162095
-
162096
- System.register(["@angular/core"], function (exports_1, context_1) {
162097
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
162098
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
162099
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
162100
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
162101
- return c > 3 && r && Object.defineProperty(target, key, r), r;
162102
- };
162103
- var __metadata = (this && this.__metadata) || function (k, v) {
162104
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
162105
- };
162106
- var core_1, FroalaViewDirective;
162107
- context_1 && context_1.id;
162108
- return {
162109
- setters: [
162110
- function (core_1_1) {
162111
- core_1 = core_1_1;
162112
- }
162113
- ],
162114
- execute: function () {
162115
- FroalaViewDirective = class FroalaViewDirective {
162116
- constructor(renderer, element) {
162117
- this.renderer = renderer;
162118
- this._element = element.nativeElement;
162119
- }
162120
- set froalaView(content) {
162121
- this._element.innerHTML = content;
162122
- }
162123
- ngAfterViewInit() {
162124
- this.renderer.addClass(this._element, 'fr-view');
162125
- }
162126
- };
162127
- __decorate([
162128
- core_1.Input(),
162129
- __metadata("design:type", String),
162130
- __metadata("design:paramtypes", [String])
162131
- ], FroalaViewDirective.prototype, "froalaView", null);
162132
- FroalaViewDirective = __decorate([
162133
- core_1.Directive({
162134
- selector: '[froalaView]'
162135
- }),
162136
- __metadata("design:paramtypes", [core_1.Renderer2, core_1.ElementRef])
162137
- ], FroalaViewDirective);
162138
- exports_1("FroalaViewDirective", FroalaViewDirective);
162139
- }
162140
- };
162141
- });
162142
-
162143
- System.register(["@angular/core", "@stratusjs/angular/froala/view/froala-view.directive"], function (exports_1, context_1) {
162144
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
162145
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
162146
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
162147
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
162148
- return c > 3 && r && Object.defineProperty(target, key, r), r;
162149
- };
162150
- var FroalaViewModule_1, core_1, froala_view_directive_1, FroalaViewModule;
162151
- context_1 && context_1.id;
162152
- return {
162153
- setters: [
162154
- function (core_1_1) {
162155
- core_1 = core_1_1;
162156
- },
162157
- function (froala_view_directive_1_1) {
162158
- froala_view_directive_1 = froala_view_directive_1_1;
162159
- }
162160
- ],
162161
- execute: function () {
162162
- FroalaViewModule = FroalaViewModule_1 = class FroalaViewModule {
162163
- static forRoot() {
162164
- return { ngModule: FroalaViewModule_1, providers: [] };
162165
- }
162166
- };
162167
- FroalaViewModule = FroalaViewModule_1 = __decorate([
162168
- core_1.NgModule({
162169
- declarations: [froala_view_directive_1.FroalaViewDirective],
162170
- exports: [froala_view_directive_1.FroalaViewDirective]
162171
- })
162172
- ], FroalaViewModule);
162173
- exports_1("FroalaViewModule", FroalaViewModule);
162174
- }
162175
- };
162176
- });
162177
-
162178
- System.register(["@stratusjs/angular/froala/view/froala-view.directive", "@stratusjs/angular/froala/view/froala-view.module"], function (exports_1, context_1) {
162179
- context_1 && context_1.id;
162180
- return {
162181
- setters: [
162182
- function (froala_view_directive_1_1) {
162183
- exports_1({
162184
- "FroalaViewDirective": froala_view_directive_1_1["FroalaViewDirective"]
162185
- });
162186
- },
162187
- function (froala_view_module_1_1) {
162188
- exports_1({
162189
- "FroalaViewModule": froala_view_module_1_1["FroalaViewModule"]
162190
- });
162191
- }
162192
- ],
162193
- execute: function () {
162194
- }
162195
- };
162196
- });
162197
-
162198
161743
  /*!
162199
161744
  * froala_editor v3.2.3 (https://www.froala.com/wysiwyg-editor)
162200
161745
  * License https://froala.com/wysiwyg-editor/terms/
@@ -162621,6 +162166,486 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
162621
162166
  undo: true
162622
162167
  });
162623
162168
 
162169
+ System.register(["@angular/core"], function (exports_1, context_1) {
162170
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
162171
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
162172
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
162173
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
162174
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
162175
+ };
162176
+ var __metadata = (this && this.__metadata) || function (k, v) {
162177
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
162178
+ };
162179
+ var core_1, FroalaViewDirective;
162180
+ context_1 && context_1.id;
162181
+ return {
162182
+ setters: [
162183
+ function (core_1_1) {
162184
+ core_1 = core_1_1;
162185
+ }
162186
+ ],
162187
+ execute: function () {
162188
+ FroalaViewDirective = class FroalaViewDirective {
162189
+ constructor(renderer, element) {
162190
+ this.renderer = renderer;
162191
+ this._element = element.nativeElement;
162192
+ }
162193
+ set froalaView(content) {
162194
+ this._element.innerHTML = content;
162195
+ }
162196
+ ngAfterViewInit() {
162197
+ this.renderer.addClass(this._element, 'fr-view');
162198
+ }
162199
+ };
162200
+ __decorate([
162201
+ core_1.Input(),
162202
+ __metadata("design:type", String),
162203
+ __metadata("design:paramtypes", [String])
162204
+ ], FroalaViewDirective.prototype, "froalaView", null);
162205
+ FroalaViewDirective = __decorate([
162206
+ core_1.Directive({
162207
+ selector: '[froalaView]'
162208
+ }),
162209
+ __metadata("design:paramtypes", [core_1.Renderer2, core_1.ElementRef])
162210
+ ], FroalaViewDirective);
162211
+ exports_1("FroalaViewDirective", FroalaViewDirective);
162212
+ }
162213
+ };
162214
+ });
162215
+
162216
+ System.register(["@angular/core", "@stratusjs/angular/froala/view/froala-view.directive"], function (exports_1, context_1) {
162217
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
162218
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
162219
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
162220
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
162221
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
162222
+ };
162223
+ var FroalaViewModule_1, core_1, froala_view_directive_1, FroalaViewModule;
162224
+ context_1 && context_1.id;
162225
+ return {
162226
+ setters: [
162227
+ function (core_1_1) {
162228
+ core_1 = core_1_1;
162229
+ },
162230
+ function (froala_view_directive_1_1) {
162231
+ froala_view_directive_1 = froala_view_directive_1_1;
162232
+ }
162233
+ ],
162234
+ execute: function () {
162235
+ FroalaViewModule = FroalaViewModule_1 = class FroalaViewModule {
162236
+ static forRoot() {
162237
+ return { ngModule: FroalaViewModule_1, providers: [] };
162238
+ }
162239
+ };
162240
+ FroalaViewModule = FroalaViewModule_1 = __decorate([
162241
+ core_1.NgModule({
162242
+ declarations: [froala_view_directive_1.FroalaViewDirective],
162243
+ exports: [froala_view_directive_1.FroalaViewDirective]
162244
+ })
162245
+ ], FroalaViewModule);
162246
+ exports_1("FroalaViewModule", FroalaViewModule);
162247
+ }
162248
+ };
162249
+ });
162250
+
162251
+ System.register(["@stratusjs/angular/froala/view/froala-view.directive", "@stratusjs/angular/froala/view/froala-view.module"], function (exports_1, context_1) {
162252
+ context_1 && context_1.id;
162253
+ return {
162254
+ setters: [
162255
+ function (froala_view_directive_1_1) {
162256
+ exports_1({
162257
+ "FroalaViewDirective": froala_view_directive_1_1["FroalaViewDirective"]
162258
+ });
162259
+ },
162260
+ function (froala_view_module_1_1) {
162261
+ exports_1({
162262
+ "FroalaViewModule": froala_view_module_1_1["FroalaViewModule"]
162263
+ });
162264
+ }
162265
+ ],
162266
+ execute: function () {
162267
+ }
162268
+ };
162269
+ });
162270
+
162271
+ System.register(["@angular/forms", "@angular/core", "froala-editor"], function (exports_1, context_1) {
162272
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
162273
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
162274
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
162275
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
162276
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
162277
+ };
162278
+ var __metadata = (this && this.__metadata) || function (k, v) {
162279
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
162280
+ };
162281
+ var FroalaEditorDirective_1, forms_1, core_1, froala_editor_1, FroalaEditorDirective;
162282
+ context_1 && context_1.id;
162283
+ return {
162284
+ setters: [
162285
+ function (forms_1_1) {
162286
+ forms_1 = forms_1_1;
162287
+ },
162288
+ function (core_1_1) {
162289
+ core_1 = core_1_1;
162290
+ },
162291
+ function (froala_editor_1_1) {
162292
+ froala_editor_1 = froala_editor_1_1;
162293
+ }
162294
+ ],
162295
+ execute: function () {
162296
+ FroalaEditorDirective = FroalaEditorDirective_1 = class FroalaEditorDirective {
162297
+ constructor(el, zone) {
162298
+ this.zone = zone;
162299
+ this._opts = {
162300
+ immediateAngularModelUpdate: false,
162301
+ angularIgnoreAttrs: null
162302
+ };
162303
+ this.SPECIAL_TAGS = ['img', 'button', 'input', 'a'];
162304
+ this.INNER_HTML_ATTR = 'innerHTML';
162305
+ this._hasSpecialTag = false;
162306
+ this._editorInitialized = false;
162307
+ this._oldModel = null;
162308
+ this.froalaModelChange = new core_1.EventEmitter();
162309
+ this.froalaInit = new core_1.EventEmitter();
162310
+ this.onChange = (_) => {
162311
+ };
162312
+ this.onTouched = () => {
162313
+ };
162314
+ const element = el.nativeElement;
162315
+ if (this.SPECIAL_TAGS.indexOf(element.tagName.toLowerCase()) != -1) {
162316
+ this._hasSpecialTag = true;
162317
+ }
162318
+ this._element = element;
162319
+ this.zone = zone;
162320
+ }
162321
+ set froalaEditor(opts) {
162322
+ this._opts = this.clone(opts || this._opts);
162323
+ this._opts = Object.assign({}, this._opts);
162324
+ }
162325
+ set froalaModel(content) {
162326
+ this.updateEditor(content);
162327
+ }
162328
+ writeValue(content) {
162329
+ this.updateEditor(content);
162330
+ }
162331
+ registerOnChange(fn) {
162332
+ this.onChange = fn;
162333
+ }
162334
+ registerOnTouched(fn) {
162335
+ this.onTouched = fn;
162336
+ }
162337
+ clone(item) {
162338
+ const me = this;
162339
+ if (!item) {
162340
+ return item;
162341
+ }
162342
+ const types = [Number, String, Boolean];
162343
+ let result;
162344
+ types.forEach((type) => {
162345
+ if (item instanceof type) {
162346
+ result = type(item);
162347
+ }
162348
+ });
162349
+ if (typeof result === 'undefined') {
162350
+ if (Object.prototype.toString.call(item) === '[object Array]') {
162351
+ result = [];
162352
+ item.forEach((child, index, array) => {
162353
+ result[index] = me.clone(child);
162354
+ });
162355
+ }
162356
+ else if (typeof item === 'object') {
162357
+ if (item.nodeType && typeof item.cloneNode === 'function') {
162358
+ result = item.cloneNode(true);
162359
+ }
162360
+ else if (!item.prototype) {
162361
+ if (item instanceof Date) {
162362
+ result = new Date(item);
162363
+ }
162364
+ else {
162365
+ result = {};
162366
+ for (const i in item) {
162367
+ result[i] = me.clone(item[i]);
162368
+ }
162369
+ }
162370
+ }
162371
+ else {
162372
+ {
162373
+ result = item;
162374
+ }
162375
+ }
162376
+ }
162377
+ else {
162378
+ result = item;
162379
+ }
162380
+ }
162381
+ return result;
162382
+ }
162383
+ updateEditor(content) {
162384
+ if (JSON.stringify(this._oldModel) === JSON.stringify(content)) {
162385
+ return;
162386
+ }
162387
+ if (!this._hasSpecialTag) {
162388
+ this._oldModel = content;
162389
+ }
162390
+ else {
162391
+ this._model = content;
162392
+ }
162393
+ if (this._editorInitialized) {
162394
+ if (!this._hasSpecialTag) {
162395
+ this._editor.html.set(content);
162396
+ }
162397
+ else {
162398
+ this.setContent();
162399
+ }
162400
+ }
162401
+ else {
162402
+ if (!this._hasSpecialTag) {
162403
+ this._element.innerHTML = content || '';
162404
+ }
162405
+ else {
162406
+ this.setContent();
162407
+ }
162408
+ }
162409
+ }
162410
+ updateModel() {
162411
+ this.zone.run(() => {
162412
+ let modelContent = null;
162413
+ if (this._hasSpecialTag) {
162414
+ const attributeNodes = this._element.attributes;
162415
+ const attrs = {};
162416
+ for (let i = 0; i < attributeNodes.length; i++) {
162417
+ const attrName = attributeNodes[i].name;
162418
+ if (this._opts.angularIgnoreAttrs && this._opts.angularIgnoreAttrs.indexOf(attrName) != -1) {
162419
+ continue;
162420
+ }
162421
+ attrs[attrName] = attributeNodes[i].value;
162422
+ }
162423
+ if (this._element.innerHTML) {
162424
+ attrs[this.INNER_HTML_ATTR] = this._element.innerHTML;
162425
+ }
162426
+ modelContent = attrs;
162427
+ }
162428
+ else {
162429
+ const returnedHtml = this._editor.html.get();
162430
+ if (typeof returnedHtml === 'string') {
162431
+ modelContent = returnedHtml;
162432
+ }
162433
+ }
162434
+ if (this._oldModel !== modelContent) {
162435
+ this._oldModel = modelContent;
162436
+ this.froalaModelChange.emit(modelContent);
162437
+ this.onChange(modelContent);
162438
+ }
162439
+ });
162440
+ }
162441
+ registerEvent(eventName, callback) {
162442
+ if (!eventName || !callback) {
162443
+ return;
162444
+ }
162445
+ if (!this._opts.events) {
162446
+ this._opts.events = {};
162447
+ }
162448
+ this._opts.events[eventName] = callback;
162449
+ }
162450
+ initListeners() {
162451
+ const self = this;
162452
+ if (this._editor.events) {
162453
+ this._editor.events.on('contentChanged', function () {
162454
+ self.updateModel();
162455
+ });
162456
+ this._editor.events.on('mousedown', function () {
162457
+ setTimeout(function () {
162458
+ self.onTouched();
162459
+ }, 0);
162460
+ });
162461
+ if (this._opts.immediateAngularModelUpdate) {
162462
+ this._editor.events.on('keyup', function () {
162463
+ setTimeout(function () {
162464
+ self.updateModel();
162465
+ }, 0);
162466
+ });
162467
+ }
162468
+ }
162469
+ this._editorInitialized = true;
162470
+ }
162471
+ createEditor() {
162472
+ if (this._editorInitialized) {
162473
+ return;
162474
+ }
162475
+ this.setContent(true);
162476
+ this.zone.runOutsideAngular(() => {
162477
+ if (!this._opts.events) {
162478
+ this._opts.events = {};
162479
+ }
162480
+ this.registerEvent('initialized', this._opts.events && this._opts.events.initialized);
162481
+ const existingInitCallback = this._opts.events.initialized;
162482
+ if (!this._opts.events.initialized || !this._opts.events.initialized.overridden) {
162483
+ this._opts.events.initialized = () => {
162484
+ this.initListeners();
162485
+ existingInitCallback && existingInitCallback.call(this._editor, this);
162486
+ };
162487
+ this._opts.events.initialized.overridden = true;
162488
+ }
162489
+ this._editor = new froala_editor_1.default(this._element, this._opts);
162490
+ });
162491
+ }
162492
+ setHtml() {
162493
+ this._editor.html.set(this._model || '');
162494
+ this._editor.undo.reset();
162495
+ this._editor.undo.saveStep();
162496
+ }
162497
+ setContent(firstTime = false) {
162498
+ const self = this;
162499
+ if (this._model || this._model === '') {
162500
+ this._oldModel = this._model;
162501
+ if (this._hasSpecialTag) {
162502
+ const tags = this._model;
162503
+ if (tags) {
162504
+ for (const attr in tags) {
162505
+ if (tags.hasOwnProperty(attr) && attr != this.INNER_HTML_ATTR) {
162506
+ this._element.setAttribute(attr, tags[attr]);
162507
+ }
162508
+ }
162509
+ if (tags.hasOwnProperty(this.INNER_HTML_ATTR)) {
162510
+ this._element.innerHTML = tags[this.INNER_HTML_ATTR];
162511
+ }
162512
+ }
162513
+ }
162514
+ else {
162515
+ if (firstTime) {
162516
+ this.registerEvent('initialized', function () {
162517
+ self.setHtml();
162518
+ });
162519
+ }
162520
+ else {
162521
+ self.setHtml();
162522
+ }
162523
+ }
162524
+ }
162525
+ }
162526
+ destroyEditor() {
162527
+ if (this._editorInitialized) {
162528
+ this._editor.destroy();
162529
+ this._editorInitialized = false;
162530
+ }
162531
+ }
162532
+ getEditor() {
162533
+ if (this._element) {
162534
+ return this._editor;
162535
+ }
162536
+ return null;
162537
+ }
162538
+ generateManualController() {
162539
+ const controls = {
162540
+ initialize: this.createEditor.bind(this),
162541
+ destroy: this.destroyEditor.bind(this),
162542
+ getEditor: this.getEditor.bind(this),
162543
+ };
162544
+ this.froalaInit.emit(controls);
162545
+ }
162546
+ ngAfterViewInit() {
162547
+ if (!this.froalaInit.observers.length) {
162548
+ this.createEditor();
162549
+ }
162550
+ else {
162551
+ this.generateManualController();
162552
+ }
162553
+ }
162554
+ ngOnDestroy() {
162555
+ this.destroyEditor();
162556
+ }
162557
+ };
162558
+ __decorate([
162559
+ core_1.Input(),
162560
+ __metadata("design:type", Object),
162561
+ __metadata("design:paramtypes", [Object])
162562
+ ], FroalaEditorDirective.prototype, "froalaEditor", null);
162563
+ __decorate([
162564
+ core_1.Input(),
162565
+ __metadata("design:type", Object),
162566
+ __metadata("design:paramtypes", [Object])
162567
+ ], FroalaEditorDirective.prototype, "froalaModel", null);
162568
+ __decorate([
162569
+ core_1.Output(),
162570
+ __metadata("design:type", core_1.EventEmitter)
162571
+ ], FroalaEditorDirective.prototype, "froalaModelChange", void 0);
162572
+ __decorate([
162573
+ core_1.Output(),
162574
+ __metadata("design:type", core_1.EventEmitter)
162575
+ ], FroalaEditorDirective.prototype, "froalaInit", void 0);
162576
+ FroalaEditorDirective = FroalaEditorDirective_1 = __decorate([
162577
+ core_1.Directive({
162578
+ selector: '[froalaEditor]',
162579
+ exportAs: 'froalaEditor',
162580
+ providers: [
162581
+ {
162582
+ provide: forms_1.NG_VALUE_ACCESSOR, useExisting: core_1.forwardRef(() => FroalaEditorDirective_1),
162583
+ multi: true
162584
+ }
162585
+ ]
162586
+ }),
162587
+ __metadata("design:paramtypes", [core_1.ElementRef, core_1.NgZone])
162588
+ ], FroalaEditorDirective);
162589
+ exports_1("FroalaEditorDirective", FroalaEditorDirective);
162590
+ }
162591
+ };
162592
+ });
162593
+
162594
+ System.register(["@angular/core", "@stratusjs/angular/froala/editor/froala-editor.directive"], function (exports_1, context_1) {
162595
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
162596
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
162597
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
162598
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
162599
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
162600
+ };
162601
+ var FroalaEditorModule_1, core_1, froala_editor_directive_1, FroalaEditorModule;
162602
+ context_1 && context_1.id;
162603
+ return {
162604
+ setters: [
162605
+ function (core_1_1) {
162606
+ core_1 = core_1_1;
162607
+ },
162608
+ function (froala_editor_directive_1_1) {
162609
+ froala_editor_directive_1 = froala_editor_directive_1_1;
162610
+ }
162611
+ ],
162612
+ execute: function () {
162613
+ FroalaEditorModule = FroalaEditorModule_1 = class FroalaEditorModule {
162614
+ static forRoot() {
162615
+ return { ngModule: FroalaEditorModule_1, providers: [] };
162616
+ }
162617
+ };
162618
+ FroalaEditorModule = FroalaEditorModule_1 = __decorate([
162619
+ core_1.NgModule({
162620
+ declarations: [froala_editor_directive_1.FroalaEditorDirective],
162621
+ exports: [froala_editor_directive_1.FroalaEditorDirective]
162622
+ })
162623
+ ], FroalaEditorModule);
162624
+ exports_1("FroalaEditorModule", FroalaEditorModule);
162625
+ }
162626
+ };
162627
+ });
162628
+
162629
+ System.register(["@stratusjs/angular/froala/editor/froala-editor.directive", "@stratusjs/angular/froala/editor/froala-editor.module"], function (exports_1, context_1) {
162630
+ context_1 && context_1.id;
162631
+ return {
162632
+ setters: [
162633
+ function (froala_editor_directive_1_1) {
162634
+ exports_1({
162635
+ "FroalaEditorDirective": froala_editor_directive_1_1["FroalaEditorDirective"]
162636
+ });
162637
+ },
162638
+ function (froala_editor_module_1_1) {
162639
+ exports_1({
162640
+ "FroalaEditorModule": froala_editor_module_1_1["FroalaEditorModule"]
162641
+ });
162642
+ }
162643
+ ],
162644
+ execute: function () {
162645
+ }
162646
+ };
162647
+ });
162648
+
162624
162649
  })
162625
162650
  };
162626
162651
  }));