@stratusjs/angular 0.5.2 → 0.5.4

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.
Files changed (121) hide show
  1. package/dist/angular.bundle.js +73612 -72175
  2. package/dist/angular.bundle.min.js +1 -1
  3. package/package.json +1 -1
  4. package/src/angular.modules.js +33 -18
  5. package/src/angular.modules.js.map +1 -1
  6. package/src/app.module.js +254 -181
  7. package/src/app.module.js.map +1 -1
  8. package/src/backend.service.js +87 -66
  9. package/src/backend.service.js.map +1 -1
  10. package/src/base/base.component.js +124 -101
  11. package/src/base/base.component.js.map +1 -1
  12. package/src/boot.js +55 -42
  13. package/src/boot.js.map +1 -1
  14. package/src/confirm-dialog/confirm-dialog.component.js +60 -41
  15. package/src/confirm-dialog/confirm-dialog.component.js.map +1 -1
  16. package/src/core/base.interface.js +9 -1
  17. package/src/core/base.interface.js.map +1 -1
  18. package/src/core/refresh.interface.js +9 -1
  19. package/src/core/refresh.interface.js.map +1 -1
  20. package/src/core/responsive.component.js +58 -40
  21. package/src/core/responsive.component.js.map +1 -1
  22. package/src/core/responsive.interface.js +9 -1
  23. package/src/core/responsive.interface.js.map +1 -1
  24. package/src/core/root.component.js +43 -24
  25. package/src/core/root.component.js.map +1 -1
  26. package/src/core/trigger.interface.js +9 -1
  27. package/src/core/trigger.interface.js.map +1 -1
  28. package/src/data/contact-meta.interface.js +9 -1
  29. package/src/data/contact-meta.interface.js.map +1 -1
  30. package/src/data/content.interface.js +9 -1
  31. package/src/data/content.interface.js.map +1 -1
  32. package/src/data/convoy.interface.js +9 -1
  33. package/src/data/convoy.interface.js.map +1 -1
  34. package/src/editor/citation-dialog.component.js +207 -174
  35. package/src/editor/citation-dialog.component.js.map +1 -1
  36. package/src/editor/code-mirror-bridge.js +74 -60
  37. package/src/editor/code-mirror-bridge.js.map +1 -1
  38. package/src/editor/code-mirror-bridge.min.js +1 -1
  39. package/src/editor/code-view-dialog.component.js +116 -87
  40. package/src/editor/code-view-dialog.component.js.map +1 -1
  41. package/src/editor/editor.component.js +961 -903
  42. package/src/editor/editor.component.js.map +1 -1
  43. package/src/editor/link-dialog.component.js +395 -356
  44. package/src/editor/link-dialog.component.js.map +1 -1
  45. package/src/editor/media-dialog.component.js +303 -270
  46. package/src/editor/media-dialog.component.js.map +1 -1
  47. package/src/editor/quill-break-blot.plugin.js +38 -0
  48. package/src/editor/quill-break-blot.plugin.js.map +1 -0
  49. package/src/editor/quill-break-blot.plugin.min.js +1 -0
  50. package/src/editor/quill-html-edit.plugin.js +164 -0
  51. package/src/editor/quill-html-edit.plugin.js.map +1 -0
  52. package/src/editor/quill-html-edit.plugin.min.js +1 -0
  53. package/src/editor/quill-image-format.plugin.js +50 -0
  54. package/src/editor/quill-image-format.plugin.js.map +1 -0
  55. package/src/editor/quill-image-format.plugin.min.js +1 -0
  56. package/src/editor/quill-input-button.plugin.js +98 -0
  57. package/src/editor/quill-input-button.plugin.js.map +1 -0
  58. package/src/editor/quill-input-button.plugin.min.js +1 -0
  59. package/src/froala/editor/froala-editor.directive.js +328 -0
  60. package/src/froala/editor/froala-editor.directive.js.map +1 -0
  61. package/src/froala/editor/froala-editor.directive.min.js +1 -0
  62. package/src/froala/editor/froala-editor.module.js +37 -0
  63. package/src/froala/editor/froala-editor.module.js.map +1 -0
  64. package/src/froala/editor/froala-editor.module.min.js +1 -0
  65. package/src/froala/editor/index.js +22 -0
  66. package/src/froala/editor/index.js.map +1 -0
  67. package/src/froala/editor/index.min.js +1 -0
  68. package/src/froala/plugins/citationManager.js +191 -170
  69. package/src/froala/plugins/citationManager.js.map +1 -1
  70. package/src/froala/plugins/image_manager.js +364 -0
  71. package/src/froala/plugins/image_manager.js.map +1 -0
  72. package/src/froala/plugins/image_manager.min.js +1 -0
  73. package/src/froala/plugins/inputButton.js +138 -122
  74. package/src/froala/plugins/inputButton.js.map +1 -1
  75. package/src/froala/plugins/linkManager.js +104 -89
  76. package/src/froala/plugins/linkManager.js.map +1 -1
  77. package/src/froala/plugins/mediaManager.js +87 -72
  78. package/src/froala/plugins/mediaManager.js.map +1 -1
  79. package/src/froala/plugins/menuButton.js +86 -71
  80. package/src/froala/plugins/menuButton.js.map +1 -1
  81. package/src/froala/view/froala-view.directive.js +49 -0
  82. package/src/froala/view/froala-view.directive.js.map +1 -0
  83. package/src/froala/view/froala-view.directive.min.js +1 -0
  84. package/src/froala/view/froala-view.module.js +37 -0
  85. package/src/froala/view/froala-view.module.js.map +1 -0
  86. package/src/froala/view/froala-view.module.min.js +1 -0
  87. package/src/froala/view/index.js +22 -0
  88. package/src/froala/view/index.js.map +1 -0
  89. package/src/froala/view/index.min.js +1 -0
  90. package/src/main.js +33 -13
  91. package/src/main.js.map +1 -1
  92. package/src/material.js +194 -99
  93. package/src/material.js.map +1 -1
  94. package/src/media-selector/media-selector.component.js +441 -406
  95. package/src/media-selector/media-selector.component.js.map +1 -1
  96. package/src/polyfills.js +16 -3
  97. package/src/polyfills.js.map +1 -1
  98. package/src/quill-plugins/quill-break-blot.plugin.js +35 -19
  99. package/src/quill-plugins/quill-break-blot.plugin.js.map +1 -1
  100. package/src/quill-plugins/quill-html-edit.plugin.js +153 -140
  101. package/src/quill-plugins/quill-html-edit.plugin.js.map +1 -1
  102. package/src/quill-plugins/quill-image-format.plugin.js +47 -33
  103. package/src/quill-plugins/quill-image-format.plugin.js.map +1 -1
  104. package/src/quill-plugins/quill-input-button.plugin.js +95 -77
  105. package/src/quill-plugins/quill-input-button.plugin.js.map +1 -1
  106. package/src/root/root.component.js +43 -0
  107. package/src/root/root.component.js.map +1 -0
  108. package/src/root/root.component.min.js +1 -0
  109. package/src/selector/selector.component.js +284 -241
  110. package/src/selector/selector.component.js.map +1 -1
  111. package/src/selector/selector.component.min.js +1 -1
  112. package/src/selector/selector.component.ts +9 -4
  113. package/src/test/test.directive.js +66 -49
  114. package/src/test/test.directive.js.map +1 -1
  115. package/src/tree/tree-dialog.component.js +231 -202
  116. package/src/tree/tree-dialog.component.js.map +1 -1
  117. package/src/tree/tree-node.component.js +282 -253
  118. package/src/tree/tree-node.component.js.map +1 -1
  119. package/src/tree/tree.component.js +561 -531
  120. package/src/tree/tree.component.js.map +1 -1
  121. package/src/core/dialog.interface.js.map +0 -1
