@coolon/angular-ui-powerups 12.4.0-alpha.77 → 12.4.0-alpha.78

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.
@@ -13,18 +13,23 @@ export class MarkdownComponent extends DisposableComponent {
13
13
  const { chain } = Dsl.disposeWith(this);
14
14
  }
15
15
  ngOnInit() {
16
- const { chain } = Dsl.disposeWith(this);
17
- chain(this.content$).subscribe(content => {
18
- this.element.nativeElement.innerHTML = _.isEmpty(content) ? '' :
19
- this.inline ? this.markdownService.renderInline(content) :
20
- this.markdownService.render(content);
21
- }, { initialValue: 'evaluate' });
16
+ const { when } = Dsl.disposeWith(this);
17
+ when(this.content$).changes(content => this.renderContent(content), { initialValue: 'triggerChangeUnlessNil' });
18
+ if (_.isNil(this.content) && !_.isEmpty(this.element.nativeElement.innerHTML)) {
19
+ this.renderContent(this.element.nativeElement.innerHTML);
20
+ }
21
+ }
22
+ renderContent(content) {
23
+ if (!_.isNil(content)) {
24
+ this.element.nativeElement.innerHTML = this.inline ? this.markdownService.renderInline(content) :
25
+ this.markdownService.render(content);
26
+ }
22
27
  }
23
28
  }
24
29
  MarkdownComponent.decorators = [
25
30
  { type: Component, args: [{
26
31
  selector: 'aup-markdown',
27
- template: "<p>markdown works!</p>\n",
32
+ template: "<ng-content></ng-content>\n",
28
33
  styles: [":host{display:inline-block}\n"]
29
34
  },] }
30
35
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.component.js","sourceRoot":"","sources":["../../../../../../../../libs/angular-ui-powerups/src/lib/components/text/markdown/markdown.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,GAAG,EAAE,iBAAiB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAOjE,MAAM,OAAO,iBAAkB,SAAQ,mBAAmB;IAaxD,YAA6B,OAAmB,EAAmB,eAAgC;QACjG,KAAK,EAAE,CAAC;QADmB,YAAO,GAAP,OAAO,CAAY;QAAmB,oBAAe,GAAf,eAAe,CAAiB;QAFnG,WAAM,GAAG,KAAK,CAAC;QAIb,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED,QAAQ;QACN,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACxC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE;YACvC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,SAAS,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBAC9D,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;oBACxD,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC3C,CAAC,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC,CAAC;IACnC,CAAC;;;YA9BF,SAAS,SAAC;gBACT,QAAQ,EAAE,cAAc;gBACxB,oCAAwC;;aAEzC;;;YAVmB,UAAU;YAGrB,eAAe;;;uBAUrB,KAAK;sBAIL,KAAK;qBAIL,KAAK;;AANN;IADC,aAAa,EAAE;8BACN,UAAU;mDAAS;AAI7B;IADC,iBAAiB,CAAC,UAAU,CAAC;;kDACd","sourcesContent":["import { Component, ElementRef, Input, OnInit } from '@angular/core';\nimport { Dsl, StoreInValueModel, TrackExternal, ValueModel } from '@coolon/pectin';\nimport * as _ from 'lodash';\nimport { MarkdownService } from '../../../services/markdown/markdown.service';\nimport { DisposableComponent } from '../../disposable-component';\n\n@Component({\n selector: 'aup-markdown',\n templateUrl: './markdown.component.html',\n styleUrls: ['./markdown.component.scss']\n})\nexport class MarkdownComponent extends DisposableComponent implements OnInit {\n\n @Input()\n @TrackExternal()\n content$: ValueModel<string>;\n\n @Input()\n @StoreInValueModel('content$')\n content: string;\n\n @Input()\n inline = false;\n\n constructor(private readonly element: ElementRef, private readonly markdownService: MarkdownService) {\n super();\n const { chain } = Dsl.disposeWith(this);\n }\n\n ngOnInit() {\n const { chain } = Dsl.disposeWith(this);\n chain(this.content$).subscribe(content => {\n this.element.nativeElement.innerHTML = _.isEmpty(content) ? '' :\n this.inline ? this.markdownService.renderInline(content) :\n this.markdownService.render(content);\n }, { initialValue: 'evaluate' });\n }\n}\n"]}
1
+ {"version":3,"file":"markdown.component.js","sourceRoot":"","sources":["../../../../../../../../libs/angular-ui-powerups/src/lib/components/text/markdown/markdown.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAiB,SAAS,EAAE,UAAU,EAAE,KAAK,EAAqB,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAE,GAAG,EAAE,iBAAiB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAOjE,MAAM,OAAO,iBAAkB,SAAQ,mBAAmB;IAaxD,YAA6B,OAAmB,EAAmB,eAAgC;QACjG,KAAK,EAAE,CAAC;QADmB,YAAO,GAAP,OAAO,CAAY;QAAmB,oBAAe,GAAf,eAAe,CAAiB;QAFnG,WAAM,GAAG,KAAK,CAAC;QAIb,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED,QAAQ;QACN,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,EAAE,YAAY,EAAE,wBAAwB,EAAE,CAAC,CAAC;QAChH,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE;YAC7E,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;SAC1D;IACH,CAAC;IAEO,aAAa,CAAC,OAAe;QACnC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;YACrB,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;gBAC/F,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;SACxC;IACH,CAAC;;;YApCF,SAAS,SAAC;gBACT,QAAQ,EAAE,cAAc;gBACxB,uCAAwC;;aAEzC;;;YAVkC,UAAU;YAGpC,eAAe;;;uBAUrB,KAAK;sBAIL,KAAK;qBAIL,KAAK;;AANN;IADC,aAAa,EAAE;8BACN,UAAU;mDAAS;AAI7B;IADC,iBAAiB,CAAC,UAAU,CAAC;;kDACd","sourcesContent":["import { AfterViewInit, Component, ElementRef, Input, OnChanges, OnInit } from '@angular/core';\nimport { Dsl, StoreInValueModel, TrackExternal, ValueModel } from '@coolon/pectin';\nimport * as _ from 'lodash';\nimport { MarkdownService } from '../../../services/markdown/markdown.service';\nimport { DisposableComponent } from '../../disposable-component';\n\n@Component({\n selector: 'aup-markdown',\n templateUrl: './markdown.component.html',\n styleUrls: ['./markdown.component.scss']\n})\nexport class MarkdownComponent extends DisposableComponent implements OnInit {\n\n @Input()\n @TrackExternal()\n content$: ValueModel<string>;\n\n @Input()\n @StoreInValueModel('content$')\n content: string;\n\n @Input()\n inline = false;\n\n constructor(private readonly element: ElementRef, private readonly markdownService: MarkdownService) {\n super();\n const { chain } = Dsl.disposeWith(this);\n }\n\n ngOnInit() {\n const { when } = Dsl.disposeWith(this);\n when(this.content$).changes(content => this.renderContent(content), { initialValue: 'triggerChangeUnlessNil' });\n if (_.isNil(this.content) && !_.isEmpty(this.element.nativeElement.innerHTML)) {\n this.renderContent(this.element.nativeElement.innerHTML);\n }\n }\n\n private renderContent(content: string) {\n if (!_.isNil(content)) {\n this.element.nativeElement.innerHTML = this.inline ? this.markdownService.renderInline(content) :\n this.markdownService.render(content);\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- [{"__symbolic":"module","version":4,"metadata":{"MarkdownComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../../disposable-component","name":"DisposableComponent","line":11,"character":39},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":6,"character":1},"arguments":[{"selector":"aup-markdown","template":"<p>markdown works!</p>\n","styles":[":host{display:inline-block}\n"]}]}],"members":{"content$":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":13,"character":3}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"TrackExternal","line":14,"character":3}}]}],"content":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":17,"character":3}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"StoreInValueModel","line":18,"character":3},"arguments":["content$"]}]}],"inline":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":21,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":24,"character":40},{"__symbolic":"reference","module":"../../../services/markdown/markdown.service","name":"MarkdownService","line":24,"character":86}]}],"ngOnInit":[{"__symbolic":"method"}]}}}}]
1
+ [{"__symbolic":"module","version":4,"metadata":{"MarkdownComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../../disposable-component","name":"DisposableComponent","line":11,"character":39},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":6,"character":1},"arguments":[{"selector":"aup-markdown","template":"<ng-content></ng-content>\n","styles":[":host{display:inline-block}\n"]}]}],"members":{"content$":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":13,"character":3}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"TrackExternal","line":14,"character":3}}]}],"content":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":17,"character":3}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"StoreInValueModel","line":18,"character":3},"arguments":["content$"]}]}],"inline":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":21,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":24,"character":40},{"__symbolic":"reference","module":"../../../services/markdown/markdown.service","name":"MarkdownService","line":24,"character":86}]}],"ngOnInit":[{"__symbolic":"method"}],"renderContent":[{"__symbolic":"method"}]}}}}]
@@ -4271,18 +4271,23 @@ class MarkdownComponent extends DisposableComponent {
4271
4271
  const { chain } = Dsl.disposeWith(this);
4272
4272
  }
