croco-html 4.4.0 → 4.4.3

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.
@@ -1023,7 +1023,6 @@ class BodyTagsExtensions {
1023
1023
  if (this.hasTagService(tagName, options)) {
1024
1024
  return this.getTagService(tagName, options).bodyTagToHtmlStringConverter(bodyTag);
1025
1025
  }
1026
- console.log("convertToHtmlString", bodyTag, options);
1027
1026
  return `<mapper-not-found>"${tagName}" тег не найден.</mapper-not-found>`;
1028
1027
  }
1029
1028
  static bodyTagsToHtml(bodyTags, options) {
@@ -1753,13 +1752,42 @@ class DefinedCustomTagViewComponent {
1753
1752
  this._data = value;
1754
1753
  }
1755
1754
  ;
1756
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DefinedCustomTagViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1757
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: DefinedCustomTagViewComponent, isStandalone: true, selector: "croco-html-defined-custom-tag-view", inputs: { data: "data" }, ngImport: i0, template: "<div>\n {{_data | json}}\n</div>", dependencies: [{ kind: "pipe", type: JsonPipe, name: "json" }] }); }
1755
+ constructor(_options) {
1756
+ this._options = _options;
1757
+ this.useDynamicComponent = false;
1758
+ }
1759
+ getCustomComponent() {
1760
+ const tagName = this._data.tagName;
1761
+ if (this._options.definedCustomTagViewRenderers.hasOwnProperty(tagName)) {
1762
+ return this._options.definedCustomTagViewRenderers[tagName].viewComponent;
1763
+ }
1764
+ return null;
1765
+ }
1766
+ ngOnInit() {
1767
+ var component = this.getCustomComponent();
1768
+ if (component) {
1769
+ this.useDynamicComponent = true;
1770
+ this.viewContainerRef.remove();
1771
+ this.dynamicContainerRef = this.viewContainerRef.createComponent(component);
1772
+ this.dynamicContainerRef.setInput("data", this._data);
1773
+ }
1774
+ }
1775
+ ngOnDestroy() {
1776
+ this.dynamicContainerRef.destroy();
1777
+ }
1778
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DefinedCustomTagViewComponent, deps: [{ token: CrocoHtmlOptionsToken }], target: i0.ɵɵFactoryTarget.Component }); }
1779
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: DefinedCustomTagViewComponent, isStandalone: true, selector: "croco-html-defined-custom-tag-view", inputs: { data: "data" }, viewQueries: [{ propertyName: "viewContainerRef", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<ng-container #container>\n @if (!useDynamicComponent) {\n <div>\n {{data | json}}\n </div>\n }\n</ng-container>", dependencies: [{ kind: "pipe", type: JsonPipe, name: "json" }] }); }
1758
1780
  }
1759
1781
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DefinedCustomTagViewComponent, decorators: [{
1760
1782
  type: Component,
1761
- args: [{ selector: 'croco-html-defined-custom-tag-view', imports: [JsonPipe], template: "<div>\n {{_data | json}}\n</div>" }]
1762
- }], propDecorators: { data: [{
1783
+ args: [{ selector: 'croco-html-defined-custom-tag-view', imports: [JsonPipe], template: "<ng-container #container>\n @if (!useDynamicComponent) {\n <div>\n {{data | json}}\n </div>\n }\n</ng-container>" }]
1784
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
1785
+ type: Inject,
1786
+ args: [CrocoHtmlOptionsToken]
1787
+ }] }], propDecorators: { viewContainerRef: [{
1788
+ type: ViewChild,
1789
+ args: ['container', { read: ViewContainerRef, static: true }]
1790
+ }], data: [{
1763
1791
  type: Input,
1764
1792
  args: [{ required: true }]
1765
1793
  }] } });
@@ -2273,13 +2301,13 @@ class DefinedCustomEditorBlockComponent {
2273
2301
  constructor(_options) {
2274
2302
  this._options = _options;
2275
2303
  this.useDynamicComponent = false;
2304
+ this.editor = null;
2276
2305
  this.onTagUpdated = new EventEmitter();
2277
- this._tagName = "";
2278
- this._shortTagName = "";
2279
2306
  }
2280
2307
  getCustomComponent() {
2281
- if (this._options.definedCustomTagViewRenderers.hasOwnProperty(this._tagName)) {
2282
- return this._options.definedCustomTagViewRenderers[this._tagName].editorComponent;
2308
+ const tagName = this.tag.tagDescription.tag;
2309
+ if (this._options.definedCustomTagViewRenderers.hasOwnProperty(tagName)) {
2310
+ return this._options.definedCustomTagViewRenderers[tagName].editorComponent;
2283
2311
  }
2284
2312
  return null;
2285
2313
  }
@@ -2289,8 +2317,14 @@ class DefinedCustomEditorBlockComponent {
2289
2317
  this.useDynamicComponent = true;
2290
2318
  this.viewContainerRef.remove();
2291
2319
  this.dynamicContainerRef = this.viewContainerRef.createComponent(component);
2320
+ this.dynamicContainerRef.setInput("tag", this.tag);
2321
+ this.editor = new SingleTagVisualEditor(this.onTagUpdated);
2322
+ this.dynamicContainerRef.setInput("tagEditor", this.editor);
2292
2323
  }
2293
2324
  }
2325
+ ngOnDestroy() {
2326
+ this.dynamicContainerRef.destroy();
2327
+ }
2294
2328
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DefinedCustomEditorBlockComponent, deps: [{ token: CrocoHtmlOptionsToken }], target: i0.ɵɵFactoryTarget.Component }); }
2295
2329
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: DefinedCustomEditorBlockComponent, isStandalone: true, selector: "croco-html-defined-custom-editor-block", inputs: { tag: "tag" }, outputs: { onTagUpdated: "onTagUpdated" }, viewQueries: [{ propertyName: "viewContainerRef", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<ng-container #container>\n @if (!useDynamicComponent) {\n <div>\n {{tag | json}}\n </div>\n }\n</ng-container>", dependencies: [{ kind: "pipe", type: JsonPipe, name: "json" }] }); }
2296
2330
  }
@@ -2309,6 +2343,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
2309
2343
  }], onTagUpdated: [{
2310
2344
  type: Output
2311
2345
  }] } });
