croco-html 0.0.1 → 0.1.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.
Files changed (183) hide show
  1. package/README.md +24 -24
  2. package/karma.conf.js +44 -0
  3. package/ng-package.json +7 -0
  4. package/package.json +14 -22
  5. package/src/lib/components/add-files-btn/add-files-btn.component.css +0 -0
  6. package/src/lib/components/add-files-btn/add-files-btn.component.html +14 -0
  7. package/src/lib/components/add-files-btn/add-files-btn.component.ts +61 -0
  8. package/src/lib/components/editor/external-video-block/external-video-block.component.css +0 -0
  9. package/src/lib/components/editor/external-video-block/external-video-block.component.html +27 -0
  10. package/src/lib/components/editor/external-video-block/external-video-block.component.ts +45 -0
  11. package/src/lib/components/editor/html-raw-editor/html-raw-editor.component.css +0 -0
  12. package/src/lib/components/editor/html-raw-editor/html-raw-editor.component.html +17 -0
  13. package/src/lib/components/editor/html-raw-editor/html-raw-editor.component.ts +22 -0
  14. package/src/lib/components/editor/image-editor/image-editor.component.css +7 -0
  15. package/src/lib/components/editor/image-editor/image-editor.component.html +54 -0
  16. package/src/lib/components/editor/image-editor/image-editor.component.ts +52 -0
  17. package/src/lib/components/editor/index.ts +7 -0
  18. package/src/lib/components/editor/main-editor/main-editor.component.css +48 -0
  19. package/src/lib/components/editor/main-editor/main-editor.component.html +39 -0
  20. package/src/lib/components/editor/main-editor/main-editor.component.ts +71 -0
  21. package/src/lib/components/editor/main-editor-block/main-editor-block.component.css +0 -0
  22. package/src/lib/components/editor/main-editor-block/main-editor-block.component.html +41 -0
  23. package/src/lib/components/editor/main-editor-block/main-editor-block.component.ts +39 -0
  24. package/src/lib/components/editor/text-editor/text-editor.component.css +0 -0
  25. package/src/lib/components/editor/text-editor/text-editor.component.html +39 -0
  26. package/src/lib/components/editor/text-editor/text-editor.component.ts +30 -0
  27. package/src/lib/components/editor/visual-editor/visual-editor.component.css +48 -0
  28. package/src/lib/components/editor/visual-editor/visual-editor.component.html +84 -0
  29. package/src/lib/components/editor/visual-editor/visual-editor.component.ts +180 -0
  30. package/src/lib/components/file-id-select/file-id-select.component.css +0 -0
  31. package/src/lib/components/file-id-select/file-id-select.component.html +39 -0
  32. package/src/lib/components/file-id-select/file-id-select.component.ts +75 -0
  33. package/src/lib/components/index.ts +5 -0
  34. package/src/lib/components/upload-files-btn/upload-files-btn.component.css +0 -0
  35. package/src/lib/components/upload-files-btn/upload-files-btn.component.html +2 -0
  36. package/src/lib/components/upload-files-btn/upload-files-btn.component.ts +57 -0
  37. package/{lib/components/xml-tags/index.d.ts → src/lib/components/xml-tags/index.ts} +8 -8
  38. package/src/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.css +15 -0
  39. package/src/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.html +8 -0
  40. package/src/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.ts +59 -0
  41. package/src/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.css +0 -0
  42. package/src/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.html +18 -0
  43. package/src/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.ts +19 -0
  44. package/src/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.css +0 -0
  45. package/src/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.html +25 -0
  46. package/src/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.ts +19 -0
  47. package/src/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.css +0 -0
  48. package/src/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.html +3 -0
  49. package/src/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.ts +14 -0
  50. package/src/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.css +0 -0
  51. package/src/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.html +2 -0
  52. package/src/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.ts +19 -0
  53. package/src/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.css +0 -0
  54. package/src/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.html +9 -0
  55. package/src/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.ts +15 -0
  56. package/src/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.css +0 -0
  57. package/src/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.html +21 -0
  58. package/src/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.ts +18 -0
  59. package/src/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.css +4 -0
  60. package/src/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.html +44 -0
  61. package/src/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.ts +17 -0
  62. package/src/lib/croco-html.module.ts +22 -0
  63. package/src/lib/extensions/AngularMaterialTableMethods.ts +87 -0
  64. package/src/lib/extensions/BodyTagsExtensions.ts +151 -0
  65. package/src/lib/extensions/BootstrapTableMethods.ts +87 -0
  66. package/src/lib/extensions/HtmlExtractionMethods.ts +78 -0
  67. package/src/lib/extensions/HtmlRawTagDataConsts.ts +3 -0
  68. package/src/lib/extensions/ImageMethods.ts +37 -0
  69. package/{lib/extensions/InterfaceBlock.d.ts → src/lib/extensions/InterfaceBlock.ts} +5 -4
  70. package/src/lib/extensions/TableBuilder.ts +50 -0
  71. package/src/lib/extensions/TableMethods.ts +175 -0
  72. package/src/lib/extensions/TextMethods.ts +51 -0
  73. package/src/lib/extensions/TextSimpleMethods.ts +120 -0
  74. package/src/lib/extensions/VideoMethods.ts +31 -0
  75. package/src/lib/extensions/XmlExtensions.ts +26 -0
  76. package/src/lib/extensions/index.ts +12 -0
  77. package/src/lib/index.ts +119 -0
  78. package/{lib/models/models.d.ts → src/lib/models/models.ts} +11 -10
  79. package/src/lib/pipes/RichTextToHtmlPipe.ts +25 -0
  80. package/src/lib/pipes/TagToSpanPipe.ts +10 -0
  81. package/src/lib/pipes/ToHtmlBodyTagsPipe.ts +14 -0
  82. package/{lib/pipes/index.d.ts → src/lib/pipes/index.ts} +4 -4
  83. package/src/lib/pipes/to-preview.pipe.ts +12 -0
  84. package/src/lib/services/file-upload.service.ts +56 -0
  85. package/src/lib/services/files-query.service.ts +72 -0
  86. package/{public-api.d.ts → src/public-api.ts} +8 -4
  87. package/src/test.ts +28 -0
  88. package/tsconfig.lib.json +20 -0
  89. package/tsconfig.lib.prod.json +10 -0
  90. package/tsconfig.spec.json +17 -0
  91. package/bundles/croco-html.umd.js +0 -2091
  92. package/bundles/croco-html.umd.js.map +0 -1
  93. package/croco-html.d.ts +0 -5
  94. package/esm2015/croco-html.js +0 -5
  95. package/esm2015/lib/components/add-files-btn/add-files-btn.component.js +0 -57
  96. package/esm2015/lib/components/editor/external-video-block/external-video-block.component.js +0 -49
  97. package/esm2015/lib/components/editor/html-raw-editor/html-raw-editor.component.js +0 -29
  98. package/esm2015/lib/components/editor/image-editor/image-editor.component.js +0 -54
  99. package/esm2015/lib/components/editor/index.js +0 -8
  100. package/esm2015/lib/components/editor/main-editor/main-editor.component.js +0 -80
  101. package/esm2015/lib/components/editor/main-editor-block/main-editor-block.component.js +0 -45
  102. package/esm2015/lib/components/editor/text-editor/text-editor.component.js +0 -38
  103. package/esm2015/lib/components/editor/visual-editor/visual-editor.component.js +0 -165
  104. package/esm2015/lib/components/file-id-select/file-id-select.component.js +0 -66
  105. package/esm2015/lib/components/index.js +0 -6
  106. package/esm2015/lib/components/upload-files-btn/upload-files-btn.component.js +0 -58
  107. package/esm2015/lib/components/xml-tags/index.js +0 -9
  108. package/esm2015/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.js +0 -47
  109. package/esm2015/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.js +0 -21
  110. package/esm2015/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.js +0 -22
  111. package/esm2015/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.js +0 -20
  112. package/esm2015/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.js +0 -24
  113. package/esm2015/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.js +0 -24
  114. package/esm2015/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.js +0 -21
  115. package/esm2015/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.js +0 -26
  116. package/esm2015/lib/croco-html.module.js +0 -90
  117. package/esm2015/lib/extensions/AngularMaterialTableMethods.js +0 -64
  118. package/esm2015/lib/extensions/BodyTagsExtensions.js +0 -120
  119. package/esm2015/lib/extensions/BootstrapTableMethods.js +0 -67
  120. package/esm2015/lib/extensions/HtmlExtractionMethods.js +0 -63
  121. package/esm2015/lib/extensions/HtmlRawTagDataConsts.js +0 -4
  122. package/esm2015/lib/extensions/ImageMethods.js +0 -24
  123. package/esm2015/lib/extensions/InterfaceBlock.js +0 -2
  124. package/esm2015/lib/extensions/TableBuilder.js +0 -35
  125. package/esm2015/lib/extensions/TableMethods.js +0 -100
  126. package/esm2015/lib/extensions/TextMethods.js +0 -29
  127. package/esm2015/lib/extensions/TextSimpleMethods.js +0 -78
  128. package/esm2015/lib/extensions/VideoMethods.js +0 -20
  129. package/esm2015/lib/extensions/XmlExtensions.js +0 -26
  130. package/esm2015/lib/extensions/index.js +0 -13
  131. package/esm2015/lib/index.js +0 -113
  132. package/esm2015/lib/models/models.js +0 -2
  133. package/esm2015/lib/pipes/RichTextToHtmlPipe.js +0 -26
  134. package/esm2015/lib/pipes/TagToSpanPipe.js +0 -16
  135. package/esm2015/lib/pipes/ToHtmlBodyTagsPipe.js +0 -17
  136. package/esm2015/lib/pipes/index.js +0 -5
  137. package/esm2015/lib/pipes/to-preview.pipe.js +0 -17
  138. package/esm2015/lib/services/file-upload.service.js +0 -40
  139. package/esm2015/lib/services/files-query.service.js +0 -27
  140. package/esm2015/public-api.js +0 -8
  141. package/fesm2015/croco-html.js +0 -1634
  142. package/fesm2015/croco-html.js.map +0 -1
  143. package/lib/components/add-files-btn/add-files-btn.component.d.ts +0 -18
  144. package/lib/components/editor/external-video-block/external-video-block.component.d.ts +0 -19
  145. package/lib/components/editor/html-raw-editor/html-raw-editor.component.d.ts +0 -11
  146. package/lib/components/editor/image-editor/image-editor.component.d.ts +0 -20
  147. package/lib/components/editor/index.d.ts +0 -7
  148. package/lib/components/editor/main-editor/main-editor.component.d.ts +0 -28
  149. package/lib/components/editor/main-editor-block/main-editor-block.component.d.ts +0 -16
  150. package/lib/components/editor/text-editor/text-editor.component.d.ts +0 -14
  151. package/lib/components/editor/visual-editor/visual-editor.component.d.ts +0 -43
  152. package/lib/components/file-id-select/file-id-select.component.d.ts +0 -30
  153. package/lib/components/index.d.ts +0 -5
  154. package/lib/components/upload-files-btn/upload-files-btn.component.d.ts +0 -24
  155. package/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.d.ts +0 -17
  156. package/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.d.ts +0 -10
  157. package/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.d.ts +0 -10
  158. package/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.d.ts +0 -7
  159. package/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.d.ts +0 -10
  160. package/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.d.ts +0 -7
  161. package/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.d.ts +0 -10
  162. package/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.d.ts +0 -8
  163. package/lib/croco-html.module.d.ts +0 -60
  164. package/lib/extensions/AngularMaterialTableMethods.d.ts +0 -10
  165. package/lib/extensions/BodyTagsExtensions.d.ts +0 -10
  166. package/lib/extensions/BootstrapTableMethods.d.ts +0 -9
  167. package/lib/extensions/HtmlExtractionMethods.d.ts +0 -69
  168. package/lib/extensions/HtmlRawTagDataConsts.d.ts +0 -3
  169. package/lib/extensions/ImageMethods.d.ts +0 -17
  170. package/lib/extensions/TableBuilder.d.ts +0 -5
  171. package/lib/extensions/TableMethods.d.ts +0 -58
  172. package/lib/extensions/TextMethods.d.ts +0 -19
  173. package/lib/extensions/TextSimpleMethods.d.ts +0 -23
  174. package/lib/extensions/VideoMethods.d.ts +0 -19
  175. package/lib/extensions/XmlExtensions.d.ts +0 -5
  176. package/lib/extensions/index.d.ts +0 -10
  177. package/lib/index.d.ts +0 -20
  178. package/lib/pipes/RichTextToHtmlPipe.d.ts +0 -8
  179. package/lib/pipes/TagToSpanPipe.d.ts +0 -7
  180. package/lib/pipes/ToHtmlBodyTagsPipe.d.ts +0 -8
  181. package/lib/pipes/to-preview.pipe.d.ts +0 -8
  182. package/lib/services/file-upload.service.d.ts +0 -23
  183. package/lib/services/files-query.service.d.ts +0 -42