@@ -100,6 +100,7 @@ export class SelectorComponent extends RootComponent { // implements OnInit, OnC
100
100
  @Input() type: string
101
101
  @Input() property: string
102
102
  @Input() endpoint: string
103
+ @Input() ignorePriority: boolean
103
104
 
104
105
  // Dependencies
105
106
  _ = _
@@ -239,8 +240,10 @@ export class SelectorComponent extends RootComponent { // implements OnInit, OnC
239
240
  return
240
241
  }
241
242
  moveItemInArray(models, event.previousIndex, event.currentIndex)
242
- let priority = 0
243
- _.forEach(models, (model: any) => model.priority = priority++)
243
+ if (!this.ignorePriority) {
244
+ let priority = 0
245
+ _.forEach(models, (model: any) => model.priority = priority++)
246
+ }
244
247
  this.model.trigger('change')
245
248
  }
246
249
 
@@ -386,8 +389,10 @@ export class SelectorComponent extends RootComponent { // implements OnInit, OnC
386
389
  if (!models || !models.length) {
387
390
  return
388
391
  }
389
- let priority = 0
390
- _.forEach(models, (model) => model.priority = priority++)
392
+ if (!this.ignorePriority) {
393
+ let priority = 0
394
+ _.forEach(models, (model) => model.priority = priority++)
395
+ }
391
396
  }
