sk-front-lib 0.18.5 → 0.19.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 (182) hide show
  1. package/article/sk-article-editor-server.component.d.ts +1 -1
  2. package/article/sk-article-editor.component.d.ts +1 -1
  3. package/article/sk-froala-editor.directive.d.ts +1 -1
  4. package/crud/sk-auth-admin.guard.d.ts +2 -2
  5. package/crud/sk-auth.guard.d.ts +2 -2
  6. package/{esm2022 → esm2020}/api/sk-api.module.mjs +9 -9
  7. package/{esm2022 → esm2020}/api/sk-api.service.mjs +4 -4
  8. package/{esm2022 → esm2020}/article/sk-article-editor-server.component.mjs +4 -4
  9. package/{esm2022 → esm2020}/article/sk-article-editor.component.mjs +4 -4
  10. package/{esm2022 → esm2020}/article/sk-article-server.module.mjs +5 -5
  11. package/{esm2022 → esm2020}/article/sk-article.module.mjs +7 -7
  12. package/{esm2022 → esm2020}/article/sk-article.service.mjs +4 -4
  13. package/{esm2022 → esm2020}/article/sk-froala-editor.directive.mjs +7 -7
  14. package/{esm2022 → esm2020}/crud/sk-account.service.mjs +4 -4
  15. package/{esm2022 → esm2020}/crud/sk-affiliate.service.mjs +4 -4
  16. package/{esm2022 → esm2020}/crud/sk-auth-admin.guard.mjs +4 -4
  17. package/{esm2022 → esm2020}/crud/sk-auth.guard.mjs +4 -4
  18. package/{esm2022 → esm2020}/crud/sk-auth.service.mjs +7 -7
  19. package/{esm2022 → esm2020}/crud/sk-board.service.mjs +4 -4
  20. package/{esm2022 → esm2020}/crud/sk-brand.service.mjs +4 -4
  21. package/esm2020/crud/sk-cart.service.mjs +256 -0
  22. package/{esm2022 → esm2020}/crud/sk-category.service.mjs +4 -4
  23. package/{esm2022 → esm2020}/crud/sk-comment.service.mjs +4 -4
  24. package/{esm2022 → esm2020}/crud/sk-config.service.mjs +4 -4
  25. package/{esm2022 → esm2020}/crud/sk-contact.service.mjs +4 -4
  26. package/{esm2022 → esm2020}/crud/sk-coupon.service.mjs +4 -4
  27. package/{esm2022 → esm2020}/crud/sk-document.service.mjs +4 -4
  28. package/{esm2022 → esm2020}/crud/sk-etc.service.mjs +4 -4
  29. package/{esm2022 → esm2020}/crud/sk-file.service.mjs +4 -4
  30. package/{esm2022 → esm2020}/crud/sk-keyword.service.mjs +4 -4
  31. package/{esm2022 → esm2020}/crud/sk-order.service.mjs +4 -4
  32. package/{esm2022 → esm2020}/crud/sk-point.service.mjs +4 -4
  33. package/{esm2022 → esm2020}/crud/sk-product.service.mjs +4 -4
  34. package/{esm2022 → esm2020}/crud/sk-promotion.service.mjs +4 -4
  35. package/{esm2022 → esm2020}/crud/sk-search.service.mjs +4 -4
  36. package/{esm2022 → esm2020}/crud/sk-store.service.mjs +4 -4
  37. package/{esm2022 → esm2020}/crud/sk-user.service.mjs +4 -4
  38. package/{esm2022 → esm2020}/google-analytics/google-analytics-router.module.mjs +9 -9
  39. package/{esm2022 → esm2020}/google-analytics/google-analytics.module.mjs +5 -5
  40. package/esm2020/google-analytics/services/google-analytics.service.mjs +200 -0
  41. package/{esm2022 → esm2020}/image/sk-image.component.mjs +6 -6
  42. package/esm2020/image/sk-image.module.mjs +40 -0
  43. package/{esm2022 → esm2020}/lib/sk-byte.pipe.mjs +4 -4
  44. package/{esm2022 → esm2020}/lib/sk-date-time.pipe.mjs +4 -4
  45. package/{esm2022 → esm2020}/lib/sk-date.pipe.mjs +4 -4
  46. package/{esm2022 → esm2020}/lib/sk-front-lib.module.mjs +13 -13
  47. package/{esm2022 → esm2020}/lib/sk-keys.pipe.mjs +4 -4
  48. package/{esm2022 → esm2020}/lib/sk-time.pipe.mjs +4 -4
  49. package/{esm2022 → esm2020}/model/lib/coupon.mjs +1 -1
  50. package/esm2020/model/lib/filetype.mjs +179 -0
  51. package/esm2020/model/lib/payment.mjs +35 -0
  52. package/esm2020/model/lib/tosspay.mjs +61 -0
  53. package/{esm2022 → esm2020}/model/public_api.mjs +2 -1
  54. package/esm2020/search-address/dialog/dialog.component.mjs +27 -0
  55. package/{esm2022 → esm2020}/search-address/sk-search-address.directive.mjs +6 -6
  56. package/esm2020/search-address/sk-search-address.module.mjs +47 -0
  57. package/{esm2022 → esm2020}/search-address/sk-search-address.service.mjs +4 -4
  58. package/esm2020/uploader/sk-uploader.component.mjs +120 -0
  59. package/esm2020/uploader/sk-uploader.directive.mjs +44 -0
  60. package/esm2020/uploader/sk-uploader.module.mjs +57 -0
  61. package/fesm2015/sk-front-lib-api.mjs +216 -0
  62. package/fesm2015/sk-front-lib-api.mjs.map +1 -0
  63. package/fesm2015/sk-front-lib-article.mjs +758 -0
  64. package/fesm2015/sk-front-lib-article.mjs.map +1 -0
  65. package/fesm2015/sk-front-lib-crud.mjs +1529 -0
  66. package/fesm2015/sk-front-lib-crud.mjs.map +1 -0
  67. package/fesm2015/sk-front-lib-google-analytics.mjs +334 -0
  68. package/fesm2015/sk-front-lib-google-analytics.mjs.map +1 -0
  69. package/fesm2015/sk-front-lib-image.mjs +303 -0
  70. package/fesm2015/sk-front-lib-image.mjs.map +1 -0
  71. package/{fesm2022 → fesm2015}/sk-front-lib-model.mjs +123 -57
  72. package/fesm2015/sk-front-lib-model.mjs.map +1 -0
  73. package/fesm2015/sk-front-lib-search-address.mjs +183 -0
  74. package/fesm2015/sk-front-lib-search-address.mjs.map +1 -0
  75. package/fesm2015/sk-front-lib-uploader.mjs +546 -0
  76. package/fesm2015/sk-front-lib-uploader.mjs.map +1 -0
  77. package/{fesm2022 → fesm2015}/sk-front-lib.mjs +27 -27
  78. package/{fesm2022 → fesm2015}/sk-front-lib.mjs.map +1 -1
  79. package/{fesm2022 → fesm2020}/sk-front-lib-api.mjs +11 -11
  80. package/{fesm2022 → fesm2020}/sk-front-lib-api.mjs.map +1 -1
  81. package/{fesm2022 → fesm2020}/sk-front-lib-article.mjs +25 -25
  82. package/{fesm2022 → fesm2020}/sk-front-lib-article.mjs.map +1 -1
  83. package/{fesm2022 → fesm2020}/sk-front-lib-crud.mjs +93 -93
  84. package/fesm2020/sk-front-lib-crud.mjs.map +1 -0
  85. package/{fesm2022 → fesm2020}/sk-front-lib-google-analytics.mjs +16 -38
  86. package/fesm2020/sk-front-lib-google-analytics.mjs.map +1 -0
  87. package/{fesm2022 → fesm2020}/sk-front-lib-image.mjs +21 -21
  88. package/fesm2020/sk-front-lib-image.mjs.map +1 -0
  89. package/fesm2020/sk-front-lib-model.mjs +1171 -0
  90. package/fesm2020/sk-front-lib-model.mjs.map +1 -0
  91. package/{fesm2022 → fesm2020}/sk-front-lib-search-address.mjs +32 -32
  92. package/fesm2020/sk-front-lib-search-address.mjs.map +1 -0
  93. package/{fesm2022 → fesm2020}/sk-front-lib-uploader.mjs +49 -48
  94. package/fesm2020/sk-front-lib-uploader.mjs.map +1 -0
  95. package/fesm2020/sk-front-lib.mjs +538 -0
  96. package/fesm2020/sk-front-lib.mjs.map +1 -0
  97. package/google-analytics/services/google-analytics.service.d.ts +1 -2
  98. package/google-analytics/types/ga-action.type.d.ts +1 -1
  99. package/google-analytics/types/ga-bind.type.d.ts +1 -1
  100. package/image/sk-image.component.d.ts +2 -2
  101. package/image/sk-image.module.d.ts +3 -3
  102. package/model/lib/coupon.d.ts +0 -2
  103. package/model/lib/payment.d.ts +6 -1
  104. package/model/lib/tosspay.d.ts +29 -0
  105. package/model/public_api.d.ts +1 -0
  106. package/package.json +66 -44
  107. package/search-address/dialog/dialog.component.d.ts +1 -1
  108. package/search-address/sk-search-address.directive.d.ts +2 -2
  109. package/search-address/sk-search-address.module.d.ts +3 -3
  110. package/uploader/sk-uploader.component.d.ts +1 -1
  111. package/uploader/sk-uploader.directive.d.ts +2 -2
  112. package/uploader/sk-uploader.module.d.ts +5 -5
  113. package/esm2022/crud/sk-cart.service.mjs +0 -256
  114. package/esm2022/google-analytics/services/google-analytics.service.mjs +0 -223
  115. package/esm2022/image/sk-image.module.mjs +0 -40
  116. package/esm2022/model/lib/filetype.mjs +0 -179
  117. package/esm2022/model/lib/payment.mjs +0 -30
  118. package/esm2022/search-address/dialog/dialog.component.mjs +0 -27
  119. package/esm2022/search-address/sk-search-address.module.mjs +0 -47
  120. package/esm2022/uploader/sk-uploader.component.mjs +0 -119
  121. package/esm2022/uploader/sk-uploader.directive.mjs +0 -44
  122. package/esm2022/uploader/sk-uploader.module.mjs +0 -57
  123. package/fesm2022/sk-front-lib-crud.mjs.map +0 -1
  124. package/fesm2022/sk-front-lib-google-analytics.mjs.map +0 -1
  125. package/fesm2022/sk-front-lib-image.mjs.map +0 -1
  126. package/fesm2022/sk-front-lib-model.mjs.map +0 -1
  127. package/fesm2022/sk-front-lib-search-address.mjs.map +0 -1
  128. package/fesm2022/sk-front-lib-uploader.mjs.map +0 -1
  129. /package/{esm2022 → esm2020}/api/model/api-config.mjs +0 -0
  130. /package/{esm2022 → esm2020}/api/model/api-pageable-param.mjs +0 -0
  131. /package/{esm2022 → esm2020}/api/model/api-pageable.mjs +0 -0
  132. /package/{esm2022 → esm2020}/api/model/api-response.mjs +0 -0
  133. /package/{esm2022 → esm2020}/api/model/index.mjs +0 -0
  134. /package/{esm2022 → esm2020}/api/public_api.mjs +0 -0
  135. /package/{esm2022 → esm2020}/api/sk-front-lib-api.mjs +0 -0
  136. /package/{esm2022 → esm2020}/article/public_api.mjs +0 -0
  137. /package/{esm2022 → esm2020}/article/sk-front-lib-article.mjs +0 -0
  138. /package/{esm2022 → esm2020}/crud/public_api.mjs +0 -0
  139. /package/{esm2022 → esm2020}/crud/sk-front-lib-crud.mjs +0 -0
  140. /package/{esm2022 → esm2020}/google-analytics/initializers/google-analytics-router.initializer.mjs +0 -0
  141. /package/{esm2022 → esm2020}/google-analytics/initializers/google-analytics.initializer.mjs +0 -0
  142. /package/{esm2022 → esm2020}/google-analytics/interfaces/google-analytics-command.mjs +0 -0
  143. /package/{esm2022 → esm2020}/google-analytics/interfaces/google-analytics-settings.mjs +0 -0
  144. /package/{esm2022 → esm2020}/google-analytics/public_api.mjs +0 -0
  145. /package/{esm2022 → esm2020}/google-analytics/sk-front-lib-google-analytics.mjs +0 -0
  146. /package/{esm2022 → esm2020}/google-analytics/tokens/google-analytics-settings-token.mjs +0 -0
  147. /package/{esm2022 → esm2020}/google-analytics/types/ga-action.type.mjs +0 -0
  148. /package/{esm2022 → esm2020}/google-analytics/types/ga-bind.type.mjs +0 -0
  149. /package/{esm2022 → esm2020}/image/public_api.mjs +0 -0
  150. /package/{esm2022 → esm2020}/image/sk-front-lib-image.mjs +0 -0
  151. /package/{esm2022 → esm2020}/lib/sk-animations.mjs +0 -0
  152. /package/{esm2022 → esm2020}/lib/sk-utils.mjs +0 -0
  153. /package/{esm2022 → esm2020}/model/lib/article.mjs +0 -0
  154. /package/{esm2022 → esm2020}/model/lib/audit.mjs +0 -0
  155. /package/{esm2022 → esm2020}/model/lib/auth.mjs +0 -0
  156. /package/{esm2022 → esm2020}/model/lib/board.mjs +0 -0
  157. /package/{esm2022 → esm2020}/model/lib/cart.mjs +0 -0
  158. /package/{esm2022 → esm2020}/model/lib/comment.mjs +0 -0
  159. /package/{esm2022 → esm2020}/model/lib/contact.mjs +0 -0
  160. /package/{esm2022 → esm2020}/model/lib/document.mjs +0 -0
  161. /package/{esm2022 → esm2020}/model/lib/etc.mjs +0 -0
  162. /package/{esm2022 → esm2020}/model/lib/file.mjs +0 -0
  163. /package/{esm2022 → esm2020}/model/lib/grid.mjs +0 -0
  164. /package/{esm2022 → esm2020}/model/lib/nicepay.mjs +0 -0
  165. /package/{esm2022 → esm2020}/model/lib/order.mjs +0 -0
  166. /package/{esm2022 → esm2020}/model/lib/point.mjs +0 -0
  167. /package/{esm2022 → esm2020}/model/lib/product-series.mjs +0 -0
  168. /package/{esm2022 → esm2020}/model/lib/product.mjs +0 -0
  169. /package/{esm2022 → esm2020}/model/lib/promotion.mjs +0 -0
  170. /package/{esm2022 → esm2020}/model/lib/shipping.mjs +0 -0
  171. /package/{esm2022 → esm2020}/model/lib/user.mjs +0 -0
  172. /package/{esm2022 → esm2020}/model/sk-front-lib-model.mjs +0 -0
  173. /package/{esm2022 → esm2020}/public-api.mjs +0 -0
  174. /package/{esm2022 → esm2020}/search-address/public_api.mjs +0 -0
  175. /package/{esm2022 → esm2020}/search-address/sk-front-lib-search-address.mjs +0 -0
  176. /package/{esm2022 → esm2020}/search-address/sk-search-address.model.mjs +0 -0
  177. /package/{esm2022 → esm2020}/sk-front-lib.mjs +0 -0
  178. /package/{esm2022 → esm2020}/uploader/public_api.mjs +0 -0
  179. /package/{esm2022 → esm2020}/uploader/sk-front-lib-uploader.mjs +0 -0
  180. /package/{esm2022 → esm2020}/uploader/sk-uploader-file-item.model.mjs +0 -0
  181. /package/{esm2022 → esm2020}/uploader/sk-uploader.animation.mjs +0 -0
  182. /package/{esm2022 → esm2020}/uploader/sk-uploader.class.mjs +0 -0