2346
+ class SingleTagVisualEditor {
2347
+ constructor(_emitter) {
2348
+ this._emitter = _emitter;
2349
+ }
2350
+ tagUpdated(tag) {
2351
+ this._emitter.emit(tag);
2352
+ }
2353
+ }
2312
2354
 
2313
2355
  class MainEditorBlockComponent {
2314
2356
  constructor(_options) {
@@ -2325,7 +2367,6 @@ class MainEditorBlockComponent {
2325
2367
  }
2326
2368
  isDefinedCustomTag() {
2327
2369
  const tagName = this.tag.tagDescription.tag;
2328
- console.log("isDefinedCustomTag()", tagName, this._options.definedCustomTags.hasOwnProperty(tagName), this._options);
2329
2370
  if (this._options.definedCustomTags.hasOwnProperty(tagName)) {
2330
2371
  return true;
2331
2372
  }
@@ -2977,5 +3018,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
2977
3018
  * Generated bundle index. Do not edit.
2978
3019
  */
2979
3020
 
2980
- export { AddFilesBtnComponent, AngularMaterialTableMethods, BodyTagsExtensions, BootstrapTableMethods, ButtonTagDataConsts, ButtonTagService, CrocoHtmlFileOptionsService, CrocoHtmlModule, CrocoHtmlOptionsToken, CustomWidgetEditorComponent, CustomWidgetIconComponent, CustomWidgetTagDataConsts, CustomWidgetTagService, DefinedCustomEditorBlockComponent, DefinedCustomTagViewComponent, DownloadButtonTagDataConsts, DownloadButtonTagService, ExternalVideoEditorComponent, ExternalVideoPlayers, ExternalVideoSupportedTypes, ExternalVideoTagDataConsts, ExternalVideoTagService, FileIdSelectComponent, FileImageTagDataConsts, FileImageTagService, FileImageTagViewComponent, FileType, HtmlRawEditorComponent, HtmlRawTagDataConsts, HtmlRawTagService, HtmlRawViewComponent, HtmlViewComponent, HtmlViewController, ImageEditorComponent, ImageMethods, MainEditorBlockComponent, MainEditorComponent, TableBuilder, TableMethods, TableTypes, TagToSpanPipe, TextAlignment, TextEditorComponent, TextSimpleMethods, TextTag, TextTagDataConsts, TextTagHtmlMarkupTagService, TextTags, ToHtmlBodyTagsPipe, ToPreviewHtmlPipe, ToPreviewPipe, UploadFilesBtnComponent, VisualEditorComponent, XmlExtensions, XmlTagCustomWidgetComponent, XmlTagExternalVideoComponent, XmlTagHeaderInnerTextViewComponent, XmlTagHeaderTextViewComponent, XmlTagHtmlViewComponent, XmlTagTextViewComponent, XmlTagViewComponent };
3021
+ export { AddFilesBtnComponent, AngularMaterialTableMethods, BodyTagsExtensions, BootstrapTableMethods, ButtonTagDataConsts, ButtonTagService, CrocoHtmlFileOptionsService, CrocoHtmlModule, CrocoHtmlOptionsToken, CustomWidgetEditorComponent, CustomWidgetIconComponent, CustomWidgetTagDataConsts, CustomWidgetTagService, DefinedCustomEditorBlockComponent, DefinedCustomTagViewComponent, DownloadButtonTagDataConsts, DownloadButtonTagService, ExternalVideoEditorComponent, ExternalVideoPlayers, ExternalVideoSupportedTypes, ExternalVideoTagDataConsts, ExternalVideoTagService, FileIdSelectComponent, FileImageTagDataConsts, FileImageTagService, FileImageTagViewComponent, FileType, HtmlRawEditorComponent, HtmlRawTagDataConsts, HtmlRawTagService, HtmlRawViewComponent, HtmlViewComponent, HtmlViewController, ImageEditorComponent, ImageMethods, MainEditorBlockComponent, MainEditorComponent, SingleTagVisualEditor, TableBuilder, TableMethods, TableTypes, TagToSpanPipe, TextAlignment, TextEditorComponent, TextSimpleMethods, TextTag, TextTagDataConsts, TextTagHtmlMarkupTagService, TextTags, ToHtmlBodyTagsPipe, ToPreviewHtmlPipe, ToPreviewPipe, UploadFilesBtnComponent, VisualEditorComponent, XmlExtensions, XmlTagCustomWidgetComponent, XmlTagExternalVideoComponent, XmlTagHeaderInnerTextViewComponent, XmlTagHeaderTextViewComponent, XmlTagHtmlViewComponent, XmlTagTextViewComponent, XmlTagViewComponent };
2981
3022
  //# sourceMappingURL=croco-html.mjs.map