392
397
 
393
398
  getSvg(url: string, options?: IconOptions): Observable<string> {
@@ -1,51 +1,68 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- 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;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- import { Directive, ElementRef, HostListener } from '@angular/core';
11
- import { Stratus } from '@stratusjs/runtime/stratus';
12
- import _ from 'lodash';
13
- const moduleName = 'test';
14
- let TestDirective = class TestDirective {
15
- constructor(el) {
16
- this.el = el;
17
- this.uid = _.uniqueId(`sa_${moduleName}_directive_`);
18
- Stratus.Instances[this.uid] = this;
19
- console.warn(this.uid, 'has been load to', this.el);
20
- }
21
- onMouseEnter() {
22
- this.highlight('yellow');
23
- }
24
- onMouseLeave() {
25
- this.highlight(null);
26
- }
27
- highlight(color) {
28
- this.el.nativeElement.style.backgroundColor = color;
29
- }
30
- };
31
- __decorate([
32
- HostListener('mouseenter'),
33
- __metadata("design:type", Function),
34
- __metadata("design:paramtypes", []),
35
- __metadata("design:returntype", void 0)
36
- ], TestDirective.prototype, "onMouseEnter", null);
37
- __decorate([
38
- HostListener('mouseleave'),
39
- __metadata("design:type", Function),
40
- __metadata("design:paramtypes", []),
41
- __metadata("design:returntype", void 0)
42
- ], TestDirective.prototype, "onMouseLeave", null);
43
- TestDirective = __decorate([
44
- Directive({
45
- selector: `[sa-${moduleName}]`
46
- }),
47
- __metadata("design:paramtypes", [ElementRef])
48
- ], TestDirective);
49
- export { TestDirective };
1
+ System.register(["@angular/core", "@stratusjs/runtime/stratus", "lodash"], function (exports_1, context_1) {
2
+ "use strict";
3
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
4
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6
+ 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;
7
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
8
+ };
9
+ var __metadata = (this && this.__metadata) || function (k, v) {
10
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11
+ };
12
+ var core_1, stratus_1, lodash_1, moduleName, TestDirective;
13
+ var __moduleName = context_1 && context_1.id;
14
+ return {
15
+ setters: [
16
+ function (core_1_1) {
17
+ core_1 = core_1_1;
18
+ },
19
+ function (stratus_1_1) {
20
+ stratus_1 = stratus_1_1;
21
+ },
22
+ function (lodash_1_1) {
23
+ lodash_1 = lodash_1_1;
24
+ }
25
+ ],
26
+ execute: function () {
27
+ moduleName = 'test';
28
+ TestDirective = class TestDirective {
29
+ constructor(el) {
30
+ this.el = el;
31
+ this.uid = lodash_1.default.uniqueId(`sa_${moduleName}_directive_`);
32
+ stratus_1.Stratus.Instances[this.uid] = this;
33
+ console.warn(this.uid, 'has been load to', this.el);
34
+ }
35
+ onMouseEnter() {
36
+ this.highlight('yellow');
37
+ }
38
+ onMouseLeave() {
39
+ this.highlight(null);
40
+ }
41
+ highlight(color) {
42
+ this.el.nativeElement.style.backgroundColor = color;
43
+ }
44
+ };
45
+ __decorate([
46
+ core_1.HostListener('mouseenter'),
47
+ __metadata("design:type", Function),
48
+ __metadata("design:paramtypes", []),
49
+ __metadata("design:returntype", void 0)
50
+ ], TestDirective.prototype, "onMouseEnter", null);
51
+ __decorate([
52
+ core_1.HostListener('mouseleave'),
53
+ __metadata("design:type", Function),
54
+ __metadata("design:paramtypes", []),
55
+ __metadata("design:returntype", void 0)
56
+ ], TestDirective.prototype, "onMouseLeave", null);
57
+ TestDirective = __decorate([
58
+ core_1.Directive({
59
+ selector: `[sa-${moduleName}]`
60
+ }),
61
+ __metadata("design:paramtypes", [core_1.ElementRef])
62
+ ], TestDirective);
63
+ exports_1("TestDirective", TestDirective);
64
+ }
65
+ };
66
+ });
50
67
 