@@ -0,0 +1,546 @@
1
+ import * as i3 from '@angular/common';
2
+ import { CommonModule } from '@angular/common';
3
+ import * as i0 from '@angular/core';
4
+ import { Component, ViewEncapsulation, Inject, ViewChild, HostListener, EventEmitter, Directive, Input, Output, NgModule } from '@angular/core';
5
+ import * as i5 from '@angular/material/legacy-button';
6
+ import { MatLegacyButtonModule } from '@angular/material/legacy-button';
7
+ import * as i1 from '@angular/material/legacy-dialog';
8
+ import { MAT_LEGACY_DIALOG_DATA, MatLegacyDialogModule } from '@angular/material/legacy-dialog';
9
+ import * as i6 from '@angular/material/icon';
10
+ import { MatIconModule } from '@angular/material/icon';
11
+ import * as i7 from '@angular/material/legacy-list';
12
+ import { MatLegacyListModule } from '@angular/material/legacy-list';
13
+ import * as i10 from '@angular/material/legacy-progress-bar';
14
+ import { MatLegacyProgressBarModule } from '@angular/material/legacy-progress-bar';
15
+ import * as i4 from '@angular/material/toolbar';
16
+ import { MatToolbarModule } from '@angular/material/toolbar';
17
+ import * as i11 from 'sk-front-lib';
18
+ import { SkFrontLibModule } from 'sk-front-lib';
19
+ import { FileType, SkFile } from 'sk-front-lib/model';
20
+ import { animation, style, animate, trigger, transition, useAnimation, query, stagger, animateChild } from '@angular/animations';
21
+ import { HttpRequest, HttpHeaders, HttpEventType } from '@angular/common/http';
22
+ import { of } from 'rxjs';
23
+ import { tap, last, map, catchError } from 'rxjs/operators';
24
+ import * as i2 from 'sk-front-lib/api';
25
+ import * as i8 from '@angular/material/core';
26
+ import * as i9 from '@angular/material/divider';
27
+ import * as _ from 'lodash';
28
+
29
+ var SkUploaderFileItemType;
30
+ (function (SkUploaderFileItemType) {
31
+ SkUploaderFileItemType[SkUploaderFileItemType["Local"] = 0] = "Local";
32
+ SkUploaderFileItemType[SkUploaderFileItemType["API"] = 1] = "API";
33
+ SkUploaderFileItemType[SkUploaderFileItemType["Unidentified"] = 2] = "Unidentified";
34
+ })(SkUploaderFileItemType || (SkUploaderFileItemType = {}));
35
+ var SkUploaderFileItemStatus;
36
+ (function (SkUploaderFileItemStatus) {
37
+ SkUploaderFileItemStatus[SkUploaderFileItemStatus["WAIT"] = 0] = "WAIT";
38
+ SkUploaderFileItemStatus[SkUploaderFileItemStatus["READY"] = 1] = "READY";
39
+ SkUploaderFileItemStatus[SkUploaderFileItemStatus["UPLOADING"] = 2] = "UPLOADING";
40
+ SkUploaderFileItemStatus[SkUploaderFileItemStatus["PROCESS"] = 3] = "PROCESS";
41
+ SkUploaderFileItemStatus[SkUploaderFileItemStatus["DONE"] = 4] = "DONE";
42
+ SkUploaderFileItemStatus[SkUploaderFileItemStatus["ERROR"] = 5] = "ERROR";
43
+ })(SkUploaderFileItemStatus || (SkUploaderFileItemStatus = {}));
44
+ class SkUploaderFileItem {
45
+ constructor(localFile, skFile) {
46
+ this.localFile = localFile;
47
+ this.skFile = skFile;
48
+ this.state = SkUploaderFileItemStatus.WAIT;
49
+ this.progress = 0;
50
+ if (this.localFile && !this.skFile) {
51
+ this.itemType = SkUploaderFileItemType.Local;
52
+ }
53
+ else if (!this.localFile && this.skFile) {
54
+ this.itemType = SkUploaderFileItemType.API;
55
+ this.state = SkUploaderFileItemStatus.DONE;
56
+ this.progress = 100;
57
+ }
58
+ else {
59
+ this.itemType = SkUploaderFileItemType.Unidentified;
60
+ }
61
+ }
62
+ get filename() {
63
+ if (this.itemType === SkUploaderFileItemType.Local) {
64
+ return this.localFile.name;
65
+ }
66
+ else if (this.itemType === SkUploaderFileItemType.API) {
67
+ return this.skFile.sourceFilename;
68
+ }
69
+ else {
70
+ return 'Unknown File';
71
+ }
72
+ }
73
+ get size() {
74
+ if (this.itemType === SkUploaderFileItemType.Local) {
75
+ return this.localFile.size;
76
+ }
77
+ else if (this.itemType === SkUploaderFileItemType.API) {
78
+ return this.skFile.fileSize;
79
+ }
80
+ else {
81
+ return -1;
82
+ }
83
+ }
84
+ get mime() {
85
+ if (this.itemType === SkUploaderFileItemType.Local) {
86
+ return this.localFile.type;
87
+ }
88
+ else if (this.itemType === SkUploaderFileItemType.API) {
89
+ return this.skFile.mime;
90
+ }
91
+ else {
92
+ return '';
93
+ }
94
+ }
95
+ get icon() {
96
+ if (this.itemType === SkUploaderFileItemType.Local) {
97
+ return FileType.getMimeClass(this.localFile);
98
+ }
99
+ else if (this.itemType === SkUploaderFileItemType.API) {
100
+ return FileType.getMimeClass(this.skFile);
101
+ }
102
+ else {
103
+ return 'application';
104
+ }
105
+ }
106
+ // -----------------------------------------------------------------------------------------------------
107
+ // @ Static Builder
108
+ // -----------------------------------------------------------------------------------------------------
109
+ static fromLocalFile(localFile) {
110
+ return new SkUploaderFileItem(localFile);
111
+ }
112
+ static fromApi(skFile) {
113
+ return new SkUploaderFileItem(null, skFile);
114
+ }
115
+ // -----------------------------------------------------------------------------------------------------
116
+ // @ State Method
117
+ // -----------------------------------------------------------------------------------------------------
118
+ prepareUpload() {
119
+ this.state = SkUploaderFileItemStatus.READY;
120
+ }
121
+ }
122
+
123
+ const customAnimation = animation([
124
+ style({
125
+ opacity: '{{opacity}}',
126
+ transform: 'scale({{scale}}) translate3d({{x}}, {{y}}, {{z}})'
127
+ }),
128
+ animate('{{duration}} {{delay}} cubic-bezier(0.0, 0.0, 0.2, 1)', style('*'))
129
+ ], {
130
+ params: {
131
+ duration: '200ms',
132
+ delay: '0ms',
133
+ opacity: '0',
134
+ scale: '1',
135
+ x: '0',
136
+ y: '0',
137
+ z: '0'
138
+ }
139
+ });
140
+ const customOutAnimation = animation([
141
+ style('*'),
142
+ animate('{{duration}} {{delay}} cubic-bezier(0.0, 0.0, 0.2, 1)', style({
143
+ opacity: '{{opacity}}',
144
+ transform: 'scale({{scale}}) translate3d({{x}}, {{y}}, {{z}})'
145
+ }))
146
+ ], {
147
+ params: {
148
+ duration: '200ms',
149
+ delay: '0ms',
150
+ opacity: '0',
151
+ scale: '1',
152
+ x: '0',
153
+ y: '0',
154
+ z: '0'
155
+ }
156
+ });
157
+ const uploaderAnimations = [
158
+ trigger('animate', [transition('void => *', [useAnimation(customAnimation)])]),
159
+ trigger('animateOut', [transition('* => void', [useAnimation(customOutAnimation)])]),
160
+ trigger('animateStagger', [
161
+ transition('* => *', query('@*', [
162
+ stagger('100ms', [
163
+ animateChild()
164
+ ])
165
+ ], { optional: true })),
166
+ ]),
167
+ ];
168
+
169
+ class SkFileUploader {
170
+ constructor(apiService, options, selectedFiles = []) {
171
+ this.apiService = apiService;
172
+ this.queue = [];
173
+ this.progress = 0;
174
+ this.options = {
175
+ autoUpload: false,
176
+ filters: [],
177
+ maxFileSize: 2 * 1024 * 1024 * 1024,
178
+ queueLimit: 1,
179
+ asyncLimit: 2,
180
+ };
181
+ this.setOptions(options);
182
+ this.setSelectedFiles(selectedFiles);
183
+ }
184
+ // -----------------------------------------------------------------------------------------------------
185
+ // @ Data Accessor
186
+ // -----------------------------------------------------------------------------------------------------
187
+ // -----------------------------------------------------------------------------------------------------
188
+ // @ Uploader - Public methods
189
+ // -----------------------------------------------------------------------------------------------------
190
+ setOptions(options) {
191
+ this.options = Object.assign(this.options, options);
192
+ this.options.filters.unshift({ name: 'queueLimit', fn: this._queueLimitFilter });
193
+ if (this.options.maxFileSize) {
194
+ this.options.filters.unshift({ name: 'fileSize', fn: this._fileSizeFilter });
195
+ }
196
+ if (this.options.allowedFileType) {
197
+ this.options.filters.unshift({ name: 'fileType', fn: this._fileTypeFilter });
198
+ }
199
+ if (this.options.allowedMimeType) {
200
+ this.options.filters.unshift({ name: 'mimeType', fn: this._mimeTypeFilter });
201
+ }
202
+ }
203
+ setSelectedFiles(files) {
204
+ const items = files.map(file => SkUploaderFileItem.fromApi(file));
205
+ this.addToQueue(items);
206
+ }
207
+ addToQueue(files, filters) {
208
+ const arrayOfFilters = this._getFilters(filters);
209
+ files.forEach(item => {
210
+ if (this._isValidFile(item, arrayOfFilters, this.options) && !this._findByFilenameInQueue(item.filename)) {
211
+ this.queue.push(item);
212
+ }
213
+ });
214
+ this.updateProgress();
215
+ }
216
+ removeFromQueue(file) {
217
+ const index = this.queue.findIndex(value => value.filename === file.filename);
218
+ this.queue.splice(index, 1);
219
+ this.updateProgress();
220
+ }
221
+ clearQueue() {
222
+ while (this.queue.length) {
223
+ this.removeFromQueue(this.queue[0]);
224
+ }
225
+ this.progress = 0;
226
+ }
227
+ upload(item) {
228
+ this._processUpload(item);
229
+ }
230
+ uploadAll() {
231
+ const targetItems = this.getNotUploadedItems();
232
+ targetItems.forEach(item => {
233
+ item.prepareUpload();
234
+ });
235
+ if (targetItems.length > 0) {
236
+ const max = Math.min(targetItems.length, this.options.asyncLimit);
237
+ for (let i = 0; i < max; i++) {
238
+ this.upload(targetItems[i]);
239
+ }
240
+ }
241
+ }
242
+ // -----------------------------------------------------------------------------------------------------
243
+ // @ Private methods.
244
+ // -----------------------------------------------------------------------------------------------------
245
+ updateProgress() {
246
+ const uploaded = this.getDoneItems().length;
247
+ const current = uploaded / this.queue.length * 100;
248
+ this.progress = Math.ceil(current);
249
+ }
250
+ // -----------------------------------------------------------------------------------------------------
251
+ // @ Uploader - Filters
252
+ // -----------------------------------------------------------------------------------------------------
253
+ _isValidFile(file, filters, options) {
254
+ this._failFilterIndex = -1;
255
+ return !filters.length ? true : filters.every((filter) => {
256
+ this._failFilterIndex++;
257
+ return filter.fn.call(this, file, options);
258
+ });
259
+ }
260
+ _getFilters(filters) {
261
+ if (!filters) {
262
+ return this.options.filters;
263
+ }
264
+ if (Array.isArray(filters)) {
265
+ return filters;
266
+ }
267
+ if (typeof filters === 'string') {
268
+ const names = filters.match(/[^\s,]+/g);
269
+ return this.options.filters
270
+ .filter((filter) => names.indexOf(filter.name) !== -1);
271
+ }
272
+ return this.options.filters;
273
+ }
274
+ _queueLimitFilter() {
275
+ return this.options.queueLimit === undefined || this.queue.length < this.options.queueLimit;
276
+ }
277
+ _mimeTypeFilter(item) {
278
+ return !(this.options.allowedMimeType && this.options.allowedMimeType.indexOf(item.mime) === -1);
279
+ }
280
+ _fileSizeFilter(item) {
281
+ return !(this.options.maxFileSize && item.size > this.options.maxFileSize);
282
+ }
283
+ _fileTypeFilter(item) {
284
+ return !(this.options.allowedFileType &&
285
+ this.options.allowedFileType.indexOf(FileType.getMimeClass(item.localFile ? item.localFile : item.skFile)) === -1);
286
+ }
287
+ // -----------------------------------------------------------------------------------------------------
288
+ // @ Uploader - Upload biz logic
289
+ // -----------------------------------------------------------------------------------------------------
290
+ _processUpload(item) {
291
+ if (item.state !== SkUploaderFileItemStatus.READY) {
292
+ return;
293
+ }
294
+ const formData = new FormData();
295
+ formData.append('file', item.localFile, item.filename);
296
+ const request = new HttpRequest('POST', this.apiService.apiServer + '/api/public/files/upload', formData, {
297
+ reportProgress: true,
298
+ headers: new HttpHeaders().set('Authorization', 'Bearer ' + this.apiService.getToken()).set('ngsw-bypass', 'true')
299
+ });
300
+ this.apiService.rawRequest(request).pipe(tap(event => {
301
+ switch (event.type) {
302
+ case HttpEventType.UploadProgress:
303
+ // Compute and show the % done:
304
+ const percentDone = Math.ceil(100 * event.loaded / event.total);
305
+ item.progress = percentDone;
306
+ if (item.progress >= 99) {
307
+ item.state = SkUploaderFileItemStatus.PROCESS;
308
+ }
309
+ else {
310
+ item.state = SkUploaderFileItemStatus.UPLOADING;
311
+ }
312
+ return;
313
+ case HttpEventType.Response:
314
+ item.state = SkUploaderFileItemStatus.DONE;
315
+ return;
316
+ default:
317
+ return;
318
+ }
319
+ }), last(), // return last (completed) message to caller
320
+ map((result) => result.body.data ? new SkFile(result.body.data) : null), catchError(err => {
321
+ console.log(err);
322
+ item.state = SkUploaderFileItemStatus.ERROR;
323
+ return of(null);
324
+ })).subscribe(result => {
325
+ if (result instanceof SkFile) {
326
+ item.skFile = result;
327
+ }
328
+ this.updateProgress();
329
+ const nextItems = this.getReadyItems();
330
+ if (nextItems.length > 0) {
331
+ this.upload(nextItems[0]);
332
+ }
333
+ });
334
+ }
335
+ // -----------------------------------------------------------------------------------------------------
336
+ // @ Data Handlers
337
+ // -----------------------------------------------------------------------------------------------------
338
+ _findByFilenameInQueue(name) {
339
+ return this.queue.findIndex(value => value.filename === name) > -1;
340
+ }
341
+ getNotUploadedItems() {
342
+ return this.queue.filter((item) => item.state === SkUploaderFileItemStatus.WAIT);
343
+ }
344
+ getReadyItems() {
345
+ return this.queue.filter((item) => item.state === SkUploaderFileItemStatus.READY);
346
+ }
347
+ getDoneItems() {
348
+ return this.queue.filter((item) => item.state === SkUploaderFileItemStatus.DONE);
349
+ }
350
+ }
351
+
352
+ class SkUploaderComponent {
353
+ constructor(data, dialogRef, _apiService) {
354
+ this.data = data;
355
+ this.dialogRef = dialogRef;
356
+ this._apiService = _apiService;
357
+ this.dragClassActive = false;
358
+ this.uploader = new SkFileUploader(this._apiService, data.options, data.selectedFile);
359
+ }
360
+ static _getTransfer(event) {
361
+ return event.dataTransfer ? event.dataTransfer : event.originalEvent.dataTransfer;
362
+ }
363
+ static _haveFiles(types) {
364
+ if (!types) {
365
+ return false;
366
+ }
367
+ if (types.indexOf) {
368
+ return types.indexOf('Files') !== -1;
369
+ }
370
+ else if (types.contains) {
371
+ return types.contains('Files');
372
+ }
373
+ else {
374
+ return false;
375
+ }
376
+ }
377
+ ngOnInit() {
378
+ }
379
+ save() {
380
+ this.dialogRef.close(this.uploader.getDoneItems());
381
+ }
382
+ onDrop(event) {
383
+ const transfer = SkUploaderComponent._getTransfer(event);
384
+ if (!transfer) {
385
+ return;
386
+ }
387
+ this.preventAndStop(event);
388
+ this.fileAdd(transfer.files);
389
+ this.dragClassActive = false;
390
+ }
391
+ onDragOver(event) {
392
+ const transfer = SkUploaderComponent._getTransfer(event);
393
+ if (!SkUploaderComponent._haveFiles(transfer.types)) {
394
+ return;
395
+ }
396
+ this.preventAndStop(event);
397
+ this.dragClassActive = true;
398
+ }
399
+ onDragLeave(event) {
400
+ if (event.relatedTarget === this.dragEl.nativeElement) {
401
+ return;
402
+ }
403
+ this.preventAndStop(event);
404
+ this.dragClassActive = false;
405
+ }
406
+ // File methods
407
+ // onFile
408
+ fileAdd(files) {
409
+ if (!(files instanceof FileList)) {
410
+ return;
411
+ }
412
+ const list = [];
413
+ for (let i = 0; i < files.length; i++) {
414
+ list.push(SkUploaderFileItem.fromLocalFile(files.item(i)));
415
+ }
416
+ this.uploader.addToQueue(list);
417
+ }
418
+ onBrowseFileComplete() {
419
+ const files = this.fileEl.nativeElement.files;
420
+ this.fileAdd(files);
421
+ }
422
+ onDragComponentClick() {
423
+ this.fileEl.nativeElement.click();
424
+ }
425
+ preventAndStop(event) {
426
+ event.preventDefault();
427
+ event.stopPropagation();
428
+ }
429
+ }
430
+ SkUploaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SkUploaderComponent, deps: [{ token: MAT_LEGACY_DIALOG_DATA }, { token: i1.MatLegacyDialogRef }, { token: i2.SkApiService }], target: i0.ɵɵFactoryTarget.Component });
431
+ SkUploaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: SkUploaderComponent, selector: "sk-uploader", host: { listeners: { "drop": "onDrop($event)", "dragover": "onDragOver($event)", "dragleave": "onDragLeave($event)" } }, viewQueries: [{ propertyName: "fileEl", first: true, predicate: ["file"], descendants: true }, { propertyName: "dragEl", first: true, predicate: ["drag"], descendants: true }], ngImport: i0, template: "<mat-toolbar class=\"dialog-title\" color=\"primary\">\n <span class=\"title dialog-title\">File Uploader</span>\n <div class=\"space-fill\"></div>\n <button mat-icon-button mat-dialog-close aria-label=\"Close dialog\">\n <mat-icon>close</mat-icon>\n </button>\n</mat-toolbar>\n<div class=\"dialog-content\">\n <input type=\"file\" style=\"display: none\" #file (change)=\"onBrowseFileComplete()\" multiple />\n <div class=\"drag-section\" #drag (click)=\"onDragComponentClick()\" [class.active]=\"dragClassActive\">\n <mat-icon>cloud_upload</mat-icon>\n <p>Drag and drop or <strong>click to browse</strong></p>\n </div>\n <mat-list [@animateStagger]=\"{value:uploader.queue.length}\">\n <h3 mat-subheader>Selected Files ({{uploader.queue.length}})</h3>\n <mat-list-item class=\"selected-file\" *ngFor=\"let file of uploader.queue\"\n [@animate]=\"{value:'*',params:{x:'-25px', opacity:'0',duration:'200ms'}}\"\n [@animateOut]=\"{value:'*',params:{delay:'100ms',x:'-25px', opacity:'0',duration:'200ms'}}\"\n dense>\n <mat-icon class=\"type-icon\" [ngClass]=\"file.icon\" matListIcon></mat-icon>\n <div mat-line>\n <span class=\"file-name\">{{ file.filename }}</span>\n <span>{{ file.size | skByte }}</span>\n </div>\n <mat-progress-bar mat-line [mode]=\"file.state == 3 ? 'query' : 'determinate'\" [value]=\"file.progress\" color=\"accent\"></mat-progress-bar>\n <div mat-line>\n <ng-container [ngSwitch]=\"file.state\">\n <div *ngSwitchCase=\"0\">\n Selected\n </div>\n <div *ngSwitchCase=\"1\">\n Wait for upload\n </div>\n <div *ngSwitchCase=\"2\">\n Uploading\n </div>\n <div *ngSwitchCase=\"3\">\n Processing..\n </div>\n <div *ngSwitchCase=\"4\">\n Done.\n </div>\n <div *ngSwitchCase=\"5\">\n Failed\n </div>\n </ng-container>\n </div>\n <button mat-icon-button (click)=\"uploader.removeFromQueue(file)\">\n <mat-icon>delete</mat-icon>\n </button>\n </mat-list-item>\n <mat-divider *ngIf=\"uploader.queue.length === 0\"\n [@animate]=\"{value:'*',params:{delay: '300ms', opacity:'0',duration:'200ms'}}\"></mat-divider>\n <mat-list-item class=\"empty\" *ngIf=\"uploader.queue.length === 0\"\n [@animate]=\"{value:'*',params:{delay: '300ms', opacity:'0',duration:'200ms'}}\">\n <h2 mat-line>No file selected..</h2>\n </mat-list-item>\n </mat-list>\n</div>\n<mat-progress-bar mat-line mode=\"determinate\" [value]=\"uploader.progress\"></mat-progress-bar>\n<div class=\"dialog-actions\">\n <div>\n <button mat-flat-button color=\"warn\" (click)=\"uploader.clearQueue()\" [disabled]=\"uploader.queue.length === 0\">Clear all</button>\n </div>\n <div>\n <button mat-flat-button color=\"primary\"\n *ngIf=\"uploader.getNotUploadedItems().length > 0\"\n (click)=\"uploader.uploadAll()\">Start Upload</button>\n <button mat-flat-button color=\"accent\"\n *ngIf=\"uploader.getDoneItems().length === uploader.queue.length && uploader.getDoneItems().length > 0 \"\n style=\"margin-left: 8px\" (click)=\"save()\">Save</button>\n </div>\n</div>\n", styles: ["sk-uploader{display:flex;flex-direction:column;min-width:50vw;position:relative}sk-uploader .dialog-title{flex-shrink:0}sk-uploader .dialog-title .space-fill{flex:1 0 auto}sk-uploader .dialog-content{padding:16px;margin:0;overflow:scroll;overflow-x:hidden;flex:0 0 500px;max-height:500px}sk-uploader .dialog-content .drag-section{border:3px dashed #ccc;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:24px}sk-uploader .dialog-content .drag-section .mat-icon{width:64px;height:64px;line-height:64px;font-size:64px}sk-uploader .dialog-content .drag-section p{cursor:pointer;font-size:14px}sk-uploader .dialog-content .drag-section .mat-icon,sk-uploader .dialog-content .drag-section p{color:#ccc}sk-uploader .dialog-content .drag-section.active{position:absolute;inset:0;width:100%;z-index:10;background-color:#2c393f}sk-uploader .dialog-content mat-list mat-list-item.selected-file{box-shadow:0 2px 1px -1px #0003,0 1px 1px #00000024,0 1px 3px #0000001f;margin-bottom:8px}sk-uploader .dialog-content mat-list mat-list-item.selected-file .mat-list-icon,sk-uploader .dialog-content mat-list mat-list-item.selected-file mat-icon{width:32px!important;height:32px!important;line-height:32px!important;font-size:32px!important}sk-uploader .dialog-content mat-list mat-list-item.selected-file .mat-icon-button{margin-left:16px}sk-uploader .dialog-content mat-list mat-list-item.selected-file .mat-line{display:flex;flex-direction:row;align-items:center;justify-content:space-between}sk-uploader .dialog-content mat-list mat-list-item.selected-file .file-name{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}sk-uploader .dialog-actions{padding:16px;flex-shrink:0;border-top:1px solid rgba(0,0,0,.12);display:flex;justify-content:space-between}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i1.MatLegacyDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "component", type: i4.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "component", type: i5.MatLegacyButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i7.MatLegacyList, selector: "mat-list, mat-action-list", inputs: ["disableRipple", "disabled"], exportAs: ["matList"] }, { kind: "component", type: i7.MatLegacyListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["disableRipple", "disabled"], exportAs: ["matListItem"] }, { kind: "directive", type: i8.MatLine, selector: "[mat-line], [matLine]" }, { kind: "directive", type: i7.MatLegacyListIconCssMatStyler, selector: "[mat-list-icon], [matListIcon]" }, { kind: "directive", type: i7.MatLegacyListSubheaderCssMatStyler, selector: "[mat-subheader], [matSubheader]" }, { kind: "component", type: i9.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "component", type: i10.MatLegacyProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "pipe", type: i11.SkBytePipe, name: "skByte" }], animations: uploaderAnimations, encapsulation: i0.ViewEncapsulation.None });
432
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SkUploaderComponent, decorators: [{
433
+ type: Component,
434
+ args: [{ selector: 'sk-uploader', encapsulation: ViewEncapsulation.None, animations: uploaderAnimations, template: "<mat-toolbar class=\"dialog-title\" color=\"primary\">\n <span class=\"title dialog-title\">File Uploader</span>\n <div class=\"space-fill\"></div>\n <button mat-icon-button mat-dialog-close aria-label=\"Close dialog\">\n <mat-icon>close</mat-icon>\n </button>\n</mat-toolbar>\n<div class=\"dialog-content\">\n <input type=\"file\" style=\"display: none\" #file (change)=\"onBrowseFileComplete()\" multiple />\n <div class=\"drag-section\" #drag (click)=\"onDragComponentClick()\" [class.active]=\"dragClassActive\">\n <mat-icon>cloud_upload</mat-icon>\n <p>Drag and drop or <strong>click to browse</strong></p>\n </div>\n <mat-list [@animateStagger]=\"{value:uploader.queue.length}\">\n <h3 mat-subheader>Selected Files ({{uploader.queue.length}})</h3>\n <mat-list-item class=\"selected-file\" *ngFor=\"let file of uploader.queue\"\n [@animate]=\"{value:'*',params:{x:'-25px', opacity:'0',duration:'200ms'}}\"\n [@animateOut]=\"{value:'*',params:{delay:'100ms',x:'-25px', opacity:'0',duration:'200ms'}}\"\n dense>\n <mat-icon class=\"type-icon\" [ngClass]=\"file.icon\" matListIcon></mat-icon>\n <div mat-line>\n <span class=\"file-name\">{{ file.filename }}</span>\n <span>{{ file.size | skByte }}</span>\n </div>\n <mat-progress-bar mat-line [mode]=\"file.state == 3 ? 'query' : 'determinate'\" [value]=\"file.progress\" color=\"accent\"></mat-progress-bar>\n <div mat-line>\n <ng-container [ngSwitch]=\"file.state\">\n <div *ngSwitchCase=\"0\">\n Selected\n </div>\n <div *ngSwitchCase=\"1\">\n Wait for upload\n </div>\n <div *ngSwitchCase=\"2\">\n Uploading\n </div>\n <div *ngSwitchCase=\"3\">\n Processing..\n </div>\n <div *ngSwitchCase=\"4\">\n Done.\n </div>\n <div *ngSwitchCase=\"5\">\n Failed\n </div>\n </ng-container>\n </div>\n <button mat-icon-button (click)=\"uploader.removeFromQueue(file)\">\n <mat-icon>delete</mat-icon>\n </button>\n </mat-list-item>\n <mat-divider *ngIf=\"uploader.queue.length === 0\"\n [@animate]=\"{value:'*',params:{delay: '300ms', opacity:'0',duration:'200ms'}}\"></mat-divider>\n <mat-list-item class=\"empty\" *ngIf=\"uploader.queue.length === 0\"\n [@animate]=\"{value:'*',params:{delay: '300ms', opacity:'0',duration:'200ms'}}\">\n <h2 mat-line>No file selected..</h2>\n </mat-list-item>\n </mat-list>\n</div>\n<mat-progress-bar mat-line mode=\"determinate\" [value]=\"uploader.progress\"></mat-progress-bar>\n<div class=\"dialog-actions\">\n <div>\n <button mat-flat-button color=\"warn\" (click)=\"uploader.clearQueue()\" [disabled]=\"uploader.queue.length === 0\">Clear all</button>\n </div>\n <div>\n <button mat-flat-button color=\"primary\"\n *ngIf=\"uploader.getNotUploadedItems().length > 0\"\n (click)=\"uploader.uploadAll()\">Start Upload</button>\n <button mat-flat-button color=\"accent\"\n *ngIf=\"uploader.getDoneItems().length === uploader.queue.length && uploader.getDoneItems().length > 0 \"\n style=\"margin-left: 8px\" (click)=\"save()\">Save</button>\n </div>\n</div>\n", styles: ["sk-uploader{display:flex;flex-direction:column;min-width:50vw;position:relative}sk-uploader .dialog-title{flex-shrink:0}sk-uploader .dialog-title .space-fill{flex:1 0 auto}sk-uploader .dialog-content{padding:16px;margin:0;overflow:scroll;overflow-x:hidden;flex:0 0 500px;max-height:500px}sk-uploader .dialog-content .drag-section{border:3px dashed #ccc;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:24px}sk-uploader .dialog-content .drag-section .mat-icon{width:64px;height:64px;line-height:64px;font-size:64px}sk-uploader .dialog-content .drag-section p{cursor:pointer;font-size:14px}sk-uploader .dialog-content .drag-section .mat-icon,sk-uploader .dialog-content .drag-section p{color:#ccc}sk-uploader .dialog-content .drag-section.active{position:absolute;inset:0;width:100%;z-index:10;background-color:#2c393f}sk-uploader .dialog-content mat-list mat-list-item.selected-file{box-shadow:0 2px 1px -1px #0003,0 1px 1px #00000024,0 1px 3px #0000001f;margin-bottom:8px}sk-uploader .dialog-content mat-list mat-list-item.selected-file .mat-list-icon,sk-uploader .dialog-content mat-list mat-list-item.selected-file mat-icon{width:32px!important;height:32px!important;line-height:32px!important;font-size:32px!important}sk-uploader .dialog-content mat-list mat-list-item.selected-file .mat-icon-button{margin-left:16px}sk-uploader .dialog-content mat-list mat-list-item.selected-file .mat-line{display:flex;flex-direction:row;align-items:center;justify-content:space-between}sk-uploader .dialog-content mat-list mat-list-item.selected-file .file-name{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}sk-uploader .dialog-actions{padding:16px;flex-shrink:0;border-top:1px solid rgba(0,0,0,.12);display:flex;justify-content:space-between}\n"] }]
435
+ }], ctorParameters: function () {
436
+ return [{ type: undefined, decorators: [{
437
+ type: Inject,
438
+ args: [MAT_LEGACY_DIALOG_DATA]
439
+ }] }, { type: i1.MatLegacyDialogRef }, { type: i2.SkApiService }];
440
+ }, propDecorators: { fileEl: [{
441
+ type: ViewChild,
442
+ args: ['file', { static: false }]
443
+ }], dragEl: [{
444
+ type: ViewChild,
445
+ args: ['drag', { static: false }]
446
+ }], onDrop: [{
447
+ type: HostListener,
448
+ args: ['drop', ['$event']]
449
+ }], onDragOver: [{
450
+ type: HostListener,
451
+ args: ['dragover', ['$event']]
452
+ }], onDragLeave: [{
453
+ type: HostListener,
454
+ args: ['dragleave', ['$event']]
455
+ }] } });
456
+
457
+ class SkUploaderDirective {
458
+ constructor(_dialog) {
459
+ this._dialog = _dialog;
460
+ this.skUploaderFileSelected = new EventEmitter();
461
+ }
462
+ onClick() {
463
+ this._dialog.open(SkUploaderComponent, {
464
+ panelClass: 'mat-dialog-no-padding',
465
+ closeOnNavigation: true,
466
+ autoFocus: false,
467
+ data: {
468
+ options: this.skUploaderOptions,
469
+ selectedFile: !this.skSelected ? [] : (_.isArray(this.skSelected) ? this.skSelected : [this.skSelected])
470
+ }
471
+ }).afterClosed().subscribe((result) => {
472
+ if (result) {
473
+ this.skUploaderFileSelected.emit(result.map(item => item.skFile));
474
+ }
475
+ });
476
+ }
477
+ }
478
+ SkUploaderDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SkUploaderDirective, deps: [{ token: i1.MatLegacyDialog }], target: i0.ɵɵFactoryTarget.Directive });
479
+ SkUploaderDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: SkUploaderDirective, selector: "[skUploader]", inputs: { skUploaderOptions: "skUploaderOptions", skSelected: "skSelected" }, outputs: { skUploaderFileSelected: "skUploaderFileSelected" }, host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
480
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SkUploaderDirective, decorators: [{
481
+ type: Directive,
482
+ args: [{
483
+ selector: '[skUploader]'
484
+ }]
485
+ }], ctorParameters: function () { return [{ type: i1.MatLegacyDialog }]; }, propDecorators: { skUploaderOptions: [{
486
+ type: Input
487
+ }], skSelected: [{
488
+ type: Input
489
+ }], skUploaderFileSelected: [{
490
+ type: Output
491
+ }], onClick: [{
492
+ type: HostListener,
493
+ args: ['click']
494
+ }] } });
495
+
496
+ class SkUploaderModule {
497
+ }
498
+ SkUploaderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SkUploaderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
499
+ SkUploaderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: SkUploaderModule, declarations: [SkUploaderComponent,
500
+ SkUploaderDirective], imports: [CommonModule,
501
+ MatLegacyDialogModule,
502
+ MatToolbarModule,
503
+ MatLegacyButtonModule,
504
+ MatIconModule,
505
+ MatLegacyListModule,
506
+ MatLegacyProgressBarModule,
507
+ SkFrontLibModule], exports: [SkUploaderComponent,
508
+ SkUploaderDirective] });
509
+ SkUploaderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SkUploaderModule, imports: [CommonModule,
510
+ MatLegacyDialogModule,
511
+ MatToolbarModule,
512
+ MatLegacyButtonModule,
513
+ MatIconModule,
514
+ MatLegacyListModule,
515
+ MatLegacyProgressBarModule,
516
+ SkFrontLibModule] });
517
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SkUploaderModule, decorators: [{
518
+ type: NgModule,
519
+ args: [{
520
+ imports: [
521
+ CommonModule,
522
+ MatLegacyDialogModule,
523
+ MatToolbarModule,
524
+ MatLegacyButtonModule,
525
+ MatIconModule,
526
+ MatLegacyListModule,
527
+ MatLegacyProgressBarModule,
528
+ SkFrontLibModule
529
+ ],
530
+ declarations: [
531
+ SkUploaderComponent,
532
+ SkUploaderDirective
533
+ ],
534
+ exports: [
535
+ SkUploaderComponent,
536
+ SkUploaderDirective
537
+ ]
538
+ }]
539
+ }] });
540
+
541
+ /**
542
+ * Generated bundle index. Do not edit.
543
+ */
544
+
545
+ export { SkUploaderComponent, SkUploaderDirective, SkUploaderModule };
546
+ //# sourceMappingURL=sk-front-lib-uploader.mjs.map