@@ -0,0 +1,119 @@
1
+ import { ImageEditorComponent } from "./components/editor/image-editor/image-editor.component";
2
+ import { MainEditorBlockComponent } from "./components/editor/main-editor-block/main-editor-block.component";
3
+ import { MainEditorComponent } from "./components/editor/main-editor/main-editor.component";
4
+ import { TextEditorComponent } from "./components/editor/text-editor/text-editor.component";
5
+ import { FileIdSelectComponent } from "./components/file-id-select/file-id-select.component";
6
+ import { XmlTagHeaderInnerTextViewComponent } from "./components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component";
7
+ import { XmlTagHeaderTextViewComponent } from "./components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component";
8
+ import { XmlTagHtmlViewComponent } from "./components/xml-tags/xml-tag-html-view/xml-tag-html-view.component";
9
+ import { XmlTagRichTextViewComponent } from "./components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component";
10
+ import { XmlTagTableViewComponent } from "./components/xml-tags/xml-tag-table-view/xml-tag-table-view.component";
11
+ import { XmlTagTextViewComponent } from "./components/xml-tags/xml-tag-text-view/xml-tag-text-view.component";
12
+ import { XmlTagViewComponent } from "./components/xml-tags/xml-tag-view/xml-tag-view.component";
13
+ import { VisualEditorComponent } from './components/editor/visual-editor/visual-editor.component';
14
+ import { AddFilesBtnComponent } from './components/add-files-btn/add-files-btn.component';
15
+ import { ExternalVideoBlockComponent } from "./components/editor/external-video-block/external-video-block.component";
16
+ import { XmlTagExternalVideoComponent } from "./components/xml-tags/xml-tag-external-video/xml-tag-external-video.component";
17
+ import { HtmlRawEditorComponent } from "./components/editor/html-raw-editor/html-raw-editor.component";
18
+
19
+ import { MatSnackBarModule } from '@angular/material/snack-bar';
20
+ import { MatSelectModule } from '@angular/material/select';
21
+ import { MatTooltipModule } from '@angular/material/tooltip';
22
+ import {MatCheckboxModule} from '@angular/material/checkbox';
23
+ import { DragDropModule } from '@angular/cdk/drag-drop';
24
+ import { MatAutocompleteModule } from '@angular/material/autocomplete';
25
+ import { MatButtonModule } from '@angular/material/button';
26
+ import { MatCardModule } from '@angular/material/card';
27
+ import { MatChipsModule } from '@angular/material/chips';
28
+ import { MatNativeDateModule } from '@angular/material/core';
29
+ import { MatDatepickerModule } from '@angular/material/datepicker';
30
+ import { MatDialogModule } from '@angular/material/dialog';
31
+ import { MatExpansionModule } from '@angular/material/expansion';
32
+ import { MatFormFieldModule } from '@angular/material/form-field';
33
+ import { MatGridListModule } from '@angular/material/grid-list';
34
+ import { MatIconModule } from '@angular/material/icon';
35
+ import { MatInputModule } from '@angular/material/input';
36
+ import { MatListModule } from '@angular/material/list';
37
+ import { MatMenuModule } from '@angular/material/menu';
38
+ import { MatPaginatorModule } from '@angular/material/paginator';
39
+ import { MatProgressBarModule } from '@angular/material/progress-bar';
40
+ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
41
+ import { MatSidenavModule } from '@angular/material/sidenav';
42
+ import { MatSlideToggleModule } from '@angular/material/slide-toggle';
43
+ import { MatTableModule } from '@angular/material/table';
44
+ import { MatTabsModule } from '@angular/material/tabs';
45
+ import { MatTreeModule } from '@angular/material/tree';
46
+ import { MatBadgeModule } from '@angular/material/badge';
47
+ import {MatButtonToggleModule} from '@angular/material/button-toggle';
48
+ import { RichTextToHtmlPipe, TagToSpanPipe, ToHtmlBodyTagsPipe, ToPreviewPipe } from "./pipes";
49
+ import { UploadFilesBtnComponent } from "./components";
50
+
51
+
52
+ export const EditorComponents = [
53
+ MainEditorComponent,
54
+ FileIdSelectComponent,
55
+ TextEditorComponent,
56
+ ExternalVideoBlockComponent,
57
+ ImageEditorComponent,
58
+ MainEditorBlockComponent,
59
+ VisualEditorComponent,
60
+ AddFilesBtnComponent,
61
+ HtmlRawEditorComponent,
62
+ ];
63
+
64
+ export const XmlComponents = [
65
+ XmlTagTableViewComponent,
66
+ XmlTagViewComponent,
67
+ XmlTagRichTextViewComponent,
68
+ XmlTagHtmlViewComponent,
69
+ XmlTagTextViewComponent,
70
+ XmlTagHeaderTextViewComponent,
71
+ XmlTagHeaderInnerTextViewComponent,
72
+ XmlTagExternalVideoComponent
73
+ ];
74
+
75
+ export const CrocoPipes = [
76
+ RichTextToHtmlPipe,
77
+ TagToSpanPipe,
78
+ ToPreviewPipe,
79
+ ToHtmlBodyTagsPipe,
80
+ ]
81
+
82
+ export const CrocoHtmlDeclarations = [
83
+ UploadFilesBtnComponent,
84
+ ...XmlComponents,
85
+ ...EditorComponents,
86
+ ...CrocoPipes
87
+ ]
88
+
89
+ export const MaterialModules = [
90
+ MatBadgeModule,
91
+ MatTableModule,
92
+ MatExpansionModule,
93
+ MatFormFieldModule,
94
+ MatSnackBarModule,
95
+ MatProgressBarModule,
96
+ MatProgressSpinnerModule,
97
+ MatTabsModule,
98
+ MatMenuModule,
99
+ MatCardModule,
100
+ MatSelectModule,
101
+ MatTooltipModule,
102
+ MatCheckboxModule,
103
+ MatChipsModule,
104
+ MatListModule,
105
+ MatButtonModule,
106
+ MatInputModule,
107
+ MatDialogModule,
108
+ MatPaginatorModule,
109
+ MatDatepickerModule,
110
+ MatGridListModule,
111
+ MatSlideToggleModule,
112
+ MatTreeModule,
113
+ MatNativeDateModule,
114
+ MatAutocompleteModule,
115
+ MatSidenavModule,
116
+ MatIconModule,
117
+ DragDropModule,
118
+ MatButtonToggleModule
119
+ ];
@@ -1,10 +1,11 @@
1
- export interface TagItem {
2
- tag: string;
3
- displayValue: string;
4
- }
5
- export interface HtmlBodyTag {
6
- tagDescription: TagItem;
7
- innerHtml: string;
8
- attributes: Object;
9
- presentOrEdit: boolean;
10
- }
1
+ export interface TagItem {
2
+ tag: string;
3
+ displayValue: string;
4
+ }
5
+
6
+ export interface HtmlBodyTag {
7
+ tagDescription: TagItem;
8
+ innerHtml: string;
9
+ attributes: Object;
10
+ presentOrEdit: boolean;
11
+ }
@@ -0,0 +1,25 @@
1
+ import { Pipe, PipeTransform } from "@angular/core";
2
+ import { RichTextData } from "../extensions/TextMethods";
3
+
4
+ @Pipe({
5
+ name: 'richTextToHtml'
6
+ })
7
+ export class RichTextToHtmlPipe implements PipeTransform {
8
+
9
+ transform(value: RichTextData): string {
10
+ let result = "";
11
+
12
+ for (let i = 0; i < value.data.children.length; i++) {
13
+ const child = value.data.children[i];
14
+
15
+ if (child.type === "text-block") {
16
+ result += `<span>${child.data.text}</span>`;
17
+ }
18
+ else if (child.type === "line-break") {
19
+ result += "</br>";
20
+ }
21
+ }
22
+
23
+ return result;
24
+ }
25
+ }
@@ -0,0 +1,10 @@
1
+ import { Pipe, PipeTransform } from "@angular/core";
2
+
3
+ @Pipe({
4
+ name: 'tagToSpan'
5
+ })
6
+ export class TagToSpanPipe implements PipeTransform {
7
+ transform(value: string[]): string {
8
+ return value.map(x => (`<b>${x}</b>`)).join(' | ')
9
+ }
10
+ }
@@ -0,0 +1,14 @@
1
+ import { Pipe, PipeTransform } from '@angular/core';
2
+ import { BodyTagsExtensions } from '../extensions/BodyTagsExtensions';
3
+ import { HtmlBodyTag } from '../models/models';
4
+
5
+ @Pipe({
6
+ name: 'tohtmlbodytags'
7
+ })
8
+ export class ToHtmlBodyTagsPipe implements PipeTransform {
9
+
10
+ transform(value: string): HtmlBodyTag[] {
11
+ return BodyTagsExtensions.getBodyTags(value);
12
+ }
13
+
14
+ }
@@ -1,4 +1,4 @@
1
- export * from "./RichTextToHtmlPipe";
2
- export * from "./TagToSpanPipe";
3
- export * from "./to-preview.pipe";
4
- export * from "./ToHtmlBodyTagsPipe";
1
+ export * from "./RichTextToHtmlPipe";
2
+ export * from "./TagToSpanPipe";
3
+ export * from "./to-preview.pipe";
4
+ export * from "./ToHtmlBodyTagsPipe";
@@ -0,0 +1,12 @@
1
+ import { Pipe, PipeTransform } from '@angular/core';
2
+ import { HtmlExtractionMethods } from '../extensions/HtmlExtractionMethods';
3
+ import { InterfaceBlock } from "../extensions/InterfaceBlock";
4
+
5
+ @Pipe({
6
+ name: 'topreview'
7
+ })
8
+ export class ToPreviewPipe implements PipeTransform {
9
+ transform(value: string): InterfaceBlock[] {
10
+ return HtmlExtractionMethods.transformHtmlStringToBlocks(value);
11
+ }
12
+ }
@@ -0,0 +1,56 @@
1
+ import { HttpClient } from "@angular/common/http";
2
+ import { Inject, Injectable } from "@angular/core";
3
+ import { Observable } from "rxjs";
4
+
5
+ export interface BaseApiResponse {
6
+ isSucceeded: boolean;
7
+ message: string;
8
+ }
9
+
10
+ export interface GenericBaseApiResponse<T> extends BaseApiResponse {
11
+ responseObject: T;
12
+ }
13
+
14
+ export interface BaseApiResponseWithFilesIds extends BaseApiResponse{
15
+ responseObject: number[];
16
+ }
17
+
18
+ @Injectable({providedIn: 'root'})
19
+ export class FileUploadService {
20
+
21
+ constructor(private _httpClient: HttpClient,
22
+ @Inject('BASE_URL') private baseUrl: string) {
23
+ }
24
+
25
+ postFile(file: File, createLocalCopiesNow = false):Observable<BaseApiResponseWithFilesIds>{
26
+ const formData: FormData = new FormData();
27
+
28
+ formData.append(`fileKey1`, file, file.name);
29
+
30
+ return this.postFilesInner(formData, createLocalCopiesNow);
31
+ }
32
+
33
+ postFiles(files: FileList, createLocalCopiesNow = false): Observable<BaseApiResponseWithFilesIds> {
34
+
35
+ const formData: FormData = new FormData();
36
+
37
+ for(let i = 0; i < files.length; i++){
38
+ var fileToUpload = files.item(i);
39
+ formData.append(`fileKey${i}`, fileToUpload as Blob, fileToUpload?.name);
40
+ }
41
+
42
+ return this.postFilesInner(formData, createLocalCopiesNow);
43
+ }
44
+
45
+ postFilesInner(formData: FormData, createLocalCopiesNow = false): Observable<BaseApiResponseWithFilesIds> {
46
+
47
+ let endpoint = this.baseUrl + 'Api/Files/UploadFiles';
48
+
49
+ if(createLocalCopiesNow){
50
+ endpoint += '/Now';
51
+ }
52
+
53
+ return this._httpClient
54
+ .post<BaseApiResponseWithFilesIds>(endpoint, formData);
55
+ }
56
+ }
@@ -0,0 +1,72 @@
1
+ import { HttpClient } from "@angular/common/http";
2
+ import { Inject, Injectable } from "@angular/core";
3
+ import { Observable } from "rxjs";
4
+
5
+ export interface GetListResult<T>{
6
+
7
+ /*
8
+ Сколько всего записей
9
+ */
10
+ totalCount:number;
11
+
12
+ /*
13
+ Текущий список
14
+ */
15
+ list:Array<T>;
16
+ }
17
+
18
+ export interface DbFileNoDataWithRelations {
19
+ id: number;
20
+ fileName: string;
21
+ relations: Array<FileRelationModel>;
22
+ }
23
+
24
+ export interface FileRelationModel {
25
+ entityTypeFullName: string;
26
+ entityKey: string;
27
+ relationName: string;
28
+ relationValue: string;
29
+ relationCustomData: string;
30
+ }
31
+
32
+ export interface SearchFiles {
33
+ fileName: string;
34
+ q: string;
35
+ count: number | null;
36
+ offSet: number;
37
+ }
38
+
39
+ export interface GetListSearchModel {
40
+ count: number | null;
41
+ offSet: number;
42
+ }
43
+
44
+ export interface FileNameAndIdModel {
45
+ fileId: number;
46
+ fileName: string;
47
+ }
48
+
49
+ @Injectable({
50
+ providedIn: 'root'
51
+ })
52
+ export class FilesQueryService{
53
+
54
+ _baseControllerUrl: string;
55
+
56
+ constructor(private _httpClient: HttpClient,
57
+ @Inject('BASE_URL') baseUrl: string) {
58
+ this._baseControllerUrl = baseUrl + 'Api/Files/';
59
+ }
60
+
61
+ public getFilesWithRelations(model: SearchFiles):Observable<GetListResult<DbFileNoDataWithRelations>>{
62
+ return this._httpClient.post<GetListResult<DbFileNoDataWithRelations>>(
63
+ this._baseControllerUrl + `GetFiles/WithRelations`, model
64
+ );
65
+ }
66
+
67
+ public getFiles(model: SearchFiles):Observable<GetListResult<FileNameAndIdModel>>{
68
+ return this._httpClient.post<GetListResult<FileNameAndIdModel>>(
69
+ this._baseControllerUrl + `GetFiles`, model
70
+ );
71
+ }
72
+ }
@@ -1,4 +1,8 @@
1
- export * from './lib/components';
2
- export * from './lib/pipes';
3
- export * from './lib/extensions';
4
- export * from './lib/croco-html.module';
1
+ /*
2
+ * Public API Surface of croco-html
3
+ */
4
+
5
+ export * from './lib/components';
6
+ export * from './lib/pipes';
7
+ export * from './lib/extensions';
8
+ export * from './lib/croco-html.module';
package/src/test.ts ADDED
@@ -0,0 +1,28 @@
1
+ // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
+
3
+ import 'zone.js';
4
+ import 'zone.js/testing';
5
+ import { getTestBed } from '@angular/core/testing';
6
+ import {
7
+ BrowserDynamicTestingModule,
8
+ platformBrowserDynamicTesting
9
+ } from '@angular/platform-browser-dynamic/testing';
10
+
11
+ declare const require: {
12
+ context(path: string, deep?: boolean, filter?: RegExp): {
13
+ keys(): string[];
14
+ <T>(id: string): T;
15
+ };
16
+ };
17
+
18
+ // First, initialize the Angular testing environment.
19
+ getTestBed().initTestEnvironment(
20
+ BrowserDynamicTestingModule,
21
+ platformBrowserDynamicTesting(), {
22
+ teardown: { destroyAfterEach: false }
23
+ }
24
+ );
25
+ // Then we find all the tests.
26
+ const context = require.context('./', true, /\.spec\.ts$/);
27
+ // And load the modules.
28
+ context.keys().map(context);
@@ -0,0 +1,20 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "../../tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "../../out-tsc/lib",
6
+ "target": "es2015",
7
+ "declaration": true,
8
+ "declarationMap": true,
9
+ "inlineSources": true,
10
+ "types": [],
11
+ "lib": [
12
+ "dom",
13
+ "es2018"
14
+ ]
15
+ },
16
+ "exclude": [
17
+ "src/test.ts",
18
+ "**/*.spec.ts"
19
+ ]
20
+ }
@@ -0,0 +1,10 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "./tsconfig.lib.json",
4
+ "compilerOptions": {
5
+ "declarationMap": false
6
+ },
7
+ "angularCompilerOptions": {
8
+ "compilationMode": "partial"
9
+ }
10
+ }
@@ -0,0 +1,17 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "../../tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "../../out-tsc/spec",
6
+ "types": [
7
+ "jasmine"
8
+ ]
9
+ },
10
+ "files": [
11
+ "src/test.ts"
12
+ ],
13
+ "include": [
14
+ "**/*.spec.ts",
15
+ "**/*.d.ts"
16
+ ]
17
+ }