51
68
  //# sourceMappingURL=test.directive.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["test.directive.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EACH,SAAS,EACT,UAAU,EACV,YAAY,EACf,MAAM,eAAe,CAAA;AAKtB,OAAO,EAAC,OAAO,EAAC,MAAM,4BAA4B,CAAA;AAClD,OAAO,CAAC,MAAM,QAAQ,CAAA;AAKtB,MAAM,UAAU,GAAG,MAAM,CAAA;AAMzB,IAAa,aAAa,GAA1B,MAAa,aAAa;IAKtB,YAAoB,EAAc;QAAd,OAAE,GAAF,EAAE,CAAY;QAK9B,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,UAAU,aAAa,CAAC,CAAA;QACpD,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;QAElC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,kBAAkB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAA;IAkBvD,CAAC;IAE2B,YAAY;QACpC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;IAC5B,CAAC;IAE2B,YAAY;QACpC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IACxB,CAAC;IAEO,SAAS,CAAC,KAAa;QAC3B,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,eAAe,GAAG,KAAK,CAAA;IACvD,CAAC;CACJ,CAAA;AAX+B;IAA3B,YAAY,CAAC,YAAY,CAAC;;;;iDAE1B;AAE2B;IAA3B,YAAY,CAAC,YAAY,CAAC;;;;iDAE1B;AAvCQ,aAAa;IAJzB,SAAS,CAAC;QACP,QAAQ,EAAE,OAAO,UAAU,GAAG;KACjC,CAAC;qCAO0B,UAAU;GALzB,aAAa,CA4CzB;SA5CY,aAAa","file":"test.directive.js"}
