croco-html 0.1.1 → 0.1.2

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/croco-html.d.ts +5 -0
  2. package/esm2020/croco-html.mjs +5 -0
  3. package/esm2020/lib/components/add-files-btn/add-files-btn.component.mjs +53 -0
  4. package/esm2020/lib/components/editor/external-video-block/external-video-block.component.mjs +45 -0
  5. package/esm2020/lib/components/editor/html-raw-editor/html-raw-editor.component.mjs +25 -0
  6. package/esm2020/lib/components/editor/image-editor/image-editor.component.mjs +50 -0
  7. package/esm2020/lib/components/editor/index.mjs +8 -0
  8. package/esm2020/lib/components/editor/main-editor/main-editor.component.mjs +76 -0
  9. package/esm2020/lib/components/editor/main-editor-block/main-editor-block.component.mjs +41 -0
  10. package/esm2020/lib/components/editor/text-editor/text-editor.component.mjs +34 -0
  11. package/esm2020/lib/components/editor/visual-editor/visual-editor.component.mjs +161 -0
  12. package/esm2020/lib/components/file-id-select/file-id-select.component.mjs +62 -0
  13. package/esm2020/lib/components/index.mjs +6 -0
  14. package/esm2020/lib/components/upload-files-btn/upload-files-btn.component.mjs +54 -0
  15. package/esm2020/lib/components/xml-tags/index.mjs +9 -0
  16. package/esm2020/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.mjs +43 -0
  17. package/esm2020/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.mjs +17 -0
  18. package/esm2020/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.mjs +18 -0
  19. package/esm2020/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.mjs +16 -0
  20. package/esm2020/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.mjs +20 -0
  21. package/esm2020/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.mjs +20 -0
  22. package/esm2020/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.mjs +17 -0
  23. package/esm2020/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.mjs +21 -0
  24. package/esm2020/lib/croco-html.module.mjs +90 -0
  25. package/esm2020/lib/extensions/AngularMaterialTableMethods.mjs +64 -0
  26. package/esm2020/lib/extensions/BodyTagsExtensions.mjs +120 -0
  27. package/esm2020/lib/extensions/BootstrapTableMethods.mjs +67 -0
  28. package/esm2020/lib/extensions/HtmlExtractionMethods.mjs +63 -0
  29. package/esm2020/lib/extensions/HtmlRawTagDataConsts.mjs +4 -0
  30. package/esm2020/lib/extensions/ImageMethods.mjs +24 -0
  31. package/esm2020/lib/extensions/InterfaceBlock.mjs +2 -0
  32. package/esm2020/lib/extensions/TableBuilder.mjs +35 -0
  33. package/esm2020/lib/extensions/TableMethods.mjs +108 -0
  34. package/esm2020/lib/extensions/TextMethods.mjs +29 -0
  35. package/esm2020/lib/extensions/TextSimpleMethods.mjs +77 -0
  36. package/esm2020/lib/extensions/VideoMethods.mjs +20 -0
  37. package/esm2020/lib/extensions/XmlExtensions.mjs +26 -0
  38. package/esm2020/lib/extensions/index.mjs +13 -0
  39. package/esm2020/lib/index.mjs +113 -0
  40. package/esm2020/lib/models/models.mjs +2 -0
  41. package/esm2020/lib/pipes/RichTextToHtmlPipe.mjs +26 -0
  42. package/esm2020/lib/pipes/TagToSpanPipe.mjs +16 -0
  43. package/esm2020/lib/pipes/ToHtmlBodyTagsPipe.mjs +17 -0
  44. package/esm2020/lib/pipes/index.mjs +5 -0
  45. package/esm2020/lib/pipes/to-preview.pipe.mjs +17 -0
  46. package/esm2020/lib/services/file-upload.service.mjs +40 -0
  47. package/esm2020/lib/services/files-query.service.mjs +27 -0
  48. package/esm2020/public-api.mjs +8 -0
  49. package/fesm2015/croco-html.mjs +1565 -0
  50. package/fesm2015/croco-html.mjs.map +1 -0
  51. package/fesm2020/croco-html.mjs +1568 -0
  52. package/fesm2020/croco-html.mjs.map +1 -0
  53. package/lib/components/add-files-btn/add-files-btn.component.d.ts +18 -0
  54. package/lib/components/editor/external-video-block/external-video-block.component.d.ts +19 -0
  55. package/lib/components/editor/html-raw-editor/html-raw-editor.component.d.ts +11 -0
  56. package/lib/components/editor/image-editor/image-editor.component.d.ts +20 -0
  57. package/lib/components/editor/index.d.ts +7 -0
  58. package/lib/components/editor/main-editor/main-editor.component.d.ts +28 -0
  59. package/lib/components/editor/main-editor-block/main-editor-block.component.d.ts +16 -0
  60. package/lib/components/editor/text-editor/text-editor.component.d.ts +14 -0
  61. package/lib/components/editor/visual-editor/visual-editor.component.d.ts +43 -0
  62. package/lib/components/file-id-select/file-id-select.component.d.ts +30 -0
  63. package/lib/components/index.d.ts +5 -0
  64. package/lib/components/upload-files-btn/upload-files-btn.component.d.ts +24 -0
  65. package/{src/lib/components/xml-tags/index.ts → lib/components/xml-tags/index.d.ts} +8 -8
  66. package/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.d.ts +17 -0
  67. package/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.d.ts +10 -0
  68. package/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.d.ts +10 -0
  69. package/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.d.ts +7 -0
  70. package/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.d.ts +10 -0
  71. package/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.d.ts +7 -0
  72. package/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.d.ts +10 -0
  73. package/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.d.ts +8 -0
  74. package/lib/croco-html.module.d.ts +60 -0
  75. package/lib/extensions/AngularMaterialTableMethods.d.ts +10 -0
  76. package/lib/extensions/BodyTagsExtensions.d.ts +10 -0
  77. package/lib/extensions/BootstrapTableMethods.d.ts +9 -0
  78. package/lib/extensions/HtmlExtractionMethods.d.ts +69 -0
  79. package/lib/extensions/HtmlRawTagDataConsts.d.ts +3 -0
  80. package/lib/extensions/ImageMethods.d.ts +17 -0
  81. package/lib/extensions/InterfaceBlock.d.ts +4 -0
  82. package/lib/extensions/TableBuilder.d.ts +5 -0
  83. package/lib/extensions/TableMethods.d.ts +58 -0
  84. package/lib/extensions/TextMethods.d.ts +19 -0
  85. package/lib/extensions/TextSimpleMethods.d.ts +23 -0
  86. package/lib/extensions/VideoMethods.d.ts +19 -0
  87. package/lib/extensions/XmlExtensions.d.ts +5 -0
  88. package/lib/extensions/index.d.ts +10 -0
  89. package/lib/index.d.ts +20 -0
  90. package/{src/lib/models/models.ts → lib/models/models.d.ts} +1 -2
  91. package/lib/pipes/RichTextToHtmlPipe.d.ts +8 -0
  92. package/lib/pipes/TagToSpanPipe.d.ts +7 -0
  93. package/lib/pipes/ToHtmlBodyTagsPipe.d.ts +8 -0
  94. package/{src/lib/pipes/index.ts → lib/pipes/index.d.ts} +0 -0
  95. package/lib/pipes/to-preview.pipe.d.ts +8 -0
  96. package/lib/services/file-upload.service.d.ts +23 -0
  97. package/lib/services/files-query.service.d.ts +42 -0
  98. package/package.json +34 -14
  99. package/{src/public-api.ts → public-api.d.ts} +0 -4
  100. package/karma.conf.js +0 -44
  101. package/ng-package.json +0 -7
  102. package/src/lib/components/add-files-btn/add-files-btn.component.css +0 -0
  103. package/src/lib/components/add-files-btn/add-files-btn.component.html +0 -14
  104. package/src/lib/components/add-files-btn/add-files-btn.component.ts +0 -61
  105. package/src/lib/components/editor/external-video-block/external-video-block.component.css +0 -0
  106. package/src/lib/components/editor/external-video-block/external-video-block.component.html +0 -27
  107. package/src/lib/components/editor/external-video-block/external-video-block.component.ts +0 -45
  108. package/src/lib/components/editor/html-raw-editor/html-raw-editor.component.css +0 -0
  109. package/src/lib/components/editor/html-raw-editor/html-raw-editor.component.html +0 -17
  110. package/src/lib/components/editor/html-raw-editor/html-raw-editor.component.ts +0 -22
  111. package/src/lib/components/editor/image-editor/image-editor.component.css +0 -7
  112. package/src/lib/components/editor/image-editor/image-editor.component.html +0 -54
  113. package/src/lib/components/editor/image-editor/image-editor.component.ts +0 -52
  114. package/src/lib/components/editor/index.ts +0 -7
  115. package/src/lib/components/editor/main-editor/main-editor.component.css +0 -48
  116. package/src/lib/components/editor/main-editor/main-editor.component.html +0 -39
  117. package/src/lib/components/editor/main-editor/main-editor.component.ts +0 -71
  118. package/src/lib/components/editor/main-editor-block/main-editor-block.component.css +0 -0
  119. package/src/lib/components/editor/main-editor-block/main-editor-block.component.html +0 -41
  120. package/src/lib/components/editor/main-editor-block/main-editor-block.component.ts +0 -39
  121. package/src/lib/components/editor/text-editor/text-editor.component.css +0 -0
  122. package/src/lib/components/editor/text-editor/text-editor.component.html +0 -39
  123. package/src/lib/components/editor/text-editor/text-editor.component.ts +0 -30
  124. package/src/lib/components/editor/visual-editor/visual-editor.component.css +0 -48
  125. package/src/lib/components/editor/visual-editor/visual-editor.component.html +0 -84
  126. package/src/lib/components/editor/visual-editor/visual-editor.component.ts +0 -180
  127. package/src/lib/components/file-id-select/file-id-select.component.css +0 -0
  128. package/src/lib/components/file-id-select/file-id-select.component.html +0 -39
  129. package/src/lib/components/file-id-select/file-id-select.component.ts +0 -75
  130. package/src/lib/components/index.ts +0 -5
  131. package/src/lib/components/upload-files-btn/upload-files-btn.component.css +0 -0
  132. package/src/lib/components/upload-files-btn/upload-files-btn.component.html +0 -2
  133. package/src/lib/components/upload-files-btn/upload-files-btn.component.ts +0 -57
  134. package/src/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.css +0 -15
  135. package/src/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.html +0 -8
  136. package/src/lib/components/xml-tags/xml-tag-external-video/xml-tag-external-video.component.ts +0 -59
  137. package/src/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.css +0 -0
  138. package/src/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.html +0 -18
  139. package/src/lib/components/xml-tags/xml-tag-header-inner-text-view/xml-tag-header-inner-text-view.component.ts +0 -19
  140. package/src/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.css +0 -0
  141. package/src/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.html +0 -25
  142. package/src/lib/components/xml-tags/xml-tag-header-text-view/xml-tag-header-text-view.component.ts +0 -19
  143. package/src/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.css +0 -0
  144. package/src/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.html +0 -3
  145. package/src/lib/components/xml-tags/xml-tag-html-view/xml-tag-html-view.component.ts +0 -14
  146. package/src/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.css +0 -0
  147. package/src/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.html +0 -2
  148. package/src/lib/components/xml-tags/xml-tag-rich-text-view/xml-tag-rich-text-view.component.ts +0 -19
  149. package/src/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.css +0 -0
  150. package/src/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.html +0 -9
  151. package/src/lib/components/xml-tags/xml-tag-table-view/xml-tag-table-view.component.ts +0 -15
  152. package/src/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.css +0 -0
  153. package/src/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.html +0 -21
  154. package/src/lib/components/xml-tags/xml-tag-text-view/xml-tag-text-view.component.ts +0 -18
  155. package/src/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.css +0 -4
  156. package/src/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.html +0 -44
  157. package/src/lib/components/xml-tags/xml-tag-view/xml-tag-view.component.ts +0 -17
  158. package/src/lib/croco-html.module.ts +0 -22
  159. package/src/lib/extensions/AngularMaterialTableMethods.ts +0 -87
  160. package/src/lib/extensions/BodyTagsExtensions.ts +0 -151
  161. package/src/lib/extensions/BootstrapTableMethods.ts +0 -87
  162. package/src/lib/extensions/HtmlExtractionMethods.ts +0 -78
  163. package/src/lib/extensions/HtmlRawTagDataConsts.ts +0 -3
  164. package/src/lib/extensions/ImageMethods.ts +0 -37
  165. package/src/lib/extensions/InterfaceBlock.ts +0 -5
  166. package/src/lib/extensions/TableBuilder.ts +0 -50
  167. package/src/lib/extensions/TableMethods.ts +0 -175
  168. package/src/lib/extensions/TextMethods.ts +0 -51
  169. package/src/lib/extensions/TextSimpleMethods.ts +0 -120
  170. package/src/lib/extensions/VideoMethods.ts +0 -31
  171. package/src/lib/extensions/XmlExtensions.ts +0 -26
  172. package/src/lib/extensions/index.ts +0 -12
  173. package/src/lib/index.ts +0 -119
  174. package/src/lib/pipes/RichTextToHtmlPipe.ts +0 -25
  175. package/src/lib/pipes/TagToSpanPipe.ts +0 -10
  176. package/src/lib/pipes/ToHtmlBodyTagsPipe.ts +0 -14
  177. package/src/lib/pipes/to-preview.pipe.ts +0 -12
  178. package/src/lib/services/file-upload.service.ts +0 -56
  179. package/src/lib/services/files-query.service.ts +0 -72
  180. package/src/test.ts +0 -28
  181. package/tsconfig.lib.json +0 -20
  182. package/tsconfig.lib.prod.json +0 -10
  183. package/tsconfig.spec.json +0 -17
package/src/lib/index.ts DELETED
@@ -1,119 +0,0 @@
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,25 +0,0 @@
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
- }
@@ -1,10 +0,0 @@
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
- }
@@ -1,14 +0,0 @@
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,12 +0,0 @@
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
- }
@@ -1,56 +0,0 @@
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
- }
@@ -1,72 +0,0 @@
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
- }
package/src/test.ts DELETED
@@ -1,28 +0,0 @@
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);
package/tsconfig.lib.json DELETED
@@ -1,20 +0,0 @@
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
- }
@@ -1,10 +0,0 @@
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
- }
@@ -1,17 +0,0 @@
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
- }