4273
4273
  ngOnInit() {
4274
- const { chain } = Dsl.disposeWith(this);
4275
- chain(this.content$).subscribe(content => {
4276
- this.element.nativeElement.innerHTML = _.isEmpty(content) ? '' :
4277
- this.inline ? this.markdownService.renderInline(content) :
4278
- this.markdownService.render(content);
4279
- }, { initialValue: 'evaluate' });
4274
+ const { when } = Dsl.disposeWith(this);
4275
+ when(this.content$).changes(content => this.renderContent(content), { initialValue: 'triggerChangeUnlessNil' });
4276
+ if (_.isNil(this.content) && !_.isEmpty(this.element.nativeElement.innerHTML)) {
4277
+ this.renderContent(this.element.nativeElement.innerHTML);
4278
+ }
4279
+ }
4280
+ renderContent(content) {
4281
+ if (!_.isNil(content)) {
4282
+ this.element.nativeElement.innerHTML = this.inline ? this.markdownService.renderInline(content) :
4283
+ this.markdownService.render(content);
4284
+ }
4280
4285
  }
4281
4286
  }
4282
4287
  MarkdownComponent.decorators = [
4283
4288
  { type: Component, args: [{
4284
4289
  selector: 'aup-markdown',
4285
- template: "<p>markdown works!</p>\n",
4290
+ template: "<ng-content></ng-content>\n",
4286
4291
  styles: [":host{display:inline-block}\n"]
4287
4292
  },] }
4288
4293
  ];