1
+ {"version":3,"sources":["test.directive.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;YAgBM,UAAU,GAAG,MAAM,CAAA;YAMZ,aAAa,GAA1B,MAAa,aAAa;gBAKtB,YAAoB,EAAc;oBAAd,OAAE,GAAF,EAAE,CAAY;oBAK9B,IAAI,CAAC,GAAG,GAAG,gBAAC,CAAC,QAAQ,CAAC,MAAM,UAAU,aAAa,CAAC,CAAA;oBACpD,iBAAO,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;oBAElC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,kBAAkB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAA;gBAkBvD,CAAC;gBAE2B,YAAY;oBACpC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;gBAC5B,CAAC;gBAE2B,YAAY;oBACpC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;gBACxB,CAAC;gBAEO,SAAS,CAAC,KAAa;oBAC3B,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,eAAe,GAAG,KAAK,CAAA;gBACvD,CAAC;aACJ,CAAA;YAX+B;gBAA3B,mBAAY,CAAC,YAAY,CAAC;;;;6DAE1B;YAE2B;gBAA3B,mBAAY,CAAC,YAAY,CAAC;;;;6DAE1B;YAvCQ,aAAa;gBAJzB,gBAAS,CAAC;oBACP,QAAQ,EAAE,OAAO,UAAU,GAAG;iBACjC,CAAC;iDAO0B,iBAAU;eALzB,aAAa,CA4CzB;;QACD,CAAC","file":"test.directive.js"}
@@ -1,208 +1,237 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- 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;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- var __param = (this && this.__param) || function (paramIndex, decorator) {
11
- return function (target, key) { decorator(target, key, paramIndex); }
12
- };
13
- import { ChangeDetectorRef, Component, Inject } from '@angular/core';
14
- import { FormBuilder } from '@angular/forms';
15
- import { moveItemInArray } from '@angular/cdk/drag-drop';
16
- import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
17
- import { debounceTime, finalize, switchMap, tap } from 'rxjs/operators';
18
- import _ from 'lodash';
19
- import { Stratus } from '@stratusjs/runtime/stratus';
20
- import { cookie } from '@stratusjs/core/environment';
21
- import { ResponsiveComponent } from '../core/responsive.component';
22
- const systemDir = '@stratusjs/angular';
23
- const moduleName = 'tree-dialog';
24
- const parentModuleName = 'tree';
25
- const min = !cookie('env') ? '.min' : '';
26
- const localDir = `${Stratus.BaseUrl}${boot.configuration.paths[`${systemDir}/*`].replace(/[^/]*$/, '').replace(/\/dist\/$/, '/src/')}`;
27
- let TreeDialogComponent = class TreeDialogComponent extends ResponsiveComponent {
28
- constructor(dialogRef, data, fb, ref) {
29
- super();
30
- this.dialogRef = dialogRef;
31
- this.data = data;
32
- this.fb = fb;
33
- this.ref = ref;
34
- this.title = moduleName + '_component';
35
- this.isInitialized = false;
36
- this.isDestroyed = false;
37
- this.isStyled = false;
38
- this._ = _;
39
- this.Stratus = Stratus;
40
- this.apiBase = '/Api/Content';
41
- this.isSingleContentLoading = false;
42
- this.limit = 20;
43
- this.isContentLoading = false;
44
- this.isContentLoaded = false;
45
- this.basicContentQueryAttributes = 'options[isContent]=null&options[isCollection]=null&options[showRoutable]=true&options[showRouting]=true';
46
- }
47
- ngOnInit() {
48
- this.uid = _.uniqueId(`sa_${_.snakeCase(moduleName)}_component_`);
49
- Stratus.Instances[this.uid] = this;
50
- Stratus.Internals.CssLoader(`${localDir}/${parentModuleName}/${moduleName}.component${min}.css`)
51
- .then(() => {
52
- this.isStyled = true;
53
- })
54
- .catch((err) => {
55
- console.warn('Issue detected in CSS Loader for Component:', this);
56
- console.error(err);
57
- this.isStyled = true;
58
- });
59
- this.tree = this.data.tree;
60
- this.treeNode = this.data.treeNode;
61
- this.backend = this.data.backend;
62
- this.iconRegistry = this.data.iconRegistry;
63
- this.dialogContentForm = this.fb.group({
64
- contentSelectorInput: this.data.content || null
65
- });
66
- this.dialogContentForm
67
- .get('contentSelectorInput')
68
- .valueChanges
69
- .pipe(debounceTime(300), tap(() => this.isContentLoading = true), switchMap((value) => {
70
- if (_.isString(value)) {
71
- this.lastContentSelectorQuery = this.getQueryUrl(value);
1
+ System.register(["@angular/core", "@angular/forms", "@angular/cdk/drag-drop", "@angular/material/dialog", "rxjs/operators", "lodash", "@stratusjs/runtime/stratus", "@stratusjs/core/environment", "../core/responsive.component"], function (exports_1, context_1) {
2
+ "use strict";
3
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
4
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6
+ 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;
7
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
8
+ };
9
+ var __metadata = (this && this.__metadata) || function (k, v) {
10
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11
+ };
12
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
13
+ return function (target, key) { decorator(target, key, paramIndex); }
14
+ };
15
+ var core_1, forms_1, drag_drop_1, dialog_1, operators_1, lodash_1, stratus_1, environment_1, responsive_component_1, systemDir, moduleName, parentModuleName, min, localDir, TreeDialogComponent;
16
+ var __moduleName = context_1 && context_1.id;
17
+ return {
18
+ setters: [
19
+ function (core_1_1) {
20
+ core_1 = core_1_1;
21
+ },
22
+ function (forms_1_1) {
23
+ forms_1 = forms_1_1;
24
+ },
25
+ function (drag_drop_1_1) {
26
+ drag_drop_1 = drag_drop_1_1;
27
+ },
28
+ function (dialog_1_1) {
29
+ dialog_1 = dialog_1_1;
30
+ },
31
+ function (operators_1_1) {
32
+ operators_1 = operators_1_1;
33
+ },
34
+ function (lodash_1_1) {
35
+ lodash_1 = lodash_1_1;
36
+ },
37
+ function (stratus_1_1) {
38
+ stratus_1 = stratus_1_1;
39
+ },
40
+ function (environment_1_1) {
41
+ environment_1 = environment_1_1;
42
+ },
43
+ function (responsive_component_1_1) {
44
+ responsive_component_1 = responsive_component_1_1;
72
45
  }
73
- else {
74
- this.data.content = value;
75
- this.data.url = null;
76
- }
77
- return this.backend.get(this.lastContentSelectorQuery || this.getQueryUrl())
78
- .pipe(finalize(() => {
79
- this.isContentLoading = false;
80
- this.isContentLoaded = true;
81
- }));
82
- }))
83
- .subscribe((response) => this.handleContent(response));
84
- this.backend
85
- .get(this.getQueryUrl())
86
- .pipe(finalize(() => this.isContentLoading = false))
87
- .subscribe((response) => this.handleContent(response));
88
- if (this.data.content && this.data.content.id) {
89
- this.isSingleContentLoading = true;
90
- this.backend
91
- .get(this.getQueryUrl(null, this.data.content.id))
92
- .pipe(finalize(() => this.isSingleContentLoading = false))
93
- .subscribe((response) => {
94
- if (!response.ok || response.status !== 200 || _.isEmpty(response.body)) {
95
- return null;
46
+ ],
47
+ execute: function () {
48
+ systemDir = '@stratusjs/angular';
49
+ moduleName = 'tree-dialog';
50
+ parentModuleName = 'tree';
51
+ min = !environment_1.cookie('env') ? '.min' : '';
52
+ localDir = `${stratus_1.Stratus.BaseUrl}${boot.configuration.paths[`${systemDir}/*`].replace(/[^/]*$/, '').replace(/\/dist\/$/, '/src/')}`;
53
+ TreeDialogComponent = class TreeDialogComponent extends responsive_component_1.ResponsiveComponent {
54
+ constructor(dialogRef, data, fb, ref) {
55
+ super();
56
+ this.dialogRef = dialogRef;
57
+ this.data = data;
58
+ this.fb = fb;
59
+ this.ref = ref;
60
+ this.title = moduleName + '_component';
61
+ this.isInitialized = false;
62
+ this.isDestroyed = false;
63
+ this.isStyled = false;
64
+ this._ = lodash_1.default;
65
+ this.Stratus = stratus_1.Stratus;
66
+ this.apiBase = '/Api/Content';
67
+ this.isSingleContentLoading = false;
68
+ this.limit = 20;
69
+ this.isContentLoading = false;
70
+ this.isContentLoaded = false;
71
+ this.basicContentQueryAttributes = 'options[isContent]=null&options[isCollection]=null&options[showRoutable]=true&options[showRouting]=true';
96
72
  }
97
- const payload = _.get(response.body, 'payload') || response.body;
98
- if (_.isEmpty(payload) || Array.isArray(payload) || !_.isObject(payload)) {
99
- return null;
73
+ ngOnInit() {
74
+ this.uid = lodash_1.default.uniqueId(`sa_${lodash_1.default.snakeCase(moduleName)}_component_`);
75
+ stratus_1.Stratus.Instances[this.uid] = this;
76
+ stratus_1.Stratus.Internals.CssLoader(`${localDir}/${parentModuleName}/${moduleName}.component${min}.css`)
77
+ .then(() => {
78
+ this.isStyled = true;
79
+ })
80
+ .catch((err) => {
81
+ console.warn('Issue detected in CSS Loader for Component:', this);
82
+ console.error(err);
83
+ this.isStyled = true;
84
+ });
85
+ this.tree = this.data.tree;
86
+ this.treeNode = this.data.treeNode;
87
+ this.backend = this.data.backend;
88
+ this.iconRegistry = this.data.iconRegistry;
89
+ this.dialogContentForm = this.fb.group({
90
+ contentSelectorInput: this.data.content || null
91
+ });
92
+ this.dialogContentForm
93
+ .get('contentSelectorInput')
94
+ .valueChanges
95
+ .pipe(operators_1.debounceTime(300), operators_1.tap(() => this.isContentLoading = true), operators_1.switchMap((value) => {
96
+ if (lodash_1.default.isString(value)) {
97
+ this.lastContentSelectorQuery = this.getQueryUrl(value);
98
+ }
99
+ else {
100
+ this.data.content = value;
101
+ this.data.url = null;
102
+ }
103
+ return this.backend.get(this.lastContentSelectorQuery || this.getQueryUrl())
104
+ .pipe(operators_1.finalize(() => {
105
+ this.isContentLoading = false;
106
+ this.isContentLoaded = true;
107
+ }));
108
+ }))
109
+ .subscribe((response) => this.handleContent(response));
110
+ this.backend
111
+ .get(this.getQueryUrl())
112
+ .pipe(operators_1.finalize(() => this.isContentLoading = false))
113
+ .subscribe((response) => this.handleContent(response));
114
+ if (this.data.content && this.data.content.id) {
115
+ this.isSingleContentLoading = true;
116
+ this.backend
117
+ .get(this.getQueryUrl(null, this.data.content.id))
118
+ .pipe(operators_1.finalize(() => this.isSingleContentLoading = false))
119
+ .subscribe((response) => {
120
+ if (!response.ok || response.status !== 200 || lodash_1.default.isEmpty(response.body)) {
121
+ return null;
122
+ }
123
+ const payload = lodash_1.default.get(response.body, 'payload') || response.body;
124
+ if (lodash_1.default.isEmpty(payload) || Array.isArray(payload) || !lodash_1.default.isObject(payload)) {
125
+ return null;
126
+ }
127
+ this.contentEntity = payload;
128
+ this.isSingleContentLoading = false;
129
+ this.dialogContentForm
130
+ .get('contentSelectorInput')
131
+ .patchValue(this.contentEntity);
132
+ this.refresh();
133
+ return this.contentEntity;
134
+ });
135
+ }
136
+ this.isInitialized = true;
100
137
  }
101
- this.contentEntity = payload;
102
- this.isSingleContentLoading = false;
103
- this.dialogContentForm
104
- .get('contentSelectorInput')
105
- .patchValue(this.contentEntity);
106
- this.refresh();
107
- return this.contentEntity;
108
- });
109
- }
110
- this.isInitialized = true;
111
- }
112
- ngOnDestroy() {
113
- this.isDestroyed = true;
114
- }
115
- refresh() {
116
- if (this.isDestroyed) {
117
- return new Promise(resolve => resolve());
118
- }
119
- return super.refresh();
120
- }
121
- onCancelClick() {
122
- this.dialogRef.close();
123
- }
124
- onBrowserTargetChange($event) {
125
- this.data.browserTarget = this.browserTarget ? '_blank' : null;
126
- }
127
- displayContentText(content) {
128
- if (!content) {
129
- return;
130
- }
131
- const routing = _.get(content, 'routing[0].url');
132
- const routingText = !_.isUndefined(routing) ? ` (/${routing})` : ' (No route!)';
133
- const contentId = _.get(content, 'id');
134
- const contentIdText = !_.isUndefined(contentId) ? `Content: ${contentId}` : null;
135
- return (_.get(content, 'version.title') || contentIdText) + routingText;
136
- }
137
- handleContent(response) {
138
- if (!response.ok || response.status !== 200 || _.isEmpty(response.body)) {
139
- this.filteredContent = [];
140
- return this.filteredContent;
141
- }
142
- const payload = _.get(response.body, 'payload') || response.body;
143
- if (_.isEmpty(payload) || !Array.isArray(payload)) {
144
- this.filteredContent = [];
145
- return this.filteredContent;
146
- }
147
- this.filteredContent = payload;
148
- return this.filteredContent;
149
- }
150
- destroy() {
151
- this.treeNode.destroy()
152
- .afterClosed()
153
- .subscribe((dialogResult) => {
154
- if (!dialogResult) {
155
- return;
156
- }
157
- this.onCancelClick();
158
- });
159
- }
160
- toggleStatus() {
161
- this.treeNode.toggleStatus();
162
- }
163
- addChild() {
164
- this.treeNode.addChild();
165
- }
166
- isSelected(content) {
167
- if (!this.data.content) {
168
- return false;
169
- }
170
- return this.data.content.id === content.id;
171
- }
172
- getSvg(url, options) {
173
- return this.tree.getSvg(url, options);
174
- }
175
- getQueryUrl(query, id) {
176
- query = (!_.isString(query) || _.isEmpty(query)) ? '' : `"${query}"`;
177
- id = !_.isString(id) && !_.isNumber(id) ? '' : `/${id}`;
178
- return `${this.apiBase}${id}?limit=${this.limit}&${this.basicContentQueryAttributes}&q=${query}`;
179
- }
180
- selectedOnTop(list, selected) {
181
- if (!list || !list.length) {
182
- return list;
183
- }
184
- if (!selected || !selected.id) {
185
- return list;
186
- }
187
- const orderedList = _.clone(list);
188
- const index = list.findIndex((v) => v.id === selected.id);
189
- if (index === -1) {
190
- orderedList.unshift(selected);
191
- return orderedList;
138
+ ngOnDestroy() {
139
+ this.isDestroyed = true;
140
+ }
141
+ refresh() {
142
+ if (this.isDestroyed) {
143
+ return new Promise(resolve => resolve());
144
+ }
145
+ return super.refresh();
146
+ }
147
+ onCancelClick() {
148
+ this.dialogRef.close();
149
+ }
150
+ onBrowserTargetChange($event) {
151
+ this.data.browserTarget = this.browserTarget ? '_blank' : null;
152
+ }
153
+ displayContentText(content) {
154
+ if (!content) {
155
+ return;
156
+ }
157
+ const routing = lodash_1.default.get(content, 'routing[0].url');
158
+ const routingText = !lodash_1.default.isUndefined(routing) ? ` (/${routing})` : ' (No route!)';
159
+ const contentId = lodash_1.default.get(content, 'id');
160
+ const contentIdText = !lodash_1.default.isUndefined(contentId) ? `Content: ${contentId}` : null;
161
+ return (lodash_1.default.get(content, 'version.title') || contentIdText) + routingText;
162
+ }
163
+ handleContent(response) {
164
+ if (!response.ok || response.status !== 200 || lodash_1.default.isEmpty(response.body)) {
165
+ this.filteredContent = [];
166
+ return this.filteredContent;
167
+ }
168
+ const payload = lodash_1.default.get(response.body, 'payload') || response.body;
169
+ if (lodash_1.default.isEmpty(payload) || !Array.isArray(payload)) {
170
+ this.filteredContent = [];
171
+ return this.filteredContent;
172
+ }
173
+ this.filteredContent = payload;
174
+ return this.filteredContent;
175
+ }
176
+ destroy() {
177
+ this.treeNode.destroy()
178
+ .afterClosed()
179
+ .subscribe((dialogResult) => {
180
+ if (!dialogResult) {
181
+ return;
182
+ }
183
+ this.onCancelClick();
184
+ });
185
+ }
186
+ toggleStatus() {
187
+ this.treeNode.toggleStatus();
188
+ }
189
+ addChild() {
190
+ this.treeNode.addChild();
191
+ }
192
+ isSelected(content) {
193
+ if (!this.data.content) {
194
+ return false;
195
+ }
196
+ return this.data.content.id === content.id;
197
+ }
198
+ getSvg(url, options) {
199
+ return this.tree.getSvg(url, options);
200
+ }
201
+ getQueryUrl(query, id) {
202
+ query = (!lodash_1.default.isString(query) || lodash_1.default.isEmpty(query)) ? '' : `"${query}"`;
203
+ id = !lodash_1.default.isString(id) && !lodash_1.default.isNumber(id) ? '' : `/${id}`;
204
+ return `${this.apiBase}${id}?limit=${this.limit}&${this.basicContentQueryAttributes}&q=${query}`;
205
+ }
206
+ selectedOnTop(list, selected) {
207
+ if (!list || !list.length) {
208
+ return list;
209
+ }
210
+ if (!selected || !selected.id) {
211
+ return list;
212
+ }
213
+ const orderedList = lodash_1.default.clone(list);
214
+ const index = list.findIndex((v) => v.id === selected.id);
215
+ if (index === -1) {
216
+ orderedList.unshift(selected);
217
+ return orderedList;
218
+ }
219
+ drag_drop_1.moveItemInArray(orderedList, index, 0);
220
+ return orderedList;
221
+ }
222
+ };
223
+ TreeDialogComponent = __decorate([
224
+ core_1.Component({
225
+ selector: `sa-${moduleName}`,
226
+ templateUrl: `${localDir}/${parentModuleName}/${moduleName}.component${min}.html`,
227
+ }),
228
+ __param(1, core_1.Inject(dialog_1.MAT_DIALOG_DATA)),
229
+ __metadata("design:paramtypes", [dialog_1.MatDialogRef, Object, forms_1.FormBuilder,
230
+ core_1.ChangeDetectorRef])
231
+ ], TreeDialogComponent);
232
+ exports_1("TreeDialogComponent", TreeDialogComponent);
192
233
  }
193
- moveItemInArray(orderedList, index, 0);
194
- return orderedList;
195
- }
196
- };
197
- TreeDialogComponent = __decorate([
198
- Component({
199
- selector: `sa-${moduleName}`,
200
- templateUrl: `${localDir}/${parentModuleName}/${moduleName}.component${min}.html`,
201
- }),
202
- __param(1, Inject(MAT_DIALOG_DATA)),
203
- __metadata("design:paramtypes", [MatDialogRef, Object, FormBuilder,
204
- ChangeDetectorRef])
205
- ], TreeDialogComponent);
206
- export { TreeDialogComponent };
234
+ };
235
+ });
207
236
 
208
237
  //# sourceMappingURL=tree-dialog.